stMeasSel, // final int stMeasSel, // = 1; // Select measurements for supertiles : +1 - combo, +2 - quad +4 - hor +8 - vert
smplMode, // final boolean smplMode, // = true; // Use sample mode (false - regular tile mode)
smplSide, // final int smplSide, // = 2; // Sample size (side of a square)
smplNum, // final int smplNum, // = 3; // Number after removing worst
smplRms, // final double smplRms, // = 0.1; // Maximal RMS of the remaining tiles in a sample
plDiscrTolerance, // final double max_disp_diff, // maximal disparity difference from the plane to consider tile
plDiscrDispRange, // final double disp_range, // parallel move known planes around original know value for the best overall fit
plDiscrSteps, // final int amplitude_steps, // number of steps (each direction) for each plane to search for the best fit (0 - single, 1 - 1 each side)
plDiscrVariants, // final int num_variants, // total number of variants to try (protect from too many planes)
plDiscrMode, // final int mode, // 0 - weighted, 1 - equalized, 2 - best, 3 - combined
stMeasSel,// final int stMeasSel, // = 1; // Select measurements for supertiles : +1 - combo, +2 - quad +4 - hor +8 - vert
plDispNorm,// final double dispNorm, // Normalize disparities to the average if above
smplMode,// final boolean smplMode, // = true; // Use sample mode (false - regular tile mode)
smplSide,// final int smplSide, // = 2; // Sample size (side of a square)
smplNum,// final int smplNum, // = 3; // Number after removing worst
smplRms,// final double smplRms, // = 0.1; // Maximal RMS of the remaining tiles in a sample
plDiscrTolerance,// final double disp_tolerance, // maximal disparity difference from the plane to consider tile
plDiscrVarFloor,// final double disp_var_floor, // squared add to variance to calculate reverse flatness (used mostly for single-cell clusters)
plDiscrSigma,// final double disp_sigma, // G.sigma to compare how measured data is attracted to planes
plDiscrDispRange,// final double disp_range, // parallel move known planes around original know value for the best overall fit
plDiscrSteps,// final int amplitude_steps, // number of steps (each direction) for each plane to search for the best fit (0 - single, 1 - 1 each side)
plDiscrBlur,// final double hist_blur, // Sigma to blur histogram
plDiscrExclusivity,// final double exclusivity, // 1.0 - tile belongs to one plane only, 0.0 - regardless of others
plDiscrExclus2,// final double excluisivity2, // = 0.8; // For second pass if exclusivity > 1.0 - will assign only around strong neighbors
plDiscrStrict,// final boolean exclusivity_strict// = true; // When growing selection do not allow any offenders around (false - more these than others)
plDiscrMode,// final int mode, // 0 - weighted, 1 - equalized, 2 - best, 3 - combined
stMeasSel,// final int stMeasSel, // = 1; // Select measurements for supertiles : +1 - combo, +2 - quad +4 - hor +8 - vert
plDispNorm,// final double plDispNorm,
plPreferDisparity,// final boolean plPreferDisparity, // Always start with disparity-most axis (false - lowest eigenvalue)
geometryCorrection,// final GeometryCorrection geometryCorrection,
correct_distortions,// final boolean correct_distortions,
smplMode,// final boolean smplMode, // = true; // Use sample mode (false - regular tile mode)
smplSide,// final int smplSide, // = 2; // Sample size (side of a square)
smplNum,// final int smplNum, // = 3; // Number after removing worst
smplRms,// final double smplRms, // = 0.1; // Maximal RMS of the remaining tiles in a sample
plDiscrTolerance,//final double plDiscrTolerance, // = 0.4; // Maximal disparity difference from the plane to consider tile
plDiscrDispRange,// final double plDiscrDispRange, // = 0.6; // Parallel move known planes around original know value for the best overall fit
plDiscrSteps,// final int plDiscrSteps, // = 3; // Number of steps (each direction) for each plane to search for the best fit (0 - single, 1 - 1 each side)
plDiscrVariants,// final int plDiscrVariants, // = 100; // Total number of variants to try (protect from too many planes)
plDiscrMode,// final int plDiscrMode, // = 3; // What plane to use as a hint: 0 - weighted, 1 - equalized, 2 - best, 3 - combined
plDiscrVarFloor,// final double plDiscrVarFloor, // = 0.03; // Squared add to variance to calculate reverse flatness (used mostly for single-cell clusters)
plDiscrSigma,// final double plDiscrSigma, // = 0.05; // Gaussian sigma to compare how measured data is attracted to planes
plDiscrBlur,// final double plDiscrBlur, // = 0.1; // Sigma to blur histograms while re-discriminating
plDiscrExclusivity,// final double plDiscrExclusivity, // = 0.5; // Tile exclusivity: 1.0 - tile belongs to one plane only, 0.0 - regardless of others
plDiscrExclus2,// final double plDiscrExclus2, // = 0.5; // For second pass if exclusivity > 1.0 - will assign only around strong neighbors
plDiscrStrict,// final boolean plDiscrStrict, // = true; // When growing selection do not allow any offenders around (false - more these than others)
2,// debugLevel, // final int debugLevel,
dbg_X,// final int dbg_X,
dbg_Y);// final int dbg_Y)
// get per-tile disparity strength again (may consider using non-filtered data here) ?
double[][][][]disp_strength=getPlaneDispStrengths(// here use actual disparity, not tilted
null,// final double [] world_plane_norm, // real world normal vector to a suggested plane family (0,1,0) for horizontal planes
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
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
// separate each supertile data into clusters, trying both horizontal and perpendicular to view planes
double[]world_hor={0.0,1.0,0.0};
st.processPlanes5(
clt_parameters.stGrowSel,// = 2; // = -1; //Grow initial selection before processing supertiles, odd - ortho. <0 - use all tiles
clt_parameters.stMeasSel,// = 1 //Select measurements for supertiles : +1 - combo, +2 - quad +4 - hor +8 - vert
clt_parameters.plDispNorm,// = 2.0; // Normalize disparities to the average if above
clt_parameters.plMinPoints,// = 5; // Minimal number of points for plane detection
clt_parameters.plTargetEigen,// = 0.1; // Remove outliers until main axis eigenvalue (possibly scaled by plDispNorm) gets below
clt_parameters.plFractOutliers,// = 0.3; // Maximal fraction of outliers to remove
clt_parameters.plMaxOutliers,// = 20; // Maximal number of outliers to remove\
clt_parameters.plPreferDisparity,
geometryCorrection,
clt_parameters.correct_distortions,
clt_parameters.stSmplMode,// final boolean smplMode, // = true; // Use sample mode (false - regular tile mode)
clt_parameters.stSmplSide,// final int smplSide, // = 2; // Sample size (side of a square)
clt_parameters.stSmplNum,// final int smplNum, // = 3; // Number after removing worst
clt_parameters.stSmplRms,// final double smplRms, // = 0.1; // Maximal RMS of the remaining tiles in a sample
clt_parameters.plBlurBinHor,// final double bin_blur_hor, // Blur disparity histograms for horizontal clusters by this sigma (in bins)
clt_parameters.plBlurBinVert,// final double bin_blur_vert, // Blur disparity histograms for constant disparity clusters by this sigma (in bins)
clt_parameters.plMaxDiffHor,// final double max_diff_hor, // maximal disparity difference (to assign to a cluster (of Double.NaN) at first run for horizontal planes
clt_parameters.plMaxDiffVert,// final double max_diff_vert, // maximal disparity difference (to assign to a cluster (of Double.NaN) at first run for vertical plane
clt_parameters.plInitPasses,// final int max_tries, // on last run - assign all rfemaining pixels to some cluster (disregard max_diff)
clt_parameters.msUseSel,// final boolean msUseSel, // final boolean use_sel,
clt_parameters.msDivideByArea,// final boolean msDivideByArea, // final boolean divide_by_area,
clt_parameters.msScaleProj,//final double msScaleProj, // final double scale_projection,
st.planes,// final TilePlanes.PlaneData [][] planes,
merge_candidates,// final int [][][] merge_candidates,
2,// -1, // debugLevel, // final int debugLevel)
clt_parameters.tileX,
clt_parameters.tileY);
clt_parameters.stSmplMode,// final boolean smplMode, // = true; // Use sample mode (false - regular tile mode)
clt_parameters.stSmplSide,// final int smplSide, // = 2; // Sample size (side of a square)
clt_parameters.stSmplNum,// final int smplNum, // = 3; // Number after removing worst
clt_parameters.stSmplRms,// final double smplRms, // = 0.1; // Maximal RMS of the remaining tiles in a sample
// remove merge candidates that break connections to neighbors
lp.keepSameTileConnections(
st.planes,// final TilePlanes.PlaneData [][] planes,
merge_candidates,// final int [][][] merge_candidates,
plane_nooverlaps,// final boolean [][][] valid_candidates, // will be updated
true,// final boolean merge_low_eigen,
2,// -1, // debugLevel, // final int debugLevel)
clt_parameters.tileX,
clt_parameters.tileY);
clt_parameters.plBlurBinHor,// final double bin_blur_hor, // Blur disparity histograms for horizontal clusters by this sigma (in bins)
clt_parameters.plBlurBinVert,// final double bin_blur_vert, // Blur disparity histograms for constant disparity clusters by this sigma (in bins)
clt_parameters.plMaxDiffHor,// final double max_diff_hor, // maximal disparity difference (to assign to a cluster (of Double.NaN) at first run for horizontal planes
clt_parameters.plMaxDiffVert,// final double max_diff_vert, // maximal disparity difference (to assign to a cluster (of Double.NaN) at first run for vertical plane
clt_parameters.plInitPasses,// final int max_tries, // on last run - assign all remaining pixels to some cluster (disregard max_diff)
clt_parameters.msUseSel,// final boolean msUseSel, // final boolean use_sel,
clt_parameters.msDivideByArea,// final boolean msDivideByArea, // final boolean divide_by_area,
clt_parameters.msScaleProj,//final double msScaleProj, // final double scale_projection,
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
// re-generate planes in the supertiles using previously calculated planes (for tghe tiles and their neighbors)
// as hints, new planes will be assumed parallel to the known and possibly slightly offset in disparity
st.regeneratePlanes(
st.planes,// final TilePlanes.PlaneData [][] planes,
clt_parameters.stMeasSel,// = 1 //Select measurements for supertiles : +1 - combo, +2 - quad +4 - hor +8 - vert
clt_parameters.plDispNorm,// = 2.0; // Normalize disparities to the average if above
clt_parameters.plMinPoints,// = 5; // Minimal number of points for plane detection
clt_parameters.plTargetEigen,// = 0.1; // Remove outliers until main axis eigenvalue (possibly scaled by plDispNorm) gets below
clt_parameters.plFractOutliers,// = 0.3; // Maximal fraction of outliers to remove
clt_parameters.plMaxOutliers,// = 20; // Maximal number of outliers to remove\
clt_parameters.plPreferDisparity,
geometryCorrection,
clt_parameters.correct_distortions,
clt_parameters.stSmplMode,// final boolean smplMode, // = true; // Use sample mode (false - regular tile mode)
clt_parameters.stSmplSide,// final int smplSide, // = 2; // Sample size (side of a square)
clt_parameters.stSmplNum,// final int smplNum, // = 3; // Number after removing worst
clt_parameters.stSmplRms,// final double smplRms, // = 0.1; // Maximal RMS of the remaining tiles in a sample
clt_parameters.plDiscrTolerance,// final double plDiscrTolerance, // = 0.4; // Maximal disparity difference from the plane to consider tile
clt_parameters.plDiscrDispRange,// final double plDiscrDispRange, // = 0.6; // Parallel move known planes around original know value for the best overall fit
clt_parameters.plDiscrSteps,// final int plDiscrSteps, // = 3; // Number of steps (each direction) for each plane to search for the best fit (0 - single, 1 - 1 each side)
clt_parameters.plDiscrVariants,// final int plDiscrVariants, // = 100; // Total number of variants to try (protect from too many planes)
clt_parameters.plDiscrMode,// final int plDiscrMode, // = 3; // What plane to use as a hint: 0 - weighted, 1 - equalized, 2 - best, 3 - combined
clt_parameters.plDiscrVarFloor,// final double plDiscrVarFloor, // = 0.03; // Squared add to variance to calculate reverse flatness (used mostly for single-cell clusters)
clt_parameters.plDiscrSigma,// final double plDiscrSigma, // = 0.05; // Gaussian sigma to compare how measured data is attracted to planes
clt_parameters.plDiscrBlur,// final double plDiscrBlur, // = 0.1; // Sigma to blur histograms while re-discriminating
clt_parameters.plDiscrExclusivity,// final double plDiscrExclusivity, // = 0.5; // Tile exclusivity: 1.0 - tile belongs to one plane only, 0.0 - regardless of others
clt_parameters.plDiscrExclus2,// final double plDiscrExclus2, // = 0.5; // For second pass if exclusivity > 1.0 - will assign only around strong neighbors
clt_parameters.plDiscrStrict,// final boolean plDiscrStrict, // = true; // When growing selection do not allow any offenders around (false - more these than others)