@@ -2858,7 +2858,9 @@ public class EyesisCorrectionParameters {
...
@@ -2858,7 +2858,9 @@ public class EyesisCorrectionParameters {
publicbooleanplPreferDisparity=false;// Always start with disparity-most axis (false - lowest eigenvalue)
publicbooleanplPreferDisparity=false;// Always start with disparity-most axis (false - lowest eigenvalue)
publicdoubleplDispNorm=5.0;// Normalize disparities to the average if above (now only for eigenvalue comparison)
publicdoubleplDispNorm=5.0;// Normalize disparities to the average if above (now only for eigenvalue comparison)
publicdoubleplFrontoTol=0.0;// for compatibility with old //0.1; // Fronto tolerance (pix) - treat almost fronto as fronto (constant disparity). <= 0 - disable
publicdoubleplFrontoRms=0.05;// Target rms for the fronto planes - same as sqrt(plMaxEigen) for other planes
publicdoubleplFrontoOffs=0.2;// increasing weight of the near tiles by using difference between the reduced average as weight. <= 0 - disable
publicdoubleplBlurBinVert=1.2;// Blur disparity histograms for constant disparity clusters by this sigma (in bins)
publicdoubleplBlurBinVert=1.2;// Blur disparity histograms for constant disparity clusters by this sigma (in bins)
publicdoubleplBlurBinHor=0.8;// Blur disparity histograms for horizontal clusters by this sigma (in bins)
publicdoubleplBlurBinHor=0.8;// Blur disparity histograms for horizontal clusters by this sigma (in bins)
publicdoubleplMaxDiffVert=0.4;// Maximal normalized disparity difference when initially assigning to vertical plane
publicdoubleplMaxDiffVert=0.4;// Maximal normalized disparity difference when initially assigning to vertical plane
...
@@ -2868,7 +2870,7 @@ public class EyesisCorrectionParameters {
...
@@ -2868,7 +2870,7 @@ public class EyesisCorrectionParameters {
publicintplMinPoints=5;// Minimal number of points for plane detection
publicintplMinPoints=5;// Minimal number of points for plane detection
publicdoubleplTargetEigen=0.02;// Remove outliers until main axis eigenvalue (possibly scaled by plDispNorm) gets below
publicdoubleplTargetEigen=0.02;// Remove outliers until main axis eigenvalue (possibly scaled by plDispNorm) gets below
publicdoubleplFractOutliers=0.3;// Maximal fraction of outliers to remove
publicdoubleplFractOutliers=0.3;// Maximal fraction of outliers to remove
publicintplMaxOutliers=20;// Maximal number of outliers to remove
publicintplMaxOutliers=200;// Maximal number of outliers to remove
publicdoubleplMinStrength=0.01;// Minimal total strength of a plane
publicdoubleplMinStrength=0.01;// Minimal total strength of a plane
publicdoubleplMaxEigen=0.06;// Maximal eigenvalue of a plane
publicdoubleplMaxEigen=0.06;// Maximal eigenvalue of a plane
publicdoubleplEigenFloor=0.005;// Add to eigenvalues of each participating plane and result to validate connections
publicdoubleplEigenFloor=0.005;// Add to eigenvalues of each participating plane and result to validate connections
...
@@ -3522,6 +3524,9 @@ public class EyesisCorrectionParameters {
...
@@ -3522,6 +3524,9 @@ public class EyesisCorrectionParameters {
"Increasing weights of the near tiles by using difference between tile disparity and reduced by this value average as weight. If <= 0 - disable feature");
gd.addNumericField("Blur disparity histograms for constant disparity clusters by this sigma (in bins)",this.plBlurBinVert,6);
gd.addNumericField("Blur disparity histograms for constant disparity clusters by this sigma (in bins)",this.plBlurBinVert,6);
gd.addNumericField("Blur disparity histograms for horizontal clusters by this sigma (in bins)",this.plBlurBinHor,6);
gd.addNumericField("Blur disparity histograms for horizontal clusters by this sigma (in bins)",this.plBlurBinHor,6);
gd.addNumericField("Maximal normalized disparity difference when initially assigning to vertical plane",this.plMaxDiffVert,6);
gd.addNumericField("Maximal normalized disparity difference when initially assigning to vertical plane",this.plMaxDiffVert,6);
...
@@ -5556,6 +5569,9 @@ public class EyesisCorrectionParameters {
...
@@ -5556,6 +5569,9 @@ public class EyesisCorrectionParameters {
publicdoubleplDispNorm;// = 3.0; // Normalize disparities to the average if above (now only for eigenvalue comparison)
publicdoubleplDispNorm;// = 3.0; // Normalize disparities to the average if above (now only for eigenvalue comparison)
publicdoubleplMinStrength;// = 0.1; // Minimal total strength of a plane
publicdoubleplFrontoTol;// = 0.2; plFrontoTol, // fronto tolerance (pix) - treat almost fronto as fronto (constant disparity). <= 0 - disable
publicdoubleplFrontoRms;// = 0.05; // Target rms for the fronto planes - same as sqrt(plMaxEigen) for other planes
publicdoubleplFrontoOffs;// = 0.2; // increasing weight of the near tiles by using difference between the reduced average as weight. <= 0 - disable
publicdoubleplMinStrength;// = 0.1; // Minimal total strength of a plane
publicdoubleplMaxEigen;// = 0.05; // Maximal eigenvalue of a plane
publicdoubleplMaxEigen;// = 0.05; // Maximal eigenvalue of a plane
publicdoubleplEigenFloor;// = 0.01; // Add to eigenvalues of each participating plane and result to validate connections
publicdoubleplEigenFloor;// = 0.01; // Add to eigenvalues of each participating plane and result to validate connections
publicdoubleplEigenStick;// = 25.0; // Consider plane to be a "stick" if second eigenvalue is below
publicdoubleplEigenStick;// = 25.0; // Consider plane to be a "stick" if second eigenvalue is below
...
@@ -132,6 +135,11 @@ public class LinkPlanes {
...
@@ -132,6 +135,11 @@ public class LinkPlanes {
plEigenStick=clt_parameters.plEigenStick;
plEigenStick=clt_parameters.plEigenStick;
plBadPlate=clt_parameters.plBadPlate;
plBadPlate=clt_parameters.plBadPlate;
plMinStrength=clt_parameters.plMinStrength;
plMinStrength=clt_parameters.plMinStrength;
plFrontoTol=clt_parameters.plFrontoTol;
plFrontoRms=clt_parameters.plFrontoRms;
plFrontoOffs=clt_parameters.plFrontoOffs;
plMaxOverlap=clt_parameters.plMaxOverlap;
plMaxOverlap=clt_parameters.plMaxOverlap;
plWeakWeight=clt_parameters.plWeakWeight;
plWeakWeight=clt_parameters.plWeakWeight;
...
@@ -282,13 +290,14 @@ public class LinkPlanes {
...
@@ -282,13 +290,14 @@ public class LinkPlanes {
Stringprefix,
Stringprefix,
intdebugLevel)
intdebugLevel)
{
{
doubleplFrontoDiff=0.02;// FIXME- make a parameter
doubleplSumThick=this.plSumThick*relax;
doubleplSumThick=this.plSumThick*relax;
doubleplWeakEigen=this.plWeakEigen*relax;
doubleplWeakEigen=this.plWeakEigen*relax;
doubleplWeakEigen2=this.plWeakEigen2*relax;
doubleplWeakEigen2=this.plWeakEigen2*relax;
merge_weak|=check_is_weak_only;
merge_weak|=check_is_weak_only;
if((plane1==null)||(plane2==null))returnfalse;
if((plane1==null)||(plane2==null))returnfalse;
booleandbg=debugLevel>1;
booleandbg=debugLevel>1;
if(debugLevel>1){
if(debugLevel>2){
System.out.println("planesFit() debug:");
System.out.println("planesFit() debug:");
}
}
TilePlanes.PlaneDatamerged_pd=null;
TilePlanes.PlaneDatamerged_pd=null;
...
@@ -296,6 +305,23 @@ public class LinkPlanes {
...
@@ -296,6 +305,23 @@ public class LinkPlanes {
doubledisp1=plane1.getZxy()[0];
doubledisp1=plane1.getZxy()[0];
doubledisp2=plane2.getZxy()[0];
doubledisp2=plane2.getZxy()[0];
if(plane1.fronto&&plane2.fronto){
if(Math.abs(disp1-disp2)>plFrontoDiff){
if(debugLevel>0)System.out.println(prefix+" both planes are fronto and disparity difference Math.abs("+disp1+"-"+disp2+") > plFrontoDiff="+plFrontoDiff);
returnfalse;
}
}
if(plane1.fronto&&!plane2.fronto){
if(debugLevel>0)System.out.println(prefix+" at plane1 is fronto and plane2 is not");
returnfalse;
}
if(plane2.fronto&&!plane1.fronto){
if(debugLevel>0)System.out.println(prefix+" at plane2 is fronto and plane1 is not");
// Verify merge candidates by evaluating overlaps. Close planes that have significant overlap on the image are mofre likely
// Verify merge candidates by evaluating overlaps. Close planes that have significant overlap on the image are more likely
// to be actually different planes, if they do not overlap it is likely to be the same one, just multiple separate parts of
// to be actually different planes, if they do not overlap it is likely to be the same one, just multiple separate parts of
// it mistakenly discriminated during initial plane generation from the tiles data.
// it mistakenly discriminated during initial plane generation from the tiles data.
//
//
...
@@ -3905,7 +3931,7 @@ public class LinkPlanes {
...
@@ -3905,7 +3931,7 @@ public class LinkPlanes {
weak_pairs,// final boolean [][] weak_fg_pairs,
weak_pairs,// final boolean [][] weak_fg_pairs,
1.0,// double relax,
1.0,// double relax,
plWeakFgRelax,// final double relax_weak_fg,
plWeakFgRelax,// final double relax_weak_fg,
1+debugLevel,// final int debugLevel)
2+debugLevel,// final int debugLevel)
dbg_tileX,
dbg_tileX,
dbg_tileY);
dbg_tileY);
// Calculate costs of merging planes of the same supertile and remove those that are exceed threshold
// Calculate costs of merging planes of the same supertile and remove those that are exceed threshold
...
@@ -3965,7 +3991,10 @@ public class LinkPlanes {
...
@@ -3965,7 +3991,10 @@ public class LinkPlanes {
plTargetEigen,// final double targetEigen, // = 0.1; // Remove outliers until main axis eigenvalue (possibly scaled by plDispNorm) gets below
plTargetEigen,// final double targetEigen, // = 0.1; // Remove outliers until main axis eigenvalue (possibly scaled by plDispNorm) gets below
plFractOutliers,// final double fractOutliers, // = 0.3; // Maximal fraction of outliers to remove
plFractOutliers,// final double fractOutliers, // = 0.3; // Maximal fraction of outliers to remove
plMaxOutliers,// final int maxOutliers, // = 20; // Maximal number of outliers to remove
plMaxOutliers,// final int maxOutliers, // = 20; // Maximal number of outliers to remove
debugLevel,// final int debugLevel)
plFrontoTol,// final double fronto_tol, // fronto tolerance (pix) - treat almost fronto as fronto (constant disparity). <= 0 - disable this feature
plFrontoRms,// final double fronto_rms, // Target rms for the fronto planes - same as sqrt(plMaxEigen) for other planes
plFrontoOffs,// final double fronto_offs, // = 0.2; // increasing weight of the near tiles by using difference between the reduced average as weight. <= 0 - disable
debugLevel,// final int debugLevel)
dbg_tileX,
dbg_tileX,
dbg_tileY);
dbg_tileY);
if(debugLevel>-1){
if(debugLevel>-1){
...
@@ -4487,6 +4516,9 @@ public class LinkPlanes {
...
@@ -4487,6 +4516,9 @@ public class LinkPlanes {
plTargetEigen,// final double targetEigen, // = 0.1; // Remove outliers until main axis eigenvalue (possibly scaled by plDispNorm) gets below
plTargetEigen,// final double targetEigen, // = 0.1; // Remove outliers until main axis eigenvalue (possibly scaled by plDispNorm) gets below
plFractOutliers,// final double fractOutliers, // = 0.3; // Maximal fraction of outliers to remove
plFractOutliers,// final double fractOutliers, // = 0.3; // Maximal fraction of outliers to remove
plMaxOutliers,// final int maxOutliers, // = 20; // Maximal number of outliers to remove
plMaxOutliers,// final int maxOutliers, // = 20; // Maximal number of outliers to remove
plFrontoTol,// final double fronto_tol, // fronto tolerance (pix) - treat almost fronto as fronto (constant disparity). <= 0 - disable this feature
plFrontoRms,// final double fronto_rms, // Target rms for the fronto planes - same as sqrt(plMaxEigen) for other planes
plFrontoOffs,// final double fronto_offs, // = 0.2; // increasing weight of the near tiles by using difference between the reduced average as weight. <= 0 - disable
debugLevel,// final int debugLevel)
debugLevel,// final int debugLevel)
dbg_tileX,
dbg_tileX,
dbg_tileY);
dbg_tileY);
...
@@ -4578,6 +4610,9 @@ public class LinkPlanes {
...
@@ -4578,6 +4610,9 @@ public class LinkPlanes {
plTargetEigen,// final double targetEigen, // = 0.1; // Remove outliers until main axis eigenvalue (possibly scaled by plDispNorm) gets below
plTargetEigen,// final double targetEigen, // = 0.1; // Remove outliers until main axis eigenvalue (possibly scaled by plDispNorm) gets below
plFractOutliers,// final double fractOutliers, // = 0.3; // Maximal fraction of outliers to remove
plFractOutliers,// final double fractOutliers, // = 0.3; // Maximal fraction of outliers to remove
plMaxOutliers,// final int maxOutliers, // = 20; // Maximal number of outliers to remove
plMaxOutliers,// final int maxOutliers, // = 20; // Maximal number of outliers to remove
plFrontoTol,// final double fronto_tol, // fronto tolerance (pix) - treat almost fronto as fronto (constant disparity). <= 0 - disable this feature
plFrontoRms,// final double fronto_rms, // Target rms for the fronto planes - same as sqrt(plMaxEigen) for other planes
plFrontoOffs,// final double fronto_offs, // = 0.2; // increasing weight of the near tiles by using difference between the reduced average as weight. <= 0 - disable
hor_disp_strength,// final double [][][][] disparity_strengths, // either normal or tilted disparity/strengths
dispClusterizeHighest(
mmm_hor,// final double [][][] hist_max_min_max, // histogram data: per tile array of odd number of disparity/strengths pairs, starting with first maximum
hor_disp_strength,// final double [][][][] disparity_strengths, // either normal or tilted disparity/strengths
null,// final boolean [][][] selected, // tiles OK to be assigned [supertile][measurement layer] [tile index] or null (or null or per-measurement layer)
null,// final boolean [][][] selected, // tiles OK to be assigned [supertile][measurement layer] [tile index] or null (or null or per-measurement layer)
used,// final boolean [][][] prohibited, // already assigned tiles [supertile][measurement layer] [tile index] or null
used_hor,// final boolean [][][] prohibited, // already assigned tiles [supertile][measurement layer] [tile index] or null
stMeasSel,// final int stMeasSel, // = 1; // Select measurements for supertiles : +1 - combo, +2 - quad +4 - hor +8 - vert
true,// final boolean search_min,
((pass<(max_tries-1))?max_diff_hor:Double.NaN),// final double max_diff, // maximal disparity difference (to assign to a cluster (of Double.NaN)
stMeasSel,// final int stMeasSel, // = 1; // Select measurements for supertiles : +1 - combo, +2 - quad +4 - hor +8 - vert
plMinPoints,// final int plMinPoints, // = 5; // Minimal number of points for plane detection
plDispNorm,// final double plDispNorm, // to increase weight of nearer planes
smallDiff,// final double smallDiff, // = 0.4; // Consider merging initial planes if disparity difference below
clust_sigma,// final double sigma,
highMix,// final double highMix, //stHighMix = 0.4; // Consider merging initial planes if jumps between ratio above
0.5*disp_arange,// final double disp_arange,
true,// final boolean norm_max_diff, // scale max_diff for large (> dispNorm) average disparities
0.5*disp_rrange,// final double disp_rrange,
true,// final boolean norm_small_diff, // scale max_diff for large (> dispNorm) average disparities
tolerance_above_far,// final double tolerance_above,
plDispNorm,// final double dispNorm, // TODO: make a separate variable?
tolerance_below_far,// final double tolerance_below,
debugLevel,// 1, // debugLevel,
plMinPoints,// final int plMinPoints, // = 5; // Minimal number of points for plane detection
dbg_X,
"hor",// final String suffix,
dbg_Y);
debugLevel+0,// final int debugLevel,
dbg_X,// final int dbg_X,
dbg_Y):// final int dbg_Y);
dispClusterize(
hor_disp_strength,// final double [][][][] disparity_strengths, // either normal or tilted disparity/strengths
mmm_hor,// final double [][][] hist_max_min_max, // histogram data: per tile array of odd number of disparity/strengths pairs, starting with first maximum
null,// final boolean [][][] selected, // tiles OK to be assigned [supertile][measurement layer] [tile index] or null (or null or per-measurement layer)
used_hor,// final boolean [][][] prohibited, // already assigned tiles [supertile][measurement layer] [tile index] or null
stMeasSel,// final int stMeasSel, // = 1; // Select measurements for supertiles : +1 - combo, +2 - quad +4 - hor +8 - vert
((pass<(max_tries-1))?max_diff_hor:Double.NaN),// final double max_diff, // maximal disparity difference (to assign to a cluster (of Double.NaN)
plMinPoints,// final int plMinPoints, // = 5; // Minimal number of points for plane detection
smallDiff,// final double smallDiff, // = 0.4; // Consider merging initial planes if disparity difference below
highMix,// final double highMix, //stHighMix = 0.4; // Consider merging initial planes if jumps between ratio above
true,// final boolean norm_max_diff, // scale max_diff for large (> dispNorm) average disparities
true,// final boolean norm_small_diff, // scale max_diff for large (> dispNorm) average disparities
plDispNorm,// final double dispNorm, // TODO: make a separate variable?
debugLevel,// 1, // debugLevel,
dbg_X,
dbg_Y);
if(debugLevel>0){
if(debugLevel>0){
System.out.println("initialDiscriminateTiles(): before new_planes_vert, pass ="+(pass+1)+" ( of "+max_tries+" )");
System.out.println("initialDiscriminateTiles(): before new_planes_vert, pass ="+(pass+1)+" ( of "+max_tries+" )");
vert_disp_strength,// final double [][][][] disparity_strengths, // either normal or tilted disparity/strengths
dispClusterizeHighest(
mmm_vert,// final double [][][] hist_max_min_max, // histogram data: per tile array of odd number of disparity/strengths pairs, starting with first maximum
vert_disp_strength,// final double [][][][] disparity_strengths, // either normal or tilted disparity/strengths
null,// final boolean [][][] selected, // tiles OK to be assigned [supertile][measurement layer] [tile index] or null (or null or per-measurement layer)
null,// final boolean [][][] selected, // tiles OK to be assigned [supertile][measurement layer] [tile index] or null (or null or per-measurement layer)
used,// final boolean [][][] prohibited, // already assigned tiles [supertile][measurement layer] [tile index] or null
used_vert,// final boolean [][][] prohibited, // already assigned tiles [supertile][measurement layer] [tile index] or null
stMeasSel,// final int stMeasSel, // = 1; // Select measurements for supertiles : +1 - combo, +2 - quad +4 - hor +8 - vert
false,// final boolean search_min,
((pass<(max_tries-1))?max_diff_vert:Double.NaN),// final double max_diff, // maximal disparity difference (to assign to a cluster (of Double.NaN)
stMeasSel,// final int stMeasSel, // = 1; // Select measurements for supertiles : +1 - combo, +2 - quad +4 - hor +8 - vert
plMinPoints,// final int plMinPoints, // = 5; // Minimal number of points for plane detection
plDispNorm,// final double plDispNorm, // to increase weight of nearer planes
smallDiff,// final double smallDiff, // = 0.4; // Consider merging initial planes if disparity difference below
clust_sigma,// final double sigma,
highMix,// final double highMix, //stHighMix = 0.4; // Consider merging initial planes if jumps between ratio above
disp_arange,// final double disp_arange,
true,// final boolean norm_max_diff, // scale max_diff for large (> dispNorm) average disparities
disp_rrange,// final double disp_rrange,
true,// final boolean norm_small_diff, // scale max_diff for large (> dispNorm) average disparities
tolerance_above_near,// final double tolerance_above,
plDispNorm,// final double dispNorm, // TODO: make a separate variable?
tolerance_below_near,// final double tolerance_below,
debugLevel,// 2, // debugLevel,
plMinPoints,// final int plMinPoints, // = 5; // Minimal number of points for plane detection
dbg_X,
"vert",// final String suffix,
dbg_Y);
debugLevel+0,// final int debugLevel,
dbg_X,// final int dbg_X,
dbg_Y):// final int dbg_Y)
dispClusterize(
vert_disp_strength,// final double [][][][] disparity_strengths, // either normal or tilted disparity/strengths
mmm_vert,// final double [][][] hist_max_min_max, // histogram data: per tile array of odd number of disparity/strengths pairs, starting with first maximum
null,// final boolean [][][] selected, // tiles OK to be assigned [supertile][measurement layer] [tile index] or null (or null or per-measurement layer)
used_vert,// final boolean [][][] prohibited, // already assigned tiles [supertile][measurement layer] [tile index] or null
stMeasSel,// final int stMeasSel, // = 1; // Select measurements for supertiles : +1 - combo, +2 - quad +4 - hor +8 - vert
((pass<(max_tries-1))?max_diff_vert:Double.NaN),// final double max_diff, // maximal disparity difference (to assign to a cluster (of Double.NaN)
plMinPoints,// final int plMinPoints, // = 5; // Minimal number of points for plane detection
smallDiff,// final double smallDiff, // = 0.4; // Consider merging initial planes if disparity difference below
highMix,// final double highMix, //stHighMix = 0.4; // Consider merging initial planes if jumps between ratio above
true,// final boolean norm_max_diff, // scale max_diff for large (> dispNorm) average disparities
true,// final boolean norm_small_diff, // scale max_diff for large (> dispNorm) average disparities
plDispNorm,// final double dispNorm, // TODO: make a separate variable?
debugLevel,// 2, // debugLevel,
dbg_X,
dbg_Y);
// compare which vert or hor provide stronger clusters, add them to selections, recalculate "used"
// compare which vert or hor provide stronger clusters, add them to selections, recalculate "used"
fronto_tol,// double fronto_tol, // fronto tolerance (pix) - treat almost fronto as fronto (constant disparity). <= 0 - disable this feature
fronto_rms,// double fronto_rms, // Target rms for the fronto planes - same as sqrt(plMaxEigen) for other planes. May be tighter
fronto_offs,// double fronto_offs, // = 0.2; // increasing weight of the near tiles by using difference between the reduced average as weight. <= 0 - disable
fronto_tol,// double fronto_tol, // fronto tolerance (pix) - treat almost fronto as fronto (constant disparity). <= 0 - disable this feature
fronto_rms,// double fronto_rms, // Target rms for the fronto planes - same as sqrt(plMaxEigen) for other planes. May be tighter
fronto_offs,// double fronto_offs, // = 0.2; // increasing weight of the near tiles by using difference between the reduced average as weight. <= 0 - disable
dl-1);// int debugLevel);
}
}
}
}
...
@@ -2661,10 +3256,10 @@ public class SuperTiles{
...
@@ -2661,10 +3256,10 @@ public class SuperTiles{
if(LOWEST_PLANE(2)>0)st_planes.add(0,st_planes.get(0));// insert dummy at pos 0;
if(LOWEST_PLANE(2)>0)st_planes.add(0,st_planes.get(0));// insert dummy at pos 0;
growSelection,// final int growSelection, // grow initial selection before processing
growSelection,// final int growSelection, // grow initial selection before processing
...
@@ -2767,7 +3371,9 @@ public class SuperTiles{
...
@@ -2767,7 +3371,9 @@ public class SuperTiles{
highMix,//final double highMix, // stHighMix = 0.4; // Consider merging initial planes if jumps between ratio above
highMix,//final double highMix, // stHighMix = 0.4; // Consider merging initial planes if jumps between ratio above
world_hor,// final double [] world_hor, // horizontal plane normal (default [0.0, 1.0, 0.0])
world_hor,// final double [] world_hor, // horizontal plane normal (default [0.0, 1.0, 0.0])
show_histograms,// final boolean show_histograms,
show_histograms,// final boolean show_histograms,
debugLevel+0,// final int debugLevel,
hor_planes,// final boolean [][] hor_planes,
debugLevel+(debug_initial_discriminate?2:0),// final int debugLevel,
dbg_X,// final int dbg_X,
dbg_X,// final int dbg_X,
dbg_Y);// final int dbg_Y)
dbg_Y);// final int dbg_Y)
...
@@ -2804,7 +3410,11 @@ public class SuperTiles{
...
@@ -2804,7 +3410,11 @@ public class SuperTiles{
smplMode,// final boolean smplMode, // = true; // Use sample mode (false - regular tile mode)
smplMode,// final boolean smplMode, // = true; // Use sample mode (false - regular tile mode)
mlfp,
mlfp,
debugLevel+0,// 1, // + 2, // 1, // final int debugLevel,
plFrontoTol,// final double plFrontoTol, // fronto tolerance (pix) - treat almost fronto as fronto (constant disparity). <= 0 - disable
plFrontoRms,// final double plFrontoRms, // Target rms for the fronto planes - same as sqrt(plMaxEigen) for other planes
plFrontoOffs,// final double plFrontoOffs, // increasing weight of the near tiles by using difference between the reduced average as weight. <= 0 - disable
hor_planes,// final boolean [][] hor_planes, // returns plane types (hor/vert)
debugLevel+1,// 0, // 1, // + 2, // 1, // final int debugLevel,
dbg_X,// final int dbg_X,
dbg_X,// final int dbg_X,
dbg_Y);// final int dbg_Y)
dbg_Y);// final int dbg_Y)
this.planes=new_planes;// save as "measured" (as opposed to "smoothed" by neighbors) planes
this.planes=new_planes;// save as "measured" (as opposed to "smoothed" by neighbors) planes
...
@@ -2859,7 +3469,10 @@ public class SuperTiles{
...
@@ -2859,7 +3469,10 @@ public class SuperTiles{
finaldoubleplTargetEigen,// = 0.1; // Remove outliers until main axis eigenvalue (possibly scaled by plDispNorm) gets below
finaldoubleplTargetEigen,// = 0.1; // Remove outliers until main axis eigenvalue (possibly scaled by plDispNorm) gets below
finaldoubleplFractOutliers,// = 0.3; // Maximal fraction of outliers to remove
finaldoubleplFractOutliers,// = 0.3; // Maximal fraction of outliers to remove
finalintplMaxOutliers,// = 20; // Maximal number of outliers to remove
finalintplMaxOutliers,// = 20; // Maximal number of outliers to remove
finalbooleanplPreferDisparity,// Always start with disparity-most axis (false - lowest eigenvalue)
finalbooleanplPreferDisparity,// Always start with disparity-most axis (false - lowest eigenvalue)
finaldoubleplFrontoTol,// fronto tolerance (pix) - treat almost fronto as fronto (constant disparity). <= 0 - disable
finaldoubleplFrontoRms,// Target rms for the fronto planes - same as sqrt(plMaxEigen) for other planes
finaldoubleplFrontoOffs,// increasing weight of the near tiles by using difference between the reduced average as weight. <= 0 - disable
finalGeometryCorrectiongeometryCorrection,
finalGeometryCorrectiongeometryCorrection,
finalbooleancorrect_distortions,
finalbooleancorrect_distortions,
...
@@ -2960,6 +3573,10 @@ public class SuperTiles{
...
@@ -2960,6 +3573,10 @@ public class SuperTiles{
smplMode,// final boolean smplMode, // = true; // Use sample mode (false - regular tile mode)
smplMode,// final boolean smplMode, // = true; // Use sample mode (false - regular tile mode)
mlfp,
mlfp,
plFrontoTol,// fronto tolerance (pix) - treat almost fronto as fronto (constant disparity). <= 0 - disable
plFrontoRms,// final double plFrontoRms, // Target rms for the fronto planes - same as sqrt(plMaxEigen) for other planes
plFrontoOffs,// final double plFrontoOffs, // increasing weight of the near tiles by using difference between the reduced average as weight. <= 0
null,// final boolean [][] hor_planes, // plane types (hor/vert)
debugLevel,// + 2, // 1, // final int debugLevel,
debugLevel,// + 2, // 1, // final int debugLevel,
dbg_X,// final int dbg_X,
dbg_X,// final int dbg_X,
dbg_Y);// final int dbg_Y)
dbg_Y);// final int dbg_Y)
...
@@ -5723,6 +6340,19 @@ public class SuperTiles{
...
@@ -5723,6 +6340,19 @@ public class SuperTiles{
}
}
}
}
}
}
//superTileSize
// mark fronto tiles with NaN - center 3x3 tiles
//superTileSize
if(planes[nsTile][np].fronto){
plane[centerIndex+0]=Double.NaN;
plane[centerIndex+superTileSize]=Double.NaN;
plane[centerIndex-superTileSize]=Double.NaN;
}
if(planes[nsTile][np].horizontal){
plane[centerIndex+0]=Double.NaN;
plane[centerIndex+1]=Double.NaN;
plane[centerIndex-1]=Double.NaN;
}
for(inty=0;y<superTileSize;y++){
for(inty=0;y<superTileSize;y++){
if(data.length<(ns+1)){
if(data.length<(ns+1)){
System.out.println("BUG in getShowPlanes()!, ns = "+ns+", data.length="+data.length);
System.out.println("BUG in getShowPlanes()!, ns = "+ns+", data.length="+data.length);
...
@@ -5733,6 +6363,7 @@ public class SuperTiles{
...
@@ -5733,6 +6363,7 @@ public class SuperTiles{
ns++;
ns++;
}
}
}
}
}
}
}
}
// fill same (nearest) plane or NaN if none was available
// fill same (nearest) plane or NaN if none was available
...
@@ -6199,7 +6830,6 @@ public class SuperTiles{
...
@@ -6199,7 +6830,6 @@ public class SuperTiles{
publicintapplyMergePlanes(
publicintapplyMergePlanes(
finalTilePlanes.PlaneData[][]planes,
finalTilePlanes.PlaneData[][]planes,
finalint[][][]merge_groups,
finalint[][][]merge_groups,
// parameters to generate ellipsoids
// parameters to generate ellipsoids
finaldoubledisp_far,// minimal disparity to select (or NaN)
finaldoubledisp_far,// minimal disparity to select (or NaN)
finaldoubledisp_near,// maximal disparity to select (or NaN)
finaldoubledisp_near,// maximal disparity to select (or NaN)
...
@@ -6208,8 +6838,12 @@ public class SuperTiles{
...
@@ -6208,8 +6838,12 @@ public class SuperTiles{
finalintmin_tiles,
finalintmin_tiles,
// parameters to reduce outliers
// parameters to reduce outliers
finaldoubletargetEigen,// = 0.1; // Remove outliers until main axis eigenvalue (possibly scaled by plDispNorm) gets below
finaldoubletargetEigen,// = 0.1; // Remove outliers until main axis eigenvalue (possibly scaled by plDispNorm) gets below
finaldoublefractOutliers,// = 0.3; // Maximal fraction of outliers to remove
finaldoubleinFractOutliers,// = 0.3; // Maximal fraction of outliers to remove
finalintmaxOutliers,// = 20; // Maximal number of outliers to remove
finalintmaxOutliers,// = 20; // Maximal number of outliers to remove
finaldoublefronto_tol,// fronto tolerance (pix) - treat almost fronto as fronto (constant disparity). <= 0 - disable this feature
// FIXME: the following 2 parameters are not yet used
finaldoublefronto_rms,// Target rms for the fronto planes - same as sqrt(plMaxEigen) for other planes
finaldoublefronto_offs,// = 0.2; // increasing weight of the near tiles by using difference between the reduced average as weight. <= 0 - disable
finalintdebugLevel,
finalintdebugLevel,
finalintdbg_X,
finalintdbg_X,
finalintdbg_Y)
finalintdbg_Y)
...
@@ -6248,24 +6882,9 @@ public class SuperTiles{
...
@@ -6248,24 +6882,9 @@ public class SuperTiles{
dispNorm,// double dispNorm, // Normalize disparities to the average if above
dispNorm,// double dispNorm, // Normalize disparities to the average if above
min_weight,// double min_weight,
min_weight,// double min_weight,
min_tiles,// int min_tiles,
min_tiles,// int min_tiles,
// strength_floor, // double strength_floor,
// strength_pow, // double strength_pow,
//OK?
//OK?
smplMode,
smplMode,
mlfp,
mlfp,
// smplSide,
// smplNum,
// smplRms,
// smplWnd,
// max_abs_tilt, // 2.0; // Maximal absolute tilt in pixels/tile
// max_rel_tilt, // 0.2; // Maximal relative tilt in pixels/tile/disparity
if(!almost_fronto){// compare to a distance from a tilted plane or to a constant disparity (almost_fronto)
doublex=((indx%stSize2)-stSize)-zxy0[1];
doubley=((indx/stSize2)-stSize)-zxy0[2];
d+=(x*v[1]+y*v[2])/v[0];
}
doubled2=d*d;
doubled2=d*d;
if(almost_fronto&&(d>0)){
d2/=fronto_bonus_near;// if tile is nearer, decrease effective error
}
if(d2>worst_d2){
if(d2>worst_d2){
worst_d2=d2;
worst_d2=d2;
worst_layer_index[0]=nl;
worst_layer_index[0]=nl;
...
@@ -1297,6 +1467,10 @@ public class TilePlanes {
...
@@ -1297,6 +1467,10 @@ public class TilePlanes {
this.min_weight,// double min_weight,
this.min_weight,// double min_weight,
this.min_tiles,// int min_tiles,
this.min_tiles,// int min_tiles,
this.smplMode,
this.smplMode,
almost_fronto,// boolean fronto_mode,
fronto_offs,// double fronto_offs, // = 0.2; // increasing weight of the near tiles by using difference between the reduced average as weight. <= 0 - disable
// FIXME: May be removed, just to update fronto_rms:
almost_fronto=isFronto(
fronto_tol,// double fronto_tol,
disp_str,// double [][][] disp_str,
debugLevel);// int debugLevel);
if(almost_fronto){
booleanOK=(getPlaneFromMeas(
measuredSelection,// null, // boolean [][] tile_sel, // null - do not use, {} use all (will be modified)
disp_str,
Double.NaN,// double disp_far, // minimal disparity to select (or NaN)
Double.NaN,// double disp_near, // maximal disparity to select (or NaN)
this.dispNorm,// double dispNorm, // Normalize disparities to the average if above
this.min_weight,// double min_weight,
this.min_tiles,// int min_tiles,
this.smplMode,
almost_fronto,// boolean fronto_mode,
fronto_offs,// double fronto_offs, // = 0.2; // increasing weight of the near tiles by using difference between the reduced average as weight. <= 0 - disable
this.mlfp,
debugLevel-0)!=null);// will show image
if(!OK){// restore how it was
getPlaneFromMeas(
measuredSelection,// null, // boolean [][] tile_sel, // null - do not use, {} use all (will be modified)
disp_str,
Double.NaN,// double disp_far, // minimal disparity to select (or NaN)
Double.NaN,// double disp_near, // maximal disparity to select (or NaN)
this.dispNorm,// double dispNorm, // Normalize disparities to the average if above
this.min_weight,// double min_weight,
this.min_tiles,// int min_tiles,
this.smplMode,
this.mlfp,
debugLevel-0);
}
}
returnno_bugs;
returnno_bugs;
}
}
publicdouble[][][]getPlaneFromMeas(
boolean[][]tile_sel,// null - do not use, {} use all (will be modified)
double[][][]disp_str,// calculate just once when removing outliers
doubledisp_far,// minimal disparity to select (or NaN)
doubledisp_near,// maximal disparity to select (or NaN)
doubledispNorm,// Normalize disparities to the average if above
OK=pd.removeOutliers(// getPlaneFromMeas should already have run
OK=pd.removeOutliers(// getPlaneFromMeas should already have run
fronto_tol,// double fronto_tol, // fronto tolerance (pix) - treat almost fronto as fronto (constant disparity). <= 0 - disable this feature
fronto_rms,// double fronto_rms, // Target rms for the fronto planes - same as sqrt(plMaxEigen) for other planes. May be tighter
fronto_offs,//double fronto_offs, // = 0.2; // increasing weight of the near tiles by using difference between the reduced average as weight. <= 0 - disable
disp_strength,
disp_strength,
targetV,// double targetEigen, // target eigenvalue for primary axis (is disparity-dependent, so is non-constant)
plTargetEigen,// targetV, // double targetEigen, // target eigenvalue for primary axis (is disparity-dependent, so is non-constant)
max_outliers,// int maxRemoved, // maximal number of tiles to remove (not a constant)
max_outliers,// int maxRemoved, // maximal number of tiles to remove (not a constant)
debugLevel);// int debugLevel)
debugLevel);// int debugLevel)
if(!OK){
if(!OK){
...
@@ -5117,6 +5534,7 @@ public class TilePlanes {
...
@@ -5117,6 +5534,7 @@ public class TilePlanes {
// return planes/selections (no remove outliers!)
// return planes/selections (no remove outliers!)
boolean[][][]filterBridges(
boolean[][][]filterBridges(
ArrayList<PlaneData>tilePlanes,
ArrayList<PlaneData>tilePlanes,
boolean[][]hor_planes,// specify which selections correspond to horizontal planes
@@ -5341,23 +5341,14 @@ public class TileProcessor {
...
@@ -5341,23 +5341,14 @@ public class TileProcessor {
clt_parameters.plFractOutliers,// = 0.3; // Maximal fraction of outliers to remove
clt_parameters.plFractOutliers,// = 0.3; // Maximal fraction of outliers to remove
clt_parameters.plMaxOutliers,// = 20; // Maximal number of outliers to remove\
clt_parameters.plMaxOutliers,// = 20; // Maximal number of outliers to remove\
clt_parameters.plPreferDisparity,
clt_parameters.plPreferDisparity,
clt_parameters.plFrontoTol,// final double plFrontoTol, // fronto tolerance (pix) - treat almost fronto as fronto (constant disparity). <= 0 - disable
clt_parameters.plFrontoRms,// final double plFrontoRms, // Target rms for the fronto planes - same as sqrt(plMaxEigen) for other planes
clt_parameters.plFrontoOffs,// final double plFrontoOffs, // increasing weight of the near tiles by using difference between the reduced average as weight. <= 0
geometryCorrection,
geometryCorrection,
clt_parameters.correct_distortions,
clt_parameters.correct_distortions,
clt_parameters.stSmplMode,// final boolean smplMode, // = true; // Use sample mode (false - regular tile mode)
clt_parameters.stSmplMode,// final boolean smplMode, // = true; // Use sample mode (false - regular tile mode)
clt_parameters.mlfp,// Filter parameters
clt_parameters.mlfp,// Filter parameters
// 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.stSmplWnd, // boolean smplWnd, // use window functions for the samples
// clt_parameters.fs_max_abs_tilt, // 2.0; // Maximal absolute tilt in pixels/tile
// clt_parameters.fs_max_rel_tilt, // 0.2; // Maximal relative tilt in pixels/tile/disparity
@@ -5412,7 +5403,7 @@ public class TileProcessor {
...
@@ -5412,7 +5403,7 @@ public class TileProcessor {
clt_parameters.plPreferDisparity,// preferDisparity, // final boolean preferDisparity)
clt_parameters.plPreferDisparity,// preferDisparity, // final boolean preferDisparity)
debugLevel-2);
debugLevel-2);
// re-generate planes in the supertiles using previously calculated planes (for tghe tiles and their neighbors)
// re-generate planes in the supertiles using previously calculated planes (for the tiles and their neighbors)
// as hints, new planes will be assumed parallel to the known and possibly slightly offset in disparity
// as hints, new planes will be assumed parallel to the known and possibly slightly offset in disparity
if(clt_parameters.plDiscrEn){
if(clt_parameters.plDiscrEn){
st.regeneratePlanes(
st.regeneratePlanes(
...
@@ -5424,30 +5415,17 @@ public class TileProcessor {
...
@@ -5424,30 +5415,17 @@ public class TileProcessor {
clt_parameters.plFractOutliers,// = 0.3; // Maximal fraction of outliers to remove
clt_parameters.plFractOutliers,// = 0.3; // Maximal fraction of outliers to remove
clt_parameters.plMaxOutliers,// = 20; // Maximal number of outliers to remove\
clt_parameters.plMaxOutliers,// = 20; // Maximal number of outliers to remove\
clt_parameters.plPreferDisparity,
clt_parameters.plPreferDisparity,
clt_parameters.plFrontoTol,// final double plFrontoTol, // fronto tolerance (pix) - treat almost fronto as fronto (constant disparity). <= 0 - disable
clt_parameters.plFrontoRms,// final double plFrontoRms, // Target rms for the fronto planes - same as sqrt(plMaxEigen) for other planes
clt_parameters.plFrontoOffs,// final double plFrontoOffs, // increasing weight of the near tiles by using difference between the reduced average as weight. <= 0
geometryCorrection,
geometryCorrection,
clt_parameters.correct_distortions,
clt_parameters.correct_distortions,
clt_parameters.stSmplMode,// final boolean smplMode, // = true; // Use sample mode (false - regular tile mode)
clt_parameters.stSmplMode,// final boolean smplMode, // = true; // Use sample mode (false - regular tile mode)
clt_parameters.mlfp,// Filter parameters
clt_parameters.mlfp,// Filter parameters
// 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.stSmplWnd, // final boolean smplWnd, // use window functions for the samples
// clt_parameters.fs_max_abs_tilt, // 2.0; // Maximal absolute tilt in pixels/tile
// clt_parameters.fs_max_rel_tilt, // 0.2; // Maximal relative tilt in pixels/tile/disparity
// clt_parameters.fs_min_tilt_disp, // 4.0; // Disparity switch between filtering modes - near objects use tilts, far - use max disparity
// clt_parameters.fs_transition, // 1.0; // Mode transition range (between tilted and maximal disparity)
// clt_parameters.fs_far_mode, // 1; // Far objects filtering mode (0 - off, 1 - power of disparity)
// clt_parameters.fs_far_power, // 1.0; // Raise disparity to this power before averaging for far objects
clt_parameters.plDiscrTolerance,// final double plDiscrTolerance, // = 0.4; // Maximal disparity difference from the plane to consider tile
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.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.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.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.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.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.plDiscrBlur,// final double plDiscrBlur, // = 0.1; // Sigma to blur histograms while re-discriminating
...
@@ -5548,24 +5526,11 @@ public class TileProcessor {
...
@@ -5548,24 +5526,11 @@ 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.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.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.plMaxOutliers,// final int maxOutliers, // = 20; // Maximal number of outliers to remove
// clt_parameters.stFloor, // final double strength_floor,
clt_parameters.stSmplMode,// final boolean smplMode, // = true; // Use sample mode (false - regular tile mode)
// clt_parameters.stPow, // final double strength_pow,
clt_parameters.plFrontoTol,//final double fronto_tol, // fronto tolerance (pix) - treat almost fronto as fronto (constant disparity). <= 0 - disable this feature
clt_parameters.stSmplMode,// final boolean smplMode, // = true; // Use sample mode (false - regular tile mode)
clt_parameters.plFrontoRms,// final double plFrontoRms, // Target rms for the fronto planes - same as sqrt(plMaxEigen) for other planes
clt_parameters.mlfp,// Filter parameters
clt_parameters.plFrontoOffs,// final double plFrontoOffs, // increasing weight of the near tiles by using difference between the reduced average as weight. <= 0
// 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.stSmplWnd, // boolean smplWnd, // use window functions for the samples
// clt_parameters.fs_max_abs_tilt, // 2.0; // Maximal absolute tilt in pixels/tile
// clt_parameters.fs_max_rel_tilt, // 0.2; // Maximal relative tilt in pixels/tile/disparity
finalintnum_full_cycles=clt_parameters.rig.pf_en_trim_fg?3:1;// Number of full low-texture cycles that include growing flat LT and trimmin weak FG over BG
finalintnum_full_cycles=clt_parameters.rig.pf_en_trim_fg?3:1;// Number of full low-texture cycles that include growing flat LT and trimmin weak FG over BG
finalintnum_cross_gaps_cycles=20;// maximal number of adding new tiles cycles while "crossing the gaps)
// final int num_cross_gaps_cycles = 12+ (num_simple_expand_cysles * dxy.length); // maximal number of adding new tiles cycles while "crossing the gaps)
finalintmin_cross_gaps_new=20;// minimal number of the new added tiles
finalintmin_cross_gaps_new=20;// minimal number of the new added tiles