Loading src/main/java/EyesisCorrectionParameters.java +21 −0 Original line number Diff line number Diff line Loading @@ -2128,6 +2128,7 @@ public class EyesisCorrectionParameters { public int stSmplNum = 3; // Number after removing worst public double stSmplRms = 0.1; // Maximal RMS of the remaining tiles in a sample public int stGrowSel = 2; // Grow initial selection before processing supertiles, odd - ortho. <0 - use all tiles public int stMeasSel = 1; // Select measurements for supertiles : +1 - combo, +2 - quad +4 - hor +8 - vert public double stSmallDiff = 0.4; // Consider merging initial planes if disparity difference below Loading Loading @@ -2216,6 +2217,7 @@ public class EyesisCorrectionParameters { public double msScaleProj = 1.5; // Scale projection of the plane ellipsoid public double msFractUni = 0.3; // Spread this fraction of the ellipsoid weight among extended (double) supertile public boolean tsNoEdge = true; // Do not assigned tiles to thesurface edges (not having all 8 neighbors) public double tsMaxDiff = 0.3; // Maximal disparity difference when assigning tiles public double tsMinDiffOther = 0.35; // Minimal disparity difference to be considered as a competitor surface public double tsMinStrength = 0.05; // Minimal tile correlation strength to be assigned Loading Loading @@ -2246,6 +2248,7 @@ public class EyesisCorrectionParameters { public boolean tsLoopMulti = true; // Repeat multi-choice assignment while succeeding public boolean tsReset = false; // Reset tiles to surfaces assignment public boolean tsShow = false; // Show results of tiles to surfaces assignment public int tsNumClust = 50; // Number of clusters to keep public boolean replaceWeakOutlayers = true; // false; Loading Loading @@ -2473,6 +2476,7 @@ public class EyesisCorrectionParameters { properties.setProperty(prefix+"stSmplNum", this.stSmplNum+""); properties.setProperty(prefix+"stSmplRms", this.stSmplRms +""); properties.setProperty(prefix+"stGrowSel", this.stGrowSel+""); properties.setProperty(prefix+"stMeasSel", this.stMeasSel+""); properties.setProperty(prefix+"stSmallDiff", this.stSmallDiff +""); properties.setProperty(prefix+"stHighMix", this.stHighMix +""); Loading Loading @@ -2552,6 +2556,7 @@ public class EyesisCorrectionParameters { properties.setProperty(prefix+"msScaleProj", this.msScaleProj +""); properties.setProperty(prefix+"msFractUni", this.msFractUni +""); properties.setProperty(prefix+"tsNoEdge", this.tsNoEdge+""); properties.setProperty(prefix+"tsMaxDiff", this.tsMaxDiff +""); properties.setProperty(prefix+"tsMinDiffOther", this.tsMinDiffOther +""); properties.setProperty(prefix+"tsMinStrength", this.tsMinStrength +""); Loading @@ -2577,6 +2582,7 @@ public class EyesisCorrectionParameters { properties.setProperty(prefix+"tsRemoveWeak2", this.tsRemoveWeak2+""); properties.setProperty(prefix+"tsLoopMulti", this.tsLoopMulti+""); properties.setProperty(prefix+"tsShow", this.tsShow+""); properties.setProperty(prefix+"tsNumClust", this.tsNumClust +""); properties.setProperty(prefix+"dbg_migrate", this.dbg_migrate+""); Loading Loading @@ -2796,6 +2802,7 @@ public class EyesisCorrectionParameters { if (properties.getProperty(prefix+"stSmplNum")!=null) this.stSmplNum=Integer.parseInt(properties.getProperty(prefix+"stSmplNum")); if (properties.getProperty(prefix+"stSmplRms")!=null) this.stSmplRms=Double.parseDouble(properties.getProperty(prefix+"stSmplRms")); if (properties.getProperty(prefix+"stGrowSel")!=null) this.stGrowSel=Integer.parseInt(properties.getProperty(prefix+"stGrowSel")); if (properties.getProperty(prefix+"stMeasSel")!=null) this.stMeasSel=Integer.parseInt(properties.getProperty(prefix+"stMeasSel")); if (properties.getProperty(prefix+"stSmallDiff")!=null) this.stSmallDiff=Double.parseDouble(properties.getProperty(prefix+"stSmallDiff")); if (properties.getProperty(prefix+"stHighMix")!=null) this.stHighMix=Double.parseDouble(properties.getProperty(prefix+"stHighMix")); Loading Loading @@ -2877,6 +2884,7 @@ public class EyesisCorrectionParameters { if (properties.getProperty(prefix+"msFractUni")!=null) this.msFractUni=Double.parseDouble(properties.getProperty(prefix+"msFractUni")); if (properties.getProperty(prefix+"tsNoEdge")!=null) this.tsNoEdge=Boolean.parseBoolean(properties.getProperty(prefix+"tsNoEdge")); if (properties.getProperty(prefix+"tsMaxDiff")!=null) this.tsMaxDiff=Double.parseDouble(properties.getProperty(prefix+"tsMaxDiff")); if (properties.getProperty(prefix+"tsMinDiffOther")!=null) this.tsMinDiffOther=Double.parseDouble(properties.getProperty(prefix+"tsMinDiffOther")); if (properties.getProperty(prefix+"tsMinStrength")!=null) this.tsMinStrength=Double.parseDouble(properties.getProperty(prefix+"tsMinStrength")); Loading @@ -2903,6 +2911,9 @@ public class EyesisCorrectionParameters { if (properties.getProperty(prefix+"tsLoopMulti")!=null) this.tsLoopMulti=Boolean.parseBoolean(properties.getProperty(prefix+"tsLoopMulti")); if (properties.getProperty(prefix+"tsShow")!=null) this.tsShow=Boolean.parseBoolean(properties.getProperty(prefix+"tsShow")); if (properties.getProperty(prefix+"tsNumClust")!=null) this.tsNumClust=Integer.parseInt(properties.getProperty(prefix+"tsNumClust")); if (properties.getProperty(prefix+"dbg_migrate")!=null) this.dbg_migrate=Boolean.parseBoolean(properties.getProperty(prefix+"dbg_migrate")); if (properties.getProperty(prefix+"show_ortho_combine")!=null) this.show_ortho_combine=Boolean.parseBoolean(properties.getProperty(prefix+"show_ortho_combine")); Loading Loading @@ -3144,6 +3155,7 @@ public class EyesisCorrectionParameters { gd.addNumericField("Number after removing worst", this.stSmplNum, 0); gd.addNumericField("Maximal RMS of the remaining tiles in a sample", this.stSmplRms, 6); gd.addNumericField("Grow initial selection before processing supertiles, odd - ortho. <0 - use all tiles",this.stGrowSel, 0); gd.addNumericField("Select measurements for supertiles : +1 - combo, +2 - quad +4 - hor +8 - vert",this.stMeasSel, 0); gd.addNumericField("Consider merging initial planes if disparity difference below", this.stSmallDiff, 6); gd.addNumericField("Consider merging initial planes if jumps between ratio above", this.stHighMix, 6); Loading Loading @@ -3228,6 +3240,7 @@ public class EyesisCorrectionParameters { gd.addMessage ("--- Tiles assignment ---"); gd.addCheckbox ("Do not assigned tiles to the surface edges (not having all 8 neighbors)", this.tsNoEdge); gd.addNumericField("Maximal disparity difference when assigning tiles", this.tsMaxDiff, 6); gd.addNumericField("Minimal disparity difference to be considered as a competitor surface", this.tsMinDiffOther, 6); gd.addNumericField("Minimal tile correlation strength to be assigned", this.tsMinStrength, 6); Loading @@ -3254,6 +3267,7 @@ public class EyesisCorrectionParameters { gd.addCheckbox ("Repeat multi-choice assignment while succeeding", this.tsLoopMulti); gd.addCheckbox ("Show results of tiles to surfaces assignment", this.tsShow); gd.addNumericField("Number of clusters to keep", this.tsNumClust, 0); gd.addCheckbox ("Test new mode after migration", this.dbg_migrate); Loading Loading @@ -3479,6 +3493,7 @@ public class EyesisCorrectionParameters { this.stSmplNum= (int) gd.getNextNumber(); this.stSmplRms= gd.getNextNumber(); this.stGrowSel= (int) gd.getNextNumber(); this.stMeasSel= (int) gd.getNextNumber(); this.stSmallDiff= gd.getNextNumber(); this.stHighMix= gd.getNextNumber(); Loading Loading @@ -3560,6 +3575,7 @@ public class EyesisCorrectionParameters { this.msScaleProj= gd.getNextNumber(); this.msFractUni= gd.getNextNumber(); this.tsNoEdge= gd.getNextBoolean(); this.tsMaxDiff= gd.getNextNumber(); this.tsMinDiffOther= gd.getNextNumber(); this.tsMinStrength= gd.getNextNumber(); Loading Loading @@ -3587,6 +3603,7 @@ public class EyesisCorrectionParameters { this.tsLoopMulti= gd.getNextBoolean(); this.tsShow = gd.getNextBoolean(); this.tsNumClust = (int) gd.getNextNumber(); this.dbg_migrate= gd.getNextBoolean(); Loading @@ -3609,6 +3626,7 @@ public class EyesisCorrectionParameters { public boolean showTsDialog() { GenericDialog gd = new GenericDialog("Set CLT tiles to surfaces assignment parameters"); gd.addCheckbox ("Do not assigned tiles to the surface edges (not having all 8 neighbors)", this.tsNoEdge); gd.addNumericField("Maximal disparity difference when assigning tiles", this.tsMaxDiff, 6); gd.addNumericField("Minimal disparity difference to be considered as a competitor surface", this.tsMinDiffOther, 6); gd.addNumericField("Minimal tile correlation strength to be assigned", this.tsMinStrength, 6); Loading @@ -3635,10 +3653,12 @@ public class EyesisCorrectionParameters { gd.addCheckbox ("Repeat multi-choice assignment while succeeding", this.tsLoopMulti); gd.addCheckbox ("Show results of tiles to surfaces assignment", this.tsShow); gd.addNumericField("Number of clusters to keep", this.tsNumClust, 0); WindowTools.addScrollBars(gd); gd.showDialog(); if (gd.wasCanceled()) return false; this.tsNoEdge= gd.getNextBoolean(); this.tsMaxDiff= gd.getNextNumber(); this.tsMinDiffOther= gd.getNextNumber(); this.tsMinStrength= gd.getNextNumber(); Loading Loading @@ -3666,6 +3686,7 @@ public class EyesisCorrectionParameters { this.tsLoopMulti= gd.getNextBoolean(); this.tsShow = gd.getNextBoolean(); this.tsNumClust= (int) gd.getNextNumber(); return true; } Loading src/main/java/MeasuredLayers.java +51 −0 Original line number Diff line number Diff line Loading @@ -781,4 +781,55 @@ public class MeasuredLayers { } return ds; } public void growSelection( 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 boolean [] tiles, boolean [] prohibit) { boolean [] src_tiles = tiles.clone(); // just in case // grow boolean hor = true; for (; grow > 0; grow--){ boolean single = (grow ==1) && hor; src_tiles = tiles.clone(); if (hor){ for (int tileY = 0; tileY < tilesY; tileY++){ for (int tileX = 0; tileX < (tilesX - 1); tileX++){ int tindx = tileY * tilesX + tileX; if ((prohibit == null) || (!prohibit[tindx] && !prohibit[tindx + 1])) { tiles[tindx + 1] |= src_tiles[tindx]; } } for (int tileX = 1; tileX < tilesX; tileX++){ int tindx = tileY * tilesX + tileX; if ((prohibit == null) || (!prohibit[tindx] && !prohibit[tindx - 1])) { tiles[tindx - 1] |= src_tiles[tindx]; } } } } if (!hor || single){ // do vertically, but from previous state for (int tileX = 0; tileX < tilesX; tileX++){ for (int tileY = 0; tileY < (tilesY - 1); tileY++){ int tindx = tileY * tilesX + tileX; if ((prohibit == null) || (!prohibit[tindx] && !prohibit[tindx + tilesX])) { tiles[tindx + tilesX] |= src_tiles[tindx]; } } for (int tileY = 1; tileY < tilesY; tileY++){ int tindx = tileY * tilesX + tileX; if ((prohibit == null) || (!prohibit[tindx] && !prohibit[tindx - tilesX])) { tiles[tindx - tilesX] |= src_tiles[tindx]; } } } } hor = !hor; } } } src/main/java/SuperTiles.java +30 −10 Original line number Diff line number Diff line Loading @@ -1699,6 +1699,7 @@ public class SuperTiles{ // find average disparity for the supertile (improve?) double sd = 0.0, sw = 0.0; for (int ml = 0; ml < plane_disp_strength[nsTile].length; ml++) if ((stMeasSel & ( 1 << ml)) != 0){ if ((plane_disp_strength[nsTile] !=null) && (plane_disp_strength[nsTile][ml] !=null) && (plane_disp_strength[nsTile][ml][1] !=null)) { for (int i = 0; i < plane_disp_strength[nsTile][ml][1].length; i++){ double w = plane_disp_strength[nsTile][ml][1][i]; double d = plane_disp_strength[nsTile][ml][0][i]; Loading @@ -1706,6 +1707,7 @@ public class SuperTiles{ sw += w; } } } if (sw > 0) { if (dl > 0) { System.out.println("Plane tilted disparity for stileX = "+stileX+" stileY="+stileY+", average disparity "+(sd/sw)); Loading Loading @@ -2008,6 +2010,7 @@ public class SuperTiles{ // Sort plane data by center (plane or supertile) disparity public boolean [][][][] initialDiscriminateTiles( final int growSelection, // grow initial selection before processing final int stMeasSel, // = 1; // Select measurements for supertiles : +1 - combo, +2 - quad +4 - hor +8 - vert final double plDispNorm, final int plMinPoints, // = 5; // Minimal number of points for plane detection Loading Loading @@ -2049,14 +2052,25 @@ public class SuperTiles{ // final TilePlanes tpl = new TilePlanes(tileSize,superTileSize, geometryCorrection); final int num_layers = measuredLayers.getNumLayers(); final int num_tiles = 4 * superTileSize * superTileSize; measuredLayers.setLayer ( boolean [] grown_selection = null; if (growSelection >= 0) { grown_selection = cltPass3d.getSelected(); if (growSelection > 0) { grown_selection = grown_selection.clone(); measuredLayers.growSelection( growSelection, // grow, grown_selection, // tiles, null); // prohibit); } } measuredLayers.setLayer ( // overwrite? 0, // int num_layer, cltPass3d.getDisparity(), // double [] disparity, cltPass3d.getStrength(), // double [] strength, null); // boolean [] selection) // may be null grown_selection); // null); // boolean [] selection) // may be null if (debugLevel > -1) { String [] titles = {"d0","s0","d1","s1","d2","s2","d3","s3","s","d"}; String [] titles = {"d0","s0","d1","s1","d2","s2","d3","s3","s","d","selection"}; boolean [] dbg_sel= grown_selection; // cltPass3d.getSelected(); double [][] dbg_img = new double [titles.length][]; for (int i = 0; i < measuredLayers.getNumLayers(); i++){ dbg_img[2 * i] = measuredLayers.getDisparity(i); Loading @@ -2064,6 +2078,10 @@ public class SuperTiles{ } dbg_img[8] = cltPass3d.getDisparity(); dbg_img[9] = cltPass3d.getStrength(); dbg_img[10]= new double [dbg_sel.length]; for (int i = 0; i < dbg_sel.length; i++){ dbg_img[10][i] = ((dbg_sel == null) || dbg_sel[i])? 1.0:0.0; } showDoubleFloatArrays sdfa_instance = new showDoubleFloatArrays(); sdfa_instance.showArrays(dbg_img, tileProcessor.getTilesX(), tileProcessor.getTilesY(), true, "measuredLayers",titles); } Loading Loading @@ -2442,6 +2460,7 @@ public class SuperTiles{ public void processPlanes5( final int growSelection, // grow initial selection before processing final int stMeasSel, // = 1; // Select measurements for supertiles : +1 - combo, +2 - quad +4 - hor +8 - vert final double plDispNorm, final int plMinPoints, // = 5; // Minimal number of points for plane detection Loading @@ -2461,7 +2480,7 @@ public class SuperTiles{ final double bin_blur_vert, // Blur disparity histograms for constant disparity clusters by this sigma (in bins) final double max_diff_hor, // maximal disparity difference (to assign to a cluster (of Double.NaN) at first run for horizontal planes final double max_diff_vert, // maximal disparity difference (to assign to a cluster (of Double.NaN) at first run for vertical plane final int max_tries, // on last run - assign all rfemaining pixels to some cluster (disregard max_diff) final int max_tries, // on last run - assign all remaining pixels to some cluster (disregard max_diff) final boolean msUseSel, // final boolean use_sel, final boolean msDivideByArea, // final boolean divide_by_area, Loading @@ -2482,6 +2501,7 @@ public class SuperTiles{ // Sort plane data by center (plane or supertile) disparity boolean [][][][] plane_selections = initialDiscriminateTiles( growSelection, // final int growSelection, // grow initial selection before processing stMeasSel, // final int stMeasSel, // = 1; // Select measurements for supertiles : +1 - combo, +2 - quad +4 - hor +8 - vert plDispNorm, // final double plDispNorm, plMinPoints, // final int plMinPoints, // = 5; // Minimal number of points for plane detection Loading src/main/java/TileProcessor.java +109 −0 Original line number Diff line number Diff line Loading @@ -2972,6 +2972,7 @@ public class TileProcessor { // assign tiles that do not depend on other assigned tiles - single pass if (clt_parameters.tsEnSingle) { int [] stats= tileSurface.assignTilesToSurfaces( clt_parameters.tsNoEdge , // final boolean noEdge, clt_parameters.tsMaxDiff, //final double maxDiff, clt_parameters.tsMinDiffOther, //final double minDiffOther, // should be >= maxDiff clt_parameters.tsMinStrength, //final double minStrength, Loading Loading @@ -2999,6 +3000,7 @@ public class TileProcessor { if (clt_parameters.tsEnMulti) { for (int nTry = 0; nTry < 100; nTry++) { int [] stats= tileSurface.assignTilesToSurfaces( clt_parameters.tsNoEdge , // final boolean noEdge, clt_parameters.tsMaxDiff, //final double maxDiff, clt_parameters.tsMinDiffOther, //final double minDiffOther, // should be >= maxDiff clt_parameters.tsMinStrength, //final double minStrength, Loading Loading @@ -3044,6 +3046,7 @@ public class TileProcessor { if (clt_parameters.tsGrowSurround) { for (int nTry = 0; nTry < 100; nTry++) { int [] stats= tileSurface.assignFromFarthest( clt_parameters.tsNoEdge , // final boolean noEdge, clt_parameters.tsMinNeib , // final int minNeib, // ** clt_parameters.tsMaxSurStrength , // final double maxStrength, // ** clt_parameters.tsCountDis, // final boolean includeImpossible, // ** // count prohibited neighbors as assigned Loading Loading @@ -3086,6 +3089,111 @@ public class TileProcessor { "assignments", // String title, dispStrength); // final double [][][] dispStrength) } boolean [][] assigned_sel = tileSurface.extractSelection( 0, // final int debugLevel, clt_parameters.tileX, clt_parameters.tileY); int [][] clusters1 = tileSurface.enumerateClusters( assigned_sel, //final boolean [][] selection, 0, // final int debugLevel, clt_parameters.tileX, clt_parameters.tileY); int [][] cluster_stats1 = tileSurface.clusterStats( clusters1, // int [][] clusters, 0, // final int debugLevel, clt_parameters.tileX, clt_parameters.tileY); tileSurface.showClusterStats( cluster_stats1, // int [][] cluster_stats, clt_parameters.tsNumClust); // int max_clusters){ if (clt_parameters.tsShow){ tileSurface.showClusters( "clusters_individual", // String title, cluster_stats1, // int [][] cluster_stats, clt_parameters.tsNumClust, // int max_clusters clusters1); // int [][] clusters); // final double [][][] dispStrength) } // Try splitting (currently no initial conflicts): int [][] clusters1a = tileSurface.spitConflictClusters( clusters1, // final int [][] clusters, 0, // final int debugLevel, clt_parameters.tileX, clt_parameters.tileY); int [][] cluster_stats1a = tileSurface.clusterStats( clusters1a, // int [][] clusters, 0, // final int debugLevel, clt_parameters.tileX, clt_parameters.tileY); tileSurface.showClusterStats( cluster_stats1a, // int [][] cluster_stats, clt_parameters.tsNumClust); // int max_clusters){ boolean [][] grown_sel = tileSurface.growSelection( 2, // int grow, assigned_sel, // final boolean [][] sel_in, 0, // final int debugLevel, clt_parameters.tileX, clt_parameters.tileY); int [][] clusters2 = tileSurface.enumerateClusters( grown_sel, // final boolean [][] selection, 0, // final int debugLevel, clt_parameters.tileX, clt_parameters.tileY); int [][] cluster_stats2 = tileSurface.clusterStats( clusters2, // int [][] clusters, 0, // final int debugLevel, clt_parameters.tileX, clt_parameters.tileY); tileSurface.showClusterStats( cluster_stats2, // int [][] cluster_stats, clt_parameters.tsNumClust); // int max_clusters){ if (clt_parameters.tsShow){ tileSurface.showClusters( "clusters_merged", // String title, cluster_stats2, // int [][] cluster_stats, clt_parameters.tsNumClust, // int max_clusters clusters2); // int [][] clusters); // final double [][][] dispStrength) } // Just for testing: splitting combined clusters int [][] clusters2a = tileSurface.spitConflictClusters( clusters2, // final int [][] clusters, 0, // final int debugLevel, clt_parameters.tileX, clt_parameters.tileY); int [][] cluster_stats2a = tileSurface.clusterStats( clusters2a, // int [][] clusters, 0, // final int debugLevel, clt_parameters.tileX, clt_parameters.tileY); tileSurface.showClusterStats( cluster_stats2a, // int [][] cluster_stats, clt_parameters.tsNumClust); // int max_clusters){ if (clt_parameters.tsShow){ tileSurface.showClusters( "clusters_merged_split", // String title, cluster_stats2a, // int [][] cluster_stats, clt_parameters.tsNumClust, // int max_clusters clusters2a); // int [][] clusters); // final double [][][] dispStrength) } return true; } Loading Loading @@ -3192,6 +3300,7 @@ public class TileProcessor { // 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 Loading Loading
src/main/java/EyesisCorrectionParameters.java +21 −0 Original line number Diff line number Diff line Loading @@ -2128,6 +2128,7 @@ public class EyesisCorrectionParameters { public int stSmplNum = 3; // Number after removing worst public double stSmplRms = 0.1; // Maximal RMS of the remaining tiles in a sample public int stGrowSel = 2; // Grow initial selection before processing supertiles, odd - ortho. <0 - use all tiles public int stMeasSel = 1; // Select measurements for supertiles : +1 - combo, +2 - quad +4 - hor +8 - vert public double stSmallDiff = 0.4; // Consider merging initial planes if disparity difference below Loading Loading @@ -2216,6 +2217,7 @@ public class EyesisCorrectionParameters { public double msScaleProj = 1.5; // Scale projection of the plane ellipsoid public double msFractUni = 0.3; // Spread this fraction of the ellipsoid weight among extended (double) supertile public boolean tsNoEdge = true; // Do not assigned tiles to thesurface edges (not having all 8 neighbors) public double tsMaxDiff = 0.3; // Maximal disparity difference when assigning tiles public double tsMinDiffOther = 0.35; // Minimal disparity difference to be considered as a competitor surface public double tsMinStrength = 0.05; // Minimal tile correlation strength to be assigned Loading Loading @@ -2246,6 +2248,7 @@ public class EyesisCorrectionParameters { public boolean tsLoopMulti = true; // Repeat multi-choice assignment while succeeding public boolean tsReset = false; // Reset tiles to surfaces assignment public boolean tsShow = false; // Show results of tiles to surfaces assignment public int tsNumClust = 50; // Number of clusters to keep public boolean replaceWeakOutlayers = true; // false; Loading Loading @@ -2473,6 +2476,7 @@ public class EyesisCorrectionParameters { properties.setProperty(prefix+"stSmplNum", this.stSmplNum+""); properties.setProperty(prefix+"stSmplRms", this.stSmplRms +""); properties.setProperty(prefix+"stGrowSel", this.stGrowSel+""); properties.setProperty(prefix+"stMeasSel", this.stMeasSel+""); properties.setProperty(prefix+"stSmallDiff", this.stSmallDiff +""); properties.setProperty(prefix+"stHighMix", this.stHighMix +""); Loading Loading @@ -2552,6 +2556,7 @@ public class EyesisCorrectionParameters { properties.setProperty(prefix+"msScaleProj", this.msScaleProj +""); properties.setProperty(prefix+"msFractUni", this.msFractUni +""); properties.setProperty(prefix+"tsNoEdge", this.tsNoEdge+""); properties.setProperty(prefix+"tsMaxDiff", this.tsMaxDiff +""); properties.setProperty(prefix+"tsMinDiffOther", this.tsMinDiffOther +""); properties.setProperty(prefix+"tsMinStrength", this.tsMinStrength +""); Loading @@ -2577,6 +2582,7 @@ public class EyesisCorrectionParameters { properties.setProperty(prefix+"tsRemoveWeak2", this.tsRemoveWeak2+""); properties.setProperty(prefix+"tsLoopMulti", this.tsLoopMulti+""); properties.setProperty(prefix+"tsShow", this.tsShow+""); properties.setProperty(prefix+"tsNumClust", this.tsNumClust +""); properties.setProperty(prefix+"dbg_migrate", this.dbg_migrate+""); Loading Loading @@ -2796,6 +2802,7 @@ public class EyesisCorrectionParameters { if (properties.getProperty(prefix+"stSmplNum")!=null) this.stSmplNum=Integer.parseInt(properties.getProperty(prefix+"stSmplNum")); if (properties.getProperty(prefix+"stSmplRms")!=null) this.stSmplRms=Double.parseDouble(properties.getProperty(prefix+"stSmplRms")); if (properties.getProperty(prefix+"stGrowSel")!=null) this.stGrowSel=Integer.parseInt(properties.getProperty(prefix+"stGrowSel")); if (properties.getProperty(prefix+"stMeasSel")!=null) this.stMeasSel=Integer.parseInt(properties.getProperty(prefix+"stMeasSel")); if (properties.getProperty(prefix+"stSmallDiff")!=null) this.stSmallDiff=Double.parseDouble(properties.getProperty(prefix+"stSmallDiff")); if (properties.getProperty(prefix+"stHighMix")!=null) this.stHighMix=Double.parseDouble(properties.getProperty(prefix+"stHighMix")); Loading Loading @@ -2877,6 +2884,7 @@ public class EyesisCorrectionParameters { if (properties.getProperty(prefix+"msFractUni")!=null) this.msFractUni=Double.parseDouble(properties.getProperty(prefix+"msFractUni")); if (properties.getProperty(prefix+"tsNoEdge")!=null) this.tsNoEdge=Boolean.parseBoolean(properties.getProperty(prefix+"tsNoEdge")); if (properties.getProperty(prefix+"tsMaxDiff")!=null) this.tsMaxDiff=Double.parseDouble(properties.getProperty(prefix+"tsMaxDiff")); if (properties.getProperty(prefix+"tsMinDiffOther")!=null) this.tsMinDiffOther=Double.parseDouble(properties.getProperty(prefix+"tsMinDiffOther")); if (properties.getProperty(prefix+"tsMinStrength")!=null) this.tsMinStrength=Double.parseDouble(properties.getProperty(prefix+"tsMinStrength")); Loading @@ -2903,6 +2911,9 @@ public class EyesisCorrectionParameters { if (properties.getProperty(prefix+"tsLoopMulti")!=null) this.tsLoopMulti=Boolean.parseBoolean(properties.getProperty(prefix+"tsLoopMulti")); if (properties.getProperty(prefix+"tsShow")!=null) this.tsShow=Boolean.parseBoolean(properties.getProperty(prefix+"tsShow")); if (properties.getProperty(prefix+"tsNumClust")!=null) this.tsNumClust=Integer.parseInt(properties.getProperty(prefix+"tsNumClust")); if (properties.getProperty(prefix+"dbg_migrate")!=null) this.dbg_migrate=Boolean.parseBoolean(properties.getProperty(prefix+"dbg_migrate")); if (properties.getProperty(prefix+"show_ortho_combine")!=null) this.show_ortho_combine=Boolean.parseBoolean(properties.getProperty(prefix+"show_ortho_combine")); Loading Loading @@ -3144,6 +3155,7 @@ public class EyesisCorrectionParameters { gd.addNumericField("Number after removing worst", this.stSmplNum, 0); gd.addNumericField("Maximal RMS of the remaining tiles in a sample", this.stSmplRms, 6); gd.addNumericField("Grow initial selection before processing supertiles, odd - ortho. <0 - use all tiles",this.stGrowSel, 0); gd.addNumericField("Select measurements for supertiles : +1 - combo, +2 - quad +4 - hor +8 - vert",this.stMeasSel, 0); gd.addNumericField("Consider merging initial planes if disparity difference below", this.stSmallDiff, 6); gd.addNumericField("Consider merging initial planes if jumps between ratio above", this.stHighMix, 6); Loading Loading @@ -3228,6 +3240,7 @@ public class EyesisCorrectionParameters { gd.addMessage ("--- Tiles assignment ---"); gd.addCheckbox ("Do not assigned tiles to the surface edges (not having all 8 neighbors)", this.tsNoEdge); gd.addNumericField("Maximal disparity difference when assigning tiles", this.tsMaxDiff, 6); gd.addNumericField("Minimal disparity difference to be considered as a competitor surface", this.tsMinDiffOther, 6); gd.addNumericField("Minimal tile correlation strength to be assigned", this.tsMinStrength, 6); Loading @@ -3254,6 +3267,7 @@ public class EyesisCorrectionParameters { gd.addCheckbox ("Repeat multi-choice assignment while succeeding", this.tsLoopMulti); gd.addCheckbox ("Show results of tiles to surfaces assignment", this.tsShow); gd.addNumericField("Number of clusters to keep", this.tsNumClust, 0); gd.addCheckbox ("Test new mode after migration", this.dbg_migrate); Loading Loading @@ -3479,6 +3493,7 @@ public class EyesisCorrectionParameters { this.stSmplNum= (int) gd.getNextNumber(); this.stSmplRms= gd.getNextNumber(); this.stGrowSel= (int) gd.getNextNumber(); this.stMeasSel= (int) gd.getNextNumber(); this.stSmallDiff= gd.getNextNumber(); this.stHighMix= gd.getNextNumber(); Loading Loading @@ -3560,6 +3575,7 @@ public class EyesisCorrectionParameters { this.msScaleProj= gd.getNextNumber(); this.msFractUni= gd.getNextNumber(); this.tsNoEdge= gd.getNextBoolean(); this.tsMaxDiff= gd.getNextNumber(); this.tsMinDiffOther= gd.getNextNumber(); this.tsMinStrength= gd.getNextNumber(); Loading Loading @@ -3587,6 +3603,7 @@ public class EyesisCorrectionParameters { this.tsLoopMulti= gd.getNextBoolean(); this.tsShow = gd.getNextBoolean(); this.tsNumClust = (int) gd.getNextNumber(); this.dbg_migrate= gd.getNextBoolean(); Loading @@ -3609,6 +3626,7 @@ public class EyesisCorrectionParameters { public boolean showTsDialog() { GenericDialog gd = new GenericDialog("Set CLT tiles to surfaces assignment parameters"); gd.addCheckbox ("Do not assigned tiles to the surface edges (not having all 8 neighbors)", this.tsNoEdge); gd.addNumericField("Maximal disparity difference when assigning tiles", this.tsMaxDiff, 6); gd.addNumericField("Minimal disparity difference to be considered as a competitor surface", this.tsMinDiffOther, 6); gd.addNumericField("Minimal tile correlation strength to be assigned", this.tsMinStrength, 6); Loading @@ -3635,10 +3653,12 @@ public class EyesisCorrectionParameters { gd.addCheckbox ("Repeat multi-choice assignment while succeeding", this.tsLoopMulti); gd.addCheckbox ("Show results of tiles to surfaces assignment", this.tsShow); gd.addNumericField("Number of clusters to keep", this.tsNumClust, 0); WindowTools.addScrollBars(gd); gd.showDialog(); if (gd.wasCanceled()) return false; this.tsNoEdge= gd.getNextBoolean(); this.tsMaxDiff= gd.getNextNumber(); this.tsMinDiffOther= gd.getNextNumber(); this.tsMinStrength= gd.getNextNumber(); Loading Loading @@ -3666,6 +3686,7 @@ public class EyesisCorrectionParameters { this.tsLoopMulti= gd.getNextBoolean(); this.tsShow = gd.getNextBoolean(); this.tsNumClust= (int) gd.getNextNumber(); return true; } Loading
src/main/java/MeasuredLayers.java +51 −0 Original line number Diff line number Diff line Loading @@ -781,4 +781,55 @@ public class MeasuredLayers { } return ds; } public void growSelection( 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 boolean [] tiles, boolean [] prohibit) { boolean [] src_tiles = tiles.clone(); // just in case // grow boolean hor = true; for (; grow > 0; grow--){ boolean single = (grow ==1) && hor; src_tiles = tiles.clone(); if (hor){ for (int tileY = 0; tileY < tilesY; tileY++){ for (int tileX = 0; tileX < (tilesX - 1); tileX++){ int tindx = tileY * tilesX + tileX; if ((prohibit == null) || (!prohibit[tindx] && !prohibit[tindx + 1])) { tiles[tindx + 1] |= src_tiles[tindx]; } } for (int tileX = 1; tileX < tilesX; tileX++){ int tindx = tileY * tilesX + tileX; if ((prohibit == null) || (!prohibit[tindx] && !prohibit[tindx - 1])) { tiles[tindx - 1] |= src_tiles[tindx]; } } } } if (!hor || single){ // do vertically, but from previous state for (int tileX = 0; tileX < tilesX; tileX++){ for (int tileY = 0; tileY < (tilesY - 1); tileY++){ int tindx = tileY * tilesX + tileX; if ((prohibit == null) || (!prohibit[tindx] && !prohibit[tindx + tilesX])) { tiles[tindx + tilesX] |= src_tiles[tindx]; } } for (int tileY = 1; tileY < tilesY; tileY++){ int tindx = tileY * tilesX + tileX; if ((prohibit == null) || (!prohibit[tindx] && !prohibit[tindx - tilesX])) { tiles[tindx - tilesX] |= src_tiles[tindx]; } } } } hor = !hor; } } }
src/main/java/SuperTiles.java +30 −10 Original line number Diff line number Diff line Loading @@ -1699,6 +1699,7 @@ public class SuperTiles{ // find average disparity for the supertile (improve?) double sd = 0.0, sw = 0.0; for (int ml = 0; ml < plane_disp_strength[nsTile].length; ml++) if ((stMeasSel & ( 1 << ml)) != 0){ if ((plane_disp_strength[nsTile] !=null) && (plane_disp_strength[nsTile][ml] !=null) && (plane_disp_strength[nsTile][ml][1] !=null)) { for (int i = 0; i < plane_disp_strength[nsTile][ml][1].length; i++){ double w = plane_disp_strength[nsTile][ml][1][i]; double d = plane_disp_strength[nsTile][ml][0][i]; Loading @@ -1706,6 +1707,7 @@ public class SuperTiles{ sw += w; } } } if (sw > 0) { if (dl > 0) { System.out.println("Plane tilted disparity for stileX = "+stileX+" stileY="+stileY+", average disparity "+(sd/sw)); Loading Loading @@ -2008,6 +2010,7 @@ public class SuperTiles{ // Sort plane data by center (plane or supertile) disparity public boolean [][][][] initialDiscriminateTiles( final int growSelection, // grow initial selection before processing final int stMeasSel, // = 1; // Select measurements for supertiles : +1 - combo, +2 - quad +4 - hor +8 - vert final double plDispNorm, final int plMinPoints, // = 5; // Minimal number of points for plane detection Loading Loading @@ -2049,14 +2052,25 @@ public class SuperTiles{ // final TilePlanes tpl = new TilePlanes(tileSize,superTileSize, geometryCorrection); final int num_layers = measuredLayers.getNumLayers(); final int num_tiles = 4 * superTileSize * superTileSize; measuredLayers.setLayer ( boolean [] grown_selection = null; if (growSelection >= 0) { grown_selection = cltPass3d.getSelected(); if (growSelection > 0) { grown_selection = grown_selection.clone(); measuredLayers.growSelection( growSelection, // grow, grown_selection, // tiles, null); // prohibit); } } measuredLayers.setLayer ( // overwrite? 0, // int num_layer, cltPass3d.getDisparity(), // double [] disparity, cltPass3d.getStrength(), // double [] strength, null); // boolean [] selection) // may be null grown_selection); // null); // boolean [] selection) // may be null if (debugLevel > -1) { String [] titles = {"d0","s0","d1","s1","d2","s2","d3","s3","s","d"}; String [] titles = {"d0","s0","d1","s1","d2","s2","d3","s3","s","d","selection"}; boolean [] dbg_sel= grown_selection; // cltPass3d.getSelected(); double [][] dbg_img = new double [titles.length][]; for (int i = 0; i < measuredLayers.getNumLayers(); i++){ dbg_img[2 * i] = measuredLayers.getDisparity(i); Loading @@ -2064,6 +2078,10 @@ public class SuperTiles{ } dbg_img[8] = cltPass3d.getDisparity(); dbg_img[9] = cltPass3d.getStrength(); dbg_img[10]= new double [dbg_sel.length]; for (int i = 0; i < dbg_sel.length; i++){ dbg_img[10][i] = ((dbg_sel == null) || dbg_sel[i])? 1.0:0.0; } showDoubleFloatArrays sdfa_instance = new showDoubleFloatArrays(); sdfa_instance.showArrays(dbg_img, tileProcessor.getTilesX(), tileProcessor.getTilesY(), true, "measuredLayers",titles); } Loading Loading @@ -2442,6 +2460,7 @@ public class SuperTiles{ public void processPlanes5( final int growSelection, // grow initial selection before processing final int stMeasSel, // = 1; // Select measurements for supertiles : +1 - combo, +2 - quad +4 - hor +8 - vert final double plDispNorm, final int plMinPoints, // = 5; // Minimal number of points for plane detection Loading @@ -2461,7 +2480,7 @@ public class SuperTiles{ final double bin_blur_vert, // Blur disparity histograms for constant disparity clusters by this sigma (in bins) final double max_diff_hor, // maximal disparity difference (to assign to a cluster (of Double.NaN) at first run for horizontal planes final double max_diff_vert, // maximal disparity difference (to assign to a cluster (of Double.NaN) at first run for vertical plane final int max_tries, // on last run - assign all rfemaining pixels to some cluster (disregard max_diff) final int max_tries, // on last run - assign all remaining pixels to some cluster (disregard max_diff) final boolean msUseSel, // final boolean use_sel, final boolean msDivideByArea, // final boolean divide_by_area, Loading @@ -2482,6 +2501,7 @@ public class SuperTiles{ // Sort plane data by center (plane or supertile) disparity boolean [][][][] plane_selections = initialDiscriminateTiles( growSelection, // final int growSelection, // grow initial selection before processing stMeasSel, // final int stMeasSel, // = 1; // Select measurements for supertiles : +1 - combo, +2 - quad +4 - hor +8 - vert plDispNorm, // final double plDispNorm, plMinPoints, // final int plMinPoints, // = 5; // Minimal number of points for plane detection Loading
src/main/java/TileProcessor.java +109 −0 Original line number Diff line number Diff line Loading @@ -2972,6 +2972,7 @@ public class TileProcessor { // assign tiles that do not depend on other assigned tiles - single pass if (clt_parameters.tsEnSingle) { int [] stats= tileSurface.assignTilesToSurfaces( clt_parameters.tsNoEdge , // final boolean noEdge, clt_parameters.tsMaxDiff, //final double maxDiff, clt_parameters.tsMinDiffOther, //final double minDiffOther, // should be >= maxDiff clt_parameters.tsMinStrength, //final double minStrength, Loading Loading @@ -2999,6 +3000,7 @@ public class TileProcessor { if (clt_parameters.tsEnMulti) { for (int nTry = 0; nTry < 100; nTry++) { int [] stats= tileSurface.assignTilesToSurfaces( clt_parameters.tsNoEdge , // final boolean noEdge, clt_parameters.tsMaxDiff, //final double maxDiff, clt_parameters.tsMinDiffOther, //final double minDiffOther, // should be >= maxDiff clt_parameters.tsMinStrength, //final double minStrength, Loading Loading @@ -3044,6 +3046,7 @@ public class TileProcessor { if (clt_parameters.tsGrowSurround) { for (int nTry = 0; nTry < 100; nTry++) { int [] stats= tileSurface.assignFromFarthest( clt_parameters.tsNoEdge , // final boolean noEdge, clt_parameters.tsMinNeib , // final int minNeib, // ** clt_parameters.tsMaxSurStrength , // final double maxStrength, // ** clt_parameters.tsCountDis, // final boolean includeImpossible, // ** // count prohibited neighbors as assigned Loading Loading @@ -3086,6 +3089,111 @@ public class TileProcessor { "assignments", // String title, dispStrength); // final double [][][] dispStrength) } boolean [][] assigned_sel = tileSurface.extractSelection( 0, // final int debugLevel, clt_parameters.tileX, clt_parameters.tileY); int [][] clusters1 = tileSurface.enumerateClusters( assigned_sel, //final boolean [][] selection, 0, // final int debugLevel, clt_parameters.tileX, clt_parameters.tileY); int [][] cluster_stats1 = tileSurface.clusterStats( clusters1, // int [][] clusters, 0, // final int debugLevel, clt_parameters.tileX, clt_parameters.tileY); tileSurface.showClusterStats( cluster_stats1, // int [][] cluster_stats, clt_parameters.tsNumClust); // int max_clusters){ if (clt_parameters.tsShow){ tileSurface.showClusters( "clusters_individual", // String title, cluster_stats1, // int [][] cluster_stats, clt_parameters.tsNumClust, // int max_clusters clusters1); // int [][] clusters); // final double [][][] dispStrength) } // Try splitting (currently no initial conflicts): int [][] clusters1a = tileSurface.spitConflictClusters( clusters1, // final int [][] clusters, 0, // final int debugLevel, clt_parameters.tileX, clt_parameters.tileY); int [][] cluster_stats1a = tileSurface.clusterStats( clusters1a, // int [][] clusters, 0, // final int debugLevel, clt_parameters.tileX, clt_parameters.tileY); tileSurface.showClusterStats( cluster_stats1a, // int [][] cluster_stats, clt_parameters.tsNumClust); // int max_clusters){ boolean [][] grown_sel = tileSurface.growSelection( 2, // int grow, assigned_sel, // final boolean [][] sel_in, 0, // final int debugLevel, clt_parameters.tileX, clt_parameters.tileY); int [][] clusters2 = tileSurface.enumerateClusters( grown_sel, // final boolean [][] selection, 0, // final int debugLevel, clt_parameters.tileX, clt_parameters.tileY); int [][] cluster_stats2 = tileSurface.clusterStats( clusters2, // int [][] clusters, 0, // final int debugLevel, clt_parameters.tileX, clt_parameters.tileY); tileSurface.showClusterStats( cluster_stats2, // int [][] cluster_stats, clt_parameters.tsNumClust); // int max_clusters){ if (clt_parameters.tsShow){ tileSurface.showClusters( "clusters_merged", // String title, cluster_stats2, // int [][] cluster_stats, clt_parameters.tsNumClust, // int max_clusters clusters2); // int [][] clusters); // final double [][][] dispStrength) } // Just for testing: splitting combined clusters int [][] clusters2a = tileSurface.spitConflictClusters( clusters2, // final int [][] clusters, 0, // final int debugLevel, clt_parameters.tileX, clt_parameters.tileY); int [][] cluster_stats2a = tileSurface.clusterStats( clusters2a, // int [][] clusters, 0, // final int debugLevel, clt_parameters.tileX, clt_parameters.tileY); tileSurface.showClusterStats( cluster_stats2a, // int [][] cluster_stats, clt_parameters.tsNumClust); // int max_clusters){ if (clt_parameters.tsShow){ tileSurface.showClusters( "clusters_merged_split", // String title, cluster_stats2a, // int [][] cluster_stats, clt_parameters.tsNumClust, // int max_clusters clusters2a); // int [][] clusters); // final double [][][] dispStrength) } return true; } Loading Loading @@ -3192,6 +3300,7 @@ public class TileProcessor { // 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 Loading