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
......
......@@ -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