Loading src/main/java/ConnectionCosts.java +29 −14 Original line number Original line Diff line number Diff line Loading @@ -32,6 +32,7 @@ public class ConnectionCosts { double orthoWeight; double orthoWeight; double diagonalWeight; double diagonalWeight; double starPwr; // Divide cost by number of connections to this power double starPwr; // Divide cost by number of connections to this power double starValPwr; // Raise value of each tile before averaging int steps; int steps; int [][][] neibs_init; int [][][] neibs_init; int [] mod_tiles; int [] mod_tiles; Loading @@ -47,6 +48,7 @@ public class ConnectionCosts { double orthoWeight, double orthoWeight, double diagonalWeight, double diagonalWeight, double starPwr, // Divide cost by number of connections to this power double starPwr, // Divide cost by number of connections to this power double starValPwr, // Raise value of each tile before averaging int steps, int steps, TilePlanes.PlaneData [][] planes, TilePlanes.PlaneData [][] planes, TileSurface.TileNeibs tnSurface, TileSurface.TileNeibs tnSurface, Loading @@ -58,6 +60,7 @@ public class ConnectionCosts { this.orthoWeight = orthoWeight; this.orthoWeight = orthoWeight; this.diagonalWeight = diagonalWeight; this.diagonalWeight = diagonalWeight; this.starPwr = starPwr; // Divide cost by number of connections to this power this.starPwr = starPwr; // Divide cost by number of connections to this power this.starValPwr = starValPwr; // Raise value of each tile before averaging this.steps = steps; this.steps = steps; } } Loading Loading @@ -124,13 +127,16 @@ public class ConnectionCosts { for (int isTile = 0; isTile < all_tiles.length; isTile++){ for (int isTile = 0; isTile < all_tiles.length; isTile++){ if (val_weights[isTile] != null){ if (val_weights[isTile] != null){ for (int nl = 0; nl < val_weights[isTile].length; nl++) if ( val_weights[isTile][nl] != null){ for (int nl = 0; nl < val_weights[isTile].length; nl++) if ( val_weights[isTile][nl] != null){ init_val += val_weights[isTile][nl][0] * val_weights[isTile][nl][1]; double val = val_weights[isTile][nl][0]; if (starValPwr != 1.0) val = Math.pow(val, starValPwr); init_val += val * val_weights[isTile][nl][1]; init_weight += val_weights[isTile][nl][1]; init_weight += val_weights[isTile][nl][1]; } } } } } } // Likely weight will never change except first run, but we will still normalize by weight // Likely weight will never change except first run, but we will still normalize by weight if (init_weight != 0.0) init_val /= init_weight; // if (starValPwr != 1.0) init_val = Math.pow(init_val, 1.0/starValPwr); // if (init_weight != 0.0) init_val /= init_weight; return neibs_init; // neighbors to clone return neibs_init; // neighbors to clone } } Loading Loading @@ -197,6 +203,7 @@ public class ConnectionCosts { orthoWeight, orthoWeight, diagonalWeight, diagonalWeight, starPwr, // double starPwr, // Divide cost by number of connections to this power starPwr, // double starPwr, // Divide cost by number of connections to this power // starValPwr, //double starValPwr, // Raise value of each tile before averaging tnSurface, tnSurface, preferDisparity, preferDisparity, -1); // debugLevel); -1); // debugLevel); Loading Loading @@ -269,6 +276,7 @@ public class ConnectionCosts { orthoWeight, orthoWeight, diagonalWeight, diagonalWeight, starPwr, // double starPwr, // Divide cost by number of connections to this power starPwr, // double starPwr, // Divide cost by number of connections to this power // starValPwr, //double starValPwr, // Raise value of each tile before averaging tnSurface, tnSurface, preferDisparity, preferDisparity, -1); // debugLevel); -1); // debugLevel); Loading Loading @@ -317,12 +325,16 @@ public class ConnectionCosts { for (int isTile = 0; isTile < all_tiles.length; isTile++){ for (int isTile = 0; isTile < all_tiles.length; isTile++){ if (vw[isTile] != null){ if (vw[isTile] != null){ for (int nl = 0; nl < vw[isTile].length; nl++) if ( vw[isTile][nl] != null){ for (int nl = 0; nl < vw[isTile].length; nl++) if ( vw[isTile][nl] != null){ new_value += vw[isTile][nl][0] * vw[isTile][nl][1]; double val = vw[isTile][nl][0]; if (starValPwr != 1.0) val = Math.pow(val, starValPwr); new_value += val * vw[isTile][nl][1]; new_weight += vw[isTile][nl][1]; new_weight += vw[isTile][nl][1]; } } } } } } if (new_weight != 0.0) new_value /= new_weight; // if (starValPwr != 1.0) new_value = Math.pow(new_value, 1.0/starValPwr); // if (new_weight != 0.0) new_value /= new_weight; return new_value - init_val; // negative - improvement return new_value - init_val; // negative - improvement } } Loading Loading @@ -350,11 +362,12 @@ public class ConnectionCosts { double orthoWeight, double orthoWeight, double diagonalWeight, double diagonalWeight, double starPwr, // Divide cost by number of connections to this power double starPwr, // Divide cost by number of connections to this power // double starValPwr, // Raise value of each tile before averaging TileSurface.TileNeibs tnSurface, TileSurface.TileNeibs tnSurface, boolean preferDisparity, boolean preferDisparity, int debugLevel) int debugLevel) { { TilePlanes.PlaneData merged_plane = planes[nsTile][nl]; TilePlanes.PlaneData merged_plane = planes[nsTile][nl]; // add weight for (int dir = 0; dir < 8; dir++){ for (int dir = 0; dir < 8; dir++){ if (neibs[dir] >= 0){ if (neibs[dir] >= 0){ double other_weight = ((dir & 1) != 0) ? diagonalWeight : orthoWeight; double other_weight = ((dir & 1) != 0) ? diagonalWeight : orthoWeight; Loading Loading @@ -404,6 +417,7 @@ public class ConnectionCosts { double orthoWeight, double orthoWeight, double diagonalWeight, double diagonalWeight, double starPwr, // Divide cost by number of connections to this power double starPwr, // Divide cost by number of connections to this power // double starValPwr, // Raise value of each tile before averaging TileSurface.TileNeibs tnSurface, TileSurface.TileNeibs tnSurface, boolean preferDisparity, boolean preferDisparity, int debugLevel) int debugLevel) Loading @@ -417,7 +431,8 @@ public class ConnectionCosts { double weight1 = dir_weight[dir]; double weight1 = dir_weight[dir]; tile_weights.put(new Point(nsTile1, nl1), new Double(weight1)); // no need to check for existence here tile_weights.put(new Point(nsTile1, nl1), new Double(weight1)); // no need to check for existence here for (int dir1 = 0; dir1 < 8; dir1++){ for (int dir1 = 0; dir1 < 8; dir1++){ if ((dir1 != dir) && (neibs2[dir]!= null)){ // if ((dir1 != dir) && (neibs2[dir]!= null)){ if ((dir1 != ((dir + 4) %8)) && (neibs2[dir1]!= null)){ // not backwards to the center and exists int nl2 =neibs2[dir][dir1]; int nl2 =neibs2[dir][dir1]; if (nl2 >= 0){ if (nl2 >= 0){ Point p = new Point (tnSurface.getNeibIndex(nsTile1, dir1), nl2); Point p = new Point (tnSurface.getNeibIndex(nsTile1, dir1), nl2); Loading src/main/java/EyesisCorrectionParameters.java +18 −3 Original line number Original line Diff line number Diff line Loading @@ -2170,8 +2170,9 @@ public class EyesisCorrectionParameters { public double plMinStrength = 0.1; // Minimal total strength of a plane public double plMinStrength = 0.1; // Minimal total strength of a plane public double plMaxEigen = 0.3; // Maximal eigenvalue of a plane public double plMaxEigen = 0.3; // Maximal eigenvalue of a plane public boolean plDbgMerge = true; // Combine 'other' plane with current public boolean plDbgMerge = true; // Combine 'other' plane with current public double plWorstWorsening = 3.0; // Worst case worsening after merge public double plWorstWorsening = 2.0; // Worst case worsening after merge public double plOKMergeEigen = 0.03; // If result of the merged planes is below, OK to bypass worst worsening public double plWorstWorsening2 = 5.0; // Worst case worsening for thin planes public double plOKMergeEigen = 0.03; // If result of the merged planes is below, OK to use thin planes (higher) threshold public double plMaxWorldSin2 = 0.1; // Maximal sine squared of the world angle between planes to merge. Set to >= 1.0 to disable public double plMaxWorldSin2 = 0.1; // Maximal sine squared of the world angle between planes to merge. Set to >= 1.0 to disable public double plWeakWorsening = 1.0; // Relax merge requirements for weaker planes public double plWeakWorsening = 1.0; // Relax merge requirements for weaker planes Loading @@ -2184,8 +2185,10 @@ public class EyesisCorrectionParameters { public double plStarOrtho = 0.5; // When calculating cost for the connections scale 4 ortho neighbors public double plStarOrtho = 0.5; // When calculating cost for the connections scale 4 ortho neighbors public double plStarDiag = 0.25; // When calculating cost for the connections scale 4 diagonal neighbors public double plStarDiag = 0.25; // When calculating cost for the connections scale 4 diagonal neighbors public double plStarPwr = 0.5; // Divide cost by number of connections to this power public double plStarPwr = 0.5; // Divide cost by number of connections to this power public double plStarValPwr = 1.0; // Raise value of each tile before averaging public double plDblTriLoss = 0.0001; // When resolving double triangles allow minor degradation (0.0 - strict) public double plDblTriLoss = 0.0001; // When resolving double triangles allow minor degradation (0.0 - strict) public boolean plNewConfl = false; // Allow more conflicts if overall cost is reduced public boolean plNewConfl = false; // Allow more conflicts if overall cost is reduced public int plMaxChanges = 0; // Maximal number of simultaneous connection changes around one tile (0 - any) public boolean plMutualOnly = true; // keep only mutual links, remove weakest if conflict public boolean plMutualOnly = true; // keep only mutual links, remove weakest if conflict public boolean plFillSquares = true; // Add diagonals to full squares public boolean plFillSquares = true; // Add diagonals to full squares Loading Loading @@ -2531,6 +2534,7 @@ public class EyesisCorrectionParameters { properties.setProperty(prefix+"plMaxEigen", this.plMaxEigen +""); properties.setProperty(prefix+"plMaxEigen", this.plMaxEigen +""); properties.setProperty(prefix+"plDbgMerge", this.plDbgMerge+""); properties.setProperty(prefix+"plDbgMerge", this.plDbgMerge+""); properties.setProperty(prefix+"plWorstWorsening", this.plWorstWorsening +""); properties.setProperty(prefix+"plWorstWorsening", this.plWorstWorsening +""); properties.setProperty(prefix+"plWorstWorsening2",this.plWorstWorsening2 +""); properties.setProperty(prefix+"plOKMergeEigen", this.plOKMergeEigen +""); properties.setProperty(prefix+"plOKMergeEigen", this.plOKMergeEigen +""); properties.setProperty(prefix+"plMaxWorldSin2", this.plMaxWorldSin2 +""); properties.setProperty(prefix+"plMaxWorldSin2", this.plMaxWorldSin2 +""); properties.setProperty(prefix+"plWeakWorsening", this.plWeakWorsening +""); properties.setProperty(prefix+"plWeakWorsening", this.plWeakWorsening +""); Loading @@ -2543,8 +2547,10 @@ public class EyesisCorrectionParameters { properties.setProperty(prefix+"plStarOrtho", this.plStarOrtho +""); properties.setProperty(prefix+"plStarOrtho", this.plStarOrtho +""); properties.setProperty(prefix+"plStarDiag", this.plStarDiag +""); properties.setProperty(prefix+"plStarDiag", this.plStarDiag +""); properties.setProperty(prefix+"plStarPwr", this.plStarPwr +""); properties.setProperty(prefix+"plStarPwr", this.plStarPwr +""); properties.setProperty(prefix+"plStarValPwr", this.plStarValPwr +""); properties.setProperty(prefix+"plDblTriLoss", this.plDblTriLoss +""); properties.setProperty(prefix+"plDblTriLoss", this.plDblTriLoss +""); properties.setProperty(prefix+"plNewConfl", this.plNewConfl+""); properties.setProperty(prefix+"plNewConfl", this.plNewConfl+""); properties.setProperty(prefix+"plMaxChanges", this.plMaxChanges+""); properties.setProperty(prefix+"plMutualOnly", this.plMutualOnly+""); properties.setProperty(prefix+"plMutualOnly", this.plMutualOnly+""); properties.setProperty(prefix+"plFillSquares", this.plFillSquares+""); properties.setProperty(prefix+"plFillSquares", this.plFillSquares+""); Loading Loading @@ -2870,6 +2876,7 @@ public class EyesisCorrectionParameters { if (properties.getProperty(prefix+"plMaxEigen")!=null) this.plMaxEigen=Double.parseDouble(properties.getProperty(prefix+"plMaxEigen")); if (properties.getProperty(prefix+"plMaxEigen")!=null) this.plMaxEigen=Double.parseDouble(properties.getProperty(prefix+"plMaxEigen")); if (properties.getProperty(prefix+"plDbgMerge")!=null) this.plDbgMerge=Boolean.parseBoolean(properties.getProperty(prefix+"plDbgMerge")); if (properties.getProperty(prefix+"plDbgMerge")!=null) this.plDbgMerge=Boolean.parseBoolean(properties.getProperty(prefix+"plDbgMerge")); if (properties.getProperty(prefix+"plWorstWorsening")!=null) this.plWorstWorsening=Double.parseDouble(properties.getProperty(prefix+"plWorstWorsening")); if (properties.getProperty(prefix+"plWorstWorsening")!=null) this.plWorstWorsening=Double.parseDouble(properties.getProperty(prefix+"plWorstWorsening")); if (properties.getProperty(prefix+"plWorstWorsening2")!=null) this.plWorstWorsening2=Double.parseDouble(properties.getProperty(prefix+"plWorstWorsening2")); if (properties.getProperty(prefix+"plOKMergeEigen")!=null) this.plOKMergeEigen=Double.parseDouble(properties.getProperty(prefix+"plOKMergeEigen")); if (properties.getProperty(prefix+"plOKMergeEigen")!=null) this.plOKMergeEigen=Double.parseDouble(properties.getProperty(prefix+"plOKMergeEigen")); if (properties.getProperty(prefix+"plMaxWorldSin2")!=null) this.plMaxWorldSin2=Double.parseDouble(properties.getProperty(prefix+"plMaxWorldSin2")); if (properties.getProperty(prefix+"plMaxWorldSin2")!=null) this.plMaxWorldSin2=Double.parseDouble(properties.getProperty(prefix+"plMaxWorldSin2")); if (properties.getProperty(prefix+"plWeakWorsening")!=null) this.plWeakWorsening=Double.parseDouble(properties.getProperty(prefix+"plWeakWorsening")); if (properties.getProperty(prefix+"plWeakWorsening")!=null) this.plWeakWorsening=Double.parseDouble(properties.getProperty(prefix+"plWeakWorsening")); Loading @@ -2882,8 +2889,10 @@ public class EyesisCorrectionParameters { if (properties.getProperty(prefix+"plStarOrtho")!=null) this.plStarOrtho=Double.parseDouble(properties.getProperty(prefix+"plStarOrtho")); if (properties.getProperty(prefix+"plStarOrtho")!=null) this.plStarOrtho=Double.parseDouble(properties.getProperty(prefix+"plStarOrtho")); if (properties.getProperty(prefix+"plStarDiag")!=null) this.plStarDiag=Double.parseDouble(properties.getProperty(prefix+"plStarDiag")); if (properties.getProperty(prefix+"plStarDiag")!=null) this.plStarDiag=Double.parseDouble(properties.getProperty(prefix+"plStarDiag")); if (properties.getProperty(prefix+"plStarPwr")!=null) this.plStarPwr=Double.parseDouble(properties.getProperty(prefix+"plStarPwr")); if (properties.getProperty(prefix+"plStarPwr")!=null) this.plStarPwr=Double.parseDouble(properties.getProperty(prefix+"plStarPwr")); if (properties.getProperty(prefix+"plStarValPwr")!=null) this.plStarValPwr=Double.parseDouble(properties.getProperty(prefix+"plStarValPwr")); if (properties.getProperty(prefix+"plDblTriLoss")!=null) this.plDblTriLoss=Double.parseDouble(properties.getProperty(prefix+"plDblTriLoss")); if (properties.getProperty(prefix+"plDblTriLoss")!=null) this.plDblTriLoss=Double.parseDouble(properties.getProperty(prefix+"plDblTriLoss")); if (properties.getProperty(prefix+"plNewConfl")!=null) this.plNewConfl=Boolean.parseBoolean(properties.getProperty(prefix+"plNewConfl")); if (properties.getProperty(prefix+"plNewConfl")!=null) this.plNewConfl=Boolean.parseBoolean(properties.getProperty(prefix+"plNewConfl")); if (properties.getProperty(prefix+"plMaxChanges")!=null) this.plMaxChanges=Integer.parseInt(properties.getProperty(prefix+"plMaxChanges")); if (properties.getProperty(prefix+"plMutualOnly")!=null) this.plMutualOnly=Boolean.parseBoolean(properties.getProperty(prefix+"plMutualOnly")); if (properties.getProperty(prefix+"plMutualOnly")!=null) this.plMutualOnly=Boolean.parseBoolean(properties.getProperty(prefix+"plMutualOnly")); if (properties.getProperty(prefix+"plFillSquares")!=null) this.plFillSquares=Boolean.parseBoolean(properties.getProperty(prefix+"plFillSquares")); if (properties.getProperty(prefix+"plFillSquares")!=null) this.plFillSquares=Boolean.parseBoolean(properties.getProperty(prefix+"plFillSquares")); Loading Loading @@ -3237,7 +3246,8 @@ public class EyesisCorrectionParameters { gd.addNumericField("Maximal eigenvalue of a plane", this.plMaxEigen, 6); gd.addNumericField("Maximal eigenvalue of a plane", this.plMaxEigen, 6); gd.addCheckbox ("Combine 'other' plane with the current (unused)", this.plDbgMerge); gd.addCheckbox ("Combine 'other' plane with the current (unused)", this.plDbgMerge); gd.addNumericField("Worst case worsening after merge", this.plWorstWorsening, 6); gd.addNumericField("Worst case worsening after merge", this.plWorstWorsening, 6); gd.addNumericField("If result of the merged planes is below, OK to bypass worst worsening", this.plOKMergeEigen, 6); gd.addNumericField("Worst case worsening for thin planes", this.plWorstWorsening2, 6); gd.addNumericField("If result of the merged planes is below, OK to use thin planes (higher) threshold ",this.plOKMergeEigen, 6); gd.addNumericField("Maximal sine squared of the world angle between planes to merge. Set to >= 1.0 to disable", this.plMaxWorldSin2, 6); gd.addNumericField("Maximal sine squared of the world angle between planes to merge. Set to >= 1.0 to disable", this.plMaxWorldSin2, 6); gd.addNumericField("Relax merge requirements for weaker planes", this.plWeakWorsening, 6); gd.addNumericField("Relax merge requirements for weaker planes", this.plWeakWorsening, 6); Loading @@ -3249,8 +3259,10 @@ public class EyesisCorrectionParameters { gd.addNumericField("When calculating cost for the connections scale 4 ortho neighbors", this.plStarOrtho, 6); gd.addNumericField("When calculating cost for the connections scale 4 ortho neighbors", this.plStarOrtho, 6); gd.addNumericField("When calculating cost for the connections scale 4 diagonal neighbors", this.plStarDiag, 6); gd.addNumericField("When calculating cost for the connections scale 4 diagonal neighbors", this.plStarDiag, 6); gd.addNumericField("Divide cost by number of connections to this power", this.plStarPwr, 6); gd.addNumericField("Divide cost by number of connections to this power", this.plStarPwr, 6); gd.addNumericField("Raise value of each tile before averaging", this.plStarValPwr, 6); gd.addNumericField("When resolving double triangles allow minor degradation (0.0 - strict)", this.plDblTriLoss, 6); gd.addNumericField("When resolving double triangles allow minor degradation (0.0 - strict)", this.plDblTriLoss, 6); gd.addCheckbox ("Allow more conflicts if overall cost is reduced", this.plNewConfl); gd.addCheckbox ("Allow more conflicts if overall cost is reduced", this.plNewConfl); gd.addNumericField("aximal number of simultaneous connection changes around one tile (0 - any)", this.plMaxChanges, 0); gd.addCheckbox ("Keep only mutual links, remove weakest if conflict", this.plMutualOnly); gd.addCheckbox ("Keep only mutual links, remove weakest if conflict", this.plMutualOnly); Loading Loading @@ -3589,6 +3601,7 @@ public class EyesisCorrectionParameters { this.plMaxEigen= gd.getNextNumber(); this.plMaxEigen= gd.getNextNumber(); this.plDbgMerge= gd.getNextBoolean(); this.plDbgMerge= gd.getNextBoolean(); this.plWorstWorsening= gd.getNextNumber(); this.plWorstWorsening= gd.getNextNumber(); this.plWorstWorsening2= gd.getNextNumber(); this.plOKMergeEigen= gd.getNextNumber(); this.plOKMergeEigen= gd.getNextNumber(); this.plMaxWorldSin2= gd.getNextNumber(); this.plMaxWorldSin2= gd.getNextNumber(); this.plWeakWorsening= gd.getNextNumber(); this.plWeakWorsening= gd.getNextNumber(); Loading @@ -3601,8 +3614,10 @@ public class EyesisCorrectionParameters { this.plStarOrtho= gd.getNextNumber(); this.plStarOrtho= gd.getNextNumber(); this.plStarDiag= gd.getNextNumber(); this.plStarDiag= gd.getNextNumber(); this.plStarPwr= gd.getNextNumber(); this.plStarPwr= gd.getNextNumber(); this.plStarValPwr= gd.getNextNumber(); this.plDblTriLoss= gd.getNextNumber(); this.plDblTriLoss= gd.getNextNumber(); this.plNewConfl= gd.getNextBoolean(); this.plNewConfl= gd.getNextBoolean(); this.plMaxChanges= (int) gd.getNextNumber(); this.plMutualOnly= gd.getNextBoolean(); this.plMutualOnly= gd.getNextBoolean(); Loading src/main/java/SuperTiles.java +458 −22 File changed.Preview size limit exceeded, changes collapsed. Show changes src/main/java/TilePlanes.java +99 −1 Original line number Original line Diff line number Diff line Loading @@ -58,7 +58,11 @@ public class TilePlanes { double [] world_v1 = null; // world in-plane vector, corresponding to vectors[1] double [] world_v1 = null; // world in-plane vector, corresponding to vectors[1] double [] world_v2 = null; // world in-plane vector, corresponding to vectors[1] double [] world_v2 = null; // world in-plane vector, corresponding to vectors[1] // double [] daxy = null; // disparity and 2 relative angles (ax and ay) corresponding to fisheye view, near (0,0) scale is pixel size // double [] daxy = null; // disparity and 2 relative angles (ax and ay) corresponding to fisheye view, near (0,0) scale is pixel size // for now keeping both weighted and equal weight merged value - later remove less useful double [][] merged_eig_val = null; // for each of the directions (N, NE, .. NW) quality match for each layer double [][] merged_eig_val = null; // for each of the directions (N, NE, .. NW) quality match for each layer double [][] merged_eig_eq = null; // for each of the directions (N, NE, .. NW) quality match for each layer - ignoring weights boolean [][] merged_valid = null; // for each of the directions (N, NE, .. NW) if it is possible to connect with link swaps int [] neib_best = null; // new int [8]; // for each of the directions (N, NE, .. NW) index of best match, -1 if none int [] neib_best = null; // new int [8]; // for each of the directions (N, NE, .. NW) index of best match, -1 if none // stores "worsening" of merging 2 planes. if L1,L2,L = values[0] of plane1, plane2 plane composite: w1, w2 - weights for plane1, plane2 // stores "worsening" of merging 2 planes. if L1,L2,L = values[0] of plane1, plane2 plane composite: w1, w2 - weights for plane1, plane2 // Lav = Math.sqrt((L1 * L1 * w1 + L2 * L2 * w2)/(w1 + w2)) // Lav = Math.sqrt((L1 * L1 * w1 + L2 * L2 * w2)/(w1 + w2)) Loading Loading @@ -209,6 +213,26 @@ public class TilePlanes { } } } } } } if (src.merged_eig_eq != null){ dst.merged_eig_eq = src.merged_eig_eq.clone(); for (int i = 0; i < src.merged_eig_eq.length; i++){ if (src.merged_eig_eq[i] != null){ dst.merged_eig_eq[i] = src.merged_eig_eq[i].clone(); } } } if (src.merged_valid != null){ dst.merged_valid = src.merged_valid.clone(); for (int i = 0; i < src.merged_valid.length; i++){ if (src.merged_valid[i] != null){ dst.merged_valid[i] = src.merged_valid[i].clone(); } } } if (src.neib_best != null) dst.neib_best = src.neib_best.clone(); if (src.neib_best != null) dst.neib_best = src.neib_best.clone(); // also copy original plane parameters - tile selection and number of points // also copy original plane parameters - tile selection and number of points Loading Loading @@ -1130,16 +1154,29 @@ public class TilePlanes { public double [][] initMergedValue() public double [][] initMergedValue() { { this.merged_eig_val = new double[8][]; this.merged_eig_val = new double[8][]; this.merged_eig_eq = new double[8][]; this.merged_valid = new boolean[8][]; return this.merged_eig_val; return this.merged_eig_val; } } public double [][] getMergedValue() public double [][] getMergedValue() { { return this.merged_eig_val; return this.merged_eig_val; } } public double [][] getMergedValueEq() { return this.merged_eig_eq; } public double [] initMergedValue(int dir, int leng) public double [] initMergedValue(int dir, int leng) { { this.merged_eig_val[dir] = new double[leng]; this.merged_eig_val[dir] = new double[leng]; for (int i = 0; i < leng; i++) this.merged_eig_val[dir][i] = Double.NaN; this.merged_eig_eq[dir] = new double[leng]; this.merged_valid[dir] = new boolean[leng]; for (int i = 0; i < leng; i++) { this.merged_eig_val[dir][i] = Double.NaN; this.merged_eig_eq[dir][i] = Double.NaN; } return getMergedValue(dir); return getMergedValue(dir); } } Loading @@ -1151,6 +1188,14 @@ public class TilePlanes { return this.merged_eig_val[dir]; return this.merged_eig_val[dir]; } } public double [] getMergedValueEq(int dir) { if (this.merged_eig_eq == null) { return null; } return this.merged_eig_eq[dir]; } public double getMergedValue(int dir, int plane) public double getMergedValue(int dir, int plane) { { if ((this.merged_eig_val == null) ||(this.merged_eig_val[dir] == null)){ if ((this.merged_eig_val == null) ||(this.merged_eig_val[dir] == null)){ Loading @@ -1158,10 +1203,63 @@ public class TilePlanes { } } return this.merged_eig_val[dir][plane]; return this.merged_eig_val[dir][plane]; } } public double getMergedValueEq(int dir, int plane) { if ((this.merged_eig_eq == null) ||(this.merged_eig_eq[dir] == null)){ return Double.NaN; } return this.merged_eig_eq[dir][plane]; } public void setNeibMatch(int dir, int plane, double value) public void setNeibMatch(int dir, int plane, double value) { { this.merged_eig_val[dir][plane] = value; this.merged_eig_val[dir][plane] = value; } } public void setNeibMatchEq(int dir, int plane, double value) { this.merged_eig_eq[dir][plane] = value; } public boolean [][] getMergedValid() { return this.merged_valid; } public boolean [] getMergedValid(int dir) { if (this.merged_valid == null) { return null; } return this.merged_valid[dir]; } public boolean isMergedValid(int dir, int plane) { if ((this.merged_valid == null) || (this.merged_valid[dir] == null)){ return false; } return this.merged_valid[dir][plane]; } public void setMergedValid(int dir, int plane, boolean valid) { this.merged_valid[dir][plane] = valid; } public void setMergedValid(int dir, int plane, boolean valid, int leng) { if (this.merged_valid == null){ this.merged_valid = new boolean[8][]; } if (this.merged_valid[dir] == null){ this.merged_valid[dir] = new boolean[leng]; } this.merged_valid[dir][plane] = valid; } public int [] initNeibBest() public int [] initNeibBest() { { Loading src/main/java/TileProcessor.java +34 −3 Original line number Original line Diff line number Diff line Loading @@ -3416,7 +3416,26 @@ public class TileProcessor { clt_parameters.tileX, clt_parameters.tileX, clt_parameters.tileY); clt_parameters.tileY); st.filterNeighborPlanes( clt_parameters.plWorstWorsening, // final double worst_worsening, clt_parameters.plWorstWorsening2,// final double worst_worsening2 Worst case worsening for thin planes, clt_parameters.plWeakWorsening, // final double worst_worsening, clt_parameters.plOKMergeEigen, // final double okMergeEigen, f result of the merged planes is below, OK to use thin planes (higher) threshold clt_parameters.plMaxWorldSin2, // final double maxWorldSin2, clt_parameters.plDispNorm, clt_parameters.plMaxEigen, clt_parameters.plMinStrength, 0, // final int debugLevel) clt_parameters.tileX, clt_parameters.tileY); /* */ st.selectNeighborPlanesMutual( st.selectNeighborPlanesMutual( 0, // final int debugLevel) clt_parameters.tileX, clt_parameters.tileY); /* st.selectNeighborPlanesMutual_old( clt_parameters.plWorstWorsening, // final double worst_worsening, clt_parameters.plWorstWorsening, // final double worst_worsening, clt_parameters.plWeakWorsening, // final double worst_worsening, clt_parameters.plWeakWorsening, // final double worst_worsening, clt_parameters.plOKMergeEigen, // final double okMergeEigen, clt_parameters.plOKMergeEigen, // final double okMergeEigen, Loading @@ -3428,7 +3447,7 @@ public class TileProcessor { 0, // final int debugLevel) 0, // final int debugLevel) clt_parameters.tileX, clt_parameters.tileX, clt_parameters.tileY); clt_parameters.tileY); */ st.resolveConflicts( st.resolveConflicts( clt_parameters.plMaxEigen, clt_parameters.plMaxEigen, clt_parameters.plConflDualTri, // boolean conflDualTri, // Resolve dual triangles conflict (odoodo) clt_parameters.plConflDualTri, // boolean conflDualTri, // Resolve dual triangles conflict (odoodo) Loading @@ -3439,8 +3458,10 @@ public class TileProcessor { clt_parameters.plStarOrtho, // double orthoWeight, clt_parameters.plStarOrtho, // double orthoWeight, clt_parameters.plStarDiag, // double diagonalWeight, clt_parameters.plStarDiag, // double diagonalWeight, clt_parameters.plStarPwr, // double starPwr, // Divide cost by number of connections to this power clt_parameters.plStarPwr, // double starPwr, // Divide cost by number of connections to this power clt_parameters.plStarValPwr, // double starValPwr, // Raise value of each tile before averaging clt_parameters.plDblTriLoss, // double diagonalWeight, clt_parameters.plDblTriLoss, // double diagonalWeight, clt_parameters.plNewConfl, // boolean preferDisparity, // Allow more conflicts if overall cost is reduced clt_parameters.plNewConfl, // boolean preferDisparity, // Allow more conflicts if overall cost is reduced clt_parameters.plMaxChanges, // int maxChanges, // Maximal number of simultaneous connection changes around one tile (0 - any) clt_parameters.plPreferDisparity, clt_parameters.plPreferDisparity, 1, // final int debugLevel) 1, // final int debugLevel) clt_parameters.tileX, clt_parameters.tileX, Loading @@ -3456,6 +3477,7 @@ public class TileProcessor { clt_parameters.plStarOrtho, // double orthoWeight, clt_parameters.plStarOrtho, // double orthoWeight, clt_parameters.plStarDiag, // double diagonalWeight, clt_parameters.plStarDiag, // double diagonalWeight, clt_parameters.plStarPwr, // double starPwr, // Divide cost by number of connections to this power clt_parameters.plStarPwr, // double starPwr, // Divide cost by number of connections to this power clt_parameters.plStarValPwr, // double starValPwr, // Raise value of each tile before averaging clt_parameters.plDblTriLoss, // double diagonalWeight, clt_parameters.plDblTriLoss, // double diagonalWeight, true, // clt_parameters.plNewConfl, // Allow more conflicts if overall cost is reduced true, // clt_parameters.plNewConfl, // Allow more conflicts if overall cost is reduced clt_parameters.plPreferDisparity, clt_parameters.plPreferDisparity, Loading Loading @@ -3543,11 +3565,13 @@ public class TileProcessor { clt_parameters.tileX, clt_parameters.tileX, clt_parameters.tileY); clt_parameters.tileY); st.selectNeighborPlanesMutual( st.filterNeighborPlanes( clt_parameters.plWorstWorsening, // final double worst_worsening, clt_parameters.plWorstWorsening, // final double worst_worsening, clt_parameters.plWorstWorsening2,// final double worst_worsening2 Worst case worsening for thin planes, clt_parameters.plWeakWorsening, // final double worst_worsening, clt_parameters.plWeakWorsening, // final double worst_worsening, clt_parameters.plOKMergeEigen, // final double okMergeEigen, clt_parameters.plOKMergeEigen, // final double okMergeEigen, clt_parameters.plMaxWorldSin2, // final double maxWorldSin2, clt_parameters.plMaxWorldSin2, // final double maxWorldSin2, clt_parameters.plDispNorm, clt_parameters.plDispNorm, clt_parameters.plMaxEigen, clt_parameters.plMaxEigen, clt_parameters.plMinStrength, clt_parameters.plMinStrength, Loading @@ -3555,6 +3579,11 @@ public class TileProcessor { clt_parameters.tileX, clt_parameters.tileX, clt_parameters.tileY); clt_parameters.tileY); st.selectNeighborPlanesMutual( 0, // final int debugLevel) clt_parameters.tileX, clt_parameters.tileY); st.resolveConflicts( st.resolveConflicts( clt_parameters.plMaxEigen, clt_parameters.plMaxEigen, clt_parameters.plConflDualTri, // boolean conflDualTri, // Resolve dual triangles conflict (odoodo) clt_parameters.plConflDualTri, // boolean conflDualTri, // Resolve dual triangles conflict (odoodo) Loading @@ -3565,8 +3594,10 @@ public class TileProcessor { clt_parameters.plStarOrtho, // double orthoWeight, clt_parameters.plStarOrtho, // double orthoWeight, clt_parameters.plStarDiag, // double diagonalWeight, clt_parameters.plStarDiag, // double diagonalWeight, clt_parameters.plStarPwr, // double starPwr, // Divide cost by number of connections to this power clt_parameters.plStarPwr, // double starPwr, // Divide cost by number of connections to this power clt_parameters.plStarValPwr, // double starValPwr, // Raise value of each tile before averaging clt_parameters.plDblTriLoss, // double diagonalWeight, clt_parameters.plDblTriLoss, // double diagonalWeight, clt_parameters.plNewConfl, // boolean preferDisparity, // Allow more conflicts if overall cost is reduced clt_parameters.plNewConfl, // boolean preferDisparity, // Allow more conflicts if overall cost is reduced clt_parameters.plMaxChanges, // int maxChanges, // Maximal number of simultaneous connection changes around one tile (0 - any) clt_parameters.plPreferDisparity, clt_parameters.plPreferDisparity, 1, // final int debugLevel) 1, // final int debugLevel) clt_parameters.tileX, clt_parameters.tileX, Loading Loading
src/main/java/ConnectionCosts.java +29 −14 Original line number Original line Diff line number Diff line Loading @@ -32,6 +32,7 @@ public class ConnectionCosts { double orthoWeight; double orthoWeight; double diagonalWeight; double diagonalWeight; double starPwr; // Divide cost by number of connections to this power double starPwr; // Divide cost by number of connections to this power double starValPwr; // Raise value of each tile before averaging int steps; int steps; int [][][] neibs_init; int [][][] neibs_init; int [] mod_tiles; int [] mod_tiles; Loading @@ -47,6 +48,7 @@ public class ConnectionCosts { double orthoWeight, double orthoWeight, double diagonalWeight, double diagonalWeight, double starPwr, // Divide cost by number of connections to this power double starPwr, // Divide cost by number of connections to this power double starValPwr, // Raise value of each tile before averaging int steps, int steps, TilePlanes.PlaneData [][] planes, TilePlanes.PlaneData [][] planes, TileSurface.TileNeibs tnSurface, TileSurface.TileNeibs tnSurface, Loading @@ -58,6 +60,7 @@ public class ConnectionCosts { this.orthoWeight = orthoWeight; this.orthoWeight = orthoWeight; this.diagonalWeight = diagonalWeight; this.diagonalWeight = diagonalWeight; this.starPwr = starPwr; // Divide cost by number of connections to this power this.starPwr = starPwr; // Divide cost by number of connections to this power this.starValPwr = starValPwr; // Raise value of each tile before averaging this.steps = steps; this.steps = steps; } } Loading Loading @@ -124,13 +127,16 @@ public class ConnectionCosts { for (int isTile = 0; isTile < all_tiles.length; isTile++){ for (int isTile = 0; isTile < all_tiles.length; isTile++){ if (val_weights[isTile] != null){ if (val_weights[isTile] != null){ for (int nl = 0; nl < val_weights[isTile].length; nl++) if ( val_weights[isTile][nl] != null){ for (int nl = 0; nl < val_weights[isTile].length; nl++) if ( val_weights[isTile][nl] != null){ init_val += val_weights[isTile][nl][0] * val_weights[isTile][nl][1]; double val = val_weights[isTile][nl][0]; if (starValPwr != 1.0) val = Math.pow(val, starValPwr); init_val += val * val_weights[isTile][nl][1]; init_weight += val_weights[isTile][nl][1]; init_weight += val_weights[isTile][nl][1]; } } } } } } // Likely weight will never change except first run, but we will still normalize by weight // Likely weight will never change except first run, but we will still normalize by weight if (init_weight != 0.0) init_val /= init_weight; // if (starValPwr != 1.0) init_val = Math.pow(init_val, 1.0/starValPwr); // if (init_weight != 0.0) init_val /= init_weight; return neibs_init; // neighbors to clone return neibs_init; // neighbors to clone } } Loading Loading @@ -197,6 +203,7 @@ public class ConnectionCosts { orthoWeight, orthoWeight, diagonalWeight, diagonalWeight, starPwr, // double starPwr, // Divide cost by number of connections to this power starPwr, // double starPwr, // Divide cost by number of connections to this power // starValPwr, //double starValPwr, // Raise value of each tile before averaging tnSurface, tnSurface, preferDisparity, preferDisparity, -1); // debugLevel); -1); // debugLevel); Loading Loading @@ -269,6 +276,7 @@ public class ConnectionCosts { orthoWeight, orthoWeight, diagonalWeight, diagonalWeight, starPwr, // double starPwr, // Divide cost by number of connections to this power starPwr, // double starPwr, // Divide cost by number of connections to this power // starValPwr, //double starValPwr, // Raise value of each tile before averaging tnSurface, tnSurface, preferDisparity, preferDisparity, -1); // debugLevel); -1); // debugLevel); Loading Loading @@ -317,12 +325,16 @@ public class ConnectionCosts { for (int isTile = 0; isTile < all_tiles.length; isTile++){ for (int isTile = 0; isTile < all_tiles.length; isTile++){ if (vw[isTile] != null){ if (vw[isTile] != null){ for (int nl = 0; nl < vw[isTile].length; nl++) if ( vw[isTile][nl] != null){ for (int nl = 0; nl < vw[isTile].length; nl++) if ( vw[isTile][nl] != null){ new_value += vw[isTile][nl][0] * vw[isTile][nl][1]; double val = vw[isTile][nl][0]; if (starValPwr != 1.0) val = Math.pow(val, starValPwr); new_value += val * vw[isTile][nl][1]; new_weight += vw[isTile][nl][1]; new_weight += vw[isTile][nl][1]; } } } } } } if (new_weight != 0.0) new_value /= new_weight; // if (starValPwr != 1.0) new_value = Math.pow(new_value, 1.0/starValPwr); // if (new_weight != 0.0) new_value /= new_weight; return new_value - init_val; // negative - improvement return new_value - init_val; // negative - improvement } } Loading Loading @@ -350,11 +362,12 @@ public class ConnectionCosts { double orthoWeight, double orthoWeight, double diagonalWeight, double diagonalWeight, double starPwr, // Divide cost by number of connections to this power double starPwr, // Divide cost by number of connections to this power // double starValPwr, // Raise value of each tile before averaging TileSurface.TileNeibs tnSurface, TileSurface.TileNeibs tnSurface, boolean preferDisparity, boolean preferDisparity, int debugLevel) int debugLevel) { { TilePlanes.PlaneData merged_plane = planes[nsTile][nl]; TilePlanes.PlaneData merged_plane = planes[nsTile][nl]; // add weight for (int dir = 0; dir < 8; dir++){ for (int dir = 0; dir < 8; dir++){ if (neibs[dir] >= 0){ if (neibs[dir] >= 0){ double other_weight = ((dir & 1) != 0) ? diagonalWeight : orthoWeight; double other_weight = ((dir & 1) != 0) ? diagonalWeight : orthoWeight; Loading Loading @@ -404,6 +417,7 @@ public class ConnectionCosts { double orthoWeight, double orthoWeight, double diagonalWeight, double diagonalWeight, double starPwr, // Divide cost by number of connections to this power double starPwr, // Divide cost by number of connections to this power // double starValPwr, // Raise value of each tile before averaging TileSurface.TileNeibs tnSurface, TileSurface.TileNeibs tnSurface, boolean preferDisparity, boolean preferDisparity, int debugLevel) int debugLevel) Loading @@ -417,7 +431,8 @@ public class ConnectionCosts { double weight1 = dir_weight[dir]; double weight1 = dir_weight[dir]; tile_weights.put(new Point(nsTile1, nl1), new Double(weight1)); // no need to check for existence here tile_weights.put(new Point(nsTile1, nl1), new Double(weight1)); // no need to check for existence here for (int dir1 = 0; dir1 < 8; dir1++){ for (int dir1 = 0; dir1 < 8; dir1++){ if ((dir1 != dir) && (neibs2[dir]!= null)){ // if ((dir1 != dir) && (neibs2[dir]!= null)){ if ((dir1 != ((dir + 4) %8)) && (neibs2[dir1]!= null)){ // not backwards to the center and exists int nl2 =neibs2[dir][dir1]; int nl2 =neibs2[dir][dir1]; if (nl2 >= 0){ if (nl2 >= 0){ Point p = new Point (tnSurface.getNeibIndex(nsTile1, dir1), nl2); Point p = new Point (tnSurface.getNeibIndex(nsTile1, dir1), nl2); Loading
src/main/java/EyesisCorrectionParameters.java +18 −3 Original line number Original line Diff line number Diff line Loading @@ -2170,8 +2170,9 @@ public class EyesisCorrectionParameters { public double plMinStrength = 0.1; // Minimal total strength of a plane public double plMinStrength = 0.1; // Minimal total strength of a plane public double plMaxEigen = 0.3; // Maximal eigenvalue of a plane public double plMaxEigen = 0.3; // Maximal eigenvalue of a plane public boolean plDbgMerge = true; // Combine 'other' plane with current public boolean plDbgMerge = true; // Combine 'other' plane with current public double plWorstWorsening = 3.0; // Worst case worsening after merge public double plWorstWorsening = 2.0; // Worst case worsening after merge public double plOKMergeEigen = 0.03; // If result of the merged planes is below, OK to bypass worst worsening public double plWorstWorsening2 = 5.0; // Worst case worsening for thin planes public double plOKMergeEigen = 0.03; // If result of the merged planes is below, OK to use thin planes (higher) threshold public double plMaxWorldSin2 = 0.1; // Maximal sine squared of the world angle between planes to merge. Set to >= 1.0 to disable public double plMaxWorldSin2 = 0.1; // Maximal sine squared of the world angle between planes to merge. Set to >= 1.0 to disable public double plWeakWorsening = 1.0; // Relax merge requirements for weaker planes public double plWeakWorsening = 1.0; // Relax merge requirements for weaker planes Loading @@ -2184,8 +2185,10 @@ public class EyesisCorrectionParameters { public double plStarOrtho = 0.5; // When calculating cost for the connections scale 4 ortho neighbors public double plStarOrtho = 0.5; // When calculating cost for the connections scale 4 ortho neighbors public double plStarDiag = 0.25; // When calculating cost for the connections scale 4 diagonal neighbors public double plStarDiag = 0.25; // When calculating cost for the connections scale 4 diagonal neighbors public double plStarPwr = 0.5; // Divide cost by number of connections to this power public double plStarPwr = 0.5; // Divide cost by number of connections to this power public double plStarValPwr = 1.0; // Raise value of each tile before averaging public double plDblTriLoss = 0.0001; // When resolving double triangles allow minor degradation (0.0 - strict) public double plDblTriLoss = 0.0001; // When resolving double triangles allow minor degradation (0.0 - strict) public boolean plNewConfl = false; // Allow more conflicts if overall cost is reduced public boolean plNewConfl = false; // Allow more conflicts if overall cost is reduced public int plMaxChanges = 0; // Maximal number of simultaneous connection changes around one tile (0 - any) public boolean plMutualOnly = true; // keep only mutual links, remove weakest if conflict public boolean plMutualOnly = true; // keep only mutual links, remove weakest if conflict public boolean plFillSquares = true; // Add diagonals to full squares public boolean plFillSquares = true; // Add diagonals to full squares Loading Loading @@ -2531,6 +2534,7 @@ public class EyesisCorrectionParameters { properties.setProperty(prefix+"plMaxEigen", this.plMaxEigen +""); properties.setProperty(prefix+"plMaxEigen", this.plMaxEigen +""); properties.setProperty(prefix+"plDbgMerge", this.plDbgMerge+""); properties.setProperty(prefix+"plDbgMerge", this.plDbgMerge+""); properties.setProperty(prefix+"plWorstWorsening", this.plWorstWorsening +""); properties.setProperty(prefix+"plWorstWorsening", this.plWorstWorsening +""); properties.setProperty(prefix+"plWorstWorsening2",this.plWorstWorsening2 +""); properties.setProperty(prefix+"plOKMergeEigen", this.plOKMergeEigen +""); properties.setProperty(prefix+"plOKMergeEigen", this.plOKMergeEigen +""); properties.setProperty(prefix+"plMaxWorldSin2", this.plMaxWorldSin2 +""); properties.setProperty(prefix+"plMaxWorldSin2", this.plMaxWorldSin2 +""); properties.setProperty(prefix+"plWeakWorsening", this.plWeakWorsening +""); properties.setProperty(prefix+"plWeakWorsening", this.plWeakWorsening +""); Loading @@ -2543,8 +2547,10 @@ public class EyesisCorrectionParameters { properties.setProperty(prefix+"plStarOrtho", this.plStarOrtho +""); properties.setProperty(prefix+"plStarOrtho", this.plStarOrtho +""); properties.setProperty(prefix+"plStarDiag", this.plStarDiag +""); properties.setProperty(prefix+"plStarDiag", this.plStarDiag +""); properties.setProperty(prefix+"plStarPwr", this.plStarPwr +""); properties.setProperty(prefix+"plStarPwr", this.plStarPwr +""); properties.setProperty(prefix+"plStarValPwr", this.plStarValPwr +""); properties.setProperty(prefix+"plDblTriLoss", this.plDblTriLoss +""); properties.setProperty(prefix+"plDblTriLoss", this.plDblTriLoss +""); properties.setProperty(prefix+"plNewConfl", this.plNewConfl+""); properties.setProperty(prefix+"plNewConfl", this.plNewConfl+""); properties.setProperty(prefix+"plMaxChanges", this.plMaxChanges+""); properties.setProperty(prefix+"plMutualOnly", this.plMutualOnly+""); properties.setProperty(prefix+"plMutualOnly", this.plMutualOnly+""); properties.setProperty(prefix+"plFillSquares", this.plFillSquares+""); properties.setProperty(prefix+"plFillSquares", this.plFillSquares+""); Loading Loading @@ -2870,6 +2876,7 @@ public class EyesisCorrectionParameters { if (properties.getProperty(prefix+"plMaxEigen")!=null) this.plMaxEigen=Double.parseDouble(properties.getProperty(prefix+"plMaxEigen")); if (properties.getProperty(prefix+"plMaxEigen")!=null) this.plMaxEigen=Double.parseDouble(properties.getProperty(prefix+"plMaxEigen")); if (properties.getProperty(prefix+"plDbgMerge")!=null) this.plDbgMerge=Boolean.parseBoolean(properties.getProperty(prefix+"plDbgMerge")); if (properties.getProperty(prefix+"plDbgMerge")!=null) this.plDbgMerge=Boolean.parseBoolean(properties.getProperty(prefix+"plDbgMerge")); if (properties.getProperty(prefix+"plWorstWorsening")!=null) this.plWorstWorsening=Double.parseDouble(properties.getProperty(prefix+"plWorstWorsening")); if (properties.getProperty(prefix+"plWorstWorsening")!=null) this.plWorstWorsening=Double.parseDouble(properties.getProperty(prefix+"plWorstWorsening")); if (properties.getProperty(prefix+"plWorstWorsening2")!=null) this.plWorstWorsening2=Double.parseDouble(properties.getProperty(prefix+"plWorstWorsening2")); if (properties.getProperty(prefix+"plOKMergeEigen")!=null) this.plOKMergeEigen=Double.parseDouble(properties.getProperty(prefix+"plOKMergeEigen")); if (properties.getProperty(prefix+"plOKMergeEigen")!=null) this.plOKMergeEigen=Double.parseDouble(properties.getProperty(prefix+"plOKMergeEigen")); if (properties.getProperty(prefix+"plMaxWorldSin2")!=null) this.plMaxWorldSin2=Double.parseDouble(properties.getProperty(prefix+"plMaxWorldSin2")); if (properties.getProperty(prefix+"plMaxWorldSin2")!=null) this.plMaxWorldSin2=Double.parseDouble(properties.getProperty(prefix+"plMaxWorldSin2")); if (properties.getProperty(prefix+"plWeakWorsening")!=null) this.plWeakWorsening=Double.parseDouble(properties.getProperty(prefix+"plWeakWorsening")); if (properties.getProperty(prefix+"plWeakWorsening")!=null) this.plWeakWorsening=Double.parseDouble(properties.getProperty(prefix+"plWeakWorsening")); Loading @@ -2882,8 +2889,10 @@ public class EyesisCorrectionParameters { if (properties.getProperty(prefix+"plStarOrtho")!=null) this.plStarOrtho=Double.parseDouble(properties.getProperty(prefix+"plStarOrtho")); if (properties.getProperty(prefix+"plStarOrtho")!=null) this.plStarOrtho=Double.parseDouble(properties.getProperty(prefix+"plStarOrtho")); if (properties.getProperty(prefix+"plStarDiag")!=null) this.plStarDiag=Double.parseDouble(properties.getProperty(prefix+"plStarDiag")); if (properties.getProperty(prefix+"plStarDiag")!=null) this.plStarDiag=Double.parseDouble(properties.getProperty(prefix+"plStarDiag")); if (properties.getProperty(prefix+"plStarPwr")!=null) this.plStarPwr=Double.parseDouble(properties.getProperty(prefix+"plStarPwr")); if (properties.getProperty(prefix+"plStarPwr")!=null) this.plStarPwr=Double.parseDouble(properties.getProperty(prefix+"plStarPwr")); if (properties.getProperty(prefix+"plStarValPwr")!=null) this.plStarValPwr=Double.parseDouble(properties.getProperty(prefix+"plStarValPwr")); if (properties.getProperty(prefix+"plDblTriLoss")!=null) this.plDblTriLoss=Double.parseDouble(properties.getProperty(prefix+"plDblTriLoss")); if (properties.getProperty(prefix+"plDblTriLoss")!=null) this.plDblTriLoss=Double.parseDouble(properties.getProperty(prefix+"plDblTriLoss")); if (properties.getProperty(prefix+"plNewConfl")!=null) this.plNewConfl=Boolean.parseBoolean(properties.getProperty(prefix+"plNewConfl")); if (properties.getProperty(prefix+"plNewConfl")!=null) this.plNewConfl=Boolean.parseBoolean(properties.getProperty(prefix+"plNewConfl")); if (properties.getProperty(prefix+"plMaxChanges")!=null) this.plMaxChanges=Integer.parseInt(properties.getProperty(prefix+"plMaxChanges")); if (properties.getProperty(prefix+"plMutualOnly")!=null) this.plMutualOnly=Boolean.parseBoolean(properties.getProperty(prefix+"plMutualOnly")); if (properties.getProperty(prefix+"plMutualOnly")!=null) this.plMutualOnly=Boolean.parseBoolean(properties.getProperty(prefix+"plMutualOnly")); if (properties.getProperty(prefix+"plFillSquares")!=null) this.plFillSquares=Boolean.parseBoolean(properties.getProperty(prefix+"plFillSquares")); if (properties.getProperty(prefix+"plFillSquares")!=null) this.plFillSquares=Boolean.parseBoolean(properties.getProperty(prefix+"plFillSquares")); Loading Loading @@ -3237,7 +3246,8 @@ public class EyesisCorrectionParameters { gd.addNumericField("Maximal eigenvalue of a plane", this.plMaxEigen, 6); gd.addNumericField("Maximal eigenvalue of a plane", this.plMaxEigen, 6); gd.addCheckbox ("Combine 'other' plane with the current (unused)", this.plDbgMerge); gd.addCheckbox ("Combine 'other' plane with the current (unused)", this.plDbgMerge); gd.addNumericField("Worst case worsening after merge", this.plWorstWorsening, 6); gd.addNumericField("Worst case worsening after merge", this.plWorstWorsening, 6); gd.addNumericField("If result of the merged planes is below, OK to bypass worst worsening", this.plOKMergeEigen, 6); gd.addNumericField("Worst case worsening for thin planes", this.plWorstWorsening2, 6); gd.addNumericField("If result of the merged planes is below, OK to use thin planes (higher) threshold ",this.plOKMergeEigen, 6); gd.addNumericField("Maximal sine squared of the world angle between planes to merge. Set to >= 1.0 to disable", this.plMaxWorldSin2, 6); gd.addNumericField("Maximal sine squared of the world angle between planes to merge. Set to >= 1.0 to disable", this.plMaxWorldSin2, 6); gd.addNumericField("Relax merge requirements for weaker planes", this.plWeakWorsening, 6); gd.addNumericField("Relax merge requirements for weaker planes", this.plWeakWorsening, 6); Loading @@ -3249,8 +3259,10 @@ public class EyesisCorrectionParameters { gd.addNumericField("When calculating cost for the connections scale 4 ortho neighbors", this.plStarOrtho, 6); gd.addNumericField("When calculating cost for the connections scale 4 ortho neighbors", this.plStarOrtho, 6); gd.addNumericField("When calculating cost for the connections scale 4 diagonal neighbors", this.plStarDiag, 6); gd.addNumericField("When calculating cost for the connections scale 4 diagonal neighbors", this.plStarDiag, 6); gd.addNumericField("Divide cost by number of connections to this power", this.plStarPwr, 6); gd.addNumericField("Divide cost by number of connections to this power", this.plStarPwr, 6); gd.addNumericField("Raise value of each tile before averaging", this.plStarValPwr, 6); gd.addNumericField("When resolving double triangles allow minor degradation (0.0 - strict)", this.plDblTriLoss, 6); gd.addNumericField("When resolving double triangles allow minor degradation (0.0 - strict)", this.plDblTriLoss, 6); gd.addCheckbox ("Allow more conflicts if overall cost is reduced", this.plNewConfl); gd.addCheckbox ("Allow more conflicts if overall cost is reduced", this.plNewConfl); gd.addNumericField("aximal number of simultaneous connection changes around one tile (0 - any)", this.plMaxChanges, 0); gd.addCheckbox ("Keep only mutual links, remove weakest if conflict", this.plMutualOnly); gd.addCheckbox ("Keep only mutual links, remove weakest if conflict", this.plMutualOnly); Loading Loading @@ -3589,6 +3601,7 @@ public class EyesisCorrectionParameters { this.plMaxEigen= gd.getNextNumber(); this.plMaxEigen= gd.getNextNumber(); this.plDbgMerge= gd.getNextBoolean(); this.plDbgMerge= gd.getNextBoolean(); this.plWorstWorsening= gd.getNextNumber(); this.plWorstWorsening= gd.getNextNumber(); this.plWorstWorsening2= gd.getNextNumber(); this.plOKMergeEigen= gd.getNextNumber(); this.plOKMergeEigen= gd.getNextNumber(); this.plMaxWorldSin2= gd.getNextNumber(); this.plMaxWorldSin2= gd.getNextNumber(); this.plWeakWorsening= gd.getNextNumber(); this.plWeakWorsening= gd.getNextNumber(); Loading @@ -3601,8 +3614,10 @@ public class EyesisCorrectionParameters { this.plStarOrtho= gd.getNextNumber(); this.plStarOrtho= gd.getNextNumber(); this.plStarDiag= gd.getNextNumber(); this.plStarDiag= gd.getNextNumber(); this.plStarPwr= gd.getNextNumber(); this.plStarPwr= gd.getNextNumber(); this.plStarValPwr= gd.getNextNumber(); this.plDblTriLoss= gd.getNextNumber(); this.plDblTriLoss= gd.getNextNumber(); this.plNewConfl= gd.getNextBoolean(); this.plNewConfl= gd.getNextBoolean(); this.plMaxChanges= (int) gd.getNextNumber(); this.plMutualOnly= gd.getNextBoolean(); this.plMutualOnly= gd.getNextBoolean(); Loading
src/main/java/SuperTiles.java +458 −22 File changed.Preview size limit exceeded, changes collapsed. Show changes
src/main/java/TilePlanes.java +99 −1 Original line number Original line Diff line number Diff line Loading @@ -58,7 +58,11 @@ public class TilePlanes { double [] world_v1 = null; // world in-plane vector, corresponding to vectors[1] double [] world_v1 = null; // world in-plane vector, corresponding to vectors[1] double [] world_v2 = null; // world in-plane vector, corresponding to vectors[1] double [] world_v2 = null; // world in-plane vector, corresponding to vectors[1] // double [] daxy = null; // disparity and 2 relative angles (ax and ay) corresponding to fisheye view, near (0,0) scale is pixel size // double [] daxy = null; // disparity and 2 relative angles (ax and ay) corresponding to fisheye view, near (0,0) scale is pixel size // for now keeping both weighted and equal weight merged value - later remove less useful double [][] merged_eig_val = null; // for each of the directions (N, NE, .. NW) quality match for each layer double [][] merged_eig_val = null; // for each of the directions (N, NE, .. NW) quality match for each layer double [][] merged_eig_eq = null; // for each of the directions (N, NE, .. NW) quality match for each layer - ignoring weights boolean [][] merged_valid = null; // for each of the directions (N, NE, .. NW) if it is possible to connect with link swaps int [] neib_best = null; // new int [8]; // for each of the directions (N, NE, .. NW) index of best match, -1 if none int [] neib_best = null; // new int [8]; // for each of the directions (N, NE, .. NW) index of best match, -1 if none // stores "worsening" of merging 2 planes. if L1,L2,L = values[0] of plane1, plane2 plane composite: w1, w2 - weights for plane1, plane2 // stores "worsening" of merging 2 planes. if L1,L2,L = values[0] of plane1, plane2 plane composite: w1, w2 - weights for plane1, plane2 // Lav = Math.sqrt((L1 * L1 * w1 + L2 * L2 * w2)/(w1 + w2)) // Lav = Math.sqrt((L1 * L1 * w1 + L2 * L2 * w2)/(w1 + w2)) Loading Loading @@ -209,6 +213,26 @@ public class TilePlanes { } } } } } } if (src.merged_eig_eq != null){ dst.merged_eig_eq = src.merged_eig_eq.clone(); for (int i = 0; i < src.merged_eig_eq.length; i++){ if (src.merged_eig_eq[i] != null){ dst.merged_eig_eq[i] = src.merged_eig_eq[i].clone(); } } } if (src.merged_valid != null){ dst.merged_valid = src.merged_valid.clone(); for (int i = 0; i < src.merged_valid.length; i++){ if (src.merged_valid[i] != null){ dst.merged_valid[i] = src.merged_valid[i].clone(); } } } if (src.neib_best != null) dst.neib_best = src.neib_best.clone(); if (src.neib_best != null) dst.neib_best = src.neib_best.clone(); // also copy original plane parameters - tile selection and number of points // also copy original plane parameters - tile selection and number of points Loading Loading @@ -1130,16 +1154,29 @@ public class TilePlanes { public double [][] initMergedValue() public double [][] initMergedValue() { { this.merged_eig_val = new double[8][]; this.merged_eig_val = new double[8][]; this.merged_eig_eq = new double[8][]; this.merged_valid = new boolean[8][]; return this.merged_eig_val; return this.merged_eig_val; } } public double [][] getMergedValue() public double [][] getMergedValue() { { return this.merged_eig_val; return this.merged_eig_val; } } public double [][] getMergedValueEq() { return this.merged_eig_eq; } public double [] initMergedValue(int dir, int leng) public double [] initMergedValue(int dir, int leng) { { this.merged_eig_val[dir] = new double[leng]; this.merged_eig_val[dir] = new double[leng]; for (int i = 0; i < leng; i++) this.merged_eig_val[dir][i] = Double.NaN; this.merged_eig_eq[dir] = new double[leng]; this.merged_valid[dir] = new boolean[leng]; for (int i = 0; i < leng; i++) { this.merged_eig_val[dir][i] = Double.NaN; this.merged_eig_eq[dir][i] = Double.NaN; } return getMergedValue(dir); return getMergedValue(dir); } } Loading @@ -1151,6 +1188,14 @@ public class TilePlanes { return this.merged_eig_val[dir]; return this.merged_eig_val[dir]; } } public double [] getMergedValueEq(int dir) { if (this.merged_eig_eq == null) { return null; } return this.merged_eig_eq[dir]; } public double getMergedValue(int dir, int plane) public double getMergedValue(int dir, int plane) { { if ((this.merged_eig_val == null) ||(this.merged_eig_val[dir] == null)){ if ((this.merged_eig_val == null) ||(this.merged_eig_val[dir] == null)){ Loading @@ -1158,10 +1203,63 @@ public class TilePlanes { } } return this.merged_eig_val[dir][plane]; return this.merged_eig_val[dir][plane]; } } public double getMergedValueEq(int dir, int plane) { if ((this.merged_eig_eq == null) ||(this.merged_eig_eq[dir] == null)){ return Double.NaN; } return this.merged_eig_eq[dir][plane]; } public void setNeibMatch(int dir, int plane, double value) public void setNeibMatch(int dir, int plane, double value) { { this.merged_eig_val[dir][plane] = value; this.merged_eig_val[dir][plane] = value; } } public void setNeibMatchEq(int dir, int plane, double value) { this.merged_eig_eq[dir][plane] = value; } public boolean [][] getMergedValid() { return this.merged_valid; } public boolean [] getMergedValid(int dir) { if (this.merged_valid == null) { return null; } return this.merged_valid[dir]; } public boolean isMergedValid(int dir, int plane) { if ((this.merged_valid == null) || (this.merged_valid[dir] == null)){ return false; } return this.merged_valid[dir][plane]; } public void setMergedValid(int dir, int plane, boolean valid) { this.merged_valid[dir][plane] = valid; } public void setMergedValid(int dir, int plane, boolean valid, int leng) { if (this.merged_valid == null){ this.merged_valid = new boolean[8][]; } if (this.merged_valid[dir] == null){ this.merged_valid[dir] = new boolean[leng]; } this.merged_valid[dir][plane] = valid; } public int [] initNeibBest() public int [] initNeibBest() { { Loading
src/main/java/TileProcessor.java +34 −3 Original line number Original line Diff line number Diff line Loading @@ -3416,7 +3416,26 @@ public class TileProcessor { clt_parameters.tileX, clt_parameters.tileX, clt_parameters.tileY); clt_parameters.tileY); st.filterNeighborPlanes( clt_parameters.plWorstWorsening, // final double worst_worsening, clt_parameters.plWorstWorsening2,// final double worst_worsening2 Worst case worsening for thin planes, clt_parameters.plWeakWorsening, // final double worst_worsening, clt_parameters.plOKMergeEigen, // final double okMergeEigen, f result of the merged planes is below, OK to use thin planes (higher) threshold clt_parameters.plMaxWorldSin2, // final double maxWorldSin2, clt_parameters.plDispNorm, clt_parameters.plMaxEigen, clt_parameters.plMinStrength, 0, // final int debugLevel) clt_parameters.tileX, clt_parameters.tileY); /* */ st.selectNeighborPlanesMutual( st.selectNeighborPlanesMutual( 0, // final int debugLevel) clt_parameters.tileX, clt_parameters.tileY); /* st.selectNeighborPlanesMutual_old( clt_parameters.plWorstWorsening, // final double worst_worsening, clt_parameters.plWorstWorsening, // final double worst_worsening, clt_parameters.plWeakWorsening, // final double worst_worsening, clt_parameters.plWeakWorsening, // final double worst_worsening, clt_parameters.plOKMergeEigen, // final double okMergeEigen, clt_parameters.plOKMergeEigen, // final double okMergeEigen, Loading @@ -3428,7 +3447,7 @@ public class TileProcessor { 0, // final int debugLevel) 0, // final int debugLevel) clt_parameters.tileX, clt_parameters.tileX, clt_parameters.tileY); clt_parameters.tileY); */ st.resolveConflicts( st.resolveConflicts( clt_parameters.plMaxEigen, clt_parameters.plMaxEigen, clt_parameters.plConflDualTri, // boolean conflDualTri, // Resolve dual triangles conflict (odoodo) clt_parameters.plConflDualTri, // boolean conflDualTri, // Resolve dual triangles conflict (odoodo) Loading @@ -3439,8 +3458,10 @@ public class TileProcessor { clt_parameters.plStarOrtho, // double orthoWeight, clt_parameters.plStarOrtho, // double orthoWeight, clt_parameters.plStarDiag, // double diagonalWeight, clt_parameters.plStarDiag, // double diagonalWeight, clt_parameters.plStarPwr, // double starPwr, // Divide cost by number of connections to this power clt_parameters.plStarPwr, // double starPwr, // Divide cost by number of connections to this power clt_parameters.plStarValPwr, // double starValPwr, // Raise value of each tile before averaging clt_parameters.plDblTriLoss, // double diagonalWeight, clt_parameters.plDblTriLoss, // double diagonalWeight, clt_parameters.plNewConfl, // boolean preferDisparity, // Allow more conflicts if overall cost is reduced clt_parameters.plNewConfl, // boolean preferDisparity, // Allow more conflicts if overall cost is reduced clt_parameters.plMaxChanges, // int maxChanges, // Maximal number of simultaneous connection changes around one tile (0 - any) clt_parameters.plPreferDisparity, clt_parameters.plPreferDisparity, 1, // final int debugLevel) 1, // final int debugLevel) clt_parameters.tileX, clt_parameters.tileX, Loading @@ -3456,6 +3477,7 @@ public class TileProcessor { clt_parameters.plStarOrtho, // double orthoWeight, clt_parameters.plStarOrtho, // double orthoWeight, clt_parameters.plStarDiag, // double diagonalWeight, clt_parameters.plStarDiag, // double diagonalWeight, clt_parameters.plStarPwr, // double starPwr, // Divide cost by number of connections to this power clt_parameters.plStarPwr, // double starPwr, // Divide cost by number of connections to this power clt_parameters.plStarValPwr, // double starValPwr, // Raise value of each tile before averaging clt_parameters.plDblTriLoss, // double diagonalWeight, clt_parameters.plDblTriLoss, // double diagonalWeight, true, // clt_parameters.plNewConfl, // Allow more conflicts if overall cost is reduced true, // clt_parameters.plNewConfl, // Allow more conflicts if overall cost is reduced clt_parameters.plPreferDisparity, clt_parameters.plPreferDisparity, Loading Loading @@ -3543,11 +3565,13 @@ public class TileProcessor { clt_parameters.tileX, clt_parameters.tileX, clt_parameters.tileY); clt_parameters.tileY); st.selectNeighborPlanesMutual( st.filterNeighborPlanes( clt_parameters.plWorstWorsening, // final double worst_worsening, clt_parameters.plWorstWorsening, // final double worst_worsening, clt_parameters.plWorstWorsening2,// final double worst_worsening2 Worst case worsening for thin planes, clt_parameters.plWeakWorsening, // final double worst_worsening, clt_parameters.plWeakWorsening, // final double worst_worsening, clt_parameters.plOKMergeEigen, // final double okMergeEigen, clt_parameters.plOKMergeEigen, // final double okMergeEigen, clt_parameters.plMaxWorldSin2, // final double maxWorldSin2, clt_parameters.plMaxWorldSin2, // final double maxWorldSin2, clt_parameters.plDispNorm, clt_parameters.plDispNorm, clt_parameters.plMaxEigen, clt_parameters.plMaxEigen, clt_parameters.plMinStrength, clt_parameters.plMinStrength, Loading @@ -3555,6 +3579,11 @@ public class TileProcessor { clt_parameters.tileX, clt_parameters.tileX, clt_parameters.tileY); clt_parameters.tileY); st.selectNeighborPlanesMutual( 0, // final int debugLevel) clt_parameters.tileX, clt_parameters.tileY); st.resolveConflicts( st.resolveConflicts( clt_parameters.plMaxEigen, clt_parameters.plMaxEigen, clt_parameters.plConflDualTri, // boolean conflDualTri, // Resolve dual triangles conflict (odoodo) clt_parameters.plConflDualTri, // boolean conflDualTri, // Resolve dual triangles conflict (odoodo) Loading @@ -3565,8 +3594,10 @@ public class TileProcessor { clt_parameters.plStarOrtho, // double orthoWeight, clt_parameters.plStarOrtho, // double orthoWeight, clt_parameters.plStarDiag, // double diagonalWeight, clt_parameters.plStarDiag, // double diagonalWeight, clt_parameters.plStarPwr, // double starPwr, // Divide cost by number of connections to this power clt_parameters.plStarPwr, // double starPwr, // Divide cost by number of connections to this power clt_parameters.plStarValPwr, // double starValPwr, // Raise value of each tile before averaging clt_parameters.plDblTriLoss, // double diagonalWeight, clt_parameters.plDblTriLoss, // double diagonalWeight, clt_parameters.plNewConfl, // boolean preferDisparity, // Allow more conflicts if overall cost is reduced clt_parameters.plNewConfl, // boolean preferDisparity, // Allow more conflicts if overall cost is reduced clt_parameters.plMaxChanges, // int maxChanges, // Maximal number of simultaneous connection changes around one tile (0 - any) clt_parameters.plPreferDisparity, clt_parameters.plPreferDisparity, 1, // final int debugLevel) 1, // final int debugLevel) clt_parameters.tileX, clt_parameters.tileX, Loading