Loading src/main/java/EyesisCorrectionParameters.java +89 −4 Original line number Diff line number Diff line Loading @@ -2326,6 +2326,15 @@ public class EyesisCorrectionParameters { public double tsMaxSurStrength = 0.05; // Maximal strength of the surrounded unassigned tile to join public boolean tsCountDis = true; // Include disabled tiles/borders when counting assigned neighbors public boolean tsEnPlaneSeed = true; // Assign tiles that were used to generate planes public boolean tsEnOnly = true; // Allow assignment only surface public boolean tsEnGrow = true; // Grow the only surface assignments public double tsGrowStrength = 0.01; // Maximal strength when growing the only surfaces public boolean tsGrowStrong = true; // Grow over strong if disparity matches public double tsContStrength = 0.1; // Minimal strength to continue grow with disparity match public double tsContDiff = 0.1; // Maximal normalized disparity error to grow over strong tiles public boolean tsEnSingle = true; // Allow assignment to the nearest surface with no competitors public boolean tsEnMulti = true; // Allow assignment when several surfaces fit Loading @@ -2338,6 +2347,10 @@ public class EyesisCorrectionParameters { public boolean tsShow = false; // Show results of tiles to surfaces assignment public int tsNumClust = 50; // Number of clusters to keep public int tsConsensMode = 7; // Which assignments to match +1 - combo, +2 grown single, +4 plane seeds public int tsConsensAgree = 1; // Minimal number of assignments to agree public boolean replaceWeakOutlayers = true; // false; public boolean dbg_migrate = true; Loading Loading @@ -2743,6 +2756,15 @@ public class EyesisCorrectionParameters { properties.setProperty(prefix+"tsMinNeib", this.tsMinNeib +""); properties.setProperty(prefix+"tsMaxSurStrength", this.tsMaxSurStrength +""); properties.setProperty(prefix+"tsCountDis", this.tsCountDis +""); properties.setProperty(prefix+"tsEnPlaneSeed", this.tsEnPlaneSeed+""); properties.setProperty(prefix+"tsEnOnly", this.tsEnOnly+""); properties.setProperty(prefix+"tsEnGrow", this.tsEnGrow+""); properties.setProperty(prefix+"tsGrowStrength", this.tsGrowStrength +""); properties.setProperty(prefix+"tsGrowStrong", this.tsGrowStrong+""); properties.setProperty(prefix+"tsContStrength", this.tsContStrength +""); properties.setProperty(prefix+"tsContDiff", this.tsContDiff +""); properties.setProperty(prefix+"tsEnSingle", this.tsEnSingle+""); properties.setProperty(prefix+"tsEnMulti", this.tsEnMulti+""); properties.setProperty(prefix+"tsRemoveWeak1", this.tsRemoveWeak1+""); Loading @@ -2752,6 +2774,9 @@ public class EyesisCorrectionParameters { properties.setProperty(prefix+"tsShow", this.tsShow+""); properties.setProperty(prefix+"tsNumClust", this.tsNumClust +""); properties.setProperty(prefix+"tsConsensMode", this.tsConsensMode +""); properties.setProperty(prefix+"tsConsensAgree", this.tsConsensAgree +""); properties.setProperty(prefix+"dbg_migrate", this.dbg_migrate+""); properties.setProperty(prefix+"show_ortho_combine", this.show_ortho_combine+""); Loading Loading @@ -3150,6 +3175,15 @@ public class EyesisCorrectionParameters { if (properties.getProperty(prefix+"tsMinNeib")!=null) this.tsMinNeib=Integer.parseInt(properties.getProperty(prefix+"tsMinNeib")); if (properties.getProperty(prefix+"tsMaxSurStrength")!=null) this.tsMaxSurStrength=Double.parseDouble(properties.getProperty(prefix+"tsMaxSurStrength")); if (properties.getProperty(prefix+"tsCountDis")!=null) this.tsCountDis=Boolean.parseBoolean(properties.getProperty(prefix+"tsCountDis")); if (properties.getProperty(prefix+"tsEnPlaneSeed")!=null) this.tsEnOnly=Boolean.parseBoolean(properties.getProperty(prefix+"tsEnPlaneSeed")); if (properties.getProperty(prefix+"tsEnOnly")!=null) this.tsEnOnly=Boolean.parseBoolean(properties.getProperty(prefix+"tsEnOnly")); if (properties.getProperty(prefix+"tsEnGrow")!=null) this.tsEnOnly=Boolean.parseBoolean(properties.getProperty(prefix+"tsEnGrow")); if (properties.getProperty(prefix+"tsGrowStrength")!=null) this.tsGrowStrength=Double.parseDouble(properties.getProperty(prefix+"tsGrowStrength")); if (properties.getProperty(prefix+"tsGrowStrong")!=null) this.tsGrowStrong=Boolean.parseBoolean(properties.getProperty(prefix+"tsGrowStrong")); if (properties.getProperty(prefix+"tsContStrength")!=null) this.tsGrowStrength=Double.parseDouble(properties.getProperty(prefix+"tsContStrength")); if (properties.getProperty(prefix+"tsContDiff")!=null) this.tsContDiff=Double.parseDouble(properties.getProperty(prefix+"tsContDiff")); if (properties.getProperty(prefix+"tsEnSingle")!=null) this.tsEnSingle=Boolean.parseBoolean(properties.getProperty(prefix+"tsEnSingle")); if (properties.getProperty(prefix+"tsEnMulti")!=null) this.tsEnMulti=Boolean.parseBoolean(properties.getProperty(prefix+"tsEnMulti")); if (properties.getProperty(prefix+"tsRemoveWeak1")!=null) this.tsRemoveWeak1=Boolean.parseBoolean(properties.getProperty(prefix+"tsRemoveWeak1")); Loading @@ -3160,6 +3194,8 @@ public class EyesisCorrectionParameters { 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+"tsConsensMode")!=null) this.tsConsensMode=Integer.parseInt(properties.getProperty(prefix+"tsConsensMode")); if (properties.getProperty(prefix+"tsConsensAgree")!=null) this.tsConsensAgree=Integer.parseInt(properties.getProperty(prefix+"tsConsensAgree")); if (properties.getProperty(prefix+"dbg_migrate")!=null) this.dbg_migrate=Boolean.parseBoolean(properties.getProperty(prefix+"dbg_migrate")); Loading Loading @@ -3590,6 +3626,15 @@ public class EyesisCorrectionParameters { gd.addNumericField("Minimal number of neighbors of unassigned tile to join (the farthest)", this.tsMinNeib, 0); gd.addNumericField("Maximal strength of the surrounded unassigned tile to join", this.tsMaxSurStrength, 6); gd.addCheckbox ("Include disabled tiles/borders when counting assigned neighbors", this.tsCountDis); gd.addCheckbox ("Assign tiles that were used to generate planes", this.tsEnPlaneSeed); gd.addCheckbox ("Allow assignment only surface", this.tsEnOnly); gd.addCheckbox ("Grow the only surface assignments", this.tsEnGrow); gd.addNumericField("Maximal strength when growing the only surfaces", this.tsGrowStrength, 6); gd.addCheckbox ("Grow over strong if disparity matches", this.tsGrowStrong); gd.addNumericField("Minimal strength to continue grow with disparity match", this.tsContStrength, 6); gd.addNumericField("Maximal normalized disparity error to grow over strong tiles", this.tsContDiff, 6); gd.addCheckbox ("Allow assignment to the nearest surface with no competitors", this.tsEnSingle); gd.addCheckbox ("Allow assignment when several surfaces fit", this.tsEnMulti); gd.addCheckbox ("Remove weak clusters before growing", this.tsRemoveWeak1); Loading @@ -3600,6 +3645,9 @@ public class EyesisCorrectionParameters { gd.addCheckbox ("Show results of tiles to surfaces assignment", this.tsShow); gd.addNumericField("Number of clusters to keep", this.tsNumClust, 0); gd.addNumericField("Which assignments to match +1 - combo, +2 grown single, +4 plane seeds", this.tsConsensMode, 0); gd.addNumericField("Minimal number of assignments to agree", this.tsConsensAgree, 0); gd.addCheckbox ("Test new mode after migration", this.dbg_migrate); gd.addMessage ("--- Other debug images ---"); Loading Loading @@ -4006,6 +4054,15 @@ public class EyesisCorrectionParameters { this.tsMaxSurStrength= gd.getNextNumber(); this.tsCountDis= gd.getNextBoolean(); this.tsReset = false; // Reset tiles to surfaces assignment this.tsEnPlaneSeed= gd.getNextBoolean(); this.tsEnOnly= gd.getNextBoolean(); this.tsEnGrow= gd.getNextBoolean(); this.tsGrowStrength= gd.getNextNumber(); this.tsGrowStrong= gd.getNextBoolean(); this.tsContStrength= gd.getNextNumber(); this.tsContDiff= gd.getNextNumber(); this.tsEnSingle= gd.getNextBoolean(); this.tsEnMulti= gd.getNextBoolean(); this.tsRemoveWeak1= gd.getNextBoolean(); Loading @@ -4016,6 +4073,9 @@ public class EyesisCorrectionParameters { this.tsShow = gd.getNextBoolean(); this.tsNumClust = (int) gd.getNextNumber(); this.tsConsensMode = (int) gd.getNextNumber(); this.tsConsensAgree = (int) gd.getNextNumber(); this.dbg_migrate= gd.getNextBoolean(); this.show_ortho_combine= gd.getNextBoolean(); Loading Loading @@ -4057,6 +4117,15 @@ public class EyesisCorrectionParameters { gd.addNumericField("Maximal strength of the surrounded unassigned tile to join", this.tsMaxSurStrength, 6); gd.addCheckbox ("Include disabled tiles/borders when counting assigned neighbors", this.tsCountDis); gd.addCheckbox ("Reset tiles to surfaces assignment", false); gd.addCheckbox ("Assign tiles that were used to generate planes", this.tsEnPlaneSeed); gd.addCheckbox ("Allow assignment only surface", this.tsEnOnly); gd.addCheckbox ("Grow the only surface assignments", this.tsEnGrow); gd.addNumericField("Maximal strength when growing the only surfaces", this.tsGrowStrength, 6); gd.addCheckbox ("Grow over strong if disparity matches", this.tsGrowStrong); gd.addNumericField("Minimal strength to continue grow with disparity match", this.tsContStrength, 6); gd.addNumericField("Maximal normalized disparity error to grow over strong tiles", this.tsContDiff, 6); gd.addCheckbox ("Allow assignment to the nearest surface with no competitors", this.tsEnSingle); gd.addCheckbox ("Allow assignment when several surfaces fit", this.tsEnMulti); gd.addCheckbox ("Remove weak clusters before growing", this.tsRemoveWeak1); Loading @@ -4067,6 +4136,10 @@ public class EyesisCorrectionParameters { gd.addCheckbox ("Show results of tiles to surfaces assignment", this.tsShow); gd.addNumericField("Number of clusters to keep", this.tsNumClust, 0); gd.addNumericField("Which assignments to match +1 - combo, +2 grown single, +4 plane seeds", this.tsConsensMode, 0); gd.addNumericField("Minimal number of assignments to agree", this.tsConsensAgree, 0); WindowTools.addScrollBars(gd); gd.showDialog(); if (gd.wasCanceled()) return false; Loading @@ -4091,6 +4164,15 @@ public class EyesisCorrectionParameters { this.tsMaxSurStrength= gd.getNextNumber(); this.tsCountDis= gd.getNextBoolean(); this.tsReset= gd.getNextBoolean(); this.tsEnPlaneSeed= gd.getNextBoolean(); this.tsEnOnly= gd.getNextBoolean(); this.tsEnGrow= gd.getNextBoolean(); this.tsGrowStrength= gd.getNextNumber(); this.tsGrowStrong= gd.getNextBoolean(); this.tsContStrength= gd.getNextNumber(); this.tsContDiff= gd.getNextNumber(); this.tsEnSingle= gd.getNextBoolean(); this.tsEnMulti= gd.getNextBoolean(); this.tsRemoveWeak1= gd.getNextBoolean(); Loading @@ -4100,6 +4182,9 @@ public class EyesisCorrectionParameters { this.tsLoopMulti= gd.getNextBoolean(); this.tsShow = gd.getNextBoolean(); this.tsNumClust= (int) gd.getNextNumber(); this.tsConsensMode = (int) gd.getNextNumber(); this.tsConsensAgree = (int) gd.getNextNumber(); return true; } Loading src/main/java/SurfaceData.java +1 −1 Original line number Diff line number Diff line /** ** ** SurfaceData - represents rectangualar area with per-tile disparity ** SurfaceData - represents rectangular area with per-tile disparity ** ** Copyright (C) 2017 Elphel, Inc. ** Loading src/main/java/TilePlanes.java +6 −2 Original line number Diff line number Diff line Loading @@ -104,7 +104,7 @@ public class TilePlanes { boolean preferDisparity = false; // alternative "plane" calcualtions in the world coordinates // alternative "plane" calculations in the world coordinates double [] wxyz = null; // [3] - plane center point when calculated in world coordinates (x, y , z) double [][] wvectors = null; // [3][3] - eigenvectors calculated in the real world double [] wvalues = null; // [3] -eigenvalues calculated in the real world Loading Loading @@ -3607,7 +3607,11 @@ public class TilePlanes { } copyNeib(this, pd); pd.num_points = otherPd.num_points; // restore, maybe remove from copy_neib? // copy other data from this tile pd.setMeasSelection(this.measuredSelection); if (this.measuredLayers != null) pd.measuredLayers = this.measuredLayers; if (this.sel_mask != null) pd.sel_mask = this.sel_mask.clone(); copyStar(this,pd); return pd; // make sure pd are updated // "this" is not used. Should it be used instead of pd? } Loading src/main/java/TileProcessor.java +114 −2 Original line number Diff line number Diff line Loading @@ -3128,7 +3128,7 @@ public class TileProcessor { final boolean updateStatus, final int debugLevel) { trimCLTPasses(); // make possible to run this method multiple time - remove extra passes added by it last time trimCLTPasses(); // make possible to run this method multiple times - remove extra passes added by it last time CLTPass3d scan_prev = clt_3d_passes.get(clt_3d_passes.size() -1); // get last one // boolean show_st = clt_parameters.stShow || (debugLevel > 1); SuperTiles st = scan_prev.getSuperTiles(); Loading @@ -3136,10 +3136,11 @@ public class TileProcessor { if (tileSurface == null){ return false; } /* tileSurface.testSimpleConnected( 230, // clt_parameters.tileX, 131);//clt_parameters.tileY); */ double [][][] dispStrength = st.getDisparityStrengths( clt_parameters.stMeasSel); // int stMeasSel) // = 1; // Select measurements for supertiles : +1 - combo, +2 - quad +4 - hor +8 - vert) Loading @@ -3148,14 +3149,88 @@ public class TileProcessor { clt_parameters.stMeasSel); // int stMeasSel) // = 1; // Select measurements for supertiles : +1 - combo, +2 - quad +4 - hor +8 - vert) // Reset/initialize assignments - if not done so yet or specifically requested boolean first_run = !tileSurface.isInit() || clt_parameters.tsReset; tileSurface.InitTilesAssignment( clt_parameters.tsReset, dispStrength, // final double [][][] dispStrength, tileSel, // final boolean [][] tileSel, debugLevel); // final int debugLevel, // assign tiles that do not depend on other assigned tiles - single pass int [][] tile_layers = tileSurface.getTileLayersCopy(); int [][] tile_layers_single_surf = tileSurface.newTileLayers(tileSel); // final boolean [][] tileSel,) int [][] tile_layers_planes = tileSurface.newTileLayers(tileSel); // final boolean [][] tileSel,) int [] stats_single_surf= tileSurface.assignTilesToSingleSurface( tile_layers_single_surf, //final int [][] tileLayers, clt_parameters.tsNoEdge , // final boolean noEdge, 0, // -1, // debugLevel, // final int debugLevel) clt_parameters.tileX, clt_parameters.tileY); System.out.print("Assign the only surface :"); tileSurface.printStats(stats_single_surf); // grow the only surface assignments if (clt_parameters.tsEnGrow){ double [] growStrengths = new double [tile_layers_single_surf.length]; double [] contMinStrengths = new double [tile_layers_single_surf.length]; double [] growMaxDiffFar = new double [tile_layers_single_surf.length]; double [] growMaxDiffNear = new double [tile_layers_single_surf.length]; int [][] assign_conflicts = null; for (int i = 0; i < growStrengths.length; i++){ growStrengths[i] = clt_parameters.tsGrowStrength; // save all the same, later can use different for different types of correlation contMinStrengths[i] = clt_parameters.tsContStrength; growMaxDiffFar[i]= clt_parameters.tsContDiff; growMaxDiffNear[i]= clt_parameters.tsContDiff; if ((tile_layers_single_surf[i] != null) && (assign_conflicts == null)){ assign_conflicts = new int[tile_layers_single_surf[i].length][]; } } stats_single_surf = tileSurface.growWeakAssigned( tile_layers_single_surf, //final int [][] tileLayers, assign_conflicts, // final int [][] conflicts, clt_parameters.tsNoEdge , // final boolean noEdge, growStrengths, // final double [] maxStrength, (clt_parameters.tsGrowStrong? contMinStrengths: null), //final double [] minStrengthContinue, (clt_parameters.tsEnGrow? growMaxDiffFar: null), // final double [] maxDiffFar, // null (clt_parameters.tsEnGrow? growMaxDiffNear: null), // final double [] maxDiffNear, // null clt_parameters.plDispNorm, // final double dispNorm, // disparity normalize (proportionally scale down disparity difference if above dispStrength, // final double [][][] dispStrength, 2, // -1, // debugLevel, // final int debugLevel) clt_parameters.tileX, clt_parameters.tileY); System.out.print("growWeakAssigned():"); tileSurface.printStats(stats_single_surf); } int [] stats_planes = tileSurface.assignPlanesTiles( true, // final boolean force, tile_layers_planes, //final int [][] tileLayers, st.planes_mod, // final TilePlanes.PlaneData[][] planes, 2, // -1, // debugLevel, // final int debugLevel) clt_parameters.tileX, clt_parameters.tileY); System.out.print("assignPlanesTiles():"); tileSurface.printStats(stats_planes); if (clt_parameters.tsEnOnly){ tileSurface.combineTileLayers( true, // final boolean overwrite, tile_layers, // final int [][] dst, tile_layers_single_surf); // final int [][] src); } if (clt_parameters.tsEnPlaneSeed) { tileSurface.combineTileLayers( true, // final boolean overwrite, tile_layers, // final int [][] dst, tile_layers_planes); // final int [][] src); } if (clt_parameters.tsEnSingle) { int [] stats= tileSurface.assignTilesToSurfaces( tile_layers, //final int [][] tileLayers, clt_parameters.tsNoEdge , // final boolean noEdge, clt_parameters.tsUseCenter, // final boolean useCenter, clt_parameters.tsMaxDiff, //final double maxDiff, Loading Loading @@ -3185,6 +3260,7 @@ public class TileProcessor { if (clt_parameters.tsEnMulti) { for (int nTry = 0; nTry < 100; nTry++) { int [] stats= tileSurface.assignTilesToSurfaces( tile_layers, //final int [][] tileLayers, clt_parameters.tsNoEdge , // final boolean noEdge, clt_parameters.tsUseCenter, // final boolean useCenter, clt_parameters.tsMaxDiff, //final double maxDiff, Loading Loading @@ -3217,6 +3293,7 @@ public class TileProcessor { // Single pass, before growing assigned tiles if (clt_parameters.tsRemoveWeak1) { int [] stats= tileSurface.removeSmallClusters( tile_layers, //final int [][] tileLayers, clt_parameters.tsClustSize , // final int minSize, // ** clt_parameters. tsClustWeight, // final double minStrength, // ** dispStrength, // final double [][][] dispStrength, Loading @@ -3232,6 +3309,7 @@ public class TileProcessor { if (clt_parameters.tsGrowSurround) { for (int nTry = 0; nTry < 100; nTry++) { int [] stats= tileSurface.assignFromFarthest( tile_layers, //final int [][] tileLayers, clt_parameters.tsNoEdge , // final boolean noEdge, clt_parameters.tsMinNeib , // final int minNeib, // ** clt_parameters.tsMaxSurStrength , // final double maxStrength, // ** Loading @@ -3255,6 +3333,7 @@ public class TileProcessor { // Single pass, after growing assigned tiles if (clt_parameters.tsRemoveWeak2) { int [] stats= tileSurface.removeSmallClusters( tile_layers, //final int [][] tileLayers, clt_parameters.tsClustSize , // final int minSize, // ** clt_parameters. tsClustWeight, // final double minStrength, // ** dispStrength, // final double [][][] dispStrength, Loading @@ -3263,6 +3342,39 @@ public class TileProcessor { clt_parameters.tileY); tileSurface.printStats(stats); } // Just show current state tileSurface.statTileLayers( tile_layers, // final int [][] tileLayers, tileSel, // final boolean [][] tileSel, 1); // final int debugLevel) // removed tile_layers from globals, so multiple parallel assignments can be generated and then combined // int [][] tile_layers = tileSurface.getTileLayersCopy(); // int [][] tile_layers_single_surf = tileSurface.newTileLayers(tileSel); // final boolean [][] tileSel,) // int [][] tile_layers_planes = tileSurface.newTileLayers(tileSel); // final boolean [][] tileSel,) int [][][] tile_assignments = {tile_layers, tile_layers_single_surf, tile_layers_planes}; for (int i = 0; i < tile_assignments.length; i++){ if ((clt_parameters.tsConsensMode & (1 << i)) == 0) { tile_assignments[i] = null; } } tileSurface.compareAssignments( tile_assignments); // final int [][][] tileAssignments) int [][][] opinions = new int [tile_layers.length][][]; tile_layers = tileSurface.getConsensusAssignment( clt_parameters.tsConsensAgree, // final int min_agree, opinions, // int [][][] opinions_in, tile_assignments); // final int [][][] tileAssignments) tileSurface.setTileLayers(tile_layers); // Just show current state tileSurface.InitTilesAssignment( false, Loading Loading
src/main/java/EyesisCorrectionParameters.java +89 −4 Original line number Diff line number Diff line Loading @@ -2326,6 +2326,15 @@ public class EyesisCorrectionParameters { public double tsMaxSurStrength = 0.05; // Maximal strength of the surrounded unassigned tile to join public boolean tsCountDis = true; // Include disabled tiles/borders when counting assigned neighbors public boolean tsEnPlaneSeed = true; // Assign tiles that were used to generate planes public boolean tsEnOnly = true; // Allow assignment only surface public boolean tsEnGrow = true; // Grow the only surface assignments public double tsGrowStrength = 0.01; // Maximal strength when growing the only surfaces public boolean tsGrowStrong = true; // Grow over strong if disparity matches public double tsContStrength = 0.1; // Minimal strength to continue grow with disparity match public double tsContDiff = 0.1; // Maximal normalized disparity error to grow over strong tiles public boolean tsEnSingle = true; // Allow assignment to the nearest surface with no competitors public boolean tsEnMulti = true; // Allow assignment when several surfaces fit Loading @@ -2338,6 +2347,10 @@ public class EyesisCorrectionParameters { public boolean tsShow = false; // Show results of tiles to surfaces assignment public int tsNumClust = 50; // Number of clusters to keep public int tsConsensMode = 7; // Which assignments to match +1 - combo, +2 grown single, +4 plane seeds public int tsConsensAgree = 1; // Minimal number of assignments to agree public boolean replaceWeakOutlayers = true; // false; public boolean dbg_migrate = true; Loading Loading @@ -2743,6 +2756,15 @@ public class EyesisCorrectionParameters { properties.setProperty(prefix+"tsMinNeib", this.tsMinNeib +""); properties.setProperty(prefix+"tsMaxSurStrength", this.tsMaxSurStrength +""); properties.setProperty(prefix+"tsCountDis", this.tsCountDis +""); properties.setProperty(prefix+"tsEnPlaneSeed", this.tsEnPlaneSeed+""); properties.setProperty(prefix+"tsEnOnly", this.tsEnOnly+""); properties.setProperty(prefix+"tsEnGrow", this.tsEnGrow+""); properties.setProperty(prefix+"tsGrowStrength", this.tsGrowStrength +""); properties.setProperty(prefix+"tsGrowStrong", this.tsGrowStrong+""); properties.setProperty(prefix+"tsContStrength", this.tsContStrength +""); properties.setProperty(prefix+"tsContDiff", this.tsContDiff +""); properties.setProperty(prefix+"tsEnSingle", this.tsEnSingle+""); properties.setProperty(prefix+"tsEnMulti", this.tsEnMulti+""); properties.setProperty(prefix+"tsRemoveWeak1", this.tsRemoveWeak1+""); Loading @@ -2752,6 +2774,9 @@ public class EyesisCorrectionParameters { properties.setProperty(prefix+"tsShow", this.tsShow+""); properties.setProperty(prefix+"tsNumClust", this.tsNumClust +""); properties.setProperty(prefix+"tsConsensMode", this.tsConsensMode +""); properties.setProperty(prefix+"tsConsensAgree", this.tsConsensAgree +""); properties.setProperty(prefix+"dbg_migrate", this.dbg_migrate+""); properties.setProperty(prefix+"show_ortho_combine", this.show_ortho_combine+""); Loading Loading @@ -3150,6 +3175,15 @@ public class EyesisCorrectionParameters { if (properties.getProperty(prefix+"tsMinNeib")!=null) this.tsMinNeib=Integer.parseInt(properties.getProperty(prefix+"tsMinNeib")); if (properties.getProperty(prefix+"tsMaxSurStrength")!=null) this.tsMaxSurStrength=Double.parseDouble(properties.getProperty(prefix+"tsMaxSurStrength")); if (properties.getProperty(prefix+"tsCountDis")!=null) this.tsCountDis=Boolean.parseBoolean(properties.getProperty(prefix+"tsCountDis")); if (properties.getProperty(prefix+"tsEnPlaneSeed")!=null) this.tsEnOnly=Boolean.parseBoolean(properties.getProperty(prefix+"tsEnPlaneSeed")); if (properties.getProperty(prefix+"tsEnOnly")!=null) this.tsEnOnly=Boolean.parseBoolean(properties.getProperty(prefix+"tsEnOnly")); if (properties.getProperty(prefix+"tsEnGrow")!=null) this.tsEnOnly=Boolean.parseBoolean(properties.getProperty(prefix+"tsEnGrow")); if (properties.getProperty(prefix+"tsGrowStrength")!=null) this.tsGrowStrength=Double.parseDouble(properties.getProperty(prefix+"tsGrowStrength")); if (properties.getProperty(prefix+"tsGrowStrong")!=null) this.tsGrowStrong=Boolean.parseBoolean(properties.getProperty(prefix+"tsGrowStrong")); if (properties.getProperty(prefix+"tsContStrength")!=null) this.tsGrowStrength=Double.parseDouble(properties.getProperty(prefix+"tsContStrength")); if (properties.getProperty(prefix+"tsContDiff")!=null) this.tsContDiff=Double.parseDouble(properties.getProperty(prefix+"tsContDiff")); if (properties.getProperty(prefix+"tsEnSingle")!=null) this.tsEnSingle=Boolean.parseBoolean(properties.getProperty(prefix+"tsEnSingle")); if (properties.getProperty(prefix+"tsEnMulti")!=null) this.tsEnMulti=Boolean.parseBoolean(properties.getProperty(prefix+"tsEnMulti")); if (properties.getProperty(prefix+"tsRemoveWeak1")!=null) this.tsRemoveWeak1=Boolean.parseBoolean(properties.getProperty(prefix+"tsRemoveWeak1")); Loading @@ -3160,6 +3194,8 @@ public class EyesisCorrectionParameters { 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+"tsConsensMode")!=null) this.tsConsensMode=Integer.parseInt(properties.getProperty(prefix+"tsConsensMode")); if (properties.getProperty(prefix+"tsConsensAgree")!=null) this.tsConsensAgree=Integer.parseInt(properties.getProperty(prefix+"tsConsensAgree")); if (properties.getProperty(prefix+"dbg_migrate")!=null) this.dbg_migrate=Boolean.parseBoolean(properties.getProperty(prefix+"dbg_migrate")); Loading Loading @@ -3590,6 +3626,15 @@ public class EyesisCorrectionParameters { gd.addNumericField("Minimal number of neighbors of unassigned tile to join (the farthest)", this.tsMinNeib, 0); gd.addNumericField("Maximal strength of the surrounded unassigned tile to join", this.tsMaxSurStrength, 6); gd.addCheckbox ("Include disabled tiles/borders when counting assigned neighbors", this.tsCountDis); gd.addCheckbox ("Assign tiles that were used to generate planes", this.tsEnPlaneSeed); gd.addCheckbox ("Allow assignment only surface", this.tsEnOnly); gd.addCheckbox ("Grow the only surface assignments", this.tsEnGrow); gd.addNumericField("Maximal strength when growing the only surfaces", this.tsGrowStrength, 6); gd.addCheckbox ("Grow over strong if disparity matches", this.tsGrowStrong); gd.addNumericField("Minimal strength to continue grow with disparity match", this.tsContStrength, 6); gd.addNumericField("Maximal normalized disparity error to grow over strong tiles", this.tsContDiff, 6); gd.addCheckbox ("Allow assignment to the nearest surface with no competitors", this.tsEnSingle); gd.addCheckbox ("Allow assignment when several surfaces fit", this.tsEnMulti); gd.addCheckbox ("Remove weak clusters before growing", this.tsRemoveWeak1); Loading @@ -3600,6 +3645,9 @@ public class EyesisCorrectionParameters { gd.addCheckbox ("Show results of tiles to surfaces assignment", this.tsShow); gd.addNumericField("Number of clusters to keep", this.tsNumClust, 0); gd.addNumericField("Which assignments to match +1 - combo, +2 grown single, +4 plane seeds", this.tsConsensMode, 0); gd.addNumericField("Minimal number of assignments to agree", this.tsConsensAgree, 0); gd.addCheckbox ("Test new mode after migration", this.dbg_migrate); gd.addMessage ("--- Other debug images ---"); Loading Loading @@ -4006,6 +4054,15 @@ public class EyesisCorrectionParameters { this.tsMaxSurStrength= gd.getNextNumber(); this.tsCountDis= gd.getNextBoolean(); this.tsReset = false; // Reset tiles to surfaces assignment this.tsEnPlaneSeed= gd.getNextBoolean(); this.tsEnOnly= gd.getNextBoolean(); this.tsEnGrow= gd.getNextBoolean(); this.tsGrowStrength= gd.getNextNumber(); this.tsGrowStrong= gd.getNextBoolean(); this.tsContStrength= gd.getNextNumber(); this.tsContDiff= gd.getNextNumber(); this.tsEnSingle= gd.getNextBoolean(); this.tsEnMulti= gd.getNextBoolean(); this.tsRemoveWeak1= gd.getNextBoolean(); Loading @@ -4016,6 +4073,9 @@ public class EyesisCorrectionParameters { this.tsShow = gd.getNextBoolean(); this.tsNumClust = (int) gd.getNextNumber(); this.tsConsensMode = (int) gd.getNextNumber(); this.tsConsensAgree = (int) gd.getNextNumber(); this.dbg_migrate= gd.getNextBoolean(); this.show_ortho_combine= gd.getNextBoolean(); Loading Loading @@ -4057,6 +4117,15 @@ public class EyesisCorrectionParameters { gd.addNumericField("Maximal strength of the surrounded unassigned tile to join", this.tsMaxSurStrength, 6); gd.addCheckbox ("Include disabled tiles/borders when counting assigned neighbors", this.tsCountDis); gd.addCheckbox ("Reset tiles to surfaces assignment", false); gd.addCheckbox ("Assign tiles that were used to generate planes", this.tsEnPlaneSeed); gd.addCheckbox ("Allow assignment only surface", this.tsEnOnly); gd.addCheckbox ("Grow the only surface assignments", this.tsEnGrow); gd.addNumericField("Maximal strength when growing the only surfaces", this.tsGrowStrength, 6); gd.addCheckbox ("Grow over strong if disparity matches", this.tsGrowStrong); gd.addNumericField("Minimal strength to continue grow with disparity match", this.tsContStrength, 6); gd.addNumericField("Maximal normalized disparity error to grow over strong tiles", this.tsContDiff, 6); gd.addCheckbox ("Allow assignment to the nearest surface with no competitors", this.tsEnSingle); gd.addCheckbox ("Allow assignment when several surfaces fit", this.tsEnMulti); gd.addCheckbox ("Remove weak clusters before growing", this.tsRemoveWeak1); Loading @@ -4067,6 +4136,10 @@ public class EyesisCorrectionParameters { gd.addCheckbox ("Show results of tiles to surfaces assignment", this.tsShow); gd.addNumericField("Number of clusters to keep", this.tsNumClust, 0); gd.addNumericField("Which assignments to match +1 - combo, +2 grown single, +4 plane seeds", this.tsConsensMode, 0); gd.addNumericField("Minimal number of assignments to agree", this.tsConsensAgree, 0); WindowTools.addScrollBars(gd); gd.showDialog(); if (gd.wasCanceled()) return false; Loading @@ -4091,6 +4164,15 @@ public class EyesisCorrectionParameters { this.tsMaxSurStrength= gd.getNextNumber(); this.tsCountDis= gd.getNextBoolean(); this.tsReset= gd.getNextBoolean(); this.tsEnPlaneSeed= gd.getNextBoolean(); this.tsEnOnly= gd.getNextBoolean(); this.tsEnGrow= gd.getNextBoolean(); this.tsGrowStrength= gd.getNextNumber(); this.tsGrowStrong= gd.getNextBoolean(); this.tsContStrength= gd.getNextNumber(); this.tsContDiff= gd.getNextNumber(); this.tsEnSingle= gd.getNextBoolean(); this.tsEnMulti= gd.getNextBoolean(); this.tsRemoveWeak1= gd.getNextBoolean(); Loading @@ -4100,6 +4182,9 @@ public class EyesisCorrectionParameters { this.tsLoopMulti= gd.getNextBoolean(); this.tsShow = gd.getNextBoolean(); this.tsNumClust= (int) gd.getNextNumber(); this.tsConsensMode = (int) gd.getNextNumber(); this.tsConsensAgree = (int) gd.getNextNumber(); return true; } Loading
src/main/java/SurfaceData.java +1 −1 Original line number Diff line number Diff line /** ** ** SurfaceData - represents rectangualar area with per-tile disparity ** SurfaceData - represents rectangular area with per-tile disparity ** ** Copyright (C) 2017 Elphel, Inc. ** Loading
src/main/java/TilePlanes.java +6 −2 Original line number Diff line number Diff line Loading @@ -104,7 +104,7 @@ public class TilePlanes { boolean preferDisparity = false; // alternative "plane" calcualtions in the world coordinates // alternative "plane" calculations in the world coordinates double [] wxyz = null; // [3] - plane center point when calculated in world coordinates (x, y , z) double [][] wvectors = null; // [3][3] - eigenvectors calculated in the real world double [] wvalues = null; // [3] -eigenvalues calculated in the real world Loading Loading @@ -3607,7 +3607,11 @@ public class TilePlanes { } copyNeib(this, pd); pd.num_points = otherPd.num_points; // restore, maybe remove from copy_neib? // copy other data from this tile pd.setMeasSelection(this.measuredSelection); if (this.measuredLayers != null) pd.measuredLayers = this.measuredLayers; if (this.sel_mask != null) pd.sel_mask = this.sel_mask.clone(); copyStar(this,pd); return pd; // make sure pd are updated // "this" is not used. Should it be used instead of pd? } Loading
src/main/java/TileProcessor.java +114 −2 Original line number Diff line number Diff line Loading @@ -3128,7 +3128,7 @@ public class TileProcessor { final boolean updateStatus, final int debugLevel) { trimCLTPasses(); // make possible to run this method multiple time - remove extra passes added by it last time trimCLTPasses(); // make possible to run this method multiple times - remove extra passes added by it last time CLTPass3d scan_prev = clt_3d_passes.get(clt_3d_passes.size() -1); // get last one // boolean show_st = clt_parameters.stShow || (debugLevel > 1); SuperTiles st = scan_prev.getSuperTiles(); Loading @@ -3136,10 +3136,11 @@ public class TileProcessor { if (tileSurface == null){ return false; } /* tileSurface.testSimpleConnected( 230, // clt_parameters.tileX, 131);//clt_parameters.tileY); */ double [][][] dispStrength = st.getDisparityStrengths( clt_parameters.stMeasSel); // int stMeasSel) // = 1; // Select measurements for supertiles : +1 - combo, +2 - quad +4 - hor +8 - vert) Loading @@ -3148,14 +3149,88 @@ public class TileProcessor { clt_parameters.stMeasSel); // int stMeasSel) // = 1; // Select measurements for supertiles : +1 - combo, +2 - quad +4 - hor +8 - vert) // Reset/initialize assignments - if not done so yet or specifically requested boolean first_run = !tileSurface.isInit() || clt_parameters.tsReset; tileSurface.InitTilesAssignment( clt_parameters.tsReset, dispStrength, // final double [][][] dispStrength, tileSel, // final boolean [][] tileSel, debugLevel); // final int debugLevel, // assign tiles that do not depend on other assigned tiles - single pass int [][] tile_layers = tileSurface.getTileLayersCopy(); int [][] tile_layers_single_surf = tileSurface.newTileLayers(tileSel); // final boolean [][] tileSel,) int [][] tile_layers_planes = tileSurface.newTileLayers(tileSel); // final boolean [][] tileSel,) int [] stats_single_surf= tileSurface.assignTilesToSingleSurface( tile_layers_single_surf, //final int [][] tileLayers, clt_parameters.tsNoEdge , // final boolean noEdge, 0, // -1, // debugLevel, // final int debugLevel) clt_parameters.tileX, clt_parameters.tileY); System.out.print("Assign the only surface :"); tileSurface.printStats(stats_single_surf); // grow the only surface assignments if (clt_parameters.tsEnGrow){ double [] growStrengths = new double [tile_layers_single_surf.length]; double [] contMinStrengths = new double [tile_layers_single_surf.length]; double [] growMaxDiffFar = new double [tile_layers_single_surf.length]; double [] growMaxDiffNear = new double [tile_layers_single_surf.length]; int [][] assign_conflicts = null; for (int i = 0; i < growStrengths.length; i++){ growStrengths[i] = clt_parameters.tsGrowStrength; // save all the same, later can use different for different types of correlation contMinStrengths[i] = clt_parameters.tsContStrength; growMaxDiffFar[i]= clt_parameters.tsContDiff; growMaxDiffNear[i]= clt_parameters.tsContDiff; if ((tile_layers_single_surf[i] != null) && (assign_conflicts == null)){ assign_conflicts = new int[tile_layers_single_surf[i].length][]; } } stats_single_surf = tileSurface.growWeakAssigned( tile_layers_single_surf, //final int [][] tileLayers, assign_conflicts, // final int [][] conflicts, clt_parameters.tsNoEdge , // final boolean noEdge, growStrengths, // final double [] maxStrength, (clt_parameters.tsGrowStrong? contMinStrengths: null), //final double [] minStrengthContinue, (clt_parameters.tsEnGrow? growMaxDiffFar: null), // final double [] maxDiffFar, // null (clt_parameters.tsEnGrow? growMaxDiffNear: null), // final double [] maxDiffNear, // null clt_parameters.plDispNorm, // final double dispNorm, // disparity normalize (proportionally scale down disparity difference if above dispStrength, // final double [][][] dispStrength, 2, // -1, // debugLevel, // final int debugLevel) clt_parameters.tileX, clt_parameters.tileY); System.out.print("growWeakAssigned():"); tileSurface.printStats(stats_single_surf); } int [] stats_planes = tileSurface.assignPlanesTiles( true, // final boolean force, tile_layers_planes, //final int [][] tileLayers, st.planes_mod, // final TilePlanes.PlaneData[][] planes, 2, // -1, // debugLevel, // final int debugLevel) clt_parameters.tileX, clt_parameters.tileY); System.out.print("assignPlanesTiles():"); tileSurface.printStats(stats_planes); if (clt_parameters.tsEnOnly){ tileSurface.combineTileLayers( true, // final boolean overwrite, tile_layers, // final int [][] dst, tile_layers_single_surf); // final int [][] src); } if (clt_parameters.tsEnPlaneSeed) { tileSurface.combineTileLayers( true, // final boolean overwrite, tile_layers, // final int [][] dst, tile_layers_planes); // final int [][] src); } if (clt_parameters.tsEnSingle) { int [] stats= tileSurface.assignTilesToSurfaces( tile_layers, //final int [][] tileLayers, clt_parameters.tsNoEdge , // final boolean noEdge, clt_parameters.tsUseCenter, // final boolean useCenter, clt_parameters.tsMaxDiff, //final double maxDiff, Loading Loading @@ -3185,6 +3260,7 @@ public class TileProcessor { if (clt_parameters.tsEnMulti) { for (int nTry = 0; nTry < 100; nTry++) { int [] stats= tileSurface.assignTilesToSurfaces( tile_layers, //final int [][] tileLayers, clt_parameters.tsNoEdge , // final boolean noEdge, clt_parameters.tsUseCenter, // final boolean useCenter, clt_parameters.tsMaxDiff, //final double maxDiff, Loading Loading @@ -3217,6 +3293,7 @@ public class TileProcessor { // Single pass, before growing assigned tiles if (clt_parameters.tsRemoveWeak1) { int [] stats= tileSurface.removeSmallClusters( tile_layers, //final int [][] tileLayers, clt_parameters.tsClustSize , // final int minSize, // ** clt_parameters. tsClustWeight, // final double minStrength, // ** dispStrength, // final double [][][] dispStrength, Loading @@ -3232,6 +3309,7 @@ public class TileProcessor { if (clt_parameters.tsGrowSurround) { for (int nTry = 0; nTry < 100; nTry++) { int [] stats= tileSurface.assignFromFarthest( tile_layers, //final int [][] tileLayers, clt_parameters.tsNoEdge , // final boolean noEdge, clt_parameters.tsMinNeib , // final int minNeib, // ** clt_parameters.tsMaxSurStrength , // final double maxStrength, // ** Loading @@ -3255,6 +3333,7 @@ public class TileProcessor { // Single pass, after growing assigned tiles if (clt_parameters.tsRemoveWeak2) { int [] stats= tileSurface.removeSmallClusters( tile_layers, //final int [][] tileLayers, clt_parameters.tsClustSize , // final int minSize, // ** clt_parameters. tsClustWeight, // final double minStrength, // ** dispStrength, // final double [][][] dispStrength, Loading @@ -3263,6 +3342,39 @@ public class TileProcessor { clt_parameters.tileY); tileSurface.printStats(stats); } // Just show current state tileSurface.statTileLayers( tile_layers, // final int [][] tileLayers, tileSel, // final boolean [][] tileSel, 1); // final int debugLevel) // removed tile_layers from globals, so multiple parallel assignments can be generated and then combined // int [][] tile_layers = tileSurface.getTileLayersCopy(); // int [][] tile_layers_single_surf = tileSurface.newTileLayers(tileSel); // final boolean [][] tileSel,) // int [][] tile_layers_planes = tileSurface.newTileLayers(tileSel); // final boolean [][] tileSel,) int [][][] tile_assignments = {tile_layers, tile_layers_single_surf, tile_layers_planes}; for (int i = 0; i < tile_assignments.length; i++){ if ((clt_parameters.tsConsensMode & (1 << i)) == 0) { tile_assignments[i] = null; } } tileSurface.compareAssignments( tile_assignments); // final int [][][] tileAssignments) int [][][] opinions = new int [tile_layers.length][][]; tile_layers = tileSurface.getConsensusAssignment( clt_parameters.tsConsensAgree, // final int min_agree, opinions, // int [][][] opinions_in, tile_assignments); // final int [][][] tileAssignments) tileSurface.setTileLayers(tile_layers); // Just show current state tileSurface.InitTilesAssignment( false, Loading