Commit 9cfff83b authored by Andrey Filippov's avatar Andrey Filippov

added/tested adding final links after planes smooth

parent 9b725244
......@@ -2200,7 +2200,13 @@ public class EyesisCorrectionParameters {
public boolean plConflMerge = true; // Try to merge conflicting planes
public double plConflRelax = 1.5; // Scale parameters to relax planes fit for merging conflicting planes
public boolean plConflSngl = true; // Only merge conflicting planes if this is the only conflicting pair in the supertile
public boolean plConflSnglPair = true; // Only merge conflicting planes only if there are just two planes in the supertile
public boolean plConflSnglPair = true; // Only merge conflicting planes only if there are just two planes in the supertile
public double plThickWorld = 0.2; // Maximal real-world thickness of merged overlapping planes (meters)
public double plThickWorldConfl = 0.4; // Maximal real-world merged thickness for conflicting planes
public double plRelaxComplete = 1.5; // Relax cost requirements when adding exclusive links to complete squares and triangles
public double plRelaxComplete2 = 2.0; // Relax cost requirements during the second pass
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
......@@ -2256,6 +2262,7 @@ public class EyesisCorrectionParameters {
public boolean plMutualOnly = true; // keep only mutual links, remove weakest if conflict
public boolean plFillSquares = true; // Add diagonals to full squares
public boolean plCutCorners = true; // Add ortho to 45-degree corners
public boolean plHypotenuse = true; // Add hypotenuse connection if both legs exist
public double plPull = 5.0; // .3; // Relative weight of original (measured) plane compared to average neighbor pull
// when combing with neighbors
......@@ -2626,6 +2633,10 @@ public class EyesisCorrectionParameters {
properties.setProperty(prefix+"plConflRelax", this.plConflRelax +"");
properties.setProperty(prefix+"plConflSngl", this.plConflSngl+"");
properties.setProperty(prefix+"plConflSnglPair", this.plConflSnglPair+"");
properties.setProperty(prefix+"plThickWorld", this.plThickWorld +"");
properties.setProperty(prefix+"plThickWorldConfl",this.plThickWorldConfl +"");
properties.setProperty(prefix+"plRelaxComplete", this.plRelaxComplete +"");
properties.setProperty(prefix+"plRelaxComplete2", this.plRelaxComplete2 +"");
properties.setProperty(prefix+"plMaxZRatio", this.plMaxZRatio +"");
properties.setProperty(prefix+"plMaxDisp", this.plMaxDisp +"");
......@@ -2676,6 +2687,7 @@ public class EyesisCorrectionParameters {
properties.setProperty(prefix+"plMutualOnly", this.plMutualOnly+"");
properties.setProperty(prefix+"plFillSquares", this.plFillSquares+"");
properties.setProperty(prefix+"plCutCorners", this.plCutCorners+"");
properties.setProperty(prefix+"plHypotenuse", this.plHypotenuse+"");
properties.setProperty(prefix+"plPull", this.plPull +"");
properties.setProperty(prefix+"plNormPow", this.plNormPow +"");
properties.setProperty(prefix+"plIterations", this.plIterations+"");
......@@ -3026,6 +3038,10 @@ public class EyesisCorrectionParameters {
if (properties.getProperty(prefix+"plConflRelax")!=null) this.plConflRelax=Double.parseDouble(properties.getProperty(prefix+"plConflRelax"));
if (properties.getProperty(prefix+"plConflSngl")!=null) this.plConflSngl=Boolean.parseBoolean(properties.getProperty(prefix+"plConflSngl"));
if (properties.getProperty(prefix+"plConflSnglPair")!=null) this.plConflSnglPair=Boolean.parseBoolean(properties.getProperty(prefix+"plConflSnglPair"));
if (properties.getProperty(prefix+"plThickWorld")!=null) this.plThickWorld=Double.parseDouble(properties.getProperty(prefix+"plThickWorld"));
if (properties.getProperty(prefix+"plThickWorldConfl")!=null) this.plThickWorldConfl=Double.parseDouble(properties.getProperty(prefix+"plThickWorldConfl"));
if (properties.getProperty(prefix+"plRelaxComplete")!=null) this.plRelaxComplete=Double.parseDouble(properties.getProperty(prefix+"plRelaxComplete"));
if (properties.getProperty(prefix+"plRelaxComplete2")!=null) this.plRelaxComplete2=Double.parseDouble(properties.getProperty(prefix+"plRelaxComplete2"));
if (properties.getProperty(prefix+"plMaxZRatio")!=null) this.plMaxZRatio=Double.parseDouble(properties.getProperty(prefix+"plMaxZRatio"));
if (properties.getProperty(prefix+"plMaxDisp")!=null) this.plMaxDisp=Double.parseDouble(properties.getProperty(prefix+"plMaxDisp"));
......@@ -3076,6 +3092,7 @@ public class EyesisCorrectionParameters {
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+"plCutCorners")!=null) this.plCutCorners=Boolean.parseBoolean(properties.getProperty(prefix+"plCutCorners"));
if (properties.getProperty(prefix+"plHypotenuse")!=null) this.plHypotenuse=Boolean.parseBoolean(properties.getProperty(prefix+"plHypotenuse"));
if (properties.getProperty(prefix+"plPull")!=null) this.plPull=Double.parseDouble(properties.getProperty(prefix+"plPull"));
if (properties.getProperty(prefix+"plNormPow")!=null) this.plNormPow=Double.parseDouble(properties.getProperty(prefix+"plNormPow"));
......@@ -3451,10 +3468,14 @@ public class EyesisCorrectionParameters {
gd.addNumericField("Cost threshold for merging same tile planes if not connected", this.plMergeCost, 6);
gd.addMessage ("--- Merging planes with topological conflicts ---");
gd.addCheckbox ("Try to merge conflicting planes", this.plConflMerge);
gd.addNumericField("Scale parameters to relax planes fit for merging conflicting planes", this.plConflRelax, 6);
gd.addCheckbox ("Only merge conflicting planes if this is the only conflicting pair in the supertile",this.plConflSngl);
gd.addCheckbox ("Only merge conflicting planes only if there are just two planes in the supertile", this.plConflSnglPair);
gd.addCheckbox ("Try to merge conflicting planes", this.plConflMerge);
gd.addNumericField("Scale parameters to relax planes fit for merging conflicting planes", this.plConflRelax, 6);
gd.addCheckbox ("Only merge conflicting planes if this is the only conflicting pair in the supertile", this.plConflSngl);
gd.addCheckbox ("Only merge conflicting planes only if there are just two planes in the supertile", this.plConflSnglPair);
gd.addNumericField("Maximal real-world thickness of merged overlapping planes (meters)", this.plThickWorld, 6);
gd.addNumericField("Maximal real-world merged thickness for conflicting planes", this.plThickWorldConfl, 6);
gd.addNumericField("Relax cost requirements when adding exclusive links to complete squares and triangles",this.plRelaxComplete, 6);
gd.addNumericField("Relax cost requirements more during the second pass", this.plRelaxComplete2, 6);
gd.addMessage ("--- ---");
gd.addNumericField("Maximal ratio of Z to allow plane merging", this.plMaxZRatio, 6);
......@@ -3509,6 +3530,7 @@ public class EyesisCorrectionParameters {
gd.addCheckbox ("Add diagonals to full squares", this.plFillSquares);
gd.addCheckbox ("Add ortho to 45-degree corners", this.plCutCorners);
gd.addCheckbox ("Add hypotenuse connection if both legs exist", this.plHypotenuse);
gd.addNumericField("Relative (to average neighbor) weight of the measured plane when combing with neighbors", this.plPull, 6);
gd.addNumericField("0.0: 8 neighbors pull 8 times as 1, 1.0 - same as 1", this.plNormPow, 6);
......@@ -3871,6 +3893,10 @@ public class EyesisCorrectionParameters {
this.plConflRelax= gd.getNextNumber();
this.plConflSngl= gd.getNextBoolean();
this.plConflSnglPair= gd.getNextBoolean();
this.plThickWorld= gd.getNextNumber();
this.plThickWorldConfl= gd.getNextNumber();
this.plRelaxComplete= gd.getNextNumber();
this.plRelaxComplete2= gd.getNextNumber();
this.plMaxZRatio= gd.getNextNumber();
this.plMaxDisp= gd.getNextNumber();
......@@ -3922,6 +3948,7 @@ public class EyesisCorrectionParameters {
this.plFillSquares= gd.getNextBoolean();
this.plCutCorners= gd.getNextBoolean();
this.plHypotenuse= gd.getNextBoolean();
this.plPull= gd.getNextNumber();
this.plNormPow= gd.getNextNumber();
......
This diff is collapsed.
......@@ -5508,11 +5508,16 @@ public class QuadCLT {
int debugLevel
)
{
final boolean new_mode = false;
final int tilesX = tp.getTilesX();
final int tilesY = tp.getTilesY();
showDoubleFloatArrays sdfa_instance = null;
if (clt_parameters.debug_filters && (debugLevel > -1)) sdfa_instance = new showDoubleFloatArrays(); // just for debugging?
if (clt_parameters.debug_filters && (debugLevel > -1))
sdfa_instance = new showDoubleFloatArrays(); // just for debugging?
CLTPass3d bgnd_data = tp.clt_3d_passes.get(0);
double [][][][] texture_tiles = bgnd_data.texture_tiles;
......@@ -5527,6 +5532,26 @@ public class QuadCLT {
disparity_index, // index of disparity value in disparity_map == 2 (0,2 or 4)
clt_parameters.show_bgnd_nonbgnd,
(clt_parameters.debug_filters ? (debugLevel) : -1));
boolean [] bgnd_tiles_new = tp.getBackgroundMask_new( // which tiles do belong to the background
clt_parameters.bgnd_range, // disparity range to be considered background
clt_parameters.bgnd_sure, // minimal strength to be considered definitely background
clt_parameters.bgnd_maybe, // maximal strength to ignore as non-background
clt_parameters.sure_smth, // if 2-nd worst image difference (noise-normalized) exceeds this - do not propagate bgnd
clt_parameters.min_clstr_seed, // number of tiles in a cluster to seed (just background?)
clt_parameters.min_clstr_block,// number of tiles in a cluster to block (just non-background?)
disparity_index, // index of disparity value in disparity_map == 2 (0,2 or 4)
clt_parameters.show_bgnd_nonbgnd,
(clt_parameters.debug_filters ? (debugLevel) : -1));
boolean [] bgnd_dbg = bgnd_tiles.clone(); // only these have non 0 alpha
// TODO: fix mess - after modifying getBackgroundMask() to getBackgroundMask_new (before road with tractor was identified as a background because of a double
// tile glitch, the background was wrong. So temporarily both old/new are used and combined (new is grown twice)
// still does not work - using old variant for now
// background selections (slightly) influences the plane mertging / connections
for (int i = 0; i < bgnd_tiles.length; i++){
// bgnd_tiles[i] &= bgnd_tiles_new[i];
}
boolean [] bgnd_strict = bgnd_tiles.clone(); // only these have non 0 alpha
tp.growTiles(
clt_parameters.bgnd_grow, // grow tile selection by 1 over non-background tiles 1: 4 directions, 2 - 8 directions, 3 - 8 by 1, 4 by 1 more
......@@ -5537,36 +5562,62 @@ public class QuadCLT {
2, // grow tile selection by 1 over non-background tiles 1: 4 directions, 2 - 8 directions, 3 - 8 by 1, 4 by 1 more
bgnd_tiles,
null); // prohibit
// hacking - grow bgnd texture even more, without changing selection
boolean [] bgnd_tiles_grown2 = bgnd_tiles_grown.clone(); // only these have non 0 alpha
bgnd_data.selected = bgnd_tiles_grown; // selected for background w/o extra transparent layer
tp.growTiles(
2, // grow tile selection by 1 over non-background tiles 1: 4 directions, 2 - 8 directions, 3 - 8 by 1, 4 by 1 more
bgnd_tiles_grown2,
null); // prohibit
if (sdfa_instance!=null){
double [][] dbg_img = new double[3][tilesY * tilesX];
String [] titles = {"strict","grown","more_grown"};
double [][] dbg_img = new double[5][tilesY * tilesX];
String [] titles = {"old","new","strict","grown","more_grown"};
for (int i = 0; i<dbg_img[0].length;i++){
dbg_img[0][i] = bgnd_strict[i]?1:0;
dbg_img[1][i] = bgnd_tiles_grown[i]?1:0;
dbg_img[2][i] = bgnd_tiles[i]?1:0;
//
dbg_img[0][i] = bgnd_dbg[i]?1:0;
dbg_img[1][i] = bgnd_tiles_new[i]?1:0;
dbg_img[2][i] = bgnd_strict[i]?1:0;
dbg_img[3][i] = bgnd_tiles_grown[i]?1:0;
dbg_img[4][i] = bgnd_tiles[i]?1:0;
}
sdfa_instance.showArrays(dbg_img, tilesX, tilesY, true, "strict_grown",titles);
}
double [][][][] texture_tiles_bgnd = new double[tilesY][tilesX][][];
double [] alpha_zero = new double [4*clt_parameters.transform_size*clt_parameters.transform_size];
int alpha_index = 3;
for (int i = 0; i < alpha_zero.length; i++) alpha_zero[i]=0.0;
for (int tileY = 0; tileY < tilesY; tileY++){
for (int tileX = 0; tileX < tilesX; tileX++){
texture_tiles_bgnd[tileY][tileX]= null;
if ((texture_tiles[tileY][tileX] != null) &&
bgnd_tiles[tileY * tilesX + tileX]) {
if (bgnd_tiles_grown[tileY * tilesX + tileX]) {
texture_tiles_bgnd[tileY][tileX]= texture_tiles[tileY][tileX];
}else{
texture_tiles_bgnd[tileY][tileX]= texture_tiles[tileY][tileX].clone();
texture_tiles_bgnd[tileY][tileX][alpha_index] = alpha_zero;
if (new_mode) {
for (int tileY = 0; tileY < tilesY; tileY++){
for (int tileX = 0; tileX < tilesX; tileX++){
texture_tiles_bgnd[tileY][tileX]= null;
if ((texture_tiles[tileY][tileX] != null) &&
// bgnd_tiles[tileY * tilesX + tileX]) {
bgnd_tiles_grown2[tileY * tilesX + tileX]) {
// if (bgnd_tiles_grown[tileY * tilesX + tileX]) {
if (bgnd_tiles[tileY * tilesX + tileX]) {
texture_tiles_bgnd[tileY][tileX]= texture_tiles[tileY][tileX];
}else{
texture_tiles_bgnd[tileY][tileX]= texture_tiles[tileY][tileX].clone();
texture_tiles_bgnd[tileY][tileX][alpha_index] = alpha_zero;
}
}
}
}
} else {
for (int tileY = 0; tileY < tilesY; tileY++){
for (int tileX = 0; tileX < tilesX; tileX++){
texture_tiles_bgnd[tileY][tileX]= null;
if ((texture_tiles[tileY][tileX] != null) &&
bgnd_tiles[tileY * tilesX + tileX]) {
if (bgnd_tiles_grown[tileY * tilesX + tileX]) {
texture_tiles_bgnd[tileY][tileX]= texture_tiles[tileY][tileX];
}else{
texture_tiles_bgnd[tileY][tileX]= texture_tiles[tileY][tileX].clone();
texture_tiles_bgnd[tileY][tileX][alpha_index] = alpha_zero;
}
}
}
}
......
This diff is collapsed.
This diff is collapsed.
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