Commit a2bb43cd authored by Andrey Filippov's avatar Andrey Filippov

Done with individual quad-cam adjustment using rig "GT" data

parent ee9c0264
...@@ -2056,7 +2056,7 @@ B = |+dy0 -dy1 -2*dy3 | ...@@ -2056,7 +2056,7 @@ B = |+dy0 -dy1 -2*dy3 |
(new showDoubleFloatArrays()).showArrays(dbg_img, tilesX, tilesY, true, "hist_filt_ds"); // , titles); (new showDoubleFloatArrays()).showArrays(dbg_img, tilesX, tilesY, true, "hist_filt_ds"); // , titles);
} }
} }
// combine infinity and lasy eye scan data into a single array // combine infinity and lazy eye scan data into a single array
double [][] inf_and_ly = new double [2 * NUM_SLICES][]; double [][] inf_and_ly = new double [2 * NUM_SLICES][];
for (int i = 0; i < NUM_SLICES; i++){ for (int i = 0; i < NUM_SLICES; i++){
inf_and_ly[i] = inf_scan[i]; inf_and_ly[i] = inf_scan[i];
...@@ -2076,7 +2076,9 @@ B = |+dy0 -dy1 -2*dy3 | ...@@ -2076,7 +2076,9 @@ B = |+dy0 -dy1 -2*dy3 |
} }
// static final int INDEX_10_WEIGHT = 1; // static final int INDEX_10_WEIGHT = 1;
System.out.println("test123"); if (debugLevel > 0) {
System.out.println("test123");
}
if ((debugLevel > -1) && (hist_smpl_side > 0)) { // 0) { if ((debugLevel > -1) && (hist_smpl_side > 0)) { // 0) {
String [] prefixes = {"disparity", "strength", "dx0", "dy0", "dx1", "dy1", "dx2", "dy2", "dx3", "dy3"}; String [] prefixes = {"disparity", "strength", "dx0", "dy0", "dx1", "dy1", "dx2", "dy2", "dx3", "dy3"};
String [] titles = new String [2 * NUM_SLICES]; String [] titles = new String [2 * NUM_SLICES];
...@@ -2128,7 +2130,9 @@ B = |+dy0 -dy1 -2*dy3 | ...@@ -2128,7 +2130,9 @@ B = |+dy0 -dy1 -2*dy3 |
} }
(new showDoubleFloatArrays()).showArrays(dbg_img, tilesX1, tilesY1, true, "inf_and_ly8",titles); (new showDoubleFloatArrays()).showArrays(dbg_img, tilesX1, tilesY1, true, "inf_and_ly8",titles);
} }
System.out.println("test1234"); if (debugLevel > 0) {
System.out.println("test1234");
}
// create list for infinity data // create list for infinity data
// /clt_parameters.ly_inf_en, // /clt_parameters.ly_inf_en,
ArrayList<Sample> inf_samples_list; ArrayList<Sample> inf_samples_list;
...@@ -2275,6 +2279,7 @@ System.out.println("test1234"); ...@@ -2275,6 +2279,7 @@ System.out.println("test1234");
clt_parameters.ly_par_sel, //int manual_par_sel, // Manually select the parameter mask bit 0 - sym0, bit1 - sym1, ... (0 - use boolean flags, != 0 - ignore boolean flags) clt_parameters.ly_par_sel, //int manual_par_sel, // Manually select the parameter mask bit 0 - sym0, bit1 - sym1, ... (0 - use boolean flags, != 0 - ignore boolean flags)
mismatch_list, // ArrayList<Mismatch> mismatch_list, mismatch_list, // ArrayList<Mismatch> mismatch_list,
qc.geometryCorrection, // GeometryCorrection geometryCorrection, qc.geometryCorrection, // GeometryCorrection geometryCorrection,
null, // GeometryCorrection geometryCorrection_main, // if is aux camera using main cameras' coordinates. Disparity is still in aux camera pixels
qc.geometryCorrection.getCorrVector(), // GeometryCorrection.CorrVector corr_vector, qc.geometryCorrection.getCorrVector(), // GeometryCorrection.CorrVector corr_vector,
old_new_rms, // double [] old_new_rms, // should be double[2] old_new_rms, // double [] old_new_rms, // should be double[2]
// 2); // debugLevel); // 2); // 1); // int debugLevel) // 2); // debugLevel); // 2); // 1); // int debugLevel)
...@@ -2323,6 +2328,7 @@ System.out.println("test1234"); ...@@ -2323,6 +2328,7 @@ System.out.println("test1234");
public double [][][] lazyEyeCorrectionFromGT( public double [][][] lazyEyeCorrectionFromGT(
final GeometryCorrection geometryCorrection_main, // if not null - this is an AUX camera of a rig
final boolean use_poly, // Use polynomial correction, false - correct tilt/azimuth/roll of each sensor final boolean use_poly, // Use polynomial correction, false - correct tilt/azimuth/roll of each sensor
final boolean restore_disp_inf, // Restore subtracted disparity for scan #0 (infinity) always true final boolean restore_disp_inf, // Restore subtracted disparity for scan #0 (infinity) always true
final double fcorr_radius, final double fcorr_radius,
...@@ -2360,7 +2366,7 @@ System.out.println("test1234"); ...@@ -2360,7 +2366,7 @@ System.out.println("test1234");
int debugLevel){ int debugLevel){
// final double lazyEyeDispRelVariation = 0.02; // final double lazyEyeDispRelVariation = 0.02;
//geometryCorrection_main
final int dbg_nTile = -34145; // 37005; // -59038; final int dbg_nTile = -34145; // 37005; // -59038;
final int num_scans = scans_14.length/NUM_ALL_SLICES; final int num_scans = scans_14.length/NUM_ALL_SLICES;
final int num_tiles = scans_14[0].length; final int num_tiles = scans_14[0].length;
...@@ -2368,6 +2374,8 @@ System.out.println("test1234"); ...@@ -2368,6 +2374,8 @@ System.out.println("test1234");
final boolean [] center_mask = getCenterMask(fcorr_radius, tilesX, tilesY); final boolean [] center_mask = getCenterMask(fcorr_radius, tilesX, tilesY);
final double [][] scans = new double [num_scans * NUM_SLICES][]; final double [][] scans = new double [num_scans * NUM_SLICES][];
// final double [][] comp_strength_rms = new double [num_scans][num_tiles]; // final double [][] comp_strength_rms = new double [num_scans][num_tiles];
for (int ns = 0; ns < num_scans; ns++){ for (int ns = 0; ns < num_scans; ns++){
final double [] min_weights = new double [num_tiles]; final double [] min_weights = new double [num_tiles];
for (int nTile = 0; nTile < num_tiles; nTile++){ for (int nTile = 0; nTile < num_tiles; nTile++){
...@@ -2478,7 +2486,7 @@ System.out.println("test1234"); ...@@ -2478,7 +2486,7 @@ System.out.println("test1234");
double [][] combo_mismatch = new double [NUM_SLICES][num_tiles]; double [][] combo_mismatch = new double [NUM_SLICES][num_tiles];
for (int ns = 0; ns < num_scans; ns++){ for (int ns = 0; ns < num_scans; ns++){
for (int nTile = 0; nTile < num_tiles; nTile++) { for (int nTile = 0; nTile < num_tiles; nTile++) {
if ((nTile == dbg_nTile) || (nTile == 24971)){ if (nTile == dbg_nTile) { // || (nTile == 24971)){
System.out.println("lazyEyeCorrectionFromGT().1: nTile="+nTile); // filtered_scans[2][37005] = NaN System.out.println("lazyEyeCorrectionFromGT().1: nTile="+nTile); // filtered_scans[2][37005] = NaN
} }
// double w = filtered_scans[ns * NUM_SLICES + 1][nTile]; // double w = filtered_scans[ns * NUM_SLICES + 1][nTile];
...@@ -2588,7 +2596,9 @@ System.out.println("test1234"); ...@@ -2588,7 +2596,9 @@ System.out.println("test1234");
} }
// static final int INDEX_10_WEIGHT = 1; // static final int INDEX_10_WEIGHT = 1;
System.out.println("test123"); if (debugLevel > 0) {
System.out.println("test123");
}
if ((debugLevel > -1) && (hist_smpl_side > 0)) { // 0) { if ((debugLevel > -1) && (hist_smpl_side > 0)) { // 0) {
String [] titles = {"disparity", "strength", "dx0", "dy0", "dx1", "dy1", "dx2", "dy2", "dx3", "dy3"}; String [] titles = {"disparity", "strength", "dx0", "dy0", "dx1", "dy1", "dx2", "dy2", "dx3", "dy3"};
(new showDoubleFloatArrays()).showArrays(combo_mismatch, tilesX, tilesY, true, "inf_and_ly",titles); (new showDoubleFloatArrays()).showArrays(combo_mismatch, tilesX, tilesY, true, "inf_and_ly",titles);
...@@ -2628,7 +2638,9 @@ System.out.println("test1234"); ...@@ -2628,7 +2638,9 @@ System.out.println("test1234");
} }
(new showDoubleFloatArrays()).showArrays(dbg_img, tilesX1, tilesY1, true, "inf_and_ly8",titles); (new showDoubleFloatArrays()).showArrays(dbg_img, tilesX1, tilesY1, true, "inf_and_ly8",titles);
} }
System.out.println("test1234a"); if (debugLevel > 0) {
System.out.println("test1234a");
}
// create list for infinity data // create list for infinity data
// /clt_parameters.ly_inf_en, // /clt_parameters.ly_inf_en,
...@@ -2732,6 +2744,7 @@ System.out.println("test1234"); ...@@ -2732,6 +2744,7 @@ System.out.println("test1234");
System.out.println("Are null - non-null are for poly correction only"); System.out.println("Are null - non-null are for poly correction only");
} }
} }
// TODO: use geometryCorrection_main (if not null)
if (!use_poly && (mismatch_list != null)){ if (!use_poly && (mismatch_list != null)){
double [] old_new_rms = new double[1]; double [] old_new_rms = new double[1];
boolean apply_extrinsic = true; boolean apply_extrinsic = true;
...@@ -2743,9 +2756,10 @@ System.out.println("test1234"); ...@@ -2743,9 +2756,10 @@ System.out.println("test1234");
clt_parameters.ly_inf_force, // boolean force_convergence, // if true try to adjust convergence (disparity, symmetrical parameter 0) even with no disparity clt_parameters.ly_inf_force, // boolean force_convergence, // if true try to adjust convergence (disparity, symmetrical parameter 0) even with no disparity
clt_parameters.ly_com_roll, // boolean common_roll, // Enable common roll (valid for high disparity range only) clt_parameters.ly_com_roll, // boolean common_roll, // Enable common roll (valid for high disparity range only)
clt_parameters.ly_focalLength, // boolean corr_focalLength, // Correct scales (focal length temperature? variations) clt_parameters.ly_focalLength, // boolean corr_focalLength, // Correct scales (focal length temperature? variations)
clt_parameters.ly_par_sel, //int manual_par_sel, // Manually select the parameter mask bit 0 - sym0, bit1 - sym1, ... (0 - use boolean flags, != 0 - ignore boolean flags) clt_parameters.ly_par_sel, // int manual_par_sel, // Manually select the parameter mask bit 0 - sym0, bit1 - sym1, ... (0 - use boolean flags, != 0 - ignore boolean flags)
mismatch_list, // ArrayList<Mismatch> mismatch_list, mismatch_list, // ArrayList<Mismatch> mismatch_list,
qc.geometryCorrection, // GeometryCorrection geometryCorrection, qc.geometryCorrection, // GeometryCorrection geometryCorrection,
geometryCorrection_main, // GeometryCorrection geometryCorrection_main, // if is aux camera using main cameras' coordinates. Disparity is still in aux camera pixels
qc.geometryCorrection.getCorrVector(), // GeometryCorrection.CorrVector corr_vector, qc.geometryCorrection.getCorrVector(), // GeometryCorrection.CorrVector corr_vector,
old_new_rms, // double [] old_new_rms, // should be double[2] old_new_rms, // double [] old_new_rms, // should be double[2]
// 2); // debugLevel); // 2); // 1); // int debugLevel) // 2); // debugLevel); // 2); // 1); // int debugLevel)
...@@ -3278,10 +3292,9 @@ System.out.println("test1234"); ...@@ -3278,10 +3292,9 @@ System.out.println("test1234");
boolean common_roll, // Enable common roll (valid for high disparity range only) boolean common_roll, // Enable common roll (valid for high disparity range only)
boolean corr_focalLength, // Correct scales (focal length temperature? variations) boolean corr_focalLength, // Correct scales (focal length temperature? variations)
int manual_par_sel, // Manually select the parameter mask bit 0 - sym0, bit1 - sym1, ... (0 - use boolean flags, != 0 - ignore boolean flags) int manual_par_sel, // Manually select the parameter mask bit 0 - sym0, bit1 - sym1, ... (0 - use boolean flags, != 0 - ignore boolean flags)
ArrayList<Mismatch> mismatch_list, ArrayList<Mismatch> mismatch_list,
GeometryCorrection geometryCorrection, GeometryCorrection geometryCorrection,
GeometryCorrection geometryCorrection_main, // if is aux camera using main cameras' coordinates. Disparity is still in aux camera pixels
GeometryCorrection.CorrVector corr_vector, GeometryCorrection.CorrVector corr_vector,
double [] old_new_rms, // should be double[2] double [] old_new_rms, // should be double[2]
int debugLevel) int debugLevel)
......
...@@ -512,7 +512,7 @@ public class BiScan { ...@@ -512,7 +512,7 @@ public class BiScan {
int dbg_x = 193; int dbg_x = 193;
int dbg_y = 162; int dbg_y = 162;
int debugLevel = -1; int debugLevel = -1;
final int dbg_tile = (debugLevel>-2)?(dbg_x + tnImage.sizeX*dbg_y):-1; final int dbg_tile = (debugLevel>-1)?(dbg_x + tnImage.sizeX*dbg_y):-1;
ai.set(0); ai.set(0);
// find definitely trusted and conditionally trusted tiles // find definitely trusted and conditionally trusted tiles
......
...@@ -570,7 +570,7 @@ private Panel panel1, ...@@ -570,7 +570,7 @@ private Panel panel1,
addButton("CLT batch process", panelClt3, color_process); addButton("CLT batch process", panelClt3, color_process);
addButton("CM Test", panelClt3, color_stop); addButton("CM Test", panelClt3, color_stop);
addButton("Show scan", panelClt3, color_configure); addButton("Show scan", panelClt3, color_configure);
addButton("Show all scans", panelClt3, color_configure);
add(panelClt3); add(panelClt3);
} }
...@@ -4480,6 +4480,10 @@ private Panel panel1, ...@@ -4480,6 +4480,10 @@ private Panel panel1,
showScan(); showScan();
return; return;
/* ======================================================================== */ /* ======================================================================== */
} else if (label.equals("Show all scans")) {
showAllScans();
return;
/* ======================================================================== */
} else if (label.equals("Import Aux")) { } else if (label.equals("Import Aux")) {
importAux(); importAux();
...@@ -5944,32 +5948,30 @@ private Panel panel1, ...@@ -5944,32 +5948,30 @@ private Panel panel1,
} }
} }
public boolean getDCTShiftwDialog(double [] shiftXY) {
GenericDialog gd = new GenericDialog("Set DCT shift");
gd.addNumericField("X-shift", shiftXY[0], 2); //2
if (shiftXY.length > 1) {
gd.addNumericField("Y-shift", shiftXY[1], 2); //2
}
gd.showDialog();
if (gd.wasCanceled()) return false;
shiftXY[0]= gd.getNextNumber();
if (shiftXY.length > 1) {
shiftXY[1]= gd.getNextNumber();
}
return true;
}
public boolean showScan() {
public boolean getDCTShiftwDialog(double [] shiftXY) {
GenericDialog gd = new GenericDialog("Set DCT shift");
gd.addNumericField("X-shift", shiftXY[0], 2); //2
if (shiftXY.length > 1) {
gd.addNumericField("Y-shift", shiftXY[1], 2); //2
}
gd.showDialog();
if (gd.wasCanceled()) return false;
shiftXY[0]= gd.getNextNumber();
if (shiftXY.length > 1) {
shiftXY[1]= gd.getNextNumber();
}
return true;
}
public boolean showScan() {
if ((QUAD_CLT == null) || (QUAD_CLT.tp == null) || (QUAD_CLT.tp.clt_3d_passes == null)) { if ((QUAD_CLT == null) || (QUAD_CLT.tp == null) || (QUAD_CLT.tp.clt_3d_passes == null)) {
String msg = "DSI data is not available. Please run \"CLT 3D\" first"; String msg = "DSI data is not available. Please run \"CLT 3D\" first";
IJ.showMessage("Error",msg); IJ.showMessage("Error",msg);
System.out.println(msg); System.out.println(msg);
return false; return false;
} }
int scan_index = 0; int scan_index = QUAD_CLT.tp.clt_3d_passes.size()-1;
GenericJTabbedDialog gd = new GenericJTabbedDialog("Set CLT parameters",400,100); GenericJTabbedDialog gd = new GenericJTabbedDialog("Select scan to show",400,100);
gd.addNumericField("Scan index (0..."+(QUAD_CLT.tp.clt_3d_passes.size()-1), scan_index, 0, 2, "", gd.addNumericField("Scan index (0..."+(QUAD_CLT.tp.clt_3d_passes.size()-1), scan_index, 0, 2, "",
"Display scan by index"); "Display scan by index");
...@@ -5980,7 +5982,59 @@ private Panel panel1, ...@@ -5980,7 +5982,59 @@ private Panel panel1,
QUAD_CLT.tp.showScan(QUAD_CLT.tp.clt_3d_passes.get(scan_index),"Scan-"+scan_index); QUAD_CLT.tp.showScan(QUAD_CLT.tp.clt_3d_passes.get(scan_index),"Scan-"+scan_index);
return true; return true;
} }
public boolean showAllScans() {
if ((QUAD_CLT == null) || (QUAD_CLT.tp == null) || (QUAD_CLT.tp.clt_3d_passes == null)) {
String msg = "DSI data is not available. Please run \"CLT 3D\" first";
IJ.showMessage("Error",msg);
System.out.println(msg);
return false;
}
int scan_index = 0;
String [] titles = QUAD_CLT.tp.getScanTitles();
GenericJTabbedDialog gd = new GenericJTabbedDialog("Select scan slice to show",400,800);
gd.addMessage("Select scan types to show");
gd.addCheckbox("All scans", true, "Include all types of scans");
gd.addCheckbox("Measured scans", false,"Include measured scans");
gd.addCheckbox("Processed scans", false,"Include processed scans");
gd.addCheckbox("Combo scans", false,"Include combo scans");
gd.addMessage("Select slice to show (only first selected will be shown)");
for (int i = 0; i < titles.length; i++ ) {
gd.addCheckbox(i+": "+titles[i], false); // 0
}
gd.showDialog();
if (gd.wasCanceled()) return false;
boolean all = gd.getNextBoolean();
boolean measured = gd.getNextBoolean();
boolean processed = gd.getNextBoolean();
boolean combo = gd.getNextBoolean();
boolean [] bslice = new boolean [titles.length];
for (int i = 0; i < titles.length;i++) {
bslice[i] = gd.getNextBoolean();
}
int slice =-1;
for (int i = 0; i < bslice.length; i++) if (bslice[i]) {
slice = i;
break;
}
if (slice < 0) {
System.out.println("Slice not selected");
return false;
}
QUAD_CLT.tp.showAllScans(
"SCANS", // String title,
slice, // int slice,
all, // boolean all,
measured, // boolean measured,
processed, // boolean processed,
combo); // boolean combo);
return true;
}
public boolean cm_test() { public boolean cm_test() {
double hsize_x = 1.5; double hsize_x = 1.5;
......
...@@ -610,8 +610,8 @@ public class GeometryCorrection { ...@@ -610,8 +610,8 @@ public class GeometryCorrection {
diff_x, // used only with target_disparity == 0 diff_x, // used only with target_disparity == 0
diff_y, diff_y,
target_disparity); target_disparity);
if (debugLevel>-1) { if (debugLevel>-4) {
System.out.println("getRigCorrection(): Current RMS = "+rms); System.out.println("getRigCorrection(): Current RMS = "+rms+ "(debugLevel= "+debugLevel+")");
}; };
double [][] jt = getJacobianTransposed( // npe double [][] jt = getJacobianTransposed( // npe
qc_main.geometryCorrection, // GeometryCorrection gc_main, qc_main.geometryCorrection, // GeometryCorrection gc_main,
...@@ -707,7 +707,7 @@ public class GeometryCorrection { ...@@ -707,7 +707,7 @@ public class GeometryCorrection {
rXY_aux[i][0] = xc_pix + Math.cos(aux_roll)*rXY[i][0] + ssr*Math.sin(aux_roll)*rXY[i][1]; rXY_aux[i][0] = xc_pix + Math.cos(aux_roll)*rXY[i][0] + ssr*Math.sin(aux_roll)*rXY[i][1];
rXY_aux[i][1] = yc_pix - ssr*Math.sin(aux_roll)*rXY[i][0] + Math.cos(aux_roll)*rXY[i][1]; rXY_aux[i][1] = yc_pix - ssr*Math.sin(aux_roll)*rXY[i][0] + Math.cos(aux_roll)*rXY[i][1];
} }
if (debugLevel > -2) { if (debugLevel > 0) {
System.out.println("Auxiliary camera offsets per 1 nominal disparity pixel"); System.out.println("Auxiliary camera offsets per 1 nominal disparity pixel");
for (int i = 0; i <rXY_aux.length;i++) { for (int i = 0; i <rXY_aux.length;i++) {
System.out.println(String.format("Camera %1d x = %8f y = %8f",i,rXY_aux[i][0],rXY_aux[i][1])); System.out.println(String.format("Camera %1d x = %8f y = %8f",i,rXY_aux[i][0],rXY_aux[i][1]));
......
...@@ -1538,11 +1538,12 @@ public class ImageDtt { ...@@ -1538,11 +1538,12 @@ public class ImageDtt {
final double scale_shot, // 3.0; // scale when dividing by sqrt ( <0 - disable correction) final double scale_shot, // 3.0; // scale when dividing by sqrt ( <0 - disable correction)
final double diff_sigma, // 5.0;//RMS difference from average to reduce weights (~ 1.0 - 1/255 full scale image) final double diff_sigma, // 5.0;//RMS difference from average to reduce weights (~ 1.0 - 1/255 full scale image)
final double diff_threshold, // 5.0; // RMS difference from average to discard channel (~ 1.0 - 1/255 full scale image) final double diff_threshold, // 5.0; // RMS difference from average to discard channel (~ 1.0 - 1/255 full scale image)
final boolean diff_gauss, // true; // when averaging images, use gaussian around average as weight (false - sharp all/nothing) final boolean diff_gauss, // true; // when averaging images, use Gaussian around average as weight (false - sharp all/nothing)
final double min_agree, // 3.0; // minimal number of channels to agree on a point (real number to work with fuzzy averages) final double min_agree, // 3.0; // minimal number of channels to agree on a point (real number to work with fuzzy averages)
final boolean dust_remove, // Do not reduce average weight when only one image differes much from the average final boolean dust_remove, // Do not reduce average weight when only one image differs much from the average
final boolean keep_weights, // Add port weights to RGBA stack (debug feature) final boolean keep_weights, // Add port weights to RGBA stack (debug feature)
final GeometryCorrection geometryCorrection, final GeometryCorrection geometryCorrection,
final GeometryCorrection geometryCorrection_main, // if not null correct this camera (aux) to the coordinates of the main
final double [][][][][][] clt_kernels, // [channel_in_quad][color][tileY][tileX][band][pixel] , size should match image (have 1 tile around) final double [][][][][][] clt_kernels, // [channel_in_quad][color][tileY][tileX][band][pixel] , size should match image (have 1 tile around)
final int kernel_step, final int kernel_step,
final int transform_size, final int transform_size,
...@@ -1729,7 +1730,13 @@ public class ImageDtt { ...@@ -1729,7 +1730,13 @@ public class ImageDtt {
System.out.println("macro_mode="+macro_mode); System.out.println("macro_mode="+macro_mode);
} }
final Matrix [] corr_rots = geometryCorrection.getCorrVector().getRotMatrices(); // get array of per-sensor rotation matrices Matrix [] corr_rots_aux = null;
if (geometryCorrection_main != null) {
corr_rots_aux = geometryCorrection.getCorrVector().getRotMatrices(geometryCorrection.getRotMatrix(true));
}
final boolean use_main = corr_rots_aux != null;
final Matrix [] corr_rots = use_main ? corr_rots_aux : geometryCorrection.getCorrVector().getRotMatrices(); // get array of per-sensor rotation matrices
for (int ithread = 0; ithread < threads.length; ithread++) { for (int ithread = 0; ithread < threads.length; ithread++) {
threads[ithread] = new Thread() { threads[ithread] = new Thread() {
@Override @Override
...@@ -1794,15 +1801,29 @@ public class ImageDtt { ...@@ -1794,15 +1801,29 @@ public class ImageDtt {
macro_scale* disparity_array[tileY][tileX] + disparity_corr); macro_scale* disparity_array[tileY][tileX] + disparity_corr);
} else { } else {
centersXY = geometryCorrection.getPortsCoordinatesAndDerivatives( if (use_main) { // this is AUX camera that uses main coordinates
geometryCorrection, // GeometryCorrection gc_main, centersXY = geometryCorrection.getPortsCoordinatesAndDerivatives(
false, // boolean use_rig_offsets, geometryCorrection_main, // GeometryCorrection gc_main,
corr_rots, // Matrix [] rots, true, // boolean use_rig_offsets,
null, // Matrix [][] deriv_rots, corr_rots, // Matrix [] rots,
null, // double [][] pXYderiv, // if not null, should be double[8][] null, // Matrix [][] deriv_rots,
centerX, null, // double [][] pXYderiv, // if not null, should be double[8][]
centerY, centerX,
disparity_array[tileY][tileX] + disparity_corr); centerY,
disparity_array[tileY][tileX] + disparity_corr); // _aux); // + disparity_corr);
} else {
centersXY = geometryCorrection.getPortsCoordinatesAndDerivatives(
geometryCorrection, // GeometryCorrection gc_main,
false, // boolean use_rig_offsets,
corr_rots, // Matrix [] rots,
null, // Matrix [][] deriv_rots,
null, // double [][] pXYderiv, // if not null, should be double[8][]
centerX,
centerY,
disparity_array[tileY][tileX] + disparity_corr);
}
if ((globalDebugLevel > 0) && (tileX == debug_tileX) && (tileY == debug_tileY)) { if ((globalDebugLevel > 0) && (tileX == debug_tileX) && (tileY == debug_tileY)) {
for (int i = 0; i < quad; i++) { for (int i = 0; i < quad; i++) {
...@@ -5567,6 +5588,7 @@ public class ImageDtt { ...@@ -5567,6 +5588,7 @@ public class ImageDtt {
final boolean dust_remove, // Do not reduce average weight when only one image differes much from the average final boolean dust_remove, // Do not reduce average weight when only one image differes much from the average
final boolean keep_weights, // Add port weights to RGBA stack (debug feature) final boolean keep_weights, // Add port weights to RGBA stack (debug feature)
final GeometryCorrection geometryCorrection, final GeometryCorrection geometryCorrection,
final GeometryCorrection geometryCorrection_main, // if not null correct this camera (aux) to the coordinates of the main
final double [][][][][][] clt_kernels, // [channel_in_quad][color][tileY][tileX][band][pixel] , size should match image (have 1 tile around) final double [][][][][][] clt_kernels, // [channel_in_quad][color][tileY][tileX][band][pixel] , size should match image (have 1 tile around)
final int kernel_step, final int kernel_step,
final int transform_size, final int transform_size,
...@@ -5632,6 +5654,7 @@ public class ImageDtt { ...@@ -5632,6 +5654,7 @@ public class ImageDtt {
dust_remove, // Do not reduce average weight when only one image differes much from the average dust_remove, // Do not reduce average weight when only one image differes much from the average
keep_weights, // Add port weights to RGBA stack (debug feature) keep_weights, // Add port weights to RGBA stack (debug feature)
geometryCorrection, geometryCorrection,
geometryCorrection_main, // final GeometryCorrection geometryCorrection_main, // if not null correct this camera (aux) to the coordinates of the main
clt_kernels, // [channel_in_quad][color][tileY][tileX][band][pixel] , size should match image (have 1 tile around) clt_kernels, // [channel_in_quad][color][tileY][tileX][band][pixel] , size should match image (have 1 tile around)
kernel_step, kernel_step,
transform_size, transform_size,
......
...@@ -113,6 +113,11 @@ public class MacroCorrelation { ...@@ -113,6 +113,11 @@ public class MacroCorrelation {
final double [][][] input_data = new double [ImageDtt.QUAD][num_chn][mTiles*tileSize*tileSize]; final double [][][] input_data = new double [ImageDtt.QUAD][num_chn][mTiles*tileSize*tileSize];
// double [][] tiles_tone = src_scan.getTileRBGA( No, we need individual subcameras // double [][] tiles_tone = src_scan.getTileRBGA( No, we need individual subcameras
// 4); // int num_layers); // 4); // int num_layers);
// TODO: add other channels (average tone)
// Maybe filter bright matching from infinity
for (int sub_cam =0; sub_cam < input_data.length; sub_cam++){ for (int sub_cam =0; sub_cam < input_data.length; sub_cam++){
for (int pty = 0; pty < pTilesY; pty++){ for (int pty = 0; pty < pTilesY; pty++){
for (int ptx = 0; ptx < pTilesX; ptx++){ for (int ptx = 0; ptx < pTilesX; ptx++){
...@@ -258,7 +263,8 @@ public class MacroCorrelation { ...@@ -258,7 +263,8 @@ public class MacroCorrelation {
clt_parameters.min_agree, // 3.0; // minimal number of channels to agree on a point (real number to work with fuzzy averages) clt_parameters.min_agree, // 3.0; // minimal number of channels to agree on a point (real number to work with fuzzy averages)
clt_parameters.dust_remove, // Do not reduce average weight when only one image differes much from the average clt_parameters.dust_remove, // Do not reduce average weight when only one image differes much from the average
clt_parameters.keep_weights, // Add port weights to RGBA stack (debug feature) clt_parameters.keep_weights, // Add port weights to RGBA stack (debug feature)
geometryCorrection, // final GeometryCorrection geometryCorrection, geometryCorrection, // final GeometryCorrection geometryCorrection,
null, // final GeometryCorrection geometryCorrection_main, // if not null correct this camera (aux) to the coordinates of the main
null, // clt_kernels, // final double [][][][][][] clt_kernels, // [channel_in_quad][color][tileY][tileX][band][pixel] , size should match image (have 1 tile around) null, // clt_kernels, // final double [][][][][][] clt_kernels, // [channel_in_quad][color][tileY][tileX][band][pixel] , size should match image (have 1 tile around)
clt_parameters.kernel_step, clt_parameters.kernel_step,
clt_parameters.transform_size, clt_parameters.transform_size,
......
This diff is collapsed.
...@@ -30,6 +30,29 @@ import java.util.concurrent.atomic.AtomicInteger; ...@@ -30,6 +30,29 @@ import java.util.concurrent.atomic.AtomicInteger;
public class TileProcessor { public class TileProcessor {
public static String [] SCAN_TITLES = {
"tile_op", // 0
"final", // 1 - calculated, filtered, combined disparity
"disparity", // 2
"disp_cm", // 3
"disp_hor", // 4
"disp_vert", // 5
"final_strength",// 6
"strength", // 7
"strength_hor", // 8
"strength_vert", // 9
"selection", // 10
"border_tiles", // 11
"max_tried", // 12
"diff0", // 13
"diff1", // 14
"diff2", // 15
"diff3", // 16
"diff2max", // 17
"diff2maxAvg", // 18
"normStrength", // 19
"overexp"}; // 20
public ArrayList <CLTPass3d> clt_3d_passes = null; public ArrayList <CLTPass3d> clt_3d_passes = null;
public double [][] rig_disparity_strength = null; // Disparity and strength created by a two-camera rig, with disparity scale and distortions of the main camera public double [][] rig_disparity_strength = null; // Disparity and strength created by a two-camera rig, with disparity scale and distortions of the main camera
public double [][] rig_pre_poles_ds = null; // Rig disparity and strength before processing poles public double [][] rig_pre_poles_ds = null; // Rig disparity and strength before processing poles
...@@ -2163,44 +2186,68 @@ public class TileProcessor { ...@@ -2163,44 +2186,68 @@ public class TileProcessor {
} }
return num_op_tiles; // num_extended; return num_op_tiles; // num_extended;
} }
public void showAllScans(
String in_title,
int slice,
boolean all,
boolean measured,
boolean processed,
boolean combo)
{
String title = in_title+"_"+getScanTitles()[slice];
String [] titles = new String[clt_3d_passes.size()];
double [][] dbg_img = new double [titles.length][];
int num_slices=0;
for (int nscan = 0; nscan < titles.length; nscan++) {
CLTPass3d scan = clt_3d_passes.get(nscan);
if (all ||
(measured && scan.isMeasured()) ||
(processed && scan.isProcessed()) ||
(combo && scan.isCombo())) {
titles[nscan] = nscan+"_";
if (scan.isMeasured()) titles[nscan] += "+M"; else titles[nscan]+="-M";
if (scan.isProcessed()) titles[nscan] += "+P"; else titles[nscan]+="-P";
if (scan.isCombo()) titles[nscan] += "+C"; else titles[nscan]+="-C";
if (scan.getTextureTiles()!=null) titles[nscan] += "+T"; else titles[nscan]+="-T";
dbg_img[nscan] = getShowScan(scan)[slice];
if (dbg_img[nscan] != null) num_slices++;
}
}
if (num_slices > 0) {
(new showDoubleFloatArrays()).showArrays(dbg_img, tilesX, tilesY, true, title, titles);
}
// QUAD_CLT.tp.showScan(QUAD_CLT.tp.clt_3d_passes.get(scan_index),"Scan-"+scan_index);
}
public String [] getScanTitles() {
return SCAN_TITLES;
}
public void showScan( public void showScan(
CLTPass3d scan, CLTPass3d scan,
String in_title) String in_title)
{ {
showDoubleFloatArrays sdfa_instance = null; String [] titles = getScanTitles();
sdfa_instance = new showDoubleFloatArrays(); // just for debugging?
String [] titles = {
"tile_op", // 0
"final", // 1 - calculated, filtered, combined disparity
"disparity", // 2
"disp_cm", // 3
"disp_hor", // 4
"disp_vert", // 5
"final_strength",// 6
"strength", // 7
"strength_hor", // 8
"strength_vert", // 9
"selection", // 10
"border_tiles", // 11
"max_tried", // 12
"diff0", // 13
"diff1", // 14
"diff2", // 15
"diff3", // 16
"diff2max", // 17
"diff2maxAvg", // 18
"normStrength", // 19
"overexp"}; // 20
String title=in_title; String title=in_title;
if (scan.isMeasured()) title+="+M"; else title+="-M"; if (scan.isMeasured()) title+="+M"; else title+="-M";
if (scan.isProcessed()) title+="+P"; else title+="-P"; if (scan.isProcessed()) title+="+P"; else title+="-P";
if (scan.isCombo()) title+="+C"; else title+="-C"; if (scan.isCombo()) title+="+C"; else title+="-C";
if (scan.getTextureTiles()!=null) title+="+T"; else title+="-T"; if (scan.getTextureTiles()!=null) title+="+T"; else title+="-T";
double [][] dbg_img = getShowScan(scan);
(new showDoubleFloatArrays()).showArrays(dbg_img, tilesX, tilesY, true, title,titles);
System.out.println("showScan("+title+"): isMeasured()="+scan.isMeasured()+", isProcessed()="+scan.isProcessed()+", isCombo()="+scan.isCombo());
}
public double [][] getShowScan(
CLTPass3d scan)
{
int NUM_SLICES=getScanTitles().length;
int tlen = tilesX*tilesY; int tlen = tilesX*tilesY;
double [][] dbg_img = new double[titles.length][]; double [][] dbg_img = new double[NUM_SLICES][];
if (scan.tile_op != null) dbg_img[ 0] = new double[tlen]; if (scan.tile_op != null) dbg_img[ 0] = new double[tlen];
if (scan.disparity != null) dbg_img[ 2] = new double[tlen]; if (scan.disparity != null) dbg_img[ 2] = new double[tlen];
if (scan.selected != null) dbg_img[10] = new double[tlen]; if (scan.selected != null) dbg_img[10] = new double[tlen];
...@@ -2247,18 +2294,12 @@ public class TileProcessor { ...@@ -2247,18 +2294,12 @@ public class TileProcessor {
} }
} }
} }
return dbg_img;
// title += "-";
// if (scan.isMeasured()) title += "M";
// if (scan.isProcessed()) title += "P";
// if (scan.isCombo()) title += "C";
sdfa_instance.showArrays(dbg_img, tilesX, tilesY, true, title,titles);
System.out.println("showScan("+title+"): isMeasured()="+scan.isMeasured()+", isProcessed()="+scan.isProcessed()+", isCombo()="+scan.isCombo());
} }
public boolean [] getBackgroundMask( // which tiles do belong to the background public boolean [] getBackgroundMask( // which tiles do belong to the background
double bgnd_range, // disparity range to be considered background double bgnd_range, // disparity range to be considered background
double bgnd_sure, // minimal strength to be considered definitely background double bgnd_sure, // minimal strength to be considered definitely background
......
This diff is collapsed.
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