Commit 5a125530 authored by Andrey Filippov's avatar Andrey Filippov

Before updates to conditioning images and filtering correlations by tile

average values.
parent e868199f
......@@ -171,7 +171,7 @@ public class EyesisCorrections {
if (!this.usedChannels[nChn]) this.pixelMapping.removeChannel(nChn);
}
}
int numUsedChannels=0;
int numUsedChannels=00;
for (int nChn=0;nChn< this.usedChannels.length; nChn++) if (this.usedChannels[nChn]) numUsedChannels++;
if (this.debugLevel>0) {
String sChannels="";
......@@ -739,6 +739,7 @@ public class EyesisCorrections {
};
}
ImageDtt.startAndJoin(threads);
return;
}
boolean [] usedChannels(String [] paths){
......
......@@ -709,7 +709,7 @@ public class BiQuadParameters {
gd.addMessage("ML output files export for LWIR16 camera");
gd.addCheckbox ("Add combo slice", this.mll_add_combo,
"Add combined correlations slice from all available pairs after rotation/scaling. Will not be used for training, can be removed to reduce processing time");
gd.addCheckbox ("Save interscene correlations", this.mll_save_accum,
gd.addCheckbox ("Save interscene correlations (no-shift)", this.mll_save_accum,
"Save interscene combination of correlations as used for GT calculation. Will not be used for training, can be removed to reduce processing time");
gd.addCheckbox ("Randomize disparity offsets", this.mll_randomize_offsets,
"Add random offset to the file-common disparity offset. The total disparity offset histogram is squared half-period of cosine"+
......
......@@ -2876,6 +2876,7 @@ public class ImageDtt extends ImageDttCPU {
final int debug_tileX,
final int debug_tileY,
final int threadsMax, // maximal number of threads to launch
final String debug_suffix,
final int globalDebugLevel)
{
final double disparity_scale = 1.0/Math.sqrt(2); // combo pixels -> disparity pixels
......@@ -3471,13 +3472,27 @@ public class ImageDtt extends ImageDttCPU {
}
startAndJoin(threads);
if (debug_lma != null) {
String suffix = (debug_suffix == null)?"":debug_suffix;
if (imgdtt_params.bimax_dual_LMA) {
System.out.println("Parameters that influence LMA results filtering:");
System.out.println("Reasons of failure is in the last slice (fail_reason) of the image.");
System.out.println("Reasons ar in the code of Cor2dLMA.lmaDisparityStrengths().");
System.out.println(" lmas_min_amp: "+imgdtt_params.lmas_min_amp);
System.out.println(" lmas_min_amp_bg: "+imgdtt_params.lmas_min_amp_bg);
System.out.println(" lmas_max_rel_rms: "+imgdtt_params.lmas_max_rel_rms);
System.out.println("lmas_min_strength: "+imgdtt_params.lmas_min_strength);
System.out.println(" lmas_min_max_ac: "+imgdtt_params.lmas_min_max_ac);
System.out.println(" lmas_min_min_ac: "+imgdtt_params.lmas_min_min_ac);
System.out.println(" lmas_max_area: "+imgdtt_params.lmas_max_area);
System.out.println(" lma_str_scale: "+imgdtt_params.lma_str_scale);
System.out.println(" lma_str_offset: "+imgdtt_params.lma_str_offset);
System.out.println(" lma_ac_offset: "+imgdtt_params.lma_ac_offset);
(new ShowDoubleFloatArrays()).showArrays(
debug_lma,
tilesX,
tilesY,
true,
"lma_debug_dual_LMA",
"lma_debug_dual_LMA-"+suffix,
debug_lma_titles
);
} else {
......@@ -3486,7 +3501,7 @@ public class ImageDtt extends ImageDttCPU {
tilesX,
tilesY,
true,
"lma_debug",
"lma_debug-"+suffix,
debug_lma_titles
);
}
......
......@@ -16403,6 +16403,7 @@ public class ImageDttCPU {
final int debug_tileX,
final int debug_tileY,
final int threadsMax, // maximal number of threads to launch
final String debug_suffix, // not yet implemented
final int globalDebugLevel)
{
if (correlation2d == null) {
......@@ -16810,6 +16811,7 @@ public class ImageDttCPU {
clt_parameters.tileX, // final int debug_tileX,
clt_parameters.tileY, // final int debug_tileY,
threadsMax, // final int threadsMax, // maximal number of threads to launch
null, // final String debug_suffix,
debugLevel + 2); // -1 ); // final int globalDebugLevel)
} else { // if ((this instanceof ImageDtt) && (getGPU() != null)) - CPU mode
......@@ -16871,6 +16873,7 @@ public class ImageDttCPU {
clt_parameters.tileX, // final int debug_tileX,
clt_parameters.tileY, // final int debug_tileY,
threadsMax, // final int threadsMax, // maximal number of threads to launch
null, // final String debug_suffix,
debugLevel + 2); // -1 ); // final int globalDebugLevel)
}
......
......@@ -222,7 +222,7 @@ public class ImageDttParameters {
public double lmas_min_amp = 0.1; // minimal ratio of minimal pair correlation amplitude to maximal pair correlation amplitude
public double lmas_min_amp_bg = 0.01; // same for background objects (all but fg)
public double lmas_max_rel_rms = 0.5; // 0.3; // LWIR16: 0.5 maximal relative (to average max/min amplitude LMA RMS) // May be up to 0.3)
public double lmas_min_strength = 1.0; // 1.1; // 0.7; // LWIR16: 0.4 minimal composite strength (sqrt(average amp squared over absolute RMS)
public double lmas_min_strength = 1.5; // 1.3; // 1.0;// TE was 1.0? // 1.1; // 0.7; // LWIR16: 0.4 minimal composite strength (sqrt(average amp squared over absolute RMS)
public double lmas_min_max_ac = 0.04; // 0.175; // 0.14; // LWIR16: 0.01 maximal of a and C coefficients minimum (measures sharpest point/line)
public double lmas_min_min_ac = 0.003; // LWIR16: 0.007 minimal of a and C coefficients minimum (measures sharpest point)
public double lmas_max_area = 45.0; // 30.0; // LWIR16: 0.0 maximal half-area (if > 0.0)
......
......@@ -136,6 +136,7 @@ public class IntersceneMatchParameters {
public double min_disparity = -0.15; // 0.2;
public double max_sym_disparity = 0.1; // 0.2;
// 2 next are wrong currently - minimal strength is ~0.25
public double min_strength_lma = 0.3; // no real filtering
public double min_strength_replace = 0.05; /// 0.14; /// Before /// - LWIR, after - RGB
public double min_strength_blur = 0.06; /// 0.2;
public double sigma = 2; /// 5;
......@@ -397,6 +398,8 @@ public class IntersceneMatchParameters {
gd.addNumericField("Disparity range for symmetrical pull", this.max_sym_disparity, 5,7,"pix",
"For larger disparities undefined tiles are pull predominantly down (to average of lowest), "+
"but for small disparities (sky) pull is to average of all neighbors.");
gd.addNumericField("Minimal strength LMA", this.min_strength_lma, 5,7,"",
"Lower strength for LMA tiles - treat as non-LMA");
gd.addNumericField("Minimal strength to replace", this.min_strength_replace, 5,7,"",
"Minimal strength to replace (now not used)");
gd.addNumericField("Minimal strength to blur", this.min_strength_blur, 5,7,"",
......@@ -786,6 +789,7 @@ public class IntersceneMatchParameters {
this.max_change = gd.getNextNumber();
this.min_disparity = gd.getNextNumber();
this.max_sym_disparity = gd.getNextNumber();
this.min_strength_lma = gd.getNextNumber();
this.min_strength_replace = gd.getNextNumber();
this.min_strength_blur = gd.getNextNumber();
this.sigma = gd.getNextNumber();
......@@ -1054,6 +1058,7 @@ public class IntersceneMatchParameters {
properties.setProperty(prefix+"max_change", this.max_change+""); // double
properties.setProperty(prefix+"min_disparity", this.min_disparity+""); // double
properties.setProperty(prefix+"max_sym_disparity", this.max_sym_disparity+""); // double
properties.setProperty(prefix+"min_strength_lma", this.min_strength_lma+""); // double
properties.setProperty(prefix+"min_strength_replace", this.min_strength_replace+""); // double
properties.setProperty(prefix+"min_strength_blur", this.min_strength_blur+""); // double
properties.setProperty(prefix+"sigma", this.sigma+""); // double
......@@ -1278,6 +1283,7 @@ public class IntersceneMatchParameters {
if (properties.getProperty(prefix+"max_change")!=null) this.max_change=Double.parseDouble(properties.getProperty(prefix+"max_change"));
if (properties.getProperty(prefix+"min_disparity")!=null) this.min_disparity=Double.parseDouble(properties.getProperty(prefix+"min_disparity"));
if (properties.getProperty(prefix+"max_sym_disparity")!=null) this.max_sym_disparity=Double.parseDouble(properties.getProperty(prefix+"max_sym_disparity"));
if (properties.getProperty(prefix+"min_strength_lma")!=null) this.min_strength_lma=Double.parseDouble(properties.getProperty(prefix+"min_strength_lma"));
if (properties.getProperty(prefix+"min_strength_replace")!=null) this.min_strength_replace=Double.parseDouble(properties.getProperty(prefix+"min_strength_replace"));
if (properties.getProperty(prefix+"min_strength_blur")!=null) this.min_strength_blur=Double.parseDouble(properties.getProperty(prefix+"min_strength_blur"));
if (properties.getProperty(prefix+"sigma")!=null) this.sigma=Double.parseDouble(properties.getProperty(prefix+"sigma"));
......@@ -1494,6 +1500,7 @@ public class IntersceneMatchParameters {
imp.max_change = this.max_change;
imp.min_disparity = this.min_disparity;
imp.max_sym_disparity = this.max_sym_disparity;
imp.min_strength_lma = this.min_strength_lma;
imp.min_strength_replace = this.min_strength_replace;
imp.min_strength_blur = this.min_strength_blur;
imp.sigma = this.sigma;
......
......@@ -1047,6 +1047,7 @@ public class MultisceneLY {
clt_parameters.tileX, // final int debug_tileX,
clt_parameters.tileY, // final int debug_tileY,
threadsMax, // final int threadsMax, // maximal number of threads to launch
null, // final String debug_suffix,
debug_level + 2); // -1 ); // final int globalDebugLevel)
ImageDtt.convertFcltCorr(
dcorr_tiles, // double [][][] dcorr_tiles,// [tile][sparse, correlation pair][(2*transform_size-1)*(2*transform_size-1)] // if null - will not calculate
......
......@@ -7487,7 +7487,7 @@ public class OpticalFlow {
for (int nt = 0; nt < target_disparity.length; nt++) if (selection[nt]) { // (!Double.isNaN(target_disparity[nt])){
num_tomeas++;
}
System.out.println ("nrefine pass = "+nrefine+", remaining "+num_tomeas+" tiles to re-measure");
System.out.println ("a. nrefine pass = "+nrefine+", remaining "+num_tomeas+" tiles to re-measure");
}
} else if (nrefine == (clt_parameters.rig.mll_max_refines_pre + clt_parameters.rig.mll_max_refines_lma)) {
clt_parameters.img_dtt.bimax_dual_only = true; // Camel-max tiles only
......@@ -7623,7 +7623,7 @@ public class OpticalFlow {
combo_dsn_titles); // dsrbg_titles);
}
if (debug_level > -2) {
System.out.println ("nrefine pass = "+nrefine+", remaining "+num_tomeas+" tiles to re-measure");
System.out.println ("b. nrefine pass = "+nrefine+", remaining "+num_tomeas+" tiles to re-measure");
}
if (num_tomeas == 0) {
break;
......@@ -8033,6 +8033,8 @@ public class OpticalFlow {
int tileStepX = clt_parameters.rig.mll_tileStepX; // 16;
int tileStepY = clt_parameters.rig.mll_tileStepY; // 16;
String suffix = clt_parameters.rig.mll_suffix; // "-ML";
boolean show_input = clt_parameters.img_dtt.lmamask_dbg; // true; // debug_level = -1;
double disp_ampl = Math.max(Math.abs(disparity_low),Math.abs(disparity_high));
// String suffix =ref_scene.correctionsParameters.mlDirectory; // now "ML32
......@@ -8057,6 +8059,18 @@ public class OpticalFlow {
ref_scene.getGPU());
image_dtt.getCorrelation2d(); // initiate image_dtt.correlation2d, needed if disparity_map != null
if (show_input) {
//COMBO_DSN_TITLES
(new ShowDoubleFloatArrays()).showArrays(
combo_dsn_final,
tilesX,
tilesY,
true,
"combo_dsn_final-"+ref_scene.getImageName(),
COMBO_DSN_TITLES); // dsrbg_titles);
}
if (save_accum) {
int mcorr_sel = Correlation2d.corrSelEncodeAll(0); // all sensors
float [][][] facc_2d_img = new float [1][][];
......@@ -10035,6 +10049,7 @@ public double[][] correlateIntersceneDebug( // only uses GPU and quad
clt_parameters.tileX, // final int debug_tileX,
clt_parameters.tileY, // final int debug_tileY,
threadsMax, // final int threadsMax, // maximal number of threads to launch
"reference", // final String debug_suffix,
debug_level + 2); // -1 ); // final int globalDebugLevel)
ImageDtt.convertFcltCorr(
dcorr_tiles, // double [][][] dcorr_tiles,// [tile][sparse, correlation pair][(2*transform_size-1)*(2*transform_size-1)] // if null - will not calculate
......@@ -10104,6 +10119,7 @@ public double[][] correlateIntersceneDebug( // only uses GPU and quad
clt_parameters.tileX, // final int debug_tileX,
clt_parameters.tileY, // final int debug_tileY,
threadsMax, // final int threadsMax, // maximal number of threads to launch
null, // final String debug_suffix,
debug_level + 2); // -1 ); // final int globalDebugLevel)
ImageDtt.convertFcltCorr(
dcorr_tiles, // double [][][] dcorr_tiles,// [tile][sparse, correlation pair][(2*transform_size-1)*(2*transform_size-1)] // if null - will not calculate
......@@ -10190,7 +10206,8 @@ public double[][] correlateIntersceneDebug( // only uses GPU and quad
clt_parameters.tileX, // final int debug_tileX,
clt_parameters.tileY, // final int debug_tileY,
threadsMax, // final int threadsMax, // maximal number of threads to launch
debug_level + 2); // -1 ); // final int globalDebugLevel)
"accumulated", // final String debug_suffix,
debug_level + 2); // -1 ); // final int globalDebugLevel)
ImageDtt.convertFcltCorr(
dcorr_tiles, // double [][][] dcorr_tiles,// [tile][sparse, correlation pair][(2*transform_size-1)*(2*transform_size-1)] // if null - will not calculate
fclt_corr); // float [][][] fclt_corr) // new float [tilesX * tilesY][][] or null
......@@ -10244,6 +10261,7 @@ public double[][] correlateIntersceneDebug( // only uses GPU and quad
clt_parameters.tileX, // final int debug_tileX,
clt_parameters.tileY, // final int debug_tileY,
threadsMax, // final int threadsMax, // maximal number of threads to launch
null, // final String debug_suffix,
debug_level + (show_reference_correlations? 2 : -1)); // final int globalDebugLevel)
ImageDttCPU.convertFcltCorr(
dcorr_tiles, // double [][][] dcorr_tiles,// [tile][sparse, correlation pair][(2*transform_size-1)*(2*transform_size-1)] // if null - will not calculate
......@@ -10418,6 +10436,7 @@ public double[][] correlateIntersceneDebug( // only uses GPU and quad
clt_parameters.tileX, // final int debug_tileX,
clt_parameters.tileY, // final int debug_tileY,
threadsMax, // final int threadsMax, // maximal number of threads to launch
null, // final String debug_suffix,
debug_level + 2); // -1 ); // final int globalDebugLevel)
ImageDtt.convertFcltCorr(
dcorr_tiles, // double [][][] dcorr_tiles,// [tile][sparse, correlation pair][(2*transform_size-1)*(2*transform_size-1)] // if null - will not calculate
......@@ -10479,6 +10498,7 @@ public double[][] correlateIntersceneDebug( // only uses GPU and quad
clt_parameters.tileX, // final int debug_tileX,
clt_parameters.tileY, // final int debug_tileY,
threadsMax, // final int threadsMax, // maximal number of threads to launch
null, // final String debug_suffix,
debug_level + 2); // -1 ); // final int globalDebugLevel)
image_dtt.convertFcltCorr(
dcorr_tiles, // double [][][] dcorr_tiles,// [tile][sparse, correlation pair][(2*transform_size-1)*(2*transform_size-1)] // if null - will not calculate
......@@ -11327,7 +11347,8 @@ public double[][] correlateIntersceneDebug( // only uses GPU and quad
int num_passes = 100;
double max_change = 1.0e-3;
double min_disparity = -0.2;
double max_sym_disparity = 0.2;
double max_sym_disparity = 0.2;
double min_strength_lma = 0.7; // weaker - treat as non-lma
double min_strength_replace = 0.05; /// 0.14; /// Before /// - LWIR, after - RGB
double min_strength_blur = 0.06; /// 0.2;
double sigma = 2; /// 5;
......@@ -11363,6 +11384,7 @@ public double[][] correlateIntersceneDebug( // only uses GPU and quad
max_change = clt_parameters.imp.max_change;
min_disparity = clt_parameters.imp.min_disparity;
max_sym_disparity = clt_parameters.imp.max_sym_disparity;
min_strength_lma = clt_parameters.imp.min_strength_lma;
min_strength_replace = clt_parameters.imp.min_strength_replace;
min_strength_blur = clt_parameters.imp.min_strength_blur;
sigma = clt_parameters.imp.sigma;
......@@ -11402,7 +11424,8 @@ public double[][] correlateIntersceneDebug( // only uses GPU and quad
num_passes, // final int num_passes,
max_change, // final double max_change,
min_disparity, // final double min_disparity,
max_sym_disparity, // final double max_sym_disparity,
max_sym_disparity, // final double max_sym_disparity,
min_strength_lma, // final double min_strength_lma,
min_strength_replace, // final double min_strength_replace,
min_strength_blur, // final double min_strength_blur,
sigma, // final double sigma,
......@@ -11444,6 +11467,7 @@ public double[][] correlateIntersceneDebug( // only uses GPU and quad
final double max_change,
final double min_disparity,
final double max_sym_disparity,
final double min_strength_lma, // remove weak LMA
final double min_strength_replace,
final double min_strength_blur,
final double sigma,
......@@ -11479,15 +11503,23 @@ public double[][] correlateIntersceneDebug( // only uses GPU and quad
final int transform_size = scene.getTileProcessor().getTileSize();
final int tiles =tilesX * tilesY;
String [] dbg_titles = {"str", "lma", "disp","-lma","by-lma","-nonlma", "few_weak", "old-disp","old-sngl","weak","filled"};
String [] dbg_titles = {"str", "lma", "clean-lma", "disp","-lma","by-lma","-nonlma", "few_weak", "old-disp","old-sngl","weak","filled"};
double [][] dbg_img = new double [dbg_titles.length][];
double [] clean_lma = dls[1].clone();
for (int i = 0; i <clean_lma.length; i++) {
if (dls[2][i] < min_strength_lma) {
clean_lma[i] = Double.NaN;
}
}
//Remove crazy LMA high-disparity tiles
dbg_img[0] = dls[2].clone();
dbg_img[1] = dls[1].clone();
dbg_img[2] = dls[00].clone();
dbg_img[2] = clean_lma.clone();
dbg_img[3] = dls[0].clone();
double [] disp_outliers = QuadCLT.removeDisparityLMAOutliers( // nothing removed (trying to remove bad LMA)
false, // final boolean non_ma,
dls, //final double [][] dls,
// dls, //final double [][] dls,
new double[][] {dls[1], dls[1], clean_lma}, //final double [][] dls,
outliers_lma_max_strength, // final double max_strength, // do not touch stronger
outliers_lma_nth_fromextrem, // final int nth_fromextrem, // 0 - compare to max/min. 1 - second max/min, ...
outliers_tolerance_absolute, // final double tolerance_absolute,
......@@ -11496,9 +11528,9 @@ public double[][] correlateIntersceneDebug( // only uses GPU and quad
outliers_max_iter, // final int max_iter,
threadsMax, // final int threadsMax,
debug_level); // final int debug_level)
dbg_img[3] = disp_outliers.clone();
dbg_img[4] = disp_outliers.clone();
disp_outliers = QuadCLT.removeDisparityOutliersByLMA( // removed sky, keeps sky edge near strong objects
new double[][] {disp_outliers, dls[1], dls[2]}, //final double [][] dls,
new double[][] {disp_outliers, dls[1], clean_lma}, //final double [][] dls,
outliers_from_lma_max_strength, // final double max_strength, // do not touch stronger
diff_from_lma_pos, // final double diff_from_lma_pos, // Difference from farthest FG objects (OK to have large, e.g. 100)
diff_from_lma_neg, // final double diff_from_lma_neg, // Difference from nearest BG objects (small, as FG are usually more visible)
......@@ -11507,11 +11539,11 @@ public double[][] correlateIntersceneDebug( // only uses GPU and quad
tilesX, // final int width, //tilesX
threadsMax, // final int threadsMax,
debug_level); // final int debug_level)
dbg_img[4] = disp_outliers.clone();
dbg_img[5] = disp_outliers.clone();
// mostly filter infinity, clouds, sky
disp_outliers = QuadCLT.removeDisparityLMAOutliers( // filter non-lma tiles // removed too few !!!
true, // final boolean non_ma,
new double[][] {disp_outliers, dls[1], dls[2]}, //final double [][] dls,
new double[][] {disp_outliers, dls[1], clean_lma}, //final double [][] dls,
outliers_max_strength, // final double max_strength, // do not touch stronger
outliers_nth_fromextrem, // final int nth_fromextrem, // 0 - compare to max/min. 1 - second max/min, ...
outliers_tolerance_absolute, // final double tolerance_absolute,
......@@ -11520,10 +11552,10 @@ public double[][] correlateIntersceneDebug( // only uses GPU and quad
outliers_max_iter, // final int max_iter,
threadsMax, // final int threadsMax,
debug_level); // final int debug_level)
dbg_img[5] = disp_outliers.clone();
dbg_img[6] = disp_outliers.clone();
disp_outliers = QuadCLT.removeFewWeak( // filter non-lma tiles // removed too few !!!
new double[][] {disp_outliers, dls[1], dls[2]}, //final double [][] dls,
new double[][] {disp_outliers, dls[1], clean_lma}, //final double [][] dls,
strong_strength, // final double strong,
weak_strength, // final double weak,
weak_min_neibs, // final int min_neibs,
......@@ -11534,10 +11566,10 @@ public double[][] correlateIntersceneDebug( // only uses GPU and quad
threadsMax, // final int threadsMax,
debug_level); // final int debug_level)
dbg_img[6] = disp_outliers.clone();
dbg_img[7] = disp_outliers.clone();
// Pre- 2022 filters, some may be obsolete
disp_outliers = QuadCLT.removeDisparityOutliers(
new double[][] {disp_outliers, dls[2]}, //final double [][] dls,
new double[][] {disp_outliers, clean_lma}, //final double [][] dls,
outliers_max_strength, // final double max_strength, // do not touch stronger
outliers_nth_fromextrem, // final int nth_fromextrem, // 0 - compare to max/min. 1 - second max/min, ...
outliers_tolerance_absolute, // final double tolerance_absolute,
......@@ -11547,10 +11579,10 @@ public double[][] correlateIntersceneDebug( // only uses GPU and quad
false, // final boolean fit_completely, // do not add tolerance when replacing
threadsMax, // final int threadsMax,
debug_level); // final int debug_level)
dbg_img[7] = disp_outliers.clone();
dbg_img[8] = disp_outliers.clone();
// remove extreme single-tile outliers (some may be strong - 0.404)
disp_outliers = QuadCLT.removeDisparityOutliers(
new double[][] {disp_outliers, dls[2]}, //final double [][] dls,
new double[][] {disp_outliers, clean_lma}, //final double [][] dls,
outliers_max_strength2, // final double max_strength, // do not touch stronger
outliers_nth_fromextrem2, // final int nth_fromextrem, // 0 - compare to max/min. 1 - second max/min, ...
outliers_tolerance_absolute2, // final double tolerance_absolute,
......@@ -11560,16 +11592,16 @@ public double[][] correlateIntersceneDebug( // only uses GPU and quad
false, // final boolean fit_completely, // do not add tolerance when replacing
threadsMax, // final int threadsMax,
debug_level); // final int debug_level)
dbg_img[8] = disp_outliers.clone();
dbg_img[9] = disp_outliers.clone();
double [] disp = QuadCLT.blurWeak(
new double[][] {disp_outliers, dls[2]}, //final double [][] dls,
new double[][] {disp_outliers, clean_lma}, //final double [][] dls,
min_strength_blur, // double min_strength_blur,
min_strength_replace, // double min_strength_replace,
num_blur, // int n,
tilesX, // int width,
sigma); // double sigma);
dbg_img[9] = disp.clone();
double [][] ds = {disp, dls[2]};
dbg_img[10] = disp.clone();
double [][] ds = {disp, clean_lma};
final double [][] ds_filled = QuadCLT.fillDisparityStrength(
ds, // final double [][] ds0,
min_disparity, // final double min_disparity,
......@@ -11580,9 +11612,9 @@ public double[][] correlateIntersceneDebug( // only uses GPU and quad
tilesX, // final int width,
threadsMax, // final int threadsMax,
debug_level); // final int debug_level)
dbg_img[10] = ds_filled[0].clone();
dbg_img[11] = ds_filled[0].clone();
if ((debug_level > 00)) {// && (clt_parameters.ofp.enable_debug_images)) {
if ((debug_level > 0)) {// && (clt_parameters.ofp.enable_debug_images)) {
(new ShowDoubleFloatArrays()).showArrays(
dbg_img,
tilesX,
......@@ -11611,7 +11643,8 @@ public double[][] correlateIntersceneDebug( // only uses GPU and quad
};
}
ImageDtt.startAndJoin(threads);
TpTask[] tp_tasks = GpuQuad.setInterTasks(
/// TpTask[] tp_tasks =
GpuQuad.setInterTasks(
scene.getNumSensors(),
scene.getGeometryCorrection().getSensorWH()[0],
!scene.hasGPU(), // final boolean calcPortsCoordinatesAndDerivatives, // GPU can calculate them centreXY
......@@ -12413,7 +12446,7 @@ public double[][] correlateIntersceneDebug( // only uses GPU and quad
debug_image_name,
mvTitles);
}
if (debug_level>0) {
if (debug_level > -2) { // 0
if (move_mask != null) {
int num_mov = 0;
for (int nTile=0; nTile<move_mask.length;nTile++) if (move_mask[nTile]) {
......@@ -12940,7 +12973,7 @@ public double[][] correlateIntersceneDebug( // only uses GPU and quad
break;
}
}
if (show_corr_fpn) { // repeat after last adjustment to get images
if (show_corr_fpn && (debug_level > -1)) { // now not needed, restore if needed
String [] fpn_dbg_titles = new String[2 + scene_QuadClt.getNumSensors() * 2];
fpn_dbg_titles[00] = "X_avg";
fpn_dbg_titles[1] = "X_avg";
......
......@@ -150,7 +150,6 @@ public class QuadCLTCPU {
boolean new_image_data = false;
boolean [][] saturation_imp = null; // (near) saturated pixels or null
boolean is_aux = false;
// boolean is_mono = false; // Use clt_kernels?
double [] lwir_offsets = null; // per image subtracted values
double lwir_offset = Double.NaN; // average of lwir_offsets[]
// hot and cold are calculated during autoranging (when generating 4 images for restored (added lwir_offset)
......@@ -8613,6 +8612,18 @@ public class QuadCLTCPU {
updateStatus,
debugLevel);
if ((debugLevel > -2) && (bgmask != null)) {
double [][] dbg_img = new double[1][tp.getTilesY() * tp.getTilesX()];
for (int i = 0; i<dbg_img[0].length;i++){
dbg_img[0][i] = bgmask[i]?1:0;
}
(new ShowDoubleFloatArrays()).showArrays(
dbg_img,
tp.getTilesX(),
tp.getTilesY(),
true, "bgmask");
}
ImagePlus imp_bgnd_int = getBackgroundImage( // null pointer
bgmask, // boolean [] bgnd_tiles,
clt_parameters,
......@@ -8794,7 +8805,7 @@ public class QuadCLTCPU {
System.out.println("new_meas.size()="+new_meas.size());
int indx = 0;
if (clt_parameters.show_macro) {
if ((debugLevel > -1) && clt_parameters.show_macro) {
for (CLTPass3d pass: new_meas) {
tp.showScan(
pass, // CLTPass3d scan,
......@@ -11886,13 +11897,13 @@ public class QuadCLTCPU {
2, // grow tile selection by 1 over non-background tiles 1: 4 directions, 2 - 8 directions, 3 - 8 by 1, 4 by 1 more
bgnd_tiles_grown2,
null); // prohibit
if (sdfa_instance!=null){
if (false && (sdfa_instance!=null)){
double [][] dbg_img = new double[5][tilesY * tilesX];
String [] titles = {"old","new","strict","grown","more_grown"};
for (int i = 0; i<dbg_img[0].length;i++){
//
dbg_img[0][i] = bgnd_dbg[i]?1:0;
dbg_img[1][i] = bgnd_tiles_new[i]?1:0;
dbg_img[1][i] = bgnd_tiles_new[i]?1:0; // null
dbg_img[2][i] = bgnd_strict[i]?1:0;
dbg_img[3][i] = bgnd_tiles_grown[i]?1:0;
dbg_img[4][i] = bgnd_tiles[i]?1:0;
......@@ -13311,6 +13322,7 @@ public class QuadCLTCPU {
clt_parameters.tileX, // final int debug_tileX,
clt_parameters.tileY, // final int debug_tileY,
threadsMax, // final int threadsMax, // maximal number of threads to launch
null, // final String debug_suffix,
debugLevel + 2+1); // -1 ); // final int globalDebugLevel)
} else {
......@@ -13344,6 +13356,7 @@ public class QuadCLTCPU {
clt_parameters.tileX, // final int debug_tileX,
clt_parameters.tileY, // final int debug_tileY,
threadsMax, // final int threadsMax, // maximal number of threads to launch
null, // final String debug_suffix,
debugLevel -1 ); // final int globalDebugLevel)
}
}
......
......@@ -150,7 +150,7 @@ public class TileProcessor {
this.trustedCorrelation = trustedCorrelation;
this.maxOverexposure = maxOverexposure;
this.threadsMax = threadsMax;
this.scan_titles = new String[SCAN_TITLES4.length + (this.numSensors-4)*6];
this.scan_titles = new String[SCAN_TITLES4.length + (this.numSensors-4)*6 + 1];
int idiff0 = getStringIndex("diff0", SCAN_TITLES4);
int idiff2max = getStringIndex("diff2max", SCAN_TITLES4);
int ir0 = getStringIndex("r0", SCAN_TITLES4);
......@@ -163,6 +163,7 @@ public class TileProcessor {
for (int i = 0; i < numSensors; i++) scan_titles[indx++] = "g"+i;
for (int i = 0; i < numSensors; i++) scan_titles[indx++] = "y"+i;
for (int i = 0; i < numSensors; i++) scan_titles[indx++] = "d"+i;
this.scan_titles[this.scan_titles.length-1] = "spread";
}
public TileProcessor(TileProcessor tp) {
......@@ -3629,6 +3630,8 @@ ImageDtt.startAndJoin(threads);
int i_diff2maxAvg = getScanTitleIndex("diff2maxAvg"); // 21 18*
int i_normStrength = getScanTitleIndex("normStrength"); // 22 19*
int i_overexp = getScanTitleIndex("overexp"); // 23 20*
int i_spread = getScanTitleIndex("spread"); // 23 20*
int i_getImgToneRGB = ImageDtt.getImgToneRGB(numSensors);
......@@ -3729,6 +3732,19 @@ ImageDtt.startAndJoin(threads);
}
}
}
dbg_img[i_spread] = new double [tlen];
for (int i = 0; i < tlen; i++){ // see spread - later zero correlation strength if spread > certain
double min_y=0, max_y=0;
for (int np = 0; np < numSensors; np++) {
if ((np == 0) || (dbg_img[this_IMG_TONE_RGB_DIFF+np][i] < min_y)) {
min_y = dbg_img[this_IMG_TONE_RGB_DIFF+np][i];
}
if ((np == 0) || (dbg_img[this_IMG_TONE_RGB_DIFF+np][i] > max_y)) {
max_y = dbg_img[this_IMG_TONE_RGB_DIFF+np][i];
}
}
dbg_img[i_spread][i] = (max_y - min_y)/(scale_diff* 0.5); // equals to y for mono
}
}
}
if (measured_only) {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment