Commit b47dba20 authored by Andrey Filippov's avatar Andrey Filippov
Browse files

tested new extrinsic adjustment including ERS rotation

parent cb607a02
Loading
Loading
Loading
Loading
+25 −5
Original line number Original line Diff line number Diff line
@@ -179,8 +179,12 @@ public class CLTParameters {
	public boolean    ly_diff_roll_en = true;    // Adjust differential rolls (3 of 4 angles)
	public boolean    ly_diff_roll_en = true;    // Adjust differential rolls (3 of 4 angles)
	public boolean    ly_focalLength=   true;    // Correct scales (focal length temperature? variations)
	public boolean    ly_focalLength=   true;    // Correct scales (focal length temperature? variations)
	public boolean    ly_com_roll=      false;   // Enable common roll (valid for high disparity range only)
	public boolean    ly_com_roll=      false;   // Enable common roll (valid for high disparity range only)
	public boolean    ly_ers_rot=       true;    // Enable ERS correction of the camera rotation
	public boolean    ly_ers_lin=       false;   // Enable ERS correction of the camera linear movement
	public int        ly_par_sel   =    0;       // Manually select the parameter mask bit 0 - sym0, bit1 - sym1, ... (0 - use checkbox selections above)
	public int        ly_par_sel   =    0;       // Manually select the parameter mask bit 0 - sym0, bit1 - sym1, ... (0 - use checkbox selections above)


	public int        ly_debug_level =  0;       // LY debug level

	public boolean    ly_right_left=    false;   // equalize weights of right/left FoV (use with horizon in both halves and gross infinity correction)
	public boolean    ly_right_left=    false;   // equalize weights of right/left FoV (use with horizon in both halves and gross infinity correction)


	public int        ly_per_quad =     10;      // minimal tiles per quadrant (not counting the worst) tp proceed
	public int        ly_per_quad =     10;      // minimal tiles per quadrant (not counting the worst) tp proceed
@@ -966,8 +970,12 @@ public class CLTParameters {
		properties.setProperty(prefix+"ly_diff_roll_en",            this.ly_diff_roll_en+"");
		properties.setProperty(prefix+"ly_diff_roll_en",            this.ly_diff_roll_en+"");
		properties.setProperty(prefix+"ly_focalLength",             this.ly_focalLength+"");
		properties.setProperty(prefix+"ly_focalLength",             this.ly_focalLength+"");
		properties.setProperty(prefix+"ly_com_roll",                this.ly_com_roll+"");
		properties.setProperty(prefix+"ly_com_roll",                this.ly_com_roll+"");

		properties.setProperty(prefix+"ly_ers_rot",                 this.ly_ers_rot+"");
		properties.setProperty(prefix+"ly_ers_lin",                 this.ly_ers_lin+"");
		properties.setProperty(prefix+"ly_par_sel",                 this.ly_par_sel+"");
		properties.setProperty(prefix+"ly_par_sel",                 this.ly_par_sel+"");
		properties.setProperty(prefix+"ly_debug_level",             this.ly_debug_level+"");


		properties.setProperty(prefix+"ly_right_left",              this.ly_right_left+"");
		properties.setProperty(prefix+"ly_right_left",              this.ly_right_left+"");


		properties.setProperty(prefix+"ly_per_quad",                this.ly_per_quad +"");
		properties.setProperty(prefix+"ly_per_quad",                this.ly_per_quad +"");
@@ -1683,8 +1691,11 @@ public class CLTParameters {
		if (properties.getProperty(prefix+"ly_diff_roll_en")!=null)               this.ly_diff_roll_en=Boolean.parseBoolean(properties.getProperty(prefix+"ly_diff_roll_en"));
		if (properties.getProperty(prefix+"ly_diff_roll_en")!=null)               this.ly_diff_roll_en=Boolean.parseBoolean(properties.getProperty(prefix+"ly_diff_roll_en"));
		if (properties.getProperty(prefix+"ly_focalLength")!=null)                this.ly_focalLength=Boolean.parseBoolean(properties.getProperty(prefix+"ly_focalLength"));
		if (properties.getProperty(prefix+"ly_focalLength")!=null)                this.ly_focalLength=Boolean.parseBoolean(properties.getProperty(prefix+"ly_focalLength"));
		if (properties.getProperty(prefix+"ly_com_roll")!=null)                   this.ly_com_roll=Boolean.parseBoolean(properties.getProperty(prefix+"ly_com_roll"));
		if (properties.getProperty(prefix+"ly_com_roll")!=null)                   this.ly_com_roll=Boolean.parseBoolean(properties.getProperty(prefix+"ly_com_roll"));

		if (properties.getProperty(prefix+"ly_ers_rot")!=null)                    this.ly_ers_rot=Boolean.parseBoolean(properties.getProperty(prefix+"ly_ers_rot"));
		if (properties.getProperty(prefix+"ly_ers_lin")!=null)                    this.ly_ers_lin=Boolean.parseBoolean(properties.getProperty(prefix+"ly_ers_lin"));
		if (properties.getProperty(prefix+"ly_par_sel")!=null)                    this.ly_par_sel=Integer.parseInt(properties.getProperty(prefix+"ly_par_sel"));
		if (properties.getProperty(prefix+"ly_par_sel")!=null)                    this.ly_par_sel=Integer.parseInt(properties.getProperty(prefix+"ly_par_sel"));
		if (properties.getProperty(prefix+"ly_debug_level")!=null)                this.ly_debug_level=Integer.parseInt(properties.getProperty(prefix+"ly_debug_level"));

		if (properties.getProperty(prefix+"ly_right_left")!=null)                 this.ly_right_left=Boolean.parseBoolean(properties.getProperty(prefix+"ly_right_left"));
		if (properties.getProperty(prefix+"ly_right_left")!=null)                 this.ly_right_left=Boolean.parseBoolean(properties.getProperty(prefix+"ly_right_left"));


		if (properties.getProperty(prefix+"ly_per_quad")!=null)                   this.ly_per_quad=Integer.parseInt(properties.getProperty(prefix+"ly_per_quad"));
		if (properties.getProperty(prefix+"ly_per_quad")!=null)                   this.ly_per_quad=Integer.parseInt(properties.getProperty(prefix+"ly_per_quad"));
@@ -2436,7 +2447,7 @@ public class CLTParameters {
		gd.addTab         ("Lazy eye", "Lazy eye parameters");
		gd.addTab         ("Lazy eye", "Lazy eye parameters");


		gd.addMessage     ("--- main-to-aux depth map parameters ---");
		gd.addMessage     ("--- main-to-aux depth map parameters ---");
		gd.addNumericField("Minimal reference (main) channel orrelation strength",                              this.ly_gt_strength,        3);
		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.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.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     ("--- others ---");
@@ -2446,9 +2457,15 @@ public class CLTParameters {
		gd.addCheckbox    ("Adjust differential rolls",                                                         this.ly_diff_roll_en,"Adjust differential rolls (3 of 4 rolls, keeping average roll)");
		gd.addCheckbox    ("Adjust differential rolls",                                                         this.ly_diff_roll_en,"Adjust differential rolls (3 of 4 rolls, keeping average roll)");
		gd.addCheckbox    ("Correct scales (focal length temperature? variations)",                             this.ly_focalLength);
		gd.addCheckbox    ("Correct scales (focal length temperature? variations)",                             this.ly_focalLength);
		gd.addCheckbox    ("Enable common roll adjustment (valid for high disparity range scans only)",         this.ly_com_roll);
		gd.addCheckbox    ("Enable common roll adjustment (valid for high disparity range scans only)",         this.ly_com_roll);

		gd.addCheckbox    ("Enable ERS correction of the camera rotation",                                      this.ly_ers_rot);
		gd.addCheckbox    ("Enable ERS correction of the camera linear movement",                               this.ly_ers_lin);
		gd.addNumericField("Manual parameter mask selection (0 use checkboxes above)",                          this.ly_par_sel,  0, 5,"",
		gd.addNumericField("Manual parameter mask selection (0 use checkboxes above)",                          this.ly_par_sel,  0, 5,"",
				"bit 0 - sym0, bit1 - sym1, ...");
				"bit 0 - sym0, bit1 - sym1, ...");
		gd.addNumericField("Debug level for lazy eye/ers processing",                                           this.ly_debug_level,  0, 5,"",
				"Active when global debug level > -1");



		gd.addCheckbox    ("Equalize weights of right/left FoV",           this.ly_right_left,
		gd.addCheckbox    ("Equalize weights of right/left FoV",           this.ly_right_left,
				"Use this mode use with horizon visible in both FoV halves when gross infinity correction is needed");
				"Use this mode use with horizon visible in both FoV halves when gross infinity correction is needed");


@@ -3273,7 +3290,10 @@ public class CLTParameters {
		this.ly_diff_roll_en=       gd.getNextBoolean();
		this.ly_diff_roll_en=       gd.getNextBoolean();
		this.ly_focalLength=        gd.getNextBoolean();
		this.ly_focalLength=        gd.getNextBoolean();
		this.ly_com_roll=           gd.getNextBoolean();
		this.ly_com_roll=           gd.getNextBoolean();
		this.ly_ers_rot=            gd.getNextBoolean();
		this.ly_ers_lin=            gd.getNextBoolean();
		this.ly_par_sel=      (int) gd.getNextNumber();
		this.ly_par_sel=      (int) gd.getNextNumber();
		this.ly_debug_level=  (int) gd.getNextNumber();


		this.ly_right_left=         gd.getNextBoolean();
		this.ly_right_left=         gd.getNextBoolean();


+17 −2
Original line number Original line Diff line number Diff line
@@ -709,7 +709,9 @@ private Panel panel1,
			addButton("LWIR_TEST",                  panelClt_GPU, color_conf_process);
			addButton("LWIR_TEST",                  panelClt_GPU, color_conf_process);
			addButton("LWIR_ACQUIRE",               panelClt_GPU, color_conf_process);
			addButton("LWIR_ACQUIRE",               panelClt_GPU, color_conf_process);
			addButton("IMU main",                   panelClt_GPU, color_conf_process);
			addButton("IMU main",                   panelClt_GPU, color_conf_process);
			addButton("ERS main",                   panelClt_GPU, color_process);
			addButton("IMU aux",                    panelClt_GPU, color_conf_process_aux);
			addButton("IMU aux",                    panelClt_GPU, color_conf_process_aux);
			addButton("ERS aux",                    panelClt_GPU, color_process_aux);


			plugInFrame.add(panelClt_GPU);
			plugInFrame.add(panelClt_GPU);
		}
		}
@@ -4318,7 +4320,8 @@ private Panel panel1,
    } else if (label.equals("CLT 4 images") ||
    } else if (label.equals("CLT 4 images") ||
    		label.equals("CLT apply fine corr") ||
    		label.equals("CLT apply fine corr") ||
    		label.equals("CLT infinity corr") ||
    		label.equals("CLT infinity corr") ||
    		label.equals("CORR TEST" )) {
    		label.equals("CORR TEST" ) ||
    		label.equals("ERS main")) {
    	boolean apply_corr = label.equals("CLT apply fine corr");
    	boolean apply_corr = label.equals("CLT apply fine corr");
    	boolean infinity_corr = label.equals("CLT infinity corr");
    	boolean infinity_corr = label.equals("CLT infinity corr");
    	DEBUG_LEVEL=MASTER_DEBUG_LEVEL;
    	DEBUG_LEVEL=MASTER_DEBUG_LEVEL;
@@ -4377,7 +4380,19 @@ private Panel panel1,
        int num_infinity_corr = infinity_corr? CLT_PARAMETERS.inf_repeat : 1;
        int num_infinity_corr = infinity_corr? CLT_PARAMETERS.inf_repeat : 1;
        if ( num_infinity_corr < 1) num_infinity_corr = 1;
        if ( num_infinity_corr < 1) num_infinity_corr = 1;
        for (int i_infinity_corr = 0;  i_infinity_corr < num_infinity_corr; i_infinity_corr++) {
        for (int i_infinity_corr = 0;  i_infinity_corr < num_infinity_corr; i_infinity_corr++) {
        	if (label.equals("CORR TEST")) {
        	if (label.equals("ERS main")) {
        		QUAD_CLT.processCLTQuadCorrsTestERS(
        				CLT_PARAMETERS,  // EyesisCorrectionParameters.DCTParameters           dct_parameters,
        				DEBAYER_PARAMETERS, //EyesisCorrectionParameters.DebayerParameters     debayerParameters,
        				COLOR_PROC_PARAMETERS, //EyesisCorrectionParameters.ColorProcParameters colorProcParameters,
        				CHANNEL_GAINS_PARAMETERS, //CorrectionColorProc.ColorGainsParameters     channelGainParameters,
        				RGB_PARAMETERS, //EyesisCorrectionParameters.RGBParameters             rgbParameters,
        				apply_corr,
        				infinity_corr, // calculate and apply geometry correction at infinity
        				THREADS_MAX, //final int          threadsMax,  // maximal number of threads to launch
        				UPDATE_STATUS, //final boolean    updateStatus,
        				DEBUG_LEVEL); //final int        debugLevel);
        	} else if (label.equals("CORR TEST")) {
        		QUAD_CLT.processCLTQuadCorrsTest(
        		QUAD_CLT.processCLTQuadCorrsTest(
        				CLT_PARAMETERS,  // EyesisCorrectionParameters.DCTParameters           dct_parameters,
        				CLT_PARAMETERS,  // EyesisCorrectionParameters.DCTParameters           dct_parameters,
        				DEBAYER_PARAMETERS, //EyesisCorrectionParameters.DebayerParameters     debayerParameters,
        				DEBAYER_PARAMETERS, //EyesisCorrectionParameters.DebayerParameters     debayerParameters,
+5 −5
Original line number Original line Diff line number Diff line
@@ -100,6 +100,7 @@ public class Corr2dLMA {
	private double []         weights; // normalized so sum is 1.0 for all - samples and extra regularization terms
	private double []         weights; // normalized so sum is 1.0 for all - samples and extra regularization terms
	private double            pure_weight; // weight of samples only
	private double            pure_weight; // weight of samples only
	private double []         values;
	private double []         values;

	// next values are only updated after success
	// next values are only updated after success
	private double []         last_rms =        null; // {rms, rms_pure}, matching this.vector
	private double []         last_rms =        null; // {rms, rms_pure}, matching this.vector
	private double []         good_or_bad_rms = null; // just for diagnostics, to read last (failed) rms
	private double []         good_or_bad_rms = null; // just for diagnostics, to read last (failed) rms
@@ -763,7 +764,7 @@ public class Corr2dLMA {
		return dbg_img;
		return dbg_img;
	}
	}


	private double [] getFxJt( // USED in lwir
	private double [] getFxJt(
			double []   vector,
			double []   vector,
			double [][] jt) { // should be either [vector.length][samples.size()] or null - then only fx is calculated
			double [][] jt) { // should be either [vector.length][samples.size()] or null - then only fx is calculated
		if (this.gaussian_mode) return getFxJt_gaussian(vector, jt);
		if (this.gaussian_mode) return getFxJt_gaussian(vector, jt);
@@ -1318,7 +1319,7 @@ public class Corr2dLMA {


////////////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////////


	private boolean debugJt( // not used in lwir
	private boolean debugJt(
    		double      delta,
    		double      delta,
    		double []   vector) {
    		double []   vector) {
    	int num_points = this.values.length;
    	int num_points = this.values.length;
@@ -1653,7 +1654,7 @@ public class Corr2dLMA {
		return wjtymfx;
		return wjtymfx;
	}
	}


	public boolean runLma( // USED in lwir
	public boolean runLma(
			double lambda,           // 0.1
			double lambda,           // 0.1
			double lambda_scale_good,// 0.5
			double lambda_scale_good,// 0.5
			double lambda_scale_bad, // 8.0
			double lambda_scale_bad, // 8.0
@@ -1713,7 +1714,7 @@ public class Corr2dLMA {




	// returns {success, done}
	// returns {success, done}
	public boolean [] lmaStep( // USED in lwir
	public boolean [] lmaStep(
			double lambda,
			double lambda,
			double rms_diff,
			double rms_diff,
			int debug_level) {
			int debug_level) {
@@ -1821,5 +1822,4 @@ public class Corr2dLMA {
		}
		}
		return rslt;
		return rslt;
	}
	}

}
}
+867 −0

File added.

Preview size limit exceeded, changes collapsed.

+496 −61

File changed.

Preview size limit exceeded, changes collapsed.

Loading