disparity_index,// index of disparity value in disparity_map == 2 (0,2 or 4)
clt_parameters.show_bgnd_nonbgnd,
(clt_parameters.debug_filters?(debugLevel):-1));
boolean[]bgnd_tiles_new=tp.getBackgroundMask_new(// which tiles do belong to the background
clt_parameters.bgnd_range,// disparity range to be considered background
clt_parameters.bgnd_sure,// minimal strength to be considered definitely background
clt_parameters.bgnd_maybe,// maximal strength to ignore as non-background
clt_parameters.sure_smth,// if 2-nd worst image difference (noise-normalized) exceeds this - do not propagate bgnd
clt_parameters.min_clstr_seed,// number of tiles in a cluster to seed (just background?)
clt_parameters.min_clstr_block,// number of tiles in a cluster to block (just non-background?)
disparity_index,// index of disparity value in disparity_map == 2 (0,2 or 4)
clt_parameters.show_bgnd_nonbgnd,
(clt_parameters.debug_filters?(debugLevel):-1));
boolean[]bgnd_dbg=bgnd_tiles.clone();// only these have non 0 alpha
// TODO: fix mess - after modifying getBackgroundMask() to getBackgroundMask_new (before road with tractor was identified as a background because of a double
// tile glitch, the background was wrong. So temporarily both old/new are used and combined (new is grown twice)
// still does not work - using old variant for now
// background selections (slightly) influences the plane mertging / connections
for(inti=0;i<bgnd_tiles.length;i++){
// bgnd_tiles[i] &= bgnd_tiles_new[i];
}
boolean[]bgnd_strict=bgnd_tiles.clone();// only these have non 0 alpha
tp.growTiles(
clt_parameters.bgnd_grow,// grow tile selection by 1 over non-background tiles 1: 4 directions, 2 - 8 directions, 3 - 8 by 1, 4 by 1 more
...
...
@@ -5538,25 +5563,50 @@ public class QuadCLT {
bgnd_tiles,
null);// prohibit
bgnd_data.selected=bgnd_tiles_grown;// selected for background w/o extra transparent layer
// hacking - grow bgnd texture even more, without changing selection
boolean[]bgnd_tiles_grown2=bgnd_tiles_grown.clone();// only these have non 0 alpha
bgnd_data.selected=bgnd_tiles_grown;// selected for background w/o extra transparent layer
tp.growTiles(
2,// grow tile selection by 1 over non-background tiles 1: 4 directions, 2 - 8 directions, 3 - 8 by 1, 4 by 1 more
st.planes,// final TilePlanes.PlaneData[][] planes,
merge_groups,// final int [][][] merge_groups,
// parameters to generate ellipsoids
0.0,// 3, // final double disp_far, // minimal disparity to select (or NaN)
Double.NaN,// final double disp_near, // maximal disparity to select (or NaN)
clt_parameters.plDispNorm,// final double dispNorm, // Normalize disparities to the average if above
0.0,// final double min_weight,
clt_parameters.plMinPoints,// final int min_tiles,
// parameters to reduce outliers
clt_parameters.plTargetEigen,// final double targetEigen, // = 0.1; // Remove outliers until main axis eigenvalue (possibly scaled by plDispNorm) gets below
clt_parameters.plFractOutliers,// final double fractOutliers, // = 0.3; // Maximal fraction of outliers to remove
clt_parameters.plMaxOutliers,// final int maxOutliers, // = 20; // Maximal number of outliers to remove
debugLevel,// final int debugLevel)
clt_parameters.tileX,
clt_parameters.tileY);
System.out.println("Try "+num_merge_try+": removed "+num_removed_by_merging+" planes by merging, recalculating connections");
if(num_removed_by_merging==0){// re-calculate all links
clt_parameters.stMeasSel);// int stMeasSel) // = 1; // Select measurements for supertiles : +1 - combo, +2 - quad +4 - hor +8 - vert)
boolean[][]tileSel=st.getMeasurementSelections(
clt_parameters.stMeasSel);// int stMeasSel) // = 1; // Select measurements for supertiles : +1 - combo, +2 - quad +4 - hor +8 - vert)
TilePlanes.PlaneData[][][]split_planes=// use original (measured planes. See if smoothed are needed here)
st.breakPlanesToPairs(
st.getPlanes(),// Mod(), // final TilePlanes.PlaneData[][] center_planes, // measured_planes,
st.getPlanes(),// Mod(), // final TilePlanes.PlaneData[][] neib_planes, //mod_planes,
clt_parameters.plSplitPull,// final double center_pull,
clt_parameters.plSplitMinNeib,// min_neibs, // 2
clt_parameters.plSplitMinWeight,// final double splitMinWeight, // = 2.0; // Minimal weight of split plains to show
clt_parameters.plSplitMinQuality,// final double splitMinQuality, // = 1.1; // Minimal split quality to show
clt_parameters.plPreferDisparity,
debugLevel,
clt_parameters.tileX,
clt_parameters.tileY);
if(clt_parameters.plSplitApply){
intnumSplitPlanes=st.replaceBrokenPlanes(
st.getPlanes(),// final TilePlanes.PlaneData[][] planes,
split_planes,// final TilePlanes.PlaneData[][][] brokenPd,
clt_parameters.plMaxDiff,// final double max_diff, // maximal disparity difference (0 - any), will be normalized by dispNorm
clt_parameters.plOtherDiff,// final double other_diff, // other_diff maximal difference of the added tile ratio to the average disparity difference
clt_parameters.plNonExclusive,// final boolean non_exclusive,
clt_parameters.plUseOtherPlanes,// final boolean use_other_planes, // TODO:
clt_parameters.stMeasSel,// final int measSel, // Select measurements for supertiles : +1 - combo, +2 - quad +4 - hor +8 - vert
clt_parameters.plAllowParallel,// final boolean allow_parallel,
clt_parameters.plSplitXY,// final boolean splitXY,
clt_parameters.plSplitXYTolerance,// final double splitXYTolerance,
// parameters to generate ellipsoids
0.0,// 3, // final double disp_far, // minimal disparity to select (or NaN)
Double.NaN,// final double disp_near, // maximal disparity to select (or NaN)
clt_parameters.plDispNorm,// final double dispNorm, // Normalize disparities to the average if above
0.0,// final double min_weight,
clt_parameters.plMinPoints,// final int min_tiles,
// parameters to reduce outliers
clt_parameters.plTargetEigen,// final double targetEigen, // = 0.1; // Remove outliers until main axis eigenvalue (possibly scaled by plDispNorm) gets below
clt_parameters.plFractOutliers,// final double fractOutliers, // = 0.3; // Maximal fraction of outliers to remove
clt_parameters.plMaxOutliers,// final int maxOutliers, // = 20; // Maximal number of outliers to remove
clt_parameters.stFloor,// final double strength_floor,
clt_parameters.stPow,// final double strength_pow,
debugLevel+1,// 2, // -1, // debugLevel, // final int debugLevel)
clt_parameters.tileX,
clt_parameters.tileY);
intnum_removed_by_merging=st.applyMergePlanes(
st.planes,// final TilePlanes.PlaneData[][] planes,
merge_groups,// final int [][][] merge_groups,
// parameters to generate ellipsoids
0.0,// 3, // final double disp_far, // minimal disparity to select (or NaN)
Double.NaN,// final double disp_near, // maximal disparity to select (or NaN)
clt_parameters.plDispNorm,// final double dispNorm, // Normalize disparities to the average if above
0.0,// final double min_weight,
clt_parameters.plMinPoints,// final int min_tiles,
// parameters to reduce outliers
clt_parameters.plTargetEigen,// final double targetEigen, // = 0.1; // Remove outliers until main axis eigenvalue (possibly scaled by plDispNorm) gets below
clt_parameters.plFractOutliers,// final double fractOutliers, // = 0.3; // Maximal fraction of outliers to remove
clt_parameters.plMaxOutliers,// final int maxOutliers, // = 20; // Maximal number of outliers to remove
debugLevel,// 2, // -1, // debugLevel, // final int debugLevel)
clt_parameters.tileX,
clt_parameters.tileY);
System.out.println("Try "+num_merge_try+": removed "+num_removed_by_merging+" planes by merging, recalculating connections");
if(num_removed_by_merging==0){// re-calculate all links
// Consider supertiles with conflicts, merge conflicting layers with relaxed requirements
//TODO: Fix the mess to get rid of the plane_nooverlaps
Conflictsconflicts0_stats=newConflicts(
conflicts0,
st,
-1);// debugLevel);
System.out.println("Trying relaxed merging for conflicting plane pairs");
plane_nooverlaps=lp.overlapSameTileCandidates(
st.planes_mod,// final TilePlanes.PlaneData [][] planes,
conflicting_candidates,// final int [][][] merge_candidates,\
0.4,// final double min_distance,
debugLevel,// 2, // -1, // debugLevel, // final int debugLevel)
clt_parameters.tileX,
clt_parameters.tileY);
// remove merge candidates that break connections to neighbors
if(debugLevel>100)lp.keepSameTileConnections(
st.planes_mod,// final TilePlanes.PlaneData [][] planes,
conflicting_candidates,// final int [][][] merge_candidates,
plane_nooverlaps,// final boolean [][][] valid_candidates, // will be updated
true,// final boolean merge_low_eigen, here it should be true
true,// final boolean useNonExcl, // consider only directions available for non-exclusive merges
debugLevel,// 2, // -1, // debugLevel, // final int debugLevel)
clt_parameters.tileX,
clt_parameters.tileY);
// Consider supertiles with conflicts, merge conflicting layers with relaxed requirements
//end of TODO: Fix the mess to get rid of the plane_nooverlaps
// try to merge original (measured) planes, not smoothed ones
lp.costSameTileConnections(
// st.planes_mod, // final TilePlanes.PlaneData [][] planes,
st.planes,// final TilePlanes.PlaneData [][] planes,
conflicting_candidates,// final int [][][] merge_candidates,
plane_nooverlaps,// final boolean [][][] valid_candidates, // will be updated
lp.getConflRelax(),//relax_for_conflicts, // final double relax,
debugLevel,// 2, // -1, // debugLevel, // final int debugLevel)
lp.getConflRelax(),// relax_for_conflicts, // final double relax,
debugLevel+1,// 2, // -1, // debugLevel, // final int debugLevel)
TilePlanes.PlaneData[][][]split_planes=// use original (measured planes. See if smoothed are needed here)
st.breakPlanesToPairs(
st.getPlanes(),// Mod(), // final TilePlanes.PlaneData[][] center_planes, // measured_planes,
st.getPlanes(),// Mod(), // final TilePlanes.PlaneData[][] neib_planes, //mod_planes,
clt_parameters.plSplitPull,// final double center_pull,
clt_parameters.plSplitMinNeib,// min_neibs, // 2
clt_parameters.plSplitMinWeight,// final double splitMinWeight, // = 2.0; // Minimal weight of split plains to show
clt_parameters.plSplitMinQuality,// final double splitMinQuality, // = 1.1; // Minimal split quality to show
clt_parameters.plPreferDisparity,
debugLevel,
clt_parameters.tileX,
clt_parameters.tileY);
num_removed_by_merging=st.applyMergePlanes(
st.planes,// final TilePlanes.PlaneData[][] planes,
merge_groups,// final int [][][] merge_groups,
if(clt_parameters.plSplitApply){
intnumSplitPlanes=st.replaceBrokenPlanes(
st.getPlanes(),// final TilePlanes.PlaneData[][] planes,
split_planes,// final TilePlanes.PlaneData[][][] brokenPd,
clt_parameters.plMaxDiff,// final double max_diff, // maximal disparity difference (0 - any), will be normalized by dispNorm
clt_parameters.plOtherDiff,// final double other_diff, // other_diff maximal difference of the added tile ratio to the average disparity difference
clt_parameters.plNonExclusive,// final boolean non_exclusive,
clt_parameters.plUseOtherPlanes,// final boolean use_other_planes, // TODO:
clt_parameters.stMeasSel,// final int measSel, // Select measurements for supertiles : +1 - combo, +2 - quad +4 - hor +8 - vert
clt_parameters.plAllowParallel,// final boolean allow_parallel,
clt_parameters.plSplitXY,// final boolean splitXY,
clt_parameters.plSplitXYTolerance,// final double splitXYTolerance,
// parameters to generate ellipsoids
0.0,// 3, // final double disp_far, // minimal disparity to select (or NaN)
Double.NaN,// final double disp_near, // maximal disparity to select (or NaN)
...
...
@@ -4132,29 +3698,29 @@ public class TileProcessor {
clt_parameters.plTargetEigen,// final double targetEigen, // = 0.1; // Remove outliers until main axis eigenvalue (possibly scaled by plDispNorm) gets below
clt_parameters.plFractOutliers,// final double fractOutliers, // = 0.3; // Maximal fraction of outliers to remove
clt_parameters.plMaxOutliers,// final int maxOutliers, // = 20; // Maximal number of outliers to remove
debugLevel,// 2, // -1, // debugLevel, // final int debugLevel)
clt_parameters.stFloor,// final double strength_floor,
clt_parameters.stPow,// final double strength_pow,