Commit 37f405a5 authored by Andrey Filippov's avatar Andrey Filippov

Implemented MPO export for EO/LWIR dual-quad rig

parent 26cdc535
...@@ -149,6 +149,7 @@ public class EyesisCorrectionParameters { ...@@ -149,6 +149,7 @@ public class EyesisCorrectionParameters {
public boolean clt_batch_extrinsic = false; // Calibrate extrinsic parameters for each set public boolean clt_batch_extrinsic = false; // Calibrate extrinsic parameters for each set
public boolean clt_batch_poly = false; // Calculate fine polynomial correction for each set public boolean clt_batch_poly = false; // Calculate fine polynomial correction for each set
public boolean clt_batch_4img = true; // Create a set of 4 images, usually for disparity = 0 public boolean clt_batch_4img = true; // Create a set of 4 images, usually for disparity = 0
public boolean clt_batch_4img_aux = true; // Create a set of 4 images, usually for disparity = 0 for AUX camera
public boolean clt_batch_explore = true; // 1-st step of 3d reconstruction - explore disparities for each tile public boolean clt_batch_explore = true; // 1-st step of 3d reconstruction - explore disparities for each tile
public boolean clt_batch_surf = true; // Create super-tile 2.5d surfaces public boolean clt_batch_surf = true; // Create super-tile 2.5d surfaces
public boolean clt_batch_assign = true; // Assign tiles to surfaces public boolean clt_batch_assign = true; // Assign tiles to surfaces
...@@ -286,6 +287,7 @@ public class EyesisCorrectionParameters { ...@@ -286,6 +287,7 @@ public class EyesisCorrectionParameters {
cp.clt_batch_extrinsic= this.clt_batch_extrinsic; cp.clt_batch_extrinsic= this.clt_batch_extrinsic;
cp.clt_batch_poly= this.clt_batch_poly; cp.clt_batch_poly= this.clt_batch_poly;
cp.clt_batch_4img= this.clt_batch_4img; cp.clt_batch_4img= this.clt_batch_4img;
cp.clt_batch_4img_aux= this.clt_batch_4img_aux;
cp.clt_batch_explore= this.clt_batch_explore; cp.clt_batch_explore= this.clt_batch_explore;
cp.clt_batch_surf= this.clt_batch_surf; cp.clt_batch_surf= this.clt_batch_surf;
cp.clt_batch_assign= this.clt_batch_assign; cp.clt_batch_assign= this.clt_batch_assign;
...@@ -461,6 +463,7 @@ public class EyesisCorrectionParameters { ...@@ -461,6 +463,7 @@ public class EyesisCorrectionParameters {
properties.setProperty(prefix+"clt_batch_extrinsic", this.clt_batch_extrinsic+""); properties.setProperty(prefix+"clt_batch_extrinsic", this.clt_batch_extrinsic+"");
properties.setProperty(prefix+"clt_batch_poly", this.clt_batch_poly+""); properties.setProperty(prefix+"clt_batch_poly", this.clt_batch_poly+"");
properties.setProperty(prefix+"clt_batch_4img", this.clt_batch_4img+""); properties.setProperty(prefix+"clt_batch_4img", this.clt_batch_4img+"");
properties.setProperty(prefix+"clt_batch_4img_aux", this.clt_batch_4img_aux+"");
properties.setProperty(prefix+"clt_batch_explore", this.clt_batch_explore+""); properties.setProperty(prefix+"clt_batch_explore", this.clt_batch_explore+"");
properties.setProperty(prefix+"clt_batch_surf", this.clt_batch_surf+""); properties.setProperty(prefix+"clt_batch_surf", this.clt_batch_surf+"");
properties.setProperty(prefix+"clt_batch_assign", this.clt_batch_assign+""); properties.setProperty(prefix+"clt_batch_assign", this.clt_batch_assign+"");
...@@ -616,6 +619,7 @@ public class EyesisCorrectionParameters { ...@@ -616,6 +619,7 @@ public class EyesisCorrectionParameters {
if (properties.getProperty(prefix+"clt_batch_extrinsic")!= null) this.clt_batch_extrinsic=Boolean.parseBoolean(properties.getProperty(prefix+"clt_batch_extrinsic")); if (properties.getProperty(prefix+"clt_batch_extrinsic")!= null) this.clt_batch_extrinsic=Boolean.parseBoolean(properties.getProperty(prefix+"clt_batch_extrinsic"));
if (properties.getProperty(prefix+"clt_batch_poly")!= null) this.clt_batch_poly=Boolean.parseBoolean(properties.getProperty(prefix+"clt_batch_poly")); if (properties.getProperty(prefix+"clt_batch_poly")!= null) this.clt_batch_poly=Boolean.parseBoolean(properties.getProperty(prefix+"clt_batch_poly"));
if (properties.getProperty(prefix+"clt_batch_4img")!= null) this.clt_batch_4img=Boolean.parseBoolean(properties.getProperty(prefix+"clt_batch_4img")); if (properties.getProperty(prefix+"clt_batch_4img")!= null) this.clt_batch_4img=Boolean.parseBoolean(properties.getProperty(prefix+"clt_batch_4img"));
if (properties.getProperty(prefix+"clt_batch_4img_aux")!= null) this.clt_batch_4img_aux=Boolean.parseBoolean(properties.getProperty(prefix+"clt_batch_4img_aux"));
if (properties.getProperty(prefix+"clt_batch_explore")!= null) this.clt_batch_explore=Boolean.parseBoolean(properties.getProperty(prefix+"clt_batch_explore")); if (properties.getProperty(prefix+"clt_batch_explore")!= null) this.clt_batch_explore=Boolean.parseBoolean(properties.getProperty(prefix+"clt_batch_explore"));
if (properties.getProperty(prefix+"clt_batch_surf")!= null) this.clt_batch_surf=Boolean.parseBoolean(properties.getProperty(prefix+"clt_batch_surf")); if (properties.getProperty(prefix+"clt_batch_surf")!= null) this.clt_batch_surf=Boolean.parseBoolean(properties.getProperty(prefix+"clt_batch_surf"));
if (properties.getProperty(prefix+"clt_batch_assign")!= null) this.clt_batch_assign=Boolean.parseBoolean(properties.getProperty(prefix+"clt_batch_assign")); if (properties.getProperty(prefix+"clt_batch_assign")!= null) this.clt_batch_assign=Boolean.parseBoolean(properties.getProperty(prefix+"clt_batch_assign"));
...@@ -983,6 +987,7 @@ public class EyesisCorrectionParameters { ...@@ -983,6 +987,7 @@ public class EyesisCorrectionParameters {
gd.addCheckbox ("Calibrate extrinsic parameters for each set", this.clt_batch_extrinsic); // 22 gd.addCheckbox ("Calibrate extrinsic parameters for each set", this.clt_batch_extrinsic); // 22
gd.addCheckbox ("Calculate fine polynomial correction for each set", this.clt_batch_poly); // 23 gd.addCheckbox ("Calculate fine polynomial correction for each set", this.clt_batch_poly); // 23
gd.addCheckbox ("Create a set of 4 images, usually for disparity = 0", this.clt_batch_4img); // 24 gd.addCheckbox ("Create a set of 4 images, usually for disparity = 0", this.clt_batch_4img); // 24
gd.addCheckbox ("Create a set of 4 images for AUX (LWIR) camera", this.clt_batch_4img_aux); // 24
gd.addCheckbox ("1-st step of 3d reconstruction - explore disparities for each tile", this.clt_batch_explore); // 25 gd.addCheckbox ("1-st step of 3d reconstruction - explore disparities for each tile", this.clt_batch_explore); // 25
gd.addCheckbox ("Create super-tile 2.5d surfaces", this.clt_batch_surf); // 26 gd.addCheckbox ("Create super-tile 2.5d surfaces", this.clt_batch_surf); // 26
gd.addCheckbox ("Assign tiles to surfaces", this.clt_batch_assign); // 27 gd.addCheckbox ("Assign tiles to surfaces", this.clt_batch_assign); // 27
...@@ -993,8 +998,9 @@ public class EyesisCorrectionParameters { ...@@ -993,8 +998,9 @@ public class EyesisCorrectionParameters {
gd.addCheckbox ("Create DSI combo image", this.clt_batch_dsi, gd.addCheckbox ("Create DSI combo image", this.clt_batch_dsi,
"Save main camera, dual-quad rig and optionally aux camera combo DSI image with the model"); "Save main camera, dual-quad rig and optionally aux camera combo DSI image with the model");
gd.addCheckbox ("Include aux camera DSI data in the combo DSI", this.clt_batch_dsi_aux, gd.addCheckbox ("Include/genarate separate aux camera DSI data in the combo DSI", this.clt_batch_dsi_aux,
"Currently DSI for the AUX camera is offset (by the rig baseline) from the main and rig DSI. Aux DSI requires extra processing time"); "8-rig: DSI for the AUX camera is offset (by the rig baseline) from the main and rig DSI. Aux DSI requires extra processing time."+
" EO+LWIR - generate a separate GT+AUX file");
gd.addCheckbox ("Save field adjustment data with the model", this.clt_batch_save_extrinsics, gd.addCheckbox ("Save field adjustment data with the model", this.clt_batch_save_extrinsics,
"This data can be used to restore specific filed-adjusted cameras extrinsics used when the model was generated"); "This data can be used to restore specific filed-adjusted cameras extrinsics used when the model was generated");
gd.addCheckbox ("Save all parameters with the model", this.clt_batch_save_all, gd.addCheckbox ("Save all parameters with the model", this.clt_batch_save_all,
...@@ -1073,6 +1079,7 @@ public class EyesisCorrectionParameters { ...@@ -1073,6 +1079,7 @@ public class EyesisCorrectionParameters {
this.clt_batch_extrinsic= gd.getNextBoolean(); // 22 this.clt_batch_extrinsic= gd.getNextBoolean(); // 22
this.clt_batch_poly= gd.getNextBoolean(); // 23 this.clt_batch_poly= gd.getNextBoolean(); // 23
this.clt_batch_4img= gd.getNextBoolean(); // 24 this.clt_batch_4img= gd.getNextBoolean(); // 24
this.clt_batch_4img_aux= gd.getNextBoolean(); // 24
this.clt_batch_explore= gd.getNextBoolean(); // 25 this.clt_batch_explore= gd.getNextBoolean(); // 25
this.clt_batch_surf= gd.getNextBoolean(); // 26 this.clt_batch_surf= gd.getNextBoolean(); // 26
this.clt_batch_assign= gd.getNextBoolean(); // 27 this.clt_batch_assign= gd.getNextBoolean(); // 27
......
...@@ -5231,16 +5231,16 @@ private Panel panel1, ...@@ -5231,16 +5231,16 @@ private Panel panel1,
ds[l][i] = f_ds[l][i]; ds[l][i] = f_ds[l][i];
} }
} }
String [] titles = {"disparity","strength"}; String [] rslt_titles = split_fg_bg ? QuadCLT.FGBG_TITLES_AUX :QuadCLT.FGBG_TITLES_ADJ; // last 2 will be 0;
(new ShowDoubleFloatArrays()) .showArrays(ds, width, height, true, title, titles);
(new ShowDoubleFloatArrays()) .showArrays(ds, width, height, true, title, QuadCLT.FGBG_TITLES_ADJ);
int tile_size = CLT_PARAMETERS.transform_size; int tile_size = CLT_PARAMETERS.transform_size;
int [] wh_aux = QUAD_CLT_AUX.getGeometryCorrection().getSensorWH(); int [] wh_aux = QUAD_CLT_AUX.getGeometryCorrection().getSensorWH();
int tilesX_aux = wh_aux[0] / tile_size; int tilesX_aux = wh_aux[0] / tile_size;
int tilesY_aux = wh_aux[1] / tile_size; int tilesY_aux = wh_aux[1] / tile_size;
// int num_slices = split_fg_bg? 7:2; // int num_slices = split_fg_bg? 7:2;
String [] fgbg_titles = {"disparity","strength", "rms","rms-split","fg-disp","fg-str","bg-disp","bg-str"};
String [] rslt_titles = split_fg_bg ? fgbg_titles :titles;
double [][] ds_aux = QUAD_CLT_AUX.depthMapMainToAux( double [][] ds_aux = QUAD_CLT_AUX.depthMapMainToAux(
ds, // double [][] ds, ds, // double [][] ds,
......
...@@ -2202,18 +2202,18 @@ B = |+dy0 -dy1 -2*dy3 | ...@@ -2202,18 +2202,18 @@ B = |+dy0 -dy1 -2*dy3 |
int [] pq = per_quad.clone(); int [] pq = per_quad.clone();
Arrays.sort(per_quad); Arrays.sort(per_quad);
if (debugLevel > -20) { if (debugLevel > -20) {
System.out.print(String.format("Tiles per quadrants :[%d, %d, %d, %d], tiles at infinity %d", pq[0],pq[1],pq[2],pq[3],num_inf)); System.out.println(String.format("Tiles per quadrants :[%d, %d, %d, %d], tiles at infinity %d", pq[0],pq[1],pq[2],pq[3],num_inf));
} }
if (per_quad[1] < min_per_quadrant) { if (per_quad[1] < min_per_quadrant) {
if (debugLevel > -20) { if (debugLevel > -20) {
System.out.print(String.format("Too few tiles in quadrants :[%d, %d, %d, %d], minimum for the second worst is %d", pq[0],pq[1],pq[2],pq[3],min_per_quadrant)); System.out.println(String.format("Too few tiles in quadrants :[%d, %d, %d, %d], minimum for the second worst is %d", pq[0],pq[1],pq[2],pq[3],min_per_quadrant));
} }
return null; return null;
} }
if (num_inf < min_inf) { if (num_inf < min_inf) {
if (debugLevel > -20) { if (debugLevel > -20) {
System.out.print(String.format("Too few tiles at infinity: %d minimum is %d", num_inf, min_inf)); System.out.println(String.format("Too few tiles at infinity: %d minimum is %d", num_inf, min_inf));
} }
return null; return null;
} }
...@@ -2810,19 +2810,19 @@ B = |+dy0 -dy1 -2*dy3 | ...@@ -2810,19 +2810,19 @@ B = |+dy0 -dy1 -2*dy3 |
Arrays.sort(per_quad); Arrays.sort(per_quad);
if (per_quad[1] < min_per_quadrant) { if (per_quad[1] < min_per_quadrant) {
if (debugLevel > -20) { if (debugLevel > -20) {
System.out.print(String.format("Too few tiles in quadrants :[%d, %d, %d, %d], minimum for the second worst is %d", pq[0],pq[1],pq[2],pq[3],min_per_quadrant)); System.out.println(String.format("Too few tiles in quadrants :[%d, %d, %d, %d], minimum for the second worst is %d", pq[0],pq[1],pq[2],pq[3],min_per_quadrant));
} }
return null; return null;
} }
if (num_inf < min_inf) { if (num_inf < min_inf) {
if (debugLevel > -20) { if (debugLevel > -20) {
System.out.print(String.format("Too few tiles at infinity (<%4f): %d minimum is %d", inf_max_disparity, num_inf, min_inf)); System.out.println(String.format("Too few tiles at infinity (<%4f): %d minimum is %d", inf_max_disparity, num_inf, min_inf));
} }
return null; return null;
} }
if (debugLevel > -20) { if (debugLevel > -20) {
System.out.print(String.format("Tiles per quadrants :[%d, %d, %d, %d], tiles at infinity %d", pq[0],pq[1],pq[2],pq[3],num_inf)); System.out.println(String.format("Tiles per quadrants :[%d, %d, %d, %d], tiles at infinity %d", pq[0],pq[1],pq[2],pq[3],num_inf));
} }
double inf_fraction_limited = (inf_fraction >= 0.0) ?((inf_fraction > 1.0) ? 1.0 : inf_fraction):0.0; double inf_fraction_limited = (inf_fraction >= 0.0) ?((inf_fraction > 1.0) ? 1.0 : inf_fraction):0.0;
......
...@@ -251,6 +251,8 @@ public class BiQuadParameters { ...@@ -251,6 +251,8 @@ public class BiQuadParameters {
public boolean ml_copyJP4 = true; // Copy source jp4 files when running "Ground truth" command public boolean ml_copyJP4 = true; // Copy source jp4 files when running "Ground truth" command
public int ml_hwidth = 4; // Half-width of the ML tiles to export (0-> 1x1, 1->3x3, 2 -> 5x5) public int ml_hwidth = 4; // Half-width of the ML tiles to export (0-> 1x1, 1->3x3, 2 -> 5x5)
// For dual-quad rig mode
public double ml_disparity_sweep = 2.0; // Disparity sweep around ground truth, each side public double ml_disparity_sweep = 2.0; // Disparity sweep around ground truth, each side
public int ml_sweep_steps = 1; // Number of disparity sweep steps public int ml_sweep_steps = 1; // Number of disparity sweep steps
...@@ -268,6 +270,15 @@ public class BiQuadParameters { ...@@ -268,6 +270,15 @@ public class BiQuadParameters {
public boolean ml_main_rnd = true; // generate ML from main camera DSI with random offset public boolean ml_main_rnd = true; // generate ML from main camera DSI with random offset
public boolean ml_rig_rnd = true; // generate ML from rig DSI (GT) with random offset public boolean ml_rig_rnd = true; // generate ML from rig DSI (GT) with random offset
// for EO+LWIR mode
public boolean ml_aux_ag = true; // aux (lwir) mode - generate 2dcorr for GT (average disparity)
public boolean ml_aux_fg = true; // aux (lwir) mode - generate 2dcorr for GT (foreground disparity)
public boolean ml_aux_bg = true; // aux (lwir) mode - generate 2dcorr for GT (background disparity)
public double ml_aux_low = 0.0; // aux (lwir) mode - disparity sweep low
public double ml_aux_high = 10.0; // aux (lwir) mode - disparity sweep high
public double ml_aux_step = 0.1; // aux (lwir) mode - disparity sweep step( >= 0 - no sweep)
// common
public boolean ml_keep_aux = false; // true; // include auxiliary camera data in the ML output public boolean ml_keep_aux = false; // true; // include auxiliary camera data in the ML output
public boolean ml_keep_inter = false; // true; // include inter-camera correlation data in the ML output public boolean ml_keep_inter = false; // true; // include inter-camera correlation data in the ML output
public boolean ml_keep_hor_vert = true; // include combined horizontal and vertical pairs data in the ML output public boolean ml_keep_hor_vert = true; // include combined horizontal and vertical pairs data in the ML output
...@@ -678,7 +689,7 @@ public class BiQuadParameters { ...@@ -678,7 +689,7 @@ public class BiQuadParameters {
gd.addCheckbox ("Randomize offset", this.ml_randomize, gd.addCheckbox ("Randomize offset", this.ml_randomize,
"Each tile will have individual offset, but it the range between the filename and next higher. Reduces sweep steps by 1"); "Each tile will have individual offset, but it the range between the filename and next higher. Reduces sweep steps by 1");
gd.addMessage("Enhancing main camera dsi for generation of the ml files"); gd.addMessage("Enhancing main camera dsi for generation of the ml files (dual quad rig mode");
gd.addNumericField("Max disparity difference between rig and main camera", this.ml_rig_tolerance, 3,6,"", gd.addNumericField("Max disparity difference between rig and main camera", this.ml_rig_tolerance, 3,6,"",
"Replace main camera disparity if it differs from rig by more than this"); "Replace main camera disparity if it differs from rig by more than this");
...@@ -693,6 +704,7 @@ public class BiQuadParameters { ...@@ -693,6 +704,7 @@ public class BiQuadParameters {
gd.addNumericField("Extrapolated tile strength", this.ml_new_strength, 3,6,"", gd.addNumericField("Extrapolated tile strength", this.ml_new_strength, 3,6,"",
"Assign this fraction of average neighbors strength strength to the tiles where strength is unknown (expanded tiles with extrapolated target)"); "Assign this fraction of average neighbors strength strength to the tiles where strength is unknown (expanded tiles with extrapolated target)");
gd.addMessage("Dual-quad rig mode (8 identical cameras)");
gd.addCheckbox ("Generate ML 2d correlations from main camera DSI", this.ml_main, gd.addCheckbox ("Generate ML 2d correlations from main camera DSI", this.ml_main,
"Target disparity/convergence extracted from the main camera DSI, filtered and expanded"); "Target disparity/convergence extracted from the main camera DSI, filtered and expanded");
...@@ -701,6 +713,25 @@ public class BiQuadParameters { ...@@ -701,6 +713,25 @@ public class BiQuadParameters {
gd.addCheckbox ("Generate ML from rig DSI (GT) with random offset", this.ml_rig_rnd, gd.addCheckbox ("Generate ML from rig DSI (GT) with random offset", this.ml_rig_rnd,
"Main camera data is not used, offset is just random from the rig (ground truth)"); "Main camera data is not used, offset is just random from the rig (ground truth)");
gd.addMessage("AUX mode (4×EO + 4×LWIR, different resolution)");
gd.addCheckbox ("Generate 2D correlation for GT (average disparity)", this.ml_aux_ag,
"Generate 2D correlation using tile weighted average disparity as target disparity");
gd.addCheckbox ("Generate 2D correlation for GT (foreground disparity)", this.ml_aux_fg,
"Generate 2D correlation using tile weighted foreground average disparity as target disparity");
gd.addCheckbox ("Generate 2D correlation for GT (background disparity)", this.ml_aux_bg,
"Generate 2D correlation using tile weighted background average disparity as target disparity");
gd.addNumericField("AUX (LWIR) camera disparity sweep low (start)", this.ml_aux_low, 3,6,"",
"Perform disparity sweep for AUX (LWIR) camera, starting with this disparity");
gd.addNumericField("AUX (LWIR) camera disparity sweep high (end)", this.ml_aux_high, 3,6,"",
"Perform disparity sweep for AUX (LWIR) camera, up to (inclusive) this disparity");
gd.addNumericField("AUX (LWIR) camera disparity sweep step (<=0 - no sweep generation)", this.ml_aux_step, 3,6,"",
"Perform disparity sweep for AUX (LWIR) camera with this disparity step. Values <=0.0 disable sweep.");
gd.addMessage("Common ML generation parameters");
gd.addCheckbox ("Include auxiliary camera data in the ML output", this.ml_keep_aux, gd.addCheckbox ("Include auxiliary camera data in the ML output", this.ml_keep_aux,
"ML output will have the second set of the layers for the auxiliary camera. Disparity values should be scaled for the camera baseline"); "ML output will have the second set of the layers for the auxiliary camera. Disparity values should be scaled for the camera baseline");
gd.addCheckbox ("Keep inter-camera correlation data", this.ml_keep_inter, gd.addCheckbox ("Keep inter-camera correlation data", this.ml_keep_inter,
...@@ -932,6 +963,13 @@ public class BiQuadParameters { ...@@ -932,6 +963,13 @@ public class BiQuadParameters {
this.ml_main_rnd= gd.getNextBoolean(); this.ml_main_rnd= gd.getNextBoolean();
this.ml_rig_rnd= gd.getNextBoolean(); this.ml_rig_rnd= gd.getNextBoolean();
this.ml_aux_ag= gd.getNextBoolean();
this.ml_aux_fg= gd.getNextBoolean();
this.ml_aux_bg= gd.getNextBoolean();
this.ml_aux_low= gd.getNextNumber();
this.ml_aux_high= gd.getNextNumber();
this.ml_aux_step= gd.getNextNumber();
this.ml_keep_aux= gd.getNextBoolean(); this.ml_keep_aux= gd.getNextBoolean();
this.ml_keep_inter= gd.getNextBoolean(); this.ml_keep_inter= gd.getNextBoolean();
this.ml_keep_tbrl= gd.getNextBoolean(); this.ml_keep_tbrl= gd.getNextBoolean();
...@@ -1155,6 +1193,13 @@ public class BiQuadParameters { ...@@ -1155,6 +1193,13 @@ public class BiQuadParameters {
properties.setProperty(prefix+"ml_main_rnd", this.ml_main_rnd+""); properties.setProperty(prefix+"ml_main_rnd", this.ml_main_rnd+"");
properties.setProperty(prefix+"ml_rig_rnd", this.ml_rig_rnd+""); properties.setProperty(prefix+"ml_rig_rnd", this.ml_rig_rnd+"");
properties.setProperty(prefix+"ml_aux_ag", this.ml_aux_ag+"");
properties.setProperty(prefix+"ml_aux_fg", this.ml_aux_fg+"");
properties.setProperty(prefix+"ml_aux_bg", this.ml_aux_bg+"");
properties.setProperty(prefix+"ml_aux_low", this.ml_aux_low+"");
properties.setProperty(prefix+"ml_aux_high", this.ml_aux_high+"");
properties.setProperty(prefix+"ml_aux_step", this.ml_aux_step+"");
properties.setProperty(prefix+"ml_keep_aux", this.ml_keep_aux+""); properties.setProperty(prefix+"ml_keep_aux", this.ml_keep_aux+"");
properties.setProperty(prefix+"ml_keep_inter", this.ml_keep_inter+""); properties.setProperty(prefix+"ml_keep_inter", this.ml_keep_inter+"");
properties.setProperty(prefix+"ml_keep_tbrl", this.ml_keep_tbrl+""); properties.setProperty(prefix+"ml_keep_tbrl", this.ml_keep_tbrl+"");
...@@ -1377,6 +1422,13 @@ public class BiQuadParameters { ...@@ -1377,6 +1422,13 @@ public class BiQuadParameters {
if (properties.getProperty(prefix+"ml_main_rnd")!=null) this.ml_main_rnd=Boolean.parseBoolean(properties.getProperty(prefix+"ml_main_rnd")); if (properties.getProperty(prefix+"ml_main_rnd")!=null) this.ml_main_rnd=Boolean.parseBoolean(properties.getProperty(prefix+"ml_main_rnd"));
if (properties.getProperty(prefix+"ml_rig_rnd")!=null) this.ml_rig_rnd=Boolean.parseBoolean(properties.getProperty(prefix+"ml_rig_rnd")); if (properties.getProperty(prefix+"ml_rig_rnd")!=null) this.ml_rig_rnd=Boolean.parseBoolean(properties.getProperty(prefix+"ml_rig_rnd"));
if (properties.getProperty(prefix+"ml_aux_ag")!=null) this.ml_aux_ag=Boolean.parseBoolean(properties.getProperty(prefix+"ml_aux_ag"));
if (properties.getProperty(prefix+"ml_aux_fg")!=null) this.ml_aux_fg=Boolean.parseBoolean(properties.getProperty(prefix+"ml_aux_fg"));
if (properties.getProperty(prefix+"ml_aux_bg")!=null) this.ml_aux_bg=Boolean.parseBoolean(properties.getProperty(prefix+"ml_aux_bg"));
if (properties.getProperty(prefix+"ml_aux_low")!=null) this.ml_aux_low=Double.parseDouble(properties.getProperty(prefix+"ml_aux_low"));
if (properties.getProperty(prefix+"ml_aux_high")!=null) this.ml_aux_high=Double.parseDouble(properties.getProperty(prefix+"ml_aux_high"));
if (properties.getProperty(prefix+"ml_aux_step")!=null) this.ml_aux_step=Double.parseDouble(properties.getProperty(prefix+"ml_aux_step"));
if (properties.getProperty(prefix+"ml_keep_aux")!=null) this.ml_keep_aux=Boolean.parseBoolean(properties.getProperty(prefix+"ml_keep_aux")); if (properties.getProperty(prefix+"ml_keep_aux")!=null) this.ml_keep_aux=Boolean.parseBoolean(properties.getProperty(prefix+"ml_keep_aux"));
if (properties.getProperty(prefix+"ml_keep_inter")!=null) this.ml_keep_inter=Boolean.parseBoolean(properties.getProperty(prefix+"ml_keep_inter")); if (properties.getProperty(prefix+"ml_keep_inter")!=null) this.ml_keep_inter=Boolean.parseBoolean(properties.getProperty(prefix+"ml_keep_inter"));
if (properties.getProperty(prefix+"ml_keep_tbrl")!=null) this.ml_keep_tbrl=Boolean.parseBoolean(properties.getProperty(prefix+"ml_keep_tbrl")); if (properties.getProperty(prefix+"ml_keep_tbrl")!=null) this.ml_keep_tbrl=Boolean.parseBoolean(properties.getProperty(prefix+"ml_keep_tbrl"));
...@@ -1590,7 +1642,14 @@ public class BiQuadParameters { ...@@ -1590,7 +1642,14 @@ public class BiQuadParameters {
bqp.ml_main_rnd = this.ml_main_rnd; bqp.ml_main_rnd = this.ml_main_rnd;
bqp.ml_rig_rnd = this.ml_rig_rnd; bqp.ml_rig_rnd = this.ml_rig_rnd;
bqp.ml_keep_aux= this.ml_keep_aux; bqp.ml_aux_ag = this.ml_aux_ag;
bqp.ml_aux_fg = this.ml_aux_fg;
bqp.ml_aux_bg = this.ml_aux_bg;
bqp.ml_aux_low = this.ml_aux_low;
bqp.ml_aux_high = this.ml_aux_high;
bqp.ml_aux_step = this.ml_aux_step;
bqp.ml_keep_aux = this.ml_keep_aux;
bqp.ml_randomize = this.ml_randomize; bqp.ml_randomize = this.ml_randomize;
bqp.ml_rig_tolerance= this.ml_rig_tolerance; bqp.ml_rig_tolerance= this.ml_rig_tolerance;
......
...@@ -289,7 +289,7 @@ public class Correlation2d { ...@@ -289,7 +289,7 @@ public class Correlation2d {
tcorr[col], tcorr[col],
fat_zero/scale_value); fat_zero/scale_value);
if (first_col < 0) {// accummulate all channels in frst non-null color ( 0 for color, 2 for mono?) if (first_col < 0) {// accummulate all channels in first non-null color ( 0 for color, 2 for mono?)
first_col = col; // first non-empty color (2, green) or 0 for color images first_col = col; // first non-empty color (2, green) or 0 for color images
for (int n = 0; n < 4; n++) { for (int n = 0; n < 4; n++) {
for (int i = 0; i < transform_len; i++) { for (int i = 0; i < transform_len; i++) {
...@@ -1150,8 +1150,8 @@ public class Correlation2d { ...@@ -1150,8 +1150,8 @@ public class Correlation2d {
double fc1 = full_corr[2 * ndir + 1][findx++]; // 1 - bottom, 3 (right) double fc1 = full_corr[2 * ndir + 1][findx++]; // 1 - bottom, 3 (right)
double cc = 0.0; double cc = 0.0;
if (offset >= 0.0) { if (offset >= 0.0) {
if ((fc0 > 0.0) && (fc1 > 0.0)) { if ((fc0 > -offset) && (fc1 > -offset)) {
cc = Math.sqrt((fc0+offset)*(fc1+offset)) - offset; cc = Math.sqrt((fc0 + offset) * (fc1 + offset)) - offset;
} }
} else { } else {
cc = 0.5*(fc0+fc1); cc = 0.5*(fc0+fc1);
......
...@@ -221,7 +221,7 @@ public class ImageDttParameters { ...@@ -221,7 +221,7 @@ public class ImageDttParameters {
gd.addNumericField("0% to 100 % transition range for poles", this.corr_notch_blur, 3,6,"half-pix", gd.addNumericField("0% to 100 % transition range for poles", this.corr_notch_blur, 3,6,"half-pix",
"Transition range, shifted sine is used"); "Transition range, shifted sine is used");
gd.addMessage("Window for niormal correlations"); gd.addMessage("Window for normal correlations");
gd.addNumericField("Number of rows to calculate CM disparity", this.corr_wndy_size, 0, 3, "", gd.addNumericField("Number of rows to calculate CM disparity", this.corr_wndy_size, 0, 3, "",
"Number of rows to calculate maximum. Normally should be equal to the previous parameter"); "Number of rows to calculate maximum. Normally should be equal to the previous parameter");
......
...@@ -68,6 +68,21 @@ import ij.process.ImageProcessor; ...@@ -68,6 +68,21 @@ import ij.process.ImageProcessor;
public class QuadCLT { public class QuadCLT {
public static final String [] FGBG_TITLES_ADJ = {"disparity","strength"};
// public static final String [] FGBG_TITLES = {"disparity","strength", "rms","rms-split","fg-disp","fg-str","bg-disp","bg-str"};
public static final String [] FGBG_TITLES_AUX = {"disparity","strength", "rms","rms-split","fg-disp","fg-str","bg-disp","bg-str","aux-disp","aux-str"};
// public static final enum FGBG {DISPARITY, STRENGTH, RMS, RMS_SPLIT, FG_DISP, FG_STR, BG_DISP, BG_STR};
public static final int FGBG_DISPARITY = 0;
public static final int FGBG_STRENGTH = 1;
public static final int FGBG_RMS = 2;
public static final int FGBG_RMS_SPLIT = 3;
public static final int FGBG_FG_DISP = 4;
public static final int FGBG_FG_STR = 5;
public static final int FGBG_BG_DISP = 6;
public static final int FGBG_BG_STR = 7;
public static final int FGBG_AUX_DISP = 8; // AUX calculated disparity
public static final int FGBG_AUX_STR = 9; // AUX calculated strength
static String [] fine_corr_coeff_names = {"A","B","C","D","E","F"}; static String [] fine_corr_coeff_names = {"A","B","C","D","E","F"};
static String [] fine_corr_dir_names = {"X","Y"}; static String [] fine_corr_dir_names = {"X","Y"};
public static String PREFIX = "EYESIS_DCT."; // change later (first on save) public static String PREFIX = "EYESIS_DCT."; // change later (first on save)
...@@ -6187,16 +6202,16 @@ public class QuadCLT { ...@@ -6187,16 +6202,16 @@ public class QuadCLT {
} }
// simple average (ignoring below minimal) // simple average (ignoring below minimal)
int num_slices = split_fg_bg? 8:2; int num_slices = split_fg_bg? FGBG_TITLES_AUX.length:FGBG_TITLES_ADJ.length;
double [][] ds_aux_avg = new double [num_slices][tilesX_aux * tilesY_aux]; double [][] ds_aux_avg = new double [num_slices][tilesX_aux * tilesY_aux];
for (int ty = 0; ty < tilesY_aux; ty++) { for (int ty = 0; ty < tilesY_aux; ty++) {
for (int tx = 0; tx < tilesX_aux; tx++) { for (int tx = 0; tx < tilesX_aux; tx++) {
if ((ty == 3) && (tx == 12)) { // if ((ty == 3) && (tx == 12)) {
System.out.println("tx = "+tx+", ty = "+ty); // System.out.println("tx = "+tx+", ty = "+ty);
} // }
int nt = ty * tilesX_aux + tx; int nt = ty * tilesX_aux + tx;
ds_aux_avg[0][nt] = Double.NaN; ds_aux_avg[FGBG_DISPARITY][nt] = Double.NaN;
ds_aux_avg[1][nt] = 0.0; ds_aux_avg[FGBG_STRENGTH][nt] = 0.0;
if(ds_list.get(nt).isEmpty()) continue; if(ds_list.get(nt).isEmpty()) continue;
Collections.sort(ds_list.get(nt), new Comparator<DS>() { Collections.sort(ds_list.get(nt), new Comparator<DS>() {
@Override @Override
...@@ -6217,22 +6232,22 @@ public class QuadCLT { ...@@ -6217,22 +6232,22 @@ public class QuadCLT {
swd2 += wd * dsi.disparity; swd2 += wd * dsi.disparity;
} }
ds_aux_avg[0][nt] = swd/sw; ds_aux_avg[FGBG_DISPARITY][nt] = swd/sw;
ds_aux_avg[1][nt] = sw/ds_list.get(nt).size(); ds_aux_avg[FGBG_STRENGTH][nt] = sw/ds_list.get(nt).size();
double rms = Math.sqrt( (swd2 * sw - swd * swd) / (sw * sw)); double rms = Math.sqrt( (swd2 * sw - swd * swd) / (sw * sw));
if (for_adjust && (rms >= clt_Parameters.ly_gt_rms)) { // remove ambiguous tiles if (for_adjust && (rms >= clt_Parameters.ly_gt_rms)) { // remove ambiguous tiles
ds_aux_avg[0][nt] = Double.NaN; ds_aux_avg[FGBG_DISPARITY][nt] = Double.NaN;
ds_aux_avg[1][nt] = 0; ds_aux_avg[FGBG_STRENGTH][nt] = 0;
} }
if (split_fg_bg) { if (split_fg_bg) {
ds_aux_avg[2][nt] = rms; ds_aux_avg[FGBG_RMS ][nt] = rms;
ds_aux_avg[3][nt] = ds_aux_avg[2][nt]; // rms ds_aux_avg[FGBG_RMS_SPLIT][nt] = ds_aux_avg[2][nt]; // rms
ds_aux_avg[4][nt] = ds_aux_avg[0][nt]; // fg disp ds_aux_avg[FGBG_FG_DISP][nt] = ds_aux_avg[0][nt]; // fg disp
ds_aux_avg[5][nt] = ds_aux_avg[1][nt]; // fg strength ds_aux_avg[FGBG_FG_STR][nt] = ds_aux_avg[1][nt]; // fg strength
ds_aux_avg[6][nt] = ds_aux_avg[0][nt]; // bg disp ds_aux_avg[FGBG_BG_DISP][nt] = ds_aux_avg[0][nt]; // bg disp
ds_aux_avg[7][nt] = ds_aux_avg[1][nt]; // bg strength ds_aux_avg[FGBG_BG_STR][nt] = ds_aux_avg[1][nt]; // bg strength
if (rms >= clt_Parameters.ly_gt_rms) { if (rms >= clt_Parameters.ly_gt_rms) {
// splitting while minimizing sum of 2 squared errors // splitting while minimizing sum of 2 squared errors
double [][] swfb = new double [2][ds_list.get(nt).size() -1]; double [][] swfb = new double [2][ds_list.get(nt).size() -1];
...@@ -6261,12 +6276,12 @@ public class QuadCLT { ...@@ -6261,12 +6276,12 @@ public class QuadCLT {
for (int i = 1; i < s2fb.length; i++) if (s2fb[i] < s2fb[nsplit]) { for (int i = 1; i < s2fb.length; i++) if (s2fb[i] < s2fb[nsplit]) {
nsplit = i; nsplit = i;
} }
ds_aux_avg[3][nt] = s2fb[nsplit]; // rms split ds_aux_avg[FGBG_RMS_SPLIT][nt] = s2fb[nsplit]; // rms split
ds_aux_avg[4][nt] = swdfb[1][nsplit] / swfb[1][nsplit] ; // fg disp ds_aux_avg[FGBG_FG_DISP][nt] = swdfb[1][nsplit] / swfb[1][nsplit] ; // fg disp
ds_aux_avg[5][nt] = swfb[1][nsplit]/ (s2fb.length - nsplit) ; // fg strength ds_aux_avg[FGBG_FG_STR][nt] = swfb[1][nsplit]/ (s2fb.length - nsplit) ; // fg strength
ds_aux_avg[6][nt] = swdfb[0][nsplit] / swfb[0][nsplit] ; // bg disp ds_aux_avg[FGBG_BG_DISP][nt] = swdfb[0][nsplit] / swfb[0][nsplit] ; // bg disp
ds_aux_avg[7][nt] = swfb[0][nsplit]/ (nsplit + 1) ; // bg strength ds_aux_avg[FGBG_BG_STR][nt] = swfb[0][nsplit]/ (nsplit + 1) ; // bg strength
} }
} }
} }
...@@ -7091,7 +7106,7 @@ public class QuadCLT { ...@@ -7091,7 +7106,7 @@ public class QuadCLT {
System.out.println("#### extrinsicsCLT(): iteration step = "+(num_iter + 1) + " ( of "+max_tries+") change = "+ System.out.println("#### extrinsicsCLT(): iteration step = "+(num_iter + 1) + " ( of "+max_tries+") change = "+
comp_diff + " ("+min_sym_update+"), previous RMS = " + new_corr[0][1][0]+ " (debugLevel = "+debugLevel+")"); comp_diff + " ("+min_sym_update+"), previous RMS = " + new_corr[0][1][0]+ " (debugLevel = "+debugLevel+")");
} }
if (debugLevel > -2) { if (debugLevel > -10) {
if ((debugLevel > -1) || done) { if ((debugLevel > -1) || done) {
// System.out.println("#### extrinsicsCLT(): iteration step = "+(num_iter + 1) + " ( of "+max_tries+") change = "+ // System.out.println("#### extrinsicsCLT(): iteration step = "+(num_iter + 1) + " ( of "+max_tries+") change = "+
// comp_diff + " ("+min_sym_update+"), previous RMS = " + new_corr[0][1][0]); // comp_diff + " ("+min_sym_update+"), previous RMS = " + new_corr[0][1][0]);
...@@ -7712,7 +7727,7 @@ public class QuadCLT { ...@@ -7712,7 +7727,7 @@ public class QuadCLT {
// Get filtered (by flexible "plates" that can tilt to accommodate tiles disparity/strength map, that uses data from all previous // Get filtered (by flexible "plates" that can tilt to accommodate tiles disparity/strength map, that uses data from all previous
// disparity "measurements". This data will be combined with individual tiles, quad, hor and vert correlation results // disparity "measurements". This data will be combined with individual tiles, quad, hor and vert correlation results
double [][] filtered_disp_strength = tp.getFilteredDisparityStrength( double [][] filtered_disp_strength = tp.getFilteredDisparityStrength( // disp all 0?, str -1/0
tp.clt_3d_passes, // final ArrayList <CLTPass3d> passes,// List, first, last - to search for the already tried disparity tp.clt_3d_passes, // final ArrayList <CLTPass3d> passes,// List, first, last - to search for the already tried disparity
lastPassPlus1 - 1, // final int measured_scan_index, // will not look at higher scans lastPassPlus1 - 1, // final int measured_scan_index, // will not look at higher scans
0, // final int start_scan_index, 0, // final int start_scan_index,
...@@ -7786,6 +7801,9 @@ public class QuadCLT { ...@@ -7786,6 +7801,9 @@ public class QuadCLT {
refine_pass, // may add 1 to include current (for future?) // final int lastPassPlus1, refine_pass, // may add 1 to include current (for future?) // final int lastPassPlus1,
passes.get(refine_pass)); // final int lastPassPlus1, passes.get(refine_pass)); // final int lastPassPlus1,
// repeated composite scan may be replaced by just a clone // repeated composite scan may be replaced by just a clone
if (last_pass){
System.out.println("+++++++++++ Last pass - pre compositeScan() ++++++++++++");
}
CLTPass3d extended_pass = tp.compositeScan( CLTPass3d extended_pass = tp.compositeScan(
passes, // final ArrayList <CLTPass3d> passes, passes, // final ArrayList <CLTPass3d> passes,
...@@ -7904,7 +7922,7 @@ public class QuadCLT { ...@@ -7904,7 +7922,7 @@ public class QuadCLT {
dbg_x, dbg_x,
dbg_y, dbg_y,
debugLevel); debugLevel);
num_extended = numLeftRemoved[0]; num_extended = numLeftRemoved[0]; //0,0
if (clt_parameters.show_expand || (clt_parameters.show_variant && (numLeftRemoved[1] > 1 ))) tp.showScan( if (clt_parameters.show_expand || (clt_parameters.show_variant && (numLeftRemoved[1] > 1 ))) tp.showScan(
tp.clt_3d_passes.get(refine_pass), // CLTPass3d scan, tp.clt_3d_passes.get(refine_pass), // CLTPass3d scan,
"prepareExpandVariant-"+numLeftRemoved[1]+"-"+refine_pass); //String title) "prepareExpandVariant-"+numLeftRemoved[1]+"-"+refine_pass); //String title)
...@@ -7971,7 +7989,7 @@ public class QuadCLT { ...@@ -7971,7 +7989,7 @@ public class QuadCLT {
// num_extended = numLeftRemoved[0]; // num_extended = numLeftRemoved[0];
CLTMeasure( // perform single pass according to prepared tiles operations and disparity CLTMeasure( // perform single pass according to prepared tiles operations and disparity BUG: gets with .disparity==null
image_data, // first index - number of image in a quad image_data, // first index - number of image in a quad
saturation_imp, //final boolean [][] saturation_imp, // (near) saturated pixels or null saturation_imp, //final boolean [][] saturation_imp, // (near) saturated pixels or null
clt_parameters, clt_parameters,
...@@ -9055,9 +9073,30 @@ public class QuadCLT { ...@@ -9055,9 +9073,30 @@ public class QuadCLT {
final int tilesY = tp.getTilesY(); final int tilesY = tp.getTilesY();
CLTPass3d scan = tp.clt_3d_passes.get(scanIndex); CLTPass3d scan = tp.clt_3d_passes.get(scanIndex);
int [][] tile_op = scan.tile_op; int [][] tile_op = scan.tile_op;
// Should not happen !
double [][] disparity_array = scan.disparity;
if (scan.disparity == null) {
System.out.println ("** BUG: should not happen - scan.disparity == null ! **");
System.out.println ("Trying to recover");
double [] backup_disparity = scan.getDisparity(0);
if (backup_disparity == null) {
System.out.println ("** BUG: no disparity at all !");
backup_disparity = new double[tilesX*tilesY];
}
scan.disparity = new double[tilesY][tilesX];
for (int ty = 0; ty < tilesY; ty++) {
for (int tx = 0; tx < tilesX; tx++) {
scan.disparity[ty][tx] = backup_disparity[ty*tilesX + tx];
if (Double.isNaN(scan.disparity[ty][tx])) {
scan.disparity[ty][tx] = 0;
tile_op[ty][tx] = 0;
}
}
}
disparity_array = scan.disparity;
}
double [][] disparity_array = scan.disparity;
// undecided, so 2 modes of combining alpha - same as rgb, or use center tile only // undecided, so 2 modes of combining alpha - same as rgb, or use center tile only
double [][][][] clt_corr_combo = new double [ImageDtt.TCORR_TITLES.length][tilesY][tilesX][]; // will only be used inside? double [][][][] clt_corr_combo = new double [ImageDtt.TCORR_TITLES.length][tilesY][tilesX][]; // will only be used inside?
if (debugLevel > -1){ if (debugLevel > -1){
......
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