* Select low-textured tiles for averaging measurements
* @param min_disparity minimal disparity to accept
* @param max_density maximal trusted tile density (density varies from 0.0 to 1.0)
* @param grow grow selection. When combined with shrink, fills small gaps. Both grow and shrink step
* advances either horizontally or vertically (alternating), so to expand by 1 pixel in all directions
* the value should be set to 2,
* @param shrink shrink selection after expanding to fill small gaps
* @param grow how many layers of tiles should be added after filling gaps and removing small clusters
* @param max_gap_radius maximal radius of a void to be filled
* @param min_clust_radius minimal original cluster radius to survive
* @param density per-tile values of the density of trusted tiles around it.
* @param src_disparity - source disparity array
* @param src_disparity - source disparity array. If null will only use density (that should be > 0)
* @return selection of the low-textured tiles to be processed with averaging correlation (3x3 or 5x5 tiles)
*/
publicboolean[]selectLowTextures(
doublemin_disparity,
doublemax_density,
intgrow,
intshrink,
intmax_gap_radius,
intmin_clust_radius,
double[]density,
double[]src_disparity)
{
boolean[]selection=newboolean[density.length];
if(src_disparity==null){
for(intnTile=0;nTile<selection.length;nTile++){
if((density[nTile]<=max_density)&&(density[nTile]<=max_density)){// disparity has NaN-s, they will fail comparisons
selection[nTile]=true;
}
}
}else{
for(intnTile=0;nTile<selection.length;nTile++){
if((src_disparity[nTile]>=min_disparity)&&(density[nTile]<=max_density)){// disparity has NaN-s, they will fail comparisons
selection[nTile]=true;
}
}
}
finalTileNeibstnImage=biCamDSI.tnImage;
tnImage.growSelection(
grow,// int grow, // grow tile selection by 1 over non-background tiles 1: 4 directions, 2 - 8 directions, 3 - 8 by 1, 4 by 1 more
2*max_gap_radius,// int grow, // grow tile selection by 1 over non-background tiles 1: 4 directions, 2 - 8 directions, 3 - 8 by 1, 4 by 1 more
selection,// boolean [] tiles,
null);// boolean [] prohibit)
tnImage.shrinkSelection(
2*(max_gap_radius+min_clust_radius),// int grow, // grow tile selection by 1 over non-background tiles 1: 4 directions, 2 - 8 directions, 3 - 8 by 1, 4 by 1 more
selection,// boolean [] tiles,
null);// boolean [] prohibit)
tnImage.growSelection(
2*(min_clust_radius+grow),// int grow, // grow tile selection by 1 over non-background tiles 1: 4 directions, 2 - 8 directions, 3 - 8 by 1, 4 by 1 more
booleansmooth_strength=clt_parameters.rig.ltavg_smooth_strength;// provide tile strength when smoothing target disparity
doubleneib_pull=clt_parameters.rig.ltavg_neib_pull;// pull to weighted average relative to pull to the original disparity value. If 0.0 - will only update former NaN-s
lt_radius,// final int lt_radius, // low texture mode - inter-correlation is averaged between the neighbors before argmax-ing, using (2*notch_mode+1)^2 square
biScan,// final BiScan biScan,
min_disparity,// final double min_disparity, // keep original disparity far tiles
trusted_strength,// final double trusted_strength, // trusted correlation strength
strength_rfloor,// final double strength_rfloor, // strength floor - relative to trusted
strength_pow,//final double strength_pow, // raise strength-floor to this power
ref_smpl_radius,// final int smpl_radius,
smpl_fract,// final double smpl_fract, // Number of friends among all neighbors
ref_smpl_num,// final int ref_smpl_num, // = 3; // Number after removing worst (should be >1)
ref_max_adiff,// final double max_adiff, // Maximal absolute difference betweenthe center tile and friends
ref_max_rdiff,// final double max_rdiff, // Maximal relative difference between the center tile and friends
max_atilt,// final double max_atilt, // = 2.0; // pix per tile
max_rtilt,// final double max_rtilt, // = 0.2; // (pix / disparity) per tile
ref_smpl_arms,// final double smpl_arms, // = 0.1; // Maximal RMS of the remaining tiles in a sample
ref_smpl_rrms,// final double smpl_rrms, // = 0.005; // Maximal RMS/disparity in addition to smplRms
damp_tilt,// final double damp_tilt, // = 0.001; // Tilt cost for damping insufficient plane data
rwsigma,// final double rwsigma, // = 0.7; // influence of far neighbors diminish as a Gaussian with this sigma
goal_fraction_rms,//final double goal_fraction_rms, // Try to make rms to be this fraction of maximal acceptable by removing outliers
max_iter,// final int max_iterations,
min_change,// final double min_change,
clt_parameters.tileX,// final int dbg_x,
clt_parameters.tileY,// final int dbg_y,
threadsMax,// final int threadsMax, // maximal number of threads to launch
ds3[0], // disparity_bimap[ImageDtt.BI_TARGET_INDEX], // ds1[0], // final double [] src_disparity,
null, // lt_strength, // final double [] src_strength, // if not null will be used for weighted pull
lt_select, // final boolean [] selection,
neib_pull,// final double neib_pull, // pull to weighted average relative to pull to the original disparity value. If 0.0 - will only update former NaN-s
0.0, // only gaps neib_pull, // final double neib_pull, // pull to weighted average relative to pull to the original disparity value. If 0.0 - will only update former NaN-s
area_of_interest,// final boolean [] area_of_interest,
ds_ref,// final double [][] disparityStrength,
min_disparity,// final double min_disparity, // keep original disparity far tiles
trusted_strength,// final double trusted_strength, // trusted correlation strength
0.5*strength_rfloor,// final double strength_rfloor, // strength floor - relative to trusted
true,// final boolean discard_unreliable,// replace v
true,// final boolean discard_weak, // consider weak trusted tiles (not promoted to trusted) as empty
true,// final boolean discard_strong, // suggest new disparities even for strong tiles
strength_pow,// final double strength_pow, // raise strength-floor to this power
null,// final double [] smpl_radius_array, // space-variant radius
smpl_radius,// final int smpl_radius,
0,// final int smpl_num, // = 3; // Number after removing worst (should be >1)
smpl_fract,// final double smpl_fract, // Number of friends among all neighbors
ref_smpl_num,// final int smpl_num_narrow, // = 3; // Number after removing worst (should be >1)
max_adiff,// final double max_adiff, // Maximal absolute difference between the center tile and friends
max_rdiff,// final double max_rdiff, // Maximal relative difference between the center tile and friends
max_atilt,// final double max_atilt, // = 2.0; // pix per tile
max_rtilt,// final double max_rtilt, // = 0.2; // (pix / disparity) per tile
smpl_arms,// final double smpl_arms, // = 0.1; // Maximal RMS of the remaining tiles in a sample
smpl_rrms,// final double smpl_rrms, // = 0.005; // Maximal RMS/disparity in addition to smplRms
damp_tilt,// final double damp_tilt, // = 0.001; // Tilt cost for damping insufficient plane data
0.0,// final double rwsigma, // = 0.7; // influence of far neighbors diminish as a Gaussian with this sigma
rwsigma,// final double rwsigma_narrow, // = used to determine initial tilt
1.0,// final double center_weight, // use center tile too (0.0 - do not use)
false,// final boolean use_alt, // use tiles from other scans if they fit better
goal_fraction_rms,// final double goal_fraction_rms, // Try to make rms to be this fraction of maximal acceptable by removing outliers
0.8,// boost_low_density, //final double boost_low_density, // 0 - strength is proportional to 1/density, 1.0 - same as remaining tiles
0,// final int fourq_min, // each of the 4 corners should have at least this number of tiles.
0,// final int fourq_gap, // symmetrical vertical and horizontal center areas that do not belong to any corner
clt_parameters.tileX,// final int dbg_x,
clt_parameters.tileY,// final int dbg_y,
debugLevel+2);// final int debugLevel
// fill NaN gaps:
double[][]ds_no_gaps=biScan.fillAndSmooth(
ds_planes[0],// disparity_bimap[ImageDtt.BI_TARGET_INDEX], // ds1[0], // final double [] src_disparity,
null,// lt_strength, // final double [] src_strength, // if not null will be used for weighted pull
area_of_interest,// final boolean [] selection,
0.0,// only gaps neib_pull, // final double neib_pull, // pull to weighted average relative to pull to the original disparity value. If 0.0 - will only update former NaN-s
quadCLT_main,// QuadCLT quadCLT_main, // tiles should be set
quadCLT_aux,// QuadCLT quadCLT_aux,
tile_op,// int [][] tile_op, // common for both amin and aux
disparity_array,// double [][] disparity_array,
null,// double [][] ml_data, // data for ML - 10 layers - 4 center areas (3x3, 5x5,..) per camera-per direction, 1 - composite, and 1 with just 1 data (target disparity)