Commit 560db20f authored by Andrey Filippov's avatar Andrey Filippov

more on expanding

parent b771650e
......@@ -624,7 +624,6 @@ public class ExtendSurfaces {
final double [] values, // will be modified, Double.NaN is not yet assigned
final boolean [] known, // cells with known values (will not be modified)
final int num_steps, // how far to extend
// final boolean [] new_cells, // cells that need to be calculated
final int smpl_size, // == 5
final int min_points, // == 3
final boolean use_wnd, // use window function for the neighbors
......@@ -637,8 +636,11 @@ public class ExtendSurfaces {
final boolean extend_far, // extend far (false - extend near)
final int max_tries, // maximal number of smoothing steps
final double final_diff, // maximal change to finish iterations
final double grow_disp_min,
final double grow_disp_max,
final double grow_disp_step,
final double unique_pre_tolerance, // usually larger than clt_parameters.unique_tolerance
final boolean try_next, // try next disparity range if the current one was already tried
final int dbg_x,
final int dbg_y,
final int debugLevel)
......@@ -666,8 +668,12 @@ public class ExtendSurfaces {
values, // final double [] disparity,
true, // final boolean mod_selected,
true, // final boolean mod_disparity,
false, // final boolean en_near,
false, // final boolean en_far,
grow_disp_min, // final double grow_disp_min,
grow_disp_max, // final double grow_disp_max,
unique_pre_tolerance); // final double unique_pre_tolerance)
grow_disp_step, // final double grow_disp_step,
try_next ? 0.0: unique_pre_tolerance); // final double unique_pre_tolerance) // disable for try_next
for (int nstep = 0; nstep < num_steps; nstep++){
int num_new_cells = 0;
......@@ -694,8 +700,12 @@ public class ExtendSurfaces {
values, // final double [] disparity,
true, // final boolean mod_selected,
true, // final boolean mod_disparity,
false, // final boolean en_near,
false, // final boolean en_far,
grow_disp_min, // final double grow_disp_min,
grow_disp_max, // final double grow_disp_max,
unique_pre_tolerance); // final double unique_pre_tolerance)
grow_disp_step, // final double grow_disp_step,
try_next ? 0.0: unique_pre_tolerance); // final double unique_pre_tolerance) // disable for try_next
}
int mt = 2 * (nstep + 1); // max_tries; // or use k * nstep ???
......@@ -741,6 +751,24 @@ public class ExtendSurfaces {
System.out.println("expandDiscontinuity(): nstep="+nstep+" mt="+mt);
}
}
if (try_next){
tp.getTriedBefore(
passes, // final ArrayList <CLTPass3d> passes,
firstPass, // final int firstPass,
lastPassPlus1, // final int lastPassPlus1,
expanding, // final boolean [] selected,
prohibited, // final boolean [] prohibited,
values, // final double [] disparity,
true, // final boolean mod_selected,
true, // final boolean mod_disparity,
// TODO: some version to enable both en_near and en_far? or make en_far assume en_near and make it first?
!extend_far, // final boolean en_near,
extend_far, // final boolean en_far,
grow_disp_min, // final double grow_disp_min,
grow_disp_max, // final double grow_disp_max,
grow_disp_step, // final double grow_disp_step,
unique_pre_tolerance); // final double unique_pre_tolerance)
}
return expanding;
}
......@@ -766,8 +794,11 @@ public class ExtendSurfaces {
final boolean extend_far, // extend far (false - extend near)
final int max_tries, // maximal number of smoothing steps
final double final_diff, // maximal change to finish iterations
final double grow_disp_min,
final double grow_disp_max,
final double grow_disp_step,
final double unique_pre_tolerance, // usually larger than clt_parameters.unique_tolerance
final boolean try_next, // try next disparity range if the current one was already tried
final int dbg_x,
final int dbg_y,
final int debugLevel)
......@@ -784,6 +815,7 @@ public class ExtendSurfaces {
if (expanding == null){
return null; // no discontinuity seeds
}
boolean [] prohibited = tp.getTriedBefore(
passes, // final ArrayList <CLTPass3d> passes,
firstPass, // final int firstPass,
......@@ -793,8 +825,12 @@ public class ExtendSurfaces {
values, // final double [] disparity,
true, // final boolean mod_selected,
true, // final boolean mod_disparity,
false, // final boolean en_near,
false, // final boolean en_far,
grow_disp_min, // final double grow_disp_min,
grow_disp_max, // final double grow_disp_max,
unique_pre_tolerance); // final double unique_pre_tolerance)
grow_disp_step, // final double grow_disp_step,
try_next ? 0.0: unique_pre_tolerance); // final double unique_pre_tolerance) // disable for try_next
for (int nstep = 0; nstep < num_steps; nstep++){
int num_new_cells = 0;
......@@ -811,6 +847,7 @@ public class ExtendSurfaces {
dbg_x, // final int dbg_x,
dbg_y, // final int dbg_y,
debugLevel); // final int debugLevel)
tp.getTriedBefore(
passes, // final ArrayList <CLTPass3d> passes,
firstPass, // final int firstPass,
......@@ -820,8 +857,12 @@ public class ExtendSurfaces {
values, // final double [] disparity,
true, // final boolean mod_selected,
true, // final boolean mod_disparity,
false, // final boolean en_near,
false, // final boolean en_far,
grow_disp_min, // final double grow_disp_min,
grow_disp_max, // final double grow_disp_max,
unique_pre_tolerance); // final double unique_pre_tolerance)
grow_disp_step, // final double grow_disp_step,
try_next ? 0.0: unique_pre_tolerance); // final double unique_pre_tolerance) // disable for try_next
}
int mt = 2 * (nstep + 1); // max_tries; // or use k * nstep ???
// increase tries last iteration?
......@@ -867,6 +908,25 @@ public class ExtendSurfaces {
System.out.println("expandKnown(): nstep="+nstep+" mt="+mt);
}
}
if (try_next){
tp.getTriedBefore(
passes, // final ArrayList <CLTPass3d> passes,
firstPass, // final int firstPass,
lastPassPlus1, // final int lastPassPlus1,
expanding, // final boolean [] selected,
prohibited, // final boolean [] prohibited,
values, // final double [] disparity,
true, // final boolean mod_selected,
true, // final boolean mod_disparity,
// TODO: some version to enable both en_near and en_far? or make en_far assume en_near and make it first?
!extend_far, // final boolean en_near,
extend_far, // final boolean en_far,
grow_disp_min, // final double grow_disp_min,
grow_disp_max, // final double grow_disp_max,
grow_disp_step, // final double grow_disp_step,
unique_pre_tolerance); // final double unique_pre_tolerance)
}
return expanding;
}
......
......@@ -2228,7 +2228,7 @@ public class EyesisCorrectionParameters {
// New for initial growing
public boolean gr_new_expand = true;
public int gr_max_expand = 500; // 150; // 30;
public double gr_strength_floor = 0.9; // Should be normally less than combine_min_strength
public double gr_strength_floor = 0.09; // Should be normally less than combine_min_strength
public double gr_comboMinStrength = 0.3; // 0.3;
public double gr_comboMinStrengthHor = 0.3; // 0.3;
public double gr_comboMinStrengthVert = 0.3; // 0.3;
......@@ -2249,6 +2249,7 @@ public class EyesisCorrectionParameters {
public boolean gr_var_all_fg = true;
public boolean gr_var_new_bg = true;
public boolean gr_var_all_bg = true;
public boolean gr_var_next = true; // try next disparity range TODO: add related statements
public int gr_num_steps = 8; // How far to extend over previously undefined disparity tiles
public int gr_steps_over = 4; // How far to extend over previously determined disparity tiles
public int gr_smpl_size = 5; // Extend sample square side
......@@ -2833,6 +2834,7 @@ public class EyesisCorrectionParameters {
properties.setProperty(prefix+"gr_var_all_fg", this.gr_var_all_fg+"");
properties.setProperty(prefix+"gr_var_new_bg", this.gr_var_new_bg+"");
properties.setProperty(prefix+"gr_var_all_bg", this.gr_var_all_bg+"");
properties.setProperty(prefix+"gr_var_next", this.gr_var_next+"");
properties.setProperty(prefix+"gr_num_steps", this.gr_num_steps+"");
properties.setProperty(prefix+"gr_steps_over", this.gr_steps_over+"");
properties.setProperty(prefix+"gr_smpl_size", this.gr_smpl_size+"");
......@@ -3388,6 +3390,7 @@ public class EyesisCorrectionParameters {
if (properties.getProperty(prefix+"gr_var_all_fg")!=null) this.gr_var_all_fg=Boolean.parseBoolean(properties.getProperty(prefix+"gr_var_all_fg"));
if (properties.getProperty(prefix+"gr_var_new_bg")!=null) this.gr_var_new_bg=Boolean.parseBoolean(properties.getProperty(prefix+"gr_var_new_bg"));
if (properties.getProperty(prefix+"gr_var_all_bg")!=null) this.gr_var_all_bg=Boolean.parseBoolean(properties.getProperty(prefix+"gr_var_all_bg"));
if (properties.getProperty(prefix+"gr_var_next")!=null) this.gr_var_next=Boolean.parseBoolean(properties.getProperty(prefix+"gr_var_next"));
if (properties.getProperty(prefix+"gr_num_steps")!=null) this.gr_num_steps=Integer.parseInt(properties.getProperty(prefix+"gr_num_steps"));
if (properties.getProperty(prefix+"gr_steps_over")!=null) this.gr_steps_over=Integer.parseInt(properties.getProperty(prefix+"gr_steps_over"));
if (properties.getProperty(prefix+"gr_smpl_size")!=null) this.gr_smpl_size=Integer.parseInt(properties.getProperty(prefix+"gr_smpl_size"));
......@@ -3974,26 +3977,27 @@ public class EyesisCorrectionParameters {
gd.addNumericField("Maximal growing plate tilt in disparity pix per tile", this.gr_max_abs_tilt, 6);
gd.addNumericField("Maximal relative growing plate tilt in disparity pix per tile per disaprity pixel", this.gr_max_rel_tilt, 6);
gd.addNumericField("Discard variant if it requests too few tiles", this.gr_min_new, 0);
gd.addCheckbox ("Retry tiles around known foreground that have low max_tried_disparity", this.gr_var_new_sngl);
gd.addCheckbox ("Retry tiles around known foreground that have low max_tried_disparity", this.gr_var_new_fg);
gd.addCheckbox ("Retry tiles around known foreground that have low max_tried_disparity", this.gr_var_all_fg);
gd.addCheckbox ("Retry tiles around known foreground that have low max_tried_disparity", this.gr_var_new_bg);
gd.addCheckbox ("Retry tiles around known foreground that have low max_tried_disparity", this.gr_var_all_bg);
gd.addNumericField("Try these number of tiles around known ones", this.gr_num_steps, 0);
gd.addNumericField("Try these number of tiles around known ones", this.gr_steps_over, 0);
gd.addNumericField("Try these number of tiles around known ones", this.gr_smpl_size, 0);
gd.addNumericField("Try these number of tiles around known ones", this.gr_min_pnts, 0);
gd.addCheckbox ("Retry tiles around known foreground that have low max_tried_disparity", this.gr_use_wnd);
gd.addNumericField("Maximal disparity to try", this.gr_tilt_damp, 6);
gd.addNumericField("Maximal disparity to try", this.gr_split_rng, 6);
gd.addNumericField("Maximal disparity to try", this.gr_same_rng, 6);
gd.addNumericField("Maximal disparity to try", this.gr_diff_cont, 6);
gd.addNumericField("Maximal disparity to try", this.gr_abs_tilt, 6);
gd.addNumericField("Maximal disparity to try", this.gr_rel_tilt, 6);
gd.addNumericField("Try these number of tiles around known ones", this.gr_smooth, 0);
gd.addNumericField("Maximal disparity to try", this.gr_fin_diff, 6);
gd.addNumericField("Maximal disparity to try", this.gr_unique_tol, 6);
gd.addNumericField("Maximal disparity to try", this.gr_unique_pretol, 6);
gd.addCheckbox ("Expand only unambiguous tiles over previously undefined", this.gr_var_new_sngl);
gd.addCheckbox ("Expand unambiguous and FOREGROUND tiles over previously UNDEFINED", this.gr_var_new_fg);
gd.addCheckbox ("Expand unambiguous and FOREGROUND tiles over already DEFINED", this.gr_var_all_fg);
gd.addCheckbox ("Expand unambiguous and BACKGROUND tiles over previously UNDEFINED", this.gr_var_new_bg);
gd.addCheckbox ("Expand unambiguous and BACKGROUND tiles over already DEFINED", this.gr_var_all_bg);
gd.addCheckbox ("Try next disparity range that was not tried before", this.gr_var_next);
gd.addNumericField("How far to extend over previously undefined disparity tiles", this.gr_num_steps, 0);
gd.addNumericField("How far to extend over previously determined disparity tiles", this.gr_steps_over, 0);
gd.addNumericField("Extend sample plate square side", this.gr_smpl_size, 0);
gd.addNumericField("Extend at least this number of the seed tiles", this.gr_min_pnts, 0);
gd.addCheckbox ("Use window function for square sample ", this.gr_use_wnd);
gd.addNumericField("Tilt cost for damping insufficient plane data", this.gr_tilt_damp, 6);
gd.addNumericField("When growing, range of disparities to be extended without far/near subdivision", this.gr_split_rng, 6);
gd.addNumericField("Consider far/near tiles within that range from the farthest/closest", this.gr_same_rng, 6);
gd.addNumericField("Maximal difference from the old value when smoothing", this.gr_diff_cont, 6);
gd.addNumericField("Maximal filter disparity absolute tilt (pix per tile)", this.gr_abs_tilt, 6);
gd.addNumericField("Maximal filter disparity tilt (pix / disparity) per tile", this.gr_rel_tilt, 6);
gd.addNumericField("Maximal number of smoothing steps (reduce if long?)", this.gr_smooth, 0);
gd.addNumericField("Maximal change to finish smoothing iterations", this.gr_fin_diff, 6);
gd.addNumericField("Do not re-measure correlation if target disparity differs from some previous less", this.gr_unique_tol, 6);
gd.addNumericField("Larger tolerance for expanding (not refining)", this.gr_unique_pretol, 6);
gd.addMessage ("--- Planes detection ---");
......@@ -4554,6 +4558,7 @@ public class EyesisCorrectionParameters {
this.gr_var_all_fg= gd.getNextBoolean();
this.gr_var_new_bg= gd.getNextBoolean();
this.gr_var_all_bg= gd.getNextBoolean();
this.gr_var_next= gd.getNextBoolean();
this.gr_num_steps= (int) gd.getNextNumber();
this.gr_steps_over= (int) gd.getNextNumber();
this.gr_smpl_size= (int) gd.getNextNumber();
......
This diff is collapsed.
This diff is collapsed.
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