Commit 4bbac7dc authored by Andrey Filippov's avatar Andrey Filippov

Testing LMA with multi-scene LY

parent 816eae59
...@@ -329,6 +329,7 @@ public class CLTParameters { ...@@ -329,6 +329,7 @@ public class CLTParameters {
public double lyms_inf_range_offs = 0.05; // Add to the disparity distribution mode for infinity center public double lyms_inf_range_offs = 0.05; // Add to the disparity distribution mode for infinity center
public double lyms_inf_range = 0.15; // Consider infinity tiles that are within +/- half of this range from infinity center public double lyms_inf_range = 0.15; // Consider infinity tiles that are within +/- half of this range from infinity center
//non-infinity parameters //non-infinity parameters
public int lyms_margin = 6; // discard tiles from each side
public double lyms_min_inf_str = 0.2; // Minimal strength of infinity tiles public double lyms_min_inf_str = 0.2; // Minimal strength of infinity tiles
public double lyms_min_fg_str = 0.4; // Minimal strength of non-infinity tiles public double lyms_min_fg_str = 0.4; // Minimal strength of non-infinity tiles
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
...@@ -1263,6 +1264,7 @@ public class CLTParameters { ...@@ -1263,6 +1264,7 @@ public class CLTParameters {
properties.setProperty(prefix+"lyms_far_fract", this.lyms_far_fract +""); properties.setProperty(prefix+"lyms_far_fract", this.lyms_far_fract +"");
properties.setProperty(prefix+"lyms_inf_range_offs", this.lyms_inf_range_offs +""); properties.setProperty(prefix+"lyms_inf_range_offs", this.lyms_inf_range_offs +"");
properties.setProperty(prefix+"lyms_inf_range", this.lyms_inf_range +""); properties.setProperty(prefix+"lyms_inf_range", this.lyms_inf_range +"");
properties.setProperty(prefix+"lyms_margin", this.lyms_margin +"");
properties.setProperty(prefix+"lyms_min_inf_str", this.lyms_min_inf_str +""); properties.setProperty(prefix+"lyms_min_inf_str", this.lyms_min_inf_str +"");
properties.setProperty(prefix+"lyms_min_fg_str", this.lyms_min_fg_str +""); properties.setProperty(prefix+"lyms_min_fg_str", this.lyms_min_fg_str +"");
properties.setProperty(prefix+"lyms_clust_size", this.lyms_clust_size +""); properties.setProperty(prefix+"lyms_clust_size", this.lyms_clust_size +"");
...@@ -2104,6 +2106,7 @@ public class CLTParameters { ...@@ -2104,6 +2106,7 @@ public class CLTParameters {
if (properties.getProperty(prefix+"lyms_far_fract")!=null) this.lyms_far_fract=Double.parseDouble(properties.getProperty(prefix+"lyms_far_fract")); if (properties.getProperty(prefix+"lyms_far_fract")!=null) this.lyms_far_fract=Double.parseDouble(properties.getProperty(prefix+"lyms_far_fract"));
if (properties.getProperty(prefix+"lyms_inf_range_offs")!=null) this.lyms_inf_range_offs=Double.parseDouble(properties.getProperty(prefix+"lyms_inf_range_offs")); if (properties.getProperty(prefix+"lyms_inf_range_offs")!=null) this.lyms_inf_range_offs=Double.parseDouble(properties.getProperty(prefix+"lyms_inf_range_offs"));
if (properties.getProperty(prefix+"lyms_inf_range")!=null) this.lyms_inf_range=Double.parseDouble(properties.getProperty(prefix+"lyms_inf_range")); if (properties.getProperty(prefix+"lyms_inf_range")!=null) this.lyms_inf_range=Double.parseDouble(properties.getProperty(prefix+"lyms_inf_range"));
if (properties.getProperty(prefix+"lyms_margin")!=null) this.lyms_margin=Integer.parseInt(properties.getProperty(prefix+"lyms_margin"));
if (properties.getProperty(prefix+"lyms_min_inf_str")!=null) this.lyms_min_inf_str=Double.parseDouble(properties.getProperty(prefix+"lyms_min_inf_str")); if (properties.getProperty(prefix+"lyms_min_inf_str")!=null) this.lyms_min_inf_str=Double.parseDouble(properties.getProperty(prefix+"lyms_min_inf_str"));
if (properties.getProperty(prefix+"lyms_min_fg_str")!=null) this.lyms_min_fg_str=Double.parseDouble(properties.getProperty(prefix+"lyms_min_fg_str")); if (properties.getProperty(prefix+"lyms_min_fg_str")!=null) this.lyms_min_fg_str=Double.parseDouble(properties.getProperty(prefix+"lyms_min_fg_str"));
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"));
...@@ -3057,6 +3060,8 @@ public class CLTParameters { ...@@ -3057,6 +3060,8 @@ public class CLTParameters {
gd.addNumericField("Infinity full range", this.lyms_inf_range, 4,6,"pix", gd.addNumericField("Infinity full range", this.lyms_inf_range, 4,6,"pix",
"Consider infinity tiles that are within +/- half of this range from infinity center"); "Consider infinity tiles that are within +/- half of this range from infinity center");
gd.addMessage ("--- LY data measurement ---"); gd.addMessage ("--- LY data measurement ---");
gd.addNumericField("LY Margin", this.lyms_margin, 0,3,"tiles",
"Discard tiles from border");
gd.addNumericField("Minimal strength (infinity)", this.lyms_min_inf_str, 4,6,"", gd.addNumericField("Minimal strength (infinity)", this.lyms_min_inf_str, 4,6,"",
"Minimal strength of infinity tiles"); "Minimal strength of infinity tiles");
gd.addNumericField("Minimal strength (non-infinity)", this.lyms_min_fg_str, 4,6,"", gd.addNumericField("Minimal strength (non-infinity)", this.lyms_min_fg_str, 4,6,"",
...@@ -4036,6 +4041,7 @@ public class CLTParameters { ...@@ -4036,6 +4041,7 @@ public class CLTParameters {
this.lyms_far_fract= gd.getNextNumber(); this.lyms_far_fract= gd.getNextNumber();
this.lyms_inf_range_offs= gd.getNextNumber(); this.lyms_inf_range_offs= gd.getNextNumber();
this.lyms_inf_range= gd.getNextNumber(); this.lyms_inf_range= gd.getNextNumber();
this.lyms_margin= (int) gd.getNextNumber();
this.lyms_min_inf_str= gd.getNextNumber(); this.lyms_min_inf_str= gd.getNextNumber();
this.lyms_min_fg_str= gd.getNextNumber(); this.lyms_min_fg_str= gd.getNextNumber();
this.lyms_clust_size= (int) gd.getNextNumber(); this.lyms_clust_size= (int) gd.getNextNumber();
......
...@@ -100,6 +100,7 @@ import com.elphel.imagej.tileprocessor.DttRad2; ...@@ -100,6 +100,7 @@ import com.elphel.imagej.tileprocessor.DttRad2;
import com.elphel.imagej.tileprocessor.ErsCorrection; import com.elphel.imagej.tileprocessor.ErsCorrection;
import com.elphel.imagej.tileprocessor.ImageDtt; import com.elphel.imagej.tileprocessor.ImageDtt;
import com.elphel.imagej.tileprocessor.MLStats; import com.elphel.imagej.tileprocessor.MLStats;
import com.elphel.imagej.tileprocessor.MultisceneLY;
import com.elphel.imagej.tileprocessor.QuadCLT; import com.elphel.imagej.tileprocessor.QuadCLT;
import com.elphel.imagej.tileprocessor.SymmVector; import com.elphel.imagej.tileprocessor.SymmVector;
import com.elphel.imagej.tileprocessor.TwoQuadCLT; import com.elphel.imagej.tileprocessor.TwoQuadCLT;
...@@ -7379,6 +7380,7 @@ public class Eyesis_Correction implements PlugIn, ActionListener { ...@@ -7379,6 +7380,7 @@ public class Eyesis_Correction implements PlugIn, ActionListener {
* @return * @return
*/ */
public boolean adjustLYSeries(boolean use_aux) { public boolean adjustLYSeries(boolean use_aux) {
MultisceneLY.MSLY_MODE adjust_mode = MultisceneLY.MSLY_MODE.INF_NOINF;
long startTime = System.nanoTime(); long startTime = System.nanoTime();
// load needed sensor and kernels files // load needed sensor and kernels files
if (!prepareRigImages()) if (!prepareRigImages())
...@@ -7437,6 +7439,7 @@ public class Eyesis_Correction implements PlugIn, ActionListener { ...@@ -7437,6 +7439,7 @@ public class Eyesis_Correction implements PlugIn, ActionListener {
TWO_QUAD_CLT.adjustLYSeries( TWO_QUAD_CLT.adjustLYSeries(
quadCLT, // QUAD_CLT, // QuadCLT quadCLT_main, quadCLT, // QUAD_CLT, // QuadCLT quadCLT_main,
CLT_PARAMETERS, // EyesisCorrectionParameters.DCTParameters dct_parameters, CLT_PARAMETERS, // EyesisCorrectionParameters.DCTParameters dct_parameters,
adjust_mode, // MultisceneLY.MSLY_MODE adjust_mode,
DEBAYER_PARAMETERS, // EyesisCorrectionParameters.DebayerParameters debayerParameters, DEBAYER_PARAMETERS, // EyesisCorrectionParameters.DebayerParameters debayerParameters,
colorProcParameters, // COLOR_PROC_PARAMETERS, //EyesisCorrectionParameters.ColorProcParameters colorProcParameters, // COLOR_PROC_PARAMETERS, //EyesisCorrectionParameters.ColorProcParameters
// colorProcParameters, // colorProcParameters,
......
...@@ -118,6 +118,10 @@ public class ExtrinsicAdjustment { ...@@ -118,6 +118,10 @@ public class ExtrinsicAdjustment {
public double dbg_delta = 0; // 1.0E-5; // if not 0 - use delta instead of the derivatives in getJacobianTransposed public double dbg_delta = 0; // 1.0E-5; // if not 0 - use delta instead of the derivatives in getJacobianTransposed
public void setForceDisparity(boolean [] force_disparity) {
this.force_disparity = force_disparity;
}
public double [] getOldNewRMS() { public double [] getOldNewRMS() {
double [] on_rms = new double[2]; double [] on_rms = new double[2];
if (initial_rms != null) { if (initial_rms != null) {
...@@ -291,13 +295,13 @@ public class ExtrinsicAdjustment { ...@@ -291,13 +295,13 @@ public class ExtrinsicAdjustment {
s += "Port"+suffix+": ["; s += "Port"+suffix+": [";
for (int p = 0; p < num_sensors; p++) s += String.format(hfmt, p, "");s+="]\n"; for (int p = 0; p < num_sensors; p++) s += String.format(hfmt, p, "");s+="]\n";
s += "DD"+suffix+"= ["; s += "DD"+suffix+"= [";
for (int p = 0; p < num_sensors; p++) s += String.format(dfmt, avg[indx_dd0 + p]);s+="]" + String.format(" # avg = "+dfmta+"\n", avg_dd); for (int p = 0; p < num_sensors; p++) s += String.format(dfmt, avg[indx_dd0 + p]);s+="]" + String.format(" # avg = "+dfmta+" (should be 0)\n", avg_dd);
s += "ND"+suffix+"= ["; s += "ND"+suffix+"= [";
for (int p = 0; p < num_sensors; p++) s += String.format(dfmt, avg[indx_nd0 + p]);s+="]" + String.format(" # avg = "+dfmta+"\n", avg_nd); for (int p = 0; p < num_sensors; p++) s += String.format(dfmt, avg[indx_nd0 + p]);s+="]" + String.format(" # avg = "+dfmta+" (May be non-0, especially large S1)\n", avg_nd);
s += "DX"+suffix+"= ["; s += "DX"+suffix+"= [";
for (int p = 0; p < num_sensors; p++) s += String.format(dfmt, avg[INDX_X0 + 2 * p + 0]);s+="]" + String.format(" # avg = "+dfmta+"\n", avg_x); for (int p = 0; p < num_sensors; p++) s += String.format(dfmt, avg[INDX_X0 + 2 * p + 0]);s+="]" + String.format(" # avg = "+dfmta+" (should be 0)\n", avg_x);
s += "DY"+suffix+"= ["; s += "DY"+suffix+"= [";
for (int p = 0; p < num_sensors; p++) s += String.format(dfmt, avg[INDX_X0 + 2 * p + 1]);s+="]" + String.format(" # avg = "+dfmta+"\n", avg_y); for (int p = 0; p < num_sensors; p++) s += String.format(dfmt, avg[INDX_X0 + 2 * p + 1]);s+="]" + String.format(" # avg = "+dfmta+" (should be 0)\n", avg_y);
return s; return s;
} }
/* /*
...@@ -457,19 +461,6 @@ public class ExtrinsicAdjustment { ...@@ -457,19 +461,6 @@ public class ExtrinsicAdjustment {
x0y0, // double[][] data, x0y0, // double[][] data,
"nondistorted X0Y0");// String title); "nondistorted X0Y0");// String title);
} }
/*
this.par_mask = geometryCorrection.getParMask(
use_disparity, // has_disparity, // boolean use_disparity,
use_aztilts, // Adjust azimuths and tilts excluding disparity
use_diff_rolls, // Adjust differential rolls (3 of 4 angles)
common_roll,// boolean common_roll,
corr_focalLength, // boolean corr_focalLength);
ers_rot, // boolean ers_rot, // Enable ERS correction of the camera rotation
ers_forw, // Enable ERS correction of the camera linear movement in z direction
ers_side, // Enable ERS correction of the camera linear movement in x direction
ers_vert, // Enable ERS correction of the camera linear movement in y direction
manual_par_sel); // Manually select the parameter mask bit 0 - sym0, bit1 - sym1, ... (0 - use boolean flags, != 0 - ignore boolean flags)
*/
boolean [] filtered_infinity = null; boolean [] filtered_infinity = null;
double [] dfe = null; double [] dfe = null;
...@@ -496,20 +487,7 @@ public class ExtrinsicAdjustment { ...@@ -496,20 +487,7 @@ public class ExtrinsicAdjustment {
inf_min_disparity, // double min_infinity, inf_min_disparity, // double min_infinity,
inf_max_disparity); // double max_infinity inf_max_disparity); // double max_infinity
} }
/*
this.weights = getWeights( // will ignore window for infinity (already used for selection)
measured_dsxy, // double [][] measured_dsxy,
(use_disparity? force_disparity: null), // boolean [] force_disparity, // same dimension as dsdn, true if disparity should be controlled
filtered_infinity, // boolean [] filtered_infinity,
dfe, // double [] distance_from_edge,// to reduce weight of the mountain ridge, increase clouds (or null)
min_num_forced, // int min_num_forced,
infinity_right_left, // boolean infinity_right_left, // each halve should have > min_num_forced, will calculate separate average
weight_infinity, // double weight_infinity, // total weight of infinity tiles fraction (0.0 - 1.0)
weight_disparity, // double weight_disparity, // disparity weight relative to the sum of 8 lazy eye values of the same tile
weight_disparity_inf, // double weight_disparity_inf, // disparity weight relative to the sum of 8 lazy eye values of the same tile for infinity
max_disparity_far, // double max_disparity_far) // reduce weights of near tiles proportional to sqrt(max_disparity_far/disparity)
max_disparity_use);
*/
int [] inf_stat = setWeights( // number right, number left int [] inf_stat = setWeights( // number right, number left
measured_dsxy, // double [][] measured_dsxy, measured_dsxy, // double [][] measured_dsxy,
(use_disparity? force_disparity: null), // boolean [] force_disparity, // same dimension as dsdn, true if disparity should be controlled (use_disparity? force_disparity: null), // boolean [] force_disparity, // same dimension as dsdn, true if disparity should be controlled
...@@ -2366,7 +2344,7 @@ public class ExtrinsicAdjustment { ...@@ -2366,7 +2344,7 @@ public class ExtrinsicAdjustment {
if (rslt == null) { if (rslt == null) {
return false; // need to check return false; // need to check
} }
if (debug_level > 1) { if (debug_level > -3) { // > 0) {
System.out.println("LMA step "+iter+": {"+rslt[0]+","+rslt[1]+"} full RMS= "+good_or_bad_rms[0]+ System.out.println("LMA step "+iter+": {"+rslt[0]+","+rslt[1]+"} full RMS= "+good_or_bad_rms[0]+
" ("+initial_rms[0]+"), pure RMS="+good_or_bad_rms[1]+" ("+initial_rms[1]+") + lambda="+lambda); " ("+initial_rms[0]+"), pure RMS="+good_or_bad_rms[1]+" ("+initial_rms[1]+") + lambda="+lambda);
} }
......
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