// proceed only if CM correlation result is non-null // for compatibility with old code we need it to run regardless of the strength of the normal correlation
if(corr_stat[cTile]!=null){
disparity[cTile]=-corr_stat[cTile][0];
disparity_map[DISPARITY_INDEX_CM][tIndex]=disparity[cTile];// disparity is negative X
corr_wnd,// double [][] corr_wnd, // correlation window to save on re-calculation of the window
corr_wnd_inv_limited, // corr_wnd_inv_limited, // correlation window, limited not to be smaller than threshold - used for finding max/convex areas (or null)
corr_wnd_inv_limited,// corr_wnd_limited, // correlation window, limited not to be smaller than threshold - used for finding max/convex areas (or null)
corrs[cTile],// double [][] corrs,
disp_dist[cTile],
rXY,// double [][] rXY, // non-distorted X,Y offset per nominal pixel of disparity
imgdtt_params.dbg_pair_mask,// int pair_mask, // which pairs to process
false, // boolean run_poly_instead, // true - run LMA, false - run 2d polynomial approximation
corr_stat[cTile][0], // double xcenter, // preliminary center x in pixels for largest baseline
// false, // boolean run_poly_instead, // true - run LMA, false - run 2d polynomial approximation
disp_str[cTile],//corr_stat[0], // double xcenter, // preliminary center x in pixels for largest baseline
imgdtt_params.ortho_vasw_pwr,// double vasw_pwr, // value as weight to this power,
tile_lma_debug_level+2, // int debug_level,
tile_lma_debug_level,//+2, // int debug_level,
tileX,// int tileX, // just for debug output
tileY ); // int tileY
*/
tileY);// int tileY
disp_str[cTile]=null;
if(lma2!=null){
disp_str[cTile]=lma2.disparityStrength(
imgdtt_params.lma_max_rel_rms,// maximal relative (to average max/min amplitude LMA RMS) // May be up to 0.3)
imgdtt_params.lma_min_strength,// minimal composite strength (sqrt(average amp squared over absolute RMS)
imgdtt_params.lma_min_ac,// minimal of A and C coefficients maximum (measures sharpest point/line)
imgdtt_params.lma_str_scale,// convert lma-generated strength to match previous ones - scale
imgdtt_params.lma_str_offset// convert lma-generated strength to match previous ones - add to result
)[0];
if(tile_lma_debug_level>0){
double[][]ds_dbg={disp_str[cTile]};
lma2.printStats(ds_dbg,1);
}
}
}
...
...
@@ -2106,7 +2119,9 @@ public class ImageDtt {
}
}
if(debugCluster){
if(globalDebugLevel>0){
System.out.println("Will run new LMA for clustX="+clustX+", clustY="+clustY);
System.out.println("BUG: 1. disparity_map[DISPARITY_STRENGTH_INDEX]["+tIndex+"] should not be NaN");
}
...
...
@@ -2998,8 +3004,8 @@ public class ImageDtt {
// proceed only if CM correlation result is non-null // for compatibility with old code we need it to run regardless of the strength of the normal correlation
if(corr_stat!=null){
// skipping DISPARITY_VARIATIONS_INDEX - it was not used
disparity=-corr_stat[0];
disparity_map[DISPARITY_INDEX_CM][tIndex]=disparity;// disparity is negative X
disp_str[0]=-corr_stat[0];
disparity_map[DISPARITY_INDEX_CM][tIndex]=disp_str[0];// disparity is negative X
if(tile_lma_debug_level>0){
System.out.println("Will run getMaxXSOrtho( ) for tileX="+tileX+", tileY="+tileY);
}
...
...
@@ -3008,6 +3014,7 @@ public class ImageDtt {
if(debugTile){
System.out.println("Will run new LMA for tileX="+tileX+", tileY="+tileY);
@@ -174,10 +190,14 @@ public class ImageDttParameters {
gd.addNumericField("Use data as weights when fitting parabola for ortho mode",this.ortho_vasw_pwr,3,6,"",
"Raise value to this power and apply as weight. Reduce width to 3 samples if false, 5 OK when true");
gd.addNumericField("Reduce weight of center correlation pixels from center (0 - none, 1 - center, 2 +/-1 from center) - main camera",this.enhortho_width,0);
gd.addNumericField("Reduce weight of center correlation pixels from center (0 - none, 1 - center, 2 +/-1 from center) - aux camera",this.enhortho_width_aux,0);
gd.addNumericField("Multiply center correlation pixels (inside enhortho_width) (1.0 - disables enh_ortho) - main camera",this.enhortho_scale,3);
gd.addNumericField("Multiply center correlation pixels (inside enhortho_width) (1.0 - disables enh_ortho) - aux camera",this.enhortho_scale_aux,3);
gd.addNumericField("Reduce weight of center correlation pixels from center for the main camera",this.enhortho_width,0,3,"pix",
"Reduce weight of center correlation pixels from center (0 - none, 1 - center, 2 +/-1 from center)");
gd.addNumericField("Reduce weight of center correlation pixels from center for the aux camera",this.enhortho_width_aux,0,3,"pix",
"Reduce weight of center correlation pixels from center (0 - none, 1 - center, 2 +/-1 from center)");
gd.addNumericField("Multiply center correlation pixels for the main camera",this.enhortho_scale,0,3,"pix",
"Multiply center correlation pixels (inside enhortho_width) (1.0 - disables enh_ortho) - main camera");
gd.addNumericField("Multiply center correlation pixels for the aux camera",this.enhortho_scale_aux,0,3,"pix",
"Multiply center correlation pixels (inside enhortho_width) (1.0 - disables enh_ortho) - aux camera");
gd.addCheckbox("Use polynomial when measuring mismatch (false - use center of mass)",this.ly_poly);
gd.addNumericField("Maximal allowed mismatch difference calculated as polynomial maximum",this.ly_crazy_poly,3,6,"px",
...
...
@@ -272,22 +292,28 @@ public class ImageDttParameters {
gd.addTab("Corr LMA","Parameters for LMA fitting of the correlation maximum parameters");
gd.addCheckbox("Correlation maximum as gaussian",this.lma_gaussian,
"Model correlation maximum as a Gaussian exp(-r^2) (false - as a parabola - 1-r^2)");
gd.addCheckbox("Re-run LMA after removing weak/failed tiles",this.lma_second,
"Re-run LMA with filtered tiles (see Correlation strength calculation section below)");
gd.addCheckbox("Gaussian mode during LMA re-run",this.lma_second_gaussian,
"Parabola is more stable when using with un-filtered tiles, so it makes sense to use Gaussina only on filtered tiles");
gd.addCheckbox("Fit correlation defined half-width",this.lma_adjust_wm,
"Allow fitting of the half-width common for all pairs, defined by the LPF filter of the phase correlation");
gd.addCheckbox("Adjust ellipse parameters (was Fit extra vertical half-width)",this.lma_adjust_wy,
"Adjust ellipse (non-circular) of the correlation maximum (was Fit extra perpendicular to disparity half-width (not used? and only possible with multi-baseline cameras))");
gd.addCheckbox("Adjust \"lazy eye\" parameters parallel to disparity (was Fit extra half-width along disparity)",this.lma_adjust_wxy,
"Increased width in disparity direction caused by multi-distance objects in the tile");
gd.addCheckbox("Adjust \"lazy eye\" parameters parallel to disparity",this.lma_adjust_wxy,
"(was Fit extra half-width along disparity) Increased width in disparity direction caused by multi-distance objects in the tile");
gd.addCheckbox("Adjust \"lazy eye\" parameters orthogonal CW to disparity",this.lma_adjust_ly1,
"Increased width in disparity direction caused by multi-distance objects in the tile");
"If false, no debug images generated regardless of debug levels");
gd.addCheckbox("Use new correlation methods compatible with x8 camera",this.corr_var_cam,
"Debug feature to compare old/new methods");
gd.addNumericField("Normalization for the CM correlation strength",this.cm_max_normalization,6,8,"",
gd.addNumericField("Normalization for the CM correlation strength (old)",this.cm_max_normalization,6,8,"",
"Fraction of correlation maximum radius, being squared multiplied by maximum to have the same total mass. ~= 0.5, the lower the value, the higher strength reported by the CM");
gd.addMessage("Cameras offsets in the disparity direction and orthogonal to disparity (debugging LMA)");