Commit d059a2ac authored by Andrey Filippov's avatar Andrey Filippov

re-assigning supertiles links

parent 18306caa
......@@ -2187,6 +2187,8 @@ public class EyesisCorrectionParameters {
public double plWeakEigen2 = 0.05; // Maximal eigenvalue of the result of non-weighted merge (second variant)
public double plSumThick = 1.2; // Do not merge if any sqrt of merged eigenvalue exceeds scaled sum of components
public double plNeNeibCost = 5.0; // When calculating non-exclusive planes, do not use neighbors with high cost
public double plExNeibCost = 5.0; // When calculating exclusive planes links, do not use neighbors with high cost
public double plNeOwn = 5.0; // When calculating non-exclusive planes, use cenrter plane relative weight
public double plMaxZRatio = 2.0; // Maximal ratio of Z to allow plane merging
public double plMaxDisp = 0.6; // Maximal disparity of one of the planes to apply maximal ratio
......@@ -2598,6 +2600,7 @@ public class EyesisCorrectionParameters {
properties.setProperty(prefix+"plWeakEigen2", this.plWeakEigen2 +"");
properties.setProperty(prefix+"plSumThick", this.plSumThick +"");
properties.setProperty(prefix+"plNeNeibCost", this.plNeNeibCost +"");
properties.setProperty(prefix+"plExNeibCost", this.plExNeibCost +"");
properties.setProperty(prefix+"plNeOwn", this.plNeOwn +"");
properties.setProperty(prefix+"plMaxZRatio", this.plMaxZRatio +"");
......@@ -2985,6 +2988,7 @@ public class EyesisCorrectionParameters {
if (properties.getProperty(prefix+"plWeakEigen2")!=null) this.plWeakEigen2=Double.parseDouble(properties.getProperty(prefix+"plWeakEigen2"));
if (properties.getProperty(prefix+"plSumThick")!=null) this.plSumThick=Double.parseDouble(properties.getProperty(prefix+"plSumThick"));
if (properties.getProperty(prefix+"plNeNeibCost")!=null) this.plNeNeibCost=Double.parseDouble(properties.getProperty(prefix+"plNeNeibCost"));
if (properties.getProperty(prefix+"plExNeibCost")!=null) this.plExNeibCost=Double.parseDouble(properties.getProperty(prefix+"plExNeibCost"));
if (properties.getProperty(prefix+"plNeOwn")!=null) this.plNeOwn=Double.parseDouble(properties.getProperty(prefix+"plNeOwn"));
if (properties.getProperty(prefix+"plMaxZRatio")!=null) this.plMaxZRatio=Double.parseDouble(properties.getProperty(prefix+"plMaxZRatio"));
......@@ -3401,6 +3405,7 @@ public class EyesisCorrectionParameters {
gd.addNumericField("Maximal eigenvalue of the result of non-weighted merge (second variant)", this.plWeakEigen2, 6);
gd.addNumericField("Do not merge if any sqrt of merged eigenvalue exceeds scaled sum of components", this.plSumThick, 6);
gd.addNumericField("When calculating non-exclusive planes, do not use neighbors with high cost", this.plNeNeibCost, 6);
gd.addNumericField(" When calculating exclusive planes links, do not use neighbors with high cost",this.plExNeibCost, 6);
gd.addNumericField("When calculating non-exclusive planes, use cenrter plane relative weight", this.plNeOwn, 6);
gd.addMessage ("--- ---");
......@@ -3804,6 +3809,7 @@ public class EyesisCorrectionParameters {
this.plWeakEigen2= gd.getNextNumber();
this.plSumThick= gd.getNextNumber();
this.plNeNeibCost= gd.getNextNumber();
this.plExNeibCost= gd.getNextNumber();
this.plNeOwn= gd.getNextNumber();
this.plMaxZRatio= gd.getNextNumber();
......
This diff is collapsed.
......@@ -109,7 +109,8 @@ public class TilePlanes {
double [][] wvectors = null; // [3][3] - eigenvectors calculated in the real world
double [] wvalues = null; // [3] -eigenvalues calculated in the real world
double [][] merged_weig_val = null; // for each of the directions (N, NE, .. NW) quality match for each layer
double [][] merged_weig_eq = null; // for each of the directions (N, NE, .. NW) quality match for each layer - ignoring weights
double [][] merged_weig_eq = null; // for each of the directions (N, NE, .. NW) quality match for each layer - ignoring weights
double [][] link_costs; // for each of the directions (N, NE, .. NW) composite cost of connection
int mark0 = -1; // just for temporary labeling the plane
......@@ -480,6 +481,16 @@ public class TilePlanes {
}
}
if (src.link_costs != null){
dst.link_costs = src.link_costs.clone();
for (int i = 0; i < src.link_costs.length; i++){
if (src.link_costs[i] != null){
dst.link_costs[i] = src.link_costs[i].clone();
}
}
}
if (src.neib_best != null) dst.neib_best = src.neib_best.clone();
// also copy original plane parameters - tile selection and number of points
......@@ -1728,11 +1739,11 @@ public class TilePlanes {
public double [][] initMergedValue()
{
this.merged_eig_val = new double[8][];
this.merged_eig_eq = new double[8][];
this.merged_weig_val = new double[8][];
this.merged_weig_eq = new double[8][];
this.merged_valid = new boolean[8][];
this.merged_eig_val = new double[8][];
this.merged_eig_eq = new double[8][];
this.merged_weig_val = new double[8][];
this.merged_weig_eq = new double[8][];
this.merged_valid = new boolean[8][];
this.merged_strong_valid = new boolean[8][];
return this.merged_eig_val;
}
......@@ -1755,7 +1766,23 @@ public class TilePlanes {
{
return this.merged_weig_eq;
}
public double [][] getLinkCosts()
{
return this.link_costs;
}
public double [] getLinkCosts(int dir)
{
return this.link_costs[dir];
}
public double getLinkCosts(int dir, int np)
{
return this.link_costs[dir][np];
}
public void setLinkCosts(int dir, int plane, double value)
{
this.link_costs[dir][plane] = value;
}
public double [] initMergedValue(int dir, int leng)
{
......@@ -1774,6 +1801,19 @@ public class TilePlanes {
return getMergedValue(dir);
}
public double [][] initLinkCosts(){
this.link_costs = new double[8][];
return link_costs;
}
public double [] initLinkCosts(int dir, int leng)
{
this.link_costs[dir] = new double[leng];
for (int i = 0; i < leng; i++) {
this.link_costs[dir][i] = Double.NaN;
}
return getLinkCosts(dir);
}
public double [] getMergedValue(int dir)
{
if (this.merged_eig_val == null) {
......
......@@ -3251,6 +3251,11 @@ public class TileProcessor {
2, // -1, // debugLevel, // final int debugLevel)
clt_parameters.tileX,
clt_parameters.tileY);
lp.interPlaneCosts( // not used yet, just for testing
st.planes, // final TilePlanes.PlaneData [][] planes,
2, // -1, // debugLevel, // final int debugLevel)
clt_parameters.tileX,
clt_parameters.tileY);
lp.filterNeighborPlanes(
st.planes, // final TilePlanes.PlaneData [][] planes,
......@@ -3698,6 +3703,12 @@ public class TileProcessor {
clt_parameters.tileX,
clt_parameters.tileY);
lp.interPlaneCosts( // not used yet, just for testing
st.planes, // final TilePlanes.PlaneData [][] planes,
2, // -1, // debugLevel, // final int debugLevel)
clt_parameters.tileX,
clt_parameters.tileY);
lp.filterNeighborPlanes(
st.planes, // final TilePlanes.PlaneData [][] planes,
true, // final boolean merge_low_eigen,
......@@ -3769,7 +3780,32 @@ public class TileProcessor {
clt_parameters.plPreferDisparity,
0, // 1,// 0, // final int debugLevel)
clt_parameters.tileX,
clt_parameters.tileY);
clt_parameters.tileY);
// create costs for the modified planes
lp.interPlaneCosts(
st.planes_mod, // final TilePlanes.PlaneData [][] planes,
2, // -1, // debugLevel, // final int debugLevel)
clt_parameters.tileX,
clt_parameters.tileY);
lp.setExclusiveLinks(
st.planes_mod, // final TilePlanes.PlaneData [][] planes,
2, // -1, // debugLevel, // final int debugLevel)
clt_parameters.tileX,
clt_parameters.tileY);
// once more after updating exclusive links
planes_mod = st.planesSmooth(
lp, // LinkPlanes lp,
clt_parameters.plPull, // final double meas_pull,// relative pull of the original (measured) plane with respect to the average of the neighbors
clt_parameters.plMaxEigen, // final double maxValue, // do not combine with too bad planes
clt_parameters.plIterations, // final int num_passes,
clt_parameters.plStopBad, // Do not update supertile if any of connected neighbors is not good (false: just skip that neighbor)
clt_parameters.plNormPow, // 0.0: 8 neighbors pull 8 times as 1, 1.0 - same as 1
Math.pow(10.0, -clt_parameters.plPrecision), // final double maxDiff, // maximal change in any of the disparity values
clt_parameters.plPreferDisparity,
0, // 1,// 0, // final int debugLevel)
clt_parameters.tileX,
clt_parameters.tileY);
} else {
st.planes_mod = st.planes; // just use the measured ones
}
......
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