Commit a12d2254 authored by Andrey Filippov's avatar Andrey Filippov

working snapshot

parent 971025da
......@@ -187,6 +187,10 @@ public class ErsCorrection extends GeometryCorrection {
DP_DVX, DP_DVY, DP_DVZ,
DP_DSVAZ, DP_DSVTL, DP_DSVRL,
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;
static final double THRESHOLD = 1E-10;
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;
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(
double [] camera_xyz,
double [] camera_atr) {
......
This source diff could not be displayed because it is too large. You can view the blob instead.
......@@ -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_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_scale_xyz = {1.1, 1.1, 1.1};
public double [] ims_scale_atr = {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.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
......@@ -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
// 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_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_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 search_rad = 10; // Search radius in steps
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,
"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,
"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.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,"",
"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");
gd.addCheckbox ("Need LMA", this.ref_need_lma,
"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,"",
"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",
"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",
......@@ -1206,6 +1246,11 @@ public class IntersceneMatchParameters {
this.ims_mount_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.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_min_base = gd.getNextNumber();
this.sfm_min_gain = gd.getNextNumber();
......@@ -1423,11 +1468,15 @@ public class IntersceneMatchParameters {
this.weight_zero_neibs = gd.getNextNumber();
this.half_disparity = 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_combo = gd.getNextBoolean();
this.min_ref_str = 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.search_rad = (int) 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_scale_xyz", IntersceneMatchParameters.doublesToString(this.ims_scale_xyz));
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_min_base", this.sfm_min_base+""); // 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+"centroid_radius", this.centroid_radius+""); // double
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_neib_weight", this.td_neib_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+"half_disparity", this.half_disparity+""); // 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_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+"search_rad", this.search_rad+""); // int
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_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+"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_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"));
......@@ -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+"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+"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_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"));
......@@ -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+"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+"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_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+"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"));
......@@ -2308,6 +2383,11 @@ public class IntersceneMatchParameters {
imp.ims_mount_xyz = this.ims_mount_xyz.clone();
imp.ims_scale_xyz = this.ims_scale_xyz.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_min_base = this.sfm_min_base;
imp.sfm_min_gain = this.sfm_min_gain;
......@@ -2503,8 +2583,6 @@ public class IntersceneMatchParameters {
imp.run_poly = this.run_poly;
imp.centroid_radius = this.centroid_radius;
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_neib_weight = this.td_neib_weight;
......@@ -2533,9 +2611,18 @@ public class IntersceneMatchParameters {
imp.weight_zero_neibs = this.weight_zero_neibs;
imp.half_disparity = this.half_disparity;
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_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.search_rad = this.search_rad;
imp.maybe_sum = this.maybe_sum;
......
......@@ -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_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);
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_combo = clt_parameters.imp.ref_need_lma_combo;
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 [] ref_blue_sky = null; // turn off "lma" in the ML output
if (reuse_video) { // disable all other options
......@@ -5234,8 +5239,12 @@ public class OpticalFlow {
min_ref_frac, // double min_ref_frac,
ref_need_lma, // 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) {
double [] dbg_img = new double [reliable_ref.length];
for (int i = 0; i < dbg_img.length; i++) {
......
......@@ -356,7 +356,7 @@ public class QuadCLTCPU {
double [] ims_ortho = clt_parameters.imp.ims_ortho;
double [] ims_mount_atr = clt_parameters.imp.getImsMountATR(); // converts to radians
double [][][] scenes_xyzatr = new double [quadCLTs.length][][];
// scenes_xyzatr[ref_index] = new double[2][3]; // all zeros
// scenes_xyzatr[ref_index] = new double[2][3]; // all zeros
Did_ins_2 d2_ref = did_ins_2;
// apply correction to orientation - better not to prevent extra loops.
......@@ -485,11 +485,11 @@ public class QuadCLTCPU {
}
}
return fl;
// if ((fl[0] >= 0) && (fl[1] >= 0)) {
// return fl;
// } else {
// return null;
// }
// if ((fl[0] >= 0) && (fl[1] >= 0)) {
// return fl;
// } else {
// return null;
// }
}
/**
......@@ -989,7 +989,7 @@ public class QuadCLTCPU {
d2.getQEnu(),
ims_mount_atr,
ims_ortho);
//
//
double [] quat_corr = getQuatCorr();
if (apply_quat_corr && (quat_corr != null)) {
cam_quat_enu=Imx5.applyQuaternionToQuaternion(quat_corr, cam_quat_enu, false);
......@@ -1030,7 +1030,7 @@ public class QuadCLTCPU {
xy_range, // double [][] xy_range, // should be double[2][]; meters
debug_level); // int debug_level)
// camera position and orientation relative to the same lat/long on the ground below it
// double [][] scene_abs_xyzatr_enu = new double [][] {new double[] {0,0,-agl}, scene_abs_atr_enu};
// double [][] scene_abs_xyzatr_enu = new double [][] {new double[] {0,0,-agl}, scene_abs_atr_enu};
double [][] scene_abs_xyzatr_enu = new double [][] {new double[] {0,0,use_parallel_proj?0:-agl}, scene_abs_atr_enu};
// double [][] ground_xyzatr = new double [][] {
// {0, 0, z_tilts[0]},
......@@ -1102,7 +1102,7 @@ public class QuadCLTCPU {
double hist_rlow = 0.5;
double hist_rhigh = 2.0;
int min_good = 20; //number of good tiles
// double rel_hight = 0.2; // when calculating scale, ignore objects far from plane
// double rel_hight = 0.2; // when calculating scale, ignore objects far from plane
int num_bins = 1000;
double sw=0, swd=0;
boolean [] good_tiles = new boolean[ref_disparity.length];
......@@ -1176,8 +1176,8 @@ public class QuadCLTCPU {
return Double.NaN;
}
// double dl = discard_low * sw;
// double dh = discard_high * sw;
// double dl = discard_low * sw;
// double dh = discard_high * sw;
double dl = discard_high * sw;
double dh = discard_low * sw;
double sh = 0.0;
......@@ -1234,7 +1234,7 @@ public class QuadCLTCPU {
public double [][] getDLS(){ // get disparity, disparity_lma, strength, sfm_gain
if (dsi == null) {
// System.out.println("dsi== null, use spawnQuadCLT(), restoreFromModel(), ... to set it");
// System.out.println("dsi== null, use spawnQuadCLT(), restoreFromModel(), ... to set it");
return null;
}
double [][] dls = new double[4][];
......@@ -1294,7 +1294,7 @@ public class QuadCLTCPU {
this.new_image_data = qParent.new_image_data;
if (qParent.saturation_imp != null) this.saturation_imp = qParent.saturation_imp.clone(); // each camera will be re-written, not just modified, so shallow copy
this.is_aux = qParent.is_aux;
// this.is_mono = qParent.is_mono;
// this.is_mono = qParent.is_mono;
this.photometric_scene = qParent.photometric_scene;
this.lwir_offsets = ErsCorrection.clone1d(qParent.lwir_offsets);
......@@ -1404,7 +1404,7 @@ public class QuadCLTCPU {
public static double getTimeStamp(String ts) {
String sts = ts.replace("_", ".");
// Matcher m = Pattern.compile("\\d").matcher(sts);
// Matcher m = Pattern.compile("\\d").matcher(sts);
Matcher m = Pattern.compile("\\d{5,10}\\.\\d{6}").matcher(sts);
//
if(m.find()) {
......@@ -1556,10 +1556,10 @@ public class QuadCLTCPU {
int height = strength.length/width;
int dbg_tile = -1150;
// int sky_bottleneck = 5; // shrink full selection, then re-expand from seed to disable
// int sky_bottleneck = 5; // shrink full selection, then re-expand from seed to disable
// small (narrow) leaks (or just disable leaks near margins)?
// int shrink_for_temp = 10;
// double sky_temp_override = -300; // really cold average seed - ignore lowest_sky_row filter
// int shrink_for_temp = 10;
// double sky_temp_override = -300; // really cold average seed - ignore lowest_sky_row filter
double [] temp_scales = null;
boolean failure = false;
double temp_cold = Double.NaN;
......@@ -2130,7 +2130,7 @@ public class QuadCLTCPU {
}
// @Deprecated
// @Deprecated
public void setBlueSky (boolean [] blue_sky) {
double [] double_blue_sky = new double [blue_sky.length];
for (int i = 0; i < blue_sky.length; i++) {
......@@ -2214,7 +2214,7 @@ public class QuadCLTCPU {
QuadCLT dbg_scene, // use to save debug images if not null
int debugLevel) {
int width = tp.getTilesX();
// this.blue_sky = getBlueSky (
// this.blue_sky = getBlueSky (
setBlueSky(getBlueSky (
max_disparity,
max_disparity_strength,
......@@ -2403,23 +2403,27 @@ public class QuadCLTCPU {
dsi,
silent);
}
//min_ref_frac
//min_ref_frac
public boolean [] getReliableTiles(
boolean use_combo,
double min_strength,
double min_ref_frac,
boolean needs_lma,
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;
// 10.15.2023 - was error here, readComboDSI (silent) returns combo_dsi, not converted to this.dsi format;
// double [][] main_dsi = use_combo? readComboDSI (silent): readDsiMain();
// 10.15.2023 - was error here, readComboDSI (silent) returns combo_dsi, not converted to this.dsi format;
// double [][] main_dsi = use_combo? readComboDSI (silent): readDsiMain();
double [][] main_dsi = null;
boolean silent = false;
if (use_combo) {
readComboDSI (silent);
main_dsi = this.dsi;
needs_lma = needs_lma_combo;
} else {
main_dsi = readDsiMain();
......@@ -2427,6 +2431,7 @@ public class QuadCLTCPU {
if (main_dsi == null) {
return null;
}
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 [] 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;
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++;
}
}
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++) {
if (sfm_gain[i] <= 0){
if (!sfm_good[i]) { // sfm_gain[i] <= 0){
reliable[i] = false;
strength[i] = 0.0;
}
}
}
}
}
int num_reliable = 0;
for (boolean b: reliable) if (b) num_reliable++;
if (num_reliable < min_reliable) { // not enough, select best tiles, ignoring LMA
......@@ -2697,7 +2714,7 @@ public class QuadCLTCPU {
// Moving here form QC:
// Moving here form QC:
public double [][] getDSRBG (){
return dsrbg;
}
......
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