Commit 6ae8367c authored by Andrey Filippov's avatar Andrey Filippov

started sorting tiles between surfaces

parent 21c0a3c4
......@@ -2212,7 +2212,8 @@ public class EyesisCorrectionParameters {
public boolean msUseSel = true; // Use planes selection masks (generated when splitting to intersecting pairs
public boolean msDivideByArea = true; // Divide plane strengths by ellipsoid area
public double msScaleProj = 1.5; // Scale projection of the plane ellkipsoid
public double msScaleProj = 1.5; // Scale projection of the plane ellipsoid
public double msFractUni = 0.3; // Spread this fraction of the ellipsoid weight among extended (double) supertile
public boolean replaceWeakOutlayers = true; // false;
......@@ -2516,6 +2517,7 @@ public class EyesisCorrectionParameters {
properties.setProperty(prefix+"msUseSel", this.msUseSel+"");
properties.setProperty(prefix+"msDivideByArea", this.msDivideByArea+"");
properties.setProperty(prefix+"msScaleProj", this.msScaleProj +"");
properties.setProperty(prefix+"msFractUni", this.msFractUni +"");
properties.setProperty(prefix+"dbg_migrate", this.dbg_migrate+"");
......@@ -2812,6 +2814,7 @@ public class EyesisCorrectionParameters {
if (properties.getProperty(prefix+"msUseSel")!=null) this.msUseSel=Boolean.parseBoolean(properties.getProperty(prefix+"msUseSel"));
if (properties.getProperty(prefix+"msDivideByArea")!=null) this.msDivideByArea=Boolean.parseBoolean(properties.getProperty(prefix+"msDivideByArea"));
if (properties.getProperty(prefix+"msScaleProj")!=null) this.msScaleProj=Double.parseDouble(properties.getProperty(prefix+"msScaleProj"));
if (properties.getProperty(prefix+"msFractUni")!=null) this.msFractUni=Double.parseDouble(properties.getProperty(prefix+"msFractUni"));
if (properties.getProperty(prefix+"dbg_migrate")!=null) this.dbg_migrate=Boolean.parseBoolean(properties.getProperty(prefix+"dbg_migrate"));
......@@ -3134,6 +3137,7 @@ public class EyesisCorrectionParameters {
gd.addCheckbox ("Use planes selection masks (generated when splitting to intersecting pairs", this.msUseSel);
gd.addCheckbox ("Divide plane strengths by ellipsoid area", this.msDivideByArea);
gd.addNumericField("Scale projection of the plane ellipsoid", this.msScaleProj, 6);
gd.addNumericField("Spread this fraction of the ellipsoid weight among extended (double) supertile",this.msFractUni, 6);
gd.addCheckbox ("Test new mode after migration", this.dbg_migrate);
......@@ -3437,6 +3441,7 @@ public class EyesisCorrectionParameters {
this.msUseSel= gd.getNextBoolean();
this.msDivideByArea= gd.getNextBoolean();
this.msScaleProj= gd.getNextNumber();
this.msFractUni= gd.getNextNumber();
this.dbg_migrate= gd.getNextBoolean();
......
......@@ -380,7 +380,7 @@ public class MeasuredLayers {
* @param sel_in optional selection for this supertile (linescan, 4 * supetile size)
* @param disp_far lowest acceptable disparity value. Double.NaN - do not check.
* @param disp_near highest acceptable disparity value. Double.NaN - do not check.
* @param null_if_none return null if there are no selected tiles in teh result selection
* @param null_if_none return null if there are no selected tiles in the result selection
* @return boolean array [4*superTileSize] of the selected tiles on the specified
* measurement layer
*/
......@@ -548,8 +548,9 @@ public class MeasuredLayers {
* @param stX supertile horizontal position in the image
* @param stY supertile vertical position in the image
* @param sel_in optional selection for this supertile (linescan, 4 * supetile size)
* @param null_if_none return null if there are no selected tiles in the result selection
* @param strength_floor subtract from the correlation strength, limit by 0
* @param strength_pow Non-linear treatment of correlation strength. Raise data to the strength_pow power
* @param null_if_none return null if there are no selected tiles in the result selection
* @return double [2][4*superTileSize] {disparity[4*superTileSize], strength [4*superTileSize]}
*/
......@@ -598,6 +599,40 @@ public class MeasuredLayers {
return ds;
}
/**
* Get disparity and correlation strength for the specific measurement layer.
* Combined with input selection
* @param num_layer number of the measurement layer to process
* @param strength_floor subtract from the correlation strength, limit by 0
* @param strength_pow Non-linear treatment of correlation strength. Raise data to the strength_pow power
* @return double {disparity[tilesX * tilesY], strength[tilesX * tilesY]}
*/
public double[][] getDisparityStrength (
int num_layer,
double strength_floor,
double strength_pow)
{
if (layers[num_layer] == null){
return null;
}
double [][] ds = {getDisparity(num_layer),getStrength(num_layer)};
for (int i = 0; i < ds[1].length; i++){
double w = ds[1][i] - strength_floor;
if (w > 0) {
if (strength_pow != 1.0) w = Math.pow(w, strength_pow);
ds[1][i] = w;
} else {
ds[1][i] = 0.0;
}
}
return ds;
}
/**
* Get double-size (for overlapping) array of disparities and strengths for the supertile
* Using best (producing lowest disparity variance) subset of neighbor tiles
......
......@@ -5981,5 +5981,29 @@ public class SuperTiles{
return snap_sort;
}
public double [][][] getDisparityStrengths(
int stMeasSel) // = 1; // Select measurements for supertiles : +1 - combo, +2 - quad +4 - hor +8 - vert)
{
int numMeasLayers = measuredLayers.getNumLayers();
double [][][] ds = new double[numMeasLayers][][];
for (int ml = 0; ml < numMeasLayers; ml++) if ((stMeasSel & ( 1 << ml)) != 0) {
ds[ml] = measuredLayers.getDisparityStrength (
ml, // int num_layer,
this.strength_floor, // double strength_floor,
this.strength_pow); // double strength_pow)
}
return ds;
}
public boolean [][] getMeasurementSelections(
int stMeasSel) // = 1; // Select measurements for supertiles : +1 - combo, +2 - quad +4 - hor +8 - vert)
{
int numMeasLayers = measuredLayers.getNumLayers();
boolean [][] sels = new boolean[numMeasLayers][];
for (int ml = 0; ml < numMeasLayers; ml++) if ((stMeasSel & ( 1 << ml)) != 0) {
sels[ml] = measuredLayers.getSelection (ml);
}
return sels;
}
} // end of class SuperTiles
......@@ -1475,6 +1475,7 @@ public class TilePlanes {
* @param use_sel use plane selection (this.sel_mask) to select only some part of the plane
* @param divide_by_area divide weights by ellipsoid area
* @param scale_projection use plane ellipsoid projection for weight: 0 - do not use, > 0 linearly scale ellipsoid
* @param fraction_uni add fraction of the total weight to each tile
* @return a pair of arrays {disparity, strength}, each [2 * superTileSize * 2 * superTileSize], only 1/2 or 1/4 used for offset tiles\
* TODO: add a combination of the ellipses and infinite planes?
*
......@@ -1485,6 +1486,7 @@ public class TilePlanes {
boolean use_sel,
boolean divide_by_area,
double scale_projection,
double fraction_uni,
int debugLevel)
{
double [][] disp_strength = new double[2][4*superTileSize*superTileSize];
......@@ -1555,8 +1557,6 @@ public class TilePlanes {
int indx_i = iy * ss4 + ix; // input index
disp_strength[0][indx] = zxy[0] - (normal[1] * x + normal[2] * y)/normal[0];
double w = weight;
if (window != null) w *= window[indx_i];
if (use_sel && (sel_mask != null) && !(sel_mask[indx_i])) w = 0.0;
if ((w > 0.0) && (scale_projection > 0.0)){
double [] xy = {x,y};
Matrix vxy = vect2d.times(new Matrix(xy,2)); // verify if it is correct
......@@ -1565,7 +1565,10 @@ public class TilePlanes {
double d = vxy.get(i,0);
r2 += d * d / val2d.get(i, i);
}
w *= Math.exp(-k_gauss*r2);
w *= ((1.0 - fraction_uni) * Math.exp(-k_gauss*r2) + fraction_uni);
if (window != null) w *= window[indx_i];
if (use_sel && (sel_mask != null) && !(sel_mask[indx_i])) w = 0.0;
}
disp_strength[1][indx] = w;
}
......
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