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

working snapshot

parent 971025da
Loading
Loading
Loading
Loading
+25 −0
Original line number Original line Diff line number Diff line
@@ -187,6 +187,10 @@ public class ErsCorrection extends GeometryCorrection {
				DP_DVX,   DP_DVY,   DP_DVZ,
				DP_DVX,   DP_DVY,   DP_DVZ,
				DP_DSVAZ, DP_DSVTL, DP_DSVRL,
				DP_DSVAZ, DP_DSVTL, DP_DSVRL,
				DP_DSVX,  DP_DSVY,  DP_DSVZ};
				DP_DSVX,  DP_DSVY,  DP_DSVZ};
	public static final int [] DP_XYZR_INDICES =    {DP_DSX,DP_DSY,DP_DSZ,DP_DSRL};
	public static final int [] DP_AT_INDICES =      {DP_DSAZ,DP_DSTL};
	public static final int [] DP_ATT_ERS_INDICES = {DP_DSVAZ,DP_DSVTL};

	public static final RotationConvention ROT_CONV = RotationConvention.FRAME_TRANSFORM;
	public static final RotationConvention ROT_CONV = RotationConvention.FRAME_TRANSFORM;
	static final double THRESHOLD = 1E-10;
	static final double THRESHOLD = 1E-10;
	static final double LINE_ERR = 0.001; // line accuracy for ERS when converting from world to pixels.
	static final double LINE_ERR = 0.001; // line accuracy for ERS when converting from world to pixels.
@@ -223,8 +227,29 @@ public class ErsCorrection extends GeometryCorrection {
		if (d > 0) return 1.0/ERS_MIN_DISPARITY;
		if (d > 0) return 1.0/ERS_MIN_DISPARITY;
		return -1.0/ERS_MIN_DISPARITY;
		return -1.0/ERS_MIN_DISPARITY;
	}
	}
	public static final int [] DP_XYZR_INDICES =    {DP_DSX,DP_DSY,DP_DSZ,DP_DSRL};
	public static final int [] DP_AT_INDICES =      {DP_DSAZ,DP_DSTL};
	public static final int [] DP_ATT_ERS_INDICES = {DP_DSVAZ,DP_DSVTL};
	
	*/
	*/
	
	
	public static boolean [] getParamSelect(
			boolean use_AT,
			boolean use_ERS) {
		boolean [] param_select = new boolean[DP_NUM_PARS];
		for (int i:DP_XYZR_INDICES)                 param_select[i] = true;
		if (use_AT) for  (int i:DP_AT_INDICES)      param_select[i] = true;
		if (use_ERS) for (int i:DP_ATT_ERS_INDICES) param_select[i] = true;
		return param_select;
	}
	public static double [] getParamRegWeights(
			double  reg_weight,
			boolean use_AT) {
		double [] reg_weights = new double[DP_NUM_PARS];
		reg_weights[DP_DSX] = reg_weight;
		reg_weights[DP_DSY] = reg_weight;
		return reg_weights;
	}	
	public void setPose(
	public void setPose(
			double []    camera_xyz,
			double []    camera_xyz,
			double []    camera_atr) {
			double []    camera_atr) {
+636 −1520

File changed.

Preview size limit exceeded, changes collapsed.

+105 −18
Original line number Original line Diff line number Diff line
@@ -41,8 +41,15 @@ public class IntersceneMatchParameters {
	public  double  [] ims_ortho =       {0.5, -0.5, 0.5, -0.5}; // approximate (90-deg) IMS to camera
	public  double  [] ims_ortho =       {0.5, -0.5, 0.5, -0.5}; // approximate (90-deg) IMS to camera
	public  double  [] ims_mount_atr =   {0, 0, 0}; // IMS mount fine correction (A,T,R around camera axes)
	public  double  [] ims_mount_atr =   {0, 0, 0}; // IMS mount fine correction (A,T,R around camera axes)
	public  double  [] ims_mount_xyz =   {0, 0, 0}; // IMS center in camera coordinates
	public  double  [] ims_mount_xyz =   {0, 0, 0}; // IMS center in camera coordinates
	public  double  [] ims_scale_xyz =   {1.1, 1.1, 1.1};
	public  double  [] ims_scale_xyz =   {1.0,1.0,1.0}; // {1.1, 1.1, 1.1};
	public  double  [] ims_scale_atr =   {1.1, 1.1, 1.1};
	public  double  [] ims_scale_atr =   {1.0,1.0,1.0}; // {1.1, 1.1, 1.1};
		
	public  boolean fmg_initial_en =     true; // enable IMS-based FPN mitigation for initial orientation
	public  boolean fmg_reorient_en =    true; // enable IMS-based FPN mitigation for readjustmnet orientation
	public  double  fmg_distance =       10.0; // try to find other reference scene not closer than this pixels
	public  double  fmg_max_quad =       10.0; // estimate offset by 4 points (rooll-aware, 25% from center) if center
	                                           // offset is too small
	public  boolean fmg_rectilinear =    false;// use rectilinear model for scene offset estimation 
	
	
	
	
	public  boolean sfm_use =            true;   // use SfM to improve depth map
	public  boolean sfm_use =            true;   // use SfM to improve depth map
@@ -306,11 +313,18 @@ public class IntersceneMatchParameters {
	public  double  half_avg_diff =                 0.2;   // when L2 of x,y difference from average of neibs - reduce twice
	public  double  half_avg_diff =                 0.2;   // when L2 of x,y difference from average of neibs - reduce twice
	
	
	// Detect initial match
	// Detect initial match
	public boolean  use_combo_relaible =           true;  // use combo dsi if available for relaible tiles
	public boolean  use_combo_reliable =           true;  // use combo dsi if available for relaible tiles
	public boolean  ref_need_lma =                 true;  // need LMA output for reliable tiles (no combo available)
	public boolean  ref_need_lma =                 true;  // need LMA output for reliable tiles (no combo available)
	public boolean  ref_need_lma_combo =           true;  // need LMA output for reliable tiles (when combo is available)
	public boolean  ref_need_lma_combo =           true;  // need LMA output for reliable tiles (when combo is available)
	public  double  min_ref_str =                   0.33;  // 0.22;  // For orientations: use only tiles of the reference scene DSI_MAIN is stronger  
	public  double  min_ref_str =                   0.33;  // 0.22;  // For orientations: use only tiles of the reference scene DSI_MAIN is stronger  
	public  double  min_ref_frac =                  0.2;   // 0.22;  if fraction number of reliable tiles is less than this, use best possible  
	public  double  min_ref_frac =                  0.2;   // 0.22;  if fraction number of reliable tiles is less than this, use best possible  
// SfM-related filtering (remove tiles without SfM)
	public boolean  sfm_filter =                   true;   // use SfM filtering if available 
	public  double  sfm_minmax =                   10.0;   // minimal value of the SfM gain maximum to consider available
	public  double  sfm_fracmax =                   0.75;  // minimal fraction of the SfM maximal gain
	public  double  sfm_fracall =                   0.3;    // minimal relative area of the SfM-enabled tiles (do not apply filter if less)
	
	
	public  int     pix_step =                      4;     // Azimuth/tilt search step in pixels
	public  int     pix_step =                      4;     // Azimuth/tilt search step in pixels
	public  int     search_rad =                   10;     // Search radius in steps
	public  int     search_rad =                   10;     // Search radius in steps
	public  double  maybe_sum =                     1.0;   // minimal sum of strengths (will search for the best)
	public  double  maybe_sum =                     1.0;   // minimal sum of strengths (will search for the best)
@@ -472,7 +486,19 @@ public class IntersceneMatchParameters {
		gd.addStringField ("scale XYZ from IMS", IntersceneMatchParameters.doublesToString(ims_scale_xyz), 80,
		gd.addStringField ("scale XYZ from IMS", IntersceneMatchParameters.doublesToString(ims_scale_xyz), 80,
				"Scales for X, Y, and Z velocities when converting from IMS data, such as '1.1 1.1 1.1'.");
				"Scales for X, Y, and Z velocities when converting from IMS data, such as '1.1 1.1 1.1'.");
		gd.addStringField ("scale ATR from IMS", IntersceneMatchParameters.doublesToString(ims_scale_atr), 80,
		gd.addStringField ("scale ATR from IMS", IntersceneMatchParameters.doublesToString(ims_scale_atr), 80,
				"Scales for Azimuth, Tilt, and Roll velocities when converting from IMS data, such as '1.1 1.1 1.1'.");
				"Scales for Azimuth, Tilt, and Roll velocities when converting from IMS data, such as '1.1 1.1 1.1' (not needed).");
		
		gd.addMessage  ("IMS-based FPN mitigation for interscene matching");
		gd.addCheckbox ("FPN mitigation for initial orientation",   this.fmg_initial_en,
				"Enable IMS-based FPN mitigation for initial orientation.");
		gd.addCheckbox ("FPN mitigation for re-orientation",        this.fmg_reorient_en,
				"Enable IMS-based FPN mitigation for readjustmnet orientation.");
		gd.addNumericField("Maximal inter-scene offset",            this.fmg_distance, 5,8,"pix",
				"Try to find other reference scene not closer than this pixels.");
		gd.addNumericField("Maximal offset for quad-point use",     this.fmg_max_quad, 5,8,"pix",
				"Estimate offset by 4 points (rooll-aware, 25% from center) if center offset is too small.");
		gd.addCheckbox ("Rectilinear model for offset estimation",  this.fmg_rectilinear,
				"Use rectilinear model for scene offset estimation.");
		
		
		gd.addTab         ("SfM", "Structure from Motion to improve depth map for the lateral views");
		gd.addTab         ("SfM", "Structure from Motion to improve depth map for the lateral views");
		gd.addCheckbox ("Use SfM",                                   this.sfm_use,
		gd.addCheckbox ("Use SfM",                                   this.sfm_use,
@@ -945,9 +971,9 @@ public class IntersceneMatchParameters {
		gd.addNumericField("Difference from neighbors average ",     this.half_avg_diff, 5,7,"",
		gd.addNumericField("Difference from neighbors average ",     this.half_avg_diff, 5,7,"",
				"Reduce twice for high difference from neighbors average.");
				"Reduce twice for high difference from neighbors average.");
		
		
		gd.addMessage  ("Initial search for the inter-scene match");
		gd.addMessage  ("Filtering tiles for interscene matching");
		
		
		gd.addCheckbox ("Use combo DSI (if available) for reliable", this.use_combo_relaible,
		gd.addCheckbox ("Use combo DSI (if available) for reliable", this.use_combo_reliable,
				"Use interscene DSI if available (instead of the single-scene) for selecting reliable tiles");
				"Use interscene DSI if available (instead of the single-scene) for selecting reliable tiles");
		gd.addCheckbox ("Need LMA",                                  this.ref_need_lma,
		gd.addCheckbox ("Need LMA",                                  this.ref_need_lma,
				"Require LMA result for reliable reference");
				"Require LMA result for reliable reference");
@@ -959,6 +985,20 @@ public class IntersceneMatchParameters {
		gd.addNumericField("DSI_MAIN minimal fraction",              this.min_ref_frac, 5,7,"",
		gd.addNumericField("DSI_MAIN minimal fraction",              this.min_ref_frac, 5,7,"",
				"If relative number of the reliable tiles is less than this - use this best fraction.");
				"If relative number of the reliable tiles is less than this - use this best fraction.");


		gd.addCheckbox ("Use SfM filtering if available",            this.sfm_filter,
				"Mask out tiles without sufficient SfM gain (if SfM data is available).");
		gd.addNumericField("Min SfM gain maximum to consider",       this.sfm_minmax, 5,7,"",
				"Minimal value of the SfM gain maximum to consider SfM available.");
		gd.addNumericField("Threshold fraction of the SfM maximum",  this.sfm_fracmax, 5,7,"",
				"Threshold (minimal) fraction of the SfM maximal gain to enable tile.");
		gd.addNumericField("Minimal relative SfM area",              this.sfm_fracall, 5,7,"",
				"Minimal relative area of the SfM-enabled tiles (do not apply filter if less).");

		
		
		gd.addMessage  ("Initial search for the interscene match");
		
		
		gd.addNumericField("Azimuth/tilt step",                      this.pix_step, 0,3,"pix",
		gd.addNumericField("Azimuth/tilt step",                      this.pix_step, 0,3,"pix",
				"Search in a spiral starting with no-shift with this step between probes, in approximate pixels");
				"Search in a spiral starting with no-shift with this step between probes, in approximate pixels");
		gd.addNumericField("Search spiral radius",                   this.search_rad, 0,3,"steps",
		gd.addNumericField("Search spiral radius",                   this.search_rad, 0,3,"steps",
@@ -1206,6 +1246,11 @@ public class IntersceneMatchParameters {
		this.ims_mount_xyz = IntersceneMatchParameters. StringToDoubles(gd.getNextString(), 3);
		this.ims_mount_xyz = IntersceneMatchParameters. StringToDoubles(gd.getNextString(), 3);
		this.ims_scale_xyz = IntersceneMatchParameters. StringToDoubles(gd.getNextString(), 3);
		this.ims_scale_xyz = IntersceneMatchParameters. StringToDoubles(gd.getNextString(), 3);
		this.ims_scale_atr = IntersceneMatchParameters. StringToDoubles(gd.getNextString(), 3);
		this.ims_scale_atr = IntersceneMatchParameters. StringToDoubles(gd.getNextString(), 3);
		this.fmg_initial_en =                 gd.getNextBoolean();
		this.fmg_reorient_en =                gd.getNextBoolean();
		this.fmg_distance =                   gd.getNextNumber();
		this.fmg_max_quad =                   gd.getNextNumber();
		this.fmg_rectilinear =                gd.getNextBoolean();
		this.sfm_use =                        gd.getNextBoolean();
		this.sfm_use =                        gd.getNextBoolean();
		this.sfm_min_base =                   gd.getNextNumber();
		this.sfm_min_base =                   gd.getNextNumber();
		this.sfm_min_gain =                   gd.getNextNumber();
		this.sfm_min_gain =                   gd.getNextNumber();
@@ -1423,11 +1468,15 @@ public class IntersceneMatchParameters {
		this.weight_zero_neibs =        gd.getNextNumber();
		this.weight_zero_neibs =        gd.getNextNumber();
		this.half_disparity =           gd.getNextNumber();
		this.half_disparity =           gd.getNextNumber();
		this.half_avg_diff =            gd.getNextNumber();
		this.half_avg_diff =            gd.getNextNumber();
		this.use_combo_relaible =       gd.getNextBoolean();
		this.use_combo_reliable =       gd.getNextBoolean();
		this.ref_need_lma =             gd.getNextBoolean();
		this.ref_need_lma =             gd.getNextBoolean();
		this.ref_need_lma_combo =       gd.getNextBoolean();
		this.ref_need_lma_combo =       gd.getNextBoolean();
		this.min_ref_str =              gd.getNextNumber();
		this.min_ref_str =              gd.getNextNumber();
		this.min_ref_frac =             gd.getNextNumber();
		this.min_ref_frac =             gd.getNextNumber();
		this.sfm_filter =               gd.getNextBoolean();
		this.sfm_minmax =               gd.getNextNumber();
		this.sfm_fracmax =              gd.getNextNumber();
		this.sfm_fracall =              gd.getNextNumber();
		this.pix_step =           (int) gd.getNextNumber();
		this.pix_step =           (int) gd.getNextNumber();
		this.search_rad =         (int) gd.getNextNumber();
		this.search_rad =         (int) gd.getNextNumber();
		this.maybe_sum =                gd.getNextNumber();
		this.maybe_sum =                gd.getNextNumber();
@@ -1591,6 +1640,11 @@ public class IntersceneMatchParameters {
		properties.setProperty(prefix+"ims_mount_xyz",                 IntersceneMatchParameters.doublesToString(this.ims_mount_xyz));
		properties.setProperty(prefix+"ims_mount_xyz",                 IntersceneMatchParameters.doublesToString(this.ims_mount_xyz));
		properties.setProperty(prefix+"ims_scale_xyz",                 IntersceneMatchParameters.doublesToString(this.ims_scale_xyz));
		properties.setProperty(prefix+"ims_scale_xyz",                 IntersceneMatchParameters.doublesToString(this.ims_scale_xyz));
		properties.setProperty(prefix+"ims_scale_atr",                 IntersceneMatchParameters.doublesToString(this.ims_scale_atr));		
		properties.setProperty(prefix+"ims_scale_atr",                 IntersceneMatchParameters.doublesToString(this.ims_scale_atr));		
		properties.setProperty(prefix+"fmg_initial_en",                this.fmg_initial_en + "");              // boolean
		properties.setProperty(prefix+"fmg_reorient_en",               this.fmg_reorient_en + "");             // boolean
		properties.setProperty(prefix+"fmg_distance",                  this.fmg_distance+"");                  // double
		properties.setProperty(prefix+"fmg_max_quad",                  this.fmg_max_quad+"");                  // double
		properties.setProperty(prefix+"fmg_rectilinear",               this.fmg_rectilinear + "");             // boolean
		properties.setProperty(prefix+"sfm_use",                       this.sfm_use + "");                     // boolean
		properties.setProperty(prefix+"sfm_use",                       this.sfm_use + "");                     // boolean
		properties.setProperty(prefix+"sfm_min_base",                  this.sfm_min_base+"");                  // double
		properties.setProperty(prefix+"sfm_min_base",                  this.sfm_min_base+"");                  // double
		properties.setProperty(prefix+"sfm_min_gain",                  this.sfm_min_gain+"");                  // double
		properties.setProperty(prefix+"sfm_min_gain",                  this.sfm_min_gain+"");                  // double
@@ -1790,8 +1844,6 @@ public class IntersceneMatchParameters {
		properties.setProperty(prefix+"run_poly",             this.run_poly+"");            // boolean
		properties.setProperty(prefix+"run_poly",             this.run_poly+"");            // boolean
		properties.setProperty(prefix+"centroid_radius",      this.centroid_radius+"");     // double
		properties.setProperty(prefix+"centroid_radius",      this.centroid_radius+"");     // double
		properties.setProperty(prefix+"n_recenter",           this.n_recenter+"");          // int
		properties.setProperty(prefix+"n_recenter",           this.n_recenter+"");          // int
		properties.setProperty(prefix+"min_ref_str",          this.min_ref_str+"");         // double
		properties.setProperty(prefix+"min_ref_frac",         this.min_ref_frac+"");        // double
		properties.setProperty(prefix+"td_weight",            this.td_weight+"");           // double
		properties.setProperty(prefix+"td_weight",            this.td_weight+"");           // double
		properties.setProperty(prefix+"td_neib_weight",       this.td_neib_weight+"");      // double
		properties.setProperty(prefix+"td_neib_weight",       this.td_neib_weight+"");      // double
		properties.setProperty(prefix+"pd_weight",            this.pd_weight+"");           // double
		properties.setProperty(prefix+"pd_weight",            this.pd_weight+"");           // double
@@ -1818,9 +1870,19 @@ public class IntersceneMatchParameters {
		properties.setProperty(prefix+"weight_zero_neibs",    this.weight_zero_neibs+"");   // double
		properties.setProperty(prefix+"weight_zero_neibs",    this.weight_zero_neibs+"");   // double
		properties.setProperty(prefix+"half_disparity",       this.half_disparity+"");      // double
		properties.setProperty(prefix+"half_disparity",       this.half_disparity+"");      // double
		properties.setProperty(prefix+"half_avg_diff",        this.half_avg_diff+"");       // double
		properties.setProperty(prefix+"half_avg_diff",        this.half_avg_diff+"");       // double
		properties.setProperty(prefix+"use_combo_relaible",   this.use_combo_relaible+"");  // boolean
		
		properties.setProperty(prefix+"use_combo_reliable",   this.use_combo_reliable+"");  // boolean
		properties.setProperty(prefix+"ref_need_lma",         this.ref_need_lma+"");        // boolean
		properties.setProperty(prefix+"ref_need_lma",         this.ref_need_lma+"");        // boolean
		properties.setProperty(prefix+"ref_need_lma_combo",   this.ref_need_lma_combo+"");  // boolean
		properties.setProperty(prefix+"ref_need_lma_combo",   this.ref_need_lma_combo+"");  // boolean
		properties.setProperty(prefix+"min_ref_str",          this.min_ref_str+"");         // double
		properties.setProperty(prefix+"min_ref_frac",         this.min_ref_frac+"");        // double
		
		properties.setProperty(prefix+"sfm_filter",           this.sfm_filter+"");          // boolean
		properties.setProperty(prefix+"sfm_minmax",           this.sfm_minmax+"");          // double
		properties.setProperty(prefix+"sfm_fracmax",          this.sfm_fracmax+"");         // double
		properties.setProperty(prefix+"sfm_fracall",          this.sfm_fracall+"");         // double
		
		
		properties.setProperty(prefix+"pix_step",             this.pix_step+"");            // int
		properties.setProperty(prefix+"pix_step",             this.pix_step+"");            // int
		properties.setProperty(prefix+"search_rad",           this.search_rad+"");          // int
		properties.setProperty(prefix+"search_rad",           this.search_rad+"");          // int
		properties.setProperty(prefix+"maybe_sum",            this.maybe_sum+"");           // double
		properties.setProperty(prefix+"maybe_sum",            this.maybe_sum+"");           // double
@@ -1936,6 +1998,11 @@ public class IntersceneMatchParameters {
		if (properties.getProperty(prefix+"ims_mount_xyz")!=null) 	   this.ims_mount_xyz= IntersceneMatchParameters.StringToDoubles(properties.getProperty(prefix+"ims_mount_xyz"),3);
		if (properties.getProperty(prefix+"ims_mount_xyz")!=null) 	   this.ims_mount_xyz= IntersceneMatchParameters.StringToDoubles(properties.getProperty(prefix+"ims_mount_xyz"),3);
		if (properties.getProperty(prefix+"ims_scale_xyz")!=null) 	   this.ims_scale_xyz= IntersceneMatchParameters.StringToDoubles(properties.getProperty(prefix+"ims_scale_xyz"),3);
		if (properties.getProperty(prefix+"ims_scale_xyz")!=null) 	   this.ims_scale_xyz= IntersceneMatchParameters.StringToDoubles(properties.getProperty(prefix+"ims_scale_xyz"),3);
		if (properties.getProperty(prefix+"ims_scale_atr")!=null) 	   this.ims_scale_atr= IntersceneMatchParameters.StringToDoubles(properties.getProperty(prefix+"ims_scale_atr"),3);
		if (properties.getProperty(prefix+"ims_scale_atr")!=null) 	   this.ims_scale_atr= IntersceneMatchParameters.StringToDoubles(properties.getProperty(prefix+"ims_scale_atr"),3);
		if (properties.getProperty(prefix+"fmg_initial_en")!=null)     this.fmg_initial_en=Boolean.parseBoolean(properties.getProperty(prefix+"fmg_initial_en"));		
		if (properties.getProperty(prefix+"fmg_reorient_en")!=null)    this.fmg_reorient_en=Boolean.parseBoolean(properties.getProperty(prefix+"fmg_reorient_en"));		
		if (properties.getProperty(prefix+"fmg_distance")!=null)       this.fmg_distance=Double.parseDouble(properties.getProperty(prefix+"fmg_distance"));
		if (properties.getProperty(prefix+"fmg_max_quad")!=null)       this.fmg_max_quad=Double.parseDouble(properties.getProperty(prefix+"fmg_max_quad"));
		if (properties.getProperty(prefix+"fmg_rectilinear")!=null)    this.fmg_rectilinear=Boolean.parseBoolean(properties.getProperty(prefix+"fmg_rectilinear"));		
		if (properties.getProperty(prefix+"sfm_use")!=null)            this.sfm_use=Boolean.parseBoolean(properties.getProperty(prefix+"sfm_use"));		
		if (properties.getProperty(prefix+"sfm_use")!=null)            this.sfm_use=Boolean.parseBoolean(properties.getProperty(prefix+"sfm_use"));		
		if (properties.getProperty(prefix+"sfm_min_base")!=null)       this.sfm_min_base=Double.parseDouble(properties.getProperty(prefix+"sfm_min_base"));
		if (properties.getProperty(prefix+"sfm_min_base")!=null)       this.sfm_min_base=Double.parseDouble(properties.getProperty(prefix+"sfm_min_base"));
		if (properties.getProperty(prefix+"sfm_min_gain")!=null)       this.sfm_min_gain=Double.parseDouble(properties.getProperty(prefix+"sfm_min_gain"));
		if (properties.getProperty(prefix+"sfm_min_gain")!=null)       this.sfm_min_gain=Double.parseDouble(properties.getProperty(prefix+"sfm_min_gain"));
@@ -2142,8 +2209,6 @@ public class IntersceneMatchParameters {
		if (properties.getProperty(prefix+"run_poly")!=null)             this.run_poly=Boolean.parseBoolean(properties.getProperty(prefix+"run_poly"));
		if (properties.getProperty(prefix+"run_poly")!=null)             this.run_poly=Boolean.parseBoolean(properties.getProperty(prefix+"run_poly"));
		if (properties.getProperty(prefix+"centroid_radius")!=null)      this.centroid_radius=Double.parseDouble(properties.getProperty(prefix+"centroid_radius"));
		if (properties.getProperty(prefix+"centroid_radius")!=null)      this.centroid_radius=Double.parseDouble(properties.getProperty(prefix+"centroid_radius"));
		if (properties.getProperty(prefix+"n_recenter")!=null)           this.n_recenter=Integer.parseInt(properties.getProperty(prefix+"n_recenter"));
		if (properties.getProperty(prefix+"n_recenter")!=null)           this.n_recenter=Integer.parseInt(properties.getProperty(prefix+"n_recenter"));
		if (properties.getProperty(prefix+"min_ref_str")!=null)          this.min_ref_str=Double.parseDouble(properties.getProperty(prefix+"min_ref_str"));
		if (properties.getProperty(prefix+"min_ref_frac")!=null)         this.min_ref_frac=Double.parseDouble(properties.getProperty(prefix+"min_ref_frac"));
		if (properties.getProperty(prefix+"td_weight")!=null)            this.td_weight=Double.parseDouble(properties.getProperty(prefix+"td_weight"));
		if (properties.getProperty(prefix+"td_weight")!=null)            this.td_weight=Double.parseDouble(properties.getProperty(prefix+"td_weight"));
		if (properties.getProperty(prefix+"td_neib_weight")!=null)       this.td_neib_weight=Double.parseDouble(properties.getProperty(prefix+"td_neib_weight"));
		if (properties.getProperty(prefix+"td_neib_weight")!=null)       this.td_neib_weight=Double.parseDouble(properties.getProperty(prefix+"td_neib_weight"));
		if (properties.getProperty(prefix+"pd_weight")!=null)            this.pd_weight=Double.parseDouble(properties.getProperty(prefix+"pd_weight"));
		if (properties.getProperty(prefix+"pd_weight")!=null)            this.pd_weight=Double.parseDouble(properties.getProperty(prefix+"pd_weight"));
@@ -2169,9 +2234,19 @@ public class IntersceneMatchParameters {
		if (properties.getProperty(prefix+"weight_zero_neibs")!=null)    this.weight_zero_neibs=Double.parseDouble(properties.getProperty(prefix+"weight_zero_neibs"));
		if (properties.getProperty(prefix+"weight_zero_neibs")!=null)    this.weight_zero_neibs=Double.parseDouble(properties.getProperty(prefix+"weight_zero_neibs"));
		if (properties.getProperty(prefix+"half_disparity")!=null)       this.half_disparity=Double.parseDouble(properties.getProperty(prefix+"half_disparity"));
		if (properties.getProperty(prefix+"half_disparity")!=null)       this.half_disparity=Double.parseDouble(properties.getProperty(prefix+"half_disparity"));
		if (properties.getProperty(prefix+"half_avg_diff")!=null)        this.half_avg_diff=Double.parseDouble(properties.getProperty(prefix+"half_avg_diff"));
		if (properties.getProperty(prefix+"half_avg_diff")!=null)        this.half_avg_diff=Double.parseDouble(properties.getProperty(prefix+"half_avg_diff"));
		if (properties.getProperty(prefix+"use_combo_relaible")!=null)   this.use_combo_relaible=Boolean.parseBoolean(properties.getProperty(prefix+"use_combo_relaible"));		

		if (properties.getProperty(prefix+"use_combo_reliable")!=null)   this.use_combo_reliable=Boolean.parseBoolean(properties.getProperty(prefix+"use_combo_reliable"));
		else if (properties.getProperty(prefix+"use_combo_relaible")!=null)   this.use_combo_reliable=Boolean.parseBoolean(properties.getProperty(prefix+"use_combo_relaible"));		
		if (properties.getProperty(prefix+"ref_need_lma")!=null)         this.ref_need_lma=Boolean.parseBoolean(properties.getProperty(prefix+"ref_need_lma"));		
		if (properties.getProperty(prefix+"ref_need_lma")!=null)         this.ref_need_lma=Boolean.parseBoolean(properties.getProperty(prefix+"ref_need_lma"));		
		if (properties.getProperty(prefix+"ref_need_lma_combo")!=null)   this.ref_need_lma_combo=Boolean.parseBoolean(properties.getProperty(prefix+"ref_need_lma_combo"));
		if (properties.getProperty(prefix+"ref_need_lma_combo")!=null)   this.ref_need_lma_combo=Boolean.parseBoolean(properties.getProperty(prefix+"ref_need_lma_combo"));
		if (properties.getProperty(prefix+"min_ref_str")!=null)          this.min_ref_str=Double.parseDouble(properties.getProperty(prefix+"min_ref_str"));
		if (properties.getProperty(prefix+"min_ref_frac")!=null)         this.min_ref_frac=Double.parseDouble(properties.getProperty(prefix+"min_ref_frac"));
		
		if (properties.getProperty(prefix+"sfm_filter")!=null)           this.sfm_filter=Boolean.parseBoolean(properties.getProperty(prefix+"sfm_filter"));		
		if (properties.getProperty(prefix+"sfm_minmax")!=null)           this.sfm_minmax=Double.parseDouble(properties.getProperty(prefix+"sfm_minmax"));
		if (properties.getProperty(prefix+"sfm_fracmax")!=null)          this.sfm_fracmax=Double.parseDouble(properties.getProperty(prefix+"sfm_fracmax"));
		if (properties.getProperty(prefix+"sfm_fracall")!=null)          this.sfm_fracall=Double.parseDouble(properties.getProperty(prefix+"sfm_fracall"));
		
		if (properties.getProperty(prefix+"pix_step")!=null)             this.pix_step=Integer.parseInt(properties.getProperty(prefix+"pix_step"));
		if (properties.getProperty(prefix+"pix_step")!=null)             this.pix_step=Integer.parseInt(properties.getProperty(prefix+"pix_step"));
		if (properties.getProperty(prefix+"search_rad")!=null)           this.search_rad=Integer.parseInt(properties.getProperty(prefix+"search_rad"));
		if (properties.getProperty(prefix+"search_rad")!=null)           this.search_rad=Integer.parseInt(properties.getProperty(prefix+"search_rad"));
		if (properties.getProperty(prefix+"maybe_sum")!=null)            this.maybe_sum=Double.parseDouble(properties.getProperty(prefix+"maybe_sum"));
		if (properties.getProperty(prefix+"maybe_sum")!=null)            this.maybe_sum=Double.parseDouble(properties.getProperty(prefix+"maybe_sum"));
@@ -2308,6 +2383,11 @@ public class IntersceneMatchParameters {
 		imp.ims_mount_xyz                 = this.ims_mount_xyz.clone();
 		imp.ims_mount_xyz                 = this.ims_mount_xyz.clone();
 		imp.ims_scale_xyz                 = this.ims_scale_xyz.clone();
 		imp.ims_scale_xyz                 = this.ims_scale_xyz.clone();
 		imp.ims_scale_atr                 = this.ims_scale_atr.clone();
 		imp.ims_scale_atr                 = this.ims_scale_atr.clone();
 		imp.fmg_initial_en                = this.fmg_initial_en;
 		imp.fmg_reorient_en               = this.fmg_reorient_en;
 		imp.fmg_distance                  = this.fmg_distance;
 		imp.fmg_max_quad                  = this.fmg_max_quad;
 		imp.fmg_rectilinear               = this.fmg_rectilinear;
 		imp.sfm_use                       = this.sfm_use;
 		imp.sfm_use                       = this.sfm_use;
 		imp.sfm_min_base                  = this.sfm_min_base;
 		imp.sfm_min_base                  = this.sfm_min_base;
 		imp.sfm_min_gain                  = this.sfm_min_gain;
 		imp.sfm_min_gain                  = this.sfm_min_gain;
@@ -2503,8 +2583,6 @@ public class IntersceneMatchParameters {
		imp.run_poly              = this.run_poly;
		imp.run_poly              = this.run_poly;
		imp.centroid_radius       = this.centroid_radius;
		imp.centroid_radius       = this.centroid_radius;
		imp.n_recenter            = this.n_recenter;
		imp.n_recenter            = this.n_recenter;
		imp.min_ref_str           = this.min_ref_str;
		imp.min_ref_frac          = this.min_ref_frac;
				
				
		imp.td_weight             = this.td_weight;
		imp.td_weight             = this.td_weight;
		imp.td_neib_weight        = this.td_neib_weight;
		imp.td_neib_weight        = this.td_neib_weight;
@@ -2533,9 +2611,18 @@ public class IntersceneMatchParameters {
		imp.weight_zero_neibs     = this.weight_zero_neibs;
		imp.weight_zero_neibs     = this.weight_zero_neibs;
		imp.half_disparity        = this.half_disparity;
		imp.half_disparity        = this.half_disparity;
		imp.half_avg_diff         = this.half_avg_diff;
		imp.half_avg_diff         = this.half_avg_diff;
		imp.use_combo_relaible    = this.use_combo_relaible;

		imp.use_combo_reliable    = this.use_combo_reliable;
		imp.ref_need_lma          = this.ref_need_lma;
		imp.ref_need_lma          = this.ref_need_lma;
		imp.ref_need_lma_combo    = this.ref_need_lma_combo;
		imp.ref_need_lma_combo    = this.ref_need_lma_combo;
		imp.min_ref_str           = this.min_ref_str;
		imp.min_ref_frac          = this.min_ref_frac;
		
		imp.sfm_filter =            this.sfm_filter;
		imp.sfm_minmax =            this.sfm_minmax;
		imp.sfm_fracmax =           this.sfm_fracmax;
		imp.sfm_fracall =           this.sfm_fracall;
		
		imp.pix_step =              this.pix_step;
		imp.pix_step =              this.pix_step;
		imp.search_rad =            this.search_rad;
		imp.search_rad =            this.search_rad;
		imp.maybe_sum =             this.maybe_sum;
		imp.maybe_sum =             this.maybe_sum;
+12 −3
Original line number Original line Diff line number Diff line
@@ -4712,11 +4712,16 @@ public class OpticalFlow {
		int     test_ers0 =          clt_parameters.imp.test_ers0; // try adjusting a pair of scenes with ERS. Reference scene index
		int     test_ers0 =          clt_parameters.imp.test_ers0; // try adjusting a pair of scenes with ERS. Reference scene index
		int     test_ers1 =          clt_parameters.imp.test_ers1; // try adjusting a pair of scenes with ERS. Other scene index
		int     test_ers1 =          clt_parameters.imp.test_ers1; // try adjusting a pair of scenes with ERS. Other scene index
		test_ers &= (test_ers0 >= 0) && (test_ers1 >= 0);
		test_ers &= (test_ers0 >= 0) && (test_ers1 >= 0);
		boolean use_combo_relaible = clt_parameters.imp.use_combo_relaible;
		boolean use_combo_relaible = clt_parameters.imp.use_combo_reliable;
		boolean ref_need_lma =       clt_parameters.imp.ref_need_lma;
		boolean ref_need_lma =       clt_parameters.imp.ref_need_lma;
		boolean ref_need_lma_combo = clt_parameters.imp.ref_need_lma_combo;
		boolean ref_need_lma_combo = clt_parameters.imp.ref_need_lma_combo;
		double  min_ref_str =        clt_parameters.imp.min_ref_str;
		double  min_ref_str =        clt_parameters.imp.min_ref_str;
		boolean sfm_filter =         clt_parameters.imp.sfm_filter;  //true;   // use SfM filtering if available 
		double  sfm_minmax =         clt_parameters.imp.sfm_minmax;  //10.0;   // minimal value of the SfM gain maximum to consider available
		double  sfm_fracmax =        clt_parameters.imp.sfm_fracmax; // 0.75;  // minimal fraction of the SfM maximal gain
		double  sfm_fracall =        clt_parameters.imp.sfm_fracall; // 0.3;    // minimal relative area of the SfM-enabled tiles (do not apply filter if less)	
		
		double min_ref_frac=         clt_parameters.imp.min_ref_frac;		
		double min_ref_frac=         clt_parameters.imp.min_ref_frac;		
		double [] ref_blue_sky = null; // turn off "lma" in the ML output  
		double [] ref_blue_sky = null; // turn off "lma" in the ML output  
		if (reuse_video) { // disable all other options
		if (reuse_video) { // disable all other options
@@ -5234,8 +5239,12 @@ public class OpticalFlow {
							min_ref_frac,       // double min_ref_frac,
							min_ref_frac,       // double min_ref_frac,
							ref_need_lma,       // boolean needs_lma);
							ref_need_lma,       // boolean needs_lma);
							ref_need_lma_combo, // boolean needs_lma);
							ref_need_lma_combo, // boolean needs_lma);
							reduced_strength);  // if not null will return >0 if had to reduce strength (no change if did not reduce)
							sfm_filter,  // boolean sfm_filter, // use SfM filtering if available                          
					
							sfm_minmax,  // double  sfm_minmax, // minimal value of the SfM gain maximum to consider available
							sfm_fracmax, // double  sfm_fracmax,// minimal fraction of the SfM maximal gain
							sfm_fracall, // double  sfm_fracall,// minimal relative area of the SfM-enabled tiles (do not apply filter if less)								
							reduced_strength,  // if not null will return >0 if had to reduce strength (no change if did not reduce)
							debugLevel); // int       debugLevel)
					if (show_reliable_ref) {
					if (show_reliable_ref) {
						double [] dbg_img = new double [reliable_ref.length];
						double [] dbg_img = new double [reliable_ref.length];
						for (int i = 0; i < dbg_img.length; i++) {
						for (int i = 0; i < dbg_img.length; i++) {
+1782 −1765
Original line number Original line Diff line number Diff line
@@ -2410,7 +2410,12 @@ public class QuadCLTCPU {
    		double    min_ref_frac,
    		double    min_ref_frac,
    		boolean   needs_lma,
    		boolean   needs_lma,
    		boolean   needs_lma_combo,
    		boolean   needs_lma_combo,
			double [] reduced_strength // if not null will return >0 if had to reduce strength (no change if did not reduce)
    		boolean   sfm_filter, 
    		double    sfm_minmax, 
    		double    sfm_fracmax,
    		double    sfm_fracall,    		
    		double [] reduced_strength, // if not null will return >0 if had to reduce strength (no change if did not reduce)
    		int       debugLevel
    		) {
    		) {
    	int NUM_BINS = 1024;
    	int NUM_BINS = 1024;
    	// 10.15.2023 - was error here,	readComboDSI (silent) returns combo_dsi, not converted to this.dsi format;	
    	// 10.15.2023 - was error here,	readComboDSI (silent) returns combo_dsi, not converted to this.dsi format;	
@@ -2419,7 +2424,6 @@ public class QuadCLTCPU {
    	boolean silent = false;
    	boolean silent = false;
    	if (use_combo) {
    	if (use_combo) {
    		readComboDSI (silent);
    		readComboDSI (silent);
			main_dsi = this.dsi;
    		needs_lma = needs_lma_combo;
    		needs_lma = needs_lma_combo;
    	} else {
    	} else {
    		main_dsi =  readDsiMain();
    		main_dsi =  readDsiMain();
@@ -2427,6 +2431,7 @@ public class QuadCLTCPU {
    	if (main_dsi == null) {
    	if (main_dsi == null) {
    		return null;
    		return null;
    	}
    	}
    	
    	double [] disparity_lma = main_dsi[isAux()?TwoQuadCLT.DSI_DISPARITY_AUX_LMA:TwoQuadCLT.DSI_DISPARITY_MAIN_LMA];
    	double [] disparity_lma = main_dsi[isAux()?TwoQuadCLT.DSI_DISPARITY_AUX_LMA:TwoQuadCLT.DSI_DISPARITY_MAIN_LMA];
    	double [] strength = main_dsi[isAux()?TwoQuadCLT.DSI_STRENGTH_AUX:TwoQuadCLT.DSI_STRENGTH_MAIN];
    	double [] strength = main_dsi[isAux()?TwoQuadCLT.DSI_STRENGTH_AUX:TwoQuadCLT.DSI_STRENGTH_MAIN];
    	double [] sfm_gain = main_dsi[isAux()?TwoQuadCLT.DSI_SFM_GAIN_AUX:TwoQuadCLT.DSI_SFM_GAIN_MAIN];
    	double [] sfm_gain = main_dsi[isAux()?TwoQuadCLT.DSI_SFM_GAIN_AUX:TwoQuadCLT.DSI_SFM_GAIN_MAIN];
@@ -2449,22 +2454,34 @@ public class QuadCLTCPU {
    			}
    			}
    		}
    		}
    	}
    	}
		if (sfm_gain != null) {
    	if (sfm_filter && (sfm_gain != null)) {
    		double sfm_max = 0.0;
    		for (int i = 0; i < reliable.length; i++) {
    			if (sfm_gain[i] > sfm_max) sfm_max = sfm_gain[i];
    		}
    		if (sfm_max > sfm_minmax) {
    			double sfm_thresh = sfm_max * sfm_fracmax;
    			boolean [] sfm_good = new boolean [reliable.length];
    			int num_sfm_gain = 0;
    			int num_sfm_gain = 0;
    			for (int i = 0; i < reliable.length; i++) {
    			for (int i = 0; i < reliable.length; i++) {
				if (sfm_gain[i] >0) {
    				if (sfm_gain[i] >= sfm_thresh) {
    					sfm_good[i] = true;
    					num_sfm_gain++;
    					num_sfm_gain++;
    				}
    				}
    			}
    			}
			if (num_sfm_gain > min_reliable) {
    			if (num_sfm_gain > (sfm_fracall * reliable.length)) {
    				if (debugLevel > -3) {
    					System.out.println("getReliableTiles(): Using SfM filter");
    				}
    				for (int i = 0; i < reliable.length; i++) {
    				for (int i = 0; i < reliable.length; i++) {
					if (sfm_gain[i] <= 0){
    					if (!sfm_good[i]) { // sfm_gain[i] <= 0){
    						reliable[i] = false;
    						reliable[i] = false;
    						strength[i] = 0.0;
    						strength[i] = 0.0;
    					}
    					}
    				}
    				}
    			}
    			}
    		}
    		}
    	}
    	int num_reliable = 0;
    	int num_reliable = 0;
    	for (boolean b: reliable) if (b) num_reliable++;
    	for (boolean b: reliable) if (b) num_reliable++;
    	if (num_reliable < min_reliable) { // not enough, select best tiles, ignoring LMA
    	if (num_reliable < min_reliable) { // not enough, select best tiles, ignoring LMA