Commit f406805d authored by Andrey Filippov's avatar Andrey Filippov

separate adjustment parameters for GT-base fitting

parent 05f8b7db
......@@ -170,8 +170,13 @@ public class CLTParameters {
public boolean ly_gt_use_wnd = true; //
public double ly_gt_rms = 0.2; // split small source samples to FG/BG if all aux tile RMS exceeds this value
// boolean split_fg_bg = true;
// boolean for_adjust = false;
// Use for LWIR
public boolean lylw_inf_en = true; // Simultaneously correct disparity at infinity (both poly and extrinsic)
public boolean lylw_aztilt_en = true; // Adjust azimuths and tilts
public boolean lylw_diff_roll_en = true; // Adjust differential rolls (3 of 4 angles)
public boolean lylw_focalLength= true; // Correct scales (focal length temperature? variations)
public boolean lylw_com_roll= false; // Enable common roll (valid for high disparity range only)
public int lylw_par_sel = 0; // Manually select the parameter mask bit 0 - sym0, bit1 - sym1, ... (0 - use checkbox selections above)
public double ly_marg_fract = 0.2; // part of half-width, and half-height to reduce weights
public boolean ly_on_scan = true; // Calculate and apply lazy eye correction after disparity scan (poly or extrinsic)
......@@ -970,6 +975,13 @@ public class CLTParameters {
properties.setProperty(prefix+"ly_gt_use_wnd", this.ly_gt_use_wnd+"");
properties.setProperty(prefix+"ly_gt_rms", this.ly_gt_rms+"");
properties.setProperty(prefix+"lylw_inf_en", this.lylw_inf_en+"");
properties.setProperty(prefix+"lylw_aztilt_en", this.lylw_aztilt_en+"");
properties.setProperty(prefix+"lylw_diff_roll_en", this.lylw_diff_roll_en+"");
properties.setProperty(prefix+"lylw_focalLength", this.lylw_focalLength+"");
properties.setProperty(prefix+"lylw_com_roll", this.lylw_com_roll+"");
properties.setProperty(prefix+"lylw_par_sel", this.lylw_par_sel+"");
properties.setProperty(prefix+"ly_marg_fract", this.ly_marg_fract+"");
properties.setProperty(prefix+"ly_on_scan", this.ly_on_scan+"");
properties.setProperty(prefix+"ly_inf_en", this.ly_inf_en+"");
......@@ -1700,6 +1712,12 @@ public class CLTParameters {
if (properties.getProperty(prefix+"ly_gt_use_wnd")!=null) this.ly_gt_use_wnd=Boolean.parseBoolean(properties.getProperty(prefix+"ly_gt_use_wnd"));
if (properties.getProperty(prefix+"ly_gt_rms")!=null) this.ly_gt_rms=Double.parseDouble(properties.getProperty(prefix+"ly_gt_rms"));
if (properties.getProperty(prefix+"lylw_inf_en")!=null) this.lylw_inf_en=Boolean.parseBoolean(properties.getProperty(prefix+"lylw_inf_en"));
if (properties.getProperty(prefix+"lylw_aztilt_en")!=null) this.lylw_aztilt_en=Boolean.parseBoolean(properties.getProperty(prefix+"lylw_aztilt_en"));
if (properties.getProperty(prefix+"lylw_diff_roll_en")!=null) this.lylw_diff_roll_en=Boolean.parseBoolean(properties.getProperty(prefix+"lylw_diff_roll_en"));
if (properties.getProperty(prefix+"lylw_focalLength")!=null) this.lylw_focalLength=Boolean.parseBoolean(properties.getProperty(prefix+"lylw_focalLength"));
if (properties.getProperty(prefix+"lylw_com_roll")!=null) this.lylw_com_roll=Boolean.parseBoolean(properties.getProperty(prefix+"lylw_com_roll"));
if (properties.getProperty(prefix+"lylw_par_sel")!=null) this.lylw_par_sel=Integer.parseInt(properties.getProperty(prefix+"lylw_par_sel"));
if (properties.getProperty(prefix+"ly_marg_fract")!=null) this.ly_marg_fract=Double.parseDouble(properties.getProperty(prefix+"ly_marg_fract"));
if (properties.getProperty(prefix+"ly_on_scan")!=null) this.ly_on_scan=Boolean.parseBoolean(properties.getProperty(prefix+"ly_on_scan"));
......@@ -2475,8 +2493,17 @@ public class CLTParameters {
gd.addNumericField("Minimal reference (main) channel correlation strength", this.ly_gt_strength, 3);
gd.addCheckbox ("Use window for AUX tiles to reduce weight of the hi-res tiles near low-res tile boundaries", this.ly_gt_use_wnd);
gd.addNumericField("Aux disparity thershold to split FG and BG (and disable AUX tile for adjustment)", this.ly_gt_rms, 3);
gd.addMessage ("--- others ---");
gd.addMessage ("--- Lazy eye from GT ---");
gd.addCheckbox ("Adjust disparity using objects at infinity by changing individual tilt and azimuth ", this.lylw_inf_en," disable if there are no really far objects in the scene");
gd.addCheckbox ("Adjust azimuths and tilts", this.lylw_aztilt_en,"Adjust azimuths and tilts excluding those that change disparity");
gd.addCheckbox ("Adjust differential rolls", this.lylw_diff_roll_en,"Adjust differential rolls (3 of 4 rolls, keeping average roll)");
gd.addCheckbox ("Correct scales (focal length temperature? variations)", this.lylw_focalLength);
gd.addCheckbox ("Enable common roll adjustment (valid for high disparity range scans only)", this.lylw_com_roll);
gd.addNumericField("Manual parameter mask selection (0 use checkboxes above)", this.lylw_par_sel, 0, 5,"",
"bit 0 - sym0, bit1 - sym1, ...");
gd.addMessage ("--- other LMA parameters ---");
gd.addNumericField("Relative weight margins (0.0 - all 1.0, 1.0 sin^2", this.ly_marg_fract, 8,3,"",
"Reduce weigt of peripheral tiles");
......@@ -3319,6 +3346,13 @@ public class CLTParameters {
this.ly_gt_use_wnd= gd.getNextBoolean();
this.ly_gt_rms= gd.getNextNumber();
this.lylw_inf_en = gd.getNextBoolean();
this.lylw_aztilt_en = gd.getNextBoolean();
this.lylw_diff_roll_en = gd.getNextBoolean();
this.lylw_focalLength = gd.getNextBoolean();
this.lylw_com_roll = gd.getNextBoolean();
this.lylw_par_sel= (int) gd.getNextNumber();
this.ly_marg_fract= gd.getNextNumber();
this.ly_on_scan= gd.getNextBoolean();
this.ly_inf_en= gd.getNextBoolean();
......
......@@ -242,7 +242,10 @@ public class AlignmentCorrection {
double [][] jt)
{
double [][] dMismatch_dXY = get_dMismatch_dXY();
if ((dMismatch_dXY.length == 0) || (jt.length == 0)) { // happens with empty parameters list
System.out.println("BUG: dMismatch_dXY.length="+dMismatch_dXY.length+", jt.length="+jt.length);
return null;
}
double [][] jt_conv = new double [jt.length][jt[0].length/dMismatch_dXY[0].length*dMismatch_dXY.length]; // now dMismatch_dXY is square
// multiplying by transposed dMismatch_dXY
for (int g = 0; g < jt[0].length/dMismatch_dXY[0].length; g++) {
......@@ -2353,18 +2356,18 @@ B = |+dy0 -dy1 -2*dy3 |
double [] old_new_rms = new double[1];
boolean apply_extrinsic = true;
int solveCorr_debug = ((clt_parameters.lym_iter == 1) && (clt_parameters.ly_par_sel != 0))? 2 : debugLevel;
GeometryCorrection.CorrVector corr_vector = solveCorr (
clt_parameters.ly_inf_en, // boolean use_disparity, // if true will ignore disparity data even if available (was false)
// clt_parameters.ly_combo_en, // boolean use_other_extr, // adjust other extrinsic parameters that do not influence disparity, common roll and zoom
clt_parameters.ly_aztilt_en,// boolean use_aztilts, // Adjust azimuths and tilts excluding disparity
clt_parameters.ly_diff_roll_en,// boolean use_diff_rolls, // Adjust differential rolls (3 of 4 angles)
clt_parameters.lylw_inf_en, // boolean use_disparity, // if true will ignore disparity data even if available (was false)
clt_parameters.lylw_aztilt_en,// boolean use_aztilts, // Adjust azimuths and tilts excluding disparity
clt_parameters.lylw_diff_roll_en,// boolean use_diff_rolls, // Adjust differential rolls (3 of 4 angles)
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_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.lylw_com_roll, // boolean common_roll, // Enable common roll (valid for high disparity range only)
clt_parameters.lylw_focalLength, // boolean corr_focalLength, // Correct scales (focal length temperature? variations)
clt_parameters.lylw_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,
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,
old_new_rms, // double [] old_new_rms, // should be double[2]
// 2); // debugLevel); // 2); // 1); // int debugLevel)
......@@ -2919,13 +2922,13 @@ B = |+dy0 -dy1 -2*dy3 |
boolean apply_extrinsic = true;
int solveCorr_debug = ((clt_parameters.lym_iter == 1) && (clt_parameters.ly_par_sel != 0))? 2 : debugLevel;
GeometryCorrection.CorrVector corr_vector = solveCorr (
clt_parameters.ly_inf_en, // boolean use_disparity, // if true will ignore disparity data even if available (was false)
clt_parameters.ly_aztilt_en,// boolean use_aztilts, // Adjust azimuths and tilts excluding disparity
clt_parameters.ly_diff_roll_en,// boolean use_diff_rolls, // Adjust differential rolls (3 of 4 angles)
clt_parameters.lylw_inf_en, // boolean use_disparity, // if true will ignore disparity data even if available (was false)
clt_parameters.lylw_aztilt_en,// boolean use_aztilts, // Adjust azimuths and tilts excluding disparity
clt_parameters.lylw_diff_roll_en,// boolean use_diff_rolls, // Adjust differential rolls (3 of 4 angles)
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_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.lylw_com_roll, // boolean common_roll, // Enable common roll (valid for high disparity range only)
clt_parameters.lylw_focalLength, // boolean corr_focalLength, // Correct scales (focal length temperature? variations)
clt_parameters.lylw_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,
qc.geometryCorrection, // GeometryCorrection geometryCorrection,
/// geometryCorrection_main, // GeometryCorrection geometryCorrection_main, // if is aux camera using main cameras' coordinates. Disparity is still in aux camera pixels
......@@ -3457,7 +3460,6 @@ B = |+dy0 -dy1 -2*dy3 |
public GeometryCorrection.CorrVector solveCorr (
boolean use_disparity, // adjust disparity-related extrinsics
// boolean use_other_extr, // adjust other extrinsic parameters that do not influence disparity, common roll and zoom
boolean use_aztilts, // Adjust azimuths and tilts excluding disparity
boolean use_diff_rolls, // Adjust differential rolls (3 of 4 angles)
boolean force_convergence, // if true try to adjust convergence (disparity, symmetrical parameter 0) even with no disparity
......@@ -3467,7 +3469,6 @@ B = |+dy0 -dy1 -2*dy3 |
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,
GeometryCorrection geometryCorrection,
/// GeometryCorrection geometryCorrection_main, // if is aux camera using main cameras' coordinates. Disparity is still in aux camera pixels
GeometryCorrection.CorrVector corr_vector,
double [] old_new_rms, // should be double[2]
int debugLevel)
......@@ -3483,15 +3484,11 @@ B = |+dy0 -dy1 -2*dy3 |
}
boolean [] par_mask = geometryCorrection.getParMask(
// temporary - just for testing
// force_convergence, // boolean disparity_only,
// force_convergence && has_disparity, // boolean use_disparity,
has_disparity, // boolean use_disparity,
// use_other_extr, // boolean use_other_extr,
use_aztilts, // Adjust azimuths and tilts excluding disparity
use_diff_rolls, // Adjust differential rolls (3 of 4 angles)
common_roll,// boolean common_roll,
common_roll, // boolean common_roll,
corr_focalLength, // boolean corr_focalLength);
manual_par_sel); // Manually select the parameter mask bit 0 - sym0, bit1 - sym1, ... (0 - use boolean flags, != 0 - ignore boolean flags)
......
......@@ -7662,7 +7662,7 @@ public class QuadCLT {
}
// iteration steps
// if (!batch_mode && clt_parameters.show_extrinsic && (debugLevel >-1)) {
if (clt_parameters.show_extrinsic && (debugLevel >-3)) { // temporary
if (clt_parameters.show_extrinsic && (debugLevel > -1)) { // temporary
tp.showScan(
tp.clt_3d_passes.get(bg_scan), // CLTPass3d scan,
"bg_scan_post"); //String title)
......@@ -7688,10 +7688,12 @@ public class QuadCLT {
(num_iter >0)? -1: bg_scan, // final int bgIndex, // combine, if >=0
tp.threadsMax, // maximal number of threads to launch
false, // updateStatus,
debugLevelInner + 7); // - 1); // -5-1
debugLevelInner -1); // - 1); // -5-1
if (debugLevel > -2) {
tp.showScan(
tp.clt_3d_passes.get(combo_scan), // CLTPass3d scan,
"LY_combo_scan-"+combo_scan+"_post"); //String title)
}
int tilesX = tp.getTilesX();
int tilesY = tp.getTilesY();
......@@ -7745,7 +7747,8 @@ public class QuadCLT {
if (debugLevel > -2){
System.out.println("New extrinsic corrections:");
System.out.println(corr_vector.toString());
}
if (debugLevel > -3){
System.out.println("Increment extrinsic corrections:");
System.out.println(diff_corr.toString());
// System.out.println("Correction scale = "+clt_parameters.ly_corr_scale);
......@@ -7772,7 +7775,7 @@ public class QuadCLT {
" final RMS = " + old_new_rms[1]+ " (debugLevel = "+debugLevel+")");
}
if (debugLevel > -10) {
if ((debugLevel > -1) || done) {
if ((debugLevel > -3) || done) {
// 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]);
System.out.println("New extrinsic corrections:");
......@@ -10280,11 +10283,11 @@ public class QuadCLT {
}
final double disparity_corr = (z_correction == 0) ? 0.0 : geometryCorrection.getDisparityFromZ(1.0/z_correction);
if (debugLevel > -5){
tp.showScan(
scan, // CLTPass3d scan,
"LY-combo_scan-"+scan+"_post"); //String title)
}
// use new, LMA-based mismatch calculation
double [][] lazy_eye_data = image_dtt.cltMeasureLazyEye ( // returns d,s lazy eye parameters
clt_parameters.img_dtt, // final ImageDttParameters imgdtt_params, // Now just extra correlation parameters, later will include, most others
......
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