Commit 5ab65126 authored by Andrey Filippov's avatar Andrey Filippov

showing edges fro plane pairs

parent bdf3d47f
......@@ -2160,10 +2160,13 @@ public class EyesisCorrectionParameters {
public double plPull = .1; // Relative weight of original (measured) plane when combing with neighbors
public int plIterations = 10; // Maximal number of smoothing iterations for each step
public boolean plStopBad = true; // Do not update supertile if any of connected neighbors is not good (false: just skip that neighbor)
public int plPrecision = 6; // Maximal step difference (1/power of 10)
public double plSplitPull = .5; // Relative weight of center plane when splitting into pairs
public int plSplitMinNeib = 2; // Minimal number of neighbors to split plane in pairs
public double plSplitMinWeight = 2.0; // Minimal weight of split plains to show
public double plSplitMinQuality = 1.1; // Minimal split quality to show
public boolean plFuse = true; // Fuse planes together (off for debug only)
......@@ -2430,10 +2433,13 @@ public class EyesisCorrectionParameters {
properties.setProperty(prefix+"plPull", this.plPull +"");
properties.setProperty(prefix+"plIterations", this.plIterations+"");
properties.setProperty(prefix+"plStopBad", this.plStopBad+"");
properties.setProperty(prefix+"plPrecision", this.plPrecision+"");
properties.setProperty(prefix+"plSplitPull", this.plSplitPull +"");
properties.setProperty(prefix+"plSplitMinNeib", this.plSplitMinNeib+"");
properties.setProperty(prefix+"plSplitMinWeight", this.plSplitMinWeight +"");
properties.setProperty(prefix+"plSplitMinQuality",this.plSplitMinQuality +"");
properties.setProperty(prefix+"plFuse", this.plFuse+"");
properties.setProperty(prefix+"plKeepOrphans", this.plKeepOrphans+"");
......@@ -2687,10 +2693,13 @@ public class EyesisCorrectionParameters {
if (properties.getProperty(prefix+"plPull")!=null) this.plPull=Double.parseDouble(properties.getProperty(prefix+"plPull"));
if (properties.getProperty(prefix+"plIterations")!=null) this.plIterations=Integer.parseInt(properties.getProperty(prefix+"plIterations"));
if (properties.getProperty(prefix+"plStopBad")!=null) this.plStopBad=Boolean.parseBoolean(properties.getProperty(prefix+"plStopBad"));
if (properties.getProperty(prefix+"plPrecision")!=null) this.plPrecision=Integer.parseInt(properties.getProperty(prefix+"plPrecision"));
if (properties.getProperty(prefix+"plSplitPull")!=null) this.plSplitPull=Double.parseDouble(properties.getProperty(prefix+"plSplitPull"));
if (properties.getProperty(prefix+"plSplitMinNeib")!=null) this.plSplitMinNeib=Integer.parseInt(properties.getProperty(prefix+"plSplitMinNeib"));
if (properties.getProperty(prefix+"plSplitMinWeight")!=null) this.plSplitMinWeight=Double.parseDouble(properties.getProperty(prefix+"plSplitMinWeight"));
if (properties.getProperty(prefix+"plSplitMinQuality")!=null) this.plSplitMinQuality=Double.parseDouble(properties.getProperty(prefix+"plSplitMinQuality"));
if (properties.getProperty(prefix+"plFuse")!=null) this.plFuse=Boolean.parseBoolean(properties.getProperty(prefix+"plFuse"));
if (properties.getProperty(prefix+"plKeepOrphans")!=null) this.plKeepOrphans=Boolean.parseBoolean(properties.getProperty(prefix+"plKeepOrphans"));
......@@ -2966,10 +2975,13 @@ public class EyesisCorrectionParameters {
gd.addNumericField("Relative weight of original (measured) plane when combing with neighbors", this.plPull, 6);
gd.addNumericField("Maximal number of smoothing iterations for each step", this.plIterations, 0);
gd.addCheckbox ("Do not update supertile if any of connected is not good (false: just skip that neighbor)", this.plStopBad);
gd.addNumericField("Maximal step difference (1/power of 10)", this.plPrecision, 0);
gd.addNumericField("Relative weight of center plane when splitting into pairs", this.plSplitPull, 6);
gd.addNumericField("Minimal number of neighbors to split plane in pairs", this.plSplitMinNeib, 0);
gd.addNumericField(" Minimal weight of split plains to show", this.plSplitMinWeight, 6);
gd.addNumericField("Minimal split quality to show", this.plSplitMinQuality, 6);
gd.addCheckbox ("Fuse planes together (off for debug only)", this.plFuse);
gd.addCheckbox ("Keep unconnected supertiles", this.plKeepOrphans);
......@@ -3233,10 +3245,13 @@ public class EyesisCorrectionParameters {
this.plPull= gd.getNextNumber();
this.plIterations= (int) gd.getNextNumber();
this.plStopBad= gd.getNextBoolean();
this.plPrecision= (int) gd.getNextNumber();
this.plSplitPull= gd.getNextNumber();
this.plSplitMinNeib= (int) gd.getNextNumber();
this.plSplitMinWeight= gd.getNextNumber();
this.plSplitMinQuality= gd.getNextNumber();
this.plFuse= gd.getNextBoolean();
this.plKeepOrphans= gd.getNextBoolean();
......
This diff is collapsed.
......@@ -281,6 +281,10 @@ public class TilePlanes {
public void setWeight(double weight) {
this.weight = weight;
}
public void scaleWeight(double scale) {
this.weight *= scale;
}
public double [] getWorldXYZ(boolean correct_distortions)
{
return getWorldXYZ(correct_distortions,0);
......@@ -457,6 +461,7 @@ public class TilePlanes {
PlaneData otherPd,
double scale_other,
boolean ignore_weights,
boolean sum_weights,
boolean preferDisparity, // Always start with disparity-most axis (false - lowest eigenvalue)
int debugLevel)
{
......@@ -608,7 +613,12 @@ public class TilePlanes {
pd.setZxy(common_center.getColumnPackedCopy()); // set new center
// what weight to use? cloned is original weight for this supertile
// or use weighted average like below?
pd.setWeight(other_fraction * otherPd.weight + (1.0 - other_fraction) * this.weight);
if (sum_weights) {
pd.setWeight(sum_weight); // normalize while averaging by the caller
} else { // how it was before
pd.setWeight(other_fraction * otherPd.weight + (1.0 - other_fraction) * this.weight);
}
return pd;
}
......@@ -968,9 +978,9 @@ public class TilePlanes {
acovar [2][0] = acovar [0][2];
acovar [2][1] = acovar [1][2];
Matrix covar = new Matrix(acovar);
if (Math.abs(covar.det()) < mindet){
debugLevel = 5;
}
// if (Math.abs(covar.det()) < mindet){
// debugLevel = 5;
// }
EigenvalueDecomposition eig = covar.eig();
if (Double.isNaN(eig.getV().get(0, 0))){
......@@ -978,9 +988,9 @@ public class TilePlanes {
debugLevel = 20;
}
if (eig.getD().get(0, 0) == 0.0){
debugLevel = 10;
}
// if (eig.getD().get(0, 0) == 0.0){
// debugLevel = 10;
// }
if (debugLevel > 0){
System.out.println("getCovar(): sw = "+sw +", swz = "+swz +", swx = "+swx +", swy = "+swy +", covar.det() = "+covar.det());
System.out.println("getCovar(): covarianvce matrix, number of used points:"+numPoints);
......@@ -1014,7 +1024,7 @@ public class TilePlanes {
select = new boolean [4*stSize];
for (int i = 0; i < select.length; i++) select[i] = true;
}
int debugLevel1 = ((sTileXY[0] == 27) && (sTileXY[1] == 16))? 1: 0; // check why v[0][0] <0
// int debugLevel1 = ((sTileXY[0] == 27) && (sTileXY[1] == 16))? 1: 0; // check why v[0][0] <0
double [][][] rslt = getCovar(
......@@ -1022,7 +1032,7 @@ public class TilePlanes {
weight,
select,
0.0,
debugLevel1); //0); // debugLevel);
0); // debugLevel1); //0); // debugLevel);
if (rslt == null) return null;
int numPoints = (int) rslt[2][0][2];
double swc = rslt[2][0][0];
......
......@@ -2940,6 +2940,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
CLTPass3d scan_prev = clt_3d_passes.get(clt_3d_passes.size() -1); // get last one
SuperTiles st = scan_prev.getSuperTiles();
......@@ -3002,7 +3003,9 @@ public class TileProcessor {
st.resetPlanesMod(); // clean start
planes_mod = st.planesSmooth(
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)
Math.pow(10.0, -clt_parameters.plPrecision), // final double maxDiff, // maximal change in any of the disparity values
clt_parameters.plPreferDisparity,
0, // final int debugLevel)
......@@ -3042,15 +3045,25 @@ public class TileProcessor {
TilePlanes.PlaneData[][][] split_planes =
st.breakPlanesToPairs(
st.getPlanes(), // Mod(), // final TilePlanes.PlaneData[][] center_planes, // measured_planes,
st.getPlanes(), // Mod(), // final TilePlanes.PlaneData[][] neib_planes, //mod_planes,
clt_parameters.plSplitPull , // final double center_pull,
clt_parameters.plSplitMinNeib , // min_neibs, // 2
st.getPlanes(), // Mod(), // final TilePlanes.PlaneData[][] neib_planes, //mod_planes,
clt_parameters.plSplitPull , // final double center_pull,
clt_parameters.plSplitMinNeib , // min_neibs, // 2
clt_parameters.plSplitMinWeight, // final double splitMinWeight, // = 2.0; // Minimal weight of split plains to show
clt_parameters.plSplitMinQuality, // final double splitMinQuality, // = 1.1; // Minimal split quality to show
clt_parameters.plPreferDisparity,
1, // final int debugLevel)
clt_parameters.tileX,
clt_parameters.tileY);
if (clt_parameters.show_planes){
double [] split_lines = st.showSplitLines(
split_planes,
1, // final int debugLevel)
clt_parameters.tileX,
clt_parameters.tileY);
int [] wh = st.getShowPlanesWidthHeight();
double [][] plane_data_nonan = st.getShowPlanes(
(planes_mod != null) ? st.getPlanesMod():st.getPlanes(),
......@@ -3068,7 +3081,7 @@ public class TileProcessor {
true, //boolean use_NaN)
0.0,
10.0);
double [][] plane_data = new double [plane_data_nonan.length + plane_data_nan.length][];
double [][] plane_data = new double [plane_data_nonan.length + plane_data_nan.length + 2][];
int indx = 0;
for (int i = 0; i < plane_data_nonan.length; i++){
plane_data[indx++] = plane_data_nonan[i];
......@@ -3076,6 +3089,13 @@ public class TileProcessor {
for (int i = 0; i < plane_data_nan.length; i++){
plane_data[indx++] = plane_data_nan[i];
}
plane_data[indx++] = split_lines;
plane_data[indx] = plane_data[indx-2].clone();
for (int i = 0; i < plane_data[indx].length;i++){
if (Double.isNaN(plane_data[indx][i])) plane_data[indx][i] = 0.0;
if (plane_data[indx-1][i] > 0) plane_data[indx][i] = Double.NaN;
}
sdfa_instance.showArrays(plane_data, wh[0], wh[1], true, "plane_data");
plane_data = st.getShowShells(
......
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