Commit 86106498 authored by Andrey Filippov's avatar Andrey Filippov

Before cleaning up terrain debugging

parent 84bd8cc0
...@@ -340,7 +340,7 @@ public class CLTParameters { ...@@ -340,7 +340,7 @@ public class CLTParameters {
public int lyms_clust_size = 4; // cluster size (same in both directions) for measuring LY data public int lyms_clust_size = 4; // cluster size (same in both directions) for measuring LY data
public double lyms_scene_range = 10.0; // disparity range for non-infinity in the same cluster public double lyms_scene_range = 10.0; // disparity range for non-infinity in the same cluster
public int lyms_min_num_inf = 10; // Minimal number of tiles (in all scenes total) in an infinity cluster public int lyms_min_num_inf = 10; // Minimal number of tiles (in all scenes total) in an infinity cluster
public boolean lyms_show_images = false; // show debug images in LY adjustment mode.
// old fcorr parameters, reuse? // old fcorr parameters, reuse?
...@@ -1553,6 +1553,9 @@ public class CLTParameters { ...@@ -1553,6 +1553,9 @@ public class CLTParameters {
properties.setProperty(prefix+"lyms_scene_range", this.lyms_scene_range +""); properties.setProperty(prefix+"lyms_scene_range", this.lyms_scene_range +"");
properties.setProperty(prefix+"lyms_min_num_inf", this.lyms_min_num_inf +""); properties.setProperty(prefix+"lyms_min_num_inf", this.lyms_min_num_inf +"");
properties.setProperty(prefix+"lyms_show_images", this.lyms_show_images +"");
properties.setProperty(prefix+"corr_magic_scale", this.corr_magic_scale +""); properties.setProperty(prefix+"corr_magic_scale", this.corr_magic_scale +"");
properties.setProperty(prefix+"corr_select", this.corr_select +""); properties.setProperty(prefix+"corr_select", this.corr_select +"");
...@@ -2608,6 +2611,7 @@ public class CLTParameters { ...@@ -2608,6 +2611,7 @@ public class CLTParameters {
if (properties.getProperty(prefix+"lyms_clust_size")!=null) this.lyms_clust_size=Integer.parseInt(properties.getProperty(prefix+"lyms_clust_size")); if (properties.getProperty(prefix+"lyms_clust_size")!=null) this.lyms_clust_size=Integer.parseInt(properties.getProperty(prefix+"lyms_clust_size"));
if (properties.getProperty(prefix+"lyms_scene_range")!=null) this.lyms_scene_range=Double.parseDouble(properties.getProperty(prefix+"lyms_scene_range")); if (properties.getProperty(prefix+"lyms_scene_range")!=null) this.lyms_scene_range=Double.parseDouble(properties.getProperty(prefix+"lyms_scene_range"));
if (properties.getProperty(prefix+"lyms_min_num_inf")!=null) this.lyms_min_num_inf=Integer.parseInt(properties.getProperty(prefix+"lyms_min_num_inf")); if (properties.getProperty(prefix+"lyms_min_num_inf")!=null) this.lyms_min_num_inf=Integer.parseInt(properties.getProperty(prefix+"lyms_min_num_inf"));
if (properties.getProperty(prefix+"lyms_show_images")!=null) this.lyms_show_images=Boolean.parseBoolean(properties.getProperty(prefix+"lyms_show_images"));
if (properties.getProperty(prefix+"corr_magic_scale")!=null) this.corr_magic_scale=Double.parseDouble(properties.getProperty(prefix+"corr_magic_scale")); if (properties.getProperty(prefix+"corr_magic_scale")!=null) this.corr_magic_scale=Double.parseDouble(properties.getProperty(prefix+"corr_magic_scale"));
if (properties.getProperty(prefix+"corr_select")!=null) this.corr_select=Integer.parseInt(properties.getProperty(prefix+"corr_select")); if (properties.getProperty(prefix+"corr_select")!=null) this.corr_select=Integer.parseInt(properties.getProperty(prefix+"corr_select"));
...@@ -3780,7 +3784,9 @@ public class CLTParameters { ...@@ -3780,7 +3784,9 @@ public class CLTParameters {
"Disparity range for non-infinity in the same cluster"); "Disparity range for non-infinity in the same cluster");
gd.addNumericField("Minimal number of infinity tiles", this.lyms_min_num_inf, 0,3,"", gd.addNumericField("Minimal number of infinity tiles", this.lyms_min_num_inf, 0,3,"",
"Minimal number of tiles (in all scenes total) in an infinity cluster"); "Minimal number of tiles (in all scenes total) in an infinity cluster");
gd.addCheckbox ("Show LY debug images", this.lyms_show_images,
"Show Lazy Eye debug images.");
gd.addTab ("Initial DSI", "Building initial (single-scene) DSI"); gd.addTab ("Initial DSI", "Building initial (single-scene) DSI");
gd.addMessage ("--- Filter tiles by inter-channel mismatch (requires photometic equalization) ---"); gd.addMessage ("--- Filter tiles by inter-channel mismatch (requires photometic equalization) ---");
...@@ -5194,6 +5200,7 @@ public class CLTParameters { ...@@ -5194,6 +5200,7 @@ public class CLTParameters {
this.lyms_clust_size= (int) gd.getNextNumber(); this.lyms_clust_size= (int) gd.getNextNumber();
this.lyms_scene_range= gd.getNextNumber(); this.lyms_scene_range= gd.getNextNumber();
this.lyms_min_num_inf=(int) gd.getNextNumber(); this.lyms_min_num_inf=(int) gd.getNextNumber();
this.lyms_show_images = gd.getNextBoolean();
this.mismatch_rgb= gd.getNextNumber(); this.mismatch_rgb= gd.getNextNumber();
this.mismatch_lwir= gd.getNextNumber(); this.mismatch_lwir= gd.getNextNumber();
......
...@@ -3331,7 +3331,7 @@ public class ImageDtt extends ImageDttCPU { ...@@ -3331,7 +3331,7 @@ public class ImageDtt extends ImageDttCPU {
npair); // int num_pair) npair); // int num_pair)
if (pair_width < 0.1) { if (pair_width < 0.1) {
if (globalDebugLevel > 1) { if (globalDebugLevel > 1) {
System.out.println("pair_width["+npair+"]="+pair_width); System.out.println("1.pair_width["+npair+"]="+pair_width);
} }
} else { } else {
weights[npair] /= Math.pow(pair_width, imgdtt_params.mcorr_weights_power); weights[npair] /= Math.pow(pair_width, imgdtt_params.mcorr_weights_power);
......
...@@ -8858,7 +8858,7 @@ public class ImageDttCPU { ...@@ -8858,7 +8858,7 @@ public class ImageDttCPU {
} }
} }
if (ilayers < 0) { // assuming each defined tile has the same number of layers and non-null layers if (ilayers < 0) { // assuming each defined tile has the same number of layers and non-null layers
System.out.println("corr_partial_dbg(): empty fcorr_data, all nulls"); System.out.println("corr_partial_dbg(): empty fcorr_data, all nulls 1");
return null; return null;
} }
...@@ -8935,7 +8935,7 @@ public class ImageDttCPU { ...@@ -8935,7 +8935,7 @@ public class ImageDttCPU {
} }
if (ilayers < 0) { // assuming each defined tile has the same number of layers and non-null layers if (ilayers < 0) { // assuming each defined tile has the same number of layers and non-null layers
System.out.println("corr_partial_dbg(): empty fcorr_data, all nulls"); System.out.println("corr_partial_dbg(): empty fcorr_data, all nulls 2");
return null; return null;
} }
...@@ -16521,7 +16521,7 @@ public class ImageDttCPU { ...@@ -16521,7 +16521,7 @@ public class ImageDttCPU {
npair); // int num_pair) npair); // int num_pair)
if (pair_width < 0.1) { if (pair_width < 0.1) {
if (globalDebugLevel > 1) { if (globalDebugLevel > 1) {
System.out.println("pair_width["+npair+"]="+pair_width); System.out.println("2.pair_width["+npair+"]="+pair_width);
} }
} else { } else {
weights[npair] /= Math.pow(pair_width, imgdtt_params.mcorr_weights_power); weights[npair] /= Math.pow(pair_width, imgdtt_params.mcorr_weights_power);
......
...@@ -589,6 +589,7 @@ public class MultisceneLY { ...@@ -589,6 +589,7 @@ public class MultisceneLY {
final int nrefine, // number of disparity refines for non-inf final int nrefine, // number of disparity refines for non-inf
final int threadsMax, final int threadsMax,
final int debug_level){ final int debug_level){
boolean show_images = clt_parameters.lyms_show_images;
final double [][][] inf_noinf_lazy_eye_data = new double [2][][]; final double [][][] inf_noinf_lazy_eye_data = new double [2][][];
int last_scene_index = scenes.length-1; int last_scene_index = scenes.length-1;
QuadCLT last_scene = scenes[last_scene_index]; QuadCLT last_scene = scenes[last_scene_index];
...@@ -628,7 +629,6 @@ public class MultisceneLY { ...@@ -628,7 +629,6 @@ public class MultisceneLY {
} }
} }
} }
inf_noinf_lazy_eye_data[0] = MultisceneLY.getLYData( // TODO: show lazy_eye_data[][] inf_noinf_lazy_eye_data[0] = MultisceneLY.getLYData( // TODO: show lazy_eye_data[][]
clt_parameters, // final CLTParameters clt_parameters, clt_parameters, // final CLTParameters clt_parameters,
clt_parameters.lyms_clust_size, // final int clust_size, clt_parameters.lyms_clust_size, // final int clust_size,
...@@ -638,7 +638,7 @@ public class MultisceneLY { ...@@ -638,7 +638,7 @@ public class MultisceneLY {
corr_vector_delta, // final CorrVector corr_vector_delta, // null or extrinsic vector offset, applied to all scenes corr_vector_delta, // final CorrVector corr_vector_delta, // null or extrinsic vector offset, applied to all scenes
threadsMax, // final int threadsMax, threadsMax, // final int threadsMax,
debug_level, // final int debug_level); debug_level, // final int debug_level);
((debug_level >-2)?"INF":null)); // String debug_suffix); (show_images?(last_scene.getImageName()+"-INF"):null)); // String debug_suffix);
// now for non-infinity: // now for non-infinity:
double [][] target_disparities_noinf = MultisceneLY.useTilesLY( double [][] target_disparities_noinf = MultisceneLY.useTilesLY(
clt_parameters.lyms_clust_size, // final int clust_size, clt_parameters.lyms_clust_size, // final int clust_size,
...@@ -672,16 +672,16 @@ public class MultisceneLY { ...@@ -672,16 +672,16 @@ public class MultisceneLY {
corr_vector_delta, // final CorrVector corr_vector_delta, // null or extrinsic vector offset, applied to all scenes corr_vector_delta, // final CorrVector corr_vector_delta, // null or extrinsic vector offset, applied to all scenes
threadsMax, // final int threadsMax, threadsMax, // final int threadsMax,
debug_level, // final int debug_level); debug_level, // final int debug_level);
((debug_level >-2)?"NOINF":null)); // String debug_suffix); (show_images?(last_scene.getImageName()+"-NOINF"):null)); // String debug_suffix);
if (debug) { if (show_images) {
showLY( showLY(
clt_parameters, // CLTParameters clt_parameters, clt_parameters, // CLTParameters clt_parameters,
last_scene.getGeometryCorrection(), // GeometryCorrection gc, last_scene.getGeometryCorrection(), // GeometryCorrection gc,
clustersX, // int clustersX, clustersX, // int clustersX,
clustersY, // int clustersY, clustersY, // int clustersY,
inf_noinf_lazy_eye_data[1], // double [][] ly_data, inf_noinf_lazy_eye_data[1], // double [][] ly_data,
"LY_noinf-initial"); // String title); last_scene.getImageName()+"-LY_noinf-initial"); // String title);
} }
for (int n = 0; n < nrefine; n++) { for (int n = 0; n < nrefine; n++) {
...@@ -701,16 +701,16 @@ public class MultisceneLY { ...@@ -701,16 +701,16 @@ public class MultisceneLY {
corr_vector_delta, // final CorrVector corr_vector_delta, // null or extrinsic vector offset, applied to all scenes corr_vector_delta, // final CorrVector corr_vector_delta, // null or extrinsic vector offset, applied to all scenes
threadsMax, // final int threadsMax, threadsMax, // final int threadsMax,
debug_level, // final int debug_level); debug_level, // final int debug_level);
((debug_level >-2)?("NOINF"+n):null)); // String debug_suffix); (show_images?("NOINF"+n):null)); // String debug_suffix);
if (debug) { if (show_images) {
showLY( showLY(
clt_parameters, // CLTParameters clt_parameters, clt_parameters, // CLTParameters clt_parameters,
last_scene.getGeometryCorrection(), // GeometryCorrection gc, last_scene.getGeometryCorrection(), // GeometryCorrection gc,
clustersX, // int clustersX, clustersX, // int clustersX,
clustersY, // int clustersY, clustersY, // int clustersY,
inf_noinf_lazy_eye_data[1], // double [][] ly_data, inf_noinf_lazy_eye_data[1], // double [][] ly_data,
"LY_noinf-"+n); // String title); last_scene.getImageName()+"-LY_noinf-"+n); // String title);
} }
} }
...@@ -906,10 +906,15 @@ public class MultisceneLY { ...@@ -906,10 +906,15 @@ public class MultisceneLY {
scene.saveQuadClt(); // to re-load new set of Bayer images to the GPU (do nothing for CPU) scene.saveQuadClt(); // to re-load new set of Bayer images to the GPU (do nothing for CPU)
scene. gpuResetCorrVector(); // is it needed - no, it is included in above scene. gpuResetCorrVector(); // is it needed - no, it is included in above
if (debug_level > -2) { if (debug_level > -2) {
if (nscene == 0 ) {
System.out.print("Correlating scene ");
}
if (nscene == last_scene_index) { if (nscene == last_scene_index) {
System.out.println("Correlating last scene"); // System.out.println("Correlating last scene");
System.out.println("last");
} else { } else {
System.out.println("Correlating scene "+nscene); // System.out.println("Correlating scene "+nscene);
System.out.print(nscene+" ");
} }
} }
double [][] disparity_array = new double[tilesY][tilesX]; double [][] disparity_array = new double[tilesY][tilesX];
...@@ -1018,10 +1023,14 @@ public class MultisceneLY { ...@@ -1018,10 +1023,14 @@ public class MultisceneLY {
// Need to initialize and update tp_tasks_combo from GPU // Need to initialize and update tp_tasks_combo from GPU
image_dtt.setUpdateTasksGPU( image_dtt.setUpdateTasksGPU(
tp_tasks_combo); // final TpTask[] tp_tasks tp_tasks_combo); // final TpTask[] tp_tasks
double [][][] dcorr_tiles = show_corr? (new double [tp_tasks_combo.length][][]):null; double [][][] dcorr_tiles = show_corr? (new double [tp_tasks_combo.length][][]):null;
final double[][] disparity_map = new double [image_dtt.getDisparityTitles().length][]; final double[][] disparity_map = new double [image_dtt.getDisparityTitles().length][];
final double [][][][] ddnd = new double [tilesY][tilesX][][]; final double [][][][] ddnd = new double [tilesY][tilesX][][];
boolean run_ly_lma = clt_parameters.imp.run_ly_lma;
if (!run_ly_lma) {
System.out.println("getLYData(): run_ly_lma is false, it should be true. Set it in clt_parameters.imp.run_ly_lma . Temporarily overwriting configuration using true");
run_ly_lma = true;
}
// Does not use disparity_map[DISPARITY_STRENGTH_INDEX] // Does not use disparity_map[DISPARITY_STRENGTH_INDEX]
image_dtt.clt_process_tl_correlations( // convert to pixel domain and process correlations already prepared in fcorr_td and/or fcorr_combo_td image_dtt.clt_process_tl_correlations( // convert to pixel domain and process correlations already prepared in fcorr_td and/or fcorr_combo_td
clt_parameters.img_dtt, // final ImageDttParameters imgdtt_params, // Now just extra correlation parameters, later will include, most others clt_parameters.img_dtt, // final ImageDttParameters imgdtt_params, // Now just extra correlation parameters, later will include, most others
...@@ -1045,7 +1054,7 @@ public class MultisceneLY { ...@@ -1045,7 +1054,7 @@ public class MultisceneLY {
//optional, may be null //optional, may be null
disparity_map, // final double [][] disparity_map, // [8][tilesY][tilesX], only [6][] is needed on input or null - do not calculate disparity_map, // final double [][] disparity_map, // [8][tilesY][tilesX], only [6][] is needed on input or null - do not calculate
ddnd, // [tilesY][tilesX][num_sensors][2] data for LY. Should be either null or [tilesY][tilesX][][]. disparity_map should be non-null ddnd, // [tilesY][tilesX][num_sensors][2] data for LY. Should be either null or [tilesY][tilesX][][]. disparity_map should be non-null
clt_parameters.imp.run_ly_lma, // correlate_lma, // final boolean run_lma, // calculate LMA, false - CM only run_ly_lma, // correlate_lma, // final boolean run_lma, // calculate LMA, false - CM only
// define combining of all 2D correlation pairs for CM (LMA does not use them) // define combining of all 2D correlation pairs for CM (LMA does not use them)
clt_parameters.img_dtt.mcorr_comb_width, //final int mcorr_comb_width, // combined correlation tile width (set <=0 to skip combined correlations) clt_parameters.img_dtt.mcorr_comb_width, //final int mcorr_comb_width, // combined correlation tile width (set <=0 to skip combined correlations)
clt_parameters.img_dtt.mcorr_comb_height,//final int mcorr_comb_height, // combined correlation tile full height clt_parameters.img_dtt.mcorr_comb_height,//final int mcorr_comb_height, // combined correlation tile full height
...@@ -1111,7 +1120,7 @@ public class MultisceneLY { ...@@ -1111,7 +1120,7 @@ public class MultisceneLY {
wh[0], wh[0],
wh[1], wh[1],
true, true,
"disparity_map_decimated"+"-"+debug_suffix, last_scene.getImageName()+"disparity_map_decimated"+"-"+debug_suffix,
ImageDtt.getDisparityTitles(last_scene.getNumSensors(),last_scene.isMonochrome()) // ImageDtt.DISPARITY_TITLES ImageDtt.getDisparityTitles(last_scene.getNumSensors(),last_scene.isMonochrome()) // ImageDtt.DISPARITY_TITLES
); );
...@@ -1495,7 +1504,7 @@ public class MultisceneLY { ...@@ -1495,7 +1504,7 @@ public class MultisceneLY {
300, // 2.943408022525927E-0, // 4, // 17 10000x vy 300, // 2.943408022525927E-0, // 4, // 17 10000x vy
500.0}; // 390.6185365641268}; //4}; // 18 100000x vz 500.0}; // 390.6185365641268}; //4}; // 18 100000x vz
// delta = 0.001; // should be 0.001 // delta = 0.001; // should be 0.001
final boolean debug_img = false; // true; // false; final boolean debug_img = clt_parameters.lyms_show_images; // true; // false;
final int last_scene_index = scenes.length-1; final int last_scene_index = scenes.length-1;
final QuadCLT last_scene = scenes[last_scene_index]; final QuadCLT last_scene = scenes[last_scene_index];
final int numSens = last_scene.getNumSensors(); final int numSens = last_scene.getNumSensors();
...@@ -1559,7 +1568,7 @@ public class MultisceneLY { ...@@ -1559,7 +1568,7 @@ public class MultisceneLY {
for (int nly = 0; nly < ly_initial2.length; nly++) if (ly_initial2[nly] != null ) { for (int nly = 0; nly < ly_initial2.length; nly++) if (ly_initial2[nly] != null ) {
ea.showInput( ea.showInput(
ly_initial2[nly], // double[][] data, ly_initial2[nly], // double[][] data,
"drv_reference-"+SINF_NOINF[nly]);// String title); last_scene.getImageName()+"-drv_reference-"+SINF_NOINF[nly]);// String title);
} }
System.out.println("Initial:\n"+last_scene.getGeometryCorrection().getCorrVector().toString(true)); // true - short out System.out.println("Initial:\n"+last_scene.getGeometryCorrection().getCorrVector().toString(true)); // true - short out
double min_strength = 0.1; // 0.23 double min_strength = 0.1; // 0.23
...@@ -1609,7 +1618,7 @@ public class MultisceneLY { ...@@ -1609,7 +1618,7 @@ public class MultisceneLY {
for (int nly = 0; nly < ly2.length; nly++) if (ly2[nly] != null ) { for (int nly = 0; nly < ly2.length; nly++) if (ly2[nly] != null ) {
ea.showInput( ea.showInput(
ly2[nly], // double[][] data, ly2[nly], // double[][] data,
"drv_par-"+SINF_NOINF[nly]);// String title); last_scene.getImageName()+"-drv_par-"+SINF_NOINF[nly]);// String title);
} }
} }
...@@ -1660,8 +1669,7 @@ public class MultisceneLY { ...@@ -1660,8 +1669,7 @@ public class MultisceneLY {
clustersX, clustersX,
clustersY, clustersY,
true, true,
"ND_test_npar-_"+npar+"-"+SINF_NOINF[nly], last_scene.getImageName()+"-ND_test_npar-_"+npar+"-"+SINF_NOINF[nly], sens_titles);
sens_titles);
} }
} }
} }
......
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