Commit 421e0704 authored by Andrey Filippov's avatar Andrey Filippov

Extracted filter parameters to a class, working on far objects

parent 8991226b
...@@ -896,22 +896,23 @@ public class CLTPass3d{ ...@@ -896,22 +896,23 @@ public class CLTPass3d{
double step_threshold, double step_threshold,
double min_disparity, double min_disparity,
double max_disparity, double max_disparity,
double strength_floor, // double strength_floor,
double strength_pow, // double strength_pow,
double stBlurSigma, double stBlurSigma,
boolean smplMode, // = true; // Use sample mode (false - regular tile mode) boolean smplMode, // = true; // Use sample mode (false - regular tile mode)
int smplSide, // = 2; // Sample size (side of a square) MeasuredLayersFilterParameters mlfp,
int smplNum, // = 3; // Number after removing worst // int smplSide, // = 2; // Sample size (side of a square)
double smplRms, // = 0.1; // Maximal RMS of the remaining tiles in a sample // int smplNum, // = 3; // Number after removing worst
boolean smplWnd, // use window functions for the samples // double smplRms, // = 0.1; // Maximal RMS of the remaining tiles in a sample
// boolean smplWnd, // use window functions for the samples
double max_abs_tilt, // 2.0; // pix per tile
double max_rel_tilt, // 0.2; // (pix / disparity) per tile // double max_abs_tilt, // 2.0; // pix per tile
double damp_tilt, // 0.001; // Damp tilt to handle insufficient (co-linear)data // double max_rel_tilt, // 0.2; // (pix / disparity) per tile
double min_tilt_disp, // 4.0; // Disparity switch between filtering modes - near objects use tilts, far - use max disparity // double damp_tilt, // 0.001; // Damp tilt to handle insufficient (co-linear)data
double transition, // 1.0; // Mode transition range (between tilted and maximal disparity) // double min_tilt_disp, // 4.0; // Disparity switch between filtering modes - near objects use tilts, far - use max disparity
int far_mode, // 1; // Far objects filtering mode (0 - off, 1 - power of disparity) // double transition, // 1.0; // Mode transition range (between tilted and maximal disparity)
double far_power, // 3.0; // Raise disparity to this power before averaging for far objects // int far_mode, // 1; // Far objects filtering mode (0 - off, 1 - power of disparity)
// double far_power, // 3.0; // Raise disparity to this power before averaging for far objects
int measSel) int measSel)
{ {
...@@ -922,21 +923,22 @@ public class CLTPass3d{ ...@@ -922,21 +923,22 @@ public class CLTPass3d{
step_threshold, step_threshold,
min_disparity, min_disparity,
max_disparity, max_disparity,
strength_floor, // strength_floor,
strength_pow, // strength_pow,
stBlurSigma, stBlurSigma,
smplMode, // = true; // Use sample mode (false - regular tile mode) smplMode, // = true; // Use sample mode (false - regular tile mode)
smplSide, // = 2; // Sample size (side of a square) mlfp,
smplNum, // = 3; // Number after removing worst // smplSide, // = 2; // Sample size (side of a square)
smplRms, // = 0.1; // Maximal RMS of the remaining tiles in a sample // smplNum, // = 3; // Number after removing worst
smplWnd, // final boolean smplWnd, // use window functions for the samples // smplRms, // = 0.1; // Maximal RMS of the remaining tiles in a sample
max_abs_tilt, // 2.0; // Maximal absolute tilt in pixels/tile // smplWnd, // final boolean smplWnd, // use window functions for the samples
max_rel_tilt, // 0.2; // Maximal relative tilt in pixels/tile/disparity // max_abs_tilt, // 2.0; // Maximal absolute tilt in pixels/tile
damp_tilt, // 0.001; // Damp tilt to handle insufficient (co-linear)data // max_rel_tilt, // 0.2; // Maximal relative tilt in pixels/tile/disparity
min_tilt_disp, // 4.0; // Disparity switch between filtering modes - near objects use tilts, far - use max disparity // damp_tilt, // 0.001; // Damp tilt to handle insufficient (co-linear)data
transition, // 1.0; // Mode transition range (between tilted and maximal disparity) // min_tilt_disp, // 4.0; // Disparity switch between filtering modes - near objects use tilts, far - use max disparity
far_mode, // 1; // Far objects filtering mode (0 - off, 1 - power of disparity) // transition, // 1.0; // Mode transition range (between tilted and maximal disparity)
far_power, // 1.0; // Raise disparity to this power before averaging for far objects // far_mode, // 1; // Far objects filtering mode (0 - off, 1 - power of disparity)
// far_power, // 1.0; // Raise disparity to this power before averaging for far objects
// true, // boolean null_if_none, // true, // boolean null_if_none,
measSel); measSel);
return this.superTiles; return this.superTiles;
...@@ -946,18 +948,19 @@ public class CLTPass3d{ ...@@ -946,18 +948,19 @@ public class CLTPass3d{
boolean [][] tile_sel, // null or per-measurement layer, per-tile selection. For each layer null - do not use, {} - use all boolean [][] tile_sel, // null or per-measurement layer, per-tile selection. For each layer null - do not use, {} - use all
boolean smplMode, // = true; // Use sample mode (false - regular tile mode) boolean smplMode, // = true; // Use sample mode (false - regular tile mode)
int smplSide, // = 2; // Sample size (side of a square) MeasuredLayersFilterParameters mlfp,
int smplNum, // = 3; // Number after removing worst // int smplSide, // = 2; // Sample size (side of a square)
double smplRms, // = 0.1; // Maximal RMS of the remaining tiles in a sample // int smplNum, // = 3; // Number after removing worst
boolean smplWnd, // use window functions for the samples // double smplRms, // = 0.1; // Maximal RMS of the remaining tiles in a sample
// boolean smplWnd, // use window functions for the samples
double max_abs_tilt, // 2.0; // pix per tile
double max_rel_tilt, // 0.2; // (pix / disparity) per tile // double max_abs_tilt, // 2.0; // pix per tile
double damp_tilt, // 0.001; // Damp tilt to handle insufficient (co-linear)data // double max_rel_tilt, // 0.2; // (pix / disparity) per tile
double min_tilt_disp, // 4.0; // Disparity switch between filtering modes - near objects use tilts, far - use max disparity // double damp_tilt, // 0.001; // Damp tilt to handle insufficient (co-linear)data
double transition, // 1.0; // Mode transition range (between tilted and maximal disparity) // double min_tilt_disp, // 4.0; // Disparity switch between filtering modes - near objects use tilts, far - use max disparity
int far_mode, // 1; // Far objects filtering mode (0 - off, 1 - power of disparity) // double transition, // 1.0; // Mode transition range (between tilted and maximal disparity)
double far_power, // 3.0; // Raise disparity to this power before averaging for far objects // int far_mode, // 1; // Far objects filtering mode (0 - off, 1 - power of disparity)
// double far_power, // 3.0; // Raise disparity to this power before averaging for far objects
int measSel) int measSel)
{ {
...@@ -969,18 +972,19 @@ public class CLTPass3d{ ...@@ -969,18 +972,19 @@ public class CLTPass3d{
tile_sel, // null or per-measurement layer, per-tile selection. For each layer null - do not use, {} - use all tile_sel, // null or per-measurement layer, per-tile selection. For each layer null - do not use, {} - use all
smplMode, // = true; // Use sample mode (false - regular tile mode) smplMode, // = true; // Use sample mode (false - regular tile mode)
smplSide, // = 2; // Sample size (side of a square) mlfp,
smplNum, // = 3; // Number after removing worst // smplSide, // = 2; // Sample size (side of a square)
smplRms, // = 0.1; // Maximal RMS of the remaining tiles in a sample // smplNum, // = 3; // Number after removing worst
smplWnd, // use window functions for the samples // smplRms, // = 0.1; // Maximal RMS of the remaining tiles in a sample
// smplWnd, // use window functions for the samples
max_abs_tilt, // 2.0; // Maximal absolute tilt in pixels/tile
max_rel_tilt, // 0.2; // Maximal relative tilt in pixels/tile/disparity // max_abs_tilt, // 2.0; // Maximal absolute tilt in pixels/tile
damp_tilt, // 0.001; // Damp tilt to handle insufficient (co-linear)data // max_rel_tilt, // 0.2; // Maximal relative tilt in pixels/tile/disparity
min_tilt_disp, // 4.0; // Disparity switch between filtering modes - near objects use tilts, far - use max disparity // damp_tilt, // 0.001; // Damp tilt to handle insufficient (co-linear)data
transition, // 1.0; // Mode transition range (between tilted and maximal disparity) // min_tilt_disp, // 4.0; // Disparity switch between filtering modes - near objects use tilts, far - use max disparity
far_mode, // 1; // Far objects filtering mode (0 - off, 1 - power of disparity) // transition, // 1.0; // Mode transition range (between tilted and maximal disparity)
far_power, // 1.0; // Raise disparity to this power before averaging for far objects // far_mode, // 1; // Far objects filtering mode (0 - off, 1 - power of disparity)
// far_power, // 1.0; // Raise disparity to this power before averaging for far objects
measSel); measSel);
} }
......
...@@ -2358,8 +2358,8 @@ public class EyesisCorrectionParameters { ...@@ -2358,8 +2358,8 @@ public class EyesisCorrectionParameters {
public double max_corr_radius = 3.5; // maximal distance from int max to consider public double max_corr_radius = 3.5; // maximal distance from int max to consider
public int enhortho_width = 2; // reduce weight of center correlation pixels from center (0 - none, 1 - center, 2 +/-1 from center) // public int enhortho_width = 2; // reduce weight of center correlation pixels from center (0 - none, 1 - center, 2 +/-1 from center)
public double enhortho_scale = 0.0; // 0.2; // multiply center correlation pixels (inside enhortho_width) // public double enhortho_scale = 0.0; // 0.2; // multiply center correlation pixels (inside enhortho_width)
public boolean max_corr_double = false; // NOT USED double pass when masking center of mass to reduce preference for integer values public boolean max_corr_double = false; // NOT USED double pass when masking center of mass to reduce preference for integer values
public int corr_mode = 2; // which correlation mode to use: 0 - integer max, 1 - center of mass, 2 - polynomial public int corr_mode = 2; // which correlation mode to use: 0 - integer max, 1 - center of mass, 2 - polynomial
...@@ -2613,31 +2613,32 @@ public class EyesisCorrectionParameters { ...@@ -2613,31 +2613,32 @@ public class EyesisCorrectionParameters {
public double stStepNear = 0.5; // Disparity histogram step for near objects public double stStepNear = 0.5; // Disparity histogram step for near objects
public double stStepThreshold = 1.0; // Disparity threshold to switch from linear to logarithmic steps public double stStepThreshold = 1.0; // Disparity threshold to switch from linear to logarithmic steps
public double stMinDisparity = 0.0; // Minimal disparity (center of a bin) public double stMinDisparity = 0.0; // Minimal disparity (center of a bin)
// public double stMaxDisparity = 15.0; // Maximal disparity (center of a bin)
public double stFloor = 0.1; // Subtract from strength, discard negative // moved to MeasuredLayersFilterParameters
public double stPow = 1.0; // raise strength to this power // public double stFloor = 0.1; // Subtract from strength, discard negative
// public double stPow = 1.0; // raise strength to this power
public double stSigma = 1.5; // Blur disparity histogram (sigma in bins) public double stSigma = 1.5; // Blur disparity histogram (sigma in bins)
public double stMinBgDisparity = 0.0; // Minimal backgroubnd disparity to extract as a maximum from the supertiles public double stMinBgDisparity = 0.0; // Minimal backgroubnd disparity to extract as a maximum from the supertiles
public double stMinBgFract = 0.1; // Minimal fraction of the disparity histogram to use as background public double stMinBgFract = 0.1; // Minimal fraction of the disparity histogram to use as background
public double stUseDisp = 0.12; // Use background disparity from supertiles if tile strength is less public double stUseDisp = 0.12; // Use background disparity from supertiles if tile strength is less
public double stStrengthScale = 50.0; // Multiply st strength if used instead of regular strength public double stStrengthScale = 50.0; // Multiply st strength if used instead of regular strength
public boolean stSmplMode = true; // Use sample mode (false - regular tile mode) public boolean stSmplMode = true; // Use sample mode (false - regular tile mode)
public int stSmplSide = 3; // Sample size (side of a square)
public int stSmplNum = 5; // Number after removing worst // public int stSmplSide = 3; // Sample size (side of a square)
public double stSmplRms = 0.3; // Maximal RMS of the remaining tiles in a sample // public int stSmplNum = 5; // Number after removing worst
public boolean stSmplWnd = false; // Use window function for the samples (TODO: change default to true after testing) // public double stSmplRms = 0.3; // Maximal RMS of the remaining tiles in a sample
// public boolean stSmplWnd = false; // Use window function for the samples (TODO: change default to true after testing)
// Additional parameters to prevent increase of the distance to far (small) objects. It happens because of averaging bg and fg disparities // Additional parameters to prevent increase of the distance to far (small) objects. It happens because of averaging bg and fg disparities
// These parameters are also used when expanding tiles from the known ones. // These parameters are also used when expanding tiles from the known ones.
public double fs_max_abs_tilt = 2.0; // Maximal absolute tilt in pixels/tile // public double fs_max_abs_tilt = 2.0; // Maximal absolute tilt in pixels/tile
public double fs_max_rel_tilt = 0.2; // Maximal relative tilt in pixels/tile/disparity // public double fs_max_rel_tilt = 0.2; // Maximal relative tilt in pixels/tile/disparity
public double fs_damp_tilt = 0.001; // Tilt cost for damping insufficient plane data // public double fs_damp_tilt = 0.001; // Tilt cost for damping insufficient plane data
public double fs_min_tilt_disp = 4.0; // Disparity switch between filtering modes - near objects use tilts, far - use max disparity // public double fs_min_tilt_disp = 4.0; // Disparity switch between filtering modes - near objects use tilts, far - use max disparity
public double fs_transition = 1.0; // Mode transition range (between tilted and maximal disparity) // public double fs_transition = 1.0; // Mode transition range (between tilted and maximal disparity)
public int fs_far_mode = 1; // Far objects filtering mode (0 - off, 1 - power of disparity) // public int fs_far_mode = 1; // Far objects filtering mode (0 - off, 1 - power of disparity)
public double fs_far_power = 3.0; // Raise disparity to this power before averaging for far objects // public double fs_far_power = 3.0; // Raise disparity to this power before averaging for far objects
public int stGrowSel = 2; // Grow initial selection before processing supertiles, odd - ortho. <0 - use all tiles public int stGrowSel = 2; // Grow initial selection before processing supertiles, odd - ortho. <0 - use all tiles
...@@ -2994,7 +2995,8 @@ public class EyesisCorrectionParameters { ...@@ -2994,7 +2995,8 @@ public class EyesisCorrectionParameters {
public boolean show_planes = false; // show planes public boolean show_planes = false; // show planes
public double [] vertical_xyz = {0.0,1.0,0.0}; // real world up unit vector in camera CS (x - right, y - up, z - to camera}; public double [] vertical_xyz = {0.0,1.0,0.0}; // real world up unit vector in camera CS (x - right, y - up, z - to camera};
public ImageDttParameters img_dtt = new ImageDttParameters(); public ImageDttParameters img_dtt = new ImageDttParameters();
public MeasuredLayersFilterParameters mlfp = new MeasuredLayersFilterParameters();
public HashMap<String,Double> z_corr_map = new HashMap<String,Double>(); public HashMap<String,Double> z_corr_map = new HashMap<String,Double>();
public static String Z_CORR_PREFIX = "z_corr."; public static String Z_CORR_PREFIX = "z_corr.";
...@@ -3047,8 +3049,8 @@ public class EyesisCorrectionParameters { ...@@ -3047,8 +3049,8 @@ public class EyesisCorrectionParameters {
properties.setProperty(prefix+"max_corr_sigma", this.max_corr_sigma +""); properties.setProperty(prefix+"max_corr_sigma", this.max_corr_sigma +"");
properties.setProperty(prefix+"max_corr_radius", this.max_corr_radius +""); properties.setProperty(prefix+"max_corr_radius", this.max_corr_radius +"");
properties.setProperty(prefix+"enhortho_width", this.enhortho_width +""); // properties.setProperty(prefix+"enhortho_width", this.enhortho_width +"");
properties.setProperty(prefix+"enhortho_scale", this.enhortho_scale +""); // properties.setProperty(prefix+"enhortho_scale", this.enhortho_scale +"");
properties.setProperty(prefix+"max_corr_double", this.max_corr_double+""); properties.setProperty(prefix+"max_corr_double", this.max_corr_double+"");
...@@ -3276,28 +3278,29 @@ public class EyesisCorrectionParameters { ...@@ -3276,28 +3278,29 @@ public class EyesisCorrectionParameters {
properties.setProperty(prefix+"stStepNear", this.stStepNear +""); properties.setProperty(prefix+"stStepNear", this.stStepNear +"");
properties.setProperty(prefix+"stStepThreshold", this.stStepThreshold +""); properties.setProperty(prefix+"stStepThreshold", this.stStepThreshold +"");
properties.setProperty(prefix+"stMinDisparity", this.stMinDisparity +""); properties.setProperty(prefix+"stMinDisparity", this.stMinDisparity +"");
// properties.setProperty(prefix+"stMaxDisparity", this.stMaxDisparity +"");
properties.setProperty(prefix+"stFloor", this.stFloor +""); /// properties.setProperty(prefix+"stFloor", this.stFloor +""); // mlfp.strength_floor
properties.setProperty(prefix+"stPow", this.stPow +""); /// properties.setProperty(prefix+"stPow", this.stPow +""); // mlfp.strength_pow
properties.setProperty(prefix+"stSigma", this.stSigma +""); properties.setProperty(prefix+"stSigma", this.stSigma +""); // keep
properties.setProperty(prefix+"stMinBgDisparity", this.stMinBgDisparity +""); properties.setProperty(prefix+"stMinBgDisparity", this.stMinBgDisparity +""); // keep
properties.setProperty(prefix+"stMinBgFract", this.stMinBgFract +""); properties.setProperty(prefix+"stMinBgFract", this.stMinBgFract +""); // keep
properties.setProperty(prefix+"stUseDisp", this.stUseDisp +""); properties.setProperty(prefix+"stUseDisp", this.stUseDisp +""); // keep
properties.setProperty(prefix+"stStrengthScale", this.stStrengthScale +""); properties.setProperty(prefix+"stStrengthScale", this.stStrengthScale +""); // keep
properties.setProperty(prefix+"stSmplMode", this.stSmplMode+""); properties.setProperty(prefix+"stSmplMode", this.stSmplMode+""); // keep
properties.setProperty(prefix+"stSmplSide", this.stSmplSide+"");
properties.setProperty(prefix+"stSmplNum", this.stSmplNum+""); /// properties.setProperty(prefix+"stSmplSide", this.stSmplSide+""); // mlfp.smplSide
properties.setProperty(prefix+"stSmplRms", this.stSmplRms +""); /// properties.setProperty(prefix+"stSmplNum", this.stSmplNum+""); // mlfp.smplNum
properties.setProperty(prefix+"stSmplWnd", this.stSmplWnd+""); /// properties.setProperty(prefix+"stSmplRms", this.stSmplRms +""); // mlfp.smplRms
/// properties.setProperty(prefix+"stSmplWnd", this.stSmplWnd+""); // mlfp.smplWnd
properties.setProperty(prefix+"fs_max_abs_tilt", this.fs_max_abs_tilt+"");
properties.setProperty(prefix+"fs_max_rel_tilt", this.fs_max_rel_tilt+""); /// properties.setProperty(prefix+"fs_max_abs_tilt", this.fs_max_abs_tilt+""); // mlfp.max_abs_tilt
properties.setProperty(prefix+"fs_damp_tilt", this.fs_damp_tilt+""); /// properties.setProperty(prefix+"fs_max_rel_tilt", this.fs_max_rel_tilt+""); // mlfp.max_rel_tilt
properties.setProperty(prefix+"fs_min_tilt_disp", this.fs_min_tilt_disp+""); /// properties.setProperty(prefix+"fs_damp_tilt", this.fs_damp_tilt+""); // mlfp.damp_tilt
properties.setProperty(prefix+"fs_transition", this.fs_transition+""); /// properties.setProperty(prefix+"fs_min_tilt_disp", this.fs_min_tilt_disp+""); // mlfp.min_tilt_disp
properties.setProperty(prefix+"fs_far_mode", this.fs_far_mode+""); /// properties.setProperty(prefix+"fs_transition", this.fs_transition+""); // mlfp.transition
properties.setProperty(prefix+"fs_far_power", this.fs_far_power+""); /// properties.setProperty(prefix+"fs_far_mode", this.fs_far_mode+""); // mlfp.far_mode
/// properties.setProperty(prefix+"fs_far_power", this.fs_far_power+""); // mlfp.far_power
properties.setProperty(prefix+"stGrowSel", this.stGrowSel+""); properties.setProperty(prefix+"stGrowSel", this.stGrowSel+"");
properties.setProperty(prefix+"stMeasSel", this.stMeasSel+""); properties.setProperty(prefix+"stMeasSel", this.stMeasSel+"");
...@@ -3624,7 +3627,9 @@ public class EyesisCorrectionParameters { ...@@ -3624,7 +3627,9 @@ public class EyesisCorrectionParameters {
properties.setProperty(prefix+Z_CORR_PREFIX+entry.getKey(), entry.getValue().toString()); properties.setProperty(prefix+Z_CORR_PREFIX+entry.getKey(), entry.getValue().toString());
} }
} }
img_dtt.setProperties(prefix+"_img_dtt", properties); img_dtt.setProperties (prefix+"_img_dtt", properties);
mlfp.setProperties (prefix+"_mlfp", properties);
} }
public void getProperties(String prefix,Properties properties){ public void getProperties(String prefix,Properties properties){
if (properties.getProperty(prefix+"transform_size")!=null) this.transform_size=Integer.parseInt(properties.getProperty(prefix+"transform_size")); if (properties.getProperty(prefix+"transform_size")!=null) this.transform_size=Integer.parseInt(properties.getProperty(prefix+"transform_size"));
...@@ -3672,8 +3677,10 @@ public class EyesisCorrectionParameters { ...@@ -3672,8 +3677,10 @@ public class EyesisCorrectionParameters {
if (properties.getProperty(prefix+"max_corr_sigma")!=null) this.max_corr_sigma=Double.parseDouble(properties.getProperty(prefix+"max_corr_sigma")); if (properties.getProperty(prefix+"max_corr_sigma")!=null) this.max_corr_sigma=Double.parseDouble(properties.getProperty(prefix+"max_corr_sigma"));
if (properties.getProperty(prefix+"max_corr_radius")!=null)this.max_corr_radius=Double.parseDouble(properties.getProperty(prefix+"max_corr_radius")); if (properties.getProperty(prefix+"max_corr_radius")!=null)this.max_corr_radius=Double.parseDouble(properties.getProperty(prefix+"max_corr_radius"));
if (properties.getProperty(prefix+"enhortho_width")!=null) this.enhortho_width=Integer.parseInt(properties.getProperty(prefix+"enhortho_width")); // for compatibility with old settings
if (properties.getProperty(prefix+"enhortho_scale")!=null) this.enhortho_scale=Double.parseDouble(properties.getProperty(prefix+"enhortho_scale")); if (properties.getProperty(prefix+"enhortho_width")!=null) this.img_dtt.enhortho_width=Integer.parseInt(properties.getProperty(prefix+"enhortho_width"));
if (properties.getProperty(prefix+"enhortho_scale")!=null) this.img_dtt.enhortho_scale=Double.parseDouble(properties.getProperty(prefix+"enhortho_scale"));
// for compatibility with old settings
if (properties.getProperty(prefix+"max_corr_double")!=null)this.max_corr_double=Boolean.parseBoolean(properties.getProperty(prefix+"max_corr_double")); if (properties.getProperty(prefix+"max_corr_double")!=null)this.max_corr_double=Boolean.parseBoolean(properties.getProperty(prefix+"max_corr_double"));
if (properties.getProperty(prefix+"corr_mode")!=null) this.corr_mode=Integer.parseInt(properties.getProperty(prefix+"corr_mode")); if (properties.getProperty(prefix+"corr_mode")!=null) this.corr_mode=Integer.parseInt(properties.getProperty(prefix+"corr_mode"));
...@@ -3902,8 +3909,7 @@ public class EyesisCorrectionParameters { ...@@ -3902,8 +3909,7 @@ public class EyesisCorrectionParameters {
if (properties.getProperty(prefix+"stStepThreshold")!=null) this.stStepThreshold=Double.parseDouble(properties.getProperty(prefix+"stStepThreshold")); if (properties.getProperty(prefix+"stStepThreshold")!=null) this.stStepThreshold=Double.parseDouble(properties.getProperty(prefix+"stStepThreshold"));
if (properties.getProperty(prefix+"stMinDisparity")!=null) this.stMinDisparity=Double.parseDouble(properties.getProperty(prefix+"stMinDisparity")); if (properties.getProperty(prefix+"stMinDisparity")!=null) this.stMinDisparity=Double.parseDouble(properties.getProperty(prefix+"stMinDisparity"));
// if (properties.getProperty(prefix+"stMaxDisparity")!=null) this.stMaxDisparity=Double.parseDouble(properties.getProperty(prefix+"stMaxDisparity")); // if (properties.getProperty(prefix+"stMaxDisparity")!=null) this.stMaxDisparity=Double.parseDouble(properties.getProperty(prefix+"stMaxDisparity"));
if (properties.getProperty(prefix+"stFloor")!=null) this.stFloor=Double.parseDouble(properties.getProperty(prefix+"stFloor"));
if (properties.getProperty(prefix+"stPow")!=null) this.stPow=Double.parseDouble(properties.getProperty(prefix+"stPow"));
if (properties.getProperty(prefix+"stSigma")!=null) this.stSigma=Double.parseDouble(properties.getProperty(prefix+"stSigma")); if (properties.getProperty(prefix+"stSigma")!=null) this.stSigma=Double.parseDouble(properties.getProperty(prefix+"stSigma"));
if (properties.getProperty(prefix+"stMinBgDisparity")!=null) this.stMinBgDisparity=Double.parseDouble(properties.getProperty(prefix+"stMinBgDisparity")); if (properties.getProperty(prefix+"stMinBgDisparity")!=null) this.stMinBgDisparity=Double.parseDouble(properties.getProperty(prefix+"stMinBgDisparity"));
if (properties.getProperty(prefix+"stMinBgFract")!=null) this.stMinBgFract=Double.parseDouble(properties.getProperty(prefix+"stMinBgFract")); if (properties.getProperty(prefix+"stMinBgFract")!=null) this.stMinBgFract=Double.parseDouble(properties.getProperty(prefix+"stMinBgFract"));
...@@ -3911,21 +3917,23 @@ public class EyesisCorrectionParameters { ...@@ -3911,21 +3917,23 @@ public class EyesisCorrectionParameters {
if (properties.getProperty(prefix+"stStrengthScale")!=null) this.stStrengthScale=Double.parseDouble(properties.getProperty(prefix+"stStrengthScale")); if (properties.getProperty(prefix+"stStrengthScale")!=null) this.stStrengthScale=Double.parseDouble(properties.getProperty(prefix+"stStrengthScale"));
if (properties.getProperty(prefix+"stSmplMode")!=null) this.stSmplMode=Boolean.parseBoolean(properties.getProperty(prefix+"stSmplMode")); if (properties.getProperty(prefix+"stSmplMode")!=null) this.stSmplMode=Boolean.parseBoolean(properties.getProperty(prefix+"stSmplMode"));
if (properties.getProperty(prefix+"stSmplSide")!=null) this.stSmplSide=Integer.parseInt(properties.getProperty(prefix+"stSmplSide"));
if (properties.getProperty(prefix+"stSmplNum")!=null) this.stSmplNum=Integer.parseInt(properties.getProperty(prefix+"stSmplNum"));
if (properties.getProperty(prefix+"stSmplRms")!=null) this.stSmplRms=Double.parseDouble(properties.getProperty(prefix+"stSmplRms"));
if (properties.getProperty(prefix+"stSmplWnd")!=null) this.stSmplWnd=Boolean.parseBoolean(properties.getProperty(prefix+"stSmplWnd"));
if (properties.getProperty(prefix+"fs_max_abs_tilt")!=null) this.fs_max_abs_tilt=Double.parseDouble(properties.getProperty(prefix+"fs_max_abs_tilt")); // next kept for compatibility with old configs
if (properties.getProperty(prefix+"fs_max_rel_tilt")!=null) this.fs_max_rel_tilt=Double.parseDouble(properties.getProperty(prefix+"fs_max_rel_tilt")); if (properties.getProperty(prefix+"stFloor")!=null) this.mlfp.strength_floor=Double.parseDouble(properties.getProperty(prefix+"stFloor"));
if (properties.getProperty(prefix+"fs_damp_tilt")!=null) this.fs_damp_tilt=Double.parseDouble(properties.getProperty(prefix+"fs_damp_tilt")); if (properties.getProperty(prefix+"stPow")!=null) this.mlfp.strength_pow=Double.parseDouble(properties.getProperty(prefix+"stPow"));
if (properties.getProperty(prefix+"stSmplSide")!=null) this.mlfp.smplSide=Integer.parseInt(properties.getProperty(prefix+"stSmplSide"));
if (properties.getProperty(prefix+"stSmplNum")!=null) this.mlfp.smplNum=Integer.parseInt(properties.getProperty(prefix+"stSmplNum"));
if (properties.getProperty(prefix+"fs_min_tilt_disp")!=null) this.fs_min_tilt_disp=Double.parseDouble(properties.getProperty(prefix+"fs_min_tilt_disp")); if (properties.getProperty(prefix+"stSmplRms")!=null) this.mlfp.smplRms=Double.parseDouble(properties.getProperty(prefix+"stSmplRms"));
if (properties.getProperty(prefix+"fs_transition")!=null) this.fs_transition=Double.parseDouble(properties.getProperty(prefix+"fs_transition")); if (properties.getProperty(prefix+"stSmplWnd")!=null) this.mlfp.smplWnd=Boolean.parseBoolean(properties.getProperty(prefix+"stSmplWnd"));
if (properties.getProperty(prefix+"fs_far_mode")!=null) this.fs_far_mode=Integer.parseInt(properties.getProperty(prefix+"fs_far_mode")); if (properties.getProperty(prefix+"fs_max_abs_tilt")!=null) this.mlfp.max_abs_tilt=Double.parseDouble(properties.getProperty(prefix+"fs_max_abs_tilt"));
if (properties.getProperty(prefix+"fs_far_power")!=null) this.fs_far_power=Double.parseDouble(properties.getProperty(prefix+"fs_far_power")); if (properties.getProperty(prefix+"fs_max_rel_tilt")!=null) this.mlfp.max_rel_tilt=Double.parseDouble(properties.getProperty(prefix+"fs_max_rel_tilt"));
if (properties.getProperty(prefix+"fs_damp_tilt")!=null) this.mlfp.damp_tilt=Double.parseDouble(properties.getProperty(prefix+"fs_damp_tilt"));
if (properties.getProperty(prefix+"fs_min_tilt_disp")!=null) this.mlfp.min_tilt_disp=Double.parseDouble(properties.getProperty(prefix+"fs_min_tilt_disp"));
if (properties.getProperty(prefix+"fs_transition")!=null) this.mlfp.transition=Double.parseDouble(properties.getProperty(prefix+"fs_transition"));
if (properties.getProperty(prefix+"fs_far_mode")!=null) this.mlfp.far_mode=Integer.parseInt(properties.getProperty(prefix+"fs_far_mode"));
if (properties.getProperty(prefix+"fs_far_power")!=null) this.mlfp.far_power=Double.parseDouble(properties.getProperty(prefix+"fs_far_power"));
// end of next kept for compatibility with old configs
if (properties.getProperty(prefix+"stGrowSel")!=null) this.stGrowSel=Integer.parseInt(properties.getProperty(prefix+"stGrowSel")); if (properties.getProperty(prefix+"stGrowSel")!=null) this.stGrowSel=Integer.parseInt(properties.getProperty(prefix+"stGrowSel"));
...@@ -4258,7 +4266,8 @@ public class EyesisCorrectionParameters { ...@@ -4258,7 +4266,8 @@ public class EyesisCorrectionParameters {
z_corr_map.put(s.substring(li), Double.parseDouble(properties.getProperty(s))); z_corr_map.put(s.substring(li), Double.parseDouble(properties.getProperty(s)));
} }
} }
img_dtt.setProperties(prefix+"_img_dtt", properties); img_dtt.getProperties (prefix+"_img_dtt", properties);
mlfp.getProperties (prefix+"_mlfp", properties);
} }
public boolean showJDialog() { public boolean showJDialog() {
...@@ -4293,7 +4302,8 @@ public class EyesisCorrectionParameters { ...@@ -4293,7 +4302,8 @@ public class EyesisCorrectionParameters {
gd.addNumericField("Value (max) in vignetting data to correspond to 1x in the kernel", this.vignetting_max, 3); gd.addNumericField("Value (max) in vignetting data to correspond to 1x in the kernel", this.vignetting_max, 3);
gd.addNumericField("Do not try to correct vignetting smaller than this fraction of max", this.vignetting_range, 3); gd.addNumericField("Do not try to correct vignetting smaller than this fraction of max", this.vignetting_range, 3);
gd.addNumericField("Kernel step in pixels (has 1 kernel margin on each side)", this.kernel_step, 0); gd.addNumericField("Kernel step in pixels (has 1 kernel margin on each side)", this.kernel_step, 0);
gd.addNumericField("Nominal (rectilinear) disparity between side of square cameras (pix)", this.disparity, 3); gd.addNumericField("Nominal (rectilinear) disparity between side of square cameras (pix)", this.disparity, 3,7,"pix",
"Used when rendering 4 images");
gd.addNumericField("Inverse distance to infinity (misalignment correction)", this.z_correction, 6); gd.addNumericField("Inverse distance to infinity (misalignment correction)", this.z_correction, 6);
gd.addCheckbox ("Perform correlation", this.correlate); gd.addCheckbox ("Perform correlation", this.correlate);
gd.addNumericField("Bitmask of pairs to combine in the composite (top, bottom, left,righth)", this.corr_mask, 0); gd.addNumericField("Bitmask of pairs to combine in the composite (top, bottom, left,righth)", this.corr_mask, 0);
...@@ -4313,18 +4323,12 @@ public class EyesisCorrectionParameters { ...@@ -4313,18 +4323,12 @@ public class EyesisCorrectionParameters {
gd.addNumericField("Select all-pair correlation type to use 0 - CM, 1 - poly", this.corr_select, 0); gd.addNumericField("Select all-pair correlation type to use 0 - CM, 1 - poly", this.corr_select, 0);
gd.addTab ("imageDtt", "Setup extra ImageDtt parameters - eventually all will be set that way"); gd.addTab ("imageDtt", "Setup extra ImageDtt parameters - eventually all will be set that way");
gd.addCheckbox ("Enable ImageDtt correlation debug layers", this.img_dtt.corr_mode_debug);
gd.addCheckbox ("Replace CM layer with mixed/new poly one", this.img_dtt.mix_corr_poly);
gd.addNumericField("Use poly mode if strength is greater than", this.img_dtt.min_poly_strength, 3,6,"", "AND condition");
gd.addNumericField("Use poly if it does not differ from CM more than by ", this.img_dtt.max_poly_diff, 3,6,"pix", "AND condition");
gd.addNumericField("When calculating poly raise correlation value to this power", this.img_dtt.poly_pwr, 3,6,"", "Trying to reduce sticking to integer values");
gd.addCheckbox ("When calculating poly multiply strength by correlation value (more important)", this.img_dtt.poly_value_to_weight);
// moved
this.img_dtt.dialogQuestions(gd);
gd.addTab ("vert/hor", "Enhance detection of horizontal/vertical features (when enh_ortho is enabled for tile"); gd.addTab ("vert/hor", "Enhance detection of horizontal/vertical features (when enh_ortho is enabled for tile");
gd.addMessage("--- Enhance detection of horizontal/vertical features (when enh_ortho is enabled for tile ---"); gd.addMessage("--- Enhance detection of horizontal/vertical features (when enh_ortho is enabled for tile ---");
gd.addNumericField("Reduce weight of center correlation pixels from center (0 - none, 1 - center, 2 +/-1 from center)", this.enhortho_width, 0);
gd.addNumericField("Multiply center correlation pixels (inside enhortho_width) (1.0 - disables enh_orttho)", this.enhortho_scale, 3);
gd.addCheckbox ("Double pass when masking center of mass to reduce preference for integer values", this.max_corr_double); gd.addCheckbox ("Double pass when masking center of mass to reduce preference for integer values", this.max_corr_double);
...@@ -4335,7 +4339,7 @@ public class EyesisCorrectionParameters { ...@@ -4335,7 +4339,7 @@ public class EyesisCorrectionParameters {
gd.addTab ("tileTasks", "tiles tasks (current tile_task_op = "+this.tile_task_op+")"); gd.addTab ("tileTasks", "tiles tasks (current tile_task_op = "+this.tile_task_op+")");
gd.addMessage("--- tiles tasks (current tile_task_op = "+this.tile_task_op+") ---"); gd.addMessage("--- tiles tasks (current tile_task_op = "+this.tile_task_op+") ---");
gd.addCheckbox ("Enhace ortho lines detection (enh_ortho)", ImageDtt.getOrthoLines(this.tile_task_op)); gd.addCheckbox ("Enhance ortho lines detection (enh_ortho)", ImageDtt.getOrthoLines(this.tile_task_op));
gd.addCheckbox ("Force disparity for image rendering (false - use found from tile correlation)", ImageDtt.getForcedDisparity(this.tile_task_op)); gd.addCheckbox ("Force disparity for image rendering (false - use found from tile correlation)", ImageDtt.getForcedDisparity(this.tile_task_op));
gd.addNumericField("Bitmask of used images (1 - top left, 2 - top right, 4 - bottom left, 8 bottom right)", ImageDtt.getImgMask(this.tile_task_op), 0); gd.addNumericField("Bitmask of used images (1 - top left, 2 - top right, 4 - bottom left, 8 bottom right)", ImageDtt.getImgMask(this.tile_task_op), 0);
gd.addNumericField("Bitmask of used pairs (1 - top, 2 - bottom, 4 - left, 8 - right)", ImageDtt.getPairMask(this.tile_task_op), 0); gd.addNumericField("Bitmask of used pairs (1 - top, 2 - bottom, 4 - left, 8 - right)", ImageDtt.getPairMask(this.tile_task_op), 0);
...@@ -4596,39 +4600,15 @@ public class EyesisCorrectionParameters { ...@@ -4596,39 +4600,15 @@ public class EyesisCorrectionParameters {
gd.addTab ("Supertiles", "Build supertiles (plates)"); gd.addTab ("Supertiles", "Build supertiles (plates)");
// gd.addNumericField("Maximal disparity (center of a bin)", this.stMaxDisparity, 6); // gd.addNumericField("Maximal disparity (center of a bin)", this.stMaxDisparity, 6);
gd.addMessage ("Maximal disparity (center of a bin) - using grow_disp_max="+this.grow_disp_max); gd.addMessage ("Maximal disparity (center of a bin) - using grow_disp_max="+this.grow_disp_max);
gd.addNumericField("Subtract from strength, discard negative", this.stFloor, 6); // gd.addNumericField("Subtract from strength, discard negative", this.stFloor, 6);
gd.addNumericField("Raise strength to this power ", this.stPow, 6); // gd.addNumericField("Raise strength to this power ", this.stPow, 6);
gd.addNumericField("Blur disparity histogram (sigma in bins)", this.stSigma, 6); gd.addNumericField("Blur disparity histogram (sigma in bins)", this.stSigma, 6);
gd.addNumericField("Minimal backgroubnd disparity to extract as a maximum from the supertiles", this.stMinBgDisparity, 6); gd.addNumericField("Minimal backgroubnd disparity to extract as a maximum from the supertiles", this.stMinBgDisparity, 6);
gd.addNumericField("Minimal fraction of the disparity histogram to use as background", this.stMinBgFract, 6); gd.addNumericField("Minimal fraction of the disparity histogram to use as background", this.stMinBgFract, 6);
gd.addNumericField("Use background disparity from supertiles if tile strength is less", this.stUseDisp, 6); gd.addNumericField("Use background disparity from supertiles if tile strength is less", this.stUseDisp, 6);
gd.addNumericField("Multiply st strength if used instead of regular strength ", this.stStrengthScale, 6); gd.addNumericField("Multiply st strength if used instead of regular strength ", this.stStrengthScale, 6);
gd.addMessage ("Sample filtering mode"); // gd.addMessage ("Sample filtering mode");
gd.addCheckbox ("Use sample mode (false - regular tile mode)", this.stSmplMode);
gd.addNumericField("Sample size (side of a square)", this.stSmplSide, 0);
gd.addNumericField("Number after removing worst", this.stSmplNum, 0);
gd.addNumericField("Maximal RMS of the remaining tiles in a sample", this.stSmplRms, 6);
gd.addCheckbox ("Use window function for the samples", this.stSmplWnd);
gd.addMessage ("Additional parameters to prevent increase of the distance to far (small) objects",
"These parameters are also used when expanding tiles from the known ones");
gd.addNumericField("Maximal absolute plane \"tilt\" in pixels/tile", this.fs_max_abs_tilt, 4, 6,
"pix/tile", "difference between disparity of the neighbor tiles in disparity space image");
gd.addNumericField("Maximal relative plane \"tilt\"", this.fs_max_rel_tilt, 4, 6,
"1/tile", "pixel/tile tilte divided by the full disparity of the tle");
gd.addNumericField("Tilt cost for damping insufficient plane data", this.fs_damp_tilt, 6, 8,
"", "Allows to find plane when there are not enough tiles to process");
gd.addNumericField("Disparity switch between filtering modes", this.fs_min_tilt_disp, 4,6,
"pix","Objects that are closer (larger disparity) use tilted plane model, far objects use maximal amon neighbors disparity");
gd.addNumericField("Mode transition range (between tilted and maximal disparity)", this.fs_transition, 4,6,
"pix","Disparity range to gradually switch between maximal and tilted modes");
gd.addNumericField("Far objects filtering mode (0 - off, 1,2 - power of disparity)", this.fs_far_mode, 0,3,
"","So far only 2 far modes: 1 - remove outliers from both sides, 2 - only from far side, 0 - use tilted mode for all tiles");
gd.addNumericField("Raise disparity to this power before averaging for far objects", this.fs_far_power, 4,6,
"", "Parameter to specify preference of the larger disparity when averaging");
gd.addMessage ("Other supertile parameters"); gd.addMessage ("Other supertile parameters");
gd.addNumericField("Grow initial selection before processing supertiles, odd - ortho. <0 - use all tiles",this.stGrowSel, 0); gd.addNumericField("Grow initial selection before processing supertiles, odd - ortho. <0 - use all tiles",this.stGrowSel, 0);
...@@ -4647,6 +4627,38 @@ public class EyesisCorrectionParameters { ...@@ -4647,6 +4627,38 @@ public class EyesisCorrectionParameters {
gd.addNumericField("Disregard weaker tiles when combining scans for vertical correlation", this.combine_min_vert, 6); gd.addNumericField("Disregard weaker tiles when combining scans for vertical correlation", this.combine_min_vert, 6);
// gd.addNumericField("Do not re-measure correlation if target disparity differs from some previous by this",this.unique_tolerance, 6); // gd.addNumericField("Do not re-measure correlation if target disparity differs from some previous by this",this.unique_tolerance, 6);
gd.addTab ("Tile Filter", "Filter for measured tile data");
gd.addCheckbox ("Use sample mode (false - regular tile mode)", this.stSmplMode);
gd.addNumericField("Sure strength", this.mlfp.strength_sure, 4,6,"",
"Do not filter tile disparities above this strength level (on top of strength floor");
gd.addNumericField("Strength floor", this.mlfp.strength_floor, 4,6,"",
"Subtract from strength, discard negative");
gd.addNumericField("Raise strength to this power ", this.mlfp.strength_pow, 6);
gd.addNumericField("Sample size (side of a square)", this.mlfp.smplSide, 0);
gd.addNumericField("Number after removing worst", this.mlfp.smplNum, 0);
gd.addNumericField("Maximal RMS of the remaining tiles in a sample", this.mlfp.smplRms, 6);
gd.addCheckbox ("Use window function for the samples", this.mlfp.smplWnd);
gd.addMessage ("Additional parameters to prevent increase of the distance to far (small) objects",
"These parameters are also used when expanding tiles from the known ones");
gd.addNumericField("Maximal absolute plane \"tilt\" in pixels/tile", this.mlfp.max_abs_tilt, 4, 6,
"pix/tile", "difference between disparity of the neighbor tiles in disparity space image");
gd.addNumericField("Maximal relative plane \"tilt\"", this.mlfp.max_rel_tilt, 4, 6,
"1/tile", "pixel/tile tilte divided by the full disparity of the tle");
gd.addNumericField("Tilt cost for damping insufficient plane data", this.mlfp.damp_tilt, 6, 8,
"", "Allows to find plane when there are not enough tiles to process");
gd.addNumericField("Disparity switch between filtering modes", this.mlfp.min_tilt_disp, 4,6,
"pix","Objects that are closer (larger disparity) use tilted plane model, far objects use maximal amon neighbors disparity");
gd.addNumericField("Mode transition range (between tilted and maximal disparity)", this.mlfp.transition, 4,6,
"pix","Disparity range to gradually switch between maximal and tilted modes");
gd.addNumericField("Far objects filtering mode (0 - off, 1,2 - power of disparity)", this. mlfp.far_mode, 0,3,
"","So far only 2 far modes: 1 - remove outliers from both sides, 2 - only from far side, 0 - use tilted mode for all tiles");
gd.addNumericField("Raise disparity to this power before averaging for far objects", this.mlfp.far_power, 4,6,
"", "Parameter to specify preference of the larger disparity when averaging");
gd.addTab ("Grow", "Growing disparity range to scan"); gd.addTab ("Grow", "Growing disparity range to scan");
gd.addMessage ("========= Growing disparity range to scan ========"); gd.addMessage ("========= Growing disparity range to scan ========");
gd.addNumericField("Try these number of tiles around known ones", this.grow_sweep, 0); gd.addNumericField("Try these number of tiles around known ones", this.grow_sweep, 0);
...@@ -5034,16 +5046,7 @@ public class EyesisCorrectionParameters { ...@@ -5034,16 +5046,7 @@ public class EyesisCorrectionParameters {
this.corr_select = (int) gd.getNextNumber(); this.corr_select = (int) gd.getNextNumber();
this.img_dtt.corr_mode_debug= gd.getNextBoolean(); this.img_dtt.dialogAnswers(gd);
this.img_dtt.mix_corr_poly= gd.getNextBoolean();
this.img_dtt.min_poly_strength= gd.getNextNumber();
this.img_dtt.max_poly_diff= gd.getNextNumber();
this.img_dtt.poly_pwr= gd.getNextNumber();
this.img_dtt.poly_value_to_weight= gd.getNextBoolean();
this.enhortho_width= (int) gd.getNextNumber();
this.enhortho_scale= gd.getNextNumber();
this.max_corr_double= gd.getNextBoolean(); this.max_corr_double= gd.getNextBoolean();
this.corr_mode= (int) gd.getNextNumber(); this.corr_mode= (int) gd.getNextNumber();
...@@ -5275,28 +5278,12 @@ public class EyesisCorrectionParameters { ...@@ -5275,28 +5278,12 @@ public class EyesisCorrectionParameters {
this.stStepThreshold= gd.getNextNumber(); this.stStepThreshold= gd.getNextNumber();
this.stMinDisparity= gd.getNextNumber(); this.stMinDisparity= gd.getNextNumber();
// this.stMaxDisparity= gd.getNextNumber(); // this.stMaxDisparity= gd.getNextNumber();
this.stFloor= gd.getNextNumber();
this.stPow= gd.getNextNumber();
this.stSigma= gd.getNextNumber(); this.stSigma= gd.getNextNumber();
this.stMinBgDisparity= gd.getNextNumber(); this.stMinBgDisparity= gd.getNextNumber();
this.stMinBgFract= gd.getNextNumber(); this.stMinBgFract= gd.getNextNumber();
this.stUseDisp= gd.getNextNumber(); this.stUseDisp= gd.getNextNumber();
this.stStrengthScale= gd.getNextNumber(); this.stStrengthScale= gd.getNextNumber();
this.stSmplMode= gd.getNextBoolean();
this.stSmplSide= (int) gd.getNextNumber();
this.stSmplNum= (int) gd.getNextNumber();
this.stSmplRms= gd.getNextNumber();
this.stSmplWnd= gd.getNextBoolean();
this.fs_max_abs_tilt= gd.getNextNumber();
this.fs_max_rel_tilt= gd.getNextNumber();
this.fs_damp_tilt = gd.getNextNumber();
this.fs_min_tilt_disp= gd.getNextNumber();
this.fs_transition= gd.getNextNumber();
this.fs_far_mode= (int) gd.getNextNumber();
this.fs_far_power= gd.getNextNumber();
this.stGrowSel= (int) gd.getNextNumber(); this.stGrowSel= (int) gd.getNextNumber();
this.stMeasSel= (int) gd.getNextNumber(); this.stMeasSel= (int) gd.getNextNumber();
this.stSmallDiff= gd.getNextNumber(); this.stSmallDiff= gd.getNextNumber();
...@@ -5312,6 +5299,25 @@ public class EyesisCorrectionParameters { ...@@ -5312,6 +5299,25 @@ public class EyesisCorrectionParameters {
this.combine_min_strength= gd.getNextNumber(); this.combine_min_strength= gd.getNextNumber();
this.combine_min_hor= gd.getNextNumber(); this.combine_min_hor= gd.getNextNumber();
this.combine_min_vert= gd.getNextNumber(); this.combine_min_vert= gd.getNextNumber();
///--------------------
this.stSmplMode= gd.getNextBoolean();
this.mlfp.strength_sure= gd.getNextNumber();
this.mlfp.strength_floor= gd.getNextNumber();
this.mlfp.strength_pow= gd.getNextNumber();
this.mlfp.smplSide= (int) gd.getNextNumber();
this.mlfp.smplNum= (int) gd.getNextNumber();
this.mlfp.smplRms= gd.getNextNumber();
this.mlfp.smplWnd= gd.getNextBoolean();
this.mlfp.max_abs_tilt= gd.getNextNumber();
this.mlfp.max_rel_tilt= gd.getNextNumber();
this.mlfp.damp_tilt = gd.getNextNumber();
this.mlfp.min_tilt_disp= gd.getNextNumber();
this.mlfp.transition= gd.getNextNumber();
this.mlfp.far_mode= (int) gd.getNextNumber();
this.mlfp.far_power= gd.getNextNumber();
// this.unique_tolerance= gd.getNextNumber(); // this.unique_tolerance= gd.getNextNumber();
this.grow_sweep= (int) gd.getNextNumber(); this.grow_sweep= (int) gd.getNextNumber();
this.grow_disp_max= gd.getNextNumber(); this.grow_disp_max= gd.getNextNumber();
...@@ -5615,7 +5621,6 @@ public class EyesisCorrectionParameters { ...@@ -5615,7 +5621,6 @@ public class EyesisCorrectionParameters {
this.show_flaps_dirs= gd.getNextBoolean(); this.show_flaps_dirs= gd.getNextBoolean();
this.show_first_clusters= gd.getNextBoolean(); this.show_first_clusters= gd.getNextBoolean();
this.show_planes= gd.getNextBoolean(); this.show_planes= gd.getNextBoolean();
/**/
return true; return true;
} }
...@@ -5775,7 +5780,6 @@ public class EyesisCorrectionParameters { ...@@ -5775,7 +5780,6 @@ public class EyesisCorrectionParameters {
this.taEnWeakFgnd= gd.getNextBoolean(); this.taEnWeakFgnd= gd.getNextBoolean();
this.taEnFlaps= gd.getNextBoolean(); this.taEnFlaps= gd.getNextBoolean();
this.taEnMismatch= gd.getNextBoolean(); this.taEnMismatch= gd.getNextBoolean();
return true; return true;
} }
public boolean modifyZCorr (String title) { public boolean modifyZCorr (String title) {
......
This source diff could not be displayed because it is too large. You can view the blob instead.
...@@ -57,6 +57,7 @@ public class ImageDtt { ...@@ -57,6 +57,7 @@ public class ImageDtt {
static int QUAD = 4; // number of cameras in camera static int QUAD = 4; // number of cameras in camera
static int GREEN_CHN = 2; // index of green channel static int GREEN_CHN = 2; // index of green channel
static int DISPARITY_INDEX_INT = 0; // 0 - disparity from correlation integer pixels, 1 - ortho static int DISPARITY_INDEX_INT = 0; // 0 - disparity from correlation integer pixels, 1 - ortho
// Now DISPARITY_INDEX_CM may be POLY with backup from CM (for bad correlation)
static int DISPARITY_INDEX_CM = 2; // 2 - disparity from correlation "center mass", 3 - ortho (only used for fine correction) static int DISPARITY_INDEX_CM = 2; // 2 - disparity from correlation "center mass", 3 - ortho (only used for fine correction)
static int DISPARITY_INDEX_HOR = 4; // disparity from correlation of the horizontal pairs with center suppressed static int DISPARITY_INDEX_HOR = 4; // disparity from correlation of the horizontal pairs with center suppressed
static int DISPARITY_INDEX_HOR_STRENGTH = 5; // strength for hor mode (emphasis on vertical lines) static int DISPARITY_INDEX_HOR_STRENGTH = 5; // strength for hor mode (emphasis on vertical lines)
...@@ -72,10 +73,19 @@ public class ImageDtt { ...@@ -72,10 +73,19 @@ public class ImageDtt {
static int DBG1_INDEX = 18; // index of dbg1 data (poly 1) static int DBG1_INDEX = 18; // index of dbg1 data (poly 1)
static int DBG2_INDEX = 19; // index of dbg2 data (poly 2) static int DBG2_INDEX = 19; // index of dbg2 data (poly 2)
static int DBG3_INDEX = 20; // index of dbg3 data (poly 3) static int DBG3_INDEX = 20; // index of dbg3 data (poly 3)
static int DBG4_INDEX = 21; // index of dbg3 data (poly 3)
static int DBG5_INDEX = 22; // index of dbg3 data (poly 3)
static int DBG6_INDEX = 23; // index of dbg3 data (poly 3)
static int DBG7_INDEX = 24; // index of dbg3 data (poly 3)
static int DBG8_INDEX = 25; // index of dbg3 data (poly 3)
static int DBG9_INDEX = 26; // index of dbg3 data (poly 3)
static int DBG10_INDEX = 27; // index of dbg3 data (poly 3)
static int DBG11_INDEX = 28; // index of dbg3 data (poly 3)
static int DBG12_INDEX = 29; // index of dbg3 data (poly 3)
static String [] DISPARITY_TITLES = { static String [] DISPARITY_TITLES = {
"int_disp","int_y_disp","cm_disp","cm_y_disp","hor_disp","hor_strength","vert_disp","vert_strength", "int_disp","int_y_disp","cm_disp","cm_y_disp","hor_disp","hor_strength","vert_disp","vert_strength",
"poly_disp", "poly_y_disp", "strength_disp", "vary_disp","diff0","diff1","diff2","diff3","overexp", "poly_disp", "poly_y_disp", "strength_disp", "vary_disp","diff0","diff1","diff2","diff3","overexp",
"dbg0","dbg1","dbg2","dbg3"}; "dbg0","dbg1","dbg2","dbg3","dbg4","dbg5","dbg6","dbg7","dbg8","dbg9","dbg10","dbg11","dbg12"};
static int TCORR_COMBO_RSLT = 0; // normal combined correlation from all selected pairs (mult/sum) static int TCORR_COMBO_RSLT = 0; // normal combined correlation from all selected pairs (mult/sum)
static int TCORR_COMBO_SUM = 1; // sum of channel correlations from all selected pairs static int TCORR_COMBO_SUM = 1; // sum of channel correlations from all selected pairs
...@@ -1403,8 +1413,8 @@ public class ImageDtt { ...@@ -1403,8 +1413,8 @@ public class ImageDtt {
final double max_corr_sigma, // 1.5; // weights of points around global max to find fractional final double max_corr_sigma, // 1.5; // weights of points around global max to find fractional
final double max_corr_radius, // 3.5; final double max_corr_radius, // 3.5;
final int enhortho_width, // 2; // reduce weight of center correlation pixels from center (0 - none, 1 - center, 2 +/-1 from center) // final int enhortho_width, // 2; // reduce weight of center correlation pixels from center (0 - none, 1 - center, 2 +/-1 from center)
final double enhortho_scale, // 0.2; // multiply center correlation pixels (inside enhortho_width) // final double enhortho_scale, // 0.2; // multiply center correlation pixels (inside enhortho_width)
final boolean max_corr_double, //"Double pass when masking center of mass to reduce preference for integer values final boolean max_corr_double, //"Double pass when masking center of mass to reduce preference for integer values
final int corr_mode, // Correlation mode: 0 - integer max, 1 - center of mass, 2 - polynomial final int corr_mode, // Correlation mode: 0 - integer max, 1 - center of mass, 2 - polynomial
...@@ -1435,6 +1445,7 @@ public class ImageDtt { ...@@ -1435,6 +1445,7 @@ public class ImageDtt {
final int globalDebugLevel) final int globalDebugLevel)
{ {
// final boolean debug_ports_coordinates = (debug_tileX == -1234); // final boolean debug_ports_coordinates = (debug_tileX == -1234);
final double poly_corr = imgdtt_params.poly_corr_scale; // maybe add per-tile task bits to select none/near/far
final boolean macro_mode = macro_scale != 1; // correlate tile data instead of the pixel data final boolean macro_mode = macro_scale != 1; // correlate tile data instead of the pixel data
final int quad = 4; // number of subcameras final int quad = 4; // number of subcameras
final int numcol = 3; // number of colors final int numcol = 3; // number of colors
...@@ -1468,18 +1479,43 @@ public class ImageDtt { ...@@ -1468,18 +1479,43 @@ public class ImageDtt {
final double [] enh_ortho_scale = new double [corr_size]; final double [] enh_ortho_scale = new double [corr_size];
for (int i = 0; i < corr_size; i++){ for (int i = 0; i < corr_size; i++){
if ((i < (transform_size - enhortho_width)) || (i > (transform_size - 2 + enhortho_width))) enh_ortho_scale[i] = 1.0; if ((i < (transform_size - imgdtt_params.enhortho_width)) || (i > (transform_size - 2 + imgdtt_params.enhortho_width))) {
else enh_ortho_scale[i] = enhortho_scale; enh_ortho_scale[i] = 1.0;
} else {
enh_ortho_scale[i] = imgdtt_params.enhortho_scale;
}
if (i == (transform_size-1)) enh_ortho_scale[i] = 0.0 ; // hardwired 0 in the center if (i == (transform_size-1)) enh_ortho_scale[i] = 0.0 ; // hardwired 0 in the center
enh_ortho_scale[i] *= Math.sin(Math.PI*(i+1.0)/(2*transform_size)); enh_ortho_scale[i] *= Math.sin(Math.PI*(i+1.0)/(2*transform_size));
} }
if (globalDebugLevel > 0){ if (globalDebugLevel > 0){
System.out.println("enhortho_width="+ enhortho_width+" enhortho_scale="+ enhortho_scale); System.out.println("enhortho_width="+ imgdtt_params.enhortho_width+" enhortho_scale="+ imgdtt_params.enhortho_scale);
for (int i = 0; i < corr_size; i++){ for (int i = 0; i < corr_size; i++){
System.out.println(" enh_ortho_scale["+i+"]="+ enh_ortho_scale[i]); System.out.println(" enh_ortho_scale["+i+"]="+ enh_ortho_scale[i]);
} }
} }
// Create window to select center correlation strip using
// ortho_height - full width of non-zero elements
// ortho_eff_height - effective height (ration of the weighted column sum to the center value)
int wcenter = transform_size - 1;
final double [] ortho_weights = new double [corr_size]; // [15]
for (int i = 0; i < corr_size; i++){
if ((i >= wcenter - imgdtt_params.ortho_height/2) && (i <= wcenter + imgdtt_params.ortho_height/2)) {
double dx = 1.0*(i-wcenter)/(imgdtt_params.ortho_height/2 + 1);
ortho_weights[i] = 0.5*(1.0+Math.cos(Math.PI*dx))/imgdtt_params.ortho_eff_height;
}
}
if (globalDebugLevel > 0){
System.out.println("ortho_height="+ imgdtt_params.ortho_height+" ortho_eff_height="+ imgdtt_params.ortho_eff_height);
for (int i = 0; i < corr_size; i++){
System.out.println(" ortho_weights["+i+"]="+ ortho_weights[i]);
}
}
if (globalDebugLevel > 0) { if (globalDebugLevel > 0) {
System.out.println("clt_aberrations_quad_corr(): width="+width+" height="+height+" transform_size="+transform_size+ System.out.println("clt_aberrations_quad_corr(): width="+width+" height="+height+" transform_size="+transform_size+
" debug_tileX="+debug_tileX+" debug_tileY="+debug_tileY+" globalDebugLevel="+globalDebugLevel); " debug_tileX="+debug_tileX+" debug_tileY="+debug_tileY+" globalDebugLevel="+globalDebugLevel);
...@@ -1832,10 +1868,7 @@ public class ImageDtt { ...@@ -1832,10 +1868,7 @@ public class ImageDtt {
} }
System.out.println(); System.out.println();
} }
} // end of debug_for_fpga
}
clt_data[i][chn][tileY][tileX] = new double [4][]; clt_data[i][chn][tileY][tileX] = new double [4][];
fract_shiftsXY[i] = extract_correct_tile( // return a pair of residual offsets fract_shiftsXY[i] = extract_correct_tile( // return a pair of residual offsets
...@@ -1916,7 +1949,6 @@ public class ImageDtt { ...@@ -1916,7 +1949,6 @@ public class ImageDtt {
if (clt_corr_combo != null){ // not null - calculate correlations if (clt_corr_combo != null){ // not null - calculate correlations
tcorr_tpartial=new double[corr_pairs.length][numcol+1][4][transform_len]; tcorr_tpartial=new double[corr_pairs.length][numcol+1][4][transform_len];
// tcorr_tcombo = new double[quad][transform_len];
tcorr_partial = new double[quad][numcol+1][]; tcorr_partial = new double[quad][numcol+1][];
for (int pair = 0; pair < corr_pairs.length; pair++){ for (int pair = 0; pair < corr_pairs.length; pair++){
...@@ -1991,6 +2023,7 @@ public class ImageDtt { ...@@ -1991,6 +2023,7 @@ public class ImageDtt {
} }
} }
// make symmetrical around the disparity direction (horizontal) (here using just average, not mul/sum mixture) // make symmetrical around the disparity direction (horizontal) (here using just average, not mul/sum mixture)
// symmetry can be added to result, not individual (if sum - yes, but with multiplication - not)
if (corr_sym && (clt_mismatch == null)){ // when measuring clt_mismatch symmetry should be off ! if (corr_sym && (clt_mismatch == null)){ // when measuring clt_mismatch symmetry should be off !
for (int chn = firstColor; chn <= numcol; chn++){ for (int chn = firstColor; chn <= numcol; chn++){
for (int i = 1 ; i < transform_size; i++){ for (int i = 1 ; i < transform_size; i++){
...@@ -2199,9 +2232,33 @@ public class ImageDtt { ...@@ -2199,9 +2232,33 @@ public class ImageDtt {
corr_max_weights_poly, // [(radius+1) * (radius+1)] corr_max_weights_poly, // [(radius+1) * (radius+1)]
max_search_radius_poly, // max_search_radius, for polynomial - always use 1 max_search_radius_poly, // max_search_radius, for polynomial - always use 1
imgdtt_params.poly_pwr, // double value_pwr, // raise value to this power (trying to compensate sticking to integer values) imgdtt_params.poly_pwr, // double value_pwr, // raise value to this power (trying to compensate sticking to integer values)
imgdtt_params.poly_value_to_weight, //boolean poly_value_to_weight, // multiply weight by value imgdtt_params.poly_vasw_pwr, // double poly_vasw_pwr, // multiply weight by value
debugMax); debugMax);
// Possible to bypass ortho calculation for bad tiles?
double [][] corr_max_ortho = new double[2][];
// return argmax, max, half-width
corr_max_ortho[0] = getMaxXSOrtho2( // get fractional center using a quadratic polynomial
tcorr_combo[TCORR_COMBO_HOR], // double [] data, // [data_size * data_size]
ortho_weights, // double [] enhortho_scales, // [data_size]
corr_size, // int data_size,
imgdtt_params.ortho_nsamples, // int num_samples, // number of samples to keep (5?)
imgdtt_params.ortho_vasw_pwr, // double value_as_weight, // use positive value as sample weight
(globalDebugLevel > -2) && (tileX == debug_tileX) && (tileY == debug_tileY)); // debugMax);
corr_max_ortho[1] = getMaxXSOrtho2( // get fractional center using a quadratic polynomial
tcorr_combo[TCORR_COMBO_VERT],// double [] data, // [data_size * data_size]
ortho_weights, // double [] enhortho_scales, // [data_size]
corr_size, // int data_size,
imgdtt_params.ortho_nsamples, // int num_samples, // number of samples to keep (5?)
imgdtt_params.ortho_vasw_pwr, // double value_as_weight, // use positive value as sample weight
(globalDebugLevel > -2) && (tileX == debug_tileX) && (tileY == debug_tileY)); // debugMax);
// (globalDebugLevel > 0) && (tileX == debug_tileX) && (tileY == debug_tileY)); // debugMax);
// disparity_map[DISPARITY_INDEX_HOR][tIndex] = transform_size - 1 - corr_max_XS_hor[0];
// disparity_map[DISPARITY_INDEX_HOR_STRENGTH][tIndex] = corr_max_XS_hor[1];
//double //double
if (corr_max_XY != null){ if (corr_max_XY != null){
corr_max_XY[0] = transform_size - 1 -corr_max_XY[0]; corr_max_XY[0] = transform_size - 1 -corr_max_XY[0];
...@@ -2211,15 +2268,27 @@ public class ImageDtt { ...@@ -2211,15 +2268,27 @@ public class ImageDtt {
corr_max_XY[0] = Double.NaN; corr_max_XY[0] = Double.NaN;
corr_max_XY[1] = Double.NaN; corr_max_XY[1] = Double.NaN;
} }
/*
if (corr_max_XY != null){ if (corr_max_ortho[0] != null){
disparity_map[DISPARITY_INDEX_POLY][tIndex] = transform_size - 1 -corr_max_XY[0]; corr_max_ortho[0][0] = transform_size - 1 -corr_max_ortho[0][0];
disparity_map[DISPARITY_INDEX_POLY+1][tIndex] = transform_size - 1 -corr_max_XY[1];
} else { } else {
disparity_map[DISPARITY_INDEX_POLY][tIndex] = Double.NaN; corr_max_ortho[0] = new double[3];
disparity_map[DISPARITY_INDEX_POLY+1][tIndex] = Double.NaN; corr_max_ortho[0][0] = Double.NaN;
corr_max_ortho[0][1] = Double.NaN;
corr_max_ortho[0][2] = Double.NaN;
} }
*/
if (corr_max_ortho[1] != null){
corr_max_ortho[1][0] = transform_size - 1 -corr_max_ortho[1][0];
} else {
corr_max_ortho[1] = new double[3];
corr_max_ortho[1][0] = Double.NaN;
corr_max_ortho[1][1] = Double.NaN;
corr_max_ortho[1][2] = Double.NaN;
}
disparity_map[DISPARITY_INDEX_POLY][tIndex] = corr_max_XY[0]; disparity_map[DISPARITY_INDEX_POLY][tIndex] = corr_max_XY[0];
disparity_map[DISPARITY_INDEX_POLY+1][tIndex] = corr_max_XY[1]; disparity_map[DISPARITY_INDEX_POLY+1][tIndex] = corr_max_XY[1];
...@@ -2232,26 +2301,101 @@ public class ImageDtt { ...@@ -2232,26 +2301,101 @@ public class ImageDtt {
} }
if (disparity_map[DBG1_INDEX] != null) { if (disparity_map[DBG1_INDEX] != null) {
disparity_map[DBG1_INDEX][tIndex] = disparity_map[DBG0_INDEX][tIndex]; disparity_map[DBG1_INDEX][tIndex] = disparity_map[DBG0_INDEX][tIndex];
if (!Double.isNaN(corr_max_XY[0]) && disparity_map[DBG3_INDEX][tIndex] = Double.NaN;
(Math.abs(disparity_map[DISPARITY_INDEX_CM][tIndex] - corr_max_XY[0]) < imgdtt_params.max_poly_diff) && if ((corr_max_XY.length > 4) &&
!Double.isNaN(corr_max_XY[3]) && !Double.isNaN(corr_max_XY[4]) &&
(corr_max_XY[3] < imgdtt_params.max_poly_hwidth) &&
(corr_max_XY[4] < imgdtt_params.max_poly_hwidth) &&
(disparity_map[DISPARITY_STRENGTH_INDEX][tIndex] > imgdtt_params.min_poly_strength)) { // debug threshold (disparity_map[DISPARITY_STRENGTH_INDEX][tIndex] > imgdtt_params.min_poly_strength)) { // debug threshold
disparity_map[DBG1_INDEX][tIndex] = corr_max_XY[0]; disparity_map[DBG1_INDEX][tIndex] = corr_max_XY[0];
disparity_map[DBG3_INDEX][tIndex] = Double.NaN; disparity_map[DBG3_INDEX][tIndex] = corr_max_XY[0]; // Double.NaN;
} else { // show only "bad" and strong poly }
if (disparity_map[DISPARITY_STRENGTH_INDEX][tIndex] > imgdtt_params.min_poly_strength) { }
disparity_map[DBG3_INDEX][tIndex] = disparity_map[DBG2_INDEX][tIndex]; /*
} else { if (disparity_map[DBG6_INDEX] != null) {
disparity_map[DBG3_INDEX][tIndex] = Double.NaN; if ((corr_max_XY.length > 4) &&
} (disparity_map[DISPARITY_STRENGTH_INDEX][tIndex] > imgdtt_params.min_poly_strength)) {
// disparity_map[DBG4_INDEX][tIndex] = corr_max_XY[2]; // value
disparity_map[DBG5_INDEX][tIndex] = corr_max_XY[3]; // half-width x
disparity_map[DBG6_INDEX][tIndex] = corr_max_XY[4]; // half-width y
disparity_map[DBG4_INDEX][tIndex] = (corr_max_XY[3]-corr_max_XY[4]); // value
} else {
disparity_map[DBG5_INDEX][tIndex] = Double.NaN;
disparity_map[DBG6_INDEX][tIndex] = Double.NaN;
disparity_map[DBG4_INDEX][tIndex] = Double.NaN;
} }
// if (disparity_map[DBG3_INDEX] != null) {
// disparity_map[DBG3_INDEX][tIndex] = disparity_map[DBG2_INDEX][tIndex] - disparity_map[DBG0_INDEX][tIndex];
// }
} }
if (imgdtt_params.mix_corr_poly) { */
if (disparity_map[DBG12_INDEX] != null) {
if ((corr_max_XY.length > 4) && // only show for strong enough poly correlation
(disparity_map[DISPARITY_STRENGTH_INDEX][tIndex] > imgdtt_params.min_poly_strength)) {
disparity_map[DBG4_INDEX ][tIndex] = corr_max_XY[0]; // argmax
disparity_map[DBG7_INDEX ][tIndex] = corr_max_XY[2]; // max
disparity_map[DBG10_INDEX][tIndex] = corr_max_XY[3]; // half-width x
disparity_map[DBG5_INDEX ][tIndex] = corr_max_ortho[0][0]; // argmax
disparity_map[DBG8_INDEX ][tIndex] = corr_max_ortho[0][1]; // max
disparity_map[DBG11_INDEX][tIndex] = corr_max_ortho[0][2]; // half-width x
disparity_map[DBG6_INDEX ][tIndex] = corr_max_ortho[1][0]; // argmax
disparity_map[DBG9_INDEX ][tIndex] = corr_max_ortho[1][1]; // max
disparity_map[DBG12_INDEX][tIndex] = corr_max_ortho[1][2]; // half-width x
} else {
disparity_map[DBG4_INDEX ][tIndex] = Double.NaN;
disparity_map[DBG5_INDEX ][tIndex] = Double.NaN;
disparity_map[DBG6_INDEX ][tIndex] = Double.NaN;
disparity_map[DBG7_INDEX ][tIndex] = Double.NaN;
disparity_map[DBG8_INDEX ][tIndex] = Double.NaN;
disparity_map[DBG9_INDEX ][tIndex] = Double.NaN;
disparity_map[DBG10_INDEX][tIndex] = Double.NaN;
disparity_map[DBG11_INDEX][tIndex] = Double.NaN;
disparity_map[DBG12_INDEX][tIndex] = Double.NaN;
}
}
// use poly only if half-width y < limit (now it is ~2.0 for good corr)
if (imgdtt_params.mix_corr_poly) { // regardless of debug
// apply // apply
disparity_map[DISPARITY_INDEX_CM][tIndex] = disparity_map[DBG1_INDEX][tIndex]; if ((corr_max_XY.length > 4) && !Double.isNaN(corr_max_XY[3]) && !Double.isNaN(corr_max_XY[4]) &&
// TODO: add Y for correction !!!! (corr_max_XY[3] < imgdtt_params.max_poly_hwidth) &&
(corr_max_XY[4] < imgdtt_params.max_poly_hwidth) &&
(disparity_map[DISPARITY_STRENGTH_INDEX][tIndex] > imgdtt_params.min_poly_strength)) { // debug threshold
// now CM is actually poly!
double pcorr = (corr_max_XY[3]-corr_max_XY[4]);
if (pcorr > 0.0) {
pcorr *= poly_corr; // maybe add per-tile control far/near/none
} else {
pcorr = 0.0;
}
disparity_map[DISPARITY_INDEX_CM+0][tIndex] = corr_max_XY[0]+pcorr; // only for X
disparity_map[DISPARITY_INDEX_CM+1][tIndex] = corr_max_XY[1];
// correct far objects by using hor/vert correlations
if (imgdtt_params.far_object_correct) {
// check strengths:
if ((corr_max_XY[2] >= imgdtt_params.fo_min_strength) &&
(corr_max_ortho[0][1] >= imgdtt_params.fo_min_strength) &&
(corr_max_ortho[1][1] >= imgdtt_params.fo_min_strength) &&
// check halw-widths
(corr_max_XY[3] <= imgdtt_params.fo_max_hwidth) &&
(corr_max_ortho[0][2] <= imgdtt_params.fo_max_hwidth) &&
(corr_max_ortho[1][2] <= imgdtt_params.fo_max_hwidth)) {
double disp_full = corr_max_XY[0];
double disp_near = Math.max(corr_max_ortho[0][0],corr_max_ortho[1][0]);
double disp_far = Math.min(corr_max_ortho[0][0],corr_max_ortho[1][0]);
if ((disp_full < disp_near) && (disp_full > disp_far)) {
double corr = (disp_near - disp_far) * imgdtt_params.fo_overcorrection + (disp_near -disp_full);
double lim_corr = (disp_near -disp_full) * imgdtt_params.fo_lim_overcorr;
corr = Math.min(corr, lim_corr);
if (corr > 0.0) {
disparity_map[DISPARITY_INDEX_CM+0][tIndex] += corr;
}
}
}
}
}
} }
// //
...@@ -2886,12 +3030,11 @@ public class ImageDtt { ...@@ -2886,12 +3030,11 @@ public class ImageDtt {
return rslt; return rslt;
} }
public double [] getMaxXSOrtho( // get fractional center as a "center of mass" inside circle/square from the integer max public double [] getMaxXSOrtho( // // get fractional center using a quadratic polynomial
double [] data, // [data_size * data_size] double [] data, // [data_size * data_size]
double [] enhortho_scales, // [data_size] double [] enhortho_scales, // [data_size]
int data_size, int data_size,
double radius, // positive - within that distance, negative - within 2*(-radius)+1 square double radius, // positive - within that distance, negative - within 2*(-radius)+1 square
// boolean poly_mode,
boolean debug) boolean debug)
{ {
double [] corr_1d = new double [data_size]; double [] corr_1d = new double [data_size];
...@@ -2905,8 +3048,7 @@ public class ImageDtt { ...@@ -2905,8 +3048,7 @@ public class ImageDtt {
for (int i = 1; i < data_size; i++){ for (int i = 1; i < data_size; i++){
if (corr_1d[i] > corr_1d[icenter]) icenter = i; if (corr_1d[i] > corr_1d[icenter]) icenter = i;
} }
//calculate as "center of mass"
// int iradius = (int) Math.abs(radius);
double [] coeff = null; double [] coeff = null;
double xcenter = icenter; double xcenter = icenter;
double [][] pa_data=null; double [][] pa_data=null;
...@@ -2927,46 +3069,94 @@ public class ImageDtt { ...@@ -2927,46 +3069,94 @@ public class ImageDtt {
double strength = corr_1d[icenter] / ((data_size+1) / 2);// scale to ~match regular strength double strength = corr_1d[icenter] / ((data_size+1) / 2);// scale to ~match regular strength
double [] rslt1 = {xcenter, strength}; double [] rslt1 = {xcenter, strength};
return rslt1; return rslt1;
/* }
double s0 = 0, sx=00;
int x_min = (int) Math.ceil(xcenter - radius); // value as weight (boolean), make 0 if <0,
if (x_min < 0) x_min = 0; // select # of points (normally 5 if v_as_w, 3 if not
int x_max = (int) Math.floor(xcenter + radius); // calculate x, f(x) and half width
if (x_max >= data_size) x_max = data_size - 1; // balance strength? Or just assume appropriate window
for (int x = x_min ; x <= x_max; x++){ // maybe optimized to symmetrical data
double d = corr_1d[x];
s0 += d; public double [] getMaxXSOrtho2( // get fractional center using a quadratic polynomial
sx += d * x; double [] data, // [data_size * data_size]
} double [] vweights, // [data_size]
double [] rslt = {sx / s0, strength}; // scale to ~match regular strength int data_size,
if (debug){ int num_samples, // number of samples to keep (5?)
System.out.println("getMaxXYCmEnhOrtho() -> "+rslt[0]+"/"+rslt[1]); double vasw_pwr, // use value to this power as sample weight
boolean debug)
{
double [] corr_1d = new double [data_size];
for (int j = 0; j < data_size; j++){
corr_1d[j] = 0;
for (int i = 0; i < data_size; i++){ for (int i = 0; i < data_size; i++){
System.out.println("corr_1d["+i+"]="+corr_1d[i]); corr_1d[j] += data[i * data_size + j] * vweights[i];
} }
showDoubleFloatArrays sdfa_instance = new showDoubleFloatArrays(); // just for debugging? }
double [] masked_data = new double [data_size*data_size]; int hsize = num_samples/2;
for (int j = 0; j < data_size; j++){ int i0 = hsize;
for (int i = 0; i < data_size; i++){ for (int i = hsize; i < (data_size - num_samples + hsize) ; i++){
masked_data[i * data_size + j] = data[i * data_size + j] * enhortho_scales[i]; if (corr_1d[i] > corr_1d[i0]) i0 = i;
}
i0 -= hsize;
double [] coeff = null;
double [][] pa_data=new double[num_samples][(vasw_pwr > 0.0)?3:2];
for (int i = 0; i < num_samples; i++) {
pa_data[i][0] = i + i0;
pa_data[i][1] = corr_1d[i + i0];
if (vasw_pwr > 0.0) {
pa_data[i][2] = Math.pow(Math.abs(pa_data[i][1]), vasw_pwr);
}
}
PolynomialApproximation pa = new PolynomialApproximation(debug?5:0); // debugLevel
coeff = pa.polynomialApproximation1d(pa_data, 2);
double xcenter, fx, hwidth;
if ((coeff == null) || (coeff[2] > 0.0)){
xcenter = i0 + hsize;
fx = corr_1d[i0+hsize];
hwidth = data_size;
} else {
xcenter = - coeff[1]/(2* coeff[2]);
fx = coeff[0] + coeff[1]*xcenter + coeff[2]*xcenter*xcenter;
hwidth = Math.sqrt(-fx/coeff[2]);
}
if (debug){
System.out.println("getMaxXSOrtho2(): getMaxXYPoly(): xcenter="+xcenter+" fx="+fx+" hwidth="+hwidth+" i0="+i0);
System.out.println("vweights[i]=");
for (int i=0; i < vweights.length; i++) System.out.print(vweights[i]+" "); System.out.println();
System.out.println("corr_1d[i]=");
for (int i=0; i < corr_1d.length; i++) System.out.print(corr_1d[i]+" "); System.out.println();
System.out.println("pa_data[i]=");
for (int i=0; i < pa_data.length; i++) System.out.println(i+": "+pa_data[i][0]+" "+pa_data[i][1]+" "+pa_data[i][2]+" ");
if (coeff != null) {
System.out.println("coeff: a = "+coeff[2]+", b="+coeff[1]+", c="+coeff[0]);
}
System.out.println("\n----source data ----------");
for (int i = 0; i < data_size; i++){
for (int j = 0; j < data_size; j++){
System.out.print(String.format(" %6.3f", data[i * data_size + j]));
} }
System.out.println();
} }
double [][] dbg_data = {data,masked_data}; System.out.println("\n---- masked ----------");
String [] titles = {"correlation", "enhortho_correlation"}; for (int i = 0; i < data_size; i++){
sdfa_instance.showArrays(dbg_data, data_size, data_size, true, "getMaxXYCmEnhOrtho", titles); for (int j = 0; j < data_size; j++){
if (coeff != null) System.out.println("a = "+coeff[2]+", b = "+coeff[1]+", c = "+coeff[0]); System.out.print(String.format(" %6.3f", data[i * data_size + j] * vweights[i]));
System.out.println("xcenter="+xcenter);
if (pa_data != null) {
for (int i = 0; i < pa_data.length; i++){
System.out.println("pa_data["+i+"]={"+pa_data[i][0]+", "+pa_data[i][1]+"}");
} }
System.out.println();
} }
for (int j = 0; j < data_size; j++){
System.out.print(String.format(" %6.3f", corr_1d[j]));
}
System.out.println();
} }
double [] rslt = {xcenter, fx, hwidth};
return rslt; return rslt;
*/
} }
public double [] getMaxXYPoly( // get interpolated maximum coordinates using 2-nd degree polynomial public double [] getMaxXYPoly( // get interpolated maximum coordinates using 2-nd degree polynomial
PolynomialApproximation pa, PolynomialApproximation pa,
double [] data, // [data_size * data_size] double [] data, // [data_size * data_size]
...@@ -2975,7 +3165,7 @@ public class ImageDtt { ...@@ -2975,7 +3165,7 @@ public class ImageDtt {
double [] weights, // [(radius+1) * (radius+1)] double [] weights, // [(radius+1) * (radius+1)]
int radius, int radius,
double value_pwr, // raise value to this power (trying to compensate sticking to integer values) double value_pwr, // raise value to this power (trying to compensate sticking to integer values)
boolean poly_value_to_weight, // multiply weight by value double poly_vasw_pwr, // multiply weight by value to this power
boolean debug) boolean debug)
{ {
// TODO: make sure it is within 1pxx1px square from the integer maximum? If not - return null and use center of mass instead? // TODO: make sure it is within 1pxx1px square from the integer maximum? If not - return null and use center of mass instead?
...@@ -3008,7 +3198,7 @@ public class ImageDtt { ...@@ -3008,7 +3198,7 @@ public class ImageDtt {
} }
mdata[indx][2] = new double [1]; mdata[indx][2] = new double [1];
mdata[indx][2][0] = weights[ay * (radius + 1) + ax]; mdata[indx][2][0] = weights[ay * (radius + 1) + ax];
if (poly_value_to_weight) mdata[indx][2][0] *= mdata[indx][1][0]; if (poly_vasw_pwr > 0 ) mdata[indx][2][0] *= Math.pow(Math.abs(mdata[indx][1][0]), poly_vasw_pwr);
indx++; indx++;
} }
} }
...@@ -3024,10 +3214,19 @@ public class ImageDtt { ...@@ -3024,10 +3214,19 @@ public class ImageDtt {
System.out.println(i+": "+mdata[i][0][0]+"/"+mdata[i][0][1]+" z="+mdata[i][1][0]+" w="+mdata[i][2][0]); System.out.println(i+": "+mdata[i][0][0]+"/"+mdata[i][0][1]+" z="+mdata[i][1][0]+" w="+mdata[i][2][0]);
} }
} }
double [] rslt = pa.quadraticMax2d( // double [] rslt = pa.quadraticMax2d(
double [] rslt = pa.quadraticMaxV2dX2Y2XY( // 6 elements - Xc, Yx, f(x,y), A, B, C (from A*x^2 + B*y^2 +C*x*y+...)
mdata, mdata,
1.0E-30,//25, // 1.0E-15, 1.0E-30,//25, // 1.0E-15,
debug? 4:0); debug? 4:0);
if (rslt == null) return null;
// calculate width_x and width_y
double hwx = Double.NaN, hwy = Double.NaN;
if ((rslt[2] > 0.0) && (rslt[3] <0.0) && (rslt[4] <0.0)) {
hwx = Math.sqrt(-rslt[2]/rslt[3]);
hwy = Math.sqrt(-rslt[2]/rslt[4]);
}
double [] xyvwh = {rslt[0], rslt[1], rslt[2], hwx, hwy};
if (debug){ if (debug){
System.out.println("after: getMaxXYPoly(): icenter[0] = "+icenter[0]+" icenter[1] = "+icenter[1]); System.out.println("after: getMaxXYPoly(): icenter[0] = "+icenter[0]+" icenter[1] = "+icenter[1]);
for (int i = 0; i< mdata.length; i++){ for (int i = 0; i< mdata.length; i++){
...@@ -3035,7 +3234,7 @@ public class ImageDtt { ...@@ -3035,7 +3234,7 @@ public class ImageDtt {
} }
System.out.println("quadraticMax2d(mdata) --> "+((rslt==null)?"null":(rslt[0]+"/"+rslt[1]))); System.out.println("quadraticMax2d(mdata) --> "+((rslt==null)?"null":(rslt[0]+"/"+rslt[1])));
} }
return rslt; return xyvwh; // rslt;
} }
......
import java.util.Properties;
/** /**
** **
** ImageDttParameters - parameters defining TP operations (at first extra) ** ImageDttParameters - parameters defining TP operations (at first extra)
...@@ -24,40 +22,186 @@ import java.util.Properties; ...@@ -24,40 +22,186 @@ import java.util.Properties;
** **
*/ */
import java.util.Properties;
public class ImageDttParameters { public class ImageDttParameters {
public boolean corr_mode_debug = true; public boolean corr_mode_debug = true;
public boolean mix_corr_poly = false; public boolean mix_corr_poly = false;
public double min_poly_strength = 0.2; public double min_poly_strength = 0.2;
public double max_poly_diff = 0.6; public double max_poly_hwidth = 2.5; // Maximal polynomial approximation half-width (in both directions)
public double poly_corr_scale = 2.0; // Shift value if correlation maximum is wide in X than in Y to detect near objects (negative - far ones)
public double poly_pwr = 1.0; public double poly_pwr = 1.0;
public boolean poly_value_to_weight = true; public double poly_vasw_pwr = 2.0; // raise value to this power and apply as weight (0 - disable)
public double corr_magic_scale_cm = 1.0; //0.85; // reported correlation offset vs. actual one (not yet understood)
public double corr_magic_scale_poly = 1.0; // 0.95; // reported correlation offset vs. actual one (not yet understood)
public int ortho_height = 7; // height of non-zero weights for hor/vert correlation to compensate borders
public double ortho_eff_height = 2.58; // effective correlation stripe height to match strengths
public int ortho_nsamples = 5; // number of samples to fit parabola
public double ortho_vasw_pwr = 2.0; // use data as weights when fitting parabola (high vale samples are more important (when false use 3 samples only)
public int enhortho_width = 2; // reduce weight of center correlation pixels from center (0 - none, 1 - center, 2 +/-1 from center)
public double enhortho_scale = 0.0; // 0.2; // multiply center correlation pixels (inside enhortho_width)
public boolean far_object_correct = true; // correct far objects by comparing orthogonal correlations
public double fo_min_strength = 0.3; // minimal strength for all correlations (full, hor, vert) to try to correct
public double fo_max_hwidth = 2.4; // maximal half-width for all directions to try to correct far objects
public double fo_overcorrection = 0.0; // add scaled hor/vert difference to the largest of hor/vert disparity
public double fo_lim_overcorr = 2.0; // limit full correction with respect to largest - fullcorr difference
public void dialogQuestions(GenericJTabbedDialog gd) {
gd.addCheckbox ("Enable ImageDtt correlation debug layers", this.corr_mode_debug);
gd.addCheckbox ("Replace CM layer with mixed/new poly one", this.mix_corr_poly);
gd.addNumericField("Use poly mode if strength is greater than", this.min_poly_strength, 3,6,"", "AND condition");
gd.addNumericField("Maximal polynomial approximation half-width", this.max_poly_hwidth, 3,6,"pix", "Maximal polynomial approximation half-width (in both directions), Most now are ~2.0");
gd.addNumericField("Polynomial argmax correction (positive - near, negative - far)", this.poly_corr_scale, 3,6,"×", "Shift value if correlation maximum is wide in X than in Y to detect near objects (negative - far ones)");
gd.addNumericField("When calculating poly raise correlation value to this power", this.poly_pwr, 3,6,"", "Trying to reduce sticking to integer values");
gd.addNumericField("When calculating poly multiply weight by correlation value", this.poly_vasw_pwr,3,6,"",
"Raise value to this power and apply as weight");
gd.addNumericField("Magic scale for CM correlation", this.corr_magic_scale_cm, 3,6,"",
"Reported center of mass correlation value is this part of actual");
gd.addNumericField("Magic scale for Poly correlation", this.corr_magic_scale_poly, 3,6,"",
"Reported polynomial correlation value is this part of actual");
gd.addNumericField("Height of non-zero weights for hor/vert correlation", this.ortho_height, 3);
gd.addNumericField("Effective correlation stripe height to match strengths", this.ortho_eff_height, 3,6,"", "For matching 2-d and 1-d correlation maximums");
gd.addNumericField("Number of samples to fit parabola in ortho mode", this.ortho_nsamples, 3);
gd.addNumericField("Use data as weights when fitting parabola for ortho mode", this.ortho_vasw_pwr,3,6,"",
"Raise value to this power and apply as weight. Reduce width to 3 samples if false, 5 OK when true");
gd.addNumericField("Reduce weight of center correlation pixels from center (0 - none, 1 - center, 2 +/-1 from center)", this.enhortho_width, 0);
gd.addNumericField("Multiply center correlation pixels (inside enhortho_width) (1.0 - disables enh_orttho)", this.enhortho_scale, 3);
gd.addMessage("Far objects correction");
gd.addCheckbox ("Try to correct far objects (make them closer) by hor/vert comparison", this.far_object_correct);
gd.addNumericField("Minimal strength for all correlations (full, hor, vert) to try to correct", this.fo_min_strength, 3,6,"",
"Do not correct if any of the full, hor or vert strength is lower than this");
gd.addNumericField("Maximal correlation half-width", this.fo_max_hwidth, 3,6,"",
"Do not correct if any of the full, hor or vert half-width is above this");
gd.addNumericField("Overcorrection scale", this.fo_overcorrection, 3,6,"",
"Add scaled hor/vert difference to the largest of hor/vert disparity. Use 0 to just select largest of disparities");
gd.addNumericField("Limit overcorrection", this.fo_lim_overcorr, 3,6,"",
"Limit full correction with respect to largest - fullcorr difference. 1.0 does not allow overcorrection, < 1.0 - the result will be closer to full correction");
}
public void dialogAnswers(GenericJTabbedDialog gd) {
this.corr_mode_debug= gd.getNextBoolean();
this.mix_corr_poly= gd.getNextBoolean();
this.min_poly_strength= gd.getNextNumber();
this.max_poly_hwidth= gd.getNextNumber();
this.poly_corr_scale= gd.getNextNumber();
this.poly_pwr= gd.getNextNumber();
this.poly_vasw_pwr= gd.getNextNumber();
this.corr_magic_scale_cm= gd.getNextNumber();
this.corr_magic_scale_poly= gd.getNextNumber();
this.ortho_height = (int) gd.getNextNumber();
this.ortho_eff_height= gd.getNextNumber();
this.ortho_nsamples = (int) gd.getNextNumber();
this.ortho_vasw_pwr = gd.getNextNumber();
this.enhortho_width= (int) gd.getNextNumber();
this.enhortho_scale= gd.getNextNumber();
this.far_object_correct = gd.getNextBoolean();
this.fo_min_strength = gd.getNextNumber();
this.fo_max_hwidth = gd.getNextNumber();
this.fo_overcorrection = gd.getNextNumber();
this.fo_lim_overcorr = gd.getNextNumber();
}
public void setProperties(String prefix,Properties properties){ public void setProperties(String prefix,Properties properties){
properties.setProperty(prefix+"corr_mode_debug", this.corr_mode_debug+""); properties.setProperty(prefix+"corr_mode_debug", this.corr_mode_debug+"");
properties.setProperty(prefix+"mix_corr_poly", this.mix_corr_poly+""); properties.setProperty(prefix+"mix_corr_poly", this.mix_corr_poly+"");
properties.setProperty(prefix+"min_poly_strength", this.min_poly_strength+""); properties.setProperty(prefix+"min_poly_strength", this.min_poly_strength+"");
properties.setProperty(prefix+"max_poly_diff", this.max_poly_diff+""); properties.setProperty(prefix+"max_poly_hwidth", this.max_poly_hwidth+"");
properties.setProperty(prefix+"poly_pwr", this.poly_pwr+""); properties.setProperty(prefix+"poly_corr_scale", this.poly_corr_scale+"");
properties.setProperty(prefix+"mix_corr_poly", this.mix_corr_poly+"");
properties.setProperty(prefix+"poly_pwr", this.poly_pwr+"");
properties.setProperty(prefix+"poly_value_to_weight", this.poly_vasw_pwr+"");
properties.setProperty(prefix+"corr_magic_scale_cm", this.corr_magic_scale_cm+"");
properties.setProperty(prefix+"corr_magic_scale_poly",this.corr_magic_scale_poly+"");
properties.setProperty(prefix+"ortho_height", this.ortho_height+"");
properties.setProperty(prefix+"ortho_eff_height", this.ortho_eff_height+"");
properties.setProperty(prefix+"ortho_nsamples", this.ortho_nsamples+"");
properties.setProperty(prefix+"ortho_vasw", this.ortho_vasw_pwr+"");
properties.setProperty(prefix+"enhortho_width", this.enhortho_width +"");
properties.setProperty(prefix+"enhortho_scale", this.enhortho_scale +"");
properties.setProperty(prefix+"far_object_correct", this.far_object_correct +"");
properties.setProperty(prefix+"fo_min_strength", this.fo_min_strength +"");
properties.setProperty(prefix+"fo_max_hwidth", this.fo_max_hwidth +"");
properties.setProperty(prefix+"fo_overcorrection", this.fo_overcorrection +"");
properties.setProperty(prefix+"fo_lim_overcorr", this.fo_lim_overcorr +"");
} }
public void getProperties(String prefix,Properties properties){ public void getProperties(String prefix,Properties properties){
if (properties.getProperty(prefix+"corr_mode_debug")!=null) this.corr_mode_debug=Boolean.parseBoolean(properties.getProperty(prefix+"corr_mode_debug")); if (properties.getProperty(prefix+"corr_mode_debug")!=null) this.corr_mode_debug=Boolean.parseBoolean(properties.getProperty(prefix+"corr_mode_debug"));
if (properties.getProperty(prefix+"mix_corr_poly")!=null) this.mix_corr_poly=Boolean.parseBoolean(properties.getProperty(prefix+"mix_corr_poly")); if (properties.getProperty(prefix+"mix_corr_poly")!=null) this.mix_corr_poly=Boolean.parseBoolean(properties.getProperty(prefix+"mix_corr_poly"));
if (properties.getProperty(prefix+"min_poly_strength")!=null) this.min_poly_strength=Double.parseDouble(properties.getProperty(prefix+"min_poly_strength")); if (properties.getProperty(prefix+"min_poly_strength")!=null) this.min_poly_strength=Double.parseDouble(properties.getProperty(prefix+"min_poly_strength"));
if (properties.getProperty(prefix+"max_poly_diff")!=null) this.max_poly_diff=Double.parseDouble(properties.getProperty(prefix+"max_poly_diff")); if (properties.getProperty(prefix+"max_poly_hwidth")!=null) this.max_poly_hwidth=Double.parseDouble(properties.getProperty(prefix+"max_poly_hwidth"));
if (properties.getProperty(prefix+"poly_pwr")!=null) this.poly_pwr=Double.parseDouble(properties.getProperty(prefix+"poly_pwr")); if (properties.getProperty(prefix+"poly_corr_scale")!=null) this.poly_corr_scale=Double.parseDouble(properties.getProperty(prefix+"poly_corr_scale"));
if (properties.getProperty(prefix+"poly_value_to_weight")!=null) this.poly_value_to_weight=Boolean.parseBoolean(properties.getProperty(prefix+"poly_value_to_weight"));
if (properties.getProperty(prefix+"poly_pwr")!=null) this.poly_pwr=Double.parseDouble(properties.getProperty(prefix+"poly_pwr"));
if (properties.getProperty(prefix+"poly_vasw_pwr")!=null) this.poly_vasw_pwr=Double.parseDouble(properties.getProperty(prefix+"poly_vasw_pwr"));
if (properties.getProperty(prefix+"corr_magic_scale_cm")!=null) this.corr_magic_scale_cm=Double.parseDouble(properties.getProperty(prefix+"corr_magic_scale_cm"));
if (properties.getProperty(prefix+"corr_magic_scale_poly")!=null) this.corr_magic_scale_poly=Double.parseDouble(properties.getProperty(prefix+"corr_magic_scale_poly"));
if (properties.getProperty(prefix+"ortho_height")!=null) this.ortho_height=Integer.parseInt(properties.getProperty(prefix+"ortho_height"));
if (properties.getProperty(prefix+"ortho_eff_height")!=null) this.ortho_eff_height=Double.parseDouble(properties.getProperty(prefix+"ortho_eff_height"));
if (properties.getProperty(prefix+"ortho_nsamples")!=null) this.ortho_nsamples=Integer.parseInt(properties.getProperty(prefix+"ortho_nsamples"));
if (properties.getProperty(prefix+"ortho_vasw_pwr")!=null) this.ortho_vasw_pwr=Double.parseDouble(properties.getProperty(prefix+"ortho_vasw_pwr"));
if (properties.getProperty(prefix+"enhortho_width")!=null) this.enhortho_width=Integer.parseInt(properties.getProperty(prefix+"enhortho_width"));
if (properties.getProperty(prefix+"enhortho_scale")!=null) this.enhortho_scale=Double.parseDouble(properties.getProperty(prefix+"enhortho_scale"));
if (properties.getProperty(prefix+"far_object_correct")!=null) this.far_object_correct=Boolean.parseBoolean(properties.getProperty(prefix+"far_object_correct"));
if (properties.getProperty(prefix+"fo_min_strength")!=null) this.fo_min_strength=Double.parseDouble(properties.getProperty(prefix+"fo_min_strength"));
if (properties.getProperty(prefix+"fo_max_hwidth")!=null) this.fo_max_hwidth=Double.parseDouble(properties.getProperty(prefix+"fo_max_hwidth"));
if (properties.getProperty(prefix+"fo_overcorrection")!=null) this.fo_overcorrection=Double.parseDouble(properties.getProperty(prefix+"fo_overcorrection"));
if (properties.getProperty(prefix+"fo_lim_overcorr")!=null) this.fo_lim_overcorr=Double.parseDouble(properties.getProperty(prefix+"fo_lim_overcorr"));
} }
@Override @Override
public ImageDttParameters clone() { public ImageDttParameters clone() throws CloneNotSupportedException {
ImageDttParameters idp = new ImageDttParameters(); ImageDttParameters idp = new ImageDttParameters();
idp.corr_mode_debug = corr_mode_debug; idp.corr_mode_debug = corr_mode_debug;
idp.mix_corr_poly = mix_corr_poly; idp.mix_corr_poly = mix_corr_poly;
idp.min_poly_strength = min_poly_strength; idp.min_poly_strength = min_poly_strength;
idp.max_poly_diff = max_poly_diff; idp.max_poly_hwidth = max_poly_hwidth;
idp.poly_corr_scale = poly_corr_scale;
idp.poly_pwr = poly_pwr; idp.poly_pwr = poly_pwr;
idp.poly_value_to_weight = poly_value_to_weight; idp.poly_vasw_pwr = poly_vasw_pwr;
idp.corr_magic_scale_cm = corr_magic_scale_cm;
idp.corr_magic_scale_poly = corr_magic_scale_poly;
idp.ortho_height = ortho_height;
idp.ortho_eff_height = ortho_eff_height;
idp.ortho_nsamples = ortho_nsamples;
idp.ortho_vasw_pwr = ortho_vasw_pwr;
idp.enhortho_width = enhortho_width;
idp.enhortho_scale = enhortho_scale;
idp.far_object_correct = far_object_correct;
idp.fo_min_strength = fo_min_strength;
idp.fo_max_hwidth = fo_max_hwidth;
idp.fo_overcorrection = fo_overcorrection;
idp.fo_lim_overcorr = fo_lim_overcorr;
return idp; return idp;
} }
// TODO move 2 dialog methods here
} }
...@@ -246,8 +246,8 @@ public class MacroCorrelation { ...@@ -246,8 +246,8 @@ public class MacroCorrelation {
min_corr_selected, // 0.0001; // minimal correlation value to consider valid min_corr_selected, // 0.0001; // minimal correlation value to consider valid
clt_parameters.max_corr_sigma,// 1.5; // weights of points around global max to find fractional clt_parameters.max_corr_sigma,// 1.5; // weights of points around global max to find fractional
clt_parameters.max_corr_radius, clt_parameters.max_corr_radius,
clt_parameters.enhortho_width, // 2; // reduce weight of center correlation pixels from center (0 - none, 1 - center, 2 +/-1 from center) // clt_parameters.enhortho_width, // 2; // reduce weight of center correlation pixels from center (0 - none, 1 - center, 2 +/-1 from center)
clt_parameters.enhortho_scale, // 0.2; // multiply center correlation pixels (inside enhortho_width) // clt_parameters.enhortho_scale, // 0.2; // multiply center correlation pixels (inside enhortho_width)
clt_parameters.max_corr_double, // Double pass when masking center of mass to reduce preference for integer values clt_parameters.max_corr_double, // Double pass when masking center of mass to reduce preference for integer values
clt_parameters.corr_mode, // Correlation mode: 0 - integer max, 1 - center of mass, 2 - polynomial clt_parameters.corr_mode, // Correlation mode: 0 - integer max, 1 - center of mass, 2 - polynomial
clt_parameters.min_shot, // 10.0; // Do not adjust for shot noise if lower than clt_parameters.min_shot, // 10.0; // Do not adjust for shot noise if lower than
......
...@@ -571,6 +571,23 @@ public class MeasuredLayers { ...@@ -571,6 +571,23 @@ public class MeasuredLayers {
return sw; return sw;
} }
public double[][] getDisparityStrengthML (
int num_layer,
int stX,
int stY,
boolean [] sel_in,
MeasuredLayersFilterParameters mlfp,
boolean null_if_none){
return getDisparityStrengthML(
num_layer,
stX,
stY,
sel_in,
mlfp.strength_floor,
mlfp.strength_pow,
null_if_none);
}
/** /**
* Get disparity and correlation strength for the specific measurement layer and * Get disparity and correlation strength for the specific measurement layer and
* supertile X,Y coordinates in the image. Combined with input selection * supertile X,Y coordinates in the image. Combined with input selection
...@@ -629,6 +646,17 @@ public class MeasuredLayers { ...@@ -629,6 +646,17 @@ public class MeasuredLayers {
return ds; return ds;
} }
public double[][] getDisparityStrengthML (
int num_layer,
MeasuredLayersFilterParameters mlfp){
return getDisparityStrengthML(
num_layer,
mlfp.strength_floor,
mlfp.strength_pow);
}
/** /**
* Get disparity and correlation strength for the specific measurement layer. * Get disparity and correlation strength for the specific measurement layer.
* Combined with input selection * Combined with input selection
...@@ -688,12 +716,13 @@ public class MeasuredLayers { ...@@ -688,12 +716,13 @@ public class MeasuredLayers {
int stX, int stX,
int stY, int stY,
boolean [] sel_in, boolean [] sel_in,
double strength_floor, MeasuredLayersFilterParameters mlfp,
double strength_pow, // double strength_floor,
int smplSide, // = 2; // Sample size (side of a square) // double strength_pow,
int smplNum, // = 3; // Number after removing worst (should be >1) // int smplSide, // = 2; // Sample size (side of a square)
double smplRms, // = 0.1; // Maximal RMS of the remaining tiles in a sample // int smplNum, // = 3; // Number after removing worst (should be >1)
boolean smplWnd, // // double smplRms, // = 0.1; // Maximal RMS of the remaining tiles in a sample
// boolean smplWnd, //
boolean null_if_none, boolean null_if_none,
int debugLevel) int debugLevel)
{ {
...@@ -706,15 +735,15 @@ public class MeasuredLayers { ...@@ -706,15 +735,15 @@ public class MeasuredLayers {
final int dbg_tile = ((stX == 22) && (stY == 19)) ? (5 + 7*16) : -1;// 50397; final int dbg_tile = ((stX == 22) && (stY == 19)) ? (5 + 7*16) : -1;// 50397;
int num_selected = 0; int num_selected = 0;
int smpl_center = smplSide /2; int smpl_center = mlfp.smplSide /2;
int st2e = st2 + smplSide; int st2e = st2 + mlfp.smplSide;
int smplLen = smplSide*smplSide; int smplLen = mlfp.smplSide*mlfp.smplSide;
final double [] smpl_weights = getSampleWindow(smplSide, !smplWnd); final double [] smpl_weights = getSampleWindow(mlfp.smplSide, !mlfp.smplWnd);
double [] disp = new double [st2e * st2e]; double [] disp = new double [st2e * st2e];
double [] weight = new double [st2e * st2e]; double [] weight = new double [st2e * st2e];
int st_halfe = st_half + smpl_center; int st_halfe = st_half + smpl_center;
double smplVar = smplRms * smplRms; // maximal variance (weighted average of the squared difference from the mean) double smplVar = mlfp.smplRms * mlfp.smplRms; // maximal variance (weighted average of the squared difference from the mean)
if (layers[num_layer] != null) { if (layers[num_layer] != null) {
...@@ -729,9 +758,9 @@ public class MeasuredLayers { ...@@ -729,9 +758,9 @@ public class MeasuredLayers {
if (layers[num_layer][indx] != null){ // apply sel_in later if (layers[num_layer][indx] != null){ // apply sel_in later
disp[indx_ste] = layers[num_layer][indx].getDisparity(); disp[indx_ste] = layers[num_layer][indx].getDisparity();
double w = layers[num_layer][indx].getStrength() - strength_floor; double w = layers[num_layer][indx].getStrength() - mlfp.strength_floor;
if (w > 0) { if (w > 0) {
if (strength_pow != 1.0) w = Math.pow(w, strength_pow); if (mlfp.strength_pow != 1.0) w = Math.pow(w, mlfp.strength_pow);
// w *= lapWeight[dy][dx]; // w *= lapWeight[dy][dx];
disp[indx_ste] = layers[num_layer][indx].getDisparity(); disp[indx_ste] = layers[num_layer][indx].getDisparity();
weight[indx_ste] = w; weight[indx_ste] = w;
...@@ -758,13 +787,13 @@ public class MeasuredLayers { ...@@ -758,13 +787,13 @@ public class MeasuredLayers {
boolean [] smpl_sel = new boolean [smplLen]; boolean [] smpl_sel = new boolean [smplLen];
double [] smpl_d = new double [smplLen]; double [] smpl_d = new double [smplLen];
double [] smpl_w = new double [smplLen]; double [] smpl_w = new double [smplLen];
for (int sy = 0; sy < smplSide; sy++){ for (int sy = 0; sy < mlfp.smplSide; sy++){
int y = dy + sy; // - smpl_center; int y = dy + sy; // - smpl_center;
for (int sx = 0; sx < smplSide; sx++){ for (int sx = 0; sx < mlfp.smplSide; sx++){
int x = dx + sx; // - smpl_center; int x = dx + sx; // - smpl_center;
int indxe = y * st2e + x; int indxe = y * st2e + x;
if (weight[indxe] > 0.0){ if (weight[indxe] > 0.0){
int indxs = sy * smplSide + sx; int indxs = sy * mlfp.smplSide + sx;
smpl_sel[indxs] = true; smpl_sel[indxs] = true;
smpl_d[indxs] = disp[indxe]; smpl_d[indxs] = disp[indxe];
smpl_w[indxs] = weight[indxe] * smpl_weights[indxs]; smpl_w[indxs] = weight[indxe] * smpl_weights[indxs];
...@@ -773,7 +802,7 @@ public class MeasuredLayers { ...@@ -773,7 +802,7 @@ public class MeasuredLayers {
} }
} }
} }
if (num_in_sample >= smplNum){ // try, remove worst if (num_in_sample >= mlfp.smplNum){ // try, remove worst
// calculate // calculate
double sd=0.0, sd2 = 0.0, sw = 0.0; double sd=0.0, sd2 = 0.0, sw = 0.0;
for (int i = 0; i < smplLen; i++) if (smpl_sel[i]) { for (int i = 0; i < smplLen; i++) if (smpl_sel[i]) {
...@@ -783,7 +812,7 @@ public class MeasuredLayers { ...@@ -783,7 +812,7 @@ public class MeasuredLayers {
sw += smpl_w[i]; sw += smpl_w[i];
} }
// remove worst, update sd2, sd and sw // remove worst, update sd2, sd and sw
while ((num_in_sample > smplNum) && (sw > 0)){ // try, remove worst while ((num_in_sample > mlfp.smplNum) && (sw > 0)){ // try, remove worst
double d_mean = sd/sw; double d_mean = sd/sw;
int iworst = -1; int iworst = -1;
double dworst2 = 0.0; double dworst2 = 0.0;
...@@ -889,20 +918,21 @@ public class MeasuredLayers { ...@@ -889,20 +918,21 @@ public class MeasuredLayers {
int stX, int stX,
int stY, int stY,
boolean [] sel_in, boolean [] sel_in,
double strength_floor, MeasuredLayersFilterParameters mlfp, // filter parameters
double strength_pow, // double strength_floor,
int smplSide, // = 2; // Sample size (side of a square) // double strength_pow,
int smplNum, // = 3; // Number after removing worst (should be >1) // int smplSide, // = 2; // Sample size (side of a square)
double smplRms, // = 0.1; // Maximal RMS of the remaining tiles in a sample // int smplNum, // = 3; // Number after removing worst (should be >1)
boolean smplWnd, // // double smplRms, // = 0.1; // Maximal RMS of the remaining tiles in a sample
// boolean smplWnd, //
double max_abs_tilt, // 2.0; // pix per tile
double max_rel_tilt, // 0.2; // (pix / disparity) per tile // double max_abs_tilt, // 2.0; // pix per tile
double damp_tilt, // 0.001; // Damp tilt to handle insufficient (co-linear)data // double max_rel_tilt, // 0.2; // (pix / disparity) per tile
double min_tilt_disp, // 4.0; // Disparity switch between filtering modes - near objects use tilts, far - use max disparity // double damp_tilt, // 0.001; // Damp tilt to handle insufficient (co-linear)data
double transition, // 1.0; // Mode transition range (between tilted and maximal disparity) // double min_tilt_disp, // 4.0; // Disparity switch between filtering modes - near objects use tilts, far - use max disparity
int far_mode, // 1; // Far objects filtering mode (0 - off, 1 - power of disparity) // double transition, // 1.0; // Mode transition range (between tilted and maximal disparity)
double far_power, // 3.0; // Raise disparity to this power before averaging for far objects // int far_mode, // 1; // Far objects filtering mode (0 - off, 1 - power of disparity)
// double far_power, // 3.0; // Raise disparity to this power before averaging for far objects
boolean null_if_none, boolean null_if_none,
int debugLevel) int debugLevel)
...@@ -916,19 +946,20 @@ public class MeasuredLayers { ...@@ -916,19 +946,20 @@ public class MeasuredLayers {
stY, // int stY, stY, // int stY,
sel_in, // boolean [] sel_in, sel_in, // boolean [] sel_in,
null, // double [] tiltXY, // null - free with limit on both absolute (2.0?) and relative (0.2) values null, // double [] tiltXY, // null - free with limit on both absolute (2.0?) and relative (0.2) values
strength_floor, // double strength_floor, mlfp, // MeasuredLayersFilterParameters mlfp, // filter parameters
strength_pow, // double strength_pow, // strength_floor, // double strength_floor,
smplSide, // int smplSide, // = 2; // Sample size (side of a square) // strength_pow, // double strength_pow,
smplNum, // int smplNum, // = 3; // Number after removing worst (should be >1) // smplSide, // int smplSide, // = 2; // Sample size (side of a square)
smplRms, // double smplRms, // = 0.1; // Maximal RMS of the remaining tiles in a sample // smplNum, // int smplNum, // = 3; // Number after removing worst (should be >1)
smplWnd, // boolean smplWnd, // // smplRms, // double smplRms, // = 0.1; // Maximal RMS of the remaining tiles in a sample
max_abs_tilt, // double max_abs_tilt, // = 2.0; // pix per tile // smplWnd, // boolean smplWnd, //
max_rel_tilt, // double max_rel_tilt, // = 0.2; // (pix / disparity) per tile // max_abs_tilt, // double max_abs_tilt, // = 2.0; // pix per tile
damp_tilt, // 0.001; // Damp tilt to handle insufficient (co-linear)data // max_rel_tilt, // double max_rel_tilt, // = 0.2; // (pix / disparity) per tile
min_tilt_disp, // 4.0; // Disparity switch between filtering modes - near objects use tilts, far - use max disparity // damp_tilt, // 0.001; // Damp tilt to handle insufficient (co-linear)data
transition, // 1.0; // Mode transition range (between tilted and maximal disparity) // min_tilt_disp, // 4.0; // Disparity switch between filtering modes - near objects use tilts, far - use max disparity
far_mode, // 1; // Far objects filtering mode (0 - off, 1 - power of disparity) // transition, // 1.0; // Mode transition range (between tilted and maximal disparity)
far_power, // 1.0; // Raise disparity to this power before averaging for far objects // far_mode, // 1; // Far objects filtering mode (0 - off, 1 - power of disparity)
// far_power, // 1.0; // Raise disparity to this power before averaging for far objects
null_if_none, // boolean null_if_none, null_if_none, // boolean null_if_none,
debugLevel); // int debugLevel) debugLevel); // int debugLevel)
} else { } else {
...@@ -938,12 +969,13 @@ public class MeasuredLayers { ...@@ -938,12 +969,13 @@ public class MeasuredLayers {
stY, // int stY, stY, // int stY,
sel_in, // boolean [] sel_in, sel_in, // boolean [] sel_in,
// null, // double [] tiltXY, // null - free with limit on both absolute (2.0?) and relative (0.2) values // null, // double [] tiltXY, // null - free with limit on both absolute (2.0?) and relative (0.2) values
strength_floor, // double strength_floor, mlfp, // MeasuredLayersFilterParameters mlfp, // filter parameters
strength_pow, // double strength_pow, // strength_floor, // double strength_floor,
smplSide, // int smplSide, // = 2; // Sample size (side of a square) // strength_pow, // double strength_pow,
smplNum, // int smplNum, // = 3; // Number after removing worst (should be >1) // smplSide, // int smplSide, // = 2; // Sample size (side of a square)
smplRms, // double smplRms, // = 0.1; // Maximal RMS of the remaining tiles in a sample // smplNum, // int smplNum, // = 3; // Number after removing worst (should be >1)
smplWnd, // boolean smplWnd, // // smplRms, // double smplRms, // = 0.1; // Maximal RMS of the remaining tiles in a sample
// smplWnd, // boolean smplWnd, //
// 2.0, // double max_abs_tilt, // = 2.0; // pix per tile // 2.0, // double max_abs_tilt, // = 2.0; // pix per tile
// 0.2, // double max_rel_tilt, // = 0.2; // (pix / disparity) per tile // 0.2, // double max_rel_tilt, // = 0.2; // (pix / disparity) per tile
null_if_none, // boolean null_if_none, null_if_none, // boolean null_if_none,
...@@ -965,19 +997,20 @@ public class MeasuredLayers { ...@@ -965,19 +997,20 @@ public class MeasuredLayers {
double [][] atiltXY, // null - free with limit on both absolute (2.0?) and relative (0.2) values double [][] atiltXY, // null - free with limit on both absolute (2.0?) and relative (0.2) values
// if it has just one element - apply to all tiles, otherwise it is supposed // if it has just one element - apply to all tiles, otherwise it is supposed
// to be per-tile of a supertile array // to be per-tile of a supertile array
double strength_floor, MeasuredLayersFilterParameters mlfp,
double strength_pow, // double strength_floor,
int smplSide, // = 3; // Sample size (side of a square) // double strength_pow,
int smplNum, // = 5; // Number after removing worst (should be >1) // int smplSide, // = 3; // Sample size (side of a square)
double smplRms, // = 0.3; // Maximal RMS of the remaining tiles in a sample // int smplNum, // = 5; // Number after removing worst (should be >1)
boolean smplWnd, // // double smplRms, // = 0.3; // Maximal RMS of the remaining tiles in a sample
double max_abs_tilt, // 2.0; // pix per tile // boolean smplWnd, //
double max_rel_tilt, // 0.2; // (pix / disparity) per tile // double max_abs_tilt, // 2.0; // pix per tile
double damp_tilt, // 0.001; // Damp tilt to handle insufficient (co-linear)data // double max_rel_tilt, // 0.2; // (pix / disparity) per tile
double min_tilt_disp, // 4.0; // Disparity switch between filtering modes - near objects use tilts, far - use max disparity // double damp_tilt, // 0.001; // Damp tilt to handle insufficient (co-linear)data
double transition, // 1.0; // Mode transition range (between tilted and maximal disparity) // double min_tilt_disp, // 4.0; // Disparity switch between filtering modes - near objects use tilts, far - use max disparity
int far_mode, // 1; // Far objects filtering mode (0 - off, 1 - power of disparity) // double transition, // 1.0; // Mode transition range (between tilted and maximal disparity)
double far_power, // 3.0; // Raise disparity to this power before averaging for far objects // int far_mode, // 1; // Far objects filtering mode (0 - off, 1 - power of disparity)
// double far_power, // 3.0; // Raise disparity to this power before averaging for far objects
boolean null_if_none, boolean null_if_none,
int debugLevel) int debugLevel)
{ {
...@@ -985,7 +1018,7 @@ public class MeasuredLayers { ...@@ -985,7 +1018,7 @@ public class MeasuredLayers {
if ((layers[num_layer] == null) && null_if_none){ if ((layers[num_layer] == null) && null_if_none){
return null; return null;
} }
final double [] damping = {damp_tilt, damp_tilt, 0.0}; // 0.0 will be applied to average value, tilt_cost - to both tilts final double [] damping = {mlfp.damp_tilt, mlfp.damp_tilt, 0.0}; // 0.0 will be applied to average value, tilt_cost - to both tilts
int st2 = 2 * superTileSize; int st2 = 2 * superTileSize;
int st_half = superTileSize/2; int st_half = superTileSize/2;
...@@ -993,26 +1026,26 @@ public class MeasuredLayers { ...@@ -993,26 +1026,26 @@ public class MeasuredLayers {
final int dbg_tile = ((stX == 22) && (stY == 19)) ? (5 + 7*16) : -1;// 50397; final int dbg_tile = ((stX == 22) && (stY == 19)) ? (5 + 7*16) : -1;// 50397;
int num_selected = 0; int num_selected = 0;
int smpl_center = smplSide /2; int smpl_center = mlfp.smplSide /2;
double smpl_dcenter = (smplSide -1.0) /2; double smpl_dcenter = (mlfp.smplSide -1.0) /2;
int st2e = st2 + smplSide; int st2e = st2 + mlfp.smplSide;
int smplLen = smplSide*smplSide; int smplLen = mlfp.smplSide*mlfp.smplSide;
final double [] smpl_weights = getSampleWindow(smplSide, !smplWnd); final double [] smpl_weights = getSampleWindow(mlfp.smplSide, !mlfp.smplWnd);
double [] disp = new double [st2e * st2e]; double [] disp = new double [st2e * st2e];
double [] weight = new double [st2e * st2e]; double [] weight = new double [st2e * st2e];
int st_halfe = st_half + smpl_center; int st_halfe = st_half + smpl_center;
double smplVar = smplRms * smplRms; // maximal variance (weighted average of the squared difference from the mean) double smplVar = mlfp.smplRms * mlfp.smplRms; // maximal variance (weighted average of the squared difference from the mean)
PolynomialApproximation pa = new PolynomialApproximation(); PolynomialApproximation pa = new PolynomialApproximation();
double thresholdLin = 1.0E-20; // threshold ratio of matrix determinant to norm for linear approximation (det too low - fail) double thresholdLin = 1.0E-20; // threshold ratio of matrix determinant to norm for linear approximation (det too low - fail)
double thresholdQuad = 1.0E-30; // threshold ratio of matrix determinant to norm for quadratic approximation (det too low - fail) double thresholdQuad = 1.0E-30; // threshold ratio of matrix determinant to norm for quadratic approximation (det too low - fail)
double disp_pwr_far = min_tilt_disp - transition/2.0; double disp_pwr_far = mlfp.min_tilt_disp - mlfp.transition/2.0;
double disp_pwr_near = min_tilt_disp + transition/2.0; double disp_pwr_near = mlfp.min_tilt_disp + mlfp.transition/2.0;
double disp_pwr_near2 = disp_pwr_near + smplRms; double disp_pwr_near2 = disp_pwr_near + mlfp.smplRms;
double [] disp_pwr = null; double [] disp_pwr = null;
boolean far_mode_en = (far_mode == 1) || (far_mode == 2); boolean far_mode_en = (mlfp.far_mode == 1) || (mlfp.far_mode == 2);
boolean remove_far_only = (far_mode == 2); boolean remove_far_only = (mlfp.far_mode == 2);
if (far_mode_en) { if (far_mode_en) {
disp_pwr = new double [st2e * st2e]; disp_pwr = new double [st2e * st2e];
} }
...@@ -1035,15 +1068,15 @@ public class MeasuredLayers { ...@@ -1035,15 +1068,15 @@ public class MeasuredLayers {
if (layers[num_layer][indx] != null){ // apply sel_in later if (layers[num_layer][indx] != null){ // apply sel_in later
disp[indx_ste] = layers[num_layer][indx].getDisparity(); disp[indx_ste] = layers[num_layer][indx].getDisparity();
double w = layers[num_layer][indx].getStrength() - strength_floor; double w = layers[num_layer][indx].getStrength() - mlfp.strength_floor;
if (w > 0) { if (w > 0) {
if (strength_pow != 1.0) w = Math.pow(w, strength_pow); if (mlfp.strength_pow != 1.0) w = Math.pow(w, mlfp.strength_pow);
// w *= lapWeight[dy][dx]; // w *= lapWeight[dy][dx];
disp[indx_ste] = layers[num_layer][indx].getDisparity(); // same? disp[indx_ste] = layers[num_layer][indx].getDisparity(); // same?
weight[indx_ste] = w; weight[indx_ste] = w;
num_selected ++; num_selected ++;
if (far_mode_en && (disp[indx_ste] < disp_pwr_near2) && (disp[indx_ste] > 0)) { if (far_mode_en && (disp[indx_ste] < disp_pwr_near2) && (disp[indx_ste] > 0)) {
disp_pwr[indx_ste] = Math.pow(disp[indx_ste], far_power); disp_pwr[indx_ste] = Math.pow(disp[indx_ste], mlfp.far_power);
num_far++; num_far++;
} }
} }
...@@ -1063,340 +1096,348 @@ public class MeasuredLayers { ...@@ -1063,340 +1096,348 @@ public class MeasuredLayers {
System.out.println("getDisparityStrengthML(): stX="+stX+" stY="+stY+" dx="+dx+" dy="+dy); System.out.println("getDisparityStrengthML(): stX="+stX+" stY="+stY+" dx="+dx+" dy="+dy);
} }
if (((sel_in == null) || sel_in[indx])){ if (((sel_in == null) || sel_in[indx])){
int num_in_sample = 0; // check if it need filtering
double sum_wnd = 0.0; int indxe_center = (dy + smpl_center)*st2e + (dx + smpl_center);
boolean [] smpl_sel = new boolean [smplLen]; if (weight[indxe_center] >= mlfp.strength_sure) { // tile does not need filtering
double [] smpl_d = new double [smplLen]; ds[0][indx] = disp[indxe_center];
double [] smpl_p = new double [smplLen]; ds[1][indx] = weight[indxe_center];
double [] smpl_w = new double [smplLen];
if (far_mode_en ) { } else {
smpl_far_sel = new boolean [smplLen]; int num_in_sample = 0;
smpl_pwr_d = new double [smplLen]; double sum_wnd = 0.0;
smpl_far_w = new double [smplLen]; boolean [] smpl_sel = new boolean [smplLen];
num_in_sample_far = 0; double [] smpl_d = new double [smplLen];
} double [] smpl_p = new double [smplLen];
for (int sy = 0; sy < smplSide; sy++){ double [] smpl_w = new double [smplLen];
int y = dy + sy; // - smpl_center; if (far_mode_en ) {
for (int sx = 0; sx < smplSide; sx++){ smpl_far_sel = new boolean [smplLen];
int x = dx + sx; // - smpl_center; smpl_pwr_d = new double [smplLen];
int indxe = y * st2e + x; smpl_far_w = new double [smplLen];
if (weight[indxe] > 0.0){ num_in_sample_far = 0;
int indxs = sy * smplSide + sx; }
smpl_sel[indxs] = true; for (int sy = 0; sy < mlfp.smplSide; sy++){
smpl_d[indxs] = disp[indxe]; int y = dy + sy; // - smpl_center;
smpl_w[indxs] = weight[indxe] * smpl_weights[indxs]; for (int sx = 0; sx < mlfp.smplSide; sx++){
sum_wnd += smpl_weights[indxs]; int x = dx + sx; // - smpl_center;
num_in_sample ++; int indxe = y * st2e + x;
if (far_mode_en && (disp_pwr[indxe]>0.0)) { if (weight[indxe] > 0.0){
smpl_far_sel[indxs] = true; int indxs = sy * mlfp.smplSide + sx;
smpl_pwr_d[indxs] = disp_pwr[indxe]; smpl_sel[indxs] = true;
smpl_far_w[indxs] = smpl_w[indxs]; smpl_d[indxs] = disp[indxe];
num_in_sample_far++; smpl_w[indxs] = weight[indxe] * smpl_weights[indxs];
sum_wnd += smpl_weights[indxs];
num_in_sample ++;
if (far_mode_en && (disp_pwr[indxe]>0.0)) {
smpl_far_sel[indxs] = true;
smpl_pwr_d[indxs] = disp_pwr[indxe];
smpl_far_w[indxs] = smpl_w[indxs];
num_in_sample_far++;
}
} }
} }
} }
} if (far_mode_en ) {
if (far_mode_en ) { smpl_far_d = smpl_d.clone();
smpl_far_d = smpl_d.clone();
}
if (num_in_sample >= smplNum){ // try, remove worst
sample_loop:
{
boolean en_tilt = (atiltXY == null);
if (en_tilt) { // make sure there are enough samples and not all of them are on the same line
if ((damp_tilt == 0.0) && !notColinear(smpl_sel,smplSide)){
en_tilt = false;
}
} }
if (en_tilt) { // enable floating tilt if (num_in_sample >= mlfp.smplNum){ // try, remove worst
double sd2 = 0.0, d_center = 0.0, sw = 0.0; sample_loop:
{
// TODO: making simple - recalculate after removing. Can be done more efficient. boolean en_tilt = (atiltXY == null);
while (num_in_sample >= smplNum) { // try, remove worst if (en_tilt) { // make sure there are enough samples and not all of them are on the same line
sd2 = 0.0; if ((mlfp.damp_tilt == 0.0) && !notColinear(smpl_sel, mlfp.smplSide)){
d_center = 0.0; en_tilt = false;
sw = 0.0; }
}
double [][][] mdata = new double [num_in_sample][3][]; if (en_tilt) { // enable floating tilt
int mindx = 0; double sd2 = 0.0, d_center = 0.0, sw = 0.0;
for (int sy = 0; sy < smplSide; sy++){
for (int sx = 0; sx < smplSide; sx++){ // TODO: making simple - recalculate after removing. Can be done more efficient.
int indxs = sy * smplSide + sx; while (num_in_sample >= mlfp.smplNum) { // try, remove worst
if (smpl_sel[indxs]) { sd2 = 0.0;
mdata[mindx][0] = new double [2]; d_center = 0.0;
mdata[mindx][0][0] = sx - smpl_dcenter; sw = 0.0;
mdata[mindx][0][1] = sy - smpl_dcenter;
mdata[mindx][1] = new double [1]; double [][][] mdata = new double [num_in_sample][3][];
mdata[mindx][1][0] = smpl_d[indxs]; int mindx = 0;
mdata[mindx][2] = new double [1]; for (int sy = 0; sy < mlfp.smplSide; sy++){
mdata[mindx][2][0] = smpl_w[indxs]; for (int sx = 0; sx < mlfp.smplSide; sx++){
mindx ++; int indxs = sy * mlfp.smplSide + sx;
if (smpl_sel[indxs]) {
mdata[mindx][0] = new double [2];
mdata[mindx][0][0] = sx - smpl_dcenter;
mdata[mindx][0][1] = sy - smpl_dcenter;
mdata[mindx][1] = new double [1];
mdata[mindx][1][0] = smpl_d[indxs];
mdata[mindx][2] = new double [1];
mdata[mindx][2][0] = smpl_w[indxs];
mindx ++;
}
} }
} }
} double[][] approx2d = pa.quadraticApproximation(
double[][] approx2d = pa.quadraticApproximation( mdata,
mdata, true, // boolean forceLinear, // use linear approximation
true, // boolean forceLinear, // use linear approximation damping, // double [] damping,
damping, // double [] damping, thresholdLin, // threshold ratio of matrix determinant to norm for linear approximation (det too low - fail)
thresholdLin, // threshold ratio of matrix determinant to norm for linear approximation (det too low - fail) thresholdQuad, // threshold ratio of matrix determinant to norm for quadratic approximation (det too low - fail)
thresholdQuad, // threshold ratio of matrix determinant to norm for quadratic approximation (det too low - fail) debugLevel);
debugLevel); if (approx2d == null){
if (approx2d == null){ if (debugLevel > -1){
if (debugLevel > -1){ System.out.println("getDisparityStrengthML(): can not find linear approximation");
System.out.println("getDisparityStrengthML(): can not find linear approximation"); }
break sample_loop;
} }
break sample_loop; // limit tilt to be within range
} // double max_abs_tilt, // = 2.0; // pix per tile
// limit tilt to be within range // double max_rel_tilt, // = 0.2; // (pix / disparity) per tile
// double max_abs_tilt, // = 2.0; // pix per tile double max_tilt = Math.min(mlfp.max_abs_tilt, mlfp.max_rel_tilt * approx2d[0][2]);
// double max_rel_tilt, // = 0.2; // (pix / disparity) per tile boolean overlimit = (Math.abs(approx2d[0][0]) > max_tilt) || (Math.abs(approx2d[0][1]) > max_tilt);
double max_tilt = Math.min(max_abs_tilt, max_rel_tilt * approx2d[0][2]); if (overlimit) {
boolean overlimit = (Math.abs(approx2d[0][0]) > max_tilt) || (Math.abs(approx2d[0][1]) > max_tilt); approx2d[0][0] = Math.min(approx2d[0][0], max_tilt);
if (overlimit) { approx2d[0][1] = Math.min(approx2d[0][1], max_tilt);
approx2d[0][0] = Math.min(approx2d[0][0], max_tilt); approx2d[0][0] = Math.max(approx2d[0][0], -max_tilt);
approx2d[0][1] = Math.min(approx2d[0][1], max_tilt); approx2d[0][1] = Math.max(approx2d[0][1], -max_tilt);
approx2d[0][0] = Math.max(approx2d[0][0], -max_tilt); }
approx2d[0][1] = Math.max(approx2d[0][1], -max_tilt); // subtract tilt from disparity
} for (int sy = 0; sy < mlfp.smplSide; sy++){
// subtract tilt from disparity for (int sx = 0; sx < mlfp.smplSide; sx++){
for (int sy = 0; sy < smplSide; sy++){ int indxs = sy * mlfp.smplSide + sx;
for (int sx = 0; sx < smplSide; sx++){ if (smpl_sel[indxs]) {
int indxs = sy * smplSide + sx; smpl_p[indxs] = approx2d[0][0] * (sx - smpl_dcenter) + approx2d[0][1] * (sy - smpl_dcenter) + approx2d[0][2];
if (smpl_sel[indxs]) { }
smpl_p[indxs] = approx2d[0][0] * (sx - smpl_dcenter) + approx2d[0][1] * (sy - smpl_dcenter) + approx2d[0][2];
} }
} }
}
if (overlimit){ // re-calculate disparity average (in the center) if (overlimit){ // re-calculate disparity average (in the center)
double sd=0.0; double sd=0.0;
for (int indxs = 0; indxs < smplLen;indxs++) if (smpl_sel[indxs]) {
double d = smpl_d[indxs] - smpl_p[indxs];
double dw = d * smpl_w[indxs];
sd += dw;
sw += smpl_w[indxs];
}
sd /= sw;
for (int indxs = 0; indxs < smplLen;indxs++) if (smpl_sel[indxs]) {
smpl_p[indxs] += sd;
}
approx2d[0][2] += sd;
}
d_center = approx2d[0][2];
sw = 0.0;
for (int indxs = 0; indxs < smplLen;indxs++) if (smpl_sel[indxs]) { for (int indxs = 0; indxs < smplLen;indxs++) if (smpl_sel[indxs]) {
double d = smpl_d[indxs] - smpl_p[indxs]; double d = smpl_d[indxs] - smpl_p[indxs];
double dw = d * smpl_w[indxs]; double dw = d * smpl_w[indxs];
sd += dw; // sd += dw;
sw += smpl_w[indxs]; sd2 += dw * smpl_d[indxs];
sw += smpl_w[indxs];
} }
sd /= sw;
for (int indxs = 0; indxs < smplLen;indxs++) if (smpl_sel[indxs]) {
smpl_p[indxs] += sd; // remove worst - it should not make remaining set
if (num_in_sample > mlfp.smplNum) { // remove worst if it is not the last run where only calculations are needed
// double d_mean = sd/sw;
int iworst = -1;
double dworst2 = 0.0;
for (int indxs = 0; indxs < smplLen; indxs++) if (smpl_sel[indxs]) {
// double d2 = (smpl_d[i] - d_mean);
double d2 = smpl_d[indxs] - smpl_p[indxs];
d2 *=d2;
if (d2 > dworst2) {
if ((mlfp.damp_tilt !=0.0) || notColinearWithout (
indxs, // int indx,
smpl_sel, // boolean [] sel,
mlfp.smplSide)) { // int side))
iworst = indxs;
dworst2 = d2;
}
}
}
if (iworst < 0){
if (debugLevel > 0) {
System.out.println("**** this may be BUG in getDisparityStrengthML() can not find the worst sample - all tiles fit perfectly ****");
}
// this can happen if some samples are the same and all the pixels fit exactly - use all of them
break;
}
// remove worst sample
smpl_sel[iworst] = false;
// double dw = smpl_d[iworst] * smpl_w[iworst];
// sd -= dw;
// sd2 -= dw * smpl_d[iworst];
// sw -= smpl_w[iworst];
sum_wnd -= smpl_weights[iworst];
num_in_sample --;
} else {
break;
}
} // removing worst tiles, all done,
// calculate variance of the remaining set
if (sw > 0.0) {
// sd /= sw;
// sd2 /= sw;
double var = sd2/sw; // - sd * sd;
if (var < smplVar) { // good, save in the result array
ds[0][indx] = d_center;
// ds[1][indx] = sw * lapWeight[dy][dx] /num_in_sample; // average weights, multiply by window //** TODO: change
ds[1][indx] = sw * lapWeight[dy][dx] /sum_wnd; // average weights, multiply by window //** TODO: change
} }
approx2d[0][2] += sd;
} }
d_center = approx2d[0][2];
sw = 0.0; } else { // fixed tilt
for (int indxs = 0; indxs < smplLen;indxs++) if (smpl_sel[indxs]) { // tilt around center
double d = smpl_d[indxs] - smpl_p[indxs]; double [] tiltXY= {0.0,0.0};
double dw = d * smpl_w[indxs]; if (atiltXY != null){ // if null ( free but failed co-linear test - keep both tilts == 0.0
// sd += dw; if (atiltXY.length == 1){
sd2 += dw * smpl_d[indxs]; tiltXY = atiltXY[0]; // common for all tiles (such as constant disparity)
sw += smpl_w[indxs]; } else if (atiltXY[indx] != null){
tiltXY = atiltXY[indx];
}
} }
if ((tiltXY != null) && (tiltXY[0] != 0.0) && (tiltXY[1] != 0.0)){
for (int sy = 0; sy < mlfp.smplSide; sy++){
for (int sx = 0; sx < mlfp.smplSide; sx++){
int indxs = sy * mlfp.smplSide + sx;
if (smpl_w[indxs] > 0.0) {
smpl_d[indxs] -= tiltXY[0]* (sx - smpl_dcenter) + tiltXY[1]* (sy - smpl_dcenter);
}
}
}
}
// remove worst - it should not make remaining set
if (num_in_sample > smplNum) { // remove worst if it is not the last run where only calculations are needed // calculate
// double d_mean = sd/sw; double sd=0.0, sd2 = 0.0, sw = 0.0;
for (int i = 0; i < smplLen; i++) if (smpl_sel[i]) {
double dw = smpl_d[i] * smpl_w[i];
sd += dw;
sd2 += dw * smpl_d[i];
sw += smpl_w[i];
}
// remove worst, update sd2, sd and sw
while ((num_in_sample > mlfp.smplNum) && (sw > 0)){ // try, remove worst
double d_mean = sd/sw;
int iworst = -1; int iworst = -1;
double dworst2 = 0.0; double dworst2 = 0.0;
for (int indxs = 0; indxs < smplLen; indxs++) if (smpl_sel[indxs]) { for (int i = 0; i < smplLen; i++) if (smpl_sel[i]) {
// double d2 = (smpl_d[i] - d_mean); double d2 = (smpl_d[i] - d_mean);
double d2 = smpl_d[indxs] - smpl_p[indxs];
d2 *=d2; d2 *=d2;
if (d2 > dworst2) { if (d2 > dworst2) {
if ((damp_tilt !=0.0) || notColinearWithout ( iworst = i;
indxs, // int indx, dworst2 = d2;
smpl_sel, // boolean [] sel,
smplSide)) { // int side))
iworst = indxs;
dworst2 = d2;
}
} }
//remove_far_only
} }
if (iworst < 0){ if (iworst < 0){
if (debugLevel > 0) { System.out.println("**** this is a BUG2 in getDisparityStrengthML() ****");
System.out.println("**** this may be BUG in getDisparityStrengthML() can not find the worst sample - all tiles fit perfectly ****");
}
// this can happen if some samples are the same and all the pixels fit exactly - use all of them
break; break;
} }
// remove worst sample // remove worst sample
smpl_sel[iworst] = false; smpl_sel[iworst] = false;
// double dw = smpl_d[iworst] * smpl_w[iworst]; double dw = smpl_d[iworst] * smpl_w[iworst];
// sd -= dw; sd -= dw;
// sd2 -= dw * smpl_d[iworst]; sd2 -= dw * smpl_d[iworst];
// sw -= smpl_w[iworst]; sw -= smpl_w[iworst];
sum_wnd -= smpl_weights[iworst]; sum_wnd -= smpl_weights[iworst];
num_in_sample --; num_in_sample --;
} else {
break;
} }
// calculate variance of the remaining set
} // removing worst tiles, all done, if (sw > 0.0) {
// calculate variance of the remaining set sd /= sw;
if (sw > 0.0) { sd2 /= sw;
// sd /= sw; double var = sd2 - sd * sd;
// sd2 /= sw; if (var < smplVar) { // good, save in the result array
double var = sd2/sw; // - sd * sd; ds[0][indx] = sd;
if (var < smplVar) { // good, save in the result array // ds[1][indx] = sw * lapWeight[dy][dx] /num_in_sample; // average weights, multiply by window //** TODO: change
ds[0][indx] = d_center; ds[1][indx] = sw * lapWeight[dy][dx] /sum_wnd; // average weights, multiply by window //** TODO: change
// ds[1][indx] = sw * lapWeight[dy][dx] /num_in_sample; // average weights, multiply by window //** TODO: change }
ds[1][indx] = sw * lapWeight[dy][dx] /sum_wnd; // average weights, multiply by window //** TODO: change } else {
num_in_sample = 0;
System.out.println("**** this is a BUG in getDisparityStrengthML(), shoud not happen ? ****");
} }
} }
} else { // fixed tilt
// tilt around center
double [] tiltXY= {0.0,0.0};
if (atiltXY != null){ // if null ( free but failed co-linear test - keep both tilts == 0.0
if (atiltXY.length == 1){
tiltXY = atiltXY[0]; // common for all tiles (such as constant disparity)
} else if (atiltXY[indx] != null){
tiltXY = atiltXY[indx];
}
} }
}
if ((tiltXY != null) && (tiltXY[0] != 0.0) && (tiltXY[1] != 0.0)){ // now apply far if needed
for (int sy = 0; sy < smplSide; sy++){ if (num_in_sample_far > 0) { // calculate small far disparity, then merge with normal one
for (int sx = 0; sx < smplSide; sx++){ // remove extra
int indxs = sy * smplSide + sx; // smpl_pwr_d - disparity to power
if (smpl_w[indxs] > 0.0) { // smpl_far_d - just disparity
smpl_d[indxs] -= tiltXY[0]* (sx - smpl_dcenter) + tiltXY[1]* (sy - smpl_dcenter); if (num_in_sample_far >= mlfp.smplNum){ // try, remove worst
} double sd=0.0, sd2 = 0.0, sw = 0.0;
} double sdp =0.0; // , sdp2 = 0.0;
for (int i = 0; i < smplLen; i++) if (smpl_far_sel[i]) {
double dw = smpl_far_d[i] * smpl_far_w[i];
sd += dw;
sd2 += dw * smpl_far_d[i];
sw += smpl_far_w[i];
double dpw = smpl_pwr_d[i] * smpl_far_w[i];
sdp += dpw;
// sdp2 += dpw * smpl_pwr_d[i];
} }
}
// calculate // remove worst (before power), update sd2, sd and sw
double sd=0.0, sd2 = 0.0, sw = 0.0; while ((num_in_sample_far > mlfp.smplNum) && (sw > 0)){ // try, remove worst
for (int i = 0; i < smplLen; i++) if (smpl_sel[i]) { double d_mean = sd/sw;
double dw = smpl_d[i] * smpl_w[i]; int iworst = -1;
sd += dw; double dworst2 = 0.0;
sd2 += dw * smpl_d[i]; for (int i = 0; i < smplLen; i++) if (smpl_far_sel[i]) {
sw += smpl_w[i]; double d2 = (smpl_far_d[i] - d_mean);
} d2 *=d2;
// remove worst, update sd2, sd and sw if ((d2 > dworst2) && (!remove_far_only ||(smpl_far_d[i] < d_mean))) {
while ((num_in_sample > smplNum) && (sw > 0)){ // try, remove worst iworst = i;
double d_mean = sd/sw; dworst2 = d2;
int iworst = -1; }
double dworst2 = 0.0;
for (int i = 0; i < smplLen; i++) if (smpl_sel[i]) {
double d2 = (smpl_d[i] - d_mean);
d2 *=d2;
if (d2 > dworst2) {
iworst = i;
dworst2 = d2;
} }
//remove_far_only if (iworst < 0){
} System.out.println("**** this is a BUG3 in getDisparityStrengthML() ****");
if (iworst < 0){ break;
System.out.println("**** this is a BUG2 in getDisparityStrengthML() ****"); }
break; // remove worst sample
} smpl_far_sel[iworst] = false;
// remove worst sample double dw = smpl_far_d[iworst] * smpl_far_w[iworst];
smpl_sel[iworst] = false; sd -= dw;
double dw = smpl_d[iworst] * smpl_w[iworst]; sd2 -= dw * smpl_far_d[iworst];
sd -= dw; sw -= smpl_far_w[iworst];
sd2 -= dw * smpl_d[iworst]; sum_wnd -= smpl_weights[iworst];
sw -= smpl_w[iworst]; num_in_sample_far --;
sum_wnd -= smpl_weights[iworst];
num_in_sample --;
}
// calculate variance of the remaining set
if (sw > 0.0) {
sd /= sw;
sd2 /= sw;
double var = sd2 - sd * sd;
if (var < smplVar) { // good, save in the result array
ds[0][indx] = sd;
// ds[1][indx] = sw * lapWeight[dy][dx] /num_in_sample; // average weights, multiply by window //** TODO: change
ds[1][indx] = sw * lapWeight[dy][dx] /sum_wnd; // average weights, multiply by window //** TODO: change
}
} else {
num_in_sample = 0;
System.out.println("**** this is a BUG in getDisparityStrengthML(), shoud not happen ? ****");
}
}
}
}
// now apply far if needed
if (num_in_sample_far > 0) { // calculate small far disparity, then merge with normal one
// remove extra
// smpl_pwr_d - disparity to power
// smpl_far_d - just disparity
if (num_in_sample_far >= smplNum){ // try, remove worst
double sd=0.0, sd2 = 0.0, sw = 0.0;
double sdp =0.0; // , sdp2 = 0.0;
for (int i = 0; i < smplLen; i++) if (smpl_far_sel[i]) {
double dw = smpl_far_d[i] * smpl_far_w[i];
sd += dw;
sd2 += dw * smpl_far_d[i];
sw += smpl_far_w[i];
double dpw = smpl_pwr_d[i] * smpl_far_w[i];
sdp += dpw;
// sdp2 += dpw * smpl_pwr_d[i];
}
// Remove from the power average too
// remove worst (before power), update sd2, sd and sw sdp -= smpl_pwr_d[iworst] * smpl_far_w[iworst];
while ((num_in_sample_far > smplNum) && (sw > 0)){ // try, remove worst
double d_mean = sd/sw;
int iworst = -1;
double dworst2 = 0.0;
for (int i = 0; i < smplLen; i++) if (smpl_far_sel[i]) {
double d2 = (smpl_far_d[i] - d_mean);
d2 *=d2;
if ((d2 > dworst2) && (!remove_far_only ||(smpl_far_d[i] < d_mean))) {
iworst = i;
dworst2 = d2;
}
}
if (iworst < 0){
System.out.println("**** this is a BUG3 in getDisparityStrengthML() ****");
break;
} }
// remove worst sample // calculate variance of the remaining set
smpl_far_sel[iworst] = false; if (sw > 0.0) {
double dw = smpl_far_d[iworst] * smpl_far_w[iworst]; sd /= sw;
sd -= dw; sd2 /= sw;
sd2 -= dw * smpl_far_d[iworst]; double var = sd2 - sd * sd;
sw -= smpl_far_w[iworst]; if (var < smplVar) { // good, save in the result array (here use linear disparity
sum_wnd -= smpl_weights[iworst]; // here need to combine two filtering modes - "tilted" and "far"
num_in_sample_far --; sdp = Math.pow(sdp/sw, 1.0/mlfp.far_power);
if (sdp < disp_pwr_near) { // otherwise keep tilted mode result
// Remove from the power average too double far_w = sw * lapWeight[dy][dx] /sum_wnd; // average weights, multiply by window //** TODO: change
if (sdp < disp_pwr_far) {
sdp -= smpl_pwr_d[iworst] * smpl_far_w[iworst]; ds[0][indx] = sdp;
} ds[1][indx] = far_w;
// calculate variance of the remaining set } else { // interpolate
if (sw > 0.0) { double k = (sdp - disp_pwr_far) / mlfp.transition;
sd /= sw; ds[0][indx] = (1.0 - k) * sdp + k * ds[0][indx];
sd2 /= sw; ds[1][indx] = (1.0 - k) * far_w + k * ds[1][indx];
double var = sd2 - sd * sd; }
if (var < smplVar) { // good, save in the result array (here use linear disparity
// here need to combine two filtering modes - "tilted" and "far"
sdp = Math.pow(sdp/sw, 1.0/far_power);
if (sdp < disp_pwr_near) { // otherwise keep tilted mode result
double far_w = sw * lapWeight[dy][dx] /sum_wnd; // average weights, multiply by window //** TODO: change
if (sdp < disp_pwr_far) {
ds[0][indx] = sdp;
ds[1][indx] = far_w;
} else { // interpolate
double k = (sdp - disp_pwr_far) / transition;
ds[0][indx] = (1.0 - k) * sdp + k * ds[0][indx];
ds[1][indx] = (1.0 - k) * far_w + k * ds[1][indx];
} }
ds[0][indx] = sd;
ds[1][indx] = sw * lapWeight[dy][dx] /sum_wnd; // average weights, multiply by window //** TODO: change
} }
ds[0][indx] = sd; } else {
ds[1][indx] = sw * lapWeight[dy][dx] /sum_wnd; // average weights, multiply by window //** TODO: change num_in_sample = 0;
System.out.println("**** this is a BUG4 in getDisparityStrengthML(), shoud not happen ? ****");
} }
} else {
num_in_sample = 0;
System.out.println("**** this is a BUG4 in getDisparityStrengthML(), shoud not happen ? ****");
} }
} }
} }
} } // end of tile
} }
} }
return ds; return ds;
......
import java.util.Properties;
/**
**
** MeasuredLayersFilterParameters - parameters defining tile filters
**
** Copyright (C) 2018 Elphel, Inc.
**
** -----------------------------------------------------------------------------**
**
** ImageDtt.java is free software: you can redistribute it and/or modify
** it under the terms of the GNU General Public License as published by
** the Free Software Foundation, either version 3 of the License, or
** (at your option) any later version.
**
** This program is distributed in the hope that it will be useful,
** but WITHOUT ANY WARRANTY; without even the implied warranty of
** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
** GNU General Public License for more details.
**
** You should have received a copy of the GNU General Public License
** along with this program. If not, see <http://www.gnu.org/licenses/>.
** -----------------------------------------------------------------------------**
**
*/
public class MeasuredLayersFilterParameters {
public double strength_sure = 0.25; // Do not filter disparity above this strength
public double strength_floor = 0.1; // Subtract from strength, discard negative
public double strength_pow = 1.0; // raise strength to this power
public int smplSide = 3; // Sample size (side of a square)
public int smplNum = 5; // Number after removing worst
public double smplRms = 0.3; // Maximal RMS of the remaining tiles in a sample
public boolean smplWnd = false; // Use window function for the samples (TODO: change default to true after testing)
public double max_abs_tilt = 2.0; // Maximal absolute tilt in pixels/tile
public double max_rel_tilt = 0.2; // Maximal relative tilt in pixels/tile/disparity
public double damp_tilt = 0.001; // Tilt cost for damping insufficient plane data
public double min_tilt_disp = 4.0; // Disparity switch between filtering modes - near objects use tilts, far - use max disparity
public double transition = 1.0; // Mode transition range (between tilted and maximal disparity)
public int far_mode = 1; // Far objects filtering mode (0 - off, 1 - power of disparity)
public double far_power = 3.0; // Raise disparity to this power before averaging for far objects
public void setProperties(String prefix,Properties properties){
properties.setProperty(prefix+"strength_sure", this.strength_sure +"");
properties.setProperty(prefix+"strength_floor", this.strength_floor +"");
properties.setProperty(prefix+"strength_pow", this.strength_pow +"");
properties.setProperty(prefix+"smplSide", this.smplSide+"");
properties.setProperty(prefix+"smplNum", this.smplNum+"");
properties.setProperty(prefix+"smplRms", this.smplRms +"");
properties.setProperty(prefix+"smplWnd", this.smplWnd+"");
properties.setProperty(prefix+"max_abs_tilt", this.max_abs_tilt+"");
properties.setProperty(prefix+"max_rel_tilt", this.max_rel_tilt+"");
properties.setProperty(prefix+"damp_tilt", this.damp_tilt+"");
properties.setProperty(prefix+"min_tilt_disp", this.min_tilt_disp+"");
properties.setProperty(prefix+"transition", this.transition+"");
properties.setProperty(prefix+"far_mode", this.far_mode+"");
properties.setProperty(prefix+"far_power", this.far_power+"");
}
public void getProperties(String prefix,Properties properties){
if (properties.getProperty(prefix+"strength_sure")!=null) this.strength_sure=Double.parseDouble(properties.getProperty(prefix+"strength_sure"));
if (properties.getProperty(prefix+"strength_floor")!=null) this.strength_floor=Double.parseDouble(properties.getProperty(prefix+"strength_floor"));
if (properties.getProperty(prefix+"strength_pow")!=null) this.strength_pow=Double.parseDouble(properties.getProperty(prefix+"strength_pow"));
if (properties.getProperty(prefix+"smplSide")!=null) this.smplSide=Integer.parseInt(properties.getProperty(prefix+"smplSide"));
if (properties.getProperty(prefix+"smplNum")!=null) this.smplNum=Integer.parseInt(properties.getProperty(prefix+"smplNum"));
if (properties.getProperty(prefix+"smplRms")!=null) this.smplRms=Double.parseDouble(properties.getProperty(prefix+"smplRms"));
if (properties.getProperty(prefix+"smplWnd")!=null) this.smplWnd=Boolean.parseBoolean(properties.getProperty(prefix+"smplWnd"));
if (properties.getProperty(prefix+"max_abs_tilt")!=null) this.max_abs_tilt=Double.parseDouble(properties.getProperty(prefix+"max_abs_tilt"));
if (properties.getProperty(prefix+"max_rel_tilt")!=null) this.max_rel_tilt=Double.parseDouble(properties.getProperty(prefix+"max_rel_tilt"));
if (properties.getProperty(prefix+"damp_tilt")!=null) this.damp_tilt=Double.parseDouble(properties.getProperty(prefix+"damp_tilt"));
if (properties.getProperty(prefix+"min_tilt_disp")!=null) this.min_tilt_disp=Double.parseDouble(properties.getProperty(prefix+"min_tilt_disp"));
if (properties.getProperty(prefix+"transition")!=null) this.transition=Double.parseDouble(properties.getProperty(prefix+"transition"));
if (properties.getProperty(prefix+"far_mode")!=null) this.far_mode=Integer.parseInt(properties.getProperty(prefix+"far_mode"));
if (properties.getProperty(prefix+"far_power")!=null) this.far_power=Double.parseDouble(properties.getProperty(prefix+"far_power"));
}
@Override
public MeasuredLayersFilterParameters clone() {
MeasuredLayersFilterParameters mlfp = new MeasuredLayersFilterParameters();
mlfp.strength_sure = this.strength_sure;
mlfp.strength_floor = this.strength_floor;
mlfp.strength_pow = this.strength_pow;
mlfp.smplSide = this.smplSide;
mlfp.smplNum = this.smplNum;
mlfp.smplRms = this.smplRms;
mlfp.smplWnd = this.smplWnd;
mlfp.max_abs_tilt = this.max_abs_tilt;
mlfp.max_rel_tilt = this.max_rel_tilt;
mlfp.damp_tilt = this.damp_tilt;
mlfp.min_tilt_disp = this.min_tilt_disp;
mlfp.transition = this.transition;
mlfp.far_mode = this.far_mode;
mlfp.far_power = this.far_power;
return mlfp;
}
public boolean equals(MeasuredLayersFilterParameters mlfp) {
return
(mlfp.strength_sure == this.strength_sure ) &&
(mlfp.strength_floor == this.strength_floor ) &&
(mlfp.strength_pow == this.strength_pow ) &&
(mlfp.smplSide == this.smplSide ) &&
(mlfp.smplNum == this.smplNum ) &&
(mlfp.smplRms == this.smplRms ) &&
(mlfp.smplWnd == this.smplWnd ) &&
(mlfp.max_abs_tilt == this.max_abs_tilt ) &&
(mlfp.max_rel_tilt == this.max_rel_tilt ) &&
(mlfp.damp_tilt == this.damp_tilt ) &&
(mlfp.min_tilt_disp == this.min_tilt_disp ) &&
(mlfp.transition == this.transition ) &&
(mlfp.far_mode == this.far_mode ) &&
(mlfp.far_power == this.far_power);
}
}
...@@ -76,12 +76,12 @@ public class PolynomialApproximation { ...@@ -76,12 +76,12 @@ public class PolynomialApproximation {
M.solve(B).print(10, 12); M.solve(B).print(10, 12);
} }
double []result=new double [N+1]; double []result=new double [N+1];
for (int i=0;i<=N;i++) result[i]=(i<=N1)?aR[i][0]:0.0; for (int i=0;i<=N;i++) result[i]=(i<=N1)?aR[i][0]:0.0;
return result; return result;
} }
/** /**
* Linear approximates each of 3 functions of 3 variables and finds where they are all zero * Linear approximates each of 3 functions of 3 variables and finds where they are all zero
* @param data: for each sample (1-st index): * @param data: for each sample (1-st index):
* 0 - {x,y,z} * 0 - {x,y,z}
* 1 - {f1, f2, f3}, * 1 - {f1, f2, f3},
...@@ -91,7 +91,7 @@ public class PolynomialApproximation { ...@@ -91,7 +91,7 @@ public class PolynomialApproximation {
public double [] linear3d(double [][][] data){ public double [] linear3d(double [][][] data){
/* /*
* Approximating each of the 3 measured parameters (Far/near, tilt x and tilt y) with linear approximation in the vicinity of the last position * Approximating each of the 3 measured parameters (Far/near, tilt x and tilt y) with linear approximation in the vicinity of the last position
* For each parameter F(x,y,z)=A*x + B*y +C*z + D, using Gaussian weight function with sigma= motorsSigma * For each parameter F(x,y,z)=A*x + B*y +C*z + D, using Gaussian weight function with sigma= motorsSigma
*/ */
double [][] aM3=new double [3][3]; double [][] aM3=new double [3][3];
double [][] aB3=new double [3][1]; double [][] aB3=new double [3][1];
...@@ -164,7 +164,7 @@ public class PolynomialApproximation { ...@@ -164,7 +164,7 @@ public class PolynomialApproximation {
} }
return result; return result;
} }
public double[] quadraticMax2d (double [][][] data){ public double[] quadraticMax2d (double [][][] data){
...@@ -196,6 +196,31 @@ public class PolynomialApproximation { ...@@ -196,6 +196,31 @@ public class PolynomialApproximation {
return xy; return xy;
} }
// returns maximum's coordinates, value, and coefficients for x2, y2 and xy
public double[] quadraticMaxV2dX2Y2XY (double [][][] data,double thresholdQuad, int debugLevel){
double [][] coeff=quadraticApproximation(data, false, 1.0E-20, thresholdQuad,debugLevel);
if (coeff==null) return null;
if (coeff[0].length<6) return null;
double [][] aM={
{2*coeff[0][0], coeff[0][2]}, // | 2A, C |
{ coeff[0][2],2*coeff[0][1]}}; // | C, 2B |
Matrix M=(new Matrix(aM));
double nmQ=normMatix(aM);
if (debugLevel>3) System.out.println("M.det()="+M.det()+" normMatix(aM)="+nmQ+" data.length="+data.length);
if ((nmQ==0.0) || (Math.abs(M.det())/normMatix(aM)<thresholdQuad)) {
if (debugLevel>3) System.out.println("quadraticMax2d() failed: M.det()="+M.det()+" normMatix(aM)="+normMatix(aM));
return null;
}
double [][] aB={
{-coeff[0][3]}, // | - D |
{-coeff[0][4]}}; // | - E |
double [] xy=M.solve(new Matrix(aB)).getColumnPackedCopy();
double vmax = coeff[0][0]*xy[0]*xy[0]+coeff[0][1]*xy[1]*xy[1]+coeff[0][2]*xy[0]*xy[1]+coeff[0][3]*xy[0]+coeff[0][4]*xy[1]+coeff[0][5];
double [] xyx2y2 = {xy[0],xy[1], vmax, coeff[0][0], coeff[0][1], coeff[0][2]};
return xyx2y2;
}
/* ======================================================================== */ /* ======================================================================== */
/** /**
* See below, this version is for backward compatibility with no damping * See below, this version is for backward compatibility with no damping
...@@ -210,13 +235,13 @@ public class PolynomialApproximation { ...@@ -210,13 +235,13 @@ public class PolynomialApproximation {
return quadraticApproximation( return quadraticApproximation(
data, data,
forceLinear, forceLinear,
null); null);
} }
/** /**
* Approximate function z(x,y) as a second degree polynomial (or just linear) * Approximate function z(x,y) as a second degree polynomial (or just linear)
* f(x,y)=A*x^2+B*y^2+C*x*y+D*x+E*y+F or f(x,y)=D*x+E*y+F * f(x,y)=A*x^2+B*y^2+C*x*y+D*x+E*y+F or f(x,y)=D*x+E*y+F
* @param data array consists of lines of either 2 or 3 vectors: * @param data array consists of lines of either 2 or 3 vectors:
* 2-element vector x,y * 2-element vector x,y
* variable length vector z (should be the same for all samples) * variable length vector z (should be the same for all samples)
...@@ -225,7 +250,7 @@ public class PolynomialApproximation { ...@@ -225,7 +250,7 @@ public class PolynomialApproximation {
* @param damping optional (may be null) array of 3 (for linear) or 6 (quadratic) values that adds cost * @param damping optional (may be null) array of 3 (for linear) or 6 (quadratic) values that adds cost
* for corresponding coefficient be non-zero. This can be used to find reasonable solutions when * for corresponding coefficient be non-zero. This can be used to find reasonable solutions when
* data is insufficient. Just one data point would result in a plane of constant z, co-linear * data is insufficient. Just one data point would result in a plane of constant z, co-linear
* points will produce a plane with a gradient along this line * points will produce a plane with a gradient along this line
* @return array of vectors or null * @return array of vectors or null
* each vector (one per each z component) is either 6-element- (A,B,C,D,E,F) if quadratic is possible and enabled * each vector (one per each z component) is either 6-element- (A,B,C,D,E,F) if quadratic is possible and enabled
* or 3-element - (D,E,F) if linear is possible and quadratic is not possible or disabled * or 3-element - (D,E,F) if linear is possible and quadratic is not possible or disabled
...@@ -242,7 +267,7 @@ public class PolynomialApproximation { ...@@ -242,7 +267,7 @@ public class PolynomialApproximation {
damping, damping,
this.debugLevel); this.debugLevel);
} }
public double [][] quadraticApproximation( public double [][] quadraticApproximation(
double [][][] data, double [][][] data,
boolean forceLinear, // use linear approximation boolean forceLinear, // use linear approximation
...@@ -254,8 +279,8 @@ public class PolynomialApproximation { ...@@ -254,8 +279,8 @@ public class PolynomialApproximation {
null, null,
debugLevel); debugLevel);
} }
public double [][] quadraticApproximation( public double [][] quadraticApproximation(
double [][][] data, double [][][] data,
boolean forceLinear, // use linear approximation boolean forceLinear, // use linear approximation
...@@ -271,7 +296,7 @@ public class PolynomialApproximation { ...@@ -271,7 +296,7 @@ public class PolynomialApproximation {
debugLevel); debugLevel);
} }
public double [][] quadraticApproximation( public double [][] quadraticApproximation(
double [][][] data, double [][][] data,
boolean forceLinear, // use linear approximation boolean forceLinear, // use linear approximation
...@@ -302,7 +327,7 @@ public class PolynomialApproximation { ...@@ -302,7 +327,7 @@ public class PolynomialApproximation {
1.0E-15, // threshold ratio of matrix determinant to norm for quadratic approximation (det too low - fail) 1.0E-15, // threshold ratio of matrix determinant to norm for quadratic approximation (det too low - fail)
this.debugLevel); this.debugLevel);
} }
public double [][] quadraticApproximation( public double [][] quadraticApproximation(
double [][][] data, double [][][] data,
boolean forceLinear, // use linear approximation boolean forceLinear, // use linear approximation
...@@ -317,10 +342,10 @@ public class PolynomialApproximation { ...@@ -317,10 +342,10 @@ public class PolynomialApproximation {
thresholdLin, // threshold ratio of matrix determinant to norm for linear approximation (det too low - fail) 11.0E-10 failed where it shouldn't? thresholdLin, // threshold ratio of matrix determinant to norm for linear approximation (det too low - fail) 11.0E-10 failed where it shouldn't?
thresholdQuad, // threshold ratio of matrix determinant to norm for quadratic approximation (det too low - fail) thresholdQuad, // threshold ratio of matrix determinant to norm for quadratic approximation (det too low - fail)
debugLevel); debugLevel);
} }
public double [][] quadraticApproximation( public double [][] quadraticApproximation(
double [][][] data, double [][][] data,
boolean forceLinear, // use linear approximation boolean forceLinear, // use linear approximation
...@@ -333,9 +358,9 @@ public class PolynomialApproximation { ...@@ -333,9 +358,9 @@ public class PolynomialApproximation {
/* ix, iy - the location of the point with maximal value. We'll approximate the vicinity of that maximum using a /* ix, iy - the location of the point with maximal value. We'll approximate the vicinity of that maximum using a
* second degree polynomial: * second degree polynomial:
Z(x,y)~=A*x^2+B*y^2+C*x*y+D*x+E*y+F Z(x,y)~=A*x^2+B*y^2+C*x*y+D*x+E*y+F
by minimizing sum of squared differenceS00between the actual (Z(x,uy)) and approximated values. by minimizing sum of squared differenceS00between the actual (Z(x,uy)) and approximated values.
and then find the maximum on the approximated surface. Here iS00the math: and then find the maximum on the approximated surface. Here iS00the math:
Z(x,y)~=A*x^2+B*y^2+C*x*y+D*x+E*y+F Z(x,y)~=A*x^2+B*y^2+C*x*y+D*x+E*y+F
minimizing squared error, using W(x,y) aS00weight function minimizing squared error, using W(x,y) aS00weight function
...@@ -402,18 +427,18 @@ public class PolynomialApproximation { ...@@ -402,18 +427,18 @@ public class PolynomialApproximation {
mDampingLin = new Matrix(3,3); mDampingLin = new Matrix(3,3);
for (int i = 0; i < 3; i++){ for (int i = 0; i < 3; i++){
int j = damping.length + i - 3; int j = damping.length + i - 3;
if (j >= 0) mDampingLin.set(i,i,damping[j]); if (j >= 0) mDampingLin.set(i,i,damping[j]);
} }
if (!forceLinear) { if (!forceLinear) {
mDampingQuad = new Matrix(6,6); mDampingQuad = new Matrix(6,6);
for (int i = 0; i < 6; i++){ for (int i = 0; i < 6; i++){
int j = damping.length + i - 6; int j = damping.length + i - 6;
if (j >= 0) mDampingQuad.set(i,i,damping[j]); if (j >= 0) mDampingQuad.set(i,i,damping[j]);
} }
} }
} }
int zDim=data[0][1].length; int zDim=data[0][1].length;
double w,z,x,x2,x3,x4,y,y2,y3,y4,wz; double w,z,x,x2,x3,x4,y,y2,y3,y4,wz;
int i,j,n=0; int i,j,n=0;
...@@ -477,7 +502,7 @@ public class PolynomialApproximation { ...@@ -477,7 +502,7 @@ public class PolynomialApproximation {
SZ02[j]+=wz*y2; SZ02[j]+=wz*y2;
} }
} }
} }
} }
//need to decide if there is enough data for linear and quadratic //need to decide if there is enough data for linear and quadratic
...@@ -486,7 +511,7 @@ public class PolynomialApproximation { ...@@ -486,7 +511,7 @@ public class PolynomialApproximation {
{S11,S02,S01}, {S11,S02,S01},
{S10,S01,S00}}; {S10,S01,S00}};
Matrix mLin=new Matrix (mAarrayL); Matrix mLin=new Matrix (mAarrayL);
if (mDampingLin != null){ if (mDampingLin != null){
mLin.plusEquals(mDampingLin); mLin.plusEquals(mDampingLin);
} }
...@@ -516,7 +541,7 @@ public class PolynomialApproximation { ...@@ -516,7 +541,7 @@ public class PolynomialApproximation {
ABCDEF[i]= mLin.solve(Z).getRowPackedCopy(); ABCDEF[i]= mLin.solve(Z).getRowPackedCopy();
} }
if (forceLinear) return ABCDEF; if (forceLinear) return ABCDEF;
// quote try quadratic approximation // quote try quadratic approximation
double [][] mAarrayQ= { double [][] mAarrayQ= {
{S40,S22,S31,S30,S21,S20}, {S40,S22,S31,S30,S21,S20},
{S22,S04,S13,S12,S03,S02}, {S22,S04,S13,S12,S03,S02},
...@@ -528,7 +553,7 @@ public class PolynomialApproximation { ...@@ -528,7 +553,7 @@ public class PolynomialApproximation {
if (mDampingQuad != null){ if (mDampingQuad != null){
mQuad.plusEquals(mDampingQuad); mQuad.plusEquals(mDampingQuad);
} }
if (debugLevel>3) { if (debugLevel>3) {
System.out.println(" n="+n+" det_quad="+mQuad.det()+" norm_quad="+normMatix(mAarrayQ)+" data.length="+data.length); System.out.println(" n="+n+" det_quad="+mQuad.det()+" norm_quad="+normMatix(mAarrayQ)+" data.length="+data.length);
mQuad.print(10,5); mQuad.print(10,5);
...@@ -557,7 +582,7 @@ public class PolynomialApproximation { ...@@ -557,7 +582,7 @@ public class PolynomialApproximation {
return ABCDEF; return ABCDEF;
} }
// calcualte "volume" made of the matrix row-vectors, placed orthogonally // calcualte "volume" made of the matrix row-vectors, placed orthogonally
// to be compared to determinant // to be compared to determinant
public double normMatix(double [][] a) { public double normMatix(double [][] a) {
double d,norm=1.0; double d,norm=1.0;
for (int i=0;i<a.length;i++) { for (int i=0;i<a.length;i++) {
......
...@@ -3690,8 +3690,8 @@ public class QuadCLT { ...@@ -3690,8 +3690,8 @@ public class QuadCLT {
min_corr_selected, // 0.0001; // minimal correlation value to consider valid min_corr_selected, // 0.0001; // minimal correlation value to consider valid
clt_parameters.max_corr_sigma,// 1.5; // weights of points around global max to find fractional clt_parameters.max_corr_sigma,// 1.5; // weights of points around global max to find fractional
clt_parameters.max_corr_radius, clt_parameters.max_corr_radius,
clt_parameters.enhortho_width, // 2; // reduce weight of center correlation pixels from center (0 - none, 1 - center, 2 +/-1 from center) // clt_parameters.enhortho_width, // 2; // reduce weight of center correlation pixels from center (0 - none, 1 - center, 2 +/-1 from center)
clt_parameters.enhortho_scale, // 0.2; // multiply center correlation pixels (inside enhortho_width) // clt_parameters.enhortho_scale, // 0.2; // multiply center correlation pixels (inside enhortho_width)
clt_parameters.max_corr_double, // Double pass when masking center of mass to reduce preference for integer values clt_parameters.max_corr_double, // Double pass when masking center of mass to reduce preference for integer values
clt_parameters.corr_mode, // Correlation mode: 0 - integer max, 1 - center of mass, 2 - polynomial clt_parameters.corr_mode, // Correlation mode: 0 - integer max, 1 - center of mass, 2 - polynomial
clt_parameters.min_shot, // 10.0; // Do not adjust for shot noise if lower than clt_parameters.min_shot, // 10.0; // Do not adjust for shot noise if lower than
...@@ -4766,8 +4766,8 @@ public class QuadCLT { ...@@ -4766,8 +4766,8 @@ public class QuadCLT {
min_corr_selected, // 0.0001; // minimal correlation value to consider valid min_corr_selected, // 0.0001; // minimal correlation value to consider valid
clt_parameters.max_corr_sigma,// 1.5; // weights of points around global max to find fractional clt_parameters.max_corr_sigma,// 1.5; // weights of points around global max to find fractional
clt_parameters.max_corr_radius, clt_parameters.max_corr_radius,
clt_parameters.enhortho_width, // 2; // reduce weight of center correlation pixels from center (0 - none, 1 - center, 2 +/-1 from center) // clt_parameters.enhortho_width, // 2; // reduce weight of center correlation pixels from center (0 - none, 1 - center, 2 +/-1 from center)
clt_parameters.enhortho_scale, // 0.2; // multiply center correlation pixels (inside enhortho_width) // clt_parameters.enhortho_scale, // 0.2; // multiply center correlation pixels (inside enhortho_width)
clt_parameters.max_corr_double, // Double pass when masking center of mass to reduce preference for integer values clt_parameters.max_corr_double, // Double pass when masking center of mass to reduce preference for integer values
clt_parameters.corr_mode, // Correlation mode: 0 - integer max, 1 - center of mass, 2 - polynomial clt_parameters.corr_mode, // Correlation mode: 0 - integer max, 1 - center of mass, 2 - polynomial
clt_parameters.min_shot, // 10.0; // Do not adjust for shot noise if lower than clt_parameters.min_shot, // 10.0; // Do not adjust for shot noise if lower than
...@@ -7869,8 +7869,8 @@ public class QuadCLT { ...@@ -7869,8 +7869,8 @@ public class QuadCLT {
min_corr_selected, // 0.0001; // minimal correlation value to consider valid min_corr_selected, // 0.0001; // minimal correlation value to consider valid
clt_parameters.max_corr_sigma,// 1.5; // weights of points around global max to find fractional clt_parameters.max_corr_sigma,// 1.5; // weights of points around global max to find fractional
clt_parameters.max_corr_radius, clt_parameters.max_corr_radius,
clt_parameters.enhortho_width, // 2; // reduce weight of center correlation pixels from center (0 - none, 1 - center, 2 +/-1 from center) // clt_parameters.enhortho_width, // 2; // reduce weight of center correlation pixels from center (0 - none, 1 - center, 2 +/-1 from center)
clt_parameters.enhortho_scale, // 0.2; // multiply center correlation pixels (inside enhortho_width) // clt_parameters.enhortho_scale, // 0.2; // multiply center correlation pixels (inside enhortho_width)
clt_parameters.max_corr_double, // Double pass when masking center of mass to reduce preference for integer values clt_parameters.max_corr_double, // Double pass when masking center of mass to reduce preference for integer values
clt_parameters.corr_mode, // Correlation mode: 0 - integer max, 1 - center of mass, 2 - polynomial clt_parameters.corr_mode, // Correlation mode: 0 - integer max, 1 - center of mass, 2 - polynomial
clt_parameters.min_shot, // 10.0; // Do not adjust for shot noise if lower than clt_parameters.min_shot, // 10.0; // Do not adjust for shot noise if lower than
...@@ -8083,8 +8083,8 @@ public class QuadCLT { ...@@ -8083,8 +8083,8 @@ public class QuadCLT {
min_corr_selected, // 0.0001; // minimal correlation value to consider valid min_corr_selected, // 0.0001; // minimal correlation value to consider valid
clt_parameters.max_corr_sigma,// 1.5; // weights of points around global max to find fractional clt_parameters.max_corr_sigma,// 1.5; // weights of points around global max to find fractional
clt_parameters.max_corr_radius, clt_parameters.max_corr_radius,
clt_parameters.enhortho_width, // 2; // reduce weight of center correlation pixels from center (0 - none, 1 - center, 2 +/-1 from center) // clt_parameters.enhortho_width, // 2; // reduce weight of center correlation pixels from center (0 - none, 1 - center, 2 +/-1 from center)
clt_parameters.enhortho_scale, // 0.2; // multiply center correlation pixels (inside enhortho_width) // clt_parameters.enhortho_scale, // 0.2; // multiply center correlation pixels (inside enhortho_width)
clt_parameters.max_corr_double, // Double pass when masking center of mass to reduce preference for integer values clt_parameters.max_corr_double, // Double pass when masking center of mass to reduce preference for integer values
clt_parameters.corr_mode, // Correlation mode: 0 - integer max, 1 - center of mass, 2 - polynomial clt_parameters.corr_mode, // Correlation mode: 0 - integer max, 1 - center of mass, 2 - polynomial
clt_parameters.min_shot, // 10.0; // Do not adjust for shot noise if lower than clt_parameters.min_shot, // 10.0; // Do not adjust for shot noise if lower than
......
...@@ -38,8 +38,6 @@ public class SuperTiles{ ...@@ -38,8 +38,6 @@ public class SuperTiles{
double bin_near; // bin value (before rounding) matching (min_disparity + step_threshold_near) double bin_near; // bin value (before rounding) matching (min_disparity + step_threshold_near)
double min_disparity; double min_disparity;
double max_disparity; double max_disparity;
double strength_floor;
double strength_pow;
double stBlurSigma; double stBlurSigma;
int numBins; int numBins;
double [] bin_centers; double [] bin_centers;
...@@ -51,11 +49,14 @@ public class SuperTiles{ ...@@ -51,11 +49,14 @@ public class SuperTiles{
int measSel = 1; // bitmask of the selected measurements for supertiles : +1 - combo, +2 - quad +4 - hor +8 - vert int measSel = 1; // bitmask of the selected measurements for supertiles : +1 - combo, +2 - quad +4 - hor +8 - vert
boolean smplMode = true; // Use sample mode (false - regular tile mode) boolean smplMode = true; // Use sample mode (false - regular tile mode)
/*
double strength_floor;
double strength_pow;
int smplSide = 2; // Sample size (side of a square) int smplSide = 2; // Sample size (side of a square)
int smplNum = 3; // Number after removing worst int smplNum = 3; // Number after removing worst
double smplRms = 0.1; // Maximal RMS of the remaining tiles in a sample double smplRms = 0.1; // Maximal RMS of the remaining tiles in a sample
boolean smplWnd = false; // final boolean smplWnd, // use window functions for the samples boolean smplWnd = false; // final boolean smplWnd, // use window functions for the samples
double max_abs_tilt = 2.0; // Maximal absolute tilt in pixels/tile double max_abs_tilt = 2.0; // Maximal absolute tilt in pixels/tile
double max_rel_tilt = 0.2; // Maximal relative tilt in pixels/tile/disparity double max_rel_tilt = 0.2; // Maximal relative tilt in pixels/tile/disparity
double damp_tilt = 0.001; // Damp tilt to handle insufficient (co-linear)data double damp_tilt = 0.001; // Damp tilt to handle insufficient (co-linear)data
...@@ -63,8 +64,8 @@ public class SuperTiles{ ...@@ -63,8 +64,8 @@ public class SuperTiles{
double transition = 1.0; // Mode transition range (between tilted and maximal disparity) double transition = 1.0; // Mode transition range (between tilted and maximal disparity)
int far_mode = 1; // Far objects filtering mode (0 - off, 1 - power of disparity) int far_mode = 1; // Far objects filtering mode (0 - off, 1 - power of disparity)
double far_power = 1.0; // Raise disparity to this power before averaging for far objects double far_power = 1.0; // Raise disparity to this power before averaging for far objects
*/
MeasuredLayersFilterParameters mlfp = new MeasuredLayersFilterParameters(); // filter parameters
MeasuredLayers measuredLayers = null; MeasuredLayers measuredLayers = null;
CLTPass3d cltPass3d; CLTPass3d cltPass3d;
...@@ -95,22 +96,26 @@ public class SuperTiles{ ...@@ -95,22 +96,26 @@ public class SuperTiles{
double step_threshold, double step_threshold,
double min_disparity, double min_disparity,
double max_disparity, double max_disparity,
double strength_floor,
double strength_pow,
double stBlurSigma, double stBlurSigma,
boolean smplMode, // = true; // Use sample mode (false - regular tile mode) boolean smplMode, // = true; // Use sample mode (false - regular tile mode)
int smplSide, // = 2; // Sample size (side of a square) MeasuredLayersFilterParameters mlfp,
int smplNum, // = 3; // Number after removing worst
double smplRms, // = 0.1; // Maximal RMS of the remaining tiles in a sample // double strength_floor,
boolean smplWnd, // use window functions for the samples // double strength_pow,
// boolean smplMode, // = true; // Use sample mode (false - regular tile mode)
double max_abs_tilt, // 2.0; // pix per tile // int smplSide, // = 2; // Sample size (side of a square)
double max_rel_tilt, // 0.2; // (pix / disparity) per tile // int smplNum, // = 3; // Number after removing worst
double damp_tilt, // 0.001; // Damp tilt to handle insufficient (co-linear)data // double smplRms, // = 0.1; // Maximal RMS of the remaining tiles in a sample
double min_tilt_disp, // 4.0; // Disparity switch between filtering modes - near objects use tilts, far - use max disparity // boolean smplWnd, // use window functions for the samples
double transition, // 1.0; // Mode transition range (between tilted and maximal disparity)
int far_mode, // 1; // Far objects filtering mode (0 - off, 1 - power of disparity) // double max_abs_tilt, // 2.0; // pix per tile
double far_power, // 3.0; // Raise disparity to this power before averaging for far objects // double max_rel_tilt, // 0.2; // (pix / disparity) per tile
// double damp_tilt, // 0.001; // Damp tilt to handle insufficient (co-linear)data
// double min_tilt_disp, // 4.0; // Disparity switch between filtering modes - near objects use tilts, far - use max disparity
// double transition, // 1.0; // Mode transition range (between tilted and maximal disparity)
// int far_mode, // 1; // Far objects filtering mode (0 - off, 1 - power of disparity)
// double far_power, // 3.0; // Raise disparity to this power before averaging for far objects
// boolean null_if_none, // boolean null_if_none,
int measSel) int measSel)
...@@ -122,26 +127,23 @@ public class SuperTiles{ ...@@ -122,26 +127,23 @@ public class SuperTiles{
this.step_threshold_far = step_threshold; this.step_threshold_far = step_threshold;
this.min_disparity = min_disparity; this.min_disparity = min_disparity;
this.max_disparity = max_disparity; this.max_disparity = max_disparity;
this.strength_floor = strength_floor;
this.strength_pow = strength_pow;
this.stBlurSigma = stBlurSigma; this.stBlurSigma = stBlurSigma;
this.smplMode = smplMode; // Use sample mode (false - regular tile mode) this.smplMode = smplMode; // Use sample mode (false - regular tile mode)
this.smplSide = smplSide; // Sample size (side of a square) this.mlfp = mlfp.clone();
this.smplNum = smplNum; // Number after removing worst
this.smplRms = smplRms; // Maximal RMS of the remaining tiles in a sample // this.strength_floor = strength_floor;
// this.strength_pow = strength_pow;
this.max_abs_tilt = max_abs_tilt; // this.smplSide = smplSide; // Sample size (side of a square)
this.max_rel_tilt = max_rel_tilt; // this.smplNum = smplNum; // Number after removing worst
this.damp_tilt = damp_tilt; // this.smplRms = smplRms; // Maximal RMS of the remaining tiles in a sample
this.min_tilt_disp = min_tilt_disp; // this.max_abs_tilt = max_abs_tilt;
this.transition = transition; // this.max_rel_tilt = max_rel_tilt;
this.far_mode = far_mode; // this.damp_tilt = damp_tilt;
this.far_power = far_power; // this.min_tilt_disp = min_tilt_disp;
// this.transition = transition;
this.smplWnd = smplWnd; // Use window functions for the samples // this.far_mode = far_mode;
// this.far_power = far_power;
// this.smplWnd = smplWnd; // Use window functions for the samples
this.measSel = measSel; this.measSel = measSel;
...@@ -190,18 +192,19 @@ public class SuperTiles{ ...@@ -190,18 +192,19 @@ public class SuperTiles{
null, // double [] world_plane, // tilt equi-disparity planes to match real world planes (usually horizontal (or null) null, // double [] world_plane, // tilt equi-disparity planes to match real world planes (usually horizontal (or null)
null, // boolean [][] tile_sel, // null or per-measurement layer, per-tile selection. For each layer null - do not use, {} - use all null, // boolean [][] tile_sel, // null or per-measurement layer, per-tile selection. For each layer null - do not use, {} - use all
smplMode, // final boolean smplMode, // = true; // Use sample mode (false - regular tile mode) smplMode, // final boolean smplMode, // = true; // Use sample mode (false - regular tile mode)
smplSide, // final int smplSide, // = 2; // Sample size (side of a square) mlfp,
smplNum, // final int smplNum, // = 3; // Number after removing worst // smplSide, // final int smplSide, // = 2; // Sample size (side of a square)
smplRms, // final double smplRms, // = 0.1; // Maximal RMS of the remaining tiles in a sample // smplNum, // final int smplNum, // = 3; // Number after removing worst
smplWnd, // final boolean smplWnd, // use window functions for the samples // smplRms, // final double smplRms, // = 0.1; // Maximal RMS of the remaining tiles in a sample
// smplWnd, // final boolean smplWnd, // use window functions for the samples
max_abs_tilt, // 2.0; // Maximal absolute tilt in pixels/tile
max_rel_tilt, // 0.2; // Maximal relative tilt in pixels/tile/disparity // max_abs_tilt, // 2.0; // Maximal absolute tilt in pixels/tile
damp_tilt, // 0.001; // Damp tilt to handle insufficient (co-linear)data // max_rel_tilt, // 0.2; // Maximal relative tilt in pixels/tile/disparity
min_tilt_disp, // 4.0; // Disparity switch between filtering modes - near objects use tilts, far - use max disparity // damp_tilt, // 0.001; // Damp tilt to handle insufficient (co-linear)data
transition, // 1.0; // Mode transition range (between tilted and maximal disparity) // min_tilt_disp, // 4.0; // Disparity switch between filtering modes - near objects use tilts, far - use max disparity
far_mode, // 1; // Far objects filtering mode (0 - off, 1 - power of disparity) // transition, // 1.0; // Mode transition range (between tilted and maximal disparity)
far_power, // 1.0; // Raise disparity to this power before averaging for far objects // far_mode, // 1; // Far objects filtering mode (0 - off, 1 - power of disparity)
// far_power, // 1.0; // Raise disparity to this power before averaging for far objects
measSel); // calculate and blur supertiles (for all, not just selected?) measSel); // calculate and blur supertiles (for all, not just selected?)
if (tileProcessor.globalDebugLevel > 0){ if (tileProcessor.globalDebugLevel > 0){
...@@ -431,18 +434,20 @@ public class SuperTiles{ ...@@ -431,18 +434,20 @@ public class SuperTiles{
final double [][][][] disparity_strength, // pre-calculated disparity/strength [per super-tile][per-measurement layer][2][tiles] or null final double [][][][] disparity_strength, // pre-calculated disparity/strength [per super-tile][per-measurement layer][2][tiles] or null
final boolean [][] tile_sel, // null or per-measurement layer, per-tile selection. For each layer null - do not use, {} - use all final boolean [][] tile_sel, // null or per-measurement layer, per-tile selection. For each layer null - do not use, {} - use all
final boolean smplMode, // = true; // Use sample mode (false - regular tile mode) final boolean smplMode, // = true; // Use sample mode (false - regular tile mode)
final int smplSide, // = 2; // Sample size (side of a square)
final int smplNum, // = 3; // Number after removing worst final MeasuredLayersFilterParameters mlfp,
final double smplRms, // = 0.1; // Maximal RMS of the remaining tiles in a sample // final int smplSide, // = 2; // Sample size (side of a square)
final boolean smplWnd, // // final int smplNum, // = 3; // Number after removing worst
// final double smplRms, // = 0.1; // Maximal RMS of the remaining tiles in a sample
final double max_abs_tilt, // 2.0; // pix per tile // final boolean smplWnd, //
final double max_rel_tilt, // 0.2; // (pix / disparity) per tile
final double damp_tilt, // 0.001; // Damp tilt to handle insufficient (co-linear)data // final double max_abs_tilt, // 2.0; // pix per tile
final double min_tilt_disp, // 4.0; // Disparity switch between filtering modes - near objects use tilts, far - use max disparity // final double max_rel_tilt, // 0.2; // (pix / disparity) per tile
final double transition, // 1.0; // Mode transition range (between tilted and maximal disparity) // final double damp_tilt, // 0.001; // Damp tilt to handle insufficient (co-linear)data
final int far_mode, // 1; // Far objects filtering mode (0 - off, 1 - power of disparity) // final double min_tilt_disp, // 4.0; // Disparity switch between filtering modes - near objects use tilts, far - use max disparity
final double far_power, // 3.0; // Raise disparity to this power before averaging for far objects // final double transition, // 1.0; // Mode transition range (between tilted and maximal disparity)
// final int far_mode, // 1; // Far objects filtering mode (0 - off, 1 - power of disparity)
// final double far_power, // 3.0; // Raise disparity to this power before averaging for far objects
final int measSel) // final int measSel) //
{ {
...@@ -451,33 +456,34 @@ public class SuperTiles{ ...@@ -451,33 +456,34 @@ public class SuperTiles{
} }
if ((this.disparityHistograms != null) && if ((this.disparityHistograms != null) &&
(smplMode == this.smplMode) && (smplMode == this.smplMode) &&
(smplSide == this.smplSide) && (mlfp.equals(this.mlfp)) &&
(smplNum == this.smplNum) && // (smplSide == this.smplSide) &&
(smplRms == this.smplRms) && // (smplNum == this.smplNum) &&
// (smplRms == this.smplRms) &&
(max_abs_tilt == this.max_abs_tilt) &&
(max_rel_tilt == this.max_rel_tilt) && // (max_abs_tilt == this.max_abs_tilt) &&
(damp_tilt == this.damp_tilt) && // (max_rel_tilt == this.max_rel_tilt) &&
(min_tilt_disp == this.min_tilt_disp) && // (damp_tilt == this.damp_tilt) &&
(transition == this.transition) && // (min_tilt_disp == this.min_tilt_disp) &&
(far_mode == this.far_mode) && // (transition == this.transition) &&
(far_power == this.far_power) && // (far_mode == this.far_mode) &&
// (far_power == this.far_power) &&
(measSel == this.measSel)){ (measSel == this.measSel)){
return this.disparityHistograms; return this.disparityHistograms;
} }
this.smplMode = smplMode; // Use sample mode (false - regular tile mode) this.smplMode = smplMode; // Use sample mode (false - regular tile mode)
this.smplSide = smplSide; // Sample size (side of a square) this.mlfp = mlfp.clone();
this.smplNum = smplNum; // Number after removing worst // this.smplSide = smplSide; // Sample size (side of a square)
this.smplRms = smplRms; // Maximal RMS of the remaining tiles in a sample // this.smplNum = smplNum; // Number after removing worst
// this.smplRms = smplRms; // Maximal RMS of the remaining tiles in a sample
this.max_abs_tilt = max_abs_tilt;
this.max_rel_tilt = max_rel_tilt; // this.max_abs_tilt = max_abs_tilt;
this.damp_tilt = damp_tilt; // this.max_rel_tilt = max_rel_tilt;
this.min_tilt_disp = min_tilt_disp; // this.damp_tilt = damp_tilt;
this.transition = transition; // this.min_tilt_disp = min_tilt_disp;
this.far_mode = far_mode; // this.transition = transition;
this.far_power = far_power; // this.far_mode = far_mode;
// this.far_power = far_power;
this.measSel = measSel; this.measSel = measSel;
...@@ -515,21 +521,22 @@ public class SuperTiles{ ...@@ -515,21 +521,22 @@ public class SuperTiles{
stileY, // int stY, stileY, // int stY,
(((tile_sel == null) || (tile_sel[nl].length == 0))? null:tile_sel[nl]), // boolean [] sel_in, (((tile_sel == null) || (tile_sel[nl].length == 0))? null:tile_sel[nl]), // boolean [] sel_in,
// null, // boolean [] sel_in, // null, // boolean [] sel_in,
strength_floor, // double strength_floor, mlfp,
strength_pow, // double strength_pow, // strength_floor, // double strength_floor,
smplSide, // int smplSide, // = 2; // Sample size (side of a square) // strength_pow, // double strength_pow,
smplNum, //int smplNum, // = 3; // Number after removing worst (should be >1) // smplSide, // int smplSide, // = 2; // Sample size (side of a square)
smplRms, //double smplRms, // = 0.1; // Maximal RMS of the remaining tiles in a sample // smplNum, //int smplNum, // = 3; // Number after removing worst (should be >1)
smplWnd, // smplRms, //double smplRms, // = 0.1; // Maximal RMS of the remaining tiles in a sample
// smplWnd,
max_abs_tilt, // = 2.0; // Maximal absolute tilt in pixels/tile
max_rel_tilt, // = 0.2; // Maximal relative tilt in pixels/tile/disparity // max_abs_tilt, // = 2.0; // Maximal absolute tilt in pixels/tile
damp_tilt, // = 0.001; // Damp tilt to handle insufficient (co-linear)data // max_rel_tilt, // = 0.2; // Maximal relative tilt in pixels/tile/disparity
min_tilt_disp, // = 4.0; // Disparity switch between filtering modes - near objects use tilts, far - use max disparity // damp_tilt, // = 0.001; // Damp tilt to handle insufficient (co-linear)data
transition, // = 1.0; // Mode transition range (between tilted and maximal disparity) // min_tilt_disp, // = 4.0; // Disparity switch between filtering modes - near objects use tilts, far - use max disparity
far_mode, // = 1; // Far objects filtering mode (0 - off, 1 - power of disparity) // transition, // = 1.0; // Mode transition range (between tilted and maximal disparity)
far_power, // = 1.0; // Raise disparity to this power before averaging for far objects // far_mode, // = 1; // Far objects filtering mode (0 - off, 1 - power of disparity)
// far_power, // = 1.0; // Raise disparity to this power before averaging for far objects
true, // boolean null_if_none); true, // boolean null_if_none);
-1); // int debugLevel -1); // int debugLevel
...@@ -540,8 +547,8 @@ public class SuperTiles{ ...@@ -540,8 +547,8 @@ public class SuperTiles{
stileY, // int stY, stileY, // int stY,
(((tile_sel == null) || (tile_sel[nl].length == 0))? null:tile_sel[nl]), // boolean [] sel_in, (((tile_sel == null) || (tile_sel[nl].length == 0))? null:tile_sel[nl]), // boolean [] sel_in,
// null, // boolean [] sel_in, // null, // boolean [] sel_in,
strength_floor, // double strength_floor, mlfp.strength_floor, // double strength_floor,
strength_pow, // double strength_pow, mlfp.strength_pow, // double strength_pow,
true); // boolean null_if_none); true); // boolean null_if_none);
} }
} else { } else {
...@@ -625,18 +632,19 @@ public class SuperTiles{ ...@@ -625,18 +632,19 @@ public class SuperTiles{
disparity_strength, // pre-calculated disparity/strength [per super-tile][per-measurement layer][2][tiles] or null disparity_strength, // pre-calculated disparity/strength [per super-tile][per-measurement layer][2][tiles] or null
tile_sel, // boolean [][] tile_sel, // null or per-measurement layer, per-tile selection. For each layer null - do not use, {} - use all tile_sel, // boolean [][] tile_sel, // null or per-measurement layer, per-tile selection. For each layer null - do not use, {} - use all
this.smplMode, // final boolean smplMode, // = true; // Use sample mode (false - regular tile mode) this.smplMode, // final boolean smplMode, // = true; // Use sample mode (false - regular tile mode)
this.smplSide, // final int smplSide, // = 2; // Sample size (side of a square) this.mlfp,
this.smplNum, // final int smplNum, // = 3; // Number after removing worst // this.smplSide, // final int smplSide, // = 2; // Sample size (side of a square)
this.smplRms, // final double smplRms, // = 0.1; // Maximal RMS of the remaining tiles in a sample // this.smplNum, // final int smplNum, // = 3; // Number after removing worst
this.smplWnd, // final boolean smplWnd, // use window functions for the samples // this.smplRms, // final double smplRms, // = 0.1; // Maximal RMS of the remaining tiles in a sample
// this.smplWnd, // final boolean smplWnd, // use window functions for the samples
this.max_abs_tilt, // 2.0; // Maximal absolute tilt in pixels/tile
this.max_rel_tilt, // 0.2; // Maximal relative tilt in pixels/tile/disparity // this.max_abs_tilt, // 2.0; // Maximal absolute tilt in pixels/tile
this.damp_tilt, // 0.001; // Damp tilt to handle insufficient (co-linear)data // this.max_rel_tilt, // 0.2; // Maximal relative tilt in pixels/tile/disparity
this.min_tilt_disp, // 4.0; // Disparity switch between filtering modes - near objects use tilts, far - use max disparity // this.damp_tilt, // 0.001; // Damp tilt to handle insufficient (co-linear)data
this.transition, // 1.0; // Mode transition range (between tilted and maximal disparity) // this.min_tilt_disp, // 4.0; // Disparity switch between filtering modes - near objects use tilts, far - use max disparity
this.far_mode, // 1; // Far objects filtering mode (0 - off, 1 - power of disparity) // this.transition, // 1.0; // Mode transition range (between tilted and maximal disparity)
this.far_power, // 1.0; // Raise disparity to this power before averaging for far objects // this.far_mode, // 1; // Far objects filtering mode (0 - off, 1 - power of disparity)
// this.far_power, // 1.0; // Raise disparity to this power before averaging for far objects
this.measSel); this.measSel);
final int globalDebugLevel = tileProcessor.globalDebugLevel; final int globalDebugLevel = tileProcessor.globalDebugLevel;
...@@ -647,7 +655,7 @@ public class SuperTiles{ ...@@ -647,7 +655,7 @@ public class SuperTiles{
threads[ithread] = new Thread() { threads[ithread] = new Thread() {
@Override @Override
public void run() { public void run() {
DoubleGaussianBlur gb=new DoubleGaussianBlur(); // DoubleGaussianBlur gb=new DoubleGaussianBlur();
for (int nsTile = ai.getAndIncrement(); nsTile < maxMinMax.length; nsTile = ai.getAndIncrement()) { for (int nsTile = ai.getAndIncrement(); nsTile < maxMinMax.length; nsTile = ai.getAndIncrement()) {
if (disparityHistograms[nsTile] != null) { if (disparityHistograms[nsTile] != null) {
double [] dh = disparityHistograms[nsTile]; double [] dh = disparityHistograms[nsTile];
...@@ -773,18 +781,20 @@ public class SuperTiles{ ...@@ -773,18 +781,20 @@ public class SuperTiles{
null, // double [] world_plane, // tilt equi-disparity planes to match real world planes (usually horizontal (or null) null, // double [] world_plane, // tilt equi-disparity planes to match real world planes (usually horizontal (or null)
null, // boolean [][] tile_sel, // null or per-measurement layer, per-tile selection. For each layer null - do not use, {} - use all null, // boolean [][] tile_sel, // null or per-measurement layer, per-tile selection. For each layer null - do not use, {} - use all
this.smplMode, // final boolean smplMode, // = true; // Use sample mode (false - regular tile mode) this.smplMode, // final boolean smplMode, // = true; // Use sample mode (false - regular tile mode)
this.smplSide, // final int smplSide, // = 2; // Sample size (side of a square) this.mlfp,
this.smplNum, // final int smplNum, // = 3; // Number after removing worst
this.smplRms, // final double smplRms, // = 0.1; // Maximal RMS of the remaining tiles in a sample // this.smplSide, // final int smplSide, // = 2; // Sample size (side of a square)
this.smplWnd, // final boolean smplWnd, // // this.smplNum, // final int smplNum, // = 3; // Number after removing worst
// this.smplRms, // final double smplRms, // = 0.1; // Maximal RMS of the remaining tiles in a sample
this.max_abs_tilt, // 2.0; // Maximal absolute tilt in pixels/tile // this.smplWnd, // final boolean smplWnd, //
this.max_rel_tilt, // 0.2; // Maximal relative tilt in pixels/tile/disparity
this.damp_tilt, // 0.001; // Damp tilt to handle insufficient (co-linear)data // this.max_abs_tilt, // 2.0; // Maximal absolute tilt in pixels/tile
this.min_tilt_disp, // 4.0; // Disparity switch between filtering modes - near objects use tilts, far - use max disparity // this.max_rel_tilt, // 0.2; // Maximal relative tilt in pixels/tile/disparity
this.transition, // 1.0; // Mode transition range (between tilted and maximal disparity) // this.damp_tilt, // 0.001; // Damp tilt to handle insufficient (co-linear)data
this.far_mode, // 1; // Far objects filtering mode (0 - off, 1 - power of disparity) // this.min_tilt_disp, // 4.0; // Disparity switch between filtering modes - near objects use tilts, far - use max disparity
this.far_power, // 1.0; // Raise disparity to this power before averaging for far objects // this.transition, // 1.0; // Mode transition range (between tilted and maximal disparity)
// this.far_mode, // 1; // Far objects filtering mode (0 - off, 1 - power of disparity)
// this.far_power, // 1.0; // Raise disparity to this power before averaging for far objects
this.measSel); // calculate and blur with the current settings, specified at instantiation this.measSel); // calculate and blur with the current settings, specified at instantiation
} }
...@@ -797,18 +807,19 @@ public class SuperTiles{ ...@@ -797,18 +807,19 @@ public class SuperTiles{
final double [][][][] disparity_strength, // pre-calculated disparity/strength [per super-tile][per-measurement layer][2][tiles] or null final double [][][][] disparity_strength, // pre-calculated disparity/strength [per super-tile][per-measurement layer][2][tiles] or null
boolean [][] tile_sel, // null or per-measurement layer, per-tile selection. For each layer null - do not use, {} - use all boolean [][] tile_sel, // null or per-measurement layer, per-tile selection. For each layer null - do not use, {} - use all
boolean smplMode, // = true; // Use sample mode (false - regular tile mode) boolean smplMode, // = true; // Use sample mode (false - regular tile mode)
int smplSide, // = 2; // Sample size (side of a square) MeasuredLayersFilterParameters mlfp, // parameters
int smplNum, // = 3; // Number after removing worst // int smplSide, // = 2; // Sample size (side of a square)
double smplRms, // = 0.1; // Maximal RMS of the remaining tiles in a sample // int smplNum, // = 3; // Number after removing worst
boolean smplWnd, // // double smplRms, // = 0.1; // Maximal RMS of the remaining tiles in a sample
// boolean smplWnd, //
double max_abs_tilt, // 2.0; // pix per tile
double max_rel_tilt, // 0.2; // (pix / disparity) per tile // double max_abs_tilt, // 2.0; // pix per tile
double damp_tilt, // 0.001; // Damp tilt to handle insufficient (co-linear)data // double max_rel_tilt, // 0.2; // (pix / disparity) per tile
double min_tilt_disp, // 4.0; // Disparity switch between filtering modes - near objects use tilts, far - use max disparity // double damp_tilt, // 0.001; // Damp tilt to handle insufficient (co-linear)data
double transition, // 1.0; // Mode transition range (between tilted and maximal disparity) // double min_tilt_disp, // 4.0; // Disparity switch between filtering modes - near objects use tilts, far - use max disparity
int far_mode, // 1; // Far objects filtering mode (0 - off, 1 - power of disparity) // double transition, // 1.0; // Mode transition range (between tilted and maximal disparity)
double far_power, // 3.0; // Raise disparity to this power before averaging for far objects // int far_mode, // 1; // Far objects filtering mode (0 - off, 1 - power of disparity)
// double far_power, // 3.0; // Raise disparity to this power before averaging for far objects
int measSel) // bitmask of the selected measurements for supertiles : +1 - combo, +2 - quad +4 - hor +8 - vert int measSel) // bitmask of the selected measurements for supertiles : +1 - combo, +2 - quad +4 - hor +8 - vert
{ {
...@@ -817,18 +828,19 @@ public class SuperTiles{ ...@@ -817,18 +828,19 @@ public class SuperTiles{
disparity_strength, // pre-calculated disparity/strength [per super-tile][per-measurement layer][2][tiles] or nullntal (or null) disparity_strength, // pre-calculated disparity/strength [per super-tile][per-measurement layer][2][tiles] or nullntal (or null)
tile_sel, // boolean [][] tile_sel, // null or per-measurement layer, per-tile selection. For each layer null - do not use, {} - use all tile_sel, // boolean [][] tile_sel, // null or per-measurement layer, per-tile selection. For each layer null - do not use, {} - use all
smplMode, // final boolean smplMode, // = true; // Use sample mode (false - regular tile mode) smplMode, // final boolean smplMode, // = true; // Use sample mode (false - regular tile mode)
smplSide, // final int smplSide, // = 2; // Sample size (side of a square) mlfp,
smplNum, // final int smplNum, // = 3; // Number after removing worst // smplSide, // final int smplSide, // = 2; // Sample size (side of a square)
smplRms, // final double smplRms, // = 0.1; // Maximal RMS of the remaining tiles in a sample // smplNum, // final int smplNum, // = 3; // Number after removing worst
smplWnd, // final boolean smplWnd, // // smplRms, // final double smplRms, // = 0.1; // Maximal RMS of the remaining tiles in a sample
// smplWnd, // final boolean smplWnd, //
max_abs_tilt, // 2.0; // Maximal absolute tilt in pixels/tile
max_rel_tilt, // 0.2; // Maximal relative tilt in pixels/tile/disparity // max_abs_tilt, // 2.0; // Maximal absolute tilt in pixels/tile
damp_tilt, // 0.001; // Damp tilt to handle insufficient (co-linear)data // max_rel_tilt, // 0.2; // Maximal relative tilt in pixels/tile/disparity
min_tilt_disp, // 4.0; // Disparity switch between filtering modes - near objects use tilts, far - use max disparity // damp_tilt, // 0.001; // Damp tilt to handle insufficient (co-linear)data
transition, // 1.0; // Mode transition range (between tilted and maximal disparity) // min_tilt_disp, // 4.0; // Disparity switch between filtering modes - near objects use tilts, far - use max disparity
far_mode, // 1; // Far objects filtering mode (0 - off, 1 - power of disparity) // transition, // 1.0; // Mode transition range (between tilted and maximal disparity)
far_power, // 1.0; // Raise disparity to this power before averaging for far objects // far_mode, // 1; // Far objects filtering mode (0 - off, 1 - power of disparity)
// far_power, // 1.0; // Raise disparity to this power before averaging for far objects
measSel); // calculate and blur with the current settings, specified at instantiation measSel); // calculate and blur with the current settings, specified at instantiation
return showDisparityHistogram(disparityHistograms); return showDisparityHistogram(disparityHistograms);
...@@ -994,7 +1006,7 @@ public class SuperTiles{ ...@@ -994,7 +1006,7 @@ public class SuperTiles{
final double minBgDisparity, final double minBgDisparity,
final double minBgFract) final double minBgFract)
{ {
final double step_disparity = step_near; // TODO: implement //// final double step_disparity = step_near; // TODO: implement
if (maxMinMax == null) return null; if (maxMinMax == null) return null;
...@@ -1410,7 +1422,7 @@ public class SuperTiles{ ...@@ -1410,7 +1422,7 @@ public class SuperTiles{
boolean [][][] selections, boolean [][][] selections,
TilePlanes.PlaneData [] planes) TilePlanes.PlaneData [] planes)
{ {
int num_p = selections.length; // int num_p = selections.length;
int num_pd = (planes != null) ? (planes.length - LOWEST_PLANE(planes.length)) : 0; int num_pd = (planes != null) ? (planes.length - LOWEST_PLANE(planes.length)) : 0;
String [] titles = new String [9 * num_pd]; String [] titles = new String [9 * num_pd];
for (int npd = 0; npd < num_pd; npd++){ for (int npd = 0; npd < num_pd; npd++){
...@@ -1529,18 +1541,20 @@ public class SuperTiles{ ...@@ -1529,18 +1541,20 @@ public class SuperTiles{
final boolean correct_distortions, final boolean correct_distortions,
final boolean smplMode, // = true; // Use sample mode (false - regular tile mode) final boolean smplMode, // = true; // Use sample mode (false - regular tile mode)
final int smplSide, // = 2; // Sample size (side of a square)
final int smplNum, // = 3; // Number after removing worst final MeasuredLayersFilterParameters mlfp,
final double smplRms, // = 0.1; // Maximal RMS of the remaining tiles in a sample // final int smplSide, // = 2; // Sample size (side of a square)
final boolean smplWnd, // // final int smplNum, // = 3; // Number after removing worst
// final double smplRms, // = 0.1; // Maximal RMS of the remaining tiles in a sample
final double max_abs_tilt, // 2.0; // pix per tile // final boolean smplWnd, //
final double max_rel_tilt, // 0.2; // (pix / disparity) per tile
final double damp_tilt, // 0.001; // Damp tilt to handle insufficient (co-linear)data // final double max_abs_tilt, // 2.0; // pix per tile
final double min_tilt_disp, // 4.0; // Disparity switch between filtering modes - near objects use tilts, far - use max disparity // final double max_rel_tilt, // 0.2; // (pix / disparity) per tile
final double transition, // 1.0; // Mode transition range (between tilted and maximal disparity) // final double damp_tilt, // 0.001; // Damp tilt to handle insufficient (co-linear)data
final int far_mode, // 1; // Far objects filtering mode (0 - off, 1 - power of disparity) // final double min_tilt_disp, // 4.0; // Disparity switch between filtering modes - near objects use tilts, far - use max disparity
final double far_power, // 3.0; // Raise disparity to this power before averaging for far objects // final double transition, // 1.0; // Mode transition range (between tilted and maximal disparity)
// final int far_mode, // 1; // Far objects filtering mode (0 - off, 1 - power of disparity)
// final double far_power, // 3.0; // Raise disparity to this power before averaging for far objects
final int debugLevel, final int debugLevel,
final int dbg_X, final int dbg_X,
...@@ -1601,8 +1615,8 @@ public class SuperTiles{ ...@@ -1601,8 +1615,8 @@ public class SuperTiles{
stileX, // int stX, stileX, // int stX,
stileY, // int stY, stileY, // int stY,
null, // boolean [] sel_in, null, // boolean [] sel_in,
strength_floor, // double strength_floor, mlfp.strength_floor, // double strength_floor,
strength_pow, // double strength_pow, mlfp.strength_pow, // double strength_pow,
true); // boolean null_if_none); true); // boolean null_if_none);
// if failed - keep constant disparity (plane_tilts[ml] = zero_tilts) // if failed - keep constant disparity (plane_tilts[ml] = zero_tilts)
...@@ -1649,20 +1663,20 @@ public class SuperTiles{ ...@@ -1649,20 +1663,20 @@ public class SuperTiles{
null, // boolean [] sel_in, null, // boolean [] sel_in,
// ((world_plane_norm == null)? zero_tilts: plane_tilts[ml]), // double [] tiltXY, // null - free with limit on both absolute (2.0?) and relative (0.2) values // ((world_plane_norm == null)? zero_tilts: plane_tilts[ml]), // double [] tiltXY, // null - free with limit on both absolute (2.0?) and relative (0.2) values
(floating? null: plane_tilts[ml]), // double [] tiltXY, // null - free with limit on both absolute (2.0?) and relative (0.2) values (floating? null: plane_tilts[ml]), // double [] tiltXY, // null - free with limit on both absolute (2.0?) and relative (0.2) values
strength_floor, // double strength_floor, mlfp,
strength_pow, // double strength_pow, // strength_floor, // double strength_floor,
smplSide, // int smplSide, // = 2; // Sample size (side of a square) // strength_pow, // double strength_pow,
smplNum, //int smplNum, // = 3; // Number after removing worst (should be >1) // smplSide, // int smplSide, // = 2; // Sample size (side of a square)
smplRms, //double smplRms, // = 0.1; // Maximal RMS of the remaining tiles in a sample // smplNum, //int smplNum, // = 3; // Number after removing worst (should be >1)
// true, // boolean null_if_none); // smplRms, //double smplRms, // = 0.1; // Maximal RMS of the remaining tiles in a sample
smplWnd, // boolean smplWnd, // // smplWnd, // boolean smplWnd, //
max_abs_tilt, // 2.0; // Maximal absolute tilt in pixels/tile // max_abs_tilt, // 2.0; // Maximal absolute tilt in pixels/tile
max_rel_tilt, // 0.2; // Maximal relative tilt in pixels/tile/disparity // max_rel_tilt, // 0.2; // Maximal relative tilt in pixels/tile/disparity
damp_tilt, // 0.001; // Damp tilt to handle insufficient (co-linear)data // damp_tilt, // 0.001; // Damp tilt to handle insufficient (co-linear)data
min_tilt_disp, // 4.0; // Disparity switch between filtering modes - near objects use tilts, far - use max disparity // min_tilt_disp, // 4.0; // Disparity switch between filtering modes - near objects use tilts, far - use max disparity
transition, // 1.0; // Mode transition range (between tilted and maximal disparity) // transition, // 1.0; // Mode transition range (between tilted and maximal disparity)
far_mode, // 1; // Far objects filtering mode (0 - off, 1 - power of disparity) // far_mode, // 1; // Far objects filtering mode (0 - off, 1 - power of disparity)
far_power, // 1.0; // Raise disparity to this power before averaging for far objects // far_power, // 1.0; // Raise disparity to this power before averaging for far objects
true, // boolean null_if_none); true, // boolean null_if_none);
dl); dl);
} else { } else {
...@@ -1671,8 +1685,8 @@ public class SuperTiles{ ...@@ -1671,8 +1685,8 @@ public class SuperTiles{
stileX, // int stX, stileX, // int stX,
stileY, // int stY, stileY, // int stY,
null, // boolean [] sel_in, null, // boolean [] sel_in,
strength_floor, // double strength_floor, mlfp.strength_floor, // double strength_floor,
strength_pow, // double strength_pow, mlfp.strength_pow, // double strength_pow,
true); // boolean null_if_none); true); // boolean null_if_none);
} }
} }
...@@ -2058,18 +2072,20 @@ public class SuperTiles{ ...@@ -2058,18 +2072,20 @@ public class SuperTiles{
final boolean correct_distortions, final boolean correct_distortions,
final boolean smplMode, // = true; // Use sample mode (false - regular tile mode) final boolean smplMode, // = true; // Use sample mode (false - regular tile mode)
final int smplSide, // = 2; // Sample size (side of a square)
final int smplNum, // = 3; // Number after removing worst final MeasuredLayersFilterParameters mlfp,
final double smplRms, // = 0.1; // Maximal RMS of the remaining tiles in a sample // final int smplSide, // = 2; // Sample size (side of a square)
final boolean smplWnd, // use window functions fro the samples // final int smplNum, // = 3; // Number after removing worst
// final double smplRms, // = 0.1; // Maximal RMS of the remaining tiles in a sample
final double max_abs_tilt, // 2.0; // pix per tile // final boolean smplWnd, // use window functions fro the samples
final double max_rel_tilt, // 0.2; // (pix / disparity) per tile
final double damp_tilt, // 0.001; // Damp tilt to handle insufficient (co-linear)data // final double max_abs_tilt, // 2.0; // pix per tile
final double min_tilt_disp, // 4.0; // Disparity switch between filtering modes - near objects use tilts, far - use max disparity // final double max_rel_tilt, // 0.2; // (pix / disparity) per tile
final double transition, // 1.0; // Mode transition range (between tilted and maximal disparity) // final double damp_tilt, // 0.001; // Damp tilt to handle insufficient (co-linear)data
final int far_mode, // 1; // Far objects filtering mode (0 - off, 1 - power of disparity) // final double min_tilt_disp, // 4.0; // Disparity switch between filtering modes - near objects use tilts, far - use max disparity
final double far_power, // 3.0; // Raise disparity to this power before averaging for far objects // final double transition, // 1.0; // Mode transition range (between tilted and maximal disparity)
// final int far_mode, // 1; // Far objects filtering mode (0 - off, 1 - power of disparity)
// final double far_power, // 3.0; // Raise disparity to this power before averaging for far objects
final double bin_blur_hor, // Blur disparity histograms for horizontal clusters by this sigma (in bins) final double bin_blur_hor, // Blur disparity histograms for horizontal clusters by this sigma (in bins)
final double bin_blur_vert, // Blur disparity histograms for constant disparity clusters by this sigma (in bins) final double bin_blur_vert, // Blur disparity histograms for constant disparity clusters by this sigma (in bins)
...@@ -2148,18 +2164,19 @@ public class SuperTiles{ ...@@ -2148,18 +2164,19 @@ public class SuperTiles{
geometryCorrection, // final GeometryCorrection geometryCorrection, geometryCorrection, // final GeometryCorrection geometryCorrection,
correct_distortions, // final boolean correct_distortions, correct_distortions, // final boolean correct_distortions,
smplMode, // final boolean smplMode, // = true; // Use sample mode (false - regular tile mode) smplMode, // final boolean smplMode, // = true; // Use sample mode (false - regular tile mode)
smplSide, // final int smplSide, // = 2; // Sample size (side of a square) mlfp,
smplNum, // final int smplNum, // = 3; // Number after removing worst // smplSide, // final int smplSide, // = 2; // Sample size (side of a square)
smplRms, // final double smplRms, // = 0.1; // Maximal RMS of the remaining tiles in a sample // smplNum, // final int smplNum, // = 3; // Number after removing worst
smplWnd, // final boolean smplWnd, // use window functions for the samples // smplRms, // final double smplRms, // = 0.1; // Maximal RMS of the remaining tiles in a sample
// smplWnd, // final boolean smplWnd, // use window functions for the samples
max_abs_tilt, // 2.0; // Maximal absolute tilt in pixels/tile
max_rel_tilt, // 0.2; // Maximal relative tilt in pixels/tile/disparity // max_abs_tilt, // 2.0; // Maximal absolute tilt in pixels/tile
damp_tilt, // 0.001; // Damp tilt to handle insufficient (co-linear)data // max_rel_tilt, // 0.2; // Maximal relative tilt in pixels/tile/disparity
min_tilt_disp, // 4.0; // Disparity switch between filtering modes - near objects use tilts, far - use max disparity // damp_tilt, // 0.001; // Damp tilt to handle insufficient (co-linear)data
transition, // 1.0; // Mode transition range (between tilted and maximal disparity) // min_tilt_disp, // 4.0; // Disparity switch between filtering modes - near objects use tilts, far - use max disparity
far_mode, // 1; // Far objects filtering mode (0 - off, 1 - power of disparity) // transition, // 1.0; // Mode transition range (between tilted and maximal disparity)
far_power, // 1.0; // Raise disparity to this power before averaging for far objects // far_mode, // 1; // Far objects filtering mode (0 - off, 1 - power of disparity)
// far_power, // 1.0; // Raise disparity to this power before averaging for far objects
debugLevel, debugLevel,
dbg_X, dbg_X,
...@@ -2172,18 +2189,19 @@ public class SuperTiles{ ...@@ -2172,18 +2189,19 @@ public class SuperTiles{
geometryCorrection, // final GeometryCorrection geometryCorrection, geometryCorrection, // final GeometryCorrection geometryCorrection,
correct_distortions, // final boolean correct_distortions, correct_distortions, // final boolean correct_distortions,
smplMode, // final boolean smplMode, // = true; // Use sample mode (false - regular tile mode) smplMode, // final boolean smplMode, // = true; // Use sample mode (false - regular tile mode)
smplSide, // final int smplSide, // = 2; // Sample size (side of a square) mlfp,
smplNum, // final int smplNum, // = 3; // Number after removing worst // smplSide, // final int smplSide, // = 2; // Sample size (side of a square)
smplRms, // final double smplRms, // = 0.1; // Maximal RMS of the remaining tiles in a sample // smplNum, // final int smplNum, // = 3; // Number after removing worst
smplWnd, // final boolean smplWnd, // use window functions for the samples // smplRms, // final double smplRms, // = 0.1; // Maximal RMS of the remaining tiles in a sample
// smplWnd, // final boolean smplWnd, // use window functions for the samples
max_abs_tilt, // 2.0; // Maximal absolute tilt in pixels/tile
max_rel_tilt, // 0.2; // Maximal relative tilt in pixels/tile/disparity // max_abs_tilt, // 2.0; // Maximal absolute tilt in pixels/tile
damp_tilt, // 0.001; // Damp tilt to handle insufficient (co-linear)data // max_rel_tilt, // 0.2; // Maximal relative tilt in pixels/tile/disparity
min_tilt_disp, // 4.0; // Disparity switch between filtering modes - near objects use tilts, far - use max disparity // damp_tilt, // 0.001; // Damp tilt to handle insufficient (co-linear)data
transition, // 1.0; // Mode transition range (between tilted and maximal disparity) // min_tilt_disp, // 4.0; // Disparity switch between filtering modes - near objects use tilts, far - use max disparity
far_mode, // 1; // Far objects filtering mode (0 - off, 1 - power of disparity) // transition, // 1.0; // Mode transition range (between tilted and maximal disparity)
far_power, // 1.0; // Raise disparity to this power before averaging for far objects // far_mode, // 1; // Far objects filtering mode (0 - off, 1 - power of disparity)
// far_power, // 1.0; // Raise disparity to this power before averaging for far objects
debugLevel, debugLevel,
dbg_X, dbg_X,
...@@ -2421,18 +2439,20 @@ public class SuperTiles{ ...@@ -2421,18 +2439,20 @@ public class SuperTiles{
final boolean correct_distortions, final boolean correct_distortions,
final boolean smplMode, // = true; // Use sample mode (false - regular tile mode) final boolean smplMode, // = true; // Use sample mode (false - regular tile mode)
final int smplSide, // = 2; // Sample size (side of a square)
final int smplNum, // = 3; // Number after removing worst final MeasuredLayersFilterParameters mlfp,
final double smplRms, // = 0.1; // Maximal RMS of the remaining tiles in a sample // final int smplSide, // = 2; // Sample size (side of a square)
final boolean smplWnd, // use window functions for the samples // final int smplNum, // = 3; // Number after removing worst
// final double smplRms, // = 0.1; // Maximal RMS of the remaining tiles in a sample
final double max_abs_tilt, // 2.0; // pix per tile // final boolean smplWnd, // use window functions for the samples
final double max_rel_tilt, // 0.2; // (pix / disparity) per tile
final double damp_tilt, // 0.001; // Damp tilt to handle insufficient (co-linear)data // final double max_abs_tilt, // 2.0; // pix per tile
final double min_tilt_disp, // 4.0; // Disparity switch between filtering modes - near objects use tilts, far - use max disparity // final double max_rel_tilt, // 0.2; // (pix / disparity) per tile
final double transition, // 1.0; // Mode transition range (between tilted and maximal disparity) // final double damp_tilt, // 0.001; // Damp tilt to handle insufficient (co-linear)data
final int far_mode, // 1; // Far objects filtering mode (0 - off, 1 - power of disparity) // final double min_tilt_disp, // 4.0; // Disparity switch between filtering modes - near objects use tilts, far - use max disparity
final double far_power, // 1.0; // Raise disparity to this power before averaging for far objects // final double transition, // 1.0; // Mode transition range (between tilted and maximal disparity)
// final int far_mode, // 1; // Far objects filtering mode (0 - off, 1 - power of disparity)
// final double far_power, // 1.0; // Raise disparity to this power before averaging for far objects
final double plDiscrTolerance, // = 0.4; // Maximal disparity difference from the plane to consider tile final double plDiscrTolerance, // = 0.4; // Maximal disparity difference from the plane to consider tile
final double plDiscrDispRange, // = 0.6; // Parallel move known planes around original know value for the best overall fit final double plDiscrDispRange, // = 0.6; // Parallel move known planes around original know value for the best overall fit
...@@ -2505,18 +2525,19 @@ public class SuperTiles{ ...@@ -2505,18 +2525,19 @@ public class SuperTiles{
stMeasSel, // final int stMeasSel, // = 1; // Select measurements for supertiles : +1 - combo, +2 - quad +4 - hor +8 - vert stMeasSel, // final int stMeasSel, // = 1; // Select measurements for supertiles : +1 - combo, +2 - quad +4 - hor +8 - vert
plDispNorm, // final double dispNorm, // Normalize disparities to the average if above plDispNorm, // final double dispNorm, // Normalize disparities to the average if above
smplMode, // final boolean smplMode, // = true; // Use sample mode (false - regular tile mode) smplMode, // final boolean smplMode, // = true; // Use sample mode (false - regular tile mode)
smplSide, // final int smplSide, // = 2; // Sample size (side of a square) mlfp,
smplNum, // final int smplNum, // = 3; // Number after removing worst // smplSide, // final int smplSide, // = 2; // Sample size (side of a square)
smplRms, // final double smplRms, // = 0.1; // Maximal RMS of the remaining tiles in a sample // smplNum, // final int smplNum, // = 3; // Number after removing worst
smplWnd, // final boolean smplWnd, // use window functions for the samples // smplRms, // final double smplRms, // = 0.1; // Maximal RMS of the remaining tiles in a sample
// smplWnd, // final boolean smplWnd, // use window functions for the samples
max_abs_tilt, // 2.0; // Maximal absolute tilt in pixels/tile
max_rel_tilt, // 0.2; // Maximal relative tilt in pixels/tile/disparity // max_abs_tilt, // 2.0; // Maximal absolute tilt in pixels/tile
damp_tilt, // 0.001; // Damp tilt to handle insufficient (co-linear)data // max_rel_tilt, // 0.2; // Maximal relative tilt in pixels/tile/disparity
min_tilt_disp, // 4.0; // Disparity switch between filtering modes - near objects use tilts, far - use max disparity // damp_tilt, // 0.001; // Damp tilt to handle insufficient (co-linear)data
transition, // 1.0; // Mode transition range (between tilted and maximal disparity) // min_tilt_disp, // 4.0; // Disparity switch between filtering modes - near objects use tilts, far - use max disparity
far_mode, // 1; // Far objects filtering mode (0 - off, 1 - power of disparity) // transition, // 1.0; // Mode transition range (between tilted and maximal disparity)
far_power, // 1.0; // Raise disparity to this power before averaging for far objects // far_mode, // 1; // Far objects filtering mode (0 - off, 1 - power of disparity)
// far_power, // 1.0; // Raise disparity to this power before averaging for far objects
plDiscrTolerance, // final double disp_tolerance, // maximal disparity difference from the plane to consider tile plDiscrTolerance, // final double disp_tolerance, // maximal disparity difference from the plane to consider tile
plDiscrVarFloor, // final double disp_var_floor, // squared add to variance to calculate reverse flatness (used mostly for single-cell clusters) plDiscrVarFloor, // final double disp_var_floor, // squared add to variance to calculate reverse flatness (used mostly for single-cell clusters)
...@@ -2622,20 +2643,21 @@ public class SuperTiles{ ...@@ -2622,20 +2643,21 @@ public class SuperTiles{
final boolean plPreferDisparity, // Always start with disparity-most axis (false - lowest eigenvalue) final boolean plPreferDisparity, // Always start with disparity-most axis (false - lowest eigenvalue)
final GeometryCorrection geometryCorrection, final GeometryCorrection geometryCorrection,
final boolean correct_distortions, final boolean correct_distortions,
final boolean smplMode, // = true; // Use sample mode (false - regular tile mode) final boolean smplMode, // = true; // Use sample mode (false - regular tile mode)
final int smplSide, // = 2; // Sample size (side of a square)
final int smplNum, // = 3; // Number after removing worst final MeasuredLayersFilterParameters mlfp,
final double smplRms, // = 0.1; // Maximal RMS of the remaining tiles in a sample // final int smplSide, // = 2; // Sample size (side of a square)
final boolean smplWnd, // use window functions for the samples // final int smplNum, // = 3; // Number after removing worst
// final double smplRms, // = 0.1; // Maximal RMS of the remaining tiles in a sample
final double max_abs_tilt, // 2.0; // pix per tile // final boolean smplWnd, // use window functions for the samples
final double max_rel_tilt, // 0.2; // (pix / disparity) per tile
final double damp_tilt, // 0.001; // Damp tilt to handle insufficient (co-linear)data // final double max_abs_tilt, // 2.0; // pix per tile
final double min_tilt_disp, // 4.0; // Disparity switch between filtering modes - near objects use tilts, far - use max disparity // final double max_rel_tilt, // 0.2; // (pix / disparity) per tile
final double transition, // 1.0; // Mode transition range (between tilted and maximal disparity) // final double damp_tilt, // 0.001; // Damp tilt to handle insufficient (co-linear)data
final int far_mode, // 1; // Far objects filtering mode (0 - off, 1 - power of disparity) // final double min_tilt_disp, // 4.0; // Disparity switch between filtering modes - near objects use tilts, far - use max disparity
final double far_power, // 3.0; // Raise disparity to this power before averaging for far objects // final double transition, // 1.0; // Mode transition range (between tilted and maximal disparity)
// final int far_mode, // 1; // Far objects filtering mode (0 - off, 1 - power of disparity)
// final double far_power, // 3.0; // Raise disparity to this power before averaging for far objects
final int debugLevel, final int debugLevel,
final int dbg_X, final int dbg_X,
...@@ -2697,22 +2719,25 @@ public class SuperTiles{ ...@@ -2697,22 +2719,25 @@ public class SuperTiles{
plTargetEigen, // double plTargetEigen, // = 0.1; // Remove outliers until main axis eigenvalue (possibly scaled by plDispNorm) gets below plTargetEigen, // double plTargetEigen, // = 0.1; // Remove outliers until main axis eigenvalue (possibly scaled by plDispNorm) gets below
plFractOutliers, // double plFractOutliers, // = 0.3; // Maximal fraction of outliers to remove plFractOutliers, // double plFractOutliers, // = 0.3; // Maximal fraction of outliers to remove
plMaxOutliers, // int plMaxOutliers, // = 20; // Maximal number of outliers to remove plMaxOutliers, // int plMaxOutliers, // = 20; // Maximal number of outliers to remove
strength_floor, // double strength_floor, // strength_floor, // double strength_floor,
strength_pow, // double strength_pow, // strength_pow, // double strength_pow,
correct_distortions, // boolean correct_distortions, correct_distortions, // boolean correct_distortions,
smplMode, // boolean smplMode, // = true; // Use sample mode (false - regular tile mode) smplMode, // boolean smplMode, // = true; // Use sample mode (false - regular tile mode)
smplSide, // int smplSide, // = 2; // Sample size (side of a square)
smplNum, // int smplNum, // = 3; // Number after removing worst mlfp,
smplRms, // double smplRms, // = 0.1; // Maximal RMS of the remaining tiles in a sample
smplWnd, // final boolean smplWnd, // use window functions for the samples // smplSide, // int smplSide, // = 2; // Sample size (side of a square)
// smplNum, // int smplNum, // = 3; // Number after removing worst
max_abs_tilt, // 2.0; // Maximal absolute tilt in pixels/tile // smplRms, // double smplRms, // = 0.1; // Maximal RMS of the remaining tiles in a sample
max_rel_tilt, // 0.2; // Maximal relative tilt in pixels/tile/disparity // smplWnd, // final boolean smplWnd, // use window functions for the samples
damp_tilt, // 0.001; // Damp tilt to handle insufficient (co-linear)data
min_tilt_disp, // 4.0; // Disparity switch between filtering modes - near objects use tilts, far - use max disparity // max_abs_tilt, // 2.0; // Maximal absolute tilt in pixels/tile
transition, // 1.0; // Mode transition range (between tilted and maximal disparity) // max_rel_tilt, // 0.2; // Maximal relative tilt in pixels/tile/disparity
far_mode, // 1; // Far objects filtering mode (0 - off, 1 - power of disparity) // damp_tilt, // 0.001; // Damp tilt to handle insufficient (co-linear)data
far_power, // 1.0; // Raise disparity to this power before averaging for far objects // min_tilt_disp, // 4.0; // Disparity switch between filtering modes - near objects use tilts, far - use max disparity
// transition, // 1.0; // Mode transition range (between tilted and maximal disparity)
// far_mode, // 1; // Far objects filtering mode (0 - off, 1 - power of disparity)
// far_power, // 1.0; // Raise disparity to this power before averaging for far objects
dl); // int debugLevel); dl); // int debugLevel);
...@@ -2749,22 +2774,23 @@ public class SuperTiles{ ...@@ -2749,22 +2774,23 @@ public class SuperTiles{
plTargetEigen, // double plTargetEigen, // = 0.1; // Remove outliers until main axis eigenvalue (possibly scaled by plDispNorm) gets below plTargetEigen, // double plTargetEigen, // = 0.1; // Remove outliers until main axis eigenvalue (possibly scaled by plDispNorm) gets below
0.0, // double plFractOutliers, // = 0.3; // Maximal fraction of outliers to remove 0.0, // double plFractOutliers, // = 0.3; // Maximal fraction of outliers to remove
0, // plMaxOutliers, // int plMaxOutliers, // = 20; // Maximal number of outliers to remove 0, // plMaxOutliers, // int plMaxOutliers, // = 20; // Maximal number of outliers to remove
strength_floor, // double strength_floor, // strength_floor, // double strength_floor,
strength_pow, // double strength_pow, // strength_pow, // double strength_pow,
correct_distortions, // boolean correct_distortions, correct_distortions, // boolean correct_distortions,
smplMode, // boolean smplMode, // = true; // Use sample mode (false - regular tile mode) smplMode, // boolean smplMode, // = true; // Use sample mode (false - regular tile mode)
smplSide, // int smplSide, // = 2; // Sample size (side of a square) mlfp,
smplNum, // int smplNum, // = 3; // Number after removing worst // smplSide, // int smplSide, // = 2; // Sample size (side of a square)
smplRms, // double smplRms, // = 0.1; // Maximal RMS of the remaining tiles in a sample // smplNum, // int smplNum, // = 3; // Number after removing worst
smplWnd, // final boolean smplWnd, // use window functions for the samples // smplRms, // double smplRms, // = 0.1; // Maximal RMS of the remaining tiles in a sample
// smplWnd, // final boolean smplWnd, // use window functions for the samples
max_abs_tilt, // 2.0; // Maximal absolute tilt in pixels/tile
max_rel_tilt, // 0.2; // Maximal relative tilt in pixels/tile/disparity // max_abs_tilt, // 2.0; // Maximal absolute tilt in pixels/tile
damp_tilt, // 0.001; // Damp tilt to handle insufficient (co-linear)data // max_rel_tilt, // 0.2; // Maximal relative tilt in pixels/tile/disparity
min_tilt_disp, // 4.0; // Disparity switch between filtering modes - near objects use tilts, far - use max disparity // damp_tilt, // 0.001; // Damp tilt to handle insufficient (co-linear)data
transition, // 1.0; // Mode transition range (between tilted and maximal disparity) // min_tilt_disp, // 4.0; // Disparity switch between filtering modes - near objects use tilts, far - use max disparity
far_mode, // 1; // Far objects filtering mode (0 - off, 1 - power of disparity) // transition, // 1.0; // Mode transition range (between tilted and maximal disparity)
far_power, // 1.0; // Raise disparity to this power before averaging for far objects // far_mode, // 1; // Far objects filtering mode (0 - off, 1 - power of disparity)
// far_power, // 1.0; // Raise disparity to this power before averaging for far objects
dl - 1); // int debugLevel); dl - 1); // int debugLevel);
} }
...@@ -2842,18 +2868,20 @@ public class SuperTiles{ ...@@ -2842,18 +2868,20 @@ public class SuperTiles{
final boolean correct_distortions, final boolean correct_distortions,
final boolean smplMode, // = true; // Use sample mode (false - regular tile mode) final boolean smplMode, // = true; // Use sample mode (false - regular tile mode)
final int smplSide, // = 2; // Sample size (side of a square)
final int smplNum, // = 3; // Number after removing worst final MeasuredLayersFilterParameters mlfp,
final double smplRms, // = 0.1; // Maximal RMS of the remaining tiles in a sample // final int smplSide, // = 2; // Sample size (side of a square)
final boolean smplWnd, // use window functions fro the samples // final int smplNum, // = 3; // Number after removing worst
// final double smplRms, // = 0.1; // Maximal RMS of the remaining tiles in a sample
final double max_abs_tilt, // 2.0; // pix per tile // final boolean smplWnd, // use window functions fro the samples
final double max_rel_tilt, // 0.2; // (pix / disparity) per tile
final double damp_tilt, // 0.001; // Damp tilt to handle insufficient (co-linear)data // final double max_abs_tilt, // 2.0; // pix per tile
final double min_tilt_disp, // 4.0; // Disparity switch between filtering modes - near objects use tilts, far - use max disparity // final double max_rel_tilt, // 0.2; // (pix / disparity) per tile
final double transition, // 1.0; // Mode transition range (between tilted and maximal disparity) // final double damp_tilt, // 0.001; // Damp tilt to handle insufficient (co-linear)data
final int far_mode, // 1; // Far objects filtering mode (0 - off, 1 - power of disparity) // final double min_tilt_disp, // 4.0; // Disparity switch between filtering modes - near objects use tilts, far - use max disparity
final double far_power, // 3.0; // Raise disparity to this power before averaging for far objects // final double transition, // 1.0; // Mode transition range (between tilted and maximal disparity)
// final int far_mode, // 1; // Far objects filtering mode (0 - off, 1 - power of disparity)
// final double far_power, // 3.0; // Raise disparity to this power before averaging for far objects
final double bin_blur_hor, // Blur disparity histograms for horizontal clusters by this sigma (in bins) final double bin_blur_hor, // Blur disparity histograms for horizontal clusters by this sigma (in bins)
final double bin_blur_vert, // Blur disparity histograms for constant disparity clusters by this sigma (in bins) final double bin_blur_vert, // Blur disparity histograms for constant disparity clusters by this sigma (in bins)
...@@ -2890,18 +2918,19 @@ public class SuperTiles{ ...@@ -2890,18 +2918,19 @@ public class SuperTiles{
correct_distortions, // final boolean correct_distortions, correct_distortions, // final boolean correct_distortions,
smplMode, // final boolean smplMode, // = true; // Use sample mode (false - regular tile mode) smplMode, // final boolean smplMode, // = true; // Use sample mode (false - regular tile mode)
smplSide, // final int smplSide, // = 2; // Sample size (side of a square) mlfp,
smplNum, // final int smplNum, // = 3; // Number after removing worst // smplSide, // final int smplSide, // = 2; // Sample size (side of a square)
smplRms, // final double smplRms, // = 0.1; // Maximal RMS of the remaining tiles in a sample // smplNum, // final int smplNum, // = 3; // Number after removing worst
smplWnd, // final boolean smplWnd, // use window functions fro the samples // smplRms, // final double smplRms, // = 0.1; // Maximal RMS of the remaining tiles in a sample
// smplWnd, // final boolean smplWnd, // use window functions fro the samples
max_abs_tilt, // 2.0; // Maximal absolute tilt in pixels/tile
max_rel_tilt, // 0.2; // Maximal relative tilt in pixels/tile/disparity // max_abs_tilt, // 2.0; // Maximal absolute tilt in pixels/tile
damp_tilt, // 0.001; // Damp tilt to handle insufficient (co-linear)data // max_rel_tilt, // 0.2; // Maximal relative tilt in pixels/tile/disparity
min_tilt_disp, // 4.0; // Disparity switch between filtering modes - near objects use tilts, far - use max disparity // damp_tilt, // 0.001; // Damp tilt to handle insufficient (co-linear)data
transition, // 1.0; // Mode transition range (between tilted and maximal disparity) // min_tilt_disp, // 4.0; // Disparity switch between filtering modes - near objects use tilts, far - use max disparity
far_mode, // 1; // Far objects filtering mode (0 - off, 1 - power of disparity) // transition, // 1.0; // Mode transition range (between tilted and maximal disparity)
far_power, // 1.0; // Raise disparity to this power before averaging for far objects // far_mode, // 1; // Far objects filtering mode (0 - off, 1 - power of disparity)
// far_power, // 1.0; // Raise disparity to this power before averaging for far objects
bin_blur_hor, // final double bin_blur_hor, // Blur disparity histograms for horizontal clusters by this sigma (in bins) bin_blur_hor, // final double bin_blur_hor, // Blur disparity histograms for horizontal clusters by this sigma (in bins)
bin_blur_vert, // final double bin_blur_vert, // Blur disparity histograms for constant disparity clusters by this sigma (in bins) bin_blur_vert, // final double bin_blur_vert, // Blur disparity histograms for constant disparity clusters by this sigma (in bins)
...@@ -2928,18 +2957,19 @@ public class SuperTiles{ ...@@ -2928,18 +2957,19 @@ public class SuperTiles{
correct_distortions, // final boolean correct_distortions, correct_distortions, // final boolean correct_distortions,
smplMode, // final boolean smplMode, // = true; // Use sample mode (false - regular tile mode) smplMode, // final boolean smplMode, // = true; // Use sample mode (false - regular tile mode)
smplSide, // final int smplSide, // = 2; // Sample size (side of a square) mlfp,
smplNum, // final int smplNum, // = 3; // Number after removing worst // smplSide, // final int smplSide, // = 2; // Sample size (side of a square)
smplRms, // final double smplRms, // = 0.1; // Maximal RMS of the remaining tiles in a sample // smplNum, // final int smplNum, // = 3; // Number after removing worst
smplWnd, // final boolean smplWnd, // use window functions fro the samples // smplRms, // final double smplRms, // = 0.1; // Maximal RMS of the remaining tiles in a sample
// smplWnd, // final boolean smplWnd, // use window functions fro the samples
max_abs_tilt, // 2.0; // Maximal absolute tilt in pixels/tile
max_rel_tilt, // 0.2; // Maximal relative tilt in pixels/tile/disparity // max_abs_tilt, // 2.0; // Maximal absolute tilt in pixels/tile
damp_tilt, // 0.001; // Damp tilt to handle insufficient (co-linear)data // max_rel_tilt, // 0.2; // Maximal relative tilt in pixels/tile/disparity
min_tilt_disp, // 4.0; // Disparity switch between filtering modes - near objects use tilts, far - use max disparity // damp_tilt, // 0.001; // Damp tilt to handle insufficient (co-linear)data
transition, // 1.0; // Mode transition range (between tilted and maximal disparity) // min_tilt_disp, // 4.0; // Disparity switch between filtering modes - near objects use tilts, far - use max disparity
far_mode, // 1; // Far objects filtering mode (0 - off, 1 - power of disparity) // transition, // 1.0; // Mode transition range (between tilted and maximal disparity)
far_power, // 1.0; // Raise disparity to this power before averaging for far objects // far_mode, // 1; // Far objects filtering mode (0 - off, 1 - power of disparity)
// far_power, // 1.0; // Raise disparity to this power before averaging for far objects
debugLevel, // final int debugLevel, debugLevel, // final int debugLevel,
dbg_X, // final int dbg_X, dbg_X, // final int dbg_X,
...@@ -2960,18 +2990,19 @@ public class SuperTiles{ ...@@ -2960,18 +2990,19 @@ public class SuperTiles{
correct_distortions, // final boolean correct_distortions, correct_distortions, // final boolean correct_distortions,
smplMode, // final boolean smplMode, // = true; // Use sample mode (false - regular tile mode) smplMode, // final boolean smplMode, // = true; // Use sample mode (false - regular tile mode)
smplSide, // final int smplSide, // = 2; // Sample size (side of a square) mlfp,
smplNum, // final int smplNum, // = 3; // Number after removing worst // smplSide, // final int smplSide, // = 2; // Sample size (side of a square)
smplRms, // final double smplRms, // = 0.1; // Maximal RMS of the remaining tiles in a sample // smplNum, // final int smplNum, // = 3; // Number after removing worst
smplWnd, // final boolean smplWnd, // use window functions for the samples // smplRms, // final double smplRms, // = 0.1; // Maximal RMS of the remaining tiles in a sample
// smplWnd, // final boolean smplWnd, // use window functions for the samples
max_abs_tilt, // 2.0; // Maximal absolute tilt in pixels/tile
max_rel_tilt, // 0.2; // Maximal relative tilt in pixels/tile/disparity // max_abs_tilt, // 2.0; // Maximal absolute tilt in pixels/tile
damp_tilt, // 0.001; // Damp tilt to handle insufficient (co-linear)data // max_rel_tilt, // 0.2; // Maximal relative tilt in pixels/tile/disparity
min_tilt_disp, // 4.0; // Disparity switch between filtering modes - near objects use tilts, far - use max disparity // damp_tilt, // 0.001; // Damp tilt to handle insufficient (co-linear)data
transition, // 1.0; // Mode transition range (between tilted and maximal disparity) // min_tilt_disp, // 4.0; // Disparity switch between filtering modes - near objects use tilts, far - use max disparity
far_mode, // 1; // Far objects filtering mode (0 - off, 1 - power of disparity) // transition, // 1.0; // Mode transition range (between tilted and maximal disparity)
far_power, // 1.0; // Raise disparity to this power before averaging for far objects // far_mode, // 1; // Far objects filtering mode (0 - off, 1 - power of disparity)
// far_power, // 1.0; // Raise disparity to this power before averaging for far objects
debugLevel + 0, // 1, // + 2, // 1, // final int debugLevel, debugLevel + 0, // 1, // + 2, // 1, // final int debugLevel,
dbg_X, // final int dbg_X, dbg_X, // final int dbg_X,
...@@ -3033,18 +3064,20 @@ public class SuperTiles{ ...@@ -3033,18 +3064,20 @@ public class SuperTiles{
final boolean correct_distortions, final boolean correct_distortions,
final boolean smplMode, // = true; // Use sample mode (false - regular tile mode) final boolean smplMode, // = true; // Use sample mode (false - regular tile mode)
final int smplSide, // = 2; // Sample size (side of a square)
final int smplNum, // = 3; // Number after removing worst final MeasuredLayersFilterParameters mlfp,
final double smplRms, // = 0.1; // Maximal RMS of the remaining tiles in a sample // final int smplSide, // = 2; // Sample size (side of a square)
final boolean smplWnd, // use window functions for the samples // final int smplNum, // = 3; // Number after removing worst
// final double smplRms, // = 0.1; // Maximal RMS of the remaining tiles in a sample
final double max_abs_tilt, // 2.0; // pix per tile // final boolean smplWnd, // use window functions for the samples
final double max_rel_tilt, // 0.2; // (pix / disparity) per tile
final double damp_tilt, // 0.001; // Damp tilt to handle insufficient (co-linear)data // final double max_abs_tilt, // 2.0; // pix per tile
final double min_tilt_disp, // 4.0; // Disparity switch between filtering modes - near objects use tilts, far - use max disparity // final double max_rel_tilt, // 0.2; // (pix / disparity) per tile
final double transition, // 1.0; // Mode transition range (between tilted and maximal disparity) // final double damp_tilt, // 0.001; // Damp tilt to handle insufficient (co-linear)data
final int far_mode, // 1; // Far objects filtering mode (0 - off, 1 - power of disparity) // final double min_tilt_disp, // 4.0; // Disparity switch between filtering modes - near objects use tilts, far - use max disparity
final double far_power, // 3.0; // Raise disparity to this power before averaging for far objects // final double transition, // 1.0; // Mode transition range (between tilted and maximal disparity)
// final int far_mode, // 1; // Far objects filtering mode (0 - off, 1 - power of disparity)
// final double far_power, // 3.0; // Raise disparity to this power before averaging for far objects
final double plDiscrTolerance, // = 0.4; // Maximal disparity difference from the plane to consider tile final double plDiscrTolerance, // = 0.4; // Maximal disparity difference from the plane to consider tile
final double plDiscrDispRange, // = 0.6; // Parallel move known planes around original know value for the best overall fit final double plDiscrDispRange, // = 0.6; // Parallel move known planes around original know value for the best overall fit
...@@ -3084,18 +3117,19 @@ public class SuperTiles{ ...@@ -3084,18 +3117,19 @@ public class SuperTiles{
correct_distortions, // final boolean correct_distortions, correct_distortions, // final boolean correct_distortions,
smplMode, // final boolean smplMode, // = true; // Use sample mode (false - regular tile mode) smplMode, // final boolean smplMode, // = true; // Use sample mode (false - regular tile mode)
smplSide, // final int smplSide, // = 2; // Sample size (side of a square) mlfp,
smplNum, // final int smplNum, // = 3; // Number after removing worst // smplSide, // final int smplSide, // = 2; // Sample size (side of a square)
smplRms, // final double smplRms, // = 0.1; // Maximal RMS of the remaining tiles in a sample // smplNum, // final int smplNum, // = 3; // Number after removing worst
smplWnd, // final boolean smplWnd, // use window functions for the samples // smplRms, // final double smplRms, // = 0.1; // Maximal RMS of the remaining tiles in a sample
// smplWnd, // final boolean smplWnd, // use window functions for the samples
max_abs_tilt, // 2.0; // Maximal absolute tilt in pixels/tile
max_rel_tilt, // 0.2; // Maximal relative tilt in pixels/tile/disparity // max_abs_tilt, // 2.0; // Maximal absolute tilt in pixels/tile
damp_tilt, // 0.001; // Damp tilt to handle insufficient (co-linear)data // max_rel_tilt, // 0.2; // Maximal relative tilt in pixels/tile/disparity
min_tilt_disp, // 4.0; // Disparity switch between filtering modes - near objects use tilts, far - use max disparity // damp_tilt, // 0.001; // Damp tilt to handle insufficient (co-linear)data
transition, // 1.0; // Mode transition range (between tilted and maximal disparity) // min_tilt_disp, // 4.0; // Disparity switch between filtering modes - near objects use tilts, far - use max disparity
far_mode, // 1; // Far objects filtering mode (0 - off, 1 - power of disparity) // transition, // 1.0; // Mode transition range (between tilted and maximal disparity)
far_power, // 1.0; // Raise disparity to this power before averaging for far objects // far_mode, // 1; // Far objects filtering mode (0 - off, 1 - power of disparity)
// far_power, // 1.0; // Raise disparity to this power before averaging for far objects
plDiscrTolerance, //final double plDiscrTolerance, // = 0.4; // Maximal disparity difference from the plane to consider tile plDiscrTolerance, //final double plDiscrTolerance, // = 0.4; // Maximal disparity difference from the plane to consider tile
plDiscrDispRange, // final double plDiscrDispRange, // = 0.6; // Parallel move known planes around original know value for the best overall fit plDiscrDispRange, // final double plDiscrDispRange, // = 0.6; // Parallel move known planes around original know value for the best overall fit
...@@ -3131,18 +3165,19 @@ public class SuperTiles{ ...@@ -3131,18 +3165,19 @@ public class SuperTiles{
correct_distortions, // final boolean correct_distortions, correct_distortions, // final boolean correct_distortions,
smplMode, // final boolean smplMode, // = true; // Use sample mode (false - regular tile mode) smplMode, // final boolean smplMode, // = true; // Use sample mode (false - regular tile mode)
smplSide, // final int smplSide, // = 2; // Sample size (side of a square) mlfp,
smplNum, // final int smplNum, // = 3; // Number after removing worst // smplSide, // final int smplSide, // = 2; // Sample size (side of a square)
smplRms, // final double smplRms, // = 0.1; // Maximal RMS of the remaining tiles in a sample // smplNum, // final int smplNum, // = 3; // Number after removing worst
smplWnd, // final boolean smplWnd, // use window functions for the samples // smplRms, // final double smplRms, // = 0.1; // Maximal RMS of the remaining tiles in a sample
// smplWnd, // final boolean smplWnd, // use window functions for the samples
max_abs_tilt, // 2.0; // Maximal absolute tilt in pixels/tile
max_rel_tilt, // 0.2; // Maximal relative tilt in pixels/tile/disparity // max_abs_tilt, // 2.0; // Maximal absolute tilt in pixels/tile
damp_tilt, // 0.001; // Damp tilt to handle insufficient (co-linear)data // max_rel_tilt, // 0.2; // Maximal relative tilt in pixels/tile/disparity
min_tilt_disp, // 4.0; // Disparity switch between filtering modes - near objects use tilts, far - use max disparity // damp_tilt, // 0.001; // Damp tilt to handle insufficient (co-linear)data
transition, // 1.0; // Mode transition range (between tilted and maximal disparity) // min_tilt_disp, // 4.0; // Disparity switch between filtering modes - near objects use tilts, far - use max disparity
far_mode, // 1; // Far objects filtering mode (0 - off, 1 - power of disparity) // transition, // 1.0; // Mode transition range (between tilted and maximal disparity)
far_power, // 1.0; // Raise disparity to this power before averaging for far objects // far_mode, // 1; // Far objects filtering mode (0 - off, 1 - power of disparity)
// far_power, // 1.0; // Raise disparity to this power before averaging for far objects
debugLevel, // final int debugLevel, debugLevel, // final int debugLevel,
dbg_X, // final int dbg_X, dbg_X, // final int dbg_X,
...@@ -3163,18 +3198,19 @@ public class SuperTiles{ ...@@ -3163,18 +3198,19 @@ public class SuperTiles{
correct_distortions, // final boolean correct_distortions, correct_distortions, // final boolean correct_distortions,
smplMode, // final boolean smplMode, // = true; // Use sample mode (false - regular tile mode) smplMode, // final boolean smplMode, // = true; // Use sample mode (false - regular tile mode)
smplSide, // final int smplSide, // = 2; // Sample size (side of a square) mlfp,
smplNum, // final int smplNum, // = 3; // Number after removing worst // smplSide, // final int smplSide, // = 2; // Sample size (side of a square)
smplRms, // final double smplRms, // = 0.1; // Maximal RMS of the remaining tiles in a sample // smplNum, // final int smplNum, // = 3; // Number after removing worst
smplWnd, // final boolean smplWnd, // use window functions for the samples // smplRms, // final double smplRms, // = 0.1; // Maximal RMS of the remaining tiles in a sample
// smplWnd, // final boolean smplWnd, // use window functions for the samples
max_abs_tilt, // 2.0; // Maximal absolute tilt in pixels/tile
max_rel_tilt, // 0.2; // Maximal relative tilt in pixels/tile/disparity // max_abs_tilt, // 2.0; // Maximal absolute tilt in pixels/tile
damp_tilt, // 0.001; // Damp tilt to handle insufficient (co-linear)data // max_rel_tilt, // 0.2; // Maximal relative tilt in pixels/tile/disparity
min_tilt_disp, // 4.0; // Disparity switch between filtering modes - near objects use tilts, far - use max disparity // damp_tilt, // 0.001; // Damp tilt to handle insufficient (co-linear)data
transition, // 1.0; // Mode transition range (between tilted and maximal disparity) // min_tilt_disp, // 4.0; // Disparity switch between filtering modes - near objects use tilts, far - use max disparity
far_mode, // 1; // Far objects filtering mode (0 - off, 1 - power of disparity) // transition, // 1.0; // Mode transition range (between tilted and maximal disparity)
far_power, // 1.0; // Raise disparity to this power before averaging for far objects // far_mode, // 1; // Far objects filtering mode (0 - off, 1 - power of disparity)
// far_power, // 1.0; // Raise disparity to this power before averaging for far objects
debugLevel, // + 2, // 1, // final int debugLevel, debugLevel, // + 2, // 1, // final int debugLevel,
dbg_X, // final int dbg_X, dbg_X, // final int dbg_X,
...@@ -6464,22 +6500,23 @@ public class SuperTiles{ ...@@ -6464,22 +6500,23 @@ public class SuperTiles{
dispNorm, // double dispNorm, // Normalize disparities to the average if above dispNorm, // double dispNorm, // Normalize disparities to the average if above
min_weight, // double min_weight, min_weight, // double min_weight,
min_tiles, // int min_tiles, min_tiles, // int min_tiles,
strength_floor, // double strength_floor, // strength_floor, // double strength_floor,
strength_pow, // double strength_pow, // strength_pow, // double strength_pow,
//OK? //OK?
smplMode, smplMode,
smplSide, mlfp,
smplNum, // smplSide,
smplRms, // smplNum,
smplWnd, // smplRms,
// smplWnd,
max_abs_tilt, // 2.0; // Maximal absolute tilt in pixels/tile
max_rel_tilt, // 0.2; // Maximal relative tilt in pixels/tile/disparity // max_abs_tilt, // 2.0; // Maximal absolute tilt in pixels/tile
damp_tilt, // 0.001; // Damp tilt to handle insufficient (co-linear)data // max_rel_tilt, // 0.2; // Maximal relative tilt in pixels/tile/disparity
min_tilt_disp, // 4.0; // Disparity switch between filtering modes - near objects use tilts, far - use max disparity // damp_tilt, // 0.001; // Damp tilt to handle insufficient (co-linear)data
transition, // 1.0; // Mode transition range (between tilted and maximal disparity) // min_tilt_disp, // 4.0; // Disparity switch between filtering modes - near objects use tilts, far - use max disparity
far_mode, // 1; // Far objects filtering mode (0 - off, 1 - power of disparity) // transition, // 1.0; // Mode transition range (between tilted and maximal disparity)
far_power, // 1.0; // Raise disparity to this power before averaging for far objects // far_mode, // 1; // Far objects filtering mode (0 - off, 1 - power of disparity)
// far_power, // 1.0; // Raise disparity to this power before averaging for far objects
dl - 2); // int debugLevel) dl - 2); // int debugLevel)
if (disp_strength == null) { if (disp_strength == null) {
...@@ -6495,23 +6532,24 @@ public class SuperTiles{ ...@@ -6495,23 +6532,24 @@ public class SuperTiles{
dispNorm, // double dispNorm, // Normalize disparities to the average if above dispNorm, // double dispNorm, // Normalize disparities to the average if above
min_weight, // double min_weight, min_weight, // double min_weight,
min_tiles, // int min_tiles, min_tiles, // int min_tiles,
strength_floor, // double strength_floor, // strength_floor, // double strength_floor,
strength_pow, // double strength_pow, // strength_pow, // double strength_pow,
//OK? //OK?
smplMode, smplMode,
smplSide, mlfp,
smplNum, // smplSide,
smplRms, // smplNum,
// smplRms,
smplWnd, // was not here // smplWnd, // was not here
max_abs_tilt, // 2.0; // Maximal absolute tilt in pixels/tile // max_abs_tilt, // 2.0; // Maximal absolute tilt in pixels/tile
max_rel_tilt, // 0.2; // Maximal relative tilt in pixels/tile/disparity // max_rel_tilt, // 0.2; // Maximal relative tilt in pixels/tile/disparity
damp_tilt, // 0.001; // Damp tilt to handle insufficient (co-linear)data // damp_tilt, // 0.001; // Damp tilt to handle insufficient (co-linear)data
min_tilt_disp, // 4.0; // Disparity switch between filtering modes - near objects use tilts, far - use max disparity // min_tilt_disp, // 4.0; // Disparity switch between filtering modes - near objects use tilts, far - use max disparity
transition, // 1.0; // Mode transition range (between tilted and maximal disparity) // transition, // 1.0; // Mode transition range (between tilted and maximal disparity)
far_mode, // 1; // Far objects filtering mode (0 - off, 1 - power of disparity) // far_mode, // 1; // Far objects filtering mode (0 - off, 1 - power of disparity)
far_power, // 1.0; // Raise disparity to this power before averaging for far objects // far_power, // 1.0; // Raise disparity to this power before averaging for far objects
dl - 2); // int debugLevel) dl - 2); // int debugLevel)
...@@ -6641,22 +6679,23 @@ public class SuperTiles{ ...@@ -6641,22 +6679,23 @@ public class SuperTiles{
final double targetEigen, // = 0.1; // Remove outliers until main axis eigenvalue (possibly scaled by plDispNorm) gets below final double targetEigen, // = 0.1; // Remove outliers until main axis eigenvalue (possibly scaled by plDispNorm) gets below
final double fractOutliers, // = 0.3; // Maximal fraction of outliers to remove final double fractOutliers, // = 0.3; // Maximal fraction of outliers to remove
final int maxOutliers, // = 20; // Maximal number of outliers to remove final int maxOutliers, // = 20; // Maximal number of outliers to remove
final double strength_floor, // final double strength_floor,
final double strength_pow, // final double strength_pow,
final boolean smplMode, // = true; // Use sample mode (false - regular tile mode) final boolean smplMode, // = true; // Use sample mode (false - regular tile mode)
final int smplSide, // = 2; // Sample size (side of a square) final MeasuredLayersFilterParameters mlfp,
final int smplNum, // = 3; // Number after removing worst // final int smplSide, // = 2; // Sample size (side of a square)
final double smplRms, // = 0.1; // Maximal RMS of the remaining tiles in a sample // final int smplNum, // = 3; // Number after removing worst
final boolean smplWnd, // use window functions for the samples // final double smplRms, // = 0.1; // Maximal RMS of the remaining tiles in a sample
// final boolean smplWnd, // use window functions for the samples
final double max_abs_tilt, // 2.0; // pix per tile
final double max_rel_tilt, // 0.2; // (pix / disparity) per tile // final double max_abs_tilt, // 2.0; // pix per tile
final double damp_tilt, // 0.001; // Damp tilt to handle insufficient (co-linear)data // final double max_rel_tilt, // 0.2; // (pix / disparity) per tile
final double min_tilt_disp, // 4.0; // Disparity switch between filtering modes - near objects use tilts, far - use max disparity // final double damp_tilt, // 0.001; // Damp tilt to handle insufficient (co-linear)data
final double transition, // 1.0; // Mode transition range (between tilted and maximal disparity) // final double min_tilt_disp, // 4.0; // Disparity switch between filtering modes - near objects use tilts, far - use max disparity
final int far_mode, // 1; // Far objects filtering mode (0 - off, 1 - power of disparity) // final double transition, // 1.0; // Mode transition range (between tilted and maximal disparity)
final double far_power, // 3.0; // Raise disparity to this power before averaging for far objects // final int far_mode, // 1; // Far objects filtering mode (0 - off, 1 - power of disparity)
// final double far_power, // 3.0; // Raise disparity to this power before averaging for far objects
final int debugLevel, final int debugLevel,
final int dbg_X, final int dbg_X,
...@@ -6778,8 +6817,9 @@ public class SuperTiles{ ...@@ -6778,8 +6817,9 @@ public class SuperTiles{
stx, // int stX, stx, // int stX,
sty, // int stY, sty, // int stY,
null, // boolean [] sel_in, null, // boolean [] sel_in,
strength_floor, // double strength_floor, mlfp,
strength_pow, // double strength_pow, // strength_floor, // double strength_floor,
// strength_pow, // double strength_pow,
true); // boolean null_if_none); true); // boolean null_if_none);
if (dbg_disp_str != null){ if (dbg_disp_str != null){
boolean [] dbg_msel = planes[nsTile][np].getMeasSelection(ml); boolean [] dbg_msel = planes[nsTile][np].getMeasSelection(ml);
...@@ -6809,18 +6849,19 @@ public class SuperTiles{ ...@@ -6809,18 +6849,19 @@ public class SuperTiles{
non_exclusive, // boolean non_exclusive, non_exclusive, // boolean non_exclusive,
use_other_planes, // boolean use_other_planes, use_other_planes, // boolean use_other_planes,
smplMode, smplMode,
smplSide, mlfp,
smplNum, // smplSide,
smplRms, // smplNum,
smplWnd, // final boolean smplWnd, // use window functions for the samples // smplRms,
// smplWnd, // final boolean smplWnd, // use window functions for the samples
max_abs_tilt, // 2.0; // Maximal absolute tilt in pixels/tile
max_rel_tilt, // 0.2; // Maximal relative tilt in pixels/tile/disparity // max_abs_tilt, // 2.0; // Maximal absolute tilt in pixels/tile
damp_tilt, // 0.001; // Damp tilt to handle insufficient (co-linear)data // max_rel_tilt, // 0.2; // Maximal relative tilt in pixels/tile/disparity
min_tilt_disp, // 4.0; // Disparity switch between filtering modes - near objects use tilts, far - use max disparity // damp_tilt, // 0.001; // Damp tilt to handle insufficient (co-linear)data
transition, // 1.0; // Mode transition range (between tilted and maximal disparity) // min_tilt_disp, // 4.0; // Disparity switch between filtering modes - near objects use tilts, far - use max disparity
far_mode, // 1; // Far objects filtering mode (0 - off, 1 - power of disparity) // transition, // 1.0; // Mode transition range (between tilted and maximal disparity)
far_power, // 1.0; // Raise disparity to this power before averaging for far objects // far_mode, // 1; // Far objects filtering mode (0 - off, 1 - power of disparity)
// far_power, // 1.0; // Raise disparity to this power before averaging for far objects
measSel, // int measSel, // Select measurements for supertiles : +1 - combo, +2 - quad +4 - hor +8 - vert measSel, // int measSel, // Select measurements for supertiles : +1 - combo, +2 - quad +4 - hor +8 - vert
allow_parallel, //boolean allow_parallel, allow_parallel, //boolean allow_parallel,
...@@ -6853,22 +6894,23 @@ public class SuperTiles{ ...@@ -6853,22 +6894,23 @@ public class SuperTiles{
dispNorm, // double dispNorm, // Normalize disparities to the average if above dispNorm, // double dispNorm, // Normalize disparities to the average if above
min_weight, // double min_weight, min_weight, // double min_weight,
min_tiles, // int min_tiles, min_tiles, // int min_tiles,
strength_floor, // double strength_floor, // strength_floor, // double strength_floor,
strength_pow, // double strength_pow, // strength_pow, // double strength_pow,
// OK? // OK?
smplMode, smplMode,
smplSide, mlfp,
smplNum, // smplSide,
smplRms, // smplNum,
smplWnd, // final boolean smplWnd, // use window functions for the samples // smplRms,
// smplWnd, // final boolean smplWnd, // use window functions for the samples
max_abs_tilt, // 2.0; // Maximal absolute tilt in pixels/tile
max_rel_tilt, // 0.2; // Maximal relative tilt in pixels/tile/disparity // max_abs_tilt, // 2.0; // Maximal absolute tilt in pixels/tile
damp_tilt, // 0.001; // Damp tilt to handle insufficient (co-linear)data // max_rel_tilt, // 0.2; // Maximal relative tilt in pixels/tile/disparity
min_tilt_disp, // 4.0; // Disparity switch between filtering modes - near objects use tilts, far - use max disparity // damp_tilt, // 0.001; // Damp tilt to handle insufficient (co-linear)data
transition, // 1.0; // Mode transition range (between tilted and maximal disparity) // min_tilt_disp, // 4.0; // Disparity switch between filtering modes - near objects use tilts, far - use max disparity
far_mode, // 1; // Far objects filtering mode (0 - off, 1 - power of disparity) // transition, // 1.0; // Mode transition range (between tilted and maximal disparity)
far_power, // 1.0; // Raise disparity to this power before averaging for far objects // far_mode, // 1; // Far objects filtering mode (0 - off, 1 - power of disparity)
// far_power, // 1.0; // Raise disparity to this power before averaging for far objects
dl); // int debugLevel) dl); // int debugLevel)
if (disp_strength == null) break; if (disp_strength == null) break;
...@@ -6898,22 +6940,23 @@ public class SuperTiles{ ...@@ -6898,22 +6940,23 @@ public class SuperTiles{
dispNorm, // double dispNorm, // Normalize disparities to the average if above dispNorm, // double dispNorm, // Normalize disparities to the average if above
min_weight, // double min_weight, min_weight, // double min_weight,
min_tiles, // int min_tiles, min_tiles, // int min_tiles,
strength_floor, // double strength_floor, // strength_floor, // double strength_floor,
strength_pow, // double strength_pow, // strength_pow, // double strength_pow,
// OK? // OK?
smplMode, smplMode,
smplSide, mlfp,
smplNum, // smplSide,
smplRms, // smplNum,
smplWnd, // was not here: final boolean smplWnd, // use window functions for the samples // smplRms,
// smplWnd, // was not here: final boolean smplWnd, // use window functions for the samples
max_abs_tilt, // 2.0; // Maximal absolute tilt in pixels/tile
max_rel_tilt, // 0.2; // Maximal relative tilt in pixels/tile/disparity // max_abs_tilt, // 2.0; // Maximal absolute tilt in pixels/tile
damp_tilt, // 0.001; // Damp tilt to handle insufficient (co-linear)data // max_rel_tilt, // 0.2; // Maximal relative tilt in pixels/tile/disparity
min_tilt_disp, // 4.0; // Disparity switch between filtering modes - near objects use tilts, far - use max disparity // damp_tilt, // 0.001; // Damp tilt to handle insufficient (co-linear)data
transition, // 1.0; // Mode transition range (between tilted and maximal disparity) // min_tilt_disp, // 4.0; // Disparity switch between filtering modes - near objects use tilts, far - use max disparity
far_mode, // 1; // Far objects filtering mode (0 - off, 1 - power of disparity) // transition, // 1.0; // Mode transition range (between tilted and maximal disparity)
far_power, // 1.0; // Raise disparity to this power before averaging for far objects // far_mode, // 1; // Far objects filtering mode (0 - off, 1 - power of disparity)
// far_power, // 1.0; // Raise disparity to this power before averaging for far objects
dl); // int debugLevel) dl); // int debugLevel)
} }
...@@ -7982,8 +8025,9 @@ public class SuperTiles{ ...@@ -7982,8 +8025,9 @@ public class SuperTiles{
for (int ml = 0; ml < numMeasLayers; ml++) if ((stMeasSel & ( 1 << ml)) != 0) { for (int ml = 0; ml < numMeasLayers; ml++) if ((stMeasSel & ( 1 << ml)) != 0) {
ds[ml] = measuredLayers.getDisparityStrengthML ( ds[ml] = measuredLayers.getDisparityStrengthML (
ml, // int num_layer, ml, // int num_layer,
this.strength_floor, // double strength_floor, this.mlfp);
this.strength_pow); // double strength_pow) // this.mlfp.strength_floor, // double strength_floor,
// this.mlfp.strength_pow); // double strength_pow)
} }
return ds; return ds;
} }
......
...@@ -83,25 +83,28 @@ public class TilePlanes { ...@@ -83,25 +83,28 @@ public class TilePlanes {
MeasuredLayers measuredLayers = null; MeasuredLayers measuredLayers = null;
boolean [][] measuredSelection = null; // [number of layers in measuredLayers][2*superTileSize * 2*superTileSize] boolean [][] measuredSelection = null; // [number of layers in measuredLayers][2*superTileSize * 2*superTileSize]
boolean [] sel_mask = null; // selection mask - may be used for splitting plane along a line - each half can have mask boolean [] sel_mask = null; // selection mask - may be used for splitting plane along a line - each half can have mask
double measured_strength_pow = 1.0;
double strength_floor = 0.0;
double min_weight = 0.0; // minimal weight of the ellipsoid double min_weight = 0.0; // minimal weight of the ellipsoid
int min_tiles = 10; int min_tiles = 10;
double dispNorm = 5.0; // Normalize disparities to the average if above double dispNorm = 5.0; // Normalize disparities to the average if above
boolean smplMode = true; // Use sample mode (false - regular tile mode)
boolean smplMode = true; // Use sample mode (false - regular tile mode) MeasuredLayersFilterParameters mlfp = new MeasuredLayersFilterParameters(); // filter parameters
int smplSide = 2; // Sample size (side of a square)
int smplNum = 3; // Number after removing worst
double smplRms = 0.1; // Maximal RMS of the remaining tiles in a sample
boolean smplWnd = false; // Use sample mode (false - regular tile mode)
double max_abs_tilt = 2.0; // Maximal absolute tilt in pixels/tile // double measured_strength_pow = 1.0;
double max_rel_tilt = 0.2; // Maximal relative tilt in pixels/tile/disparity // double strength_floor = 0.0;
double damp_tilt = 0.001; // Damp tilt to handle insufficient (co-linear)data
double min_tilt_disp = 4.0; // Disparity switch between filtering modes - near objects use tilts, far - use max disparity // int smplSide = 2; // Sample size (side of a square)
double transition = 1.0; // Mode transition range (between tilted and maximal disparity) // int smplNum = 3; // Number after removing worst
int far_mode = 1; // Far objects filtering mode (0 - off, 1 - power of disparity) // double smplRms = 0.1; // Maximal RMS of the remaining tiles in a sample
double far_power = 1.0; // Raise disparity to this power before averaging for far objects // boolean smplWnd = false; // Use sample mode (false - regular tile mode)
// double max_abs_tilt = 2.0; // Maximal absolute tilt in pixels/tile
// double max_rel_tilt = 0.2; // Maximal relative tilt in pixels/tile/disparity
// double damp_tilt = 0.001; // Damp tilt to handle insufficient (co-linear)data
// double min_tilt_disp = 4.0; // Disparity switch between filtering modes - near objects use tilts, far - use max disparity
// double transition = 1.0; // Mode transition range (between tilted and maximal disparity)
// int far_mode = 1; // Far objects filtering mode (0 - off, 1 - power of disparity)
// double far_power = 1.0; // Raise disparity to this power before averaging for far objects
...@@ -157,25 +160,27 @@ public class TilePlanes { ...@@ -157,25 +160,27 @@ public class TilePlanes {
if (this.sel_mask != null) pd.sel_mask = this.sel_mask.clone(); if (this.sel_mask != null) pd.sel_mask = this.sel_mask.clone();
pd.measured_strength_pow = this.measured_strength_pow;
pd.strength_floor = this.strength_floor;
pd.min_weight = this.min_weight; pd.min_weight = this.min_weight;
pd.min_tiles = this.min_tiles; pd.min_tiles = this.min_tiles;
pd.dispNorm = this.dispNorm; pd.dispNorm = this.dispNorm;
pd.smplMode = this.smplMode; pd.smplMode = this.smplMode;
pd.smplSide = this.smplSide;
pd.smplNum = this.smplNum; pd.mlfp = this.mlfp.clone();
pd.smplRms = this.smplRms; // pd.measured_strength_pow = this.measured_strength_pow;
// pd.strength_floor = this.strength_floor;
pd.max_abs_tilt = this.max_abs_tilt;
pd.max_rel_tilt = this.max_rel_tilt; // pd.smplSide = this.smplSide;
pd.damp_tilt = this.damp_tilt; // pd.smplNum = this.smplNum;
pd.min_tilt_disp = this.min_tilt_disp; // pd.smplRms = this.smplRms;
pd.transition = this.transition;
pd.far_mode = this.far_mode; // pd.max_abs_tilt = this.max_abs_tilt;
pd.far_power = this.far_power; // pd.max_rel_tilt = this.max_rel_tilt;
// pd.damp_tilt = this.damp_tilt;
// pd.min_tilt_disp = this.min_tilt_disp;
// pd.transition = this.transition;
// pd.far_mode = this.far_mode;
// pd.far_power = this.far_power;
pd.preferDisparity = this.preferDisparity; pd.preferDisparity = this.preferDisparity;
...@@ -764,18 +769,20 @@ public class TilePlanes { ...@@ -764,18 +769,20 @@ public class TilePlanes {
boolean non_exclusive, boolean non_exclusive,
boolean use_other_planes, boolean use_other_planes,
boolean smplMode, // = true; // Use sample mode (false - regular tile mode) boolean smplMode, // = true; // Use sample mode (false - regular tile mode)
int smplSide, // = 2; // Sample size (side of a square)
int smplNum, // = 3; // Number after removing worst MeasuredLayersFilterParameters mlfp,
double smplRms, // = 0.1; // Maximal RMS of the remaining tiles in a sample // int smplSide, // = 2; // Sample size (side of a square)
boolean smplWnd, // use window functions for the samples // int smplNum, // = 3; // Number after removing worst
// double smplRms, // = 0.1; // Maximal RMS of the remaining tiles in a sample
double max_abs_tilt, // 2.0; // pix per tile // boolean smplWnd, // use window functions for the samples
double max_rel_tilt, // 0.2; // (pix / disparity) per tile
double damp_tilt, // 0.001; // Damp tilt to handle insufficient (co-linear)data // double max_abs_tilt, // 2.0; // pix per tile
double min_tilt_disp, // 4.0; // Disparity switch between filtering modes - near objects use tilts, far - use max disparity // double max_rel_tilt, // 0.2; // (pix / disparity) per tile
double transition, // 1.0; // Mode transition range (between tilted and maximal disparity) // double damp_tilt, // 0.001; // Damp tilt to handle insufficient (co-linear)data
int far_mode, // 1; // Far objects filtering mode (0 - off, 1 - power of disparity) // double min_tilt_disp, // 4.0; // Disparity switch between filtering modes - near objects use tilts, far - use max disparity
double far_power, // 3.0; // Raise disparity to this power before averaging for far objects // double transition, // 1.0; // Mode transition range (between tilted and maximal disparity)
// int far_mode, // 1; // Far objects filtering mode (0 - off, 1 - power of disparity)
// double far_power, // 3.0; // Raise disparity to this power before averaging for far objects
int measSel, // Select measurements for supertiles : +1 - combo, +2 - quad +4 - hor +8 - vert int measSel, // Select measurements for supertiles : +1 - combo, +2 - quad +4 - hor +8 - vert
boolean allow_parallel, boolean allow_parallel,
...@@ -813,19 +820,20 @@ public class TilePlanes { ...@@ -813,19 +820,20 @@ public class TilePlanes {
getSTileXY()[0], // int stX, getSTileXY()[0], // int stX,
getSTileXY()[1], // int stY, getSTileXY()[1], // int stY,
(single_plane ? null : measuredSelection[nl]), // boolean [] sel_in, (single_plane ? null : measuredSelection[nl]), // boolean [] sel_in,
strength_floor, mlfp,
measured_strength_pow, // // strength_floor,
smplSide, // = 2; // Sample size (side of a square) // measured_strength_pow, //
smplNum, // = 3; // Number after removing worst // smplSide, // = 2; // Sample size (side of a square)
smplRms, // = 0.1; // Maximal RMS of the remaining tiles in a sample // smplNum, // = 3; // Number after removing worst
smplWnd, // use window functions for the samples // smplRms, // = 0.1; // Maximal RMS of the remaining tiles in a sample
max_abs_tilt, // 2.0; // Maximal absolute tilt in pixels/tile // smplWnd, // use window functions for the samples
max_rel_tilt, // 0.2; // Maximal relative tilt in pixels/tile/disparity // max_abs_tilt, // 2.0; // Maximal absolute tilt in pixels/tile
damp_tilt, // 0.001; // Damp tilt to handle insufficient (co-linear)data // max_rel_tilt, // 0.2; // Maximal relative tilt in pixels/tile/disparity
min_tilt_disp, // 4.0; // Disparity switch between filtering modes - near objects use tilts, far - use max disparity // damp_tilt, // 0.001; // Damp tilt to handle insufficient (co-linear)data
transition, // 1.0; // Mode transition range (between tilted and maximal disparity) // min_tilt_disp, // 4.0; // Disparity switch between filtering modes - near objects use tilts, far - use max disparity
far_mode, // 1; // Far objects filtering mode (0 - off, 1 - power of disparity) // transition, // 1.0; // Mode transition range (between tilted and maximal disparity)
far_power, // 1.0; // Raise disparity to this power before averaging for far objects // far_mode, // 1; // Far objects filtering mode (0 - off, 1 - power of disparity)
// far_power, // 1.0; // Raise disparity to this power before averaging for far objects
true, // boolean null_if_none) true, // boolean null_if_none)
debugLevel); debugLevel);
} else { } else {
...@@ -834,8 +842,9 @@ public class TilePlanes { ...@@ -834,8 +842,9 @@ public class TilePlanes {
getSTileXY()[0], // int stX, getSTileXY()[0], // int stX,
getSTileXY()[1], // int stY, getSTileXY()[1], // int stY,
(single_plane ? null : measuredSelection[nl]), // boolean [] sel_in, (single_plane ? null : measuredSelection[nl]), // boolean [] sel_in,
strength_floor, // double strength_floor, mlfp,
measured_strength_pow, // double strength_pow, // strength_floor, // double strength_floor,
// measured_strength_pow, // double strength_pow,
true); // boolean null_if_none); true); // boolean null_if_none);
} }
if (disp_strength[nl] != null) { if (disp_strength[nl] != null) {
...@@ -946,19 +955,20 @@ public class TilePlanes { ...@@ -946,19 +955,20 @@ public class TilePlanes {
getSTileXY()[0], // int stX, getSTileXY()[0], // int stX,
getSTileXY()[1], // int stY, getSTileXY()[1], // int stY,
null, // boolean [] sel_in, null, // boolean [] sel_in,
strength_floor, mlfp,
measured_strength_pow, // // strength_floor,
smplSide, // = 2; // Sample size (side of a square) // measured_strength_pow, //
smplNum, // = 3; // Number after removing worst // smplSide, // = 2; // Sample size (side of a square)
smplRms, // = 0.1; // Maximal RMS of the remaining tiles in a sample // smplNum, // = 3; // Number after removing worst
smplWnd, // use window functions for the samples // smplRms, // = 0.1; // Maximal RMS of the remaining tiles in a sample
max_abs_tilt, // 2.0; // Maximal absolute tilt in pixels/tile // smplWnd, // use window functions for the samples
max_rel_tilt, // 0.2; // Maximal relative tilt in pixels/tile/disparity // max_abs_tilt, // 2.0; // Maximal absolute tilt in pixels/tile
damp_tilt, // 0.001; // Damp tilt to handle insufficient (co-linear)data // max_rel_tilt, // 0.2; // Maximal relative tilt in pixels/tile/disparity
min_tilt_disp, // 4.0; // Disparity switch between filtering modes - near objects use tilts, far - use max disparity // damp_tilt, // 0.001; // Damp tilt to handle insufficient (co-linear)data
transition, // 1.0; // Mode transition range (between tilted and maximal disparity) // min_tilt_disp, // 4.0; // Disparity switch between filtering modes - near objects use tilts, far - use max disparity
far_mode, // 1; // Far objects filtering mode (0 - off, 1 - power of disparity) // transition, // 1.0; // Mode transition range (between tilted and maximal disparity)
far_power, // 1.0; // Raise disparity to this power before averaging for far objects // far_mode, // 1; // Far objects filtering mode (0 - off, 1 - power of disparity)
// far_power, // 1.0; // Raise disparity to this power before averaging for far objects
true, // boolean null_if_none) true, // boolean null_if_none)
debugLevel); debugLevel);
} else { } else {
...@@ -967,8 +977,9 @@ public class TilePlanes { ...@@ -967,8 +977,9 @@ public class TilePlanes {
getSTileXY()[0], // int stX, getSTileXY()[0], // int stX,
getSTileXY()[1], // int stY, getSTileXY()[1], // int stY,
null, // boolean [] sel_in, null, // boolean [] sel_in,
strength_floor, // double strength_floor, mlfp,
measured_strength_pow, // double strength_pow, // strength_floor, // double strength_floor,
// measured_strength_pow, // double strength_pow,
true); // boolean null_if_none); true); // boolean null_if_none);
} }
//disp_strength[nl] = measuredLayers.getDisparityStrengthML( //disp_strength[nl] = measuredLayers.getDisparityStrengthML(
...@@ -1204,20 +1215,21 @@ public class TilePlanes { ...@@ -1204,20 +1215,21 @@ public class TilePlanes {
sTileXY[0], // int stX, sTileXY[0], // int stX,
sTileXY[1], // int stY, sTileXY[1], // int stY,
null, // measuredSelection[nl], // boolean [] sel_in, null, // measuredSelection[nl], // boolean [] sel_in,
strength_floor, this.mlfp,
measured_strength_pow, // // strength_floor,
smplSide, // = 2; // Sample size (side of a square) // measured_strength_pow, //
smplNum, // = 3; // Number after removing worst // smplSide, // = 2; // Sample size (side of a square)
smplRms, // = 0.1; // Maximal RMS of the remaining tiles in a sample // smplNum, // = 3; // Number after removing worst
smplWnd, // use window functions for the samples // smplRms, // = 0.1; // Maximal RMS of the remaining tiles in a sample
// smplWnd, // use window functions for the samples
max_abs_tilt, // 2.0; // Maximal absolute tilt in pixels/tile
max_rel_tilt, // 0.2; // Maximal relative tilt in pixels/tile/disparity // max_abs_tilt, // 2.0; // Maximal absolute tilt in pixels/tile
damp_tilt, // 0.001; // Damp tilt to handle insufficient (co-linear)data // max_rel_tilt, // 0.2; // Maximal relative tilt in pixels/tile/disparity
min_tilt_disp, // 4.0; // Disparity switch between filtering modes - near objects use tilts, far - use max disparity // damp_tilt, // 0.001; // Damp tilt to handle insufficient (co-linear)data
transition, // 1.0; // Mode transition range (between tilted and maximal disparity) // min_tilt_disp, // 4.0; // Disparity switch between filtering modes - near objects use tilts, far - use max disparity
far_mode, // 1; // Far objects filtering mode (0 - off, 1 - power of disparity) // transition, // 1.0; // Mode transition range (between tilted and maximal disparity)
far_power, // 1.0; // Raise disparity to this power before averaging for far objects // far_mode, // 1; // Far objects filtering mode (0 - off, 1 - power of disparity)
// far_power, // 1.0; // Raise disparity to this power before averaging for far objects
true, // boolean null_if_none) true, // boolean null_if_none)
debugLevel); debugLevel);
...@@ -1228,8 +1240,9 @@ public class TilePlanes { ...@@ -1228,8 +1240,9 @@ public class TilePlanes {
sTileXY[0], // int stX, sTileXY[0], // int stX,
sTileXY[1], // int stY, sTileXY[1], // int stY,
null, // measuredSelection[nl], // boolean [] sel_in, null, // measuredSelection[nl], // boolean [] sel_in,
strength_floor, // this.mlfp,
measured_strength_pow, // // strength_floor, //
// measured_strength_pow, //
true); // boolean null_if_none) true); // boolean null_if_none)
} }
} }
...@@ -1291,20 +1304,22 @@ public class TilePlanes { ...@@ -1291,20 +1304,22 @@ public class TilePlanes {
this.dispNorm, // double dispNorm, // Normalize disparities to the average if above this.dispNorm, // double dispNorm, // Normalize disparities to the average if above
this.min_weight, // double min_weight, this.min_weight, // double min_weight,
this.min_tiles, // int min_tiles, this.min_tiles, // int min_tiles,
strength_floor, // strength_floor,
measured_strength_pow, // double strength_pow, // measured_strength_pow, // double strength_pow,
smplMode, this.smplMode,
smplSide, this.mlfp,
smplNum,
smplRms, // smplSide,
smplWnd, // use window functions for the samples // smplNum,
max_abs_tilt, // 2.0; // Maximal absolute tilt in pixels/tile // smplRms,
max_rel_tilt, // 0.2; // Maximal relative tilt in pixels/tile/disparity // smplWnd, // use window functions for the samples
damp_tilt, // 0.001; // Damp tilt to handle insufficient (co-linear)data // max_abs_tilt, // 2.0; // Maximal absolute tilt in pixels/tile
min_tilt_disp, // 4.0; // Disparity switch between filtering modes - near objects use tilts, far - use max disparity // max_rel_tilt, // 0.2; // Maximal relative tilt in pixels/tile/disparity
transition, // 1.0; // Mode transition range (between tilted and maximal disparity) // damp_tilt, // 0.001; // Damp tilt to handle insufficient (co-linear)data
far_mode, // 1; // Far objects filtering mode (0 - off, 1 - power of disparity) // min_tilt_disp, // 4.0; // Disparity switch between filtering modes - near objects use tilts, far - use max disparity
far_power, // 1.0; // Raise disparity to this power before averaging for far objects // transition, // 1.0; // Mode transition range (between tilted and maximal disparity)
// far_mode, // 1; // Far objects filtering mode (0 - off, 1 - power of disparity)
// far_power, // 1.0; // Raise disparity to this power before averaging for far objects
debugLevel-1) != null); debugLevel-1) != null);
if (!OK){ // restore last selection, re-run getPlaneFromMeas if (!OK){ // restore last selection, re-run getPlaneFromMeas
...@@ -1317,20 +1332,21 @@ public class TilePlanes { ...@@ -1317,20 +1332,21 @@ public class TilePlanes {
this.dispNorm, // double dispNorm, // Normalize disparities to the average if above this.dispNorm, // double dispNorm, // Normalize disparities to the average if above
this.min_weight, // double min_weight, this.min_weight, // double min_weight,
this.min_tiles, // int min_tiles, this.min_tiles, // int min_tiles,
strength_floor, // strength_floor,
measured_strength_pow, // double strength_pow, // measured_strength_pow, // double strength_pow,
smplMode, this.smplMode,
smplSide, this.mlfp,
smplNum, // smplSide,
smplRms, // smplNum,
smplWnd, // use window functions for the samples // smplRms,
max_abs_tilt, // 2.0; // Maximal absolute tilt in pixels/tile // smplWnd, // use window functions for the samples
max_rel_tilt, // 0.2; // Maximal relative tilt in pixels/tile/disparity // max_abs_tilt, // 2.0; // Maximal absolute tilt in pixels/tile
damp_tilt, // 0.001; // Damp tilt to handle insufficient (co-linear)data // max_rel_tilt, // 0.2; // Maximal relative tilt in pixels/tile/disparity
min_tilt_disp, // 4.0; // Disparity switch between filtering modes - near objects use tilts, far - use max disparity // damp_tilt, // 0.001; // Damp tilt to handle insufficient (co-linear)data
transition, // 1.0; // Mode transition range (between tilted and maximal disparity) // min_tilt_disp, // 4.0; // Disparity switch between filtering modes - near objects use tilts, far - use max disparity
far_mode, // 1; // Far objects filtering mode (0 - off, 1 - power of disparity) // transition, // 1.0; // Mode transition range (between tilted and maximal disparity)
far_power, // 1.0; // Raise disparity to this power before averaging for far objects // far_mode, // 1; // Far objects filtering mode (0 - off, 1 - power of disparity)
// far_power, // 1.0; // Raise disparity to this power before averaging for far objects
debugLevel-1) != null); debugLevel-1) != null);
if (!OK) { if (!OK) {
System.out.println("This is a BUG in removePlaneOutliers() - run with previous selection and failed"); System.out.println("This is a BUG in removePlaneOutliers() - run with previous selection and failed");
...@@ -1377,21 +1393,23 @@ public class TilePlanes { ...@@ -1377,21 +1393,23 @@ public class TilePlanes {
double dispNorm, // Normalize disparities to the average if above double dispNorm, // Normalize disparities to the average if above
double min_weight, double min_weight,
int min_tiles, int min_tiles,
double strength_floor, // double strength_floor,
double strength_pow, // double strength_pow,
boolean smplMode, // = true; // Use sample mode (false - regular tile mode) boolean smplMode, // = true; // Use sample mode (false - regular tile mode)
int smplSide, // = 2; // Sample size (side of a square) MeasuredLayersFilterParameters mlfp,
int smplNum, // = 3; // Number after removing worst
double smplRms, // = 0.1; // Maximal RMS of the remaining tiles in a sample // int smplSide, // = 2; // Sample size (side of a square)
boolean smplWnd, // use window functions for the samples // int smplNum, // = 3; // Number after removing worst
// double smplRms, // = 0.1; // Maximal RMS of the remaining tiles in a sample
double max_abs_tilt, // 2.0; // pix per tile // boolean smplWnd, // use window functions for the samples
double max_rel_tilt, // 0.2; // (pix / disparity) per tile
double damp_tilt, // 0.001; // Damp tilt to handle insufficient (co-linear)data // double max_abs_tilt, // 2.0; // pix per tile
double min_tilt_disp, // 4.0; // Disparity switch between filtering modes - near objects use tilts, far - use max disparity // double max_rel_tilt, // 0.2; // (pix / disparity) per tile
double transition, // 1.0; // Mode transition range (between tilted and maximal disparity) // double damp_tilt, // 0.001; // Damp tilt to handle insufficient (co-linear)data
int far_mode, // 1; // Far objects filtering mode (0 - off, 1 - power of disparity) // double min_tilt_disp, // 4.0; // Disparity switch between filtering modes - near objects use tilts, far - use max disparity
double far_power, // 3.0; // Raise disparity to this power before averaging for far objects // double transition, // 1.0; // Mode transition range (between tilted and maximal disparity)
// int far_mode, // 1; // Far objects filtering mode (0 - off, 1 - power of disparity)
// double far_power, // 3.0; // Raise disparity to this power before averaging for far objects
int debugLevel) int debugLevel)
{ {
...@@ -1405,24 +1423,26 @@ public class TilePlanes { ...@@ -1405,24 +1423,26 @@ public class TilePlanes {
tile_sel = this.measuredSelection; tile_sel = this.measuredSelection;
} }
this.strength_floor = strength_floor; // this.strength_floor = strength_floor;
this.measured_strength_pow = strength_pow; // this.measured_strength_pow = strength_pow;
this.min_weight = min_weight; this.min_weight = min_weight;
this.min_tiles = min_tiles; this.min_tiles = min_tiles;
this.dispNorm = dispNorm; this.dispNorm = dispNorm;
this.smplWnd = smplWnd; // use window functions for the samples // this.smplWnd = smplWnd; // use window functions for the samples
this.smplMode = smplMode; // = true; // Use sample mode (false - regular tile mode) this.smplMode = smplMode; // = true; // Use sample mode (false - regular tile mode)
this.smplSide = smplSide; // = 2; // Sample size (side of a square) // this.smplSide = smplSide; // = 2; // Sample size (side of a square)
this.smplNum = smplNum; // = 3; // Number after removing worst // this.smplNum = smplNum; // = 3; // Number after removing worst
this.smplRms = smplRms; // = 0.1; // Maximal RMS of the remaining tiles in a sample // this.smplRms = smplRms; // = 0.1; // Maximal RMS of the remaining tiles in a sample
// this.max_abs_tilt = max_abs_tilt;
// this.max_rel_tilt = max_rel_tilt;
// this.damp_tilt = damp_tilt;
// this.min_tilt_disp = min_tilt_disp;
// this.transition = transition;
// this.far_mode = far_mode;
// this.far_power = far_power;
this.max_abs_tilt = max_abs_tilt; this.mlfp = mlfp.clone();
this.max_rel_tilt = max_rel_tilt;
this.damp_tilt = damp_tilt;
this.min_tilt_disp = min_tilt_disp;
this.transition = transition;
this.far_mode = far_mode;
this.far_power = far_power;
if (debugLevel > 2){ if (debugLevel > 2){
...@@ -1443,19 +1463,20 @@ public class TilePlanes { ...@@ -1443,19 +1463,20 @@ public class TilePlanes {
sTileXY[1], // int stY, sTileXY[1], // int stY,
((tile_sel[nl].length == 0)? null:tile_sel[nl]), // boolean [] sel_in, ((tile_sel[nl].length == 0)? null:tile_sel[nl]), // boolean [] sel_in,
//tile_sel[nl], // boolean [] sel_in, //tile_sel[nl], // boolean [] sel_in,
strength_floor, mlfp,
strength_pow, // // strength_floor,
smplSide, // = 2; // Sample size (side of a square) // strength_pow, //
smplNum, // = 3; // Number after removing worst // smplSide, // = 2; // Sample size (side of a square)
smplRms, // = 0.1; // Maximal RMS of the remaining tiles in a sample // smplNum, // = 3; // Number after removing worst
smplWnd, // final boolean smplWnd, // use window functions fro the samples // smplRms, // = 0.1; // Maximal RMS of the remaining tiles in a sample
max_abs_tilt, // 2.0; // Maximal absolute tilt in pixels/tile // smplWnd, // final boolean smplWnd, // use window functions fro the samples
max_rel_tilt, // 0.2; // Maximal relative tilt in pixels/tile/disparity // max_abs_tilt, // 2.0; // Maximal absolute tilt in pixels/tile
damp_tilt, // 0.001; // Damp tilt to handle insufficient (co-linear)data // max_rel_tilt, // 0.2; // Maximal relative tilt in pixels/tile/disparity
min_tilt_disp, // 4.0; // Disparity switch between filtering modes - near objects use tilts, far - use max disparity // damp_tilt, // 0.001; // Damp tilt to handle insufficient (co-linear)data
transition, // 1.0; // Mode transition range (between tilted and maximal disparity) // min_tilt_disp, // 4.0; // Disparity switch between filtering modes - near objects use tilts, far - use max disparity
far_mode, // 1; // Far objects filtering mode (0 - off, 1 - power of disparity) // transition, // 1.0; // Mode transition range (between tilted and maximal disparity)
far_power, // 1.0; // Raise disparity to this power before averaging for far objects // far_mode, // 1; // Far objects filtering mode (0 - off, 1 - power of disparity)
// far_power, // 1.0; // Raise disparity to this power before averaging for far objects
true, // boolean null_if_none) true, // boolean null_if_none)
debugLevel); debugLevel);
} }
...@@ -1483,7 +1504,7 @@ public class TilePlanes { ...@@ -1483,7 +1504,7 @@ public class TilePlanes {
sTileXY[0], // int stX, sTileXY[0], // int stX,
sTileXY[1], // int stY, sTileXY[1], // int stY,
((tile_sel[nl].length == 0)? null:tile_sel[nl]), // boolean [] sel_in, ((tile_sel[nl].length == 0)? null:tile_sel[nl]), // boolean [] sel_in,
strength_floor, mlfp.strength_floor,
true); // boolean null_if_none) true); // boolean null_if_none)
} else { } else {
tile_sel[nl] = measuredLayers.getSupertileSelection( tile_sel[nl] = measuredLayers.getSupertileSelection(
...@@ -1493,7 +1514,7 @@ public class TilePlanes { ...@@ -1493,7 +1514,7 @@ public class TilePlanes {
((tile_sel[nl].length == 0)? null:tile_sel[nl]), // boolean [] sel_in, ((tile_sel[nl].length == 0)? null:tile_sel[nl]), // boolean [] sel_in,
disp_far, // double disp_far, disp_far, // double disp_far,
disp_near, // double disp_near, disp_near, // double disp_near,
strength_floor, mlfp.strength_floor,
true); // boolean null_if_none) true); // boolean null_if_none)
} }
...@@ -1504,8 +1525,9 @@ public class TilePlanes { ...@@ -1504,8 +1525,9 @@ public class TilePlanes {
sTileXY[0], // int stX, sTileXY[0], // int stX,
sTileXY[1], // int stY, sTileXY[1], // int stY,
tile_sel[nl], // boolean [] sel_in, tile_sel[nl], // boolean [] sel_in,
strength_floor, mlfp,
strength_pow, // // strength_floor,
// strength_pow, //
true); // boolean null_if_none) true); // boolean null_if_none)
sw += MeasuredLayers.getSumStrength(disp_str[nl]); sw += MeasuredLayers.getSumStrength(disp_str[nl]);
} }
...@@ -1711,23 +1733,26 @@ public class TilePlanes { ...@@ -1711,23 +1733,26 @@ public class TilePlanes {
double dispNorm, // Normalize disparities to the average if above double dispNorm, // Normalize disparities to the average if above
double min_weight, double min_weight,
int min_tiles, int min_tiles,
double strength_floor,
double strength_pow, // double strength_floor,
// double strength_pow,
boolean smplMode, // = true; // Use sample mode (false - regular tile mode) boolean smplMode, // = true; // Use sample mode (false - regular tile mode)
int smplSide, // = 2; // Sample size (side of a square) MeasuredLayersFilterParameters mlfp,
int smplNum, // = 3; // Number after removing worst
double smplRms, // = 0.1; // Maximal RMS of the remaining tiles in a sample
/* was not here */boolean smplWnd, // use window functions for the samples // int smplSide, // = 2; // Sample size (side of a square)
// int smplNum, // = 3; // Number after removing worst
// double smplRms, // = 0.1; // Maximal RMS of the remaining tiles in a sample
double max_abs_tilt, // 2.0; // pix per tile ///* was not here */boolean smplWnd, // use window functions for the samples
double max_rel_tilt, // 0.2; // (pix / disparity) per tile
double damp_tilt, // 0.001; // Damp tilt to handle insufficient (co-linear)data // double max_abs_tilt, // 2.0; // pix per tile
double min_tilt_disp, // 4.0; // Disparity switch between filtering modes - near objects use tilts, far - use max disparity // double max_rel_tilt, // 0.2; // (pix / disparity) per tile
double transition, // 1.0; // Mode transition range (between tilted and maximal disparity) // double damp_tilt, // 0.001; // Damp tilt to handle insufficient (co-linear)data
int far_mode, // 1; // Far objects filtering mode (0 - off, 1 - power of disparity) // double min_tilt_disp, // 4.0; // Disparity switch between filtering modes - near objects use tilts, far - use max disparity
double far_power, // 3.0; // Raise disparity to this power before averaging for far objects // double transition, // 1.0; // Mode transition range (between tilted and maximal disparity)
// int far_mode, // 1; // Far objects filtering mode (0 - off, 1 - power of disparity)
// double far_power, // 3.0; // Raise disparity to this power before averaging for far objects
int debugLevel) int debugLevel)
{ {
...@@ -1741,25 +1766,26 @@ public class TilePlanes { ...@@ -1741,25 +1766,26 @@ public class TilePlanes {
tile_sel = this.measuredSelection; tile_sel = this.measuredSelection;
} }
this.strength_floor = strength_floor; // this.strength_floor = strength_floor;
this.measured_strength_pow = strength_pow; // this.measured_strength_pow = strength_pow;
this.min_weight = min_weight; this.min_weight = min_weight;
this.min_tiles = min_tiles; this.min_tiles = min_tiles;
this.dispNorm = dispNorm; this.dispNorm = dispNorm;
this.smplMode = smplMode; // = true; // Use sample mode (false - regular tile mode) this.smplMode = smplMode; // = true; // Use sample mode (false - regular tile mode)
this.smplSide = smplSide; // = 2; // Sample size (side of a square) // this.smplSide = smplSide; // = 2; // Sample size (side of a square)
this.smplNum = smplNum; // = 3; // Number after removing worst // this.smplNum = smplNum; // = 3; // Number after removing worst
this.smplRms = smplRms; // = 0.1; // Maximal RMS of the remaining tiles in a sample // this.smplRms = smplRms; // = 0.1; // Maximal RMS of the remaining tiles in a sample
this.smplWnd = smplWnd; // was not here ! // this.smplWnd = smplWnd; // was not here !
this.max_abs_tilt = max_abs_tilt; // this.max_abs_tilt = max_abs_tilt;
this.max_rel_tilt = max_rel_tilt; // this.max_rel_tilt = max_rel_tilt;
this.damp_tilt = damp_tilt; // this.damp_tilt = damp_tilt;
this.min_tilt_disp = min_tilt_disp; // this.min_tilt_disp = min_tilt_disp;
this.transition = transition; // this.transition = transition;
this.far_mode = far_mode; // this.far_mode = far_mode;
this.far_power = far_power; // this.far_power = far_power;
this.mlfp = mlfp.clone();
if (debugLevel > 2){ if (debugLevel > 2){
System.out.println("getWorldPlaneFromMeas()"); System.out.println("getWorldPlaneFromMeas()");
...@@ -1780,19 +1806,20 @@ public class TilePlanes { ...@@ -1780,19 +1806,20 @@ public class TilePlanes {
sTileXY[1], // int stY, sTileXY[1], // int stY,
((tile_sel[nl].length == 0)? null:tile_sel[nl]), // boolean [] sel_in, ((tile_sel[nl].length == 0)? null:tile_sel[nl]), // boolean [] sel_in,
//tile_sel[nl], // boolean [] sel_in, //tile_sel[nl], // boolean [] sel_in,
strength_floor, mlfp,
strength_pow, // // strength_floor,
smplSide, // = 2; // Sample size (side of a square) // strength_pow, //
smplNum, // = 3; // Number after removing worst // smplSide, // = 2; // Sample size (side of a square)
smplRms, // = 0.1; // Maximal RMS of the remaining tiles in a sample // smplNum, // = 3; // Number after removing worst
/*was using this. */ smplWnd, // use window functions for the samples // smplRms, // = 0.1; // Maximal RMS of the remaining tiles in a sample
max_abs_tilt, // 2.0; // Maximal absolute tilt in pixels/tile ///*was using this. */ smplWnd, // use window functions for the samples
max_rel_tilt, // 0.2; // Maximal relative tilt in pixels/tile/disparity // max_abs_tilt, // 2.0; // Maximal absolute tilt in pixels/tile
damp_tilt, // 0.001; // Damp tilt to handle insufficient (co-linear)data // max_rel_tilt, // 0.2; // Maximal relative tilt in pixels/tile/disparity
min_tilt_disp, // 4.0; // Disparity switch between filtering modes - near objects use tilts, far - use max disparity // damp_tilt, // 0.001; // Damp tilt to handle insufficient (co-linear)data
transition, // 1.0; // Mode transition range (between tilted and maximal disparity) // min_tilt_disp, // 4.0; // Disparity switch between filtering modes - near objects use tilts, far - use max disparity
far_mode, // 1; // Far objects filtering mode (0 - off, 1 - power of disparity) // transition, // 1.0; // Mode transition range (between tilted and maximal disparity)
far_power, // 1.0; // Raise disparity to this power before averaging for far objects // far_mode, // 1; // Far objects filtering mode (0 - off, 1 - power of disparity)
// far_power, // 1.0; // Raise disparity to this power before averaging for far objects
true, // boolean null_if_none) true, // boolean null_if_none)
debugLevel); debugLevel);
} }
...@@ -1820,7 +1847,7 @@ public class TilePlanes { ...@@ -1820,7 +1847,7 @@ public class TilePlanes {
sTileXY[0], // int stX, sTileXY[0], // int stX,
sTileXY[1], // int stY, sTileXY[1], // int stY,
((tile_sel[nl].length == 0)? null:tile_sel[nl]), // boolean [] sel_in, ((tile_sel[nl].length == 0)? null:tile_sel[nl]), // boolean [] sel_in,
strength_floor, mlfp.strength_floor,
true); // boolean null_if_none) true); // boolean null_if_none)
} else { } else {
tile_sel[nl] = measuredLayers.getSupertileSelection( tile_sel[nl] = measuredLayers.getSupertileSelection(
...@@ -1830,7 +1857,7 @@ public class TilePlanes { ...@@ -1830,7 +1857,7 @@ public class TilePlanes {
((tile_sel[nl].length == 0)? null:tile_sel[nl]), // boolean [] sel_in, ((tile_sel[nl].length == 0)? null:tile_sel[nl]), // boolean [] sel_in,
disp_far, // double disp_far, disp_far, // double disp_far,
disp_near, // double disp_near, disp_near, // double disp_near,
strength_floor, mlfp.strength_floor,
true); // boolean null_if_none) true); // boolean null_if_none)
} }
...@@ -1841,8 +1868,9 @@ public class TilePlanes { ...@@ -1841,8 +1868,9 @@ public class TilePlanes {
sTileXY[0], // int stX, sTileXY[0], // int stX,
sTileXY[1], // int stY, sTileXY[1], // int stY,
tile_sel[nl], // boolean [] sel_in, tile_sel[nl], // boolean [] sel_in,
strength_floor, mlfp,
strength_pow, // // strength_floor,
// strength_pow, //
true); // boolean null_if_none) true); // boolean null_if_none)
sw += MeasuredLayers.getSumStrength(disp_str[nl]); sw += MeasuredLayers.getSumStrength(disp_str[nl]);
} }
...@@ -3983,22 +4011,25 @@ public class TilePlanes { ...@@ -3983,22 +4011,25 @@ public class TilePlanes {
double plTargetEigen, // = 0.1; // Remove outliers until main axis eigenvalue (possibly scaled by plDispNorm) gets below double plTargetEigen, // = 0.1; // Remove outliers until main axis eigenvalue (possibly scaled by plDispNorm) gets below
double plFractOutliers, // = 0.3; // Maximal fraction of outliers to remove double plFractOutliers, // = 0.3; // Maximal fraction of outliers to remove
int plMaxOutliers, // = 20; // Maximal number of outliers to remove int plMaxOutliers, // = 20; // Maximal number of outliers to remove
double strength_floor, // double strength_floor,
double strength_pow, // double strength_pow,
boolean correct_distortions, boolean correct_distortions,
boolean smplMode, // = true; // Use sample mode (false - regular tile mode) boolean smplMode, // = true; // Use sample mode (false - regular tile mode)
int smplSide, // = 2; // Sample size (side of a square)
int smplNum, // = 3; // Number after removing worst MeasuredLayersFilterParameters mlfp,
double smplRms, // = 0.1; // Maximal RMS of the remaining tiles in a sample
boolean smplWnd, // use window functions for the samples // int smplSide, // = 2; // Sample size (side of a square)
// int smplNum, // = 3; // Number after removing worst
double max_abs_tilt, // 2.0; // pix per tile // double smplRms, // = 0.1; // Maximal RMS of the remaining tiles in a sample
double max_rel_tilt, // 0.2; // (pix / disparity) per tile // boolean smplWnd, // use window functions for the samples
double damp_tilt, // 0.001; // Damp tilt to handle insufficient (co-linear)data
double min_tilt_disp, // 4.0; // Disparity switch between filtering modes - near objects use tilts, far - use max disparity // double max_abs_tilt, // 2.0; // pix per tile
double transition, // 1.0; // Mode transition range (between tilted and maximal disparity) // double max_rel_tilt, // 0.2; // (pix / disparity) per tile
int far_mode, // 1; // Far objects filtering mode (0 - off, 1 - power of disparity) // double damp_tilt, // 0.001; // Damp tilt to handle insufficient (co-linear)data
double far_power, // 3.0; // Raise disparity to this power before averaging for far objects // double min_tilt_disp, // 4.0; // Disparity switch between filtering modes - near objects use tilts, far - use max disparity
// double transition, // 1.0; // Mode transition range (between tilted and maximal disparity)
// int far_mode, // 1; // Far objects filtering mode (0 - off, 1 - power of disparity)
// double far_power, // 3.0; // Raise disparity to this power before averaging for far objects
int debugLevel) int debugLevel)
{ {
...@@ -4021,23 +4052,24 @@ public class TilePlanes { ...@@ -4021,23 +4052,24 @@ public class TilePlanes {
0.0, // double min_weight, 0.0, // double min_weight,
min_tiles, // int min_tiles, min_tiles, // int min_tiles,
strength_floor, // // strength_floor, //
strength_pow, // double strength_pow, // strength_pow, // double strength_pow,
// update ! // update !
smplMode, smplMode,
smplSide, mlfp,
smplNum, // smplSide,
smplRms, // smplNum,
smplWnd, // use window functions for the samples // smplRms,
// smplWnd, // use window functions for the samples
max_abs_tilt, // 2.0; // Maximal absolute tilt in pixels/tile
max_rel_tilt, // 0.2; // Maximal relative tilt in pixels/tile/disparity // max_abs_tilt, // 2.0; // Maximal absolute tilt in pixels/tile
damp_tilt, // 0.001; // Damp tilt to handle insufficient (co-linear)data // max_rel_tilt, // 0.2; // Maximal relative tilt in pixels/tile/disparity
min_tilt_disp, // 4.0; // Disparity switch between filtering modes - near objects use tilts, far - use max disparity // damp_tilt, // 0.001; // Damp tilt to handle insufficient (co-linear)data
transition, // 1.0; // Mode transition range (between tilted and maximal disparity) // min_tilt_disp, // 4.0; // Disparity switch between filtering modes - near objects use tilts, far - use max disparity
far_mode, // 1; // Far objects filtering mode (0 - off, 1 - power of disparity) // transition, // 1.0; // Mode transition range (between tilted and maximal disparity)
far_power, // 1.0; // Raise disparity to this power before averaging for far objects // far_mode, // 1; // Far objects filtering mode (0 - off, 1 - power of disparity)
// far_power, // 1.0; // Raise disparity to this power before averaging for far objects
debugLevel) != null); // int debugLevel) debugLevel) != null); // int debugLevel)
if (OK) { if (OK) {
...@@ -4102,23 +4134,25 @@ public class TilePlanes { ...@@ -4102,23 +4134,25 @@ public class TilePlanes {
dispNorm, // 0.0, // plDispNorm, // double dispNorm, // Normalize disparities to the average if above dispNorm, // 0.0, // plDispNorm, // double dispNorm, // Normalize disparities to the average if above
0.0, // double min_weight, 0.0, // double min_weight,
min_tiles, // int min_tiles, min_tiles, // int min_tiles,
strength_floor, // // strength_floor, //
strength_pow, // double strength_pow, // strength_pow, // double strength_pow,
// update ! // update !
smplMode, smplMode,
smplSide, mlfp,
smplNum,
smplRms, // smplSide,
// smplNum,
// smplRms,
smplWnd, // use window functions for the samples // smplWnd, // use window functions for the samples
max_abs_tilt, // 2.0; // Maximal absolute tilt in pixels/tile // max_abs_tilt, // 2.0; // Maximal absolute tilt in pixels/tile
max_rel_tilt, // 0.2; // Maximal relative tilt in pixels/tile/disparity // max_rel_tilt, // 0.2; // Maximal relative tilt in pixels/tile/disparity
damp_tilt, // 0.001; // Damp tilt to handle insufficient (co-linear)data // damp_tilt, // 0.001; // Damp tilt to handle insufficient (co-linear)data
min_tilt_disp, // 4.0; // Disparity switch between filtering modes - near objects use tilts, far - use max disparity // min_tilt_disp, // 4.0; // Disparity switch between filtering modes - near objects use tilts, far - use max disparity
transition, // 1.0; // Mode transition range (between tilted and maximal disparity) // transition, // 1.0; // Mode transition range (between tilted and maximal disparity)
far_mode, // 1; // Far objects filtering mode (0 - off, 1 - power of disparity) // far_mode, // 1; // Far objects filtering mode (0 - off, 1 - power of disparity)
far_power, // 1.0; // Raise disparity to this power before averaging for far objects // far_power, // 1.0; // Raise disparity to this power before averaging for far objects
debugLevel); debugLevel);
...@@ -4144,18 +4178,20 @@ public class TilePlanes { ...@@ -4144,18 +4178,20 @@ public class TilePlanes {
final int stMeasSel, // = 1; // Select measurements for supertiles : +1 - combo, +2 - quad +4 - hor +8 - vert final int stMeasSel, // = 1; // Select measurements for supertiles : +1 - combo, +2 - quad +4 - hor +8 - vert
final boolean smplMode, // = true; // Use sample mode (false - regular tile mode) final boolean smplMode, // = true; // Use sample mode (false - regular tile mode)
final int smplSide, // = 2; // Sample size (side of a square) final MeasuredLayersFilterParameters mlfp,
final int smplNum, // = 3; // Number after removing worst
final double smplRms, // = 0.1; // Maximal RMS of the remaining tiles in a sample // final int smplSide, // = 2; // Sample size (side of a square)
final boolean smplWnd, // use window functions for the samples // final int smplNum, // = 3; // Number after removing worst
// final double smplRms, // = 0.1; // Maximal RMS of the remaining tiles in a sample
final double max_abs_tilt, // 2.0; // pix per tile // final boolean smplWnd, // use window functions for the samples
final double max_rel_tilt, // 0.2; // (pix / disparity) per tile
final double damp_tilt, // 0.001; // Damp tilt to handle insufficient (co-linear)data // final double max_abs_tilt, // 2.0; // pix per tile
final double min_tilt_disp, // 4.0; // Disparity switch between filtering modes - near objects use tilts, far - use max disparity // final double max_rel_tilt, // 0.2; // (pix / disparity) per tile
final double transition, // 1.0; // Mode transition range (between tilted and maximal disparity) // final double damp_tilt, // 0.001; // Damp tilt to handle insufficient (co-linear)data
final int far_mode, // 1; // Far objects filtering mode (0 - off, 1 - power of disparity) // final double min_tilt_disp, // 4.0; // Disparity switch between filtering modes - near objects use tilts, far - use max disparity
final double far_power, // 3.0; // Raise disparity to this power before averaging for far objects // final double transition, // 1.0; // Mode transition range (between tilted and maximal disparity)
// final int far_mode, // 1; // Far objects filtering mode (0 - off, 1 - power of disparity)
// final double far_power, // 3.0; // Raise disparity to this power before averaging for far objects
final double max_disp_diff, // maximal disparity difference from the plane to consider tile final double max_disp_diff, // maximal disparity difference from the plane to consider tile
final double disp_range, // parallel move known planes around original know value for the best overall fit final double disp_range, // parallel move known planes around original know value for the best overall fit
...@@ -4267,20 +4303,21 @@ public class TilePlanes { ...@@ -4267,20 +4303,21 @@ public class TilePlanes {
getSTileXY()[0], // int stX, getSTileXY()[0], // int stX,
getSTileXY()[1], // int stY, getSTileXY()[1], // int stY,
null, // boolean [] sel_in, - use all null, // boolean [] sel_in, - use all
strength_floor, mlfp,
measured_strength_pow, // // strength_floor,
smplSide, // = 2; // Sample size (side of a square) // measured_strength_pow, //
smplNum, // = 3; // Number after removing worst // smplSide, // = 2; // Sample size (side of a square)
smplRms, // = 0.1; // Maximal RMS of the remaining tiles in a sample // smplNum, // = 3; // Number after removing worst
smplWnd, // use window functions for the samples // smplRms, // = 0.1; // Maximal RMS of the remaining tiles in a sample
// smplWnd, // use window functions for the samples
max_abs_tilt, // 2.0; // Maximal absolute tilt in pixels/tile
max_rel_tilt, // 0.2; // Maximal relative tilt in pixels/tile/disparity // max_abs_tilt, // 2.0; // Maximal absolute tilt in pixels/tile
damp_tilt, // 0.001; // Damp tilt to handle insufficient (co-linear)data // max_rel_tilt, // 0.2; // Maximal relative tilt in pixels/tile/disparity
min_tilt_disp, // 4.0; // Disparity switch between filtering modes - near objects use tilts, far - use max disparity // damp_tilt, // 0.001; // Damp tilt to handle insufficient (co-linear)data
transition, // 1.0; // Mode transition range (between tilted and maximal disparity) // min_tilt_disp, // 4.0; // Disparity switch between filtering modes - near objects use tilts, far - use max disparity
far_mode, // 1; // Far objects filtering mode (0 - off, 1 - power of disparity) // transition, // 1.0; // Mode transition range (between tilted and maximal disparity)
far_power, // 1.0; // Raise disparity to this power before averaging for far objects // far_mode, // 1; // Far objects filtering mode (0 - off, 1 - power of disparity)
// far_power, // 1.0; // Raise disparity to this power before averaging for far objects
true, // boolean null_if_none) true, // boolean null_if_none)
debugLevel); debugLevel);
...@@ -4290,8 +4327,9 @@ public class TilePlanes { ...@@ -4290,8 +4327,9 @@ public class TilePlanes {
getSTileXY()[0], // int stX, getSTileXY()[0], // int stX,
getSTileXY()[1], // int stY, getSTileXY()[1], // int stY,
null, // boolean [] sel_in, - use all null, // boolean [] sel_in, - use all
strength_floor, // double strength_floor, mlfp,
measured_strength_pow, // double strength_pow, // strength_floor, // double strength_floor,
// measured_strength_pow, // double strength_pow,
true); // boolean null_if_none); true); // boolean null_if_none);
} }
} }
...@@ -4584,18 +4622,19 @@ public class TilePlanes { ...@@ -4584,18 +4622,19 @@ public class TilePlanes {
final double dispNorm, // Normalize disparities to the average if above final double dispNorm, // Normalize disparities to the average if above
final boolean smplMode, // = true; // Use sample mode (false - regular tile mode) final boolean smplMode, // = true; // Use sample mode (false - regular tile mode)
final int smplSide, // = 2; // Sample size (side of a square) final MeasuredLayersFilterParameters mlfp,
final int smplNum, // = 3; // Number after removing worst // final int smplSide, // = 2; // Sample size (side of a square)
final double smplRms, // = 0.1; // Maximal RMS of the remaining tiles in a sample // final int smplNum, // = 3; // Number after removing worst
final boolean smplWnd, // use window functions for the samples // final double smplRms, // = 0.1; // Maximal RMS of the remaining tiles in a sample
// final boolean smplWnd, // use window functions for the samples
final double max_abs_tilt, // 2.0; // pix per tile
final double max_rel_tilt, // 0.2; // (pix / disparity) per tile // final double max_abs_tilt, // 2.0; // pix per tile
final double damp_tilt, // 0.001; // Damp tilt to handle insufficient (co-linear)data // final double max_rel_tilt, // 0.2; // (pix / disparity) per tile
final double min_tilt_disp, // 4.0; // Disparity switch between filtering modes - near objects use tilts, far - use max disparity // final double damp_tilt, // 0.001; // Damp tilt to handle insufficient (co-linear)data
final double transition, // 1.0; // Mode transition range (between tilted and maximal disparity) // final double min_tilt_disp, // 4.0; // Disparity switch between filtering modes - near objects use tilts, far - use max disparity
final int far_mode, // 1; // Far objects filtering mode (0 - off, 1 - power of disparity) // final double transition, // 1.0; // Mode transition range (between tilted and maximal disparity)
final double far_power, // 3.0; // Raise disparity to this power before averaging for far objects // final int far_mode, // 1; // Far objects filtering mode (0 - off, 1 - power of disparity)
// final double far_power, // 3.0; // Raise disparity to this power before averaging for far objects
final double disp_tolerance, // maximal disparity difference from the plane to consider tile final double disp_tolerance, // maximal disparity difference from the plane to consider tile
final double disp_var_floor, // squared add to variance to calculate reverse flatness (used mostly for single-cell clusters) final double disp_var_floor, // squared add to variance to calculate reverse flatness (used mostly for single-cell clusters)
...@@ -4722,19 +4761,20 @@ public class TilePlanes { ...@@ -4722,19 +4761,20 @@ public class TilePlanes {
getSTileXY()[0], // int stX, getSTileXY()[0], // int stX,
getSTileXY()[1], // int stY, getSTileXY()[1], // int stY,
null, // boolean [] sel_in, - use all null, // boolean [] sel_in, - use all
strength_floor, mlfp,
measured_strength_pow, // // strength_floor,
smplSide, // = 2; // Sample size (side of a square) // measured_strength_pow, //
smplNum, // = 3; // Number after removing worst // smplSide, // = 2; // Sample size (side of a square)
smplRms, // = 0.1; // Maximal RMS of the remaining tiles in a sample // smplNum, // = 3; // Number after removing worst
smplWnd, // use window functions for the samples // smplRms, // = 0.1; // Maximal RMS of the remaining tiles in a sample
max_abs_tilt, // 2.0; // Maximal absolute tilt in pixels/tile // smplWnd, // use window functions for the samples
max_rel_tilt, // 0.2; // Maximal relative tilt in pixels/tile/disparity // max_abs_tilt, // 2.0; // Maximal absolute tilt in pixels/tile
damp_tilt, // 0.001; // Damp tilt to handle insufficient (co-linear)data // max_rel_tilt, // 0.2; // Maximal relative tilt in pixels/tile/disparity
min_tilt_disp, // 4.0; // Disparity switch between filtering modes - near objects use tilts, far - use max disparity // damp_tilt, // 0.001; // Damp tilt to handle insufficient (co-linear)data
transition, // 1.0; // Mode transition range (between tilted and maximal disparity) // min_tilt_disp, // 4.0; // Disparity switch between filtering modes - near objects use tilts, far - use max disparity
far_mode, // 1; // Far objects filtering mode (0 - off, 1 - power of disparity) // transition, // 1.0; // Mode transition range (between tilted and maximal disparity)
far_power, // 1.0; // Raise disparity to this power before averaging for far objects // far_mode, // 1; // Far objects filtering mode (0 - off, 1 - power of disparity)
// far_power, // 1.0; // Raise disparity to this power before averaging for far objects
true, // boolean null_if_none) true, // boolean null_if_none)
debugLevel); debugLevel);
} else { } else {
...@@ -4743,8 +4783,9 @@ public class TilePlanes { ...@@ -4743,8 +4783,9 @@ public class TilePlanes {
getSTileXY()[0], // int stX, getSTileXY()[0], // int stX,
getSTileXY()[1], // int stY, getSTileXY()[1], // int stY,
null, // boolean [] sel_in, - use all null, // boolean [] sel_in, - use all
strength_floor, // double strength_floor, mlfp,
measured_strength_pow, // double strength_pow, // strength_floor, // double strength_floor,
// measured_strength_pow, // double strength_pow,
true); // boolean null_if_none); true); // boolean null_if_none);
} }
} }
...@@ -5511,25 +5552,26 @@ public class TilePlanes { ...@@ -5511,25 +5552,26 @@ public class TilePlanes {
double [] lap_weights = measuredLayers.getLapWeights1d(); double [] lap_weights = measuredLayers.getLapWeights1d();
double [][][] disp_strength = new double[measuredLayers.getNumLayers()][][]; double [][][] disp_strength = new double[measuredLayers.getNumLayers()][][];
for (int ml = 0; ml < disp_strength.length; ml++) if (fg_sel[ml] != null){ // if ((stMeasSel & ( 1 << ml)) != 0) { for (int ml = 0; ml < disp_strength.length; ml++) if (fg_sel[ml] != null){ // if ((stMeasSel & ( 1 << ml)) != 0) {
if (smplMode) { if (this.smplMode) {
disp_strength[ml] = measuredLayers.getDisparityStrengthMLTilted( // expensive to calculate (improve removing outlayers disp_strength[ml] = measuredLayers.getDisparityStrengthMLTilted( // expensive to calculate (improve removing outlayers
ml, // int num_layer, ml, // int num_layer,
getSTileXY()[0], // int stX, getSTileXY()[0], // int stX,
getSTileXY()[1], // int stY, getSTileXY()[1], // int stY,
null, // boolean [] sel_in, - use all null, // boolean [] sel_in, - use all
strength_floor, this.mlfp,
measured_strength_pow, // // strength_floor,
smplSide, // = 2; // Sample size (side of a square) // measured_strength_pow, //
smplNum, // = 3; // Number after removing worst // smplSide, // = 2; // Sample size (side of a square)
smplRms, // = 0.1; // Maximal RMS of the remaining tiles in a sample // smplNum, // = 3; // Number after removing worst
smplWnd, // use window functions for the samples // smplRms, // = 0.1; // Maximal RMS of the remaining tiles in a sample
max_abs_tilt, // 2.0; // Maximal absolute tilt in pixels/tile // smplWnd, // use window functions for the samples
max_rel_tilt, // 0.2; // Maximal relative tilt in pixels/tile/disparity // max_abs_tilt, // 2.0; // Maximal absolute tilt in pixels/tile
damp_tilt, // 0.001; // Damp tilt to handle insufficient (co-linear)data // max_rel_tilt, // 0.2; // Maximal relative tilt in pixels/tile/disparity
min_tilt_disp, // 4.0; // Disparity switch between filtering modes - near objects use tilts, far - use max disparity // damp_tilt, // 0.001; // Damp tilt to handle insufficient (co-linear)data
transition, // 1.0; // Mode transition range (between tilted and maximal disparity) // min_tilt_disp, // 4.0; // Disparity switch between filtering modes - near objects use tilts, far - use max disparity
far_mode, // 1; // Far objects filtering mode (0 - off, 1 - power of disparity) // transition, // 1.0; // Mode transition range (between tilted and maximal disparity)
far_power, // 1.0; // Raise disparity to this power before averaging for far objects // far_mode, // 1; // Far objects filtering mode (0 - off, 1 - power of disparity)
// far_power, // 1.0; // Raise disparity to this power before averaging for far objects
true, // boolean null_if_none) true, // boolean null_if_none)
debugLevel); debugLevel);
} else { } else {
...@@ -5538,8 +5580,9 @@ public class TilePlanes { ...@@ -5538,8 +5580,9 @@ public class TilePlanes {
getSTileXY()[0], // int stX, getSTileXY()[0], // int stX,
getSTileXY()[1], // int stY, getSTileXY()[1], // int stY,
null, // boolean [] sel_in, - use all null, // boolean [] sel_in, - use all
strength_floor, // double strength_floor, this.mlfp,
measured_strength_pow, // double strength_pow, // strength_floor, // double strength_floor,
// measured_strength_pow, // double strength_pow,
true); // boolean null_if_none); true); // boolean null_if_none);
} }
} }
......
...@@ -3490,8 +3490,8 @@ public class TileProcessor { ...@@ -3490,8 +3490,8 @@ public class TileProcessor {
final int [] horVertMod, // +1 - modified by hor correlation, +2 - modified by vert correlation (or null) final int [] horVertMod, // +1 - modified by hor correlation, +2 - modified by vert correlation (or null)
final double disparity_far, // final double disparity_far, //
final double disparity_near, // final double disparity_near, //
final double ex_strength, // minimal 4-corr strength to trust tile final double ex_strength, // minimal 4-corr strength to trust tile
final double ex_nstrength, // minimal 4-corr strength divided by channel diff for new (border) tiles final double ex_nstrength, // minimal 4-corr strength divided by channel diff for new (border) tiles
final double this_maybe, // maximal strength to ignore as non-background final double this_maybe, // maximal strength to ignore as non-background
final double sure_smth, // if 2-nd worst image difference (noise-normalized) exceeds this - do not propagate bgnd final double sure_smth, // if 2-nd worst image difference (noise-normalized) exceeds this - do not propagate bgnd
final double super_trust, // If strength exceeds ex_strength * super_trust, do not apply ex_nstrength and plate_ds final double super_trust, // If strength exceeds ex_strength * super_trust, do not apply ex_nstrength and plate_ds
...@@ -3514,7 +3514,7 @@ public class TileProcessor { ...@@ -3514,7 +3514,7 @@ public class TileProcessor {
{ {
// final double super_trust = 1.6; // If strength exceeds ex_strength * super_trust, do not apply ex_nstrength // final double super_trust = 1.6; // If strength exceeds ex_strength * super_trust, do not apply ex_nstrength
final int dbg_tile = 49468; // x = 220, y = 152 (pavement line) final int dbg_tile = 41030; // x = 206, y = 126 (324*126+206)
final boolean show_scan = show_filter_scan || (debugLevel > 1); final boolean show_scan = show_filter_scan || (debugLevel > 1);
showDoubleFloatArrays sdfa_instance = null; showDoubleFloatArrays sdfa_instance = null;
if ((debugLevel > -2) && ((debugLevel > -1) || show_scan)) sdfa_instance = new showDoubleFloatArrays(); // just for debugging? if ((debugLevel > -2) && ((debugLevel > -1) || show_scan)) sdfa_instance = new showDoubleFloatArrays(); // just for debugging?
...@@ -3539,7 +3539,8 @@ public class TileProcessor { ...@@ -3539,7 +3539,8 @@ public class TileProcessor {
} }
for (int i = 0; i <tlen; i++) if (!Double.isNaN(this_disparity[i])){ for (int i = 0; i <tlen; i++) if (!Double.isNaN(this_disparity[i])){
if ((debugLevel > 0) && (i==dbg_tile)){ // if ((debugLevel > 0) && (i==dbg_tile)){
if ((debugLevel > -2) && (i==dbg_tile)){
System.out.println("FilterScan(): this_disparity["+i+"] = "+this_disparity[i]+"this_strength["+i+"] = "+this_strength[i]); System.out.println("FilterScan(): this_disparity["+i+"] = "+this_disparity[i]+"this_strength["+i+"] = "+this_strength[i]);
} }
...@@ -4351,21 +4352,22 @@ public class TileProcessor { ...@@ -4351,21 +4352,22 @@ public class TileProcessor {
clt_parameters.stStepThreshold, // double step_threshold, clt_parameters.stStepThreshold, // double step_threshold,
clt_parameters.stMinDisparity, // double min_disparity, clt_parameters.stMinDisparity, // double min_disparity,
clt_parameters.grow_disp_max, // double max_disparity, clt_parameters.grow_disp_max, // double max_disparity,
clt_parameters.stFloor, // double strength_floor, // clt_parameters.stFloor, // double strength_floor,
clt_parameters.stPow, // double strength_pow, // clt_parameters.stPow, // double strength_pow,
0.0,// NO BLUR double stBlurSigma) 0.0,// NO BLUR double stBlurSigma)
false, //clt_parameters.stSmplMode, // Use sample mode (false - regular tile mode) false, //clt_parameters.stSmplMode, // Use sample mode (false - regular tile mode)
clt_parameters.stSmplSide, // Sample size (side of a square) clt_parameters.mlfp, // filter parameters
clt_parameters.stSmplNum, // Number after removing worst // clt_parameters.stSmplSide, // Sample size (side of a square)
clt_parameters.stSmplRms, // Maximal RMS of the remaining tiles in a sample // clt_parameters.stSmplNum, // Number after removing worst
clt_parameters.stSmplWnd, // boolean smplWnd, // use window functions for the samples // clt_parameters.stSmplRms, // Maximal RMS of the remaining tiles in a sample
clt_parameters.fs_max_abs_tilt, // 2.0; // Maximal absolute tilt in pixels/tile // clt_parameters.stSmplWnd, // boolean smplWnd, // use window functions for the samples
clt_parameters.fs_max_rel_tilt, // 0.2; // Maximal relative tilt in pixels/tile/disparity // clt_parameters.fs_max_abs_tilt, // 2.0; // Maximal absolute tilt in pixels/tile
clt_parameters.fs_damp_tilt, // 0.001; // Damp tilt to handle insufficient (co-linear)data // clt_parameters.fs_max_rel_tilt, // 0.2; // Maximal relative tilt in pixels/tile/disparity
clt_parameters.fs_min_tilt_disp, // 4.0; // Disparity switch between filtering modes - near objects use tilts, far - use max disparity // clt_parameters.fs_damp_tilt, // 0.001; // Damp tilt to handle insufficient (co-linear)data
clt_parameters.fs_transition, // 1.0; // Mode transition range (between tilted and maximal disparity) // clt_parameters.fs_min_tilt_disp, // 4.0; // Disparity switch between filtering modes - near objects use tilts, far - use max disparity
clt_parameters.fs_far_mode, // 1; // Far objects filtering mode (0 - off, 1 - power of disparity) // clt_parameters.fs_transition, // 1.0; // Mode transition range (between tilted and maximal disparity)
clt_parameters.fs_far_power, // 1.0; // Raise disparity to this power before averaging for far objects // clt_parameters.fs_far_mode, // 1; // Far objects filtering mode (0 - off, 1 - power of disparity)
// clt_parameters.fs_far_power, // 1.0; // Raise disparity to this power before averaging for far objects
clt_parameters.stMeasSel); // bitmask of the selected measurements for supertiles : +1 - combo, +2 - quad +4 - hor +8 - vert clt_parameters.stMeasSel); // bitmask of the selected measurements for supertiles : +1 - combo, +2 - quad +4 - hor +8 - vert
dbg_hist[0] = scan_prev.getSuperTiles().showDisparityHistogram(); dbg_hist[0] = scan_prev.getSuperTiles().showDisparityHistogram();
...@@ -4375,21 +4377,22 @@ public class TileProcessor { ...@@ -4375,21 +4377,22 @@ public class TileProcessor {
clt_parameters.stStepThreshold, // double step_threshold, clt_parameters.stStepThreshold, // double step_threshold,
clt_parameters.stMinDisparity, // double min_disparity, clt_parameters.stMinDisparity, // double min_disparity,
clt_parameters.grow_disp_max, // double max_disparity, clt_parameters.grow_disp_max, // double max_disparity,
clt_parameters.stFloor, // double strength_floor, // clt_parameters.stFloor, // double strength_floor,
clt_parameters.stPow, // double strength_pow, // clt_parameters.stPow, // double strength_pow,
clt_parameters.stSigma, // with blur double stBlurSigma) clt_parameters.stSigma, // with blur double stBlurSigma)
false, //clt_parameters.stSmplMode, // Use sample mode (false - regular tile mode) false, //clt_parameters.stSmplMode, // Use sample mode (false - regular tile mode)
clt_parameters.stSmplSide, // Sample size (side of a square) clt_parameters.mlfp, // filter parameters
clt_parameters.stSmplNum, // Number after removing worst // clt_parameters.stSmplSide, // Sample size (side of a square)
clt_parameters.stSmplRms, // Maximal RMS of the remaining tiles in a sample // clt_parameters.stSmplNum, // Number after removing worst
clt_parameters.stSmplWnd, // boolean smplWnd, // use window functions for the samples // clt_parameters.stSmplRms, // Maximal RMS of the remaining tiles in a sample
clt_parameters.fs_max_abs_tilt, // 2.0; // Maximal absolute tilt in pixels/tile // clt_parameters.stSmplWnd, // boolean smplWnd, // use window functions for the samples
clt_parameters.fs_max_rel_tilt, // 0.2; // Maximal relative tilt in pixels/tile/disparity // clt_parameters.fs_max_abs_tilt, // 2.0; // Maximal absolute tilt in pixels/tile
clt_parameters.fs_damp_tilt, // 0.001; // Damp tilt to handle insufficient (co-linear)data // clt_parameters.fs_max_rel_tilt, // 0.2; // Maximal relative tilt in pixels/tile/disparity
clt_parameters.fs_min_tilt_disp, // 4.0; // Disparity switch between filtering modes - near objects use tilts, far - use max disparity // clt_parameters.fs_damp_tilt, // 0.001; // Damp tilt to handle insufficient (co-linear)data
clt_parameters.fs_transition, // 1.0; // Mode transition range (between tilted and maximal disparity) // clt_parameters.fs_min_tilt_disp, // 4.0; // Disparity switch between filtering modes - near objects use tilts, far - use max disparity
clt_parameters.fs_far_mode, // 1; // Far objects filtering mode (0 - off, 1 - power of disparity) // clt_parameters.fs_transition, // 1.0; // Mode transition range (between tilted and maximal disparity)
clt_parameters.fs_far_power, // 1.0; // Raise disparity to this power before averaging for far objects // clt_parameters.fs_far_mode, // 1; // Far objects filtering mode (0 - off, 1 - power of disparity)
// clt_parameters.fs_far_power, // 1.0; // Raise disparity to this power before averaging for far objects
clt_parameters.stMeasSel); // bitmask of the selected measurements for supertiles : +1 - combo, +2 - quad +4 - hor +8 - vert clt_parameters.stMeasSel); // bitmask of the selected measurements for supertiles : +1 - combo, +2 - quad +4 - hor +8 - vert
dbg_hist[1] = scan_prev.getSuperTiles().showDisparityHistogram(); dbg_hist[1] = scan_prev.getSuperTiles().showDisparityHistogram();
...@@ -5152,21 +5155,22 @@ public class TileProcessor { ...@@ -5152,21 +5155,22 @@ public class TileProcessor {
clt_parameters.stStepThreshold, // double step_threshold, clt_parameters.stStepThreshold, // double step_threshold,
clt_parameters.stMinDisparity, // double min_disparity, clt_parameters.stMinDisparity, // double min_disparity,
clt_parameters.grow_disp_max, // double max_disparity, clt_parameters.grow_disp_max, // double max_disparity,
clt_parameters.stFloor, // double strength_floor, // clt_parameters.stFloor, // double strength_floor,
clt_parameters.stPow, // double strength_pow, // clt_parameters.stPow, // double strength_pow,
0.0, // NO BLUR double stBlurSigma) 0.0, // NO BLUR double stBlurSigma)
false, //clt_parameters.stSmplMode, // Use sample mode (false - regular tile mode) false, //clt_parameters.stSmplMode, // Use sample mode (false - regular tile mode)
clt_parameters.stSmplSide, // Sample size (side of a square) clt_parameters.mlfp, // Filter parameters
clt_parameters.stSmplNum, // Number after removing worst // clt_parameters.stSmplSide, // Sample size (side of a square)
clt_parameters.stSmplRms, // Maximal RMS of the remaining tiles in a sample // clt_parameters.stSmplNum, // Number after removing worst
clt_parameters.stSmplWnd, // boolean smplWnd, // use window functions for the samples // clt_parameters.stSmplRms, // Maximal RMS of the remaining tiles in a sample
clt_parameters.fs_max_abs_tilt, // 2.0; // Maximal absolute tilt in pixels/tile // clt_parameters.stSmplWnd, // boolean smplWnd, // use window functions for the samples
clt_parameters.fs_max_rel_tilt, // 0.2; // Maximal relative tilt in pixels/tile/disparity // clt_parameters.fs_max_abs_tilt, // 2.0; // Maximal absolute tilt in pixels/tile
clt_parameters.fs_damp_tilt, // 0.001; // Damp tilt to handle insufficient (co-linear)data // clt_parameters.fs_max_rel_tilt, // 0.2; // Maximal relative tilt in pixels/tile/disparity
clt_parameters.fs_min_tilt_disp, // 4.0; // Disparity switch between filtering modes - near objects use tilts, far - use max disparity // clt_parameters.fs_damp_tilt, // 0.001; // Damp tilt to handle insufficient (co-linear)data
clt_parameters.fs_transition, // 1.0; // Mode transition range (between tilted and maximal disparity) // clt_parameters.fs_min_tilt_disp, // 4.0; // Disparity switch between filtering modes - near objects use tilts, far - use max disparity
clt_parameters.fs_far_mode, // 1; // Far objects filtering mode (0 - off, 1 - power of disparity) // clt_parameters.fs_transition, // 1.0; // Mode transition range (between tilted and maximal disparity)
clt_parameters.fs_far_power, // 1.0; // Raise disparity to this power before averaging for far objects // clt_parameters.fs_far_mode, // 1; // Far objects filtering mode (0 - off, 1 - power of disparity)
// clt_parameters.fs_far_power, // 1.0; // Raise disparity to this power before averaging for far objects
clt_parameters.stMeasSel); // bitmask of the selected measurements for supertiles : +1 - combo, +2 - quad +4 - hor +8 - vert clt_parameters.stMeasSel); // bitmask of the selected measurements for supertiles : +1 - combo, +2 - quad +4 - hor +8 - vert
dbg_hist[0] = scan_prev.getSuperTiles().showDisparityHistogram(); dbg_hist[0] = scan_prev.getSuperTiles().showDisparityHistogram();
scan_prev.setSuperTiles( scan_prev.setSuperTiles(
...@@ -5175,21 +5179,22 @@ public class TileProcessor { ...@@ -5175,21 +5179,22 @@ public class TileProcessor {
clt_parameters.stStepThreshold, // double step_threshold, clt_parameters.stStepThreshold, // double step_threshold,
clt_parameters.stMinDisparity, // double min_disparity, clt_parameters.stMinDisparity, // double min_disparity,
clt_parameters.grow_disp_max, // double max_disparity, clt_parameters.grow_disp_max, // double max_disparity,
clt_parameters.stFloor, // double strength_floor, // clt_parameters.stFloor, // double strength_floor,
clt_parameters.stPow, // double strength_pow, // clt_parameters.stPow, // double strength_pow,
0.0, // NO BLUR double stBlurSigma) 0.0, // NO BLUR double stBlurSigma)
clt_parameters.stSmplMode, // Use sample mode (false - regular tile mode) clt_parameters.stSmplMode, // Use sample mode (false - regular tile mode)
clt_parameters.stSmplSide, // Sample size (side of a square) clt_parameters.mlfp, // Filter parameters
clt_parameters.stSmplNum, // Number after removing worst // clt_parameters.stSmplSide, // Sample size (side of a square)
clt_parameters.stSmplRms, // Maximal RMS of the remaining tiles in a sample // clt_parameters.stSmplNum, // Number after removing worst
clt_parameters.stSmplWnd, // boolean smplWnd, // use window functions for the samples // clt_parameters.stSmplRms, // Maximal RMS of the remaining tiles in a sample
clt_parameters.fs_max_abs_tilt, // 2.0; // Maximal absolute tilt in pixels/tile // clt_parameters.stSmplWnd, // boolean smplWnd, // use window functions for the samples
clt_parameters.fs_max_rel_tilt, // 0.2; // Maximal relative tilt in pixels/tile/disparity // clt_parameters.fs_max_abs_tilt, // 2.0; // Maximal absolute tilt in pixels/tile
clt_parameters.fs_damp_tilt, // 0.001; // Damp tilt to handle insufficient (co-linear)data // clt_parameters.fs_max_rel_tilt, // 0.2; // Maximal relative tilt in pixels/tile/disparity
clt_parameters.fs_min_tilt_disp, // 4.0; // Disparity switch between filtering modes - near objects use tilts, far - use max disparity // clt_parameters.fs_damp_tilt, // 0.001; // Damp tilt to handle insufficient (co-linear)data
clt_parameters.fs_transition, // 1.0; // Mode transition range (between tilted and maximal disparity) // clt_parameters.fs_min_tilt_disp, // 4.0; // Disparity switch between filtering modes - near objects use tilts, far - use max disparity
clt_parameters.fs_far_mode, // 1; // Far objects filtering mode (0 - off, 1 - power of disparity) // clt_parameters.fs_transition, // 1.0; // Mode transition range (between tilted and maximal disparity)
clt_parameters.fs_far_power, // 1.0; // Raise disparity to this power before averaging for far objects // clt_parameters.fs_far_mode, // 1; // Far objects filtering mode (0 - off, 1 - power of disparity)
// clt_parameters.fs_far_power, // 1.0; // Raise disparity to this power before averaging for far objects
clt_parameters.stMeasSel); // bitmask of the selected measurements for supertiles : +1 - combo, +2 - quad +4 - hor +8 - vert clt_parameters.stMeasSel); // bitmask of the selected measurements for supertiles : +1 - combo, +2 - quad +4 - hor +8 - vert
dbg_hist[1] = scan_prev.getSuperTiles().showDisparityHistogram(); dbg_hist[1] = scan_prev.getSuperTiles().showDisparityHistogram();
} }
...@@ -5201,21 +5206,22 @@ public class TileProcessor { ...@@ -5201,21 +5206,22 @@ public class TileProcessor {
clt_parameters.stStepThreshold, // double step_threshold, clt_parameters.stStepThreshold, // double step_threshold,
clt_parameters.stMinDisparity, // double min_disparity, clt_parameters.stMinDisparity, // double min_disparity,
clt_parameters.grow_disp_max, // double max_disparity, clt_parameters.grow_disp_max, // double max_disparity,
clt_parameters.stFloor, // double strength_floor, // clt_parameters.stFloor, // double strength_floor,
clt_parameters.stPow, // double strength_pow, // clt_parameters.stPow, // double strength_pow,
clt_parameters.stSigma, // with blur double stBlurSigma) clt_parameters.stSigma, // with blur double stBlurSigma)
false, //clt_parameters.stSmplMode, // Use sample mode (false - regular tile mode) false, //clt_parameters.stSmplMode, // Use sample mode (false - regular tile mode)
clt_parameters.stSmplSide, // Sample size (side of a square) clt_parameters.mlfp, // Filter parameters
clt_parameters.stSmplNum, // Number after removing worst // clt_parameters.stSmplSide, // Sample size (side of a square)
clt_parameters.stSmplRms, // Maximal RMS of the remaining tiles in a sample // clt_parameters.stSmplNum, // Number after removing worst
clt_parameters.stSmplWnd, // boolean smplWnd, // use window functions for the samples // clt_parameters.stSmplRms, // Maximal RMS of the remaining tiles in a sample
clt_parameters.fs_max_abs_tilt, // 2.0; // Maximal absolute tilt in pixels/tile // clt_parameters.stSmplWnd, // boolean smplWnd, // use window functions for the samples
clt_parameters.fs_max_rel_tilt, // 0.2; // Maximal relative tilt in pixels/tile/disparity // clt_parameters.fs_max_abs_tilt, // 2.0; // Maximal absolute tilt in pixels/tile
clt_parameters.fs_damp_tilt, // 0.001; // Damp tilt to handle insufficient (co-linear)data // clt_parameters.fs_max_rel_tilt, // 0.2; // Maximal relative tilt in pixels/tile/disparity
clt_parameters.fs_min_tilt_disp, // 4.0; // Disparity switch between filtering modes - near objects use tilts, far - use max disparity // clt_parameters.fs_damp_tilt, // 0.001; // Damp tilt to handle insufficient (co-linear)data
clt_parameters.fs_transition, // 1.0; // Mode transition range (between tilted and maximal disparity) // clt_parameters.fs_min_tilt_disp, // 4.0; // Disparity switch between filtering modes - near objects use tilts, far - use max disparity
clt_parameters.fs_far_mode, // 1; // Far objects filtering mode (0 - off, 1 - power of disparity) // clt_parameters.fs_transition, // 1.0; // Mode transition range (between tilted and maximal disparity)
clt_parameters.fs_far_power, // 1.0; // Raise disparity to this power before averaging for far objects // clt_parameters.fs_far_mode, // 1; // Far objects filtering mode (0 - off, 1 - power of disparity)
// clt_parameters.fs_far_power, // 1.0; // Raise disparity to this power before averaging for far objects
clt_parameters.stMeasSel); // bitmask of the selected measurements for supertiles : +1 - combo, +2 - quad +4 - hor +8 - vert clt_parameters.stMeasSel); // bitmask of the selected measurements for supertiles : +1 - combo, +2 - quad +4 - hor +8 - vert
if (show_st) { // otherwise only blured version is needed if (show_st) { // otherwise only blured version is needed
dbg_hist[2] = scan_prev.getSuperTiles().showDisparityHistogram(); dbg_hist[2] = scan_prev.getSuperTiles().showDisparityHistogram();
...@@ -5237,21 +5243,22 @@ public class TileProcessor { ...@@ -5237,21 +5243,22 @@ public class TileProcessor {
clt_parameters.stStepThreshold, // double step_threshold, clt_parameters.stStepThreshold, // double step_threshold,
clt_parameters.stMinDisparity, // double min_disparity, clt_parameters.stMinDisparity, // double min_disparity,
clt_parameters.grow_disp_max, // double max_disparity, clt_parameters.grow_disp_max, // double max_disparity,
clt_parameters.stFloor, // double strength_floor, // clt_parameters.stFloor, // double strength_floor,
clt_parameters.stPow, // double strength_pow, // clt_parameters.stPow, // double strength_pow,
0.0, // NO BLUR double stBlurSigma) 0.0, // NO BLUR double stBlurSigma)
clt_parameters.stSmplMode, // Use sample mode (false - regular tile mode) clt_parameters.stSmplMode, // Use sample mode (false - regular tile mode)
clt_parameters.stSmplSide, // Sample size (side of a square) clt_parameters.mlfp, // Filter parameters
clt_parameters.stSmplNum, // Number after removing worst // clt_parameters.stSmplSide, // Sample size (side of a square)
clt_parameters.stSmplRms, // Maximal RMS of the remaining tiles in a sample // clt_parameters.stSmplNum, // Number after removing worst
clt_parameters.stSmplWnd, // boolean smplWnd, // use window functions for the samples // clt_parameters.stSmplRms, // Maximal RMS of the remaining tiles in a sample
clt_parameters.fs_max_abs_tilt, // 2.0; // Maximal absolute tilt in pixels/tile // clt_parameters.stSmplWnd, // boolean smplWnd, // use window functions for the samples
clt_parameters.fs_max_rel_tilt, // 0.2; // Maximal relative tilt in pixels/tile/disparity // clt_parameters.fs_max_abs_tilt, // 2.0; // Maximal absolute tilt in pixels/tile
clt_parameters.fs_damp_tilt, // 0.001; // Damp tilt to handle insufficient (co-linear)data // clt_parameters.fs_max_rel_tilt, // 0.2; // Maximal relative tilt in pixels/tile/disparity
clt_parameters.fs_min_tilt_disp, // 4.0; // Disparity switch between filtering modes - near objects use tilts, far - use max disparity // clt_parameters.fs_damp_tilt, // 0.001; // Damp tilt to handle insufficient (co-linear)data
clt_parameters.fs_transition, // 1.0; // Mode transition range (between tilted and maximal disparity) // clt_parameters.fs_min_tilt_disp, // 4.0; // Disparity switch between filtering modes - near objects use tilts, far - use max disparity
clt_parameters.fs_far_mode, // 1; // Far objects filtering mode (0 - off, 1 - power of disparity) // clt_parameters.fs_transition, // 1.0; // Mode transition range (between tilted and maximal disparity)
clt_parameters.fs_far_power, // 1.0; // Raise disparity to this power before averaging for far objects // clt_parameters.fs_far_mode, // 1; // Far objects filtering mode (0 - off, 1 - power of disparity)
// clt_parameters.fs_far_power, // 1.0; // Raise disparity to this power before averaging for far objects
clt_parameters.stMeasSel); // bitmask of the selected measurements for supertiles : +1 - combo, +2 - quad +4 - hor +8 - vert clt_parameters.stMeasSel); // bitmask of the selected measurements for supertiles : +1 - combo, +2 - quad +4 - hor +8 - vert
} }
...@@ -5272,18 +5279,19 @@ public class TileProcessor { ...@@ -5272,18 +5279,19 @@ public class TileProcessor {
clt_parameters.correct_distortions, clt_parameters.correct_distortions,
clt_parameters.stSmplMode , // final boolean smplMode, // = true; // Use sample mode (false - regular tile mode) clt_parameters.stSmplMode , // final boolean smplMode, // = true; // Use sample mode (false - regular tile mode)
clt_parameters.stSmplSide , // final int smplSide, // = 2; // Sample size (side of a square) clt_parameters.mlfp, // Filter parameters
clt_parameters.stSmplNum , // final int smplNum, // = 3; // Number after removing worst // clt_parameters.stSmplSide , // final int smplSide, // = 2; // Sample size (side of a square)
clt_parameters.stSmplRms , // final double smplRms, // = 0.1; // Maximal RMS of the remaining tiles in a sample // clt_parameters.stSmplNum , // final int smplNum, // = 3; // Number after removing worst
clt_parameters.stSmplWnd, // boolean smplWnd, // use window functions for the samples // clt_parameters.stSmplRms , // final double smplRms, // = 0.1; // Maximal RMS of the remaining tiles in a sample
// clt_parameters.stSmplWnd, // boolean smplWnd, // use window functions for the samples
clt_parameters.fs_max_abs_tilt, // 2.0; // Maximal absolute tilt in pixels/tile
clt_parameters.fs_max_rel_tilt, // 0.2; // Maximal relative tilt in pixels/tile/disparity // clt_parameters.fs_max_abs_tilt, // 2.0; // Maximal absolute tilt in pixels/tile
clt_parameters.fs_damp_tilt, // 0.001; // Damp tilt to handle insufficient (co-linear)data // clt_parameters.fs_max_rel_tilt, // 0.2; // Maximal relative tilt in pixels/tile/disparity
clt_parameters.fs_min_tilt_disp, // 4.0; // Disparity switch between filtering modes - near objects use tilts, far - use max disparity // clt_parameters.fs_damp_tilt, // 0.001; // Damp tilt to handle insufficient (co-linear)data
clt_parameters.fs_transition, // 1.0; // Mode transition range (between tilted and maximal disparity) // clt_parameters.fs_min_tilt_disp, // 4.0; // Disparity switch between filtering modes - near objects use tilts, far - use max disparity
clt_parameters.fs_far_mode, // 1; // Far objects filtering mode (0 - off, 1 - power of disparity) // clt_parameters.fs_transition, // 1.0; // Mode transition range (between tilted and maximal disparity)
clt_parameters.fs_far_power, // 1.0; // Raise disparity to this power before averaging for far objects // clt_parameters.fs_far_mode, // 1; // Far objects filtering mode (0 - off, 1 - power of disparity)
// clt_parameters.fs_far_power, // 1.0; // Raise disparity to this power before averaging for far objects
clt_parameters.plBlurBinHor, // final double bin_blur_hor, // Blur disparity histograms for horizontal clusters by this sigma (in bins) clt_parameters.plBlurBinHor, // final double bin_blur_hor, // Blur disparity histograms for horizontal clusters by this sigma (in bins)
clt_parameters.plBlurBinVert, // final double bin_blur_vert, // Blur disparity histograms for constant disparity clusters by this sigma (in bins) clt_parameters.plBlurBinVert, // final double bin_blur_vert, // Blur disparity histograms for constant disparity clusters by this sigma (in bins)
...@@ -5354,18 +5362,19 @@ public class TileProcessor { ...@@ -5354,18 +5362,19 @@ public class TileProcessor {
clt_parameters.correct_distortions, clt_parameters.correct_distortions,
clt_parameters.stSmplMode, // final boolean smplMode, // = true; // Use sample mode (false - regular tile mode) clt_parameters.stSmplMode, // final boolean smplMode, // = true; // Use sample mode (false - regular tile mode)
clt_parameters.stSmplSide, // final int smplSide, // = 2; // Sample size (side of a square) clt_parameters.mlfp, // Filter parameters
clt_parameters.stSmplNum, // final int smplNum, // = 3; // Number after removing worst // clt_parameters.stSmplSide, // final int smplSide, // = 2; // Sample size (side of a square)
clt_parameters.stSmplRms, // final double smplRms, // = 0.1; // Maximal RMS of the remaining tiles in a sample // clt_parameters.stSmplNum, // final int smplNum, // = 3; // Number after removing worst
clt_parameters.stSmplWnd, // final boolean smplWnd, // use window functions for the samples // clt_parameters.stSmplRms, // final double smplRms, // = 0.1; // Maximal RMS of the remaining tiles in a sample
// clt_parameters.stSmplWnd, // final boolean smplWnd, // use window functions for the samples
clt_parameters.fs_max_abs_tilt, // 2.0; // Maximal absolute tilt in pixels/tile
clt_parameters.fs_max_rel_tilt, // 0.2; // Maximal relative tilt in pixels/tile/disparity // clt_parameters.fs_max_abs_tilt, // 2.0; // Maximal absolute tilt in pixels/tile
clt_parameters.fs_damp_tilt, // 0.001; // Damp tilt to handle insufficient (co-linear)data // clt_parameters.fs_max_rel_tilt, // 0.2; // Maximal relative tilt in pixels/tile/disparity
clt_parameters.fs_min_tilt_disp, // 4.0; // Disparity switch between filtering modes - near objects use tilts, far - use max disparity // clt_parameters.fs_damp_tilt, // 0.001; // Damp tilt to handle insufficient (co-linear)data
clt_parameters.fs_transition, // 1.0; // Mode transition range (between tilted and maximal disparity) // clt_parameters.fs_min_tilt_disp, // 4.0; // Disparity switch between filtering modes - near objects use tilts, far - use max disparity
clt_parameters.fs_far_mode, // 1; // Far objects filtering mode (0 - off, 1 - power of disparity) // clt_parameters.fs_transition, // 1.0; // Mode transition range (between tilted and maximal disparity)
clt_parameters.fs_far_power, // 1.0; // Raise disparity to this power before averaging for far objects // clt_parameters.fs_far_mode, // 1; // Far objects filtering mode (0 - off, 1 - power of disparity)
// clt_parameters.fs_far_power, // 1.0; // Raise disparity to this power before averaging for far objects
clt_parameters.plDiscrTolerance, // final double plDiscrTolerance, // = 0.4; // Maximal disparity difference from the plane to consider tile clt_parameters.plDiscrTolerance, // final double plDiscrTolerance, // = 0.4; // Maximal disparity difference from the plane to consider tile
clt_parameters.plDiscrDispRange, // final double plDiscrDispRange, // = 0.6; // Parallel move known planes around original know value for the best overall fit clt_parameters.plDiscrDispRange, // final double plDiscrDispRange, // = 0.6; // Parallel move known planes around original know value for the best overall fit
...@@ -5473,22 +5482,23 @@ public class TileProcessor { ...@@ -5473,22 +5482,23 @@ public class TileProcessor {
clt_parameters.plTargetEigen, // final double targetEigen, // = 0.1; // Remove outliers until main axis eigenvalue (possibly scaled by plDispNorm) gets below clt_parameters.plTargetEigen, // final double targetEigen, // = 0.1; // Remove outliers until main axis eigenvalue (possibly scaled by plDispNorm) gets below
clt_parameters.plFractOutliers, // final double fractOutliers, // = 0.3; // Maximal fraction of outliers to remove clt_parameters.plFractOutliers, // final double fractOutliers, // = 0.3; // Maximal fraction of outliers to remove
clt_parameters.plMaxOutliers, // final int maxOutliers, // = 20; // Maximal number of outliers to remove clt_parameters.plMaxOutliers, // final int maxOutliers, // = 20; // Maximal number of outliers to remove
clt_parameters.stFloor, // final double strength_floor, // clt_parameters.stFloor, // final double strength_floor,
clt_parameters.stPow, // final double strength_pow, // clt_parameters.stPow, // final double strength_pow,
// clt_parameters.dbg_migrate && clt_parameters.stSmplMode , // final boolean smplMode, // = true; // Use sample mode (false - regular tile mode) // clt_parameters.dbg_migrate && clt_parameters.stSmplMode , // final boolean smplMode, // = true; // Use sample mode (false - regular tile mode)
clt_parameters.stSmplMode , // final boolean smplMode, // = true; // Use sample mode (false - regular tile mode) clt_parameters.stSmplMode , // final boolean smplMode, // = true; // Use sample mode (false - regular tile mode)
clt_parameters.stSmplSide , // final int smplSide, // = 2; // Sample size (side of a square) clt_parameters.mlfp, // Filter parameters
clt_parameters.stSmplNum , // final int smplNum, // = 3; // Number after removing worst // clt_parameters.stSmplSide , // final int smplSide, // = 2; // Sample size (side of a square)
clt_parameters.stSmplRms , // final double smplRms, // = 0.1; // Maximal RMS of the remaining tiles in a sample // clt_parameters.stSmplNum , // final int smplNum, // = 3; // Number after removing worst
clt_parameters.stSmplWnd, // boolean smplWnd, // use window functions for the samples // clt_parameters.stSmplRms , // final double smplRms, // = 0.1; // Maximal RMS of the remaining tiles in a sample
// clt_parameters.stSmplWnd, // boolean smplWnd, // use window functions for the samples
clt_parameters.fs_max_abs_tilt, // 2.0; // Maximal absolute tilt in pixels/tile
clt_parameters.fs_max_rel_tilt, // 0.2; // Maximal relative tilt in pixels/tile/disparity // clt_parameters.fs_max_abs_tilt, // 2.0; // Maximal absolute tilt in pixels/tile
clt_parameters.fs_damp_tilt, // 0.001; // Damp tilt to handle insufficient (co-linear)data // clt_parameters.fs_max_rel_tilt, // 0.2; // Maximal relative tilt in pixels/tile/disparity
clt_parameters.fs_min_tilt_disp, // 4.0; // Disparity switch between filtering modes - near objects use tilts, far - use max disparity // clt_parameters.fs_damp_tilt, // 0.001; // Damp tilt to handle insufficient (co-linear)data
clt_parameters.fs_transition, // 1.0; // Mode transition range (between tilted and maximal disparity) // clt_parameters.fs_min_tilt_disp, // 4.0; // Disparity switch between filtering modes - near objects use tilts, far - use max disparity
clt_parameters.fs_far_mode, // 1; // Far objects filtering mode (0 - off, 1 - power of disparity) // clt_parameters.fs_transition, // 1.0; // Mode transition range (between tilted and maximal disparity)
clt_parameters.fs_far_power, // 1.0; // Raise disparity to this power before averaging for far objects // clt_parameters.fs_far_mode, // 1; // Far objects filtering mode (0 - off, 1 - power of disparity)
// clt_parameters.fs_far_power, // 1.0; // Raise disparity to this power before averaging for far objects
debugLevel, // 1, // final int debugLevel) debugLevel, // 1, // final int debugLevel)
clt_parameters.tileX, clt_parameters.tileX,
...@@ -6201,22 +6211,24 @@ public class TileProcessor { ...@@ -6201,22 +6211,24 @@ public class TileProcessor {
clt_parameters.stStepThreshold, // double step_threshold, clt_parameters.stStepThreshold, // double step_threshold,
clt_parameters.stMinDisparity, // double min_disparity, clt_parameters.stMinDisparity, // double min_disparity,
clt_parameters.grow_disp_max, // double max_disparity, clt_parameters.grow_disp_max, // double max_disparity,
clt_parameters.stFloor, // double strength_floor, // clt_parameters.stFloor, // double strength_floor,
clt_parameters.stPow, // double strength_pow, // clt_parameters.stPow, // double strength_pow,
0.0, // NO BLUR double stBlurSigma) 0.0, // NO BLUR double stBlurSigma)
false, //clt_parameters.stSmplMode, // Use sample mode (false - regular tile mode) false, //clt_parameters.stSmplMode, // Use sample mode (false - regular tile mode)
clt_parameters.stSmplSide, // Sample size (side of a square) clt_parameters.mlfp, // Filter parameters
clt_parameters.stSmplNum, // Number after removing worst
clt_parameters.stSmplRms, // Maximal RMS of the remaining tiles in a sample // clt_parameters.stSmplSide, // Sample size (side of a square)
clt_parameters.stSmplWnd, // Use window functions for the samples // clt_parameters.stSmplNum, // Number after removing worst
// clt_parameters.stSmplRms, // Maximal RMS of the remaining tiles in a sample
clt_parameters.fs_max_abs_tilt, // 2.0; // Maximal absolute tilt in pixels/tile // clt_parameters.stSmplWnd, // Use window functions for the samples
clt_parameters.fs_max_rel_tilt, // 0.2; // Maximal relative tilt in pixels/tile/disparity
clt_parameters.fs_damp_tilt, // 0.001; // Damp tilt to handle insufficient (co-linear)data // clt_parameters.fs_max_abs_tilt, // 2.0; // Maximal absolute tilt in pixels/tile
clt_parameters.fs_min_tilt_disp, // 4.0; // Disparity switch between filtering modes - near objects use tilts, far - use max disparity // clt_parameters.fs_max_rel_tilt, // 0.2; // Maximal relative tilt in pixels/tile/disparity
clt_parameters.fs_transition, // 1.0; // Mode transition range (between tilted and maximal disparity) // clt_parameters.fs_damp_tilt, // 0.001; // Damp tilt to handle insufficient (co-linear)data
clt_parameters.fs_far_mode, // 1; // Far objects filtering mode (0 - off, 1 - power of disparity) // clt_parameters.fs_min_tilt_disp, // 4.0; // Disparity switch between filtering modes - near objects use tilts, far - use max disparity
clt_parameters.fs_far_power, // 1.0; // Raise disparity to this power before averaging for far objects // clt_parameters.fs_transition, // 1.0; // Mode transition range (between tilted and maximal disparity)
// clt_parameters.fs_far_mode, // 1; // Far objects filtering mode (0 - off, 1 - power of disparity)
// clt_parameters.fs_far_power, // 1.0; // Raise disparity to this power before averaging for far objects
clt_parameters.stMeasSel); // bitmask of the selected measurements for supertiles : +1 - combo, +2 - quad +4 - hor +8 - vert clt_parameters.stMeasSel); // bitmask of the selected measurements for supertiles : +1 - combo, +2 - quad +4 - hor +8 - vert
dbg_hist[0] = scan_prev.getSuperTiles().showDisparityHistogram(); dbg_hist[0] = scan_prev.getSuperTiles().showDisparityHistogram();
...@@ -6227,22 +6239,23 @@ public class TileProcessor { ...@@ -6227,22 +6239,23 @@ public class TileProcessor {
clt_parameters.stStepThreshold, // double step_threshold, clt_parameters.stStepThreshold, // double step_threshold,
clt_parameters.stMinDisparity, // double min_disparity, clt_parameters.stMinDisparity, // double min_disparity,
clt_parameters.grow_disp_max, // double max_disparity, clt_parameters.grow_disp_max, // double max_disparity,
clt_parameters.stFloor, // double strength_floor, // clt_parameters.stFloor, // double strength_floor,
clt_parameters.stPow, // double strength_pow, // clt_parameters.stPow, // double strength_pow,
clt_parameters.stSigma, // with blur double stBlurSigma) clt_parameters.stSigma, // with blur double stBlurSigma)
false, //clt_parameters.stSmplMode, // Use sample mode (false - regular tile mode) false, //clt_parameters.stSmplMode, // Use sample mode (false - regular tile mode)
clt_parameters.stSmplSide, // Sample size (side of a square) clt_parameters.mlfp, // Filter parameters
clt_parameters.stSmplNum, // Number after removing worst // clt_parameters.stSmplSide, // Sample size (side of a square)
clt_parameters.stSmplRms, // Maximal RMS of the remaining tiles in a sample // clt_parameters.stSmplNum, // Number after removing worst
clt_parameters.stSmplWnd, // boolean smplWnd, // use window functions for the samples // clt_parameters.stSmplRms, // Maximal RMS of the remaining tiles in a sample
// clt_parameters.stSmplWnd, // boolean smplWnd, // use window functions for the samples
clt_parameters.fs_max_abs_tilt, // 2.0; // Maximal absolute tilt in pixels/tile
clt_parameters.fs_max_rel_tilt, // 0.2; // Maximal relative tilt in pixels/tile/disparity // clt_parameters.fs_max_abs_tilt, // 2.0; // Maximal absolute tilt in pixels/tile
clt_parameters.fs_damp_tilt, // 0.001; // Damp tilt to handle insufficient (co-linear)data // clt_parameters.fs_max_rel_tilt, // 0.2; // Maximal relative tilt in pixels/tile/disparity
clt_parameters.fs_min_tilt_disp, // 4.0; // Disparity switch between filtering modes - near objects use tilts, far - use max disparity // clt_parameters.fs_damp_tilt, // 0.001; // Damp tilt to handle insufficient (co-linear)data
clt_parameters.fs_transition, // 1.0; // Mode transition range (between tilted and maximal disparity) // clt_parameters.fs_min_tilt_disp, // 4.0; // Disparity switch between filtering modes - near objects use tilts, far - use max disparity
clt_parameters.fs_far_mode, // 1; // Far objects filtering mode (0 - off, 1 - power of disparity) // clt_parameters.fs_transition, // 1.0; // Mode transition range (between tilted and maximal disparity)
clt_parameters.fs_far_power, // 1.0; // Raise disparity to this power before averaging for far objects // clt_parameters.fs_far_mode, // 1; // Far objects filtering mode (0 - off, 1 - power of disparity)
// clt_parameters.fs_far_power, // 1.0; // Raise disparity to this power before averaging for far objects
clt_parameters.stMeasSel); // bitmask of the selected measurements for supertiles : +1 - combo, +2 - quad +4 - hor +8 - vert clt_parameters.stMeasSel); // bitmask of the selected measurements for supertiles : +1 - combo, +2 - quad +4 - hor +8 - vert
dbg_hist[1] = scan_prev.getSuperTiles().showDisparityHistogram(); dbg_hist[1] = scan_prev.getSuperTiles().showDisparityHistogram();
......
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