Commit d67d3674 authored by Andrey Filippov's avatar Andrey Filippov

working on second level correlation

parent 560db20f
...@@ -2178,7 +2178,7 @@ public class EyesisCorrectionParameters { ...@@ -2178,7 +2178,7 @@ 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 stMaxDisparity = 15.0; // Maximal disparity (center of a bin)
public double stFloor = 0.15; // Subtract from strength, discard negative public double stFloor = 0.15; // Subtract from strength, discard negative
public double stPow = 1.0; // raise strength to this power 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)
...@@ -2216,8 +2216,8 @@ public class EyesisCorrectionParameters { ...@@ -2216,8 +2216,8 @@ public class EyesisCorrectionParameters {
// Multi-pass growing disparity // Multi-pass growing disparity
public int grow_sweep = 8; // Try these number of tiles around known ones public int grow_sweep = 8; // Try these number of tiles around known ones
public double grow_disp_max = 100.0; // Maximal disparity to try public double grow_disp_max = 160.0;// Maximal disparity to try
public double grow_disp_trust = 6.0; // Trust measured disparity within +/- this value public double grow_disp_trust = 4.0; // Trust measured disparity within +/- this value
public double grow_disp_step = 6.0; // Increase disparity (from maximal tried) if nothing found in that tile // TODO: handle enclosed dips? public double grow_disp_step = 6.0; // Increase disparity (from maximal tried) if nothing found in that tile // TODO: handle enclosed dips?
public double grow_min_diff = 0.5; // Grow more only if at least one channel has higher variance from others for the tile public double grow_min_diff = 0.5; // Grow more only if at least one channel has higher variance from others for the tile
...@@ -2226,22 +2226,30 @@ public class EyesisCorrectionParameters { ...@@ -2226,22 +2226,30 @@ public class EyesisCorrectionParameters {
public boolean grow_retry_inf = false; // Retry border tiles that were identified as infinity earlier public boolean grow_retry_inf = false; // Retry border tiles that were identified as infinity earlier
// New for initial growing // New for initial growing
public boolean gr_new_expand = true; public boolean gr_new_expand = true;
public int gr_max_expand = 500; // 150; // 30; public int gr_max_expand = 500; // 150; // 30;
public double gr_strength_floor = 0.09; // Should be normally less than combine_min_strength public double gr_ovrbg_cmb = 0.3; // 0.3;
public double gr_comboMinStrength = 0.3; // 0.3; public double gr_ovrbg_cmb_hor = 0.3; // 0.3;
public double gr_comboMinStrengthHor = 0.3; // 0.3; public double gr_ovrbg_cmb_vert = 0.3; // 0.3;
public double gr_comboMinStrengthVert = 0.3; // 0.3; public double gr_ovrbg_filtered = 0.3; // 0.3;
public double gr_filterMinStrength = 0.3; // 0.3;
public double gr_strength_pow = 1.0; public double fds_str_floor = 0.09; // Should be normally less than combine_min_strength
public int gr_smplSide = 5; // 3; // Sample size (side of a square) public double fds_str_pow = 1.0;
public int gr_smplNum = 13; // 13; // 5; // Number after removing worst (should be >1) public int fds_smpl_side = 5; // 3; // Sample size (side of a square)
public double gr_smplRms = 0.15; // Maximal RMS of the remaining tiles in a sample public int fds_smpl_num = 13; // 13; // 5; // Number after removing worst (should be >1)
public double gr_smplRelRms = 0.01; // 05; // Maximal RMS/disparity in addition to smplRms public double fds_smpl_rms = 0.15; // Maximal RMS of the remaining tiles in a sample
public boolean gr_smplWnd = true; // public double fds_smpl_rel_rms = 0.01; // 05; // Maximal RMS/disparity in addition to smplRms
public double gr_max_abs_tilt = 2.0; // pix per tile public boolean fds_smpl_wnd = true; //
public double gr_max_rel_tilt = 0.2; // (pix / disparity) per tile public double fds_abs_tilt = 2.0; // pix per tile
public double fds_rel_tilt = 0.2; // (pix / disparity) per tile
// Macro disparity scanning parameters
public double mc_disp8_step = 2.0; // Macro disparity scan step (actual disparity step is 8x)
public double mc_disp8_trust = 3.0; //Trust measured disparity within +/- this value
public double mc_strength = 0.2; // Minimal composite correlation to process
public double mc_unique_tol = 0.1; // Do not re-measure macro correlation if target disparity differs from some previous by this
// 0x1e, // 0x1f, // final int variants_mask, // 0x1e, // 0x1f, // final int variants_mask,
public int gr_min_new = 20; // Discard variant if it requests too few tiles public int gr_min_new = 20; // Discard variant if it requests too few tiles
public boolean gr_var_new_sngl = false;// Expand only unambiguous tiles over previously undefined public boolean gr_var_new_sngl = false;// Expand only unambiguous tiles over previously undefined
...@@ -2772,7 +2780,7 @@ public class EyesisCorrectionParameters { ...@@ -2772,7 +2780,7 @@ 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+"stMaxDisparity", this.stMaxDisparity +"");
properties.setProperty(prefix+"stFloor", this.stFloor +""); properties.setProperty(prefix+"stFloor", this.stFloor +"");
properties.setProperty(prefix+"stPow", this.stPow +""); properties.setProperty(prefix+"stPow", this.stPow +"");
properties.setProperty(prefix+"stSigma", this.stSigma +""); properties.setProperty(prefix+"stSigma", this.stSigma +"");
...@@ -2815,19 +2823,25 @@ public class EyesisCorrectionParameters { ...@@ -2815,19 +2823,25 @@ public class EyesisCorrectionParameters {
properties.setProperty(prefix+"gr_new_expand", this.gr_new_expand+""); properties.setProperty(prefix+"gr_new_expand", this.gr_new_expand+"");
properties.setProperty(prefix+"gr_max_expand", this.gr_max_expand+""); properties.setProperty(prefix+"gr_max_expand", this.gr_max_expand+"");
properties.setProperty(prefix+"gr_strength_floor",this.gr_strength_floor +""); properties.setProperty(prefix+"fds_str_floor", this.fds_str_floor +"");
properties.setProperty(prefix+"gr_comboMinStrength", this.gr_comboMinStrength +""); properties.setProperty(prefix+"gr_ovrbg_cmb", this.gr_ovrbg_cmb +"");
properties.setProperty(prefix+"gr_comboMinStrengthHor", this.gr_comboMinStrengthHor +""); properties.setProperty(prefix+"gr_ovrbg_cmb_hor", this.gr_ovrbg_cmb_hor +"");
properties.setProperty(prefix+"gr_comboMinStrengthVert",this.gr_comboMinStrengthVert +""); properties.setProperty(prefix+"gr_ovrbg_cmb_vert",this.gr_ovrbg_cmb_vert +"");
properties.setProperty(prefix+"gr_filterMinStrength", this.gr_filterMinStrength +""); properties.setProperty(prefix+"gr_ovrbg_filtered",this.gr_ovrbg_filtered +"");
properties.setProperty(prefix+"gr_strength_pow", this.gr_strength_pow +""); properties.setProperty(prefix+"fds_str_pow", this.fds_str_pow +"");
properties.setProperty(prefix+"gr_smplSide", this.gr_smplSide+""); properties.setProperty(prefix+"fds_smpl_side", this.fds_smpl_side+"");
properties.setProperty(prefix+"gr_smplNum", this.gr_smplNum+""); properties.setProperty(prefix+"fds_smpl_num", this.fds_smpl_num+"");
properties.setProperty(prefix+"gr_smplRms", this.gr_smplRms +""); properties.setProperty(prefix+"fds_smpl_rms", this.fds_smpl_rms +"");
properties.setProperty(prefix+"gr_smplRelRms", this.gr_smplRelRms +""); properties.setProperty(prefix+"fds_smpl_rel_rms", this.fds_smpl_rel_rms +"");
properties.setProperty(prefix+"gr_smplWnd", this.gr_smplWnd+""); properties.setProperty(prefix+"fds_smpl_wnd", this.fds_smpl_wnd+"");
properties.setProperty(prefix+"gr_max_abs_tilt", this.gr_max_abs_tilt +""); properties.setProperty(prefix+"fds_abs_tilt", this.fds_abs_tilt +"");
properties.setProperty(prefix+"gr_max_rel_tilt", this.gr_max_rel_tilt +""); properties.setProperty(prefix+"fds_rel_tilt", this.fds_rel_tilt +"");
properties.setProperty(prefix+"mc_disp8_step", this.mc_disp8_step +"");
properties.setProperty(prefix+"mc_disp8_trust", this.mc_disp8_trust +"");
properties.setProperty(prefix+"mc_strength", this.mc_strength +"");
properties.setProperty(prefix+"mc_unique_tol", this.mc_unique_tol +"");
properties.setProperty(prefix+"gr_min_new", this.gr_min_new+""); properties.setProperty(prefix+"gr_min_new", this.gr_min_new+"");
properties.setProperty(prefix+"gr_var_new_sngl", this.gr_var_new_sngl+""); properties.setProperty(prefix+"gr_var_new_sngl", this.gr_var_new_sngl+"");
properties.setProperty(prefix+"gr_var_new_fg", this.gr_var_new_fg+""); properties.setProperty(prefix+"gr_var_new_fg", this.gr_var_new_fg+"");
...@@ -3329,7 +3343,7 @@ public class EyesisCorrectionParameters { ...@@ -3329,7 +3343,7 @@ public class EyesisCorrectionParameters {
if (properties.getProperty(prefix+"stStepNear")!=null) this.stStepNear=Double.parseDouble(properties.getProperty(prefix+"stStepNear")); if (properties.getProperty(prefix+"stStepNear")!=null) this.stStepNear=Double.parseDouble(properties.getProperty(prefix+"stStepNear"));
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+"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+"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"));
...@@ -3369,43 +3383,49 @@ public class EyesisCorrectionParameters { ...@@ -3369,43 +3383,49 @@ public class EyesisCorrectionParameters {
if (properties.getProperty(prefix+"grow_pedantic")!=null) this.grow_pedantic=Boolean.parseBoolean(properties.getProperty(prefix+"grow_pedantic")); if (properties.getProperty(prefix+"grow_pedantic")!=null) this.grow_pedantic=Boolean.parseBoolean(properties.getProperty(prefix+"grow_pedantic"));
if (properties.getProperty(prefix+"grow_retry_inf")!=null) this.grow_retry_inf=Boolean.parseBoolean(properties.getProperty(prefix+"grow_retry_inf")); if (properties.getProperty(prefix+"grow_retry_inf")!=null) this.grow_retry_inf=Boolean.parseBoolean(properties.getProperty(prefix+"grow_retry_inf"));
if (properties.getProperty(prefix+"gr_new_expand")!=null) this.gr_new_expand=Boolean.parseBoolean(properties.getProperty(prefix+"gr_new_expand")); if (properties.getProperty(prefix+"gr_new_expand")!=null) this.gr_new_expand=Boolean.parseBoolean(properties.getProperty(prefix+"gr_new_expand"));
if (properties.getProperty(prefix+"gr_max_expand")!=null) this.gr_max_expand=Integer.parseInt(properties.getProperty(prefix+"gr_max_expand")); if (properties.getProperty(prefix+"gr_max_expand")!=null) this.gr_max_expand=Integer.parseInt(properties.getProperty(prefix+"gr_max_expand"));
if (properties.getProperty(prefix+"gr_strength_floor")!=null) this.gr_strength_floor=Double.parseDouble(properties.getProperty(prefix+"gr_strength_floor")); if (properties.getProperty(prefix+"fds_str_floor")!=null) this.fds_str_floor=Double.parseDouble(properties.getProperty(prefix+"fds_str_floor"));
if (properties.getProperty(prefix+"gr_comboMinStrength")!=null) this.gr_comboMinStrength=Double.parseDouble(properties.getProperty(prefix+"gr_comboMinStrength")); if (properties.getProperty(prefix+"gr_ovrbg_cmb")!=null) this.gr_ovrbg_cmb=Double.parseDouble(properties.getProperty(prefix+"gr_ovrbg_cmb"));
if (properties.getProperty(prefix+"gr_comboMinStrengthHor")!=null) this.gr_comboMinStrengthHor=Double.parseDouble(properties.getProperty(prefix+"gr_comboMinStrengthHor")); if (properties.getProperty(prefix+"gr_ovrbg_cmb_hor")!=null) this.gr_ovrbg_cmb_hor=Double.parseDouble(properties.getProperty(prefix+"gr_ovrbg_cmb_hor"));
if (properties.getProperty(prefix+"gr_comboMinStrengthVert")!=null) this.gr_comboMinStrengthVert=Double.parseDouble(properties.getProperty(prefix+"gr_comboMinStrengthVert")); if (properties.getProperty(prefix+"gr_ovrbg_cmb_vert")!=null) this.gr_ovrbg_cmb_vert=Double.parseDouble(properties.getProperty(prefix+"gr_ovrbg_cmb_vert"));
if (properties.getProperty(prefix+"gr_filterMinStrength")!=null) this.gr_filterMinStrength=Double.parseDouble(properties.getProperty(prefix+"gr_filterMinStrength")); if (properties.getProperty(prefix+"gr_ovrbg_filtered")!=null) this.gr_ovrbg_filtered=Double.parseDouble(properties.getProperty(prefix+"gr_ovrbg_filtered"));
if (properties.getProperty(prefix+"gr_strength_pow")!=null) this.gr_strength_pow=Double.parseDouble(properties.getProperty(prefix+"gr_strength_pow")); if (properties.getProperty(prefix+"fds_str_pow")!=null) this.fds_str_pow=Double.parseDouble(properties.getProperty(prefix+"fds_str_pow"));
if (properties.getProperty(prefix+"gr_smplSide")!=null) this.gr_smplSide=Integer.parseInt(properties.getProperty(prefix+"gr_smplSide")); if (properties.getProperty(prefix+"fds_smpl_side")!=null) this.fds_smpl_side=Integer.parseInt(properties.getProperty(prefix+"fds_smpl_side"));
if (properties.getProperty(prefix+"gr_smplNum")!=null) this.gr_smplNum=Integer.parseInt(properties.getProperty(prefix+"gr_smplNum")); if (properties.getProperty(prefix+"fds_smpl_num")!=null) this.fds_smpl_num=Integer.parseInt(properties.getProperty(prefix+"fds_smpl_num"));
if (properties.getProperty(prefix+"gr_smplRms")!=null) this.gr_smplRms=Double.parseDouble(properties.getProperty(prefix+"gr_smplRms")); if (properties.getProperty(prefix+"fds_smpl_rms")!=null) this.fds_smpl_rms=Double.parseDouble(properties.getProperty(prefix+"fds_smpl_rms"));
if (properties.getProperty(prefix+"gr_smplRelRms")!=null) this.gr_smplRelRms=Double.parseDouble(properties.getProperty(prefix+"gr_smplRelRms")); if (properties.getProperty(prefix+"fds_smpl_rel_rms")!=null) this.fds_smpl_rel_rms=Double.parseDouble(properties.getProperty(prefix+"fds_smpl_rel_rms"));
if (properties.getProperty(prefix+"gr_smplWnd")!=null) this.gr_smplWnd=Boolean.parseBoolean(properties.getProperty(prefix+"gr_smplWnd")); if (properties.getProperty(prefix+"fds_smpl_wnd")!=null) this.fds_smpl_wnd=Boolean.parseBoolean(properties.getProperty(prefix+"fds_smpl_wnd"));
if (properties.getProperty(prefix+"gr_max_abs_tilt")!=null) this.gr_max_abs_tilt=Double.parseDouble(properties.getProperty(prefix+"gr_max_abs_tilt")); if (properties.getProperty(prefix+"fds_abs_tilt")!=null) this.fds_abs_tilt=Double.parseDouble(properties.getProperty(prefix+"fds_abs_tilt"));
if (properties.getProperty(prefix+"gr_max_rel_tilt")!=null) this.gr_max_rel_tilt=Double.parseDouble(properties.getProperty(prefix+"gr_max_rel_tilt")); if (properties.getProperty(prefix+"fds_rel_tilt")!=null) this.fds_rel_tilt=Double.parseDouble(properties.getProperty(prefix+"fds_rel_tilt"));
if (properties.getProperty(prefix+"gr_min_new")!=null) this.gr_min_new=Integer.parseInt(properties.getProperty(prefix+"gr_min_new"));
if (properties.getProperty(prefix+"gr_var_new_sngl")!=null) this.gr_var_new_sngl=Boolean.parseBoolean(properties.getProperty(prefix+"gr_var_new_sngl")); if (properties.getProperty(prefix+"mc_disp8_step")!=null) this.mc_disp8_step=Double.parseDouble(properties.getProperty(prefix+"mc_disp8_step"));
if (properties.getProperty(prefix+"gr_var_new_fg")!=null) this.gr_var_new_fg=Boolean.parseBoolean(properties.getProperty(prefix+"gr_var_new_fg")); if (properties.getProperty(prefix+"mc_disp8_trust")!=null) this.mc_disp8_trust=Double.parseDouble(properties.getProperty(prefix+"mc_disp8_trust"));
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+"mc_strength")!=null) this.mc_strength=Double.parseDouble(properties.getProperty(prefix+"mc_strength"));
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+"mc_unique_tol")!=null) this.mc_unique_tol=Double.parseDouble(properties.getProperty(prefix+"mc_unique_tol"));
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_min_new")!=null) this.gr_min_new=Integer.parseInt(properties.getProperty(prefix+"gr_min_new"));
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_var_new_sngl")!=null) this.gr_var_new_sngl=Boolean.parseBoolean(properties.getProperty(prefix+"gr_var_new_sngl"));
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_var_new_fg")!=null) this.gr_var_new_fg=Boolean.parseBoolean(properties.getProperty(prefix+"gr_var_new_fg"));
if (properties.getProperty(prefix+"gr_smpl_size")!=null) this.gr_smpl_size=Integer.parseInt(properties.getProperty(prefix+"gr_smpl_size")); 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_min_pnts")!=null) this.gr_min_pnts=Integer.parseInt(properties.getProperty(prefix+"gr_min_pnts")); 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_use_wnd")!=null) this.gr_use_wnd=Boolean.parseBoolean(properties.getProperty(prefix+"gr_use_wnd")); 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_tilt_damp")!=null) this.gr_tilt_damp=Double.parseDouble(properties.getProperty(prefix+"gr_tilt_damp")); 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_split_rng")!=null) this.gr_split_rng=Double.parseDouble(properties.getProperty(prefix+"gr_split_rng")); 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_same_rng")!=null) this.gr_same_rng=Double.parseDouble(properties.getProperty(prefix+"gr_same_rng")); 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_diff_cont")!=null) this.gr_diff_cont=Double.parseDouble(properties.getProperty(prefix+"gr_diff_cont")); if (properties.getProperty(prefix+"gr_smpl_size")!=null) this.gr_smpl_size=Integer.parseInt(properties.getProperty(prefix+"gr_smpl_size"));
if (properties.getProperty(prefix+"gr_abs_tilt")!=null) this.gr_abs_tilt=Double.parseDouble(properties.getProperty(prefix+"gr_abs_tilt")); if (properties.getProperty(prefix+"gr_min_pnts")!=null) this.gr_min_pnts=Integer.parseInt(properties.getProperty(prefix+"gr_min_pnts"));
if (properties.getProperty(prefix+"gr_rel_tilt")!=null) this.gr_rel_tilt=Double.parseDouble(properties.getProperty(prefix+"gr_rel_tilt")); if (properties.getProperty(prefix+"gr_use_wnd")!=null) this.gr_use_wnd=Boolean.parseBoolean(properties.getProperty(prefix+"gr_use_wnd"));
if (properties.getProperty(prefix+"gr_smooth")!=null) this.gr_smooth=Integer.parseInt(properties.getProperty(prefix+"gr_smooth")); if (properties.getProperty(prefix+"gr_tilt_damp")!=null) this.gr_tilt_damp=Double.parseDouble(properties.getProperty(prefix+"gr_tilt_damp"));
if (properties.getProperty(prefix+"gr_fin_diff")!=null) this.gr_fin_diff=Double.parseDouble(properties.getProperty(prefix+"gr_fin_diff")); if (properties.getProperty(prefix+"gr_split_rng")!=null) this.gr_split_rng=Double.parseDouble(properties.getProperty(prefix+"gr_split_rng"));
if (properties.getProperty(prefix+"gr_unique_tol")!=null) this.gr_unique_tol=Double.parseDouble(properties.getProperty(prefix+"gr_unique_tol")); if (properties.getProperty(prefix+"gr_same_rng")!=null) this.gr_same_rng=Double.parseDouble(properties.getProperty(prefix+"gr_same_rng"));
if (properties.getProperty(prefix+"gr_unique_pretol")!=null) this.gr_unique_pretol=Double.parseDouble(properties.getProperty(prefix+"gr_unique_pretol")); if (properties.getProperty(prefix+"gr_diff_cont")!=null) this.gr_diff_cont=Double.parseDouble(properties.getProperty(prefix+"gr_diff_cont"));
if (properties.getProperty(prefix+"gr_abs_tilt")!=null) this.gr_abs_tilt=Double.parseDouble(properties.getProperty(prefix+"gr_abs_tilt"));
if (properties.getProperty(prefix+"gr_rel_tilt")!=null) this.gr_rel_tilt=Double.parseDouble(properties.getProperty(prefix+"gr_rel_tilt"));
if (properties.getProperty(prefix+"gr_smooth")!=null) this.gr_smooth=Integer.parseInt(properties.getProperty(prefix+"gr_smooth"));
if (properties.getProperty(prefix+"gr_fin_diff")!=null) this.gr_fin_diff=Double.parseDouble(properties.getProperty(prefix+"gr_fin_diff"));
if (properties.getProperty(prefix+"gr_unique_tol")!=null) this.gr_unique_tol=Double.parseDouble(properties.getProperty(prefix+"gr_unique_tol"));
if (properties.getProperty(prefix+"gr_unique_pretol")!=null) this.gr_unique_pretol=Double.parseDouble(properties.getProperty(prefix+"gr_unique_pretol"));
if (properties.getProperty(prefix+"plPreferDisparity")!=null) this.plPreferDisparity=Boolean.parseBoolean(properties.getProperty(prefix+"plPreferDisparity")); if (properties.getProperty(prefix+"plPreferDisparity")!=null) this.plPreferDisparity=Boolean.parseBoolean(properties.getProperty(prefix+"plPreferDisparity"));
if (properties.getProperty(prefix+"plDispNorm")!=null) this.plDispNorm=Double.parseDouble(properties.getProperty(prefix+"plDispNorm")); if (properties.getProperty(prefix+"plDispNorm")!=null) this.plDispNorm=Double.parseDouble(properties.getProperty(prefix+"plDispNorm"));
...@@ -3918,7 +3938,9 @@ public class EyesisCorrectionParameters { ...@@ -3918,7 +3938,9 @@ public class EyesisCorrectionParameters {
gd.addNumericField("Disparity histogram step for near objects", this.stStepNear, 6); gd.addNumericField("Disparity histogram step for near objects", this.stStepNear, 6);
gd.addNumericField("Disparity threshold to switch from linear to logarithmic steps", this.stStepThreshold, 6); gd.addNumericField("Disparity threshold to switch from linear to logarithmic steps", this.stStepThreshold, 6);
gd.addNumericField("Minimal disparity (center of a bin)", this.stMinDisparity, 6); gd.addNumericField("Minimal disparity (center of a bin)", this.stMinDisparity, 6);
gd.addNumericField("Maximal disparity (center of a bin)", this.stMaxDisparity, 6);
// gd.addNumericField("Maximal disparity (center of a bin)", this.stMaxDisparity, 6);
gd.addMessage ("aximal 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);
...@@ -3963,19 +3985,31 @@ public class EyesisCorrectionParameters { ...@@ -3963,19 +3985,31 @@ public class EyesisCorrectionParameters {
gd.addCheckbox ("New expansion mode", this.gr_new_expand); gd.addCheckbox ("New expansion mode", this.gr_new_expand);
gd.addNumericField("Expansion steps limit", this.gr_max_expand, 0); gd.addNumericField("Expansion steps limit", this.gr_max_expand, 0);
gd.addNumericField("Strength floor for multi-tile (now 5x5) samples (normally < combine_min_strength) ", this.gr_strength_floor, 6); gd.addNumericField("Strength floor for multi-tile (now 5x5) samples (normally < combine_min_strength) ", this.fds_str_floor, 6);
gd.addNumericField("Over background extra reliable strength", this.gr_comboMinStrength, 6); gd.addNumericField("Over background extra reliable strength", this.gr_ovrbg_cmb, 6);
gd.addNumericField("Over background extra reliable strength horizontal", this.gr_comboMinStrengthHor, 6); gd.addNumericField("Over background extra reliable strength horizontal", this.gr_ovrbg_cmb_hor, 6);
gd.addNumericField("Over background extra reliable strength vertical", this.gr_comboMinStrengthVert, 6); gd.addNumericField("Over background extra reliable strength vertical", this.gr_ovrbg_cmb_vert, 6);
gd.addNumericField("Over background filtered extra reliable strength", this.gr_filterMinStrength, 6); gd.addNumericField("Over background filtered extra reliable strength", this.gr_ovrbg_filtered, 6);
gd.addNumericField("Strength power exponent for tilted plates growing", this.gr_strength_pow, 6);
gd.addNumericField("Sample size (side of a square) for tilted plates growing", this.gr_smplSide, 0); gd.addMessage ("--- \"plate\" filtering when growing parameters ---");
gd.addNumericField("Number of tiles in a square tilted plate (should be >1)", this.gr_smplNum, 0); gd.addNumericField("Strength power exponent for tilted plates growing", this.fds_str_pow, 6);
gd.addNumericField("Maximal RMS for the tiles to the tilted plate", this.gr_smplRms, 6); gd.addNumericField("Sample size (side of a square) for tilted plates growing", this.fds_smpl_side, 0);
gd.addNumericField("Maximal relative RMS for the tiles to the tilted plate - multiply by disparity and add", this.gr_smplRelRms, 6); gd.addNumericField("Number of tiles in a square tilted plate (should be >1)", this.fds_smpl_num, 0);
gd.addCheckbox ("Use window function for the square sample plates", this.gr_smplWnd); gd.addNumericField("Maximal RMS for the tiles to the tilted plate", this.fds_smpl_rms, 6);
gd.addNumericField("Maximal growing plate tilt in disparity pix per tile", this.gr_max_abs_tilt, 6); gd.addNumericField("Maximal relative RMS for the tiles to the tilted plate - multiply by disparity and add", this.fds_smpl_rel_rms, 6);
gd.addNumericField("Maximal relative growing plate tilt in disparity pix per tile per disaprity pixel", this.gr_max_rel_tilt, 6); gd.addCheckbox ("Use window function for the square sample plates", this.fds_smpl_wnd);
gd.addNumericField("Maximal growing plate tilt in disparity pix per tile", this.fds_abs_tilt, 6);
gd.addNumericField("Maximal relative growing plate tilt in disparity pix per tile per disaprity pixel", this.fds_rel_tilt, 6);
gd.addMessage ("--- Macro correlation parameters ---");
gd.addNumericField("Macro disparity scan step (actual disparity step is 8x)", this.mc_disp8_step, 6);
gd.addNumericField("Trust measured macro(8x) disparity within +/- this value ", this.mc_disp8_trust, 6);
gd.addNumericField("Minimal macro correlation strength to process", this.mc_strength, 6);
gd.addNumericField("Do not re-measure macro correlation if target disparity differs less", this.mc_unique_tol, 6);
gd.addMessage ("--- more growing parameters ---");
gd.addNumericField("Discard variant if it requests too few tiles", this.gr_min_new, 0); gd.addNumericField("Discard variant if it requests too few tiles", this.gr_min_new, 0);
gd.addCheckbox ("Expand only unambiguous tiles over previously undefined", this.gr_var_new_sngl); 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 previously UNDEFINED", this.gr_var_new_fg);
...@@ -4497,7 +4531,7 @@ public class EyesisCorrectionParameters { ...@@ -4497,7 +4531,7 @@ public class EyesisCorrectionParameters {
this.stStepNear= gd.getNextNumber(); this.stStepNear= gd.getNextNumber();
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.stFloor= gd.getNextNumber();
this.stPow= gd.getNextNumber(); this.stPow= gd.getNextNumber();
this.stSigma= gd.getNextNumber(); this.stSigma= gd.getNextNumber();
...@@ -4539,19 +4573,25 @@ public class EyesisCorrectionParameters { ...@@ -4539,19 +4573,25 @@ public class EyesisCorrectionParameters {
this.gr_new_expand= gd.getNextBoolean(); this.gr_new_expand= gd.getNextBoolean();
this.gr_max_expand= (int) gd.getNextNumber(); this.gr_max_expand= (int) gd.getNextNumber();
this.gr_strength_floor= gd.getNextNumber(); this.fds_str_floor= gd.getNextNumber();
this.gr_comboMinStrength= gd.getNextNumber(); this.gr_ovrbg_cmb= gd.getNextNumber();
this.gr_comboMinStrengthHor= gd.getNextNumber(); this.gr_ovrbg_cmb_hor= gd.getNextNumber();
this.gr_comboMinStrengthVert= gd.getNextNumber(); this.gr_ovrbg_cmb_vert= gd.getNextNumber();
this.gr_filterMinStrength= gd.getNextNumber(); this.gr_ovrbg_filtered= gd.getNextNumber();
this.gr_strength_pow= gd.getNextNumber(); this.fds_str_pow= gd.getNextNumber();
this.gr_smplSide= (int) gd.getNextNumber(); this.fds_smpl_side= (int) gd.getNextNumber();
this.gr_smplNum= (int) gd.getNextNumber(); this.fds_smpl_num= (int) gd.getNextNumber();
this.gr_smplRms= gd.getNextNumber(); this.fds_smpl_rms= gd.getNextNumber();
this.gr_smplRelRms= gd.getNextNumber(); this.fds_smpl_rel_rms= gd.getNextNumber();
this.gr_smplWnd= gd.getNextBoolean(); this.fds_smpl_wnd= gd.getNextBoolean();
this.gr_max_abs_tilt= gd.getNextNumber(); this.fds_abs_tilt= gd.getNextNumber();
this.gr_max_rel_tilt= gd.getNextNumber(); this.fds_rel_tilt= gd.getNextNumber();
this.mc_disp8_step= gd.getNextNumber();
this.mc_disp8_trust= gd.getNextNumber();
this.mc_strength= gd.getNextNumber();
this.mc_unique_tol= gd.getNextNumber();
this.gr_min_new= (int) gd.getNextNumber(); this.gr_min_new= (int) gd.getNextNumber();
this.gr_var_new_sngl= gd.getNextBoolean(); this.gr_var_new_sngl= gd.getNextBoolean();
this.gr_var_new_fg= gd.getNextBoolean(); this.gr_var_new_fg= gd.getNextBoolean();
......
...@@ -72,6 +72,8 @@ public class GeometryCorrection { ...@@ -72,6 +72,8 @@ public class GeometryCorrection {
public double [][] XYZ_he; // all cameras coordinates transformed to eliminate heading and elevation (rolls preserved) public double [][] XYZ_he; // all cameras coordinates transformed to eliminate heading and elevation (rolls preserved)
public double [][] XYZ_her = null; // XYZ of the lenses in a corrected CCS (adjusted for to elevation, heading, common_roll) public double [][] XYZ_her = null; // XYZ of the lenses in a corrected CCS (adjusted for to elevation, heading, common_roll)
public double [][] rXY = null; // XY pairs of the in a normal plane, relative to disparityRadius public double [][] rXY = null; // XY pairs of the in a normal plane, relative to disparityRadius
public double [][] rXY_ideal = {{-0.5, -0.5}, {0.5,-0.5}, {-0.5, 0.5}, {0.5,0.5}};
public double cameraRadius=0; // average distance from the "mass center" of the sensors to the sensors public double cameraRadius=0; // average distance from the "mass center" of the sensors to the sensors
public double disparityRadius=0; // distance between cameras to normalize disparity units to. sqrt(2)*disparityRadius for quad camera (~=150mm)? public double disparityRadius=0; // distance between cameras to normalize disparity units to. sqrt(2)*disparityRadius for quad camera (~=150mm)?
...@@ -596,11 +598,15 @@ public class GeometryCorrection { ...@@ -596,11 +598,15 @@ public class GeometryCorrection {
return jacobian; return jacobian;
} }
/* /**
* Calculate pixel coordinates for each of numSensors images, for a given (px,py) of the idealized "center" (still distorted) image * Calculate pixel coordinates for each of numSensors images, for a given (px,py) of the idealized "center" (still distorted) image
* and generic disparity, measured in pixels * and generic disparity, measured in pixels
* @param px pixel X coordinate
* @param py pixel Y coordinate
* @param disparity disparity
* @return array of per port pairs of pixel shifts
*/ */
public double [][] getPortsCoordinates( public double [][] getPortsCoordinates(
double px, double px,
double py, double py,
...@@ -627,7 +633,7 @@ public class GeometryCorrection { ...@@ -627,7 +633,7 @@ public class GeometryCorrection {
double rri = 1.0; double rri = 1.0;
for (int j = 0; j < a.length; j++){ for (int j = 0; j < a.length; j++){
rri *= ri; rri *= ri;
rD2rND += a[j]*(rri - a[j]); rD2rND += a[j]*(rri - a[j]); // BUG here !!!! - fix later, will need to re-adjust all fine corr
} }
double pXid = pXci * rD2rND; double pXid = pXci * rD2rND;
double pYid = pYci * rD2rND; double pYid = pYci * rD2rND;
...@@ -640,6 +646,117 @@ public class GeometryCorrection { ...@@ -640,6 +646,117 @@ public class GeometryCorrection {
return pXY; return pXY;
} }
public double [][] getPortsCoordinatesIdeal_wrong(
double px,
double py,
double disparity)
{
double [][] pXY = new double [numSensors][2];
double pXcd = px - 0.5 * this.pixelCorrectionWidth;
double pYcd = py - 0.5 * this.pixelCorrectionHeight;
double rD = Math.sqrt(pXcd*pXcd + pYcd*pYcd)*0.001*this.pixelSize; // distorted radius in a virtual center camera
double rND2R=getRByRDist(rD/this.distortionRadius, (debugLevel > -1));
double pXc = pXcd * rND2R; // non-distorted coordinates relative to the (0.5 * this.pixelCorrectionWidth, 0.5 * this.pixelCorrectionHeight)
double pYc = pYcd * rND2R; // in pixels
double [] a={this.distortionC,this.distortionB,this.distortionA,this.distortionA5,this.distortionA6,this.distortionA7,this.distortionA8};
for (int i = 0; i < numSensors; i++){
// non-distorted XY of the shifted location of the individual sensor
double pXci = pXc - disparity * this.rXY_ideal[i][0]; // in pixels
double pYci = pYc - disparity * this.rXY_ideal[i][1];
// calculate back to distorted
double rNDi = Math.sqrt(pXci*pXci + pYci*pYci); // in pixels
// Rdist/R=A8*R^7+A7*R^6+A6*R^5+A5*R^4+A*R^3+B*R^2+C*R+(1-A6-A7-A6-A5-A-B-C)");
double ri = rNDi* 0.001 * this.pixelSize / this.distortionRadius; // relative to distortion radius
// double rD2rND = (1.0 - distortionA8 - distortionA7 - distortionA6 - distortionA5 - distortionA - distortionB - distortionC);
double rD2rND = 1.0;
double rri = 1.0;
for (int j = 0; j < a.length; j++){
rri *= ri;
rD2rND += a[j]*(rri - a[j]);
}
double pXid = pXci * rD2rND;
double pYid = pYci * rD2rND;
// individual rotate (check sign)
// double c_roll = Math.cos((this.roll[i] - this.common_roll) * Math.PI/180.0);
// double s_roll = Math.sin((this.roll[i] - this.common_roll) * Math.PI/180.0);
double c_roll = Math.cos(( - this.common_roll) * Math.PI/180.0);
double s_roll = Math.sin(( - this.common_roll) * Math.PI/180.0);
pXY[i][0] = c_roll * pXid + s_roll* pYid + 0.5 * this.pixelCorrectionWidth; // this.pXY0[i][0];
pXY[i][1] = -s_roll * pXid + c_roll* pYid + 0.5 * this.pixelCorrectionWidth; // this.pXY0[i][1];
}
return pXY;
}
// should return same as input if disparity==0
public double [][] getPortsCoordinatesIdeal(
double px,
double py,
double disparity)
{
// reverse getPortsCoordinates
double c_roll = Math.cos(( - this.common_roll) * Math.PI/180.0);
double s_roll = Math.sin(( - this.common_roll) * Math.PI/180.0);
double pXcd0 = px - 0.5 * this.pixelCorrectionWidth;
double pYcd0 = py - 0.5 * this.pixelCorrectionWidth;
double pXcd = c_roll * pXcd0 - s_roll* pYcd0;
double pYcd = s_roll * pXcd0 + c_roll* pYcd0;
double rD = Math.sqrt(pXcd*pXcd + pYcd*pYcd)*0.001*this.pixelSize; // distorted radius in a virtual center camera
double rND2R=getRByRDist(rD/this.distortionRadius, (debugLevel > -1));
double pXc = pXcd * rND2R; // non-distorted coordinates relative to the (0.5 * this.pixelCorrectionWidth, 0.5 * this.pixelCorrectionHeight)
double pYc = pYcd * rND2R; // in pixels
double [] a={this.distortionC,this.distortionB,this.distortionA,this.distortionA5,this.distortionA6,this.distortionA7,this.distortionA8};
double [][] pXY = new double [numSensors][2];
for (int i = 0; i < numSensors; i++){
// non-distorted XY of the shifted location of the individual sensor
double pXci = pXc - disparity * this.rXY_ideal[i][0]; // in pixels
double pYci = pYc - disparity * this.rXY_ideal[i][1];
// calculate back to distorted
double rNDi = Math.sqrt(pXci*pXci + pYci*pYci); // in pixels
// Rdist/R=A8*R^7+A7*R^6+A6*R^5+A5*R^4+A*R^3+B*R^2+C*R+(1-A8-A7-A6-A5-A-B-C)");
double ri = rNDi* 0.001 * this.pixelSize / this.distortionRadius; // relative to distortion radius
// double rD2rND = (1.0 - distortionA8 - distortionA7 - distortionA6 - distortionA5 - distortionA - distortionB - distortionC);
double rD2rND = 1.0;
double rri = 1.0;
for (int j = 0; j < a.length; j++){
rri *= ri;
rD2rND += a[j]*(rri - 1.0);
}
double pXid = pXci * rD2rND;
double pYid = pYci * rD2rND;
pXY[i][0] = c_roll * pXid + s_roll* pYid + 0.5 * this.pixelCorrectionWidth; // this.pXY0[i][0];
pXY[i][1] = -s_roll * pXid + c_roll* pYid + 0.5 * this.pixelCorrectionWidth; // this.pXY0[i][1];
}
return pXY;
}
public double [][] getPortsCoordinatesIdeal(
int macro_scale, // 1 for pixels, 8 - for tiles when correlating tiles instead of the pixels
double px,
double py,
double disparity)
{
if (macro_scale == 1){
return getPortsCoordinates(
px * macro_scale,
py * macro_scale,
disparity);
}
double [][] coords = getPortsCoordinatesIdeal(
px * macro_scale,
py * macro_scale,
disparity);
for (int i = 0; i < coords.length; i++){
for (int j = 0; j< coords[i].length; j++){
coords[i][j] /= macro_scale;
}
}
return coords;
}
// Copied from PixelMapping // Copied from PixelMapping
/** /**
* Calculate reverse distortion table - from pixel radius to non-distorted radius * Calculate reverse distortion table - from pixel radius to non-distorted radius
......
...@@ -771,7 +771,7 @@ public class ImageDtt { ...@@ -771,7 +771,7 @@ public class ImageDtt {
chn, chn,
centerX, // center of aberration-corrected (common model) tile, X centerX, // center of aberration-corrected (common model) tile, X
centerY, // centerY, //
(globalDebugLevel > 0) && (tileX == debug_tileX) && (tileY == debug_tileY) && (chn == 2), // external tile compare ((globalDebugLevel > 0) && (tileX == debug_tileX) && (tileY == debug_tileY) && (chn == 2)) ? 1 : 0, // external tile compare
no_deconvolution, no_deconvolution,
transpose); transpose);
if ((globalDebugLevel > 0) && (debug_tileX == tileX) && (debug_tileY == tileY) && (chn == 2)) { if ((globalDebugLevel > 0) && (debug_tileX == tileX) && (debug_tileY == tileY) && (chn == 2)) {
...@@ -896,7 +896,7 @@ public class ImageDtt { ...@@ -896,7 +896,7 @@ public class ImageDtt {
chn, chn,
centersXY[i][0], // centerX, // center of aberration-corrected (common model) tile, X centersXY[i][0], // centerX, // center of aberration-corrected (common model) tile, X
centersXY[i][1], // centerY, // centersXY[i][1], // centerY, //
(globalDebugLevel > 0) && (tileX == debug_tileX) && (tileY == debug_tileY) && (chn == 2), // external tile compare ((globalDebugLevel > 0) && (tileX == debug_tileX) && (tileY == debug_tileY) && (chn == 2)) ? 1 : 0, // external tile compare
no_deconvolution, no_deconvolution,
transpose); transpose);
} }
...@@ -952,8 +952,8 @@ public class ImageDtt { ...@@ -952,8 +952,8 @@ public class ImageDtt {
public double [][][][][][] clt_aberrations_quad_corr( public double [][][][][][] clt_aberrations_quad_corr(
final int macro_scale, // to correlate tile data instead of the pixel data: 1 - pixels, 8 - tiles
final int [][] tile_op, // [tilesY][tilesX] - what to do - 0 - nothing for this tile final int [][] tile_op, // [tilesY][tilesX] - what to do - 0 - nothing for this tile
// final double disparity,
final double [][] disparity_array, // [tilesY][tilesX] - individual per-tile expected disparity final double [][] disparity_array, // [tilesY][tilesX] - individual per-tile expected disparity
final double [][][] image_data, // first index - number of image in a quad final double [][][] image_data, // first index - number of image in a quad
// correlation results - final and partial // correlation results - final and partial
...@@ -977,7 +977,6 @@ public class ImageDtt { ...@@ -977,7 +977,6 @@ public class ImageDtt {
final double corr_red, final double corr_red,
final double corr_blue, final double corr_blue,
final double corr_sigma, final double corr_sigma,
// final int corr_mask, // which pairs to combine in the combo: 1 - top, 2 bottom, 4 - left, 8 - right
final boolean corr_normalize, // normalize correlation results by rms final boolean corr_normalize, // normalize correlation results by rms
final double min_corr, // 0.0001; // minimal correlation value to consider valid final double min_corr, // 0.0001; // minimal correlation value to consider valid
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
...@@ -1014,6 +1013,8 @@ public class ImageDtt { ...@@ -1014,6 +1013,8 @@ public class ImageDtt {
final int threadsMax, // maximal number of threads to launch final int threadsMax, // maximal number of threads to launch
final int globalDebugLevel) final int globalDebugLevel)
{ {
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
final int nChn = image_data[0].length; final int nChn = image_data[0].length;
...@@ -1184,61 +1185,74 @@ public class ImageDtt { ...@@ -1184,61 +1185,74 @@ public class ImageDtt {
for (int chn = 0; chn <numcol; chn++) { for (int chn = 0; chn <numcol; chn++) {
centerX = tileX * transform_size + transform_size/2 - shiftX; centerX = tileX * transform_size + transform_size/2 - shiftX;
centerY = tileY * transform_size + transform_size/2 - shiftY; centerY = tileY * transform_size + transform_size/2 - shiftY;
double [][] centersXY = geometryCorrection.getPortsCoordinates( double [][] centersXY;
centerX, if (macro_mode){
centerY, if ((globalDebugLevel > -1) && (tileX == debug_tileX) && (tileY == debug_tileY) && (chn == 2)) { // before correction
disparity_array[tileY][tileX] + disparity_corr); System.out.println("\nUsing MACRO mode, centerX="+centerX+", centerY="+centerY);
if ((globalDebugLevel > 0) && (tileX == debug_tileX) && (tileY == debug_tileY)) { }
for (int i = 0; i < quad; i++) { centersXY = geometryCorrection.getPortsCoordinatesIdeal(
System.out.println("clt_aberrations_quad_corr(): color="+chn+", tileX="+tileX+", tileY="+tileY+ macro_scale,
" centerX="+centerX+" centerY="+centerY+" disparity="+disparity_array[tileY][tileX]+ centerX,
" centersXY["+i+"][0]="+centersXY[i][0]+" centersXY["+i+"][1]="+centersXY[i][1]); centerY,
macro_scale* disparity_array[tileY][tileX] + disparity_corr);
} else {
centersXY = geometryCorrection.getPortsCoordinates(
centerX,
centerY,
disparity_array[tileY][tileX] + disparity_corr);
if ((globalDebugLevel > 0) && (tileX == debug_tileX) && (tileY == debug_tileY)) {
for (int i = 0; i < quad; i++) {
System.out.println("clt_aberrations_quad_corr(): color="+chn+", tileX="+tileX+", tileY="+tileY+
" centerX="+centerX+" centerY="+centerY+" disparity="+disparity_array[tileY][tileX]+
" centersXY["+i+"][0]="+centersXY[i][0]+" centersXY["+i+"][1]="+centersXY[i][1]);
}
} }
}
if ((globalDebugLevel > -1) && (tileX == debug_tileX) && (tileY == debug_tileY) && (chn == 2)) { // before correction if ((globalDebugLevel > -1) && (tileX == debug_tileX) && (tileY == debug_tileY) && (chn == 2)) { // before correction
System.out.print(disparity_array[tileY][tileX]+"\t"+ System.out.print(disparity_array[tileY][tileX]+"\t"+
centersXY[0][0]+"\t"+centersXY[0][1]+"\t"+ centersXY[0][0]+"\t"+centersXY[0][1]+"\t"+
centersXY[1][0]+"\t"+centersXY[1][1]+"\t"+ centersXY[1][0]+"\t"+centersXY[1][1]+"\t"+
centersXY[2][0]+"\t"+centersXY[2][1]+"\t"+ centersXY[2][0]+"\t"+centersXY[2][1]+"\t"+
centersXY[3][0]+"\t"+centersXY[3][1]+"\t"); centersXY[3][0]+"\t"+centersXY[3][1]+"\t");
} }
for (int ip = 0; ip < centersXY.length; ip++){
centersXY[ip][0] -= shiftXY[ip][0];
centersXY[ip][1] -= shiftXY[ip][1];
}
if (fine_corr != null){
double tX = (2.0 * tileX)/tilesX - 1.0; // -1.0 to +1.0
double tY = (2.0 * tileY)/tilesY - 1.0; // -1.0 to +1.0
for (int ip = 0; ip < centersXY.length; ip++){ for (int ip = 0; ip < centersXY.length; ip++){
//f(x,y)=A*x^2+B*y^2+C*x*y+D*x+E*y+F centersXY[ip][0] -= shiftXY[ip][0];
for (int d = 0; d <2; d++) centersXY[ip][1] -= shiftXY[ip][1];
centersXY[ip][d] -= (
fine_corr[ip][d][0]*tX*tX+
fine_corr[ip][d][1]*tY*tY+
fine_corr[ip][d][2]*tX*tY+
fine_corr[ip][d][3]*tX+
fine_corr[ip][d][4]*tY+
fine_corr[ip][d][5]);
} }
}
if (fine_corr != null){
double tX = (2.0 * tileX)/tilesX - 1.0; // -1.0 to +1.0
double tY = (2.0 * tileY)/tilesY - 1.0; // -1.0 to +1.0
for (int ip = 0; ip < centersXY.length; ip++){
//f(x,y)=A*x^2+B*y^2+C*x*y+D*x+E*y+F
for (int d = 0; d <2; d++)
centersXY[ip][d] -= (
fine_corr[ip][d][0]*tX*tX+
fine_corr[ip][d][1]*tY*tY+
fine_corr[ip][d][2]*tX*tY+
fine_corr[ip][d][3]*tX+
fine_corr[ip][d][4]*tY+
fine_corr[ip][d][5]);
}
}
}
if ((globalDebugLevel > -1) && (tileX == debug_tileX) && (tileY == debug_tileY) && (chn == 2)) { if ((globalDebugLevel > -1) && (tileX == debug_tileX) && (tileY == debug_tileY) && (chn == 2)) {
System.out.print(disparity_array[tileY][tileX]+"\t"+ System.out.println("\nUsing "+(macro_mode?"MACRO":"PIXEL")+" mode, centerX="+centerX+", centerY="+centerY);
System.out.println(disparity_array[tileY][tileX]+"\t"+
centersXY[0][0]+"\t"+centersXY[0][1]+"\t"+ centersXY[0][0]+"\t"+centersXY[0][1]+"\t"+
centersXY[1][0]+"\t"+centersXY[1][1]+"\t"+ centersXY[1][0]+"\t"+centersXY[1][1]+"\t"+
centersXY[2][0]+"\t"+centersXY[2][1]+"\t"+ centersXY[2][0]+"\t"+centersXY[2][1]+"\t"+
centersXY[3][0]+"\t"+centersXY[3][1]+"\t"); centersXY[3][0]+"\t"+centersXY[3][1]+"\t");
} }
for (int i = 0; i < quad; i++) { for (int i = 0; i < quad; i++) {
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 resudual offsets fract_shiftsXY[i] = extract_correct_tile( // return a pair of residual offsets
image_data[i], image_data[i],
width, // image width width, // image width
clt_kernels[i], // [color][tileY][tileX][band][pixel] (clt_kernels == null) ? null : clt_kernels[i], // [color][tileY][tileX][band][pixel]
clt_data[i][chn][tileY][tileX], //double [][] clt_tile, // should be double [4][]; clt_data[i][chn][tileY][tileX], //double [][] clt_tile, // should be double [4][];
kernel_step, kernel_step,
transform_size, transform_size,
...@@ -1246,7 +1260,9 @@ public class ImageDtt { ...@@ -1246,7 +1260,9 @@ public class ImageDtt {
chn, chn,
centersXY[i][0], // centerX, // center of aberration-corrected (common model) tile, X centersXY[i][0], // centerX, // center of aberration-corrected (common model) tile, X
centersXY[i][1], // centerY, // centersXY[i][1], // centerY, //
((globalDebugLevel > -1) && (tileX == debug_tileX) && (tileY == debug_tileY) && (chn == 2)), // ((globalDebugLevel > -1) && (tileX == debug_tileX) && (tileY == debug_tileY) && (chn == 2)),
((globalDebugLevel > -1) && (tileX == debug_tileX) && (tileY == debug_tileY) && (chn == 2)) ? (globalDebugLevel + 0) : 0, // external tile compare
// (globalDebugLevel > 0) && (tileX == debug_tileX) && (tileY == debug_tileY) && (chn == 2), // external tile compare // (globalDebugLevel > 0) && (tileX == debug_tileX) && (tileY == debug_tileY) && (chn == 2), // external tile compare
no_deconvolution, no_deconvolution,
false); // transpose); false); // transpose);
...@@ -1279,7 +1295,7 @@ public class ImageDtt { ...@@ -1279,7 +1295,7 @@ public class ImageDtt {
fract_shiftsXY[i][0], // double shiftX, fract_shiftsXY[i][0], // double shiftX,
fract_shiftsXY[i][1], // double shiftY, fract_shiftsXY[i][1], // double shiftY,
// (globalDebugLevel > 0) && (tileX == debug_tileX) && (tileY == debug_tileY)); // external tile compare // (globalDebugLevel > 0) && (tileX == debug_tileX) && (tileY == debug_tileY)); // external tile compare
((globalDebugLevel > 0) && (chn==0) && (tileX >= debug_tileX - 2) && (tileX <= debug_tileX + 2) && ((globalDebugLevel > 1) && (chn==0) && (tileX >= debug_tileX - 2) && (tileX <= debug_tileX + 2) &&
(tileY >= debug_tileY - 2) && (tileY <= debug_tileY+2))); (tileY >= debug_tileY - 2) && (tileY <= debug_tileY+2)));
} }
if ((globalDebugLevel > 0) && (debug_tileX == tileX) && (debug_tileY == tileY)) { if ((globalDebugLevel > 0) && (debug_tileX == tileX) && (debug_tileY == tileY)) {
...@@ -1400,7 +1416,7 @@ public class ImageDtt { ...@@ -1400,7 +1416,7 @@ public class ImageDtt {
} }
double avScale = 0.0, avScaleHor = 0.0, avScaleVert = 0.0; double avScale = 0.0, avScaleHor = 0.0, avScaleVert = 0.0;
if (numPairs > 0) { if (numPairs > 0) {
boolean debugMax = (globalDebugLevel > 0) && (tileX == debug_tileX) && (tileY == debug_tileY); boolean debugMax = (globalDebugLevel > 1) && (tileX == debug_tileX) && (tileY == debug_tileY);
avScale = 1.0/numPairs; avScale = 1.0/numPairs;
if (numPairsHor > 0) avScaleHor = 1.0/numPairsHor; if (numPairsHor > 0) avScaleHor = 1.0/numPairsHor;
if (numPairsVert > 0) avScaleVert = 1.0/numPairsVert; if (numPairsVert > 0) avScaleVert = 1.0/numPairsVert;
...@@ -2724,7 +2740,7 @@ public class ImageDtt { ...@@ -2724,7 +2740,7 @@ public class ImageDtt {
} }
if (globalDebugLevel > 0){ if (globalDebugLevel > 1){
showDoubleFloatArrays sdfa_instance = new showDoubleFloatArrays(); // just for debugging? showDoubleFloatArrays sdfa_instance = new showDoubleFloatArrays(); // just for debugging?
String [] titles = {"cos_hor","sin_hor","cos_vert","sin_vert"}; String [] titles = {"cos_hor","sin_hor","cos_vert","sin_vert"};
double [][] cs_dbg = {cos_hor, sin_hor, cos_vert, sin_vert}; double [][] cs_dbg = {cos_hor, sin_hor, cos_vert, sin_vert};
...@@ -3525,7 +3541,7 @@ public class ImageDtt { ...@@ -3525,7 +3541,7 @@ public class ImageDtt {
// return // return
// kernel [0][0] is centered at (-kernel_step/2,-kernel_step/2) // kernel [0][0] is centered at (-kernel_step/2,-kernel_step/2)
public double [] extract_correct_tile( // return a pair of resudual offsets public double [] extract_correct_tile( // return a pair of residual offsets
double [][] image_data, double [][] image_data,
int width, // image width int width, // image width
double [][][][][] clt_kernels, // [color][tileY][tileX][band][pixel] double [][][][][] clt_kernels, // [color][tileY][tileX][band][pixel]
...@@ -3535,34 +3551,43 @@ public class ImageDtt { ...@@ -3535,34 +3551,43 @@ public class ImageDtt {
DttRad2 dtt, DttRad2 dtt,
int chn, int chn,
double centerX, // center of aberration-corrected (common model) tile, X double centerX, // center of aberration-corrected (common model) tile, X
double centerY, // double centerY, //
boolean bdebug0, // external tile compare int debugLevel,
// boolean bdebug0, // external tile compare
boolean dbg_no_deconvolution, boolean dbg_no_deconvolution,
boolean dbg_transpose) boolean dbg_transpose)
{ {
boolean bdebug = false; boolean use_kernels = (clt_kernels != null) && !dbg_no_deconvolution;
boolean bdebug0 = debugLevel > 0;
boolean bdebug = debugLevel > 1;
double [] residual_shift = new double[2]; double [] residual_shift = new double[2];
int height = image_data[0].length/width; int height = image_data[0].length/width;
int transform_size2 = 2* transform_size; int transform_size2 = 2* transform_size;
// if (dtt == null) dtt = new DttRad2(transform_size); should have window set up // if (dtt == null) dtt = new DttRad2(transform_size); should have window set up
double [] tile_in = new double [4*transform_size*transform_size]; double [] tile_in = new double [4*transform_size*transform_size];
// 1. find closest kernel
int ktileX = (int) Math.round(centerX/kernel_step) + 1;
int ktileY = (int) Math.round(centerY/kernel_step) + 1;
if (ktileY < 0) ktileY = 0;
else if (ktileY >= clt_kernels[chn].length) ktileY = clt_kernels[chn].length-1;
if (ktileX < 0) ktileX = 0;
else if (ktileX >= clt_kernels[chn][ktileY].length) ktileX = clt_kernels[chn][ktileY].length-1;
CltExtra ce = new CltExtra (clt_kernels[chn][ktileY][ktileX][4]);
// 2. calculate correction for center of the kernel offset
double kdx = centerX - (ktileX -1 +0.5) * kernel_step; // difference in pixel
double kdy = centerY - (ktileY -1 +0.5) * kernel_step;
// 3. find top-left corner of the
// check signs, ce.data_x is "-" as if original kernel was shifted to "+" need to take pixel sifted "-"
// same with extra shift
double px = centerX - transform_size - (ce.data_x + ce.dxc_dx * kdx + ce.dxc_dy * kdy) ; // fractional left corner
double py = centerY - transform_size - (ce.data_y + ce.dyc_dx * kdx + ce.dyc_dy * kdy) ; // fractional top corner
double px = centerX - transform_size;
double py = centerY - transform_size;
int ktileX = 0;
int ktileY = 0;
if (use_kernels) {
// 1. find closest kernel
ktileX = (int) Math.round(centerX/kernel_step) + 1;
ktileY = (int) Math.round(centerY/kernel_step) + 1;
if (ktileY < 0) ktileY = 0;
else if (ktileY >= clt_kernels[chn].length) ktileY = clt_kernels[chn].length-1;
if (ktileX < 0) ktileX = 0;
else if (ktileX >= clt_kernels[chn][ktileY].length) ktileX = clt_kernels[chn][ktileY].length-1;
CltExtra ce = new CltExtra (clt_kernels[chn][ktileY][ktileX][4]);
// 2. calculate correction for center of the kernel offset
double kdx = centerX - (ktileX -1 +0.5) * kernel_step; // difference in pixel
double kdy = centerY - (ktileY -1 +0.5) * kernel_step;
// 3. find top-left corner of the
// check signs, ce.data_x is "-" as if original kernel was shifted to "+" need to take pixel sifted "-"
// same with extra shift
px = centerX - transform_size - (ce.data_x + ce.dxc_dx * kdx + ce.dxc_dy * kdy) ; // fractional left corner
py = centerY - transform_size - (ce.data_y + ce.dyc_dx * kdx + ce.dyc_dy * kdy) ; // fractional top corner
}
if (bdebug0){ if (bdebug0){
System.out.print(px+"\t"+py+"\t"); System.out.print(px+"\t"+py+"\t");
} }
...@@ -3608,14 +3633,14 @@ public class ImageDtt { ...@@ -3608,14 +3633,14 @@ public class ImageDtt {
} }
clt_tile[dct_mode] = dtt.dttt_iv (clt_tile[dct_mode], dct_mode, transform_size); clt_tile[dct_mode] = dtt.dttt_iv (clt_tile[dct_mode], dct_mode, transform_size);
} }
if (bdebug) { if (bdebug0) {
showDoubleFloatArrays sdfa_instance = new showDoubleFloatArrays(); // just for debugging? showDoubleFloatArrays sdfa_instance = new showDoubleFloatArrays(); // just for debugging?
sdfa_instance.showArrays(tile_in, transform_size2, transform_size2, "tile_in_x"+ctile_left+"_y"+ctile_top); sdfa_instance.showArrays(tile_in, transform_size2, transform_size2, "tile_in_x"+ctile_left+"_y"+ctile_top);
String [] titles = {"CC","SC","CS","SS"}; String [] titles = {"CC","SC","CS","SS"};
sdfa_instance.showArrays(clt_tile, transform_size, transform_size, true, "clt_x"+ctile_left+"_y"+ctile_top, titles); sdfa_instance.showArrays(clt_tile, transform_size, transform_size, true, "clt_x"+ctile_left+"_y"+ctile_top, titles);
} }
// deconvolve with kernel // deconvolve with kernel
if (!dbg_no_deconvolution) { if (use_kernels) {
double [][] ktile = clt_kernels[chn][ktileY][ktileX]; double [][] ktile = clt_kernels[chn][ktileY][ktileX];
convolve_tile( convolve_tile(
clt_tile, // double [][] data, // array [transform_size*transform_size], will be updated DTT4 converted clt_tile, // double [][] data, // array [transform_size*transform_size], will be updated DTT4 converted
......
/**
**
** MacroCorrelation handle "correlations of correlations" - tiles instead of pixels
** to find the ranges for pixel correlations
**
** Copyright (C) 2017 Elphel, Inc.
**
** -----------------------------------------------------------------------------**
**
** MacroCorrelation.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 MacroCorrelation {
TileProcessor tp; // pixel tile processor
TileProcessor mtp; // macro tile processor
public MacroCorrelation(
TileProcessor tp,
double trusted_correlation){
this.tp = tp;
final int pTilesX = tp.getTilesX();
final int pTilesY = tp.getTilesY();
final int tileSize = tp.getTileSize(); //
final int mTilesX = (pTilesX + tileSize - 1) / tileSize; // clt_aberrations_quad_corr truncates
final int mTilesY = (pTilesY + tileSize - 1) / tileSize;
this.mtp = new TileProcessor(
mTilesX, // int tilesX,
mTilesY, // int tilesY,
tileSize, // int tileSize,
tp.superTileSize, // int superTileSize,
tp.getMagicScale(), // double scale,
trusted_correlation, // double trustedCorrelation,
tp.getThreadsMax()); // int threadsMax)
}
public TileProcessor CLTMacroScan( // perform single pass according to prepared tiles operations and disparity
final CLTPass3d src_scan, // results of the normal correlations (now expecting infinity)
// final double [][][] other_channels, // other channels to correlate, such as average RGB (first index - subcamera, 2-nd - channel, 3-rd - pixel)
EyesisCorrectionParameters.CLTParameters clt_parameters,
GeometryCorrection geometryCorrection,
final double macro_disparity_low,
final double macro_disparity_high,
final double macro_disparity_step,
final int debugLevel){
double [][][] input_data = CLTMacroSetData( // perform single pass according to prepared tiles operations and disparity
src_scan, // final CLTPass3d src_scan, // results of the normal correlations (now expecting infinity)
null); // final double [][][] other_channels, // other channels to correlate, such as average RGB (first index - subcamera, 2-nd - channel, 3-rd - pixel)
mtp.resetCLTPasses();
for (double mdisp = macro_disparity_low; mdisp < (macro_disparity_high - macro_disparity_step); mdisp +=macro_disparity_step){
final CLTPass3d macro_scan = new CLTPass3d(mtp);
CLTMacroSetMeasure( // perform single pass according to prepared tiles operations and disparity
macro_scan, // final CLTPass3d macro_scan, // new, will be filled out
clt_parameters, // EyesisCorrectionParameters.CLTParameters clt_parameters,
geometryCorrection, // GeometryCorrection geometryCorrection,
mdisp, // final double macro_disparity,
false, // final boolean show_corr_partial,
false, // final boolean show_corr_combo,
debugLevel); // final int debugLevel)
CLTMacroMeasure( // perform single pass according to prepared tiles operations and disparity
macro_scan, // final CLTPass3d macro_scan, //
input_data, // final double [][][] input_data,
clt_parameters, // EyesisCorrectionParameters.CLTParameters clt_parameters,
geometryCorrection, // GeometryCorrection geometryCorrection,
""+mdisp, // final String suffix,
false, // final boolean show_corr_partial,
false, // final boolean show_corr_combo,
debugLevel); // final int debugLevel)
mtp.clt_3d_passes.add(macro_scan);
}
return mtp;
}
public double [][][] CLTMacroSetData( // perform single pass according to prepared tiles operations and disparity
final CLTPass3d src_scan, // results of the normal correlations (now expecting infinity)
final double [][][] other_channels // other channels to correlate, such as average RGB (first index - subcamera, 2-nd - channel, 3-rd - pixel)
)
{
final boolean tmp_input = true; // use 3 correlation channels made of the same data
// final int dbg_x = 295;
// final int dbg_y = 160;
final int pTilesX = tp.getTilesX();
final int pTilesY = tp.getTilesY();
final int tileSize = tp.getTileSize(); //
final int mTilesX = (pTilesX + tileSize - 1) / tileSize; // clt_aberrations_quad_corr truncates
final int mTilesY = (pTilesY + tileSize - 1) / tileSize;
final int mTiles = mTilesX * mTilesY;
final int num_chn = tmp_input? 3: (1 + ((other_channels == null) ? 0 : (other_channels[0].length)));
final double [][][] input_data = new double [ImageDtt.QUAD][num_chn][mTiles*tileSize*tileSize];
// double [][] tiles_tone = src_scan.getTileRBGA( No, we need individual subcameras
// 4); // int num_layers);
for (int sub_cam =0; sub_cam < input_data.length; sub_cam++){
for (int pty = 0; pty < pTilesY; pty++){
for (int ptx = 0; ptx < pTilesX; ptx++){
int pTile = ptx + pty * pTilesX;
int mTile = ptx + pty * (mTilesX * tileSize);
input_data[sub_cam][0][mTile]= src_scan.disparity_map[ImageDtt.IMG_DIFF0_INDEX + sub_cam][pTile];
if (tmp_input) {
input_data[sub_cam][1][mTile]= input_data[sub_cam][0][mTile];
input_data[sub_cam][2][mTile]= input_data[sub_cam][0][mTile];
} else {
for (int other_chn = 1; other_chn < num_chn; other_chn++){
input_data[sub_cam][other_chn][mTile] = other_channels[sub_cam][other_chn-1][pTile];
}
}
}
}
}
return input_data;
}
public CLTPass3d CLTMacroSetMeasure( // perform single pass according to prepared tiles operations and disparity
final CLTPass3d macro_scan, // new, will be filled out
EyesisCorrectionParameters.CLTParameters clt_parameters,
GeometryCorrection geometryCorrection,
final double macro_disparity,
final boolean show_corr_partial,
final boolean show_corr_combo,
final int debugLevel)
{
final int pTilesX = tp.getTilesX();
final int pTilesY = tp.getTilesY();
final int tileSize = tp.getTileSize(); //
final int mTilesX = (pTilesX + tileSize - 1) / tileSize; // clt_aberrations_quad_corr truncates
final int mTilesY = (pTilesY + tileSize - 1) / tileSize;
int op = ImageDtt.setImgMask(0, 0xf);
op = ImageDtt.setPairMask(op,0xf);
op = ImageDtt.setForcedDisparity(op,true);
final int [][] tile_op = new int [mTilesY][mTilesX];
final double [][] disparity_array = new double [mTilesY][mTilesX];
for (int mty = 0; mty < mTilesY; mty ++){
for (int mtx = 0; mtx < mTilesX; mtx ++){
tile_op[mty][mtx] = op;
disparity_array[mty][mtx] = macro_disparity;
}
}
// final CLTPass3d macro_scan = new CLTPass3d(mtp);
macro_scan.tile_op = tile_op;
macro_scan.disparity = disparity_array;
return macro_scan;
}
public CLTPass3d CLTMacroMeasure( // perform single pass according to prepared tiles operations and disparity
final CLTPass3d macro_scan, //
final double [][][] input_data,
EyesisCorrectionParameters.CLTParameters clt_parameters,
GeometryCorrection geometryCorrection,
final String suffix,
final boolean show_corr_partial,
final boolean show_corr_combo,
final int debugLevel)
{
int mTilesY = macro_scan.tile_op.length;
int mTilesX = macro_scan.tile_op[0].length;
// undecided, so 2 modes of combining alpha - same as rgb, or use center tile only
if (debugLevel > -1){
int numTiles = 0;
for (int ty = 0; ty < macro_scan.tile_op.length; ty ++) for (int tx = 0; tx < macro_scan.tile_op[ty].length; tx ++){
if (macro_scan.tile_op[ty][tx] != 0) numTiles ++;
}
System.out.println("CLTMacroMeasure(): numTiles = "+numTiles);
}
double min_corr_selected = clt_parameters.min_corr;
double [][] disparity_map = new double [ImageDtt.DISPARITY_TITLES.length][]; //[0] -residual disparity, [1] - orthogonal (just for debugging)
double [][] shiftXY = {{0.0,0.0},{0.0,0.0},{0.0,0.0},{0.0,0.0}};
double [][][][] clt_corr_combo = new double [ImageDtt.TCORR_TITLES.length][mTilesY][mTilesX][]; // needed always
double [][][][][] clt_corr_partial = null; // [tp.tilesY][tp.tilesX][pair][color][(2*transform_size-1)*(2*transform_size-1)]
if (show_corr_partial) {
clt_corr_partial = new double [mTilesY][mTilesX][][][];
for (int i = 0; i < mTilesY; i++){
for (int j = 0; j < mTilesX; j++){
clt_corr_partial[i][j] = null;
}
}
}
if (show_corr_combo) {
for (int i = 0; i < mTilesY; i++){
for (int j = 0; j < mTilesX; j++){
for (int k = 0; k<clt_corr_combo.length; k++){
clt_corr_combo[k][i][j] = null;
}
}
}
}
// double [][][][] texture_tiles = save_textures ? new double [tilesY][tilesX][][] : null; // ["RGBA".length()][];
ImageDtt image_dtt = new ImageDtt();
image_dtt.clt_aberrations_quad_corr(
8, // final int macro_scale, // to correlate tile data instead of the pixel data: 1 - pixels, 8 - tiles
macro_scan.tile_op, // per-tile operation bit codes
macro_scan.disparity, // clt_parameters.disparity, // final double disparity,
input_data, // final double [][][] imade_data, // first index - number of image in a quad
// correlation results - final and partial
clt_corr_combo, // [tp.tilesY][tp.tilesX][(2*transform_size-1)*(2*transform_size-1)] // if null - will not calculate
clt_corr_partial, // clt_corr_partial, // [tp.tilesY][tp.tilesX][quad]color][(2*transform_size-1)*(2*transform_size-1)] // if null - will not calculate
null, // [tp.tilesY][tp.tilesX][pair]{dx,dy,weight}[(2*transform_size-1)*(2*transform_size-1)] // transpose unapplied. null - do not calculate
// Use it with disparity_maps[scan_step]? clt_mismatch, // [tp.tilesY][tp.tilesX][pair]{dx,dy,weight}[(2*transform_size-1)*(2*transform_size-1)] // transpose unapplied. null - do not calculate
disparity_map, // [12][tp.tilesY * tp.tilesX]
null, // [tp.tilesY][tp.tilesX]["RGBA".length()][];
mTilesX * clt_parameters.transform_size, // imp_quad[0].getWidth(), // final int width,
clt_parameters.fat_zero, // add to denominator to modify phase correlation (same units as data1, data2). <0 - pure sum
clt_parameters.corr_sym,
clt_parameters.corr_offset,
clt_parameters.corr_red,
clt_parameters.corr_blue,
clt_parameters.corr_sigma,
clt_parameters.corr_normalize, // normalize correlation results by rms
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_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_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.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.scale_shot, // 3.0; // scale when dividing by sqrt ( <0 - disable correction)
clt_parameters.diff_sigma, // 5.0;//RMS difference from average to reduce weights (~ 1.0 - 1/255 full scale image)
clt_parameters.diff_threshold, // 5.0; // RMS difference from average to discard channel (~ 1.0 - 1/255 full scale image)
clt_parameters.diff_gauss, // true; // when averaging images, use gaussian around average as weight (false - sharp all/nothing)
clt_parameters.min_agree, // 3.0; // minimal number of channels to agree on a point (real number to work with fuzzy averages)
clt_parameters.dust_remove, // Do not reduce average weight when only one image differes much from the average
clt_parameters.keep_weights, // Add port weights to RGBA stack (debug feature)
geometryCorrection, // final GeometryCorrection geometryCorrection,
null, // clt_kernels, // final double [][][][][][] clt_kernels, // [channel_in_quad][color][tileY][tileX][band][pixel] , size should match image (have 1 tile around)
clt_parameters.kernel_step,
clt_parameters.transform_size,
clt_parameters.clt_window,
shiftXY, //
0.0, // disparity_corr, // final double disparity_corr, // disparity at infinity
null, // (clt_parameters.fcorr_ignore? null: this.fine_corr),
clt_parameters.corr_magic_scale, // still not understood coefficient that reduces reported disparity value. Seems to be around 0.85
clt_parameters.shift_x, // final int shiftX, // shift image horizontally (positive - right) - just for testing
clt_parameters.shift_y, // final int shiftY, // shift image vertically (positive - down)
31, // clt_parameters.tileX, // final int debug_tileX,
10, // clt_parameters.tileY, // final int debug_tileY,
(clt_parameters.dbg_mode & 64) != 0, // no fract shift
true, // no convolve
mtp.getThreadsMax(),
debugLevel - 2);
macro_scan.disparity_map = disparity_map;
macro_scan.is_measured = true;
macro_scan.is_combo = false;
macro_scan.resetProcessed();
if (debugLevel > 1) {
double [][]dbg_img = new double [input_data.length][];
for (int i = 0; i < input_data.length; i++) {
dbg_img[i] = input_data[i][0];
}
(new showDoubleFloatArrays()).showArrays(
dbg_img,
tp.getTilesX(),
tp.getTilesY(),
true,
"DBG_INPUT_MACRO-D"+suffix);
}
if (debugLevel > 0) mtp.showScan(
macro_scan, // CLTPass3d scan,
"macro_scan-D"+suffix); //String title)
if (show_corr_partial) {
String [] allColorNames = {"red","blue","green","combo"};
String [] titles = new String[clt_corr_partial.length];
for (int i = 0; i < titles.length; i++){
titles[i]=allColorNames[i % allColorNames.length]+"_"+(i / allColorNames.length);
}
double [][] corr_rslt_partial = image_dtt.corr_partial_dbg(
clt_corr_partial,
2*clt_parameters.transform_size - 1, //final int corr_size,
4, // final int pairs,
4, // final int colors,
clt_parameters.corr_border_contrast,
mtp.getThreadsMax(),
debugLevel);
(new showDoubleFloatArrays()) .showArrays(
corr_rslt_partial,
mTilesX*(2*clt_parameters.transform_size),
mTilesY*(2*clt_parameters.transform_size),
true,
"MACRO-PART_CORR-D"+suffix,
titles);
}
if (show_corr_combo) {
double [][] corr_rslt = new double [clt_corr_combo.length][];
String [] titles = new String[clt_corr_combo.length]; // {"combo","sum"};
for (int i = 0; i< titles.length; i++) titles[i] = ImageDtt.TCORR_TITLES[i];
for (int i = 0; i<corr_rslt.length; i++) {
corr_rslt[i] = image_dtt.corr_dbg(
clt_corr_combo[i],
2*clt_parameters.transform_size - 1,
clt_parameters.corr_border_contrast,
mtp.getThreadsMax(),
debugLevel);
}
(new showDoubleFloatArrays()).showArrays(
corr_rslt,
mTilesX*(2*clt_parameters.transform_size),
mTilesY*(2*clt_parameters.transform_size),
true,
"MACRO-CORR-D"+suffix,
titles );
}
return macro_scan;
}
public CLTPass3d refineMacro(
final double [][][] input_data,
EyesisCorrectionParameters.CLTParameters clt_parameters,
GeometryCorrection geometryCorrection,
final double trustedCorrelation,
final double disp_far, // limit results to the disparity range
final double disp_near,
final double minStrength,
final double unique_tolerance,
final int debugLevel)
{
CLTPass3d refined_macro = mtp.RefineQuadMulti(
mtp.clt_3d_passes, // final ArrayList <CLTPass3d> passes,
0, // final int firstPass,
mtp.clt_3d_passes.size(), // final int lastPassPlus1,
trustedCorrelation, // final double trustedCorrelation,
disp_far, // final double disp_far, // limit results to the disparity range
disp_near, // final double disp_near,
minStrength, // final double minStrength,
unique_tolerance, // final double unique_tolerance,
// TODO: when useCombo - pay attention to borders (disregard)
false, // final boolean usePoly, // use polynomial method to find max), valid if useCombo == false
1); // final int debugLevel)
if (refined_macro == null) return null;
CLTMacroMeasure( // perform single pass according to prepared tiles operations and disparity
refined_macro, // final CLTPass3d macro_scan, //
input_data, // final double [][][] input_data,
clt_parameters, // EyesisCorrectionParameters.CLTParameters clt_parameters,
geometryCorrection, // GeometryCorrection geometryCorrection,
""+mtp.clt_3d_passes, // final String suffix,
false, // final boolean show_corr_partial,
false, // final boolean show_corr_combo,
0); // final int debugLevel)
return refined_macro;
}
}
...@@ -3256,6 +3256,7 @@ public class QuadCLT { ...@@ -3256,6 +3256,7 @@ public class QuadCLT {
final double disparity_corr = (clt_parameters.z_correction == 0) ? 0.0 : geometryCorrection.getDisparityFromZ(1.0/clt_parameters.z_correction); final double disparity_corr = (clt_parameters.z_correction == 0) ? 0.0 : geometryCorrection.getDisparityFromZ(1.0/clt_parameters.z_correction);
double [][][][][][] clt_data = image_dtt.clt_aberrations_quad_corr( double [][][][][][] clt_data = image_dtt.clt_aberrations_quad_corr(
1, // final int macro_scale, // to correlate tile data instead of the pixel data: 1 - pixels, 8 - tiles
tile_op, // per-tile operation bit codes tile_op, // per-tile operation bit codes
disparity_array, // final double disparity, disparity_array, // final double disparity,
double_stacks, // final double [][][] imade_data, // first index - number of image in a quad double_stacks, // final double [][][] imade_data, // first index - number of image in a quad
...@@ -4559,6 +4560,7 @@ public class QuadCLT { ...@@ -4559,6 +4560,7 @@ public class QuadCLT {
final double disparity_corr = (clt_parameters.z_correction == 0) ? 0.0 : geometryCorrection.getDisparityFromZ(1.0/clt_parameters.z_correction); final double disparity_corr = (clt_parameters.z_correction == 0) ? 0.0 : geometryCorrection.getDisparityFromZ(1.0/clt_parameters.z_correction);
image_dtt.clt_aberrations_quad_corr( image_dtt.clt_aberrations_quad_corr(
1, // final int macro_scale, // to correlate tile data instead of the pixel data: 1 - pixels, 8 - tiles
tile_op, // per-tile operation bit codes tile_op, // per-tile operation bit codes
disparity_array, // clt_parameters.disparity, // final double disparity, disparity_array, // clt_parameters.disparity, // final double disparity,
double_stacks, // final double [][][] imade_data, // first index - number of image in a quad double_stacks, // final double [][][] imade_data, // first index - number of image in a quad
...@@ -5310,26 +5312,26 @@ public class QuadCLT { ...@@ -5310,26 +5312,26 @@ public class QuadCLT {
// Temporary assign here // Temporary assign here
final int disp_index = ImageDtt.DISPARITY_INDEX_CM; final int disp_index = ImageDtt.DISPARITY_INDEX_CM;
final int str_index = ImageDtt.DISPARITY_STRENGTH_INDEX; final int str_index = ImageDtt.DISPARITY_STRENGTH_INDEX;
final double strength_floor = clt_parameters.gr_strength_floor; // 0.6* clt_parameters.combine_min_strength; final double strength_floor = clt_parameters.fds_str_floor; // 0.6* clt_parameters.combine_min_strength;
// final double strength_floor = 0.8* clt_parameters.combine_min_strength; // final double strength_floor = 0.8* clt_parameters.combine_min_strength;
// TODO: define, make parameters // TODO: define, make parameters
final double comboMinStrength = clt_parameters.gr_comboMinStrength; // 0.3; // 0.3; final double comboMinStrength = clt_parameters.gr_ovrbg_cmb; // 0.3; // 0.3;
final double comboMinStrengthHor = clt_parameters.gr_comboMinStrengthHor ; // 0.3; // 0.3; final double comboMinStrengthHor = clt_parameters.gr_ovrbg_cmb_hor ; // 0.3; // 0.3;
final double comboMinStrengthVert =clt_parameters.gr_comboMinStrengthVert ; // 0.3; // 0.3; final double comboMinStrengthVert =clt_parameters.gr_ovrbg_cmb_vert ; // 0.3; // 0.3;
final double filterMinStrength = clt_parameters.gr_filterMinStrength ; // 0.3; // 0.3; final double filterMinStrength = clt_parameters.gr_ovrbg_filtered ; // 0.3; // 0.3;
// TODO: make parameters // TODO: make parameters
final double strength_pow = clt_parameters.gr_strength_pow ; // 1.0; final double strength_pow = clt_parameters.fds_str_pow ; // 1.0;
final int smplSide = clt_parameters.gr_smplSide ; // 5; // 3; // Sample size (side of a square) final int smplSide = clt_parameters.fds_smpl_side ; // 5; // 3; // Sample size (side of a square)
final int smplNum = clt_parameters.gr_smplNum ; // 10; // 13; // 5; // Number after removing worst (should be >1) final int smplNum = clt_parameters.fds_smpl_num ; // 10; // 13; // 5; // Number after removing worst (should be >1)
final double smplRms = clt_parameters.gr_smplRms ; // 0.15; // Maximal RMS of the remaining tiles in a sample final double smplRms = clt_parameters.fds_smpl_rms ; // 0.15; // Maximal RMS of the remaining tiles in a sample
final double smplRelRms = clt_parameters.gr_smplRelRms ; // 0.01; // 05; // Maximal RMS/disparity in addition to smplRms final double smplRelRms = clt_parameters.fds_smpl_rel_rms ; // 0.01; // 05; // Maximal RMS/disparity in addition to smplRms
final boolean smplWnd = clt_parameters.gr_smplWnd ; // true; // final boolean smplWnd = clt_parameters.fds_smpl_wnd ; // true; //
final double max_abs_tilt = clt_parameters.gr_max_abs_tilt ; // 2.0; // pix per tile final double max_abs_tilt = clt_parameters.fds_abs_tilt ; // 2.0; // pix per tile
final double max_rel_tilt = clt_parameters.gr_max_rel_tilt ; // 0.2; // (pix / disparity) per tile final double max_rel_tilt = clt_parameters.fds_rel_tilt ; // 0.2; // (pix / disparity) per tile
final int dbg_x = 155; final int dbg_x = 155;
final int dbg_y = 207; final int dbg_y = 207;
...@@ -5365,7 +5367,7 @@ public class QuadCLT { ...@@ -5365,7 +5367,7 @@ public class QuadCLT {
final double trustedCorrelation = tp.getTrustedCorrelation(); final double trustedCorrelation = tp.getTrustedCorrelation();
/// CLTPass3d bgnd_data = CLTBackgroundMeas( // measure background /// CLTPass3d bgnd_data = CLTBackgroundMeas( // measure background
CLTPass3d bgnd_data = CLTBackgroundMeas( // measure background CLTPass3d bgnd_data = CLTBackgroundMeas( // measure background
image_data, // image_data, //
clt_parameters, clt_parameters,
...@@ -5373,13 +5375,103 @@ public class QuadCLT { ...@@ -5373,13 +5375,103 @@ public class QuadCLT {
updateStatus, updateStatus,
debugLevel); debugLevel);
tp.clt_3d_passes.add(bgnd_data); tp.clt_3d_passes.add(bgnd_data);
// if (show_init_refine) // if (show_init_refine)
tp.showScan( tp.showScan(
tp.clt_3d_passes.get(0), // CLTPass3d scan, tp.clt_3d_passes.get(0), // CLTPass3d scan,
"bgnd_data-"+tp.clt_3d_passes.size()); "bgnd_data-"+tp.clt_3d_passes.size());
// Test macro correlation and exit.
MacroCorrelation mc = new MacroCorrelation(
tp,
clt_parameters.mc_disp8_trust);
double [][][] input_data = mc.CLTMacroSetData( // perform single pass according to prepared tiles operations and disparity
bgnd_data, // final CLTPass3d src_scan, // results of the normal correlations (now expecting infinity)
null); // final double [][][] other_channels, // other channels to correlate, such as average RGB (first index - subcamera, 2-nd - channel, 3-rd - pixel)
TileProcessor mtp = mc.CLTMacroScan( // perform single pass according to prepared tiles operations and disparity
bgnd_data, // final CLTPass3d src_scan, // results of the normal correlations (now expecting infinity)
clt_parameters, // EyesisCorrectionParameters.CLTParameters clt_parameters,
geometryCorrection, // GeometryCorrection geometryCorrection,
0.0, // final double macro_disparity_low,
clt_parameters.grow_disp_max / tp.getTileSize(), // final double macro_disparity_high,
clt_parameters.mc_disp8_step, // final double macro_disparity_step,
debugLevel); // 1); // final int debugLevel){
CLTPass3d macro_combo = mtp.compositeScan(
mtp.clt_3d_passes, // final ArrayList <CLTPass3d> passes,
0, // final int firstPass,
mtp.clt_3d_passes.size(), // final int lastPassPlus1,
mtp.getTrustedCorrelation(), // final double trustedCorrelation,
0.0, // clt_parameters.bgnd_range, // final double disp_far, // limit results to the disparity range
clt_parameters.grow_disp_max / tp.getTileSize(), // final double disp_near,
clt_parameters.mc_strength, // final double minStrength,
Double.NaN, // clt_parameters.combine_min_hor, // final double minStrengthHor,
Double.NaN, // clt_parameters.combine_min_vert, // final double minStrengthVert,
// maybe temporarily? later keep weak?
true, // final boolean no_weak,
false, // final boolean use_last, //
// TODO: when useCombo - pay attention to borders (disregard)
false, // final boolean usePoly) // use polynomial method to find max), valid if useCombo == false
true, // final boolean copyDebug)
debugLevel);
mtp.clt_3d_passes.add(macro_combo);
mtp.showScan(
macro_combo, // CLTPass3d scan,
"macro_combo-"+mtp.clt_3d_passes.size());
for (int num_try = 0; num_try < 100; num_try++) {
CLTPass3d refined_macro = mc.refineMacro(
input_data, // final double [][][] input_data,
clt_parameters, // EyesisCorrectionParameters.CLTParameters clt_parameters,
geometryCorrection, // GeometryCorrection geometryCorrection,
clt_parameters.mc_disp8_trust, // final double trustedCorrelation,
0, // final double disp_far, // limit results to the disparity range
clt_parameters.grow_disp_max / tp.getTileSize(), // final double disp_near,
clt_parameters.mc_strength, // final double minStrength,
clt_parameters.mc_unique_tol, // final double unique_tolerance,
1); // final int debugLevel)
if (refined_macro == null) break;
mtp.clt_3d_passes.add(refined_macro);
mtp.showScan(
refined_macro, // CLTPass3d scan,
"refined_macro-"+mtp.clt_3d_passes.size());
}
CLTPass3d macro_combo1 = mtp.compositeScan(
mtp.clt_3d_passes, // final ArrayList <CLTPass3d> passes,
0, // final int firstPass,
mtp.clt_3d_passes.size(), // final int lastPassPlus1,
mtp.getTrustedCorrelation(), // final double trustedCorrelation,
0.0, // clt_parameters.bgnd_range, // final double disp_far, // limit results to the disparity range
clt_parameters.grow_disp_max / tp.getTileSize(), // final double disp_near,
clt_parameters.mc_strength, // final double minStrength,
Double.NaN, // clt_parameters.combine_min_hor, // final double minStrengthHor,
Double.NaN, // clt_parameters.combine_min_vert, // final double minStrengthVert,
// maybe temporarily? later keep weak?
true, // final boolean no_weak,
false, // final boolean use_last, //
// TODO: when useCombo - pay attention to borders (disregard)
false, // final boolean usePoly) // use polynomial method to find max), valid if useCombo == false
true, // final boolean copyDebug)
debugLevel);
mtp.clt_3d_passes.add(macro_combo1);
mtp.showScan(
macro_combo1, // CLTPass3d scan,
"macro_combo-"+mtp.clt_3d_passes.size());
// Temporary exit here
if (debugLevel > -100){
return null;
}
double [][] filtered_bgnd_disp_strength = tp.getFilteredDisparityStrength( double [][] filtered_bgnd_disp_strength = tp.getFilteredDisparityStrength(
tp.clt_3d_passes, // final ArrayList <CLTPass3d> passes,// List, first, last - to search for the already tried disparity
tp.clt_3d_passes.size() - 1, // final int measured_scan_index, // will not look at higher scans tp.clt_3d_passes.size() - 1, // final int measured_scan_index, // will not look at higher scans
0, // final int start_scan_index, 0, // final int start_scan_index,
null , // final boolean [] bg_tiles, // get from selected in clt_3d_passes.get(0); null , // final boolean [] bg_tiles, // get from selected in clt_3d_passes.get(0);
...@@ -5548,6 +5640,7 @@ public class QuadCLT { ...@@ -5548,6 +5640,7 @@ public class QuadCLT {
clt_parameters.combine_min_strength, // final double minStrength, clt_parameters.combine_min_strength, // final double minStrength,
clt_parameters.combine_min_hor, // final double minStrengthHor, clt_parameters.combine_min_hor, // final double minStrengthHor,
clt_parameters.combine_min_vert, // final double minStrengthVert, clt_parameters.combine_min_vert, // final double minStrengthVert,
false, // final boolean no_weak,
false, // final boolean use_last, // false, // final boolean use_last, //
// TODO: when useCombo - pay attention to borders (disregard) // TODO: when useCombo - pay attention to borders (disregard)
false, // final boolean usePoly) // use polynomial method to find max), valid if useCombo == false false, // final boolean usePoly) // use polynomial method to find max), valid if useCombo == false
...@@ -5575,274 +5668,366 @@ public class QuadCLT { ...@@ -5575,274 +5668,366 @@ public class QuadCLT {
boolean over_infinity = false; boolean over_infinity = false;
int dbg_start_pass = 4; // 10; // 20; int dbg_start_pass = 4; // 10; // 20;
int dbg_end_pass = 20; // 12; // -29; int dbg_end_pass = 20; // 12; // -29;
final int dbg_x0 = 73; // // final int dbg_x0 = 73; //
final int dbg_y0 = 195; // // final int dbg_y0 = 195; //
for (int num_expand = 0; num_expand < max_expand; num_expand++) { for (int num_expand = 0; num_expand < max_expand; num_expand++) {
boolean dbg_pass = (num_expand >= dbg_start_pass) && (num_expand <= dbg_end_pass); boolean dbg_pass = (num_expand >= dbg_start_pass) && (num_expand <= dbg_end_pass);
show_expand = (clt_parameters.show_expand && (max_expand <= 10)) || dbg_pass; show_expand = (clt_parameters.show_expand && (max_expand <= 10)) || dbg_pass;
// Runtime runtime = Runtime.getRuntime();
// Runtime runtime = Runtime.getRuntime(); // runtime.gc();
// runtime.gc(); // System.out.println("--- Free memory="+runtime.freeMemory()+" (of "+runtime.totalMemory()+")");
// System.out.println("--- Free memory="+runtime.freeMemory()+" (of "+runtime.totalMemory()+")");
boolean use_zMapExpansionStep = true; // false;
// Temporarily mixing results of refinePassSetup() and tp.getFilteredDisparityStrength(). The Later needs measurement pass, not refined
double [][] filtered_disp_strength = tp.getFilteredDisparityStrength( if (use_zMapExpansionStep) {
tp.clt_3d_passes.size() - 1, // final int measured_scan_index, // will not look at higher scans num_extended = zMapExpansionStep(
0, // final int start_scan_index, tp.clt_3d_passes, // final ArrayList <CLTPass3d> passes,// List, first, last - to search for the already tried disparity
tp.clt_3d_passes.get(bg_pass).getSelected(), // selected , // final boolean [] bg_tiles, // get from selected in clt_3d_passes.get(0); clt_parameters, //final EyesisCorrectionParameters.CLTParameters clt_parameters, // for refinePassSetup()
clt_parameters.ex_min_over,// final double ex_min_over, // when expanding over previously detected (by error) background, disregard far tiles 0, // final int firstPass,
disp_index, // final int disp_index, tp.clt_3d_passes.size(), // final int lastPassPlus1,
str_index, // final int str_index, bg_pass, // final int bg_index,
null, // final double [] tiltXY, // null - free with limit on both absolute (2.0?) and relative (0.2) values
trustedCorrelation, // final double trustedCorrelation, true, // final boolean refine, // now always should be true ?
strength_floor, // final double strength_floor, clt_parameters.gr_new_expand, // final boolean expand_neibs, // expand from neighbors
strength_pow, // final double strength_pow, !clt_parameters.gr_new_expand, // final boolean expand_legacy, // old mode of growing tiles (using max scanned). If both true, will try only if expand_neibs fails
smplSide, // final int smplSide, // = 2; // Sample size (side of a square)
smplNum, // final int smplNum, // = 3; // Number after removing worst (should be >1) // Filtering by background data:
smplRms, // final double smplRms, // = 0.1; // Maximal RMS of the remaining tiles in a sample filtered_bgnd_disp_strength, // final double [][] filtered_bgnd_ds, // if not null, will filter results not to have low disparity new tiles over supposed bgnd
smplRelRms, // final double smplRelRms, // = 0.005; // Maximal RMS/disparity in addition to smplRms // for legacy expansion it is not used, but just checked for null, so double [0][] should work too
smplWnd, // final boolean smplWnd, // clt_parameters.ex_min_over , // final double ex_min_over, // when expanding over previously detected (by error) background, disregard far tiles
max_abs_tilt, // final double max_abs_tilt, // = 2.0; // pix per tile clt_parameters.gr_ovrbg_filtered , // final double str_over_bg, // Minimal filtered strength when replacing background data
max_rel_tilt, // final double max_rel_tilt, // = 0.2; // (pix / disparity) per tile clt_parameters.gr_ovrbg_cmb , // final double str_over_bg_combo, // Minimal combined strength when replacing background data
dbg_x, clt_parameters.gr_ovrbg_cmb_hor , // final double str_over_bg_combo_hor, // Minimal combined strength when replacing background data
dbg_y, // final int dbg_y, clt_parameters.gr_ovrbg_cmb_vert, // final double str_over_bg_combo_vert, // Minimal combined strength when replacing background data
debugLevel+1); // final int debugLevel)
if (over_infinity) { // Refine parameters use directly some clt_parameters, others below
tp.filterOverBackground( clt_parameters.stUseRefine, // final boolean stUseRefine, // use supertiles (now false)
filtered_disp_strength, // final double [][] ds, clt_parameters.bgnd_range, //final double bgnd_range, // double disparity_far,
filtered_bgnd_disp_strength[1], // final double [] bg_strength, clt_parameters.ex_strength, // final double ex_strength, // double this_sure, // minimal strength to be considered definitely good
tp.clt_3d_passes.get(bg_pass).getSelected(), // final boolean [] bg_tiles, // get from selected in clt_3d_passes.get(0); clt_parameters.ex_nstrength, //final double ex_nstrength, // double ex_nstrength, // minimal 4-corr strength divided by channel diff for new (border) tiles
filterMinStrength, // final double minStrength, clt_parameters.bgnd_maybe, // final double bgnd_maybe, // double this_maybe, // maximal strength to ignore as non-background
clt_parameters.ex_min_over); // final double ex_min_over // when expanding over previously detected (by error) background, disregard far tiles clt_parameters.sure_smth, // final double sure_smth, // sure_smth, // if 2-nd worst image difference (noise-normalized) exceeds this - do not propagate bgnd
} clt_parameters.pt_super_trust, //final double pt_super_trust, // final double super_trust, // If strength exceeds ex_strength * super_trust, do not apply ex_nstrength and plate_ds
refine_pass = tp.clt_3d_passes.size(); // 1 // using plates disparity/strength - averaged for small square sets of tiles. If null - just use raw tiles
// refine pass uses hor/vert thresholds inside clt_parameters.pt_keep_raw_fg, // final boolean pt_keep_raw_fg, // final boolean keep_raw_fg, // do not replace raw tiles by the plates, if raw is closer (like poles)
CLTPass3d refined = tp.refinePassSetup( // prepare tile tasks for the refine pass (re-measure disparities) clt_parameters.pt_scale_pre, // final double pt_scale_pre, // final double scale_filtered_strength_pre, // scale plate_ds[1] before comparing to raw strength
// final double [][][] image_data, // first index - number of image in a quad clt_parameters.pt_scale_post, // final double pt_scale_post, // final double scale_filtered_strength_post,// scale plate_ds[1] when replacing raw (generally plate_ds is more reliable if it exists)
clt_parameters,
clt_parameters.stUseRefine, // use supertiles // Composite scan parameters
bg_pass, clt_parameters.combine_min_strength, // final double combine_min_strength, // final double minStrength,
// disparity range - differences from clt_parameters.combine_min_hor, // final double combine_min_hor, // final double minStrengthHor,
clt_parameters.bgnd_range, // double disparity_far, clt_parameters.combine_min_vert, // final double combine_min_vert, // final double minStrengthVert,
clt_parameters.grow_disp_max, // other_range, //double disparity_near, //
clt_parameters.ex_strength, // double this_sure, // minimal strength to be considered definitely good //getFilteredDisparityStrength parameters
clt_parameters.ex_nstrength, // double ex_nstrength, // minimal 4-corr strength divided by channel diff for new (border) tiles
clt_parameters.bgnd_maybe, // double this_maybe, // maximal strength to ignore as non-background // Consider separate parameters for FDS?
clt_parameters.sure_smth, // sure_smth, // if 2-nd worst image difference (noise-normalized) exceeds this - do not propagate bgnd clt_parameters.fds_str_floor, // final double fds_str_floor,
clt_parameters.pt_super_trust, // final double super_trust, // If strength exceeds ex_strength * super_trust, do not apply ex_nstrength and plate_ds clt_parameters.fds_str_pow, // final double fds_str_pow,
// using plates disparity/strength - averaged for small square sets of tiles. If null - just use raw tiles clt_parameters.fds_smpl_side, // final int fds_smpl_size, // == 5
filtered_disp_strength, // final double [][] plate_ds, // disparity/strength last time measured for the multi-tile squares. Strength =-1 - not measured. May be null clt_parameters.fds_smpl_num, // final int fds_smpl_points, // == 3
clt_parameters.pt_keep_raw_fg, // final boolean keep_raw_fg, // do not replace raw tiles by the plates, if raw is closer (like poles) clt_parameters.fds_smpl_rms, // final double fds_abs_rms,
clt_parameters.pt_scale_pre, // final double scale_filtered_strength_pre, // scale plate_ds[1] before comparing to raw strength clt_parameters.fds_smpl_rel_rms, // final double fds_rel_rms,
clt_parameters.pt_scale_post, // final double scale_filtered_strength_post,// scale plate_ds[1] when replacing raw (generally plate_ds is more reliable if it exists) clt_parameters.fds_smpl_wnd, // final boolean fds_use_wnd, // use window function fro the neighbors
0.001, // final double fds_tilt_damp,
ImageDtt.DISPARITY_INDEX_CM, // index of disparity value in disparity_map == 2 (0,2 or 4) clt_parameters.fds_abs_tilt, // final double fds_abs_tilt, // = 2.0; // pix per tile
geometryCorrection, clt_parameters.fds_rel_tilt, // final double fds_rel_tilt, // = 0.2; // (pix / disparity) per tile
threadsMax, // maximal number of threads to launch
updateStatus, // expansion from neighbors parameters:
debugLevel); clt_parameters.gr_min_new , // final int gr_min_new, // discard variant if there are less new tiles
tp.clt_3d_passes.add(refined); clt_parameters.gr_steps_over, // final int gr_steps_over, // how far to extend
clt_parameters.gr_var_new_sngl , // final boolean gr_var_new_sngl,
if (show_expand || (clt_parameters.show_expand && last_pass)) { clt_parameters.gr_var_new_fg , // final boolean gr_var_new_fg,
tp.showScan( clt_parameters.gr_var_all_fg , // final boolean gr_var_all_fg,
tp.clt_3d_passes.get(refine_pass), // CLTPass3d scan, clt_parameters.gr_var_new_bg , // final boolean gr_var_new_bg,
"after_refine-"+refine_pass); clt_parameters.gr_var_all_bg , // final boolean gr_var_all_bg,
} clt_parameters.gr_var_next , // final boolean gr_var_next,
clt_parameters.gr_smpl_size , // final int gr_smpl_size , // 5, // final int smpl_size, // == 5
clt_parameters.gr_min_pnts , // final int gr_min_pnts , // 5, // 4, // 3, // final int min_points, // == 3
clt_parameters.gr_use_wnd , // final boolean gr_use_wnd , // true, // final boolean use_wnd, // use window function fro the neighbors
clt_parameters.gr_tilt_damp , // final double gr_tilt_damp , // 0.001, // final double tilt_cost,
clt_parameters.gr_split_rng , // final double gr_split_rng , // 5.0, // final double split_threshold, // if full range of the values around the cell higher, need separate fg, bg
// if (show_expand || (clt_parameters.show_expand && last_pass)) { clt_parameters.gr_same_rng , // final double gr_same_rng , // 3.0, // final double same_range, // modify
// tp.showScan( clt_parameters.gr_diff_cont , // final double gr_diff_cont , // 2.0, // final double diff_continue, // maximal difference from the old value (for previously defined tiles
// tp.clt_3d_passes.get(refine_pass), // CLTPass3d scan, clt_parameters.gr_abs_tilt , // final double gr_abs_tilt , // 2.0, // final double max_abs_tilt, // = 2.0; // pix per tile
// "after_refine-"+refine_pass); clt_parameters.gr_rel_tilt , // final double gr_rel_tilt , // 0.2, // final double max_rel_tilt, // = 0.2; // (pix / disparity) per tile
// } clt_parameters.gr_smooth , // final int gr_smooth , // 50, // final int max_tries, // maximal number of smoothing steps
clt_parameters.gr_fin_diff , // final double gr_fin_diff , // 0.01, // final double final_diff, // maximal change to finish iterations
clt_parameters.gr_unique_pretol , // final double gr_unique_pretol , // 1.0, // final double unique_pre_tolerance, // usually larger than clt_parameters.unique_tolerance
tp.calcMaxTried(
tp.clt_3d_passes, // final ArrayList <CLTPass3d> passes, // legacy expansion
bg_pass, // final int firstPass, clt_parameters.grow_min_diff , // final double grow_min_diff, // = 0.5; // Grow more only if at least one channel has higher variance from others for the tile
refine_pass, // may add 1 to include current (for future?) // final int lastPassPlus1, clt_parameters.grow_retry_far , // final boolean grow_retry_far, // final boolean grow_retry_far, // Retry tiles around known foreground that have low max_tried_disparity
tp.clt_3d_passes.get(refine_pass)); // final int lastPassPlus1, clt_parameters.grow_pedantic , // final boolean grow_pedantic, // final boolean grow_pedantic, // Scan full range between max_tried_disparity of the background and known foreground
clt_parameters.grow_retry_inf , // final boolean grow_retry_inf, // final boolean grow_retry_inf, // Retry border tiles that were identified as infinity earlier
// repeated composite scan may be replaced by just a clone
CLTPass3d extended_pass = tp.compositeScan( // common expansion
tp.clt_3d_passes, // final ArrayList <CLTPass3d> passes, clt_parameters.gr_num_steps, // final int gr_num_steps, // how far to extend
bg_pass, // final int firstPass, clt_parameters.gr_unique_tol , // final double gr_unique_tol,
tp.clt_3d_passes.size(), // final int lastPassPlus1, 0.0, // clt_parameters.grow_disp_min , // final double grow_disp_min, // final double disp_near,
// tp.clt_3d_passes.get(bg_pass).getSelected(), // selected , // final boolean [] bg_tiles, // get from selected in clt_3d_passes.get(0); clt_parameters.grow_disp_max , // final double grow_disp_max, // final double disp_near,
// clt_parameters.ex_min_over,// final double ex_min_over, // when expanding over previously detected (by error) background, disregard far tiles clt_parameters.grow_disp_step , // final double grow_disp_step, // = 6.0; // Increase disparity (from maximal tried) if nothing found in that tile // TODO: handle enclosed dips?
tp.getTrustedCorrelation(), // final double trustedCorrelation,
0.0, // clt_parameters.bgnd_range, // final double disp_far, // limit results to the disparity range // for debug level > 1, just corresponding clt_parameters.* will work, otherwise following 3 can override
clt_parameters.grow_disp_max, // final double disp_near, last_pass, // final boolean last_pass, // just for more debug?
clt_parameters.combine_min_strength, // final double minStrength, true, // final boolean remove_non_measurement, // save memory, true is OK
clt_parameters.combine_min_hor, // final double minStrengthHor, show_expand, // final boolean show_expand,
clt_parameters.combine_min_vert, // final double minStrengthVert, clt_parameters. show_unique, // final boolean show_unique,
true, // false, // final boolean use_last, // show_retry_far, // final boolean show_retry_far,
// TODO: when useCombo - pay attention to borders (disregard)
false, // final boolean usePoly) // use polynomial method to find max), valid if useCombo == false dbg_x,
true, // final boolean copyDebug) dbg_y, // final int dbg_y,
debugLevel); debugLevel+1); // final int debugLevel)
if (over_infinity) {
tp.filterOverBackground(
extended_pass, // final CLTPass3d pass, } else { // if (use_zMapExpansionStep) {
comboMinStrength, // final double minStrength,
comboMinStrengthHor, // final double minStrengthHor, // Temporarily mixing results of refinePassSetup() and tp.getFilteredDisparityStrength(). The Later needs measurement pass, not refined
comboMinStrengthVert, //final double minStrengthVert, double [][] filtered_disp_strength = tp.getFilteredDisparityStrength(
tp.clt_3d_passes, // final ArrayList <CLTPass3d> passes,// List, first, last - to search for the already tried disparity
tp.clt_3d_passes.size() - 1, // final int measured_scan_index, // will not look at higher scans
0, // final int start_scan_index,
tp.clt_3d_passes.get(bg_pass).getSelected(), // selected , // final boolean [] bg_tiles, // get from selected in clt_3d_passes.get(0); tp.clt_3d_passes.get(bg_pass).getSelected(), // selected , // final boolean [] bg_tiles, // get from selected in clt_3d_passes.get(0);
clt_parameters.ex_min_over,// final double ex_min_over, // when expanding over previously detected (by error) background, disregard far tiles clt_parameters.ex_min_over,// final double ex_min_over, // when expanding over previously detected (by error) background, disregard far tiles
filtered_disp_strength); disp_index, // final int disp_index,
} str_index, // final int str_index,
if (show_expand || (clt_parameters.show_expand && last_pass)) tp.showScan( null, // final double [] tiltXY, // null - free with limit on both absolute (2.0?) and relative (0.2) values
tp.clt_3d_passes.get(refine_pass), // CLTPass3d scan, trustedCorrelation, // final double trustedCorrelation,
"after_refine-combine-"+(tp.clt_3d_passes.size() - 1)); strength_floor, // final double strength_floor,
strength_pow, // final double strength_pow,
smplSide, // final int smplSide, // = 2; // Sample size (side of a square)
if (show_expand || (clt_parameters.show_expand && last_pass)) { smplNum, // final int smplNum, // = 3; // Number after removing worst (should be >1)
String [] titles = {"disp","strength", "disp_combined","str_combined","max_tried","selected"}; smplRms, // final double smplRms, // = 0.1; // Maximal RMS of the remaining tiles in a sample
String title = "FDS_"+(tp.clt_3d_passes.size() - 1); smplRelRms, // final double smplRelRms, // = 0.005; // Maximal RMS/disparity in addition to smplRms
double [][] dbg_img = new double [titles.length][]; smplWnd, // final boolean smplWnd, //
dbg_img[0] = filtered_disp_strength[0]; max_abs_tilt, // final double max_abs_tilt, // = 2.0; // pix per tile
dbg_img[1] = filtered_disp_strength[1]; max_rel_tilt, // final double max_rel_tilt, // = 0.2; // (pix / disparity) per tile
dbg_img[2] = extended_pass.getDisparity(); dbg_x,
dbg_img[3] = extended_pass.getStrength(); dbg_y, // final int dbg_y,
double [][] max_tried_disparity = extended_pass.getMaxTriedDisparity(); debugLevel+1); // final int debugLevel)
if (max_tried_disparity != null){ if (over_infinity) {
dbg_img[4] = new double [tilesX * tilesY]; tp.filterOverBackground(
for (int ty = 0; ty < tilesY; ty++){ filtered_disp_strength, // final double [][] ds,
for (int tx = 0; tx < tilesX; tx++){ filtered_bgnd_disp_strength[1], // final double [] bg_strength,
dbg_img[4][ty*tilesX + tx] = max_tried_disparity[ty][tx]; tp.clt_3d_passes.get(bg_pass).getSelected(), // final boolean [] bg_tiles, // get from selected in clt_3d_passes.get(0);
filterMinStrength, // final double minStrength,
clt_parameters.ex_min_over); // final double ex_min_over // when expanding over previously detected (by error) background, disregard far tiles
}
refine_pass = tp.clt_3d_passes.size(); // 1
// refine pass uses hor/vert thresholds inside
CLTPass3d refined = tp.refinePassSetup( // prepare tile tasks for the refine pass (re-measure disparities)
// final double [][][] image_data, // first index - number of image in a quad
clt_parameters,
clt_parameters.stUseRefine, // use supertiles
bg_pass,
// disparity range - differences from
clt_parameters.bgnd_range, // double disparity_far,
clt_parameters.grow_disp_max, // other_range, //double disparity_near, //
clt_parameters.ex_strength, // double this_sure, // minimal strength to be considered definitely good
clt_parameters.ex_nstrength, // double ex_nstrength, // minimal 4-corr strength divided by channel diff for new (border) tiles
clt_parameters.bgnd_maybe, // double this_maybe, // maximal strength to ignore as non-background
clt_parameters.sure_smth, // sure_smth, // if 2-nd worst image difference (noise-normalized) exceeds this - do not propagate bgnd
clt_parameters.pt_super_trust, // final double super_trust, // If strength exceeds ex_strength * super_trust, do not apply ex_nstrength and plate_ds
// using plates disparity/strength - averaged for small square sets of tiles. If null - just use raw tiles
filtered_disp_strength, // final double [][] plate_ds, // disparity/strength last time measured for the multi-tile squares. Strength =-1 - not measured. May be null
clt_parameters.pt_keep_raw_fg, // final boolean keep_raw_fg, // do not replace raw tiles by the plates, if raw is closer (like poles)
clt_parameters.pt_scale_pre, // final double scale_filtered_strength_pre, // scale plate_ds[1] before comparing to raw strength
clt_parameters.pt_scale_post, // final double scale_filtered_strength_post,// scale plate_ds[1] when replacing raw (generally plate_ds is more reliable if it exists)
ImageDtt.DISPARITY_INDEX_CM, // index of disparity value in disparity_map == 2 (0,2 or 4)
geometryCorrection,
threadsMax, // maximal number of threads to launch
updateStatus,
debugLevel);
tp.clt_3d_passes.add(refined);
if (show_expand || (clt_parameters.show_expand && last_pass)) {
tp.showScan(
tp.clt_3d_passes.get(refine_pass), // CLTPass3d scan,
"after_refine-"+refine_pass);
}
tp.calcMaxTried(
tp.clt_3d_passes, // final ArrayList <CLTPass3d> passes,
bg_pass, // final int firstPass,
refine_pass, // may add 1 to include current (for future?) // final int lastPassPlus1,
tp.clt_3d_passes.get(refine_pass)); // final int lastPassPlus1,
// repeated composite scan may be replaced by just a clone
CLTPass3d extended_pass = tp.compositeScan(
tp.clt_3d_passes, // final ArrayList <CLTPass3d> passes,
bg_pass, // final int firstPass,
tp.clt_3d_passes.size(), // final int lastPassPlus1,
// tp.clt_3d_passes.get(bg_pass).getSelected(), // selected , // final boolean [] bg_tiles, // get from selected in clt_3d_passes.get(0);
// clt_parameters.ex_min_over,// final double ex_min_over, // when expanding over previously detected (by error) background, disregard far tiles
tp.getTrustedCorrelation(), // final double trustedCorrelation,
0.0, // clt_parameters.bgnd_range, // final double disp_far, // limit results to the disparity range
clt_parameters.grow_disp_max, // final double disp_near,
clt_parameters.combine_min_strength, // final double minStrength,
clt_parameters.combine_min_hor, // final double minStrengthHor,
clt_parameters.combine_min_vert, // final double minStrengthVert,
false, // final boolean no_weak,
true, // false, // final boolean use_last, //
// TODO: when useCombo - pay attention to borders (disregard)
false, // final boolean usePoly) // use polynomial method to find max), valid if useCombo == false
true, // final boolean copyDebug)
debugLevel);
if (over_infinity) {
tp.filterOverBackground(
extended_pass, // final CLTPass3d pass,
comboMinStrength, // final double minStrength,
comboMinStrengthHor, // final double minStrengthHor,
comboMinStrengthVert, //final double minStrengthVert,
tp.clt_3d_passes.get(bg_pass).getSelected(), // selected , // final boolean [] bg_tiles, // get from selected in clt_3d_passes.get(0);
clt_parameters.ex_min_over,// final double ex_min_over, // when expanding over previously detected (by error) background, disregard far tiles
filtered_disp_strength);
}
if (show_expand || (clt_parameters.show_expand && last_pass)) tp.showScan(
tp.clt_3d_passes.get(refine_pass), // CLTPass3d scan,
"after_refine-combine-"+(tp.clt_3d_passes.size() - 1));
if (show_expand || (clt_parameters.show_expand && last_pass)) {
String [] titles = {"disp","strength", "disp_combined","str_combined","max_tried","selected"};
String title = "FDS_"+(tp.clt_3d_passes.size() - 1);
double [][] dbg_img = new double [titles.length][];
dbg_img[0] = filtered_disp_strength[0];
dbg_img[1] = filtered_disp_strength[1];
dbg_img[2] = extended_pass.getDisparity();
dbg_img[3] = extended_pass.getStrength();
double [][] max_tried_disparity = extended_pass.getMaxTriedDisparity();
if (max_tried_disparity != null){
dbg_img[4] = new double [tilesX * tilesY];
for (int ty = 0; ty < tilesY; ty++){
for (int tx = 0; tx < tilesX; tx++){
dbg_img[4][ty*tilesX + tx] = max_tried_disparity[ty][tx];
}
} }
} }
} boolean [] s_selected = extended_pass.selected;
boolean [] s_selected = extended_pass.selected; boolean [] s_border = extended_pass.border_tiles;
boolean [] s_border = extended_pass.border_tiles; if ((s_selected != null) && (s_border != null)){
if ((s_selected != null) && (s_border != null)){ dbg_img[5] = new double [tilesX * tilesY];
dbg_img[5] = new double [tilesX * tilesY]; for (int i = 0; i < dbg_img[5].length; i++){
for (int i = 0; i < dbg_img[5].length; i++){ dbg_img[5][i] = 1.0 * ((s_selected[i]?1:0) + (s_border[i]?2:0));
dbg_img[5][i] = 1.0 * ((s_selected[i]?1:0) + (s_border[i]?2:0)); }
} }
(new showDoubleFloatArrays()).showArrays(dbg_img, tilesX, tilesY, true, title,titles);
} }
(new showDoubleFloatArrays()).showArrays(dbg_img, tilesX, tilesY, true, title,titles); if (new_expand) { // show_expand){ // use new mode
} if (last_pass){
System.out.println("+++++++++++ Last pass ++++++++++++");
}
if (new_expand) { // show_expand){ // use new mode // public boolean []
if (last_pass){ tp.dbg_filtered_disp_strength = filtered_disp_strength; // to be shown inside
System.out.println("+++++++++++ Last pass ++++++++++++"); boolean [] variants_flags = {
} clt_parameters.gr_var_new_sngl,
clt_parameters.gr_var_new_fg,
clt_parameters.gr_var_all_fg,
clt_parameters.gr_var_new_bg,
clt_parameters.gr_var_all_bg,
clt_parameters.gr_var_next};
numLeftRemoved = tp.prepareExpandVariant(
extended_pass, // final CLTPass3d scan, // combined scan with max_tried_disparity, will be modified to re-scan
tp.clt_3d_passes.get(refine_pass), // final CLTPass3d last_scan, // last prepared tile - can use last_scan.disparity, .border_tiles and .selected
tp.clt_3d_passes.get(bg_pass), // final CLTPass3d bg_scan, // background scan data
tp.clt_3d_passes, // final ArrayList <CLTPass3d> passes,// List, first, last - to search for the already tried disparity
0, // final int firstPass,
tp.clt_3d_passes.size(), // final int lastPassPlus1,
clt_parameters.gr_min_new , // 20, // final int min_new, // discard variant if there are less new tiles
variants_flags, // 0x1e, // 0x1f, // final int variants_mask,
clt_parameters.gr_num_steps , // 8, // final int num_steps, // how far to extend
clt_parameters.gr_steps_over , // 8, // 4, // final int num_steps_disc, // how far to extend
clt_parameters.gr_smpl_size , // 5, // final int smpl_size, // == 5
clt_parameters.gr_min_pnts , // 5, // 4, // 3, // final int min_points, // == 3
clt_parameters.gr_use_wnd , // true, // final boolean use_wnd, // use window function fro the neighbors
clt_parameters.gr_tilt_damp , // 0.001, // final double tilt_cost,
clt_parameters.gr_split_rng , // 5.0, // final double split_threshold, // if full range of the values around the cell higher, need separate fg, bg
clt_parameters.gr_same_rng , // 3.0, // final double same_range, // modify
clt_parameters.gr_diff_cont , // 2.0, // final double diff_continue, // maximal difference from the old value (for previously defined tiles
clt_parameters.gr_abs_tilt , // 2.0, // final double max_abs_tilt, // = 2.0; // pix per tile
clt_parameters.gr_rel_tilt , // 0.2, // final double max_rel_tilt, // = 0.2; // (pix / disparity) per tile
clt_parameters.gr_smooth , // 50, // final int max_tries, // maximal number of smoothing steps
clt_parameters.gr_fin_diff , // 0.01, // final double final_diff, // maximal change to finish iterations
0.0, // clt_parameters.grow_disp_max, // final double grow_disp_min,
clt_parameters.grow_disp_max, // final double grow_disp_max,
clt_parameters.grow_disp_step, // final double grow_disp_step,
clt_parameters.gr_unique_pretol , // 1.0, // final double unique_pre_tolerance, // usually larger than clt_parameters.unique_tolerance
last_pass? clt_parameters.gr_unique_tol : clt_parameters.gr_unique_pretol, // final double unique_tolerance,
clt_parameters. show_expand, // final boolean show_expand,
clt_parameters. show_unique, // final boolean show_unique,
//show_expand
138, // 216, // 214, // 210, // 206, // 204, // 202, // 200, // 198, // final int dbg_x,
149, // 138, // 140, // 142, // 143, // 142, // final int dbg_y,
1); // 2); // 1); // final int debugLevel)
refine_pass = tp.clt_3d_passes.size(); // now points to the extended_pass !!
tp.clt_3d_passes.add(extended_pass);
if (clt_parameters.show_expand || (numLeftRemoved[1] > 1 )) tp.showScan(
tp.clt_3d_passes.get(refine_pass), // CLTPass3d scan,
"prepareExpandVariant-"+numLeftRemoved[1]+"-"+refine_pass); //String title)
} else { // old way
boolean show_ex_debug = show_retry_far || (clt_parameters.show_retry_far && last_pass) || dbg_pass;
num_extended = tp.setupExtendDisparity(
extended_pass, // final CLTPass3d scan, // combined scan with max_tried_disparity, will be modified to re-scan
tp.clt_3d_passes.get(refine_pass), // final CLTPass3d last_scan, // last prepared tile - can use last_scan.disparity, .border_tiles and .selected
over_infinity? null: tp.clt_3d_passes.get(bg_pass), // final CLTPass3d bg_scan, // background scan data
clt_parameters.grow_sweep, // 8; // Try these number of tiles around known ones
clt_parameters.grow_disp_max, // = 50.0; // Maximal disparity to try
0.5 * clt_parameters.grow_disp_trust, // = 4.0; // Trust measured disparity within +/- this value
clt_parameters.grow_disp_step, // = 6.0; // Increase disparity (from maximal tried) if nothing found in that tile // TODO: handle enclosed dips?
clt_parameters.grow_min_diff, // = 0.5; // Grow more only if at least one channel has higher variance from others for the tile
clt_parameters.grow_retry_far, // final boolean grow_retry_far, // Retry tiles around known foreground that have low max_tried_disparity
clt_parameters.grow_pedantic, // final boolean grow_pedantic, // Scan full range between max_tried_disparity of the background and known foreground
clt_parameters.grow_retry_inf, // final boolean grow_retry_inf, // Retry border tiles that were identified as infinity earlier
clt_parameters, // EyesisCorrectionParameters.CLTParameters clt_parameters,
geometryCorrection, // GeometryCorrection geometryCorrection,
show_ex_debug, // true, // final boolean show_debug,
threadsMax, // maximal number of threads to launch
updateStatus,
debugLevel);
//TODO: break if nothing wanted? - no, there are some left to be refined
// public boolean [] if (debugLevel > -1){
tp.dbg_filtered_disp_strength = filtered_disp_strength; // to be shown inside System.out.println("=== setupExtendDisparity() pass:"+num_expand+" added "+num_extended+" new tiles to scan");
boolean [] variants_flags = { }
clt_parameters.gr_var_new_sngl,
clt_parameters.gr_var_new_fg,
clt_parameters.gr_var_all_fg,
clt_parameters.gr_var_new_bg,
clt_parameters.gr_var_all_bg,
clt_parameters.gr_var_next};
numLeftRemoved = tp.prepareExpandVariant(
extended_pass, // final CLTPass3d scan, // combined scan with max_tried_disparity, will be modified to re-scan
tp.clt_3d_passes.get(refine_pass), // final CLTPass3d last_scan, // last prepared tile - can use last_scan.disparity, .border_tiles and .selected
/*null, // */ tp.clt_3d_passes.get(bg_pass), // final CLTPass3d bg_scan, // background scan data
tp.clt_3d_passes, // final ArrayList <CLTPass3d> passes,// List, first, last - to search for the already tried disparity
0, // final int firstPass,
tp.clt_3d_passes.size(), // final int lastPassPlus1,
clt_parameters.gr_min_new , // 20, // final int min_new, // discard variant if there are less new tiles
variants_flags, // 0x1e, // 0x1f, // final int variants_mask,
clt_parameters.gr_num_steps , // 8, // final int num_steps, // how far to extend
clt_parameters.gr_steps_over , // 8, // 4, // final int num_steps_disc, // how far to extend
clt_parameters.gr_smpl_size , // 5, // final int smpl_size, // == 5
clt_parameters.gr_min_pnts , // 5, // 4, // 3, // final int min_points, // == 3
clt_parameters.gr_use_wnd , // true, // final boolean use_wnd, // use window function fro the neighbors
clt_parameters.gr_tilt_damp , // 0.001, // final double tilt_cost,
clt_parameters.gr_split_rng , // 5.0, // final double split_threshold, // if full range of the values around the cell higher, need separate fg, bg
clt_parameters.gr_same_rng , // 3.0, // final double same_range, // modify
clt_parameters.gr_diff_cont , // 2.0, // final double diff_continue, // maximal difference from the old value (for previously defined tiles
clt_parameters.gr_abs_tilt , // 2.0, // final double max_abs_tilt, // = 2.0; // pix per tile
clt_parameters.gr_rel_tilt , // 0.2, // final double max_rel_tilt, // = 0.2; // (pix / disparity) per tile
clt_parameters.gr_smooth , // 50, // final int max_tries, // maximal number of smoothing steps
clt_parameters.gr_fin_diff , // 0.01, // final double final_diff, // maximal change to finish iterations
0.0, // clt_parameters.grow_disp_max, // final double grow_disp_min,
clt_parameters.grow_disp_max, // final double grow_disp_max,
clt_parameters.grow_disp_step, // final double grow_disp_step,
clt_parameters.gr_unique_pretol , // 1.0, // final double unique_pre_tolerance, // usually larger than clt_parameters.unique_tolerance
last_pass? clt_parameters.gr_unique_tol : clt_parameters.gr_unique_pretol, // final double unique_tolerance,
clt_parameters. show_expand, // final boolean show_expand,
clt_parameters. show_unique, // final boolean show_unique,
//show_expand
138, // 216, // 214, // 210, // 206, // 204, // 202, // 200, // 198, // final int dbg_x,
149, // 138, // 140, // 142, // 143, // 142, // final int dbg_y,
1); // 2); // 1); // final int debugLevel)
refine_pass = tp.clt_3d_passes.size(); // now points to the extended_pass !!
tp.clt_3d_passes.add(extended_pass);
// if (show_expand) tp.showScan(
// if (clt_parameters.show_expand || (numLeftRemoved[1] > 4 )) tp.showScan(
if (clt_parameters.show_expand || (numLeftRemoved[1] > 1 )) tp.showScan(
tp.clt_3d_passes.get(refine_pass), // CLTPass3d scan,
"prepareExpandVariant-"+numLeftRemoved[1]+"-"+refine_pass); //String title)
} else { // old way
boolean show_ex_debug = show_retry_far || (clt_parameters.show_retry_far && last_pass) || dbg_pass;
num_extended = tp.setupExtendDisparity(
extended_pass, // final CLTPass3d scan, // combined scan with max_tried_disparity, will be modified to re-scan
tp.clt_3d_passes.get(refine_pass), // final CLTPass3d last_scan, // last prepared tile - can use last_scan.disparity, .border_tiles and .selected
over_infinity? null: tp.clt_3d_passes.get(bg_pass), // final CLTPass3d bg_scan, // background scan data
clt_parameters.grow_sweep, // 8; // Try these number of tiles around known ones
clt_parameters.grow_disp_max, // = 50.0; // Maximal disparity to try
0.5 * clt_parameters.grow_disp_trust, // = 4.0; // Trust measured disparity within +/- this value
clt_parameters.grow_disp_step, // = 6.0; // Increase disparity (from maximal tried) if nothing found in that tile // TODO: handle enclosed dips?
clt_parameters.grow_min_diff, // = 0.5; // Grow more only if at least one channel has higher variance from others for the tile
clt_parameters.grow_retry_far, // final boolean grow_retry_far, // Retry tiles around known foreground that have low max_tried_disparity
clt_parameters.grow_pedantic, // final boolean grow_pedantic, // Scan full range between max_tried_disparity of the background and known foreground
clt_parameters.grow_retry_inf, // final boolean grow_retry_inf, // Retry border tiles that were identified as infinity earlier
clt_parameters, // EyesisCorrectionParameters.CLTParameters clt_parameters,
geometryCorrection, // GeometryCorrection geometryCorrection,
show_ex_debug, // true, // final boolean show_debug,
threadsMax, // maximal number of threads to launch
updateStatus,
debugLevel);
//TODO: break if nothing wanted? - no, there are some left to be refined
if (debugLevel > -1){
System.out.println("=== setupExtendDisparity() pass:"+num_expand+" added "+num_extended+" new tiles to scan");
}
refine_pass = tp.clt_3d_passes.size(); // 1 refine_pass = tp.clt_3d_passes.size(); // 1
tp.clt_3d_passes.add(extended_pass); tp.clt_3d_passes.add(extended_pass);
numLeftRemoved = tp.makeUnique(
tp.clt_3d_passes, // final ArrayList <CLTPass3d> passes,
0, // final int firstPass,
refine_pass, // - 1, // final int lastPassPlus1,
tp.clt_3d_passes.get(refine_pass), // final CLTPass3d new_scan,
clt_parameters.grow_disp_max, // final double grow_disp_max,
clt_parameters.gr_unique_tol, // final double unique_tolerance,
clt_parameters.show_unique); // final boolean show_unique)
if (show_expand) tp.showScan(
tp.clt_3d_passes.get(refine_pass), // CLTPass3d scan,
"before_measure-"+refine_pass); //String title)
if (debugLevel > -1){ numLeftRemoved = tp.makeUnique(
System.out.println("last makeUnique("+refine_pass+") -> left: "+numLeftRemoved[0]+", removed:" + numLeftRemoved[1]); tp.clt_3d_passes, // final ArrayList <CLTPass3d> passes,
} 0, // final int firstPass,
// num_extended = numLeftRemoved[0]; refine_pass, // - 1, // final int lastPassPlus1,
//TODO: break if nothing wanted? - here yes, will make sense tp.clt_3d_passes.get(refine_pass), // final CLTPass3d new_scan,
clt_parameters.grow_disp_max, // final double grow_disp_max,
clt_parameters.gr_unique_tol, // final double unique_tolerance,
clt_parameters.show_unique); // final boolean show_unique)
if (show_expand) tp.showScan(
tp.clt_3d_passes.get(refine_pass), // CLTPass3d scan,
"before_measure-"+refine_pass); //String title)
} if (debugLevel > -1){
num_extended = numLeftRemoved[0]; System.out.println("last makeUnique("+refine_pass+") -> left: "+numLeftRemoved[0]+", removed:" + numLeftRemoved[1]);
}
// num_extended = numLeftRemoved[0];
//TODO: break if nothing wanted? - here yes, will make sense
} // end of old way
} // if (use_zMapExpansionStep) else
//// num_extended = numLeftRemoved[0];
// refine_pass = tp.clt_3d_passes.size(); // // refine_pass = tp.clt_3d_passes.size(); //
CLTMeasure( // perform single pass according to prepared tiles operations and disparity CLTMeasure( // perform single pass according to prepared tiles operations and disparity
...@@ -5875,8 +6060,6 @@ public class QuadCLT { ...@@ -5875,8 +6060,6 @@ public class QuadCLT {
} }
//num_expand == 9 //num_expand == 9
/* */
CLTPass3d combo_pass = tp.compositeScan( CLTPass3d combo_pass = tp.compositeScan(
tp.clt_3d_passes, // final ArrayList <CLTPass3d> passes, tp.clt_3d_passes, // final ArrayList <CLTPass3d> passes,
bg_pass, // final int firstPass, bg_pass, // final int firstPass,
...@@ -5887,21 +6070,20 @@ public class QuadCLT { ...@@ -5887,21 +6070,20 @@ public class QuadCLT {
clt_parameters.combine_min_strength, // final double minStrength, clt_parameters.combine_min_strength, // final double minStrength,
clt_parameters.combine_min_hor, // final double minStrengthHor, clt_parameters.combine_min_hor, // final double minStrengthHor,
clt_parameters.combine_min_vert, // final double minStrengthVert, clt_parameters.combine_min_vert, // final double minStrengthVert,
false, // final boolean no_weak,
false, // final boolean use_last, // false, // final boolean use_last, //
// TODO: when useCombo - pay attention to borders (disregard) // TODO: when useCombo - pay attention to borders (disregard)
false, // final boolean usePoly) // use polynomial method to find max), valid if useCombo == false false, // final boolean usePoly) // use polynomial method to find max), valid if useCombo == false
true, // final boolean copyDebug) true, // final boolean copyDebug)
// (num_expand == 9)? 2: debugLevel); // (num_expand == 9)? 2: debugLevel);
debugLevel); debugLevel);
/* // tp.filterOverBackground(
tp.filterOverBackground( // combo_pass, // final CLTPass3d pass,
combo_pass, // final CLTPass3d pass, // comboMinStrength, // final double minStrength,
comboMinStrength, // final double minStrength, // comboMinStrengthHor, // final double minStrengthHor,
comboMinStrengthHor, // final double minStrengthHor, // comboMinStrengthVert, //final double minStrengthVert,
comboMinStrengthVert, //final double minStrengthVert, // tp.clt_3d_passes.get(bg_pass).getSelected(), // selected , // final boolean [] bg_tiles, // get from selected in clt_3d_passes.get(0);
tp.clt_3d_passes.get(bg_pass).getSelected(), // selected , // final boolean [] bg_tiles, // get from selected in clt_3d_passes.get(0); // clt_parameters.ex_min_over);// final double ex_min_over, // when expanding over previously detected (by error) background, disregard far tiles
clt_parameters.ex_min_over);// final double ex_min_over, // when expanding over previously detected (by error) background, disregard far tiles
*/
tp.clt_3d_passes.add(combo_pass); tp.clt_3d_passes.add(combo_pass);
// refine_pass = tp.clt_3d_passes.size(); // refine_pass = tp.clt_3d_passes.size();
// } // }
...@@ -5909,11 +6091,10 @@ public class QuadCLT { ...@@ -5909,11 +6091,10 @@ public class QuadCLT {
tp.clt_3d_passes.get(tp.clt_3d_passes.size() -1), // refine_pass), // CLTPass3d scan, tp.clt_3d_passes.get(tp.clt_3d_passes.size() -1), // refine_pass), // CLTPass3d scan,
"after_combo_pass-"+(tp.clt_3d_passes.size() -1)); // (refine_pass)); //String title) "after_combo_pass-"+(tp.clt_3d_passes.size() -1)); // (refine_pass)); //String title)
/* */
if (last_pass) { if (last_pass) {
break; break;
} else if (numLeftRemoved[0] == 0){ } else if (num_extended == 0){
System.out.println("**** processCLTQuad3d(): nothing to expand ***"); System.out.println("**** processCLTQuad3d(): nothing to expand ***");
System.out.println("!clt_parameters.ex_over_bgnd="+clt_parameters.ex_over_bgnd+" over_infinity="+over_infinity); System.out.println("!clt_parameters.ex_over_bgnd="+clt_parameters.ex_over_bgnd+" over_infinity="+over_infinity);
if (!clt_parameters.ex_over_bgnd || over_infinity) last_pass = true; if (!clt_parameters.ex_over_bgnd || over_infinity) last_pass = true;
...@@ -5927,30 +6108,9 @@ public class QuadCLT { ...@@ -5927,30 +6108,9 @@ public class QuadCLT {
} }
/*
CLTPass3d combo_pass = tp.compositeScan(
tp.clt_3d_passes, // final ArrayList <CLTPass3d> passes,
bg_pass, // final int firstPass,
tp.clt_3d_passes.size(), // final int lastPassPlus1,
tp.getTrustedCorrelation(), // final double trustedCorrelation,
-0.5, // 0.0, // clt_parameters.bgnd_range, // final double disp_far, // limit results to the disparity range
clt_parameters.grow_disp_max, // final double disp_near,
clt_parameters.combine_min_strength, // final double minStrength,
clt_parameters.combine_min_hor, // final double minStrengthHor,
clt_parameters.combine_min_vert, // final double minStrengthVert,
false, // final boolean use_last, //
// TODO: when useCombo - pay attention to borders (disregard)
false, // final boolean usePoly) // use polynomial method to find max), valid if useCombo == false
true, // final boolean copyDebug)
// (num_expand == 9)? 2: debugLevel);
debugLevel);
tp.clt_3d_passes.add(combo_pass);
if (show_expand || (clt_parameters.show_expand && last_pass)) tp.showScan(
tp.clt_3d_passes.get(tp.clt_3d_passes.size() -1), // refine_pass), // CLTPass3d scan,
"after_combo_pass-"+(tp.clt_3d_passes.size() -1)); // (refine_pass)); //String title)
*/
show_expand = (clt_parameters.show_expand && (max_expand <= 10)); show_expand = (clt_parameters.show_expand && (max_expand <= 10));
...@@ -6001,9 +6161,6 @@ public class QuadCLT { ...@@ -6001,9 +6161,6 @@ public class QuadCLT {
// called after composite scan is added to the list? composite scan is inside // called after composite scan is added to the list? composite scan is inside
public int zMapExpansionStep( public int zMapExpansionStep(
// final CLTPass3d scan, // combined scan with max_tried_disparity, will be modified to re-scan
// final CLTPass3d last_scan, // last prepared tile - can use last_scan.disparity, .border_tiles and .selected
// final CLTPass3d bg_scan, // background scan data, null - ignore background
final ArrayList <CLTPass3d> passes,// List, first, last - to search for the already tried disparity final ArrayList <CLTPass3d> passes,// List, first, last - to search for the already tried disparity
final EyesisCorrectionParameters.CLTParameters clt_parameters, // for refinePassSetup() final EyesisCorrectionParameters.CLTParameters clt_parameters, // for refinePassSetup()
final int firstPass, final int firstPass,
...@@ -6027,7 +6184,6 @@ public class QuadCLT { ...@@ -6027,7 +6184,6 @@ public class QuadCLT {
// Refine parameters use directly some clt_parameters, others below // Refine parameters use directly some clt_parameters, others below
final boolean stUseRefine, // use supertiles final boolean stUseRefine, // use supertiles
final double bgnd_range, // double disparity_far, final double bgnd_range, // double disparity_far,
// clt_parameters.grow_disp_max, // other_range, //double disparity_near, //
final double ex_strength, // double this_sure, // minimal strength to be considered definitely good final double ex_strength, // double this_sure, // minimal strength to be considered definitely good
final double ex_nstrength, // double ex_nstrength, // minimal 4-corr strength divided by channel diff for new (border) tiles final double ex_nstrength, // double ex_nstrength, // minimal 4-corr strength divided by channel diff for new (border) tiles
final double bgnd_maybe, // double this_maybe, // maximal strength to ignore as non-background final double bgnd_maybe, // double this_maybe, // maximal strength to ignore as non-background
...@@ -6044,8 +6200,8 @@ public class QuadCLT { ...@@ -6044,8 +6200,8 @@ public class QuadCLT {
final double combine_min_vert, // final double minStrengthVert, final double combine_min_vert, // final double minStrengthVert,
//getFilteredDisparityStrength parameter //getFilteredDisparityStrength parameter
final double fds_strength_floor, final double fds_str_floor,
final double fds_strength_pow, final double fds_str_pow,
final int fds_smpl_size, // == 5 final int fds_smpl_size, // == 5
final int fds_smpl_points, // == 3 final int fds_smpl_points, // == 3
final double fds_abs_rms, final double fds_abs_rms,
...@@ -6114,7 +6270,8 @@ public class QuadCLT { ...@@ -6114,7 +6270,8 @@ public class QuadCLT {
// disparity "measurements". This data will be combined with individual tiles, quad, hor and vert correlation results // disparity "measurements". This data will be combined with individual tiles, quad, hor and vert correlation results
double [][] filtered_disp_strength = tp.getFilteredDisparityStrength( double [][] filtered_disp_strength = tp.getFilteredDisparityStrength(
lastPassPlus1, // final int measured_scan_index, // will not look at higher scans tp.clt_3d_passes, // final ArrayList <CLTPass3d> passes,// List, first, last - to search for the already tried disparity
lastPassPlus1 - 1, // final int measured_scan_index, // will not look at higher scans
0, // final int start_scan_index, 0, // final int start_scan_index,
bg_scan.getSelected(), // selected , // final boolean [] bg_tiles, // get from selected in clt_3d_passes.get(0); bg_scan.getSelected(), // selected , // final boolean [] bg_tiles, // get from selected in clt_3d_passes.get(0);
ex_min_over, // final double ex_min_over, // when expanding over previously detected (by error) background, disregard far tiles ex_min_over, // final double ex_min_over, // when expanding over previously detected (by error) background, disregard far tiles
...@@ -6122,8 +6279,8 @@ public class QuadCLT { ...@@ -6122,8 +6279,8 @@ public class QuadCLT {
ImageDtt.DISPARITY_STRENGTH_INDEX, // final int str_index, ImageDtt.DISPARITY_STRENGTH_INDEX, // final int str_index,
null, // final double [] tiltXY, // null - free with limit on both absolute (2.0?) and relative (0.2) values null, // final double [] tiltXY, // null - free with limit on both absolute (2.0?) and relative (0.2) values
tp.getTrustedCorrelation(), // final double trustedCorrelation, tp.getTrustedCorrelation(), // final double trustedCorrelation,
fds_strength_floor, // final double strength_floor, fds_str_floor, // final double strength_floor,
fds_strength_pow, // final double strength_pow, fds_str_pow, // final double strength_pow,
fds_smpl_size, // final int smplSide, // = 2; // Sample size (side of a square) fds_smpl_size, // final int smplSide, // = 2; // Sample size (side of a square)
fds_smpl_points, // final int smplNum, // = 3; // Number after removing worst (should be >1) fds_smpl_points, // final int smplNum, // = 3; // Number after removing worst (should be >1)
fds_abs_rms, // final double smplRms, // = 0.1; // Maximal RMS of the remaining tiles in a sample fds_abs_rms, // final double smplRms, // = 0.1; // Maximal RMS of the remaining tiles in a sample
...@@ -6199,11 +6356,12 @@ public class QuadCLT { ...@@ -6199,11 +6356,12 @@ public class QuadCLT {
combine_min_strength, // final double minStrength, combine_min_strength, // final double minStrength,
combine_min_hor, // final double minStrengthHor, combine_min_hor, // final double minStrengthHor,
combine_min_vert, // final double minStrengthVert, combine_min_vert, // final double minStrengthVert,
false, // final boolean no_weak,
true, // false, // final boolean use_last, // true, // false, // final boolean use_last, //
// TODO: when useCombo - pay attention to borders (disregard) // TODO: when useCombo - pay attention to borders (disregard)
false, // final boolean usePoly) // use polynomial method to find max), valid if useCombo == false false, // final boolean usePoly) // use polynomial method to find max), valid if useCombo == false
true, // final boolean copyDebug) true, // final boolean copyDebug)
debugLevel); debugLevel - 1);
if (show_expand || (clt_parameters.show_expand && last_pass)) tp.showScan( if (show_expand || (clt_parameters.show_expand && last_pass)) tp.showScan(
passes.get(refine_pass), // CLTPass3d scan, passes.get(refine_pass), // CLTPass3d scan,
"after_refine-combine0-"+(passes.size() - 1)); "after_refine-combine0-"+(passes.size() - 1));
...@@ -6303,7 +6461,9 @@ public class QuadCLT { ...@@ -6303,7 +6461,9 @@ public class QuadCLT {
dbg_y, dbg_y,
debugLevel); debugLevel);
num_extended = numLeftRemoved[0]; num_extended = numLeftRemoved[0];
if (clt_parameters.show_expand || (numLeftRemoved[1] > 1 )) tp.showScan(
tp.clt_3d_passes.get(refine_pass), // CLTPass3d scan,
"prepareExpandVariant-"+numLeftRemoved[1]+"-"+refine_pass); //String title)
} }
if ((num_extended == 0) && expand_legacy) { // if both are on, will use legacy if neighbors failed if ((num_extended == 0) && expand_legacy) { // if both are on, will use legacy if neighbors failed
...@@ -6374,7 +6534,7 @@ public class QuadCLT { ...@@ -6374,7 +6534,7 @@ public class QuadCLT {
false, // final boolean save_textures, false, // final boolean save_textures,
tp.threadsMax, // maximal number of threads to launch tp.threadsMax, // maximal number of threads to launch
false, // updateStatus, false, // updateStatus,
debugLevel); debugLevel - 1);
if (remove_non_measurement) { if (remove_non_measurement) {
if (debugLevel > -1){ if (debugLevel > -1){
System.out.print("Removing non-measurement(derivative) scan data, current list size = "+passes.size()); System.out.print("Removing non-measurement(derivative) scan data, current list size = "+passes.size());
...@@ -6407,12 +6567,13 @@ public class QuadCLT { ...@@ -6407,12 +6567,13 @@ public class QuadCLT {
clt_parameters.combine_min_strength, // final double minStrength, clt_parameters.combine_min_strength, // final double minStrength,
clt_parameters.combine_min_hor, // final double minStrengthHor, clt_parameters.combine_min_hor, // final double minStrengthHor,
clt_parameters.combine_min_vert, // final double minStrengthVert, clt_parameters.combine_min_vert, // final double minStrengthVert,
false, // final boolean no_weak,
false, // final boolean use_last, // false, // final boolean use_last, //
// TODO: when useCombo - pay attention to borders (disregard) // TODO: when useCombo - pay attention to borders (disregard)
false, // final boolean usePoly) // use polynomial method to find max), valid if useCombo == false false, // final boolean usePoly) // use polynomial method to find max), valid if useCombo == false
true, // final boolean copyDebug) true, // final boolean copyDebug)
// (num_expand == 9)? 2: debugLevel); // (num_expand == 9)? 2: debugLevel);
debugLevel); debugLevel -1);
/* /*
tp.filterOverBackground( tp.filterOverBackground(
combo_pass, // final CLTPass3d pass, combo_pass, // final CLTPass3d pass,
...@@ -7114,6 +7275,7 @@ public class QuadCLT { ...@@ -7114,6 +7275,7 @@ public class QuadCLT {
ImageDtt image_dtt = new ImageDtt(); ImageDtt image_dtt = new ImageDtt();
final double disparity_corr = (clt_parameters.z_correction == 0) ? 0.0 : geometryCorrection.getDisparityFromZ(1.0/clt_parameters.z_correction); final double disparity_corr = (clt_parameters.z_correction == 0) ? 0.0 : geometryCorrection.getDisparityFromZ(1.0/clt_parameters.z_correction);
image_dtt.clt_aberrations_quad_corr( image_dtt.clt_aberrations_quad_corr(
1, // final int macro_scale, // to correlate tile data instead of the pixel data: 1 - pixels, 8 - tiles
tile_op, // per-tile operation bit codes tile_op, // per-tile operation bit codes
disparity_array, // clt_parameters.disparity, // final double disparity, disparity_array, // clt_parameters.disparity, // final double disparity,
image_data, // final double [][][] imade_data, // first index - number of image in a quad image_data, // final double [][][] imade_data, // first index - number of image in a quad
...@@ -7221,6 +7383,7 @@ public class QuadCLT { ...@@ -7221,6 +7383,7 @@ public class QuadCLT {
ImageDtt image_dtt = new ImageDtt(); ImageDtt image_dtt = new ImageDtt();
final double disparity_corr = (clt_parameters.z_correction == 0) ? 0.0 : geometryCorrection.getDisparityFromZ(1.0/clt_parameters.z_correction); final double disparity_corr = (clt_parameters.z_correction == 0) ? 0.0 : geometryCorrection.getDisparityFromZ(1.0/clt_parameters.z_correction);
image_dtt.clt_aberrations_quad_corr( image_dtt.clt_aberrations_quad_corr(
1, // final int macro_scale, // to correlate tile data instead of the pixel data: 1 - pixels, 8 - tiles
tile_op, // per-tile operation bit codes tile_op, // per-tile operation bit codes
disparity_array, // clt_parameters.disparity, // final double disparity, disparity_array, // clt_parameters.disparity, // final double disparity,
image_data, // final double [][][] imade_data, // first index - number of image in a quad image_data, // final double [][][] imade_data, // first index - number of image in a quad
......
...@@ -80,6 +80,9 @@ public class TileProcessor { ...@@ -80,6 +80,9 @@ public class TileProcessor {
return this.corr_magic_scale; return this.corr_magic_scale;
} }
public int getThreadsMax(){
return this.threadsMax;
}
// public void setMagicScale (double scale) // public void setMagicScale (double scale)
// { // {
// this.corr_magic_scale = scale; // this.corr_magic_scale = scale;
...@@ -373,8 +376,9 @@ public class TileProcessor { ...@@ -373,8 +376,9 @@ public class TileProcessor {
* @param disp_far lowest disparity value to consider (does not apply to max_tried_disparity) * @param disp_far lowest disparity value to consider (does not apply to max_tried_disparity)
* @param disp_near highest disparity value to consider (does not apply to max_tried_disparity) * @param disp_near highest disparity value to consider (does not apply to max_tried_disparity)
* @param minStrength full correlation strength to consider data to be reliable * @param minStrength full correlation strength to consider data to be reliable
* @param minStrengthHor horizontal (for vertical features) correlation strength to consider data to be reliable * @param minStrengthHor horizontal (for vertical features) correlation strength to consider data to be reliable. NaN - do not use
* @param minStrengthVert vertical (for horizontal features) correlation strength to consider data to be reliable * @param minStrengthVert vertical (for horizontal features) correlation strength to consider data to be reliable. NaN - do not use
* @param no_weak Do not use weak at all
* @param use_last use last scan data if nothing strong enough (false - use the strongest) * @param use_last use last scan data if nothing strong enough (false - use the strongest)
* @param usePoly use polynomial method to find max for full correlation, false - use center of mass * @param usePoly use polynomial method to find max for full correlation, false - use center of mass
* @param copyDebug copy data that is only needed for debug purposes * @param copyDebug copy data that is only needed for debug purposes
...@@ -390,6 +394,7 @@ public class TileProcessor { ...@@ -390,6 +394,7 @@ public class TileProcessor {
final double minStrength, final double minStrength,
final double minStrengthHor, final double minStrengthHor,
final double minStrengthVert, final double minStrengthVert,
final boolean no_weak,
final boolean use_last, // final boolean use_last, //
// TODO: when useCombo - pay attention to borders (disregard) // TODO: when useCombo - pay attention to borders (disregard)
final boolean usePoly, // use polynomial method to find max), valid if useCombo == false final boolean usePoly, // use polynomial method to find max), valid if useCombo == false
...@@ -488,7 +493,7 @@ public class TileProcessor { ...@@ -488,7 +493,7 @@ public class TileProcessor {
best_index = ipass; best_index = ipass;
} }
} else { } else {
if ((last && (strength > 0.0)) || (strength > strongest_weak)){ if ((last && (strength > 0.0)) || (!no_weak && (strength > strongest_weak))){
strongest_weak = strength; strongest_weak = strength;
best_weak_index = ipass; best_weak_index = ipass;
} }
...@@ -497,16 +502,16 @@ public class TileProcessor { ...@@ -497,16 +502,16 @@ public class TileProcessor {
// } // }
} }
if (adiff_hor <= trustedCorrelation){ if (!Double.isNaN(minStrengthHor) && (adiff_hor <= trustedCorrelation)){
double disp_hor = mdisp_hor/corr_magic_scale + pass.disparity[ty][tx]; double disp_hor = mdisp_hor/corr_magic_scale + pass.disparity[ty][tx];
if ((disp_hor >= disp_far) && (disp_hor <= disp_near) && !Double.isNaN(adiff_hor)){ if ((disp_hor >= disp_far) && (disp_hor <= disp_near) && !Double.isNaN(adiff_hor)){
if (strength_hor >= minStrength) { if (strength_hor >= minStrengthHor) {
if (!(adiff_hor >= adiff_best_hor)){ // adiff_best == Double.NaN works too if (!(adiff_hor >= adiff_best_hor)){ // adiff_best == Double.NaN works too
adiff_best_hor = adiff_hor; adiff_best_hor = adiff_hor;
best_index_hor = ipass; best_index_hor = ipass;
} }
} else { } else {
if ((last && (strength_hor > 0.0)) || (strength_hor > strongest_weak_hor)){ if ((last && (strength_hor > 0.0)) || (!no_weak && (strength_hor > strongest_weak_hor))){
strongest_weak_hor = strength_hor; strongest_weak_hor = strength_hor;
best_weak_index_hor = ipass; best_weak_index_hor = ipass;
} }
...@@ -514,16 +519,16 @@ public class TileProcessor { ...@@ -514,16 +519,16 @@ public class TileProcessor {
} }
} }
if (adiff_vert <= trustedCorrelation){ if (!Double.isNaN(minStrengthVert) && (adiff_vert <= trustedCorrelation)){
double disp_vert = mdisp_vert/corr_magic_scale + pass.disparity[ty][tx]; double disp_vert = mdisp_vert/corr_magic_scale + pass.disparity[ty][tx];
if ((disp_vert >= disp_far) && (disp_vert <= disp_near) && !Double.isNaN(adiff_vert)){ if ((disp_vert >= disp_far) && (disp_vert <= disp_near) && !Double.isNaN(adiff_vert)){
if (strength_vert >= minStrength) { if (strength_vert >= minStrengthVert) {
if (!(adiff_vert >= adiff_best_vert)){ // adiff_best == Double.NaN works too if (!(adiff_vert >= adiff_best_vert)){ // adiff_best == Double.NaN works too
adiff_best_vert = adiff_vert; adiff_best_vert = adiff_vert;
best_index_vert = ipass; best_index_vert = ipass;
} }
} else { } else {
if ((last && (strength_vert > 0.0)) || (strength_vert > strongest_weak_vert)){ if ((last && (strength_vert > 0.0)) || (!no_weak && (strength_vert > strongest_weak_vert))){
strongest_weak_vert = strength_vert; strongest_weak_vert = strength_vert;
best_weak_index_vert = ipass; best_weak_index_vert = ipass;
} }
...@@ -599,10 +604,118 @@ public class TileProcessor { ...@@ -599,10 +604,118 @@ public class TileProcessor {
} }
} }
} }
combo_pass.getDisparity(); // See if it does not break anything - triggers calculation if not done yet
combo_pass.fixNaNDisparity(); // mostly for debug, measured disparity should be already fixed from NaN combo_pass.fixNaNDisparity(); // mostly for debug, measured disparity should be already fixed from NaN
return combo_pass; return combo_pass;
} }
/**
* Create next measurement scan that can handle multiple disparities, using quad correlations only
* @param passes
* @param firstPass
* @param lastPassPlus1
* @param trustedCorrelation
* @param disp_far
* @param disp_near
* @param minStrength
* @param unique_tolerance
* @param usePoly
* @param debugLevel
* @return
*/
public CLTPass3d RefineQuadMulti(
final ArrayList <CLTPass3d> passes,
final int firstPass,
final int lastPassPlus1,
final double trustedCorrelation,
final double disp_far, // limit results to the disparity range
final double disp_near,
final double minStrength,
final double unique_tolerance,
// TODO: when useCombo - pay attention to borders (disregard)
final boolean usePoly, // use polynomial method to find max), valid if useCombo == false
final int debugLevel)
{
final int dbg_tile = (debugLevel > 0)? 839: -1; // x = 122, y= 108; -1; // 27669;
CLTPass3d combo_pass =new CLTPass3d(this);
final int tlen = tilesX * tilesY;
final int disparity_index = usePoly ? ImageDtt.DISPARITY_INDEX_POLY : ImageDtt.DISPARITY_INDEX_CM;
combo_pass.tile_op = new int [tilesY][tilesX];
combo_pass.disparity = new double [tilesY][tilesX];
// for (int i = 0; i< ImageDtt.QUAD; i++) combo_pass.disparity_map[ImageDtt.IMG_DIFF0_INDEX + i] = new double[tlen];
int op = ImageDtt.setImgMask(0, 0xf);
op = ImageDtt.setPairMask(op,0xf);
op = ImageDtt.setForcedDisparity(op,true);
int num_new = 0;
for (int ty = 0; ty < tilesY; ty ++) {
for (int tx = 0; tx < tilesX; tx ++){
int nt = ty * tilesX + tx;
if (nt == dbg_tile) {
System.out.println("RefineQuadMulti(): nt = "+nt);
}
for (int ipass = firstPass; ipass <lastPassPlus1; ipass++ ){
CLTPass3d pass = passes.get(ipass);
if (nt == dbg_tile) {
System.out.println("RefineQuadMulti(): ipass = "+ipass+" nt = "+nt+" pass.tile_op["+ty+"]["+tx+"]="+pass.tile_op[ty][tx]+
" pass.isCombo()="+(pass.isCombo())+" pass.isProcessed()="+(pass.isProcessed()));
}
if ( pass.isMeasured() && (pass.tile_op[ty][tx] != 0 )) { // current tile has valid data
// if ( (Double.isNaN(combo_pass.max_tried_disparity[ty][tx]) ||
// (pass.disparity[ty][tx] > combo_pass.max_tried_disparity[ty][tx]))){
// combo_pass.max_tried_disparity[ty][tx] = pass.disparity[ty][tx];
// }
double mdisp = pass.disparity_map[disparity_index][nt];
double strength = pass.disparity_map[ImageDtt.DISPARITY_STRENGTH_INDEX][nt];
double adiff = Math.abs(mdisp);
if ((strength >= minStrength) && (adiff <= trustedCorrelation)){
double disp = mdisp/corr_magic_scale + pass.disparity[ty][tx];
// double disp_low = (disp > pass.disparity[ty][tx]) ? pass.disparity[ty][tx] : (2 * disp - pass.disparity[ty][tx]);
// double disp_high = (disp > pass.disparity[ty][tx]) ? (2 * disp - pass.disparity[ty][tx]) : pass.disparity[ty][tx];
double disp_low = Math.min(disp, pass.disparity[ty][tx]);
double disp_high = Math.max(disp, pass.disparity[ty][tx]);
// if ((disp_high - disp_low) > 2 * unique_tolerance) { // suggested correction is not too small
if ((disp_high - disp_low) > unique_tolerance) { // suggested correction is not too small
boolean duplicate = false;
for (int iother = firstPass; iother <lastPassPlus1; iother++ ) {
CLTPass3d other = passes.get(iother);
if ( other.isMeasured() && (other.tile_op[ty][tx] != 0 )){ // && (iother != ipass)){
if ( (Math.abs(other.disparity[ty][tx] - disp) < unique_tolerance) ||
((other.disparity[ty][tx] - disp) * (other.disparity[ty][tx] - pass.disparity[ty][tx]) <0) // between
){
duplicate = true;
break;
}
}
}
if (!duplicate){
combo_pass.tile_op[ty][tx] = op;
combo_pass.disparity[ty][tx] = disp;
num_new++;
break; // for (int ipass = firstPass; ipass <lastPassPlus1; ipass++ ){
}
}
}
}
}
}
}
// combo_pass.getDisparity(); // See if it does not break anything - triggers calculation if not done yet
// combo_pass.fixNaNDisparity(); // mostly for debug, measured disparity should be already fixed from NaN
if (debugLevel > -1){
System.out.println("RefineQuadMulti(): prepared "+num_new+" tiles to be measured");
}
return (num_new > 0) ? combo_pass: null;
}
/** /**
* Verify that selected points are not all on the same line * Verify that selected points are not all on the same line
* @param sel 2-d sample selection in linescan order * @param sel 2-d sample selection in linescan order
...@@ -703,6 +816,7 @@ public class TileProcessor { ...@@ -703,6 +816,7 @@ public class TileProcessor {
// combo_pass.calc_disparity[nt] = pass.disparity_map[disparity_index][nt]/corr_magic_scale + pass.disparity[ty][tx]; // combo_pass.calc_disparity[nt] = pass.disparity_map[disparity_index][nt]/corr_magic_scale + pass.disparity[ty][tx];
public double [][] getFilteredDisparityStrength( public double [][] getFilteredDisparityStrength(
final ArrayList <CLTPass3d> passes,// List, first, last - to search for the already tried disparity
final int measured_scan_index, // will not look at higher scans (OK to be non-measured, last measured will be used then) final int measured_scan_index, // will not look at higher scans (OK to be non-measured, last measured will be used then)
final int start_scan_index, final int start_scan_index,
final boolean [] bg_tiles, // get from selected in clt_3d_passes.get(0); final boolean [] bg_tiles, // get from selected in clt_3d_passes.get(0);
...@@ -743,8 +857,8 @@ public class TileProcessor { ...@@ -743,8 +857,8 @@ public class TileProcessor {
final int dbg_tile = (debugLevel > 0) ?(dbg_x + dbg_y * tilesX) : -1; final int dbg_tile = (debugLevel > 0) ?(dbg_x + dbg_y * tilesX) : -1;
// Create a list of only measurement scans // Create a list of only measurement scans
final ArrayList<CLTPass3d> measured_list = new ArrayList<CLTPass3d> (); final ArrayList<CLTPass3d> measured_list = new ArrayList<CLTPass3d> ();
for (int ipass = start_scan_index; ipass <= measured_scan_index; ipass++){ for (int ipass = start_scan_index; (ipass < passes.size()) && (ipass <= measured_scan_index) ; ipass++){
CLTPass3d pass = clt_3d_passes.get(ipass); CLTPass3d pass = passes.get(ipass);
if ((pass != null) && pass.isMeasured()){ if ((pass != null) && pass.isMeasured()){
measured_list.add(pass); measured_list.add(pass);
} }
...@@ -3566,7 +3680,7 @@ public class TileProcessor { ...@@ -3566,7 +3680,7 @@ public class TileProcessor {
String [] titles = {"masked","map","orig_map","hor_map","vert_map","bg_sel","far", String [] titles = {"masked","map","orig_map","hor_map","vert_map","bg_sel","far",
"before_small","before_lone","before_gaps","these","near","block", "before_small","before_lone","before_gaps","these","near","block",
"strength","hor-strength","vert-strength", "strength","hor-strength","vert-strength",
"diff0","diff1","diff2","diff3", "enum_clusters", "disp_cm", "disp_poly", "disp_hor", "disp_vert", "poison"}; "diff0","diff1","diff2","diff3", "enum_clusters", "disp_cm", "disp_poly", "disp_hor", "disp_vert", "poison","platde_d","plate_s"};
double [][] dbg_img = new double[titles.length][tilesY * tilesX]; double [][] dbg_img = new double[titles.length][tilesY * tilesX];
for (int i = 0; i<dbg_img[0].length;i++){ for (int i = 0; i<dbg_img[0].length;i++){
dbg_img[ 0][i] = this_disparity_masked[i]; dbg_img[ 0][i] = this_disparity_masked[i];
...@@ -3605,6 +3719,10 @@ public class TileProcessor { ...@@ -3605,6 +3719,10 @@ public class TileProcessor {
dbg_img[22] = scan. disparity_map[ImageDtt.DISPARITY_INDEX_POLY]; dbg_img[22] = scan. disparity_map[ImageDtt.DISPARITY_INDEX_POLY];
dbg_img[23] = scan. disparity_map[ImageDtt.DISPARITY_INDEX_HOR]; dbg_img[23] = scan. disparity_map[ImageDtt.DISPARITY_INDEX_HOR];
dbg_img[24] = scan. disparity_map[ImageDtt.DISPARITY_INDEX_VERT]; dbg_img[24] = scan. disparity_map[ImageDtt.DISPARITY_INDEX_VERT];
if (plate_ds != null) {
dbg_img[26] = plate_ds[0];
dbg_img[26] = plate_ds[1];
}
sdfa_instance.showArrays(dbg_img, tilesX, tilesY, true, "FilterScan"+clt_3d_passes.size(),titles); sdfa_instance.showArrays(dbg_img, tilesX, tilesY, true, "FilterScan"+clt_3d_passes.size(),titles);
System.out.println("FilterScan"+clt_3d_passes.size()); System.out.println("FilterScan"+clt_3d_passes.size());
...@@ -4190,7 +4308,7 @@ public class TileProcessor { ...@@ -4190,7 +4308,7 @@ public class TileProcessor {
clt_parameters.stStepFar, // double step_near, clt_parameters.stStepFar, // double step_near,
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.stMaxDisparity, // 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)
...@@ -4207,7 +4325,7 @@ public class TileProcessor { ...@@ -4207,7 +4325,7 @@ public class TileProcessor {
clt_parameters.stStepFar, // double step_near, clt_parameters.stStepFar, // double step_near,
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.stMaxDisparity, // 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)
...@@ -4985,7 +5103,7 @@ public class TileProcessor { ...@@ -4985,7 +5103,7 @@ public class TileProcessor {
clt_parameters.stStepFar, // double step_near, clt_parameters.stStepFar, // double step_near,
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.stMaxDisparity, // 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)
...@@ -5001,7 +5119,7 @@ public class TileProcessor { ...@@ -5001,7 +5119,7 @@ public class TileProcessor {
clt_parameters.stStepFar, // double step_near, clt_parameters.stStepFar, // double step_near,
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.stMaxDisparity, // 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)
...@@ -5020,7 +5138,7 @@ public class TileProcessor { ...@@ -5020,7 +5138,7 @@ public class TileProcessor {
clt_parameters.stStepFar, // double step_near, clt_parameters.stStepFar, // double step_near,
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.stMaxDisparity, // 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)
...@@ -5049,7 +5167,7 @@ public class TileProcessor { ...@@ -5049,7 +5167,7 @@ public class TileProcessor {
clt_parameters.stStepFar, // double step_near, clt_parameters.stStepFar, // double step_near,
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.stMaxDisparity, // 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)
...@@ -5976,7 +6094,7 @@ public class TileProcessor { ...@@ -5976,7 +6094,7 @@ public class TileProcessor {
clt_parameters.stStepFar, // double step_near, clt_parameters.stStepFar, // double step_near,
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.stMaxDisparity, // 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)
...@@ -5993,7 +6111,7 @@ public class TileProcessor { ...@@ -5993,7 +6111,7 @@ public class TileProcessor {
clt_parameters.stStepFar, // double step_near, clt_parameters.stStepFar, // double step_near,
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.stMaxDisparity, // 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)
......
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