* 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];
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;
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