Commit 1ca1c6d0 authored by Andrey Filippov's avatar Andrey Filippov

increasing range to 2 supertiles when calculating connection costs

parent ada2ac85
......@@ -32,7 +32,7 @@ public class Conflicts {
private int [] num_all_conflicts = new int [24];
private int num_ortho_incompat = 0;
private int num_ortho_dual = 0;
private int num_conflicts;
private int num_conflicts = 0;
private SuperTiles st = null;
public Conflicts(
......@@ -90,6 +90,18 @@ public class Conflicts {
}
public void resetConflicts()
{
num_ortho_diag_ortho = new int [8];
num_ortho_ortho_diag = new int [16];
num_all_conflicts = new int [24];
num_ortho_incompat = 0;
num_ortho_dual = 0;
num_conflicts = 0;
}
public int addConflicts(
int [][][] conflicts,
int debugLevel)
......@@ -104,7 +116,7 @@ public class Conflicts {
num_ortho_dual += conf.getDualTriOrthoDiagOrthoConflicts();
num_conflicts += conf.getNumConflicts();
if (debugLevel > 0){
printConflict("addConflicts() nsTile = "+nsTile, conf);
printConflict("addConflicts() nsTile = "+nsTile+" ", conf);
}
}
}
......@@ -125,7 +137,7 @@ public class Conflicts {
num_ortho_dual += conf.getDualTriOrthoDiagOrthoConflicts();
num_conflicts += conf.getNumConflicts();
if (debugLevel > 0){
printConflict("addConflicts() nsTile = "+nsTile, conf);
printConflict("addConflicts() nsTile = "+nsTile+" ", conf);
}
}
}
......
This diff is collapsed.
......@@ -2174,8 +2174,11 @@ public class EyesisCorrectionParameters {
public double plOKMergeEigen = 0.03; // If result of the merged planes is below, OK to bypass worst worsening
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 int plStarSteps = 1; // How far to look around when calculationg connection cost
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 plStarPwr = 0.5; // Divide cost by number of connections to this power
public double plDblTriLoss = 0.0001; // When resolving double triangles allow minor degradation (0.0 - strict)
public boolean plMutualOnly = true; // keep only mutual links, remove weakest if conflict
......@@ -2526,8 +2529,10 @@ public class EyesisCorrectionParameters {
properties.setProperty(prefix+"plMaxWorldSin2", this.plMaxWorldSin2 +"");
properties.setProperty(prefix+"plWeakWorsening", this.plWeakWorsening +"");
properties.setProperty(prefix+"plStarSteps", this.plStarSteps+"");
properties.setProperty(prefix+"plStarOrtho", this.plStarOrtho +"");
properties.setProperty(prefix+"plStarDiag", this.plStarDiag +"");
properties.setProperty(prefix+"plStarPwr", this.plStarPwr +"");
properties.setProperty(prefix+"plDblTriLoss", this.plDblTriLoss +"");
properties.setProperty(prefix+"plMutualOnly", this.plMutualOnly+"");
......@@ -2858,8 +2863,10 @@ public class EyesisCorrectionParameters {
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+"plStarSteps")!=null) this.plStarSteps=Integer.parseInt(properties.getProperty(prefix+"plStarSteps"));
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+"plStarPwr")!=null) this.plStarPwr=Double.parseDouble(properties.getProperty(prefix+"plStarPwr"));
if (properties.getProperty(prefix+"plDblTriLoss")!=null) this.plDblTriLoss=Double.parseDouble(properties.getProperty(prefix+"plDblTriLoss"));
if (properties.getProperty(prefix+"plMutualOnly")!=null) this.plMutualOnly=Boolean.parseBoolean(properties.getProperty(prefix+"plMutualOnly"));
......@@ -3218,8 +3225,10 @@ public class EyesisCorrectionParameters {
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("How far to look around when calculationg connection cost", this.plStarSteps, 0);
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("Divide cost by number of connections to this power", this.plStarPwr, 6);
gd.addNumericField("When resolving double triangles allow minor degradation (0.0 - strict)", this.plDblTriLoss, 6);
gd.addCheckbox ("Keep only mutual links, remove weakest if conflict", this.plMutualOnly);
......@@ -3563,8 +3572,10 @@ public class EyesisCorrectionParameters {
this.plMaxWorldSin2= gd.getNextNumber();
this.plWeakWorsening= gd.getNextNumber();
this.plStarSteps= (int) gd.getNextNumber();
this.plStarOrtho= gd.getNextNumber();
this.plStarDiag= gd.getNextNumber();
this.plStarPwr= gd.getNextNumber();
this.plDblTriLoss= gd.getNextNumber();
this.plMutualOnly= gd.getNextBoolean();
......
This diff is collapsed.
......@@ -1154,6 +1154,16 @@ public class TilePlanes {
return this.neib_best;
}
public int getNumNeibBest()
{
if (this.neib_best == null) {
return 0;
}
int num = 0;
for (int i = 0; i < this.neib_best.length; i++) if (this.neib_best[i] >= 0) num++;
return num;
}
public int getNeibBest(int dir)
{
if (this.neib_best == null) {
......
......@@ -2959,8 +2959,8 @@ public class TileProcessor {
}
tileSurface.testSimpleConnected(
clt_parameters.tileX,
clt_parameters.tileY);
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)
......@@ -3428,100 +3428,18 @@ public class TileProcessor {
0, // final int debugLevel)
clt_parameters.tileX,
clt_parameters.tileY);
Conflicts iconflicts0 = new Conflicts(st);
/*
int [][][] conflicts0 = st.detectTriangularConflicts(
1); // final int debugLevel)
int [] conflicts0_stats = st.getNumConflicts(
conflicts0,
*/
int [][][] conflicts0 = iconflicts0.detectTriangularConflicts(
1); // final int debugLevel)
Conflicts conflicts0_stats = new Conflicts(
conflicts0,
st,
-1); // debugLevel);
// just testing
/*
for (int pass = 0; pass < 10; pass ++) {
int [] dual_tri_results = st. resolveDualTriangularConflicts(
conflicts0, // int [][][] conflicts,
conflicts0_stats,
clt_parameters.plMaxEigen,
clt_parameters.plStarOrtho, // double orthoWeight,
clt_parameters.plStarDiag, // double diagonalWeight,
clt_parameters.plDblTriLoss, // double diagonalWeight,
clt_parameters.plPreferDisparity,
1, // final int debugLevel)
clt_parameters.tileX,
clt_parameters.tileY);
System.out.println("Pass "+(pass+1)+": dual_tri_results (success/failures) = "+dual_tri_results[0]+" / "+dual_tri_results[1]);
if (dual_tri_results[0] == 0) break;
}
*/
for (int pass = 0; pass < 10; pass ++) {
int [] dual_tri_results = st. resolveDualTriangularConflicts(
conflicts0, // int [][][] conflicts,
conflicts0_stats,
st.resolveConflicts(
clt_parameters.plMaxEigen,
clt_parameters.plStarSteps, // int starSteps, // How far to look around when calculationg connection cost
clt_parameters.plStarOrtho, // double orthoWeight,
clt_parameters.plStarDiag, // double diagonalWeight,
clt_parameters.plStarPwr, // double starPwr, // Divide cost by number of connections to this power
clt_parameters.plDblTriLoss, // double diagonalWeight,
clt_parameters.plPreferDisparity,
1, // final int debugLevel)
clt_parameters.tileX,
clt_parameters.tileY);
System.out.println("Pass "+(pass+1)+": dual_tri_results (success/failures) = "+dual_tri_results[0]+" / "+dual_tri_results[1]);
int [] conflict_resoultion_results = st.resolveMultiTriangularConflicts(
conflicts0, // int [][][] conflicts,
conflicts0_stats,
clt_parameters.plStarOrtho, // double orthoWeight,
clt_parameters.plStarDiag, // double diagonalWeight,
clt_parameters.plDblTriLoss, // double diagonalWeight,
clt_parameters.plPreferDisparity,
1, // final int debugLevel)
clt_parameters.tileX,
clt_parameters.tileY);
System.out.println("Pass "+(pass+1)+": multi_tri_results (success/failures) = "+conflict_resoultion_results[0]+" / "+conflict_resoultion_results[1]);
int [] diagonal_resoultion_results = st.resolveDiagonalTriangularConflicts(
conflicts0, // int [][][] conflicts,
conflicts0_stats,
clt_parameters.plStarOrtho, // double orthoWeight,
clt_parameters.plStarDiag, // double diagonalWeight,
clt_parameters.plDblTriLoss, // double diagonalWeight,
clt_parameters.plPreferDisparity,
1, // final int debugLevel)
clt_parameters.tileX,
clt_parameters.tileY);
System.out.println("Pass "+(pass+1)+": resolveDiagonalTriangularConflicts (success/failures) = "+diagonal_resoultion_results[0]+" / "+diagonal_resoultion_results[1]);
if ( (dual_tri_results[0] == 0) &&
(conflict_resoultion_results[0] == 0) &&
(diagonal_resoultion_results[0] == 0)) break;
}
Conflicts conflicts1_stats = new Conflicts(
conflicts0,
st,
1); // -1); // debugLevel);
conflicts1_stats.printConflictSummary("Detected conflicts (all):", true,false,false);
conflicts1_stats.printConflictSummary("Detected conflicts (ortho-diag-ortho):", false, true,false);
conflicts1_stats.printConflictSummary("Detected conflicts(ortho-ortho-diag):", false, false, true);
st.testResoveTriangle(
clt_parameters.plWorstWorsening, // final double worst_worsening,
clt_parameters.plWeakWorsening, // final double worst_worsening,
clt_parameters.plOKMergeEigen, // final double okMergeEigen,
clt_parameters.plMaxWorldSin2, // final double maxWorldSin2,
clt_parameters.plDispNorm,
clt_parameters.plMaxEigen,
clt_parameters.plPreferDisparity,
conflicts0, // int [][][] conflicts,
1, // final int debugLevel)
clt_parameters.tileX,
clt_parameters.tileY);
if (clt_parameters.plSplitApply) {
while (true) {
......@@ -3613,10 +3531,17 @@ public class TileProcessor {
clt_parameters.tileX,
clt_parameters.tileY);
System.out.println("********* Put here conflict resolution again ! *********");
// st.detectTriangularConflicts(
// 1); // final int debugLevel)
st.resolveConflicts(
clt_parameters.plMaxEigen,
clt_parameters.plStarSteps, // int starSteps, // How far to look around when calculationg connection cost
clt_parameters.plStarOrtho, // double orthoWeight,
clt_parameters.plStarDiag, // double diagonalWeight,
clt_parameters.plStarPwr, // double starPwr, // Divide cost by number of connections to this power
clt_parameters.plDblTriLoss, // double diagonalWeight,
clt_parameters.plPreferDisparity,
1, // final int debugLevel)
clt_parameters.tileX,
clt_parameters.tileY);
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment