Commit 204eba2c authored by Andrey Filippov's avatar Andrey Filippov

More work on poles

parent 7dac691f
......@@ -39,11 +39,20 @@
<artifactId>commons-configuration</artifactId>
<version>1.7</version>
</dependency>
<!-- https://mvnrepository.com/artifact/gov.nist.math/jama -->
<dependency>
<groupId>gov.nist.math</groupId>
<artifactId>jama</artifactId>
<version>1.0.3</version>
</dependency>
<!--
<dependency>
<groupId>jama</groupId>
<artifactId>jama</artifactId>
<version>1.0.2</version>
<version>1.0.3</version>
</dependency>
-->
<dependency>
<groupId>commons-lang</groupId>
<artifactId>commons-lang</artifactId>
......
......@@ -398,7 +398,7 @@ public class AlignmentCorrection {
use_poly, // final boolean use_poly,
clt_parameters.fcorr_inf_quad, // final boolean use_quadratic,
clt_parameters.fcorr_inf_vert, // final boolean use_vertical,
// now disaprity is already restored
// now disparity is already restored
false, //clt_parameters.ly_inf_en, // final boolean use_disparity, // for infinity - if true, restores differences in the direction of disparity that was subtracted during measurement)
// For ly_inf_en need to make sure that programmed disparity was 0.0, so
clt_parameters.ly_inf_disp, //final boolean allow_dispatity,
......@@ -1933,7 +1933,7 @@ B = |+dy0 -dy1 -2*dy3 |
}
}
// reduce influence of high disparity, using combined disaprity
// reduce influence of high disparity, using combined disparity
// double norm_ly_disparity = 100.0; // disabling
for (int nTile = 0; nTile < num_tiles; nTile++) {
if ((combo_mismatch[0][nTile] > 0) && (combo_mismatch[0][nTile] > ly_norm_disp)) {
......
import java.util.Properties;
/**
**
** BiQuadParameters - parameters defining Operation of a two quad camera rig
......@@ -24,6 +22,8 @@ import java.util.Properties;
**
*/
import java.util.Properties;
public class BiQuadParameters {
public boolean rig_mode_debug = true;
public boolean no_int_x0 = true; // do not offset window to integer maximum for the rig - used when averaging low textures to avoid "jumps" for very wide maximums
......@@ -447,7 +447,7 @@ public class BiQuadParameters {
"Try trimming hanging FG (need improvement)");
gd.addNumericField("Absolute tolerane to determine that a tile is a background one for the selected plane",this.pf_atolerance, 4,6,"pix",
"When a tile has disparity smaller than a plane by more than this value it is considered to be farther (in backgeround)");
gd.addNumericField("Relative (to center tile disaprity) disaprity tolerance to distinguish between FG and BG", this.pf_rtolerance, 4,6,"pix/pix",
gd.addNumericField("Relative (to center tile disparity) disparity tolerance to distinguish between FG and BG", this.pf_rtolerance, 4,6,"pix/pix",
"Product of this value by the center disparity is added to the absolute tolerance (above)?");
gd.addNumericField("How many directions to look into (evenly of all 360) when trimming weak FG", this.pf_num_dirs, 0,3,"",
"Weak FG trimming (after more permissive bridging over gaps) assumes that the FG adge should be strong, it looks in specified number of directions");
......
......@@ -486,7 +486,7 @@ public class BiScan {
* calcTrusted should be called before to set up trusted/cond_trusted tiles
* suggested tiles will be compared against and made sure they differ by more than a specified margin
* 1) current measured (refined) disparity value
* 2) target disaprity that lead to the current measurement after refinement
* 2) target disparity that lead to the current measurement after refinement
* 3) any other disable measurement
* 4) any target disparity that lead to the disabled measurement
* @param area_of_interest - limit results to these tiles (if provided)
......@@ -518,7 +518,7 @@ public class BiScan {
* @param use_alt use tiles from other scans if they fit better
* @param goal_fraction_rms try to make rms to be this fraction of maximal acceptable by removing outliers
* @param boost_low_density 0.0 - strength is proportional to 1/density, 1.0 - same as remaining tiles
* @param smooth_ds optionally fill disaprity/strength instead of the target_disparity
* @param smooth_ds optionally fill disparity/strength instead of the target_disparity
* @param fourq_min each of the 4 corners should have at least this number of tiles.
* @param fourq_gap symmetrical vertical and horizontal center areas that do not belong to any corner
* @param dbg_x tileX to debug
......
......@@ -30,7 +30,7 @@ public class CLTPass3d{
// static double max_overexposed = 0.8; // TODO: make parameter
public double [][] disparity; // per-tile disparity set for the pass[tileY][tileX]
public int [][] tile_op; // what was done in the current pass
private double [][] disparity_sav; // saved disaprity
private double [][] disparity_sav; // saved disparity
private int [][] tile_op_sav; // saved tile_op
public double [][] disparity_map = null; // add 4 layers - worst difference for the port
double [] calc_disparity = null; // composite disparity, calculated from "disparity", and "disparity_map" fields
......
......@@ -3037,6 +3037,7 @@ public class EyesisCorrectionParameters {
public ImageDttParameters img_dtt = new ImageDttParameters();
public BiQuadParameters rig = new BiQuadParameters();
public PoleProcessorParameters poles = new PoleProcessorParameters();
public MeasuredLayersFilterParameters mlfp = new MeasuredLayersFilterParameters();
public HashMap<String,Double> z_corr_map = new HashMap<String,Double>();
......@@ -3681,6 +3682,8 @@ public class EyesisCorrectionParameters {
img_dtt.setProperties (prefix+"_img_dtt", properties);
mlfp.setProperties (prefix+"_mlfp", properties);
rig.setProperties (prefix+"_rig", properties);
poles.setProperties (prefix+"_poles", properties);
}
public void getProperties(String prefix,Properties properties){
......@@ -4329,6 +4332,7 @@ public class EyesisCorrectionParameters {
img_dtt.getProperties (prefix+"_img_dtt", properties);
mlfp.getProperties (prefix+"_mlfp", properties);
rig.getProperties (prefix+"_rig", properties);
poles.getProperties (prefix+"_poles", properties);
}
public boolean showJDialog() {
......@@ -4387,6 +4391,8 @@ public class EyesisCorrectionParameters {
this.img_dtt.dialogQuestions(gd);
gd.addTab ("Rig", "Parameters for the wide baseline rig with two quad cameras");
this.rig.dialogQuestions(gd);
gd.addTab ("Poles", "Parameters for processing vertical poles (such as street lights)");
this.poles.dialogQuestions(gd);
gd.addTab ("vert/hor", "Enhance detection of horizontal/vertical features (when enh_ortho is enabled for tile");
......@@ -4760,7 +4766,7 @@ public class EyesisCorrectionParameters {
gd.addNumericField("Maximal relative RMS for the tiles to the tilted plate - multiply by disparity and add", this.fds_smpl_rel_rms, 6);
gd.addCheckbox ("Use window function for the square sample plates", this.fds_smpl_wnd);
gd.addNumericField("Maximal growing plate tilt in disparity pix per tile", this.fds_abs_tilt, 6);
gd.addNumericField("Maximal relative growing plate tilt in disparity pix per tile per disaprity pixel", this.fds_rel_tilt, 6);
gd.addNumericField("Maximal relative growing plate tilt in disparity pix per tile per disparity pixel", this.fds_rel_tilt, 6);
gd.addTab ("Macro", "Macro tiles correlation parameters");
gd.addMessage ("--- Macro correlation parameters ---");
......@@ -5120,6 +5126,7 @@ public class EyesisCorrectionParameters {
this.img_dtt.dialogAnswers(gd);
this.rig.dialogAnswers(gd);
this.poles.dialogAnswers(gd);
this.max_corr_double= gd.getNextBoolean();
this.corr_mode= (int) gd.getNextNumber();
......
......@@ -2457,7 +2457,7 @@ private Panel panel1,
POST_PROCESSING.disparityCorrelationParameters.debugRow,
POST_PROCESSING.disparityCorrelationParameters.debugColumn,
POST_PROCESSING.disparityCorrelationParameters.filter2DisparityMax, //double disparityMax,
POST_PROCESSING.disparityCorrelationParameters.filter2DisaprityMin, //double disaprityMin,
POST_PROCESSING.disparityCorrelationParameters.filter2disparityMin, //double disparityMin,
POST_PROCESSING.disparityCorrelationParameters.filter2UpdateMax?POST_PROCESSING.disparityCorrelationParameters.filter2MinAbsolute:Double.NaN, //double minAbsolute, // or NaN - will use enabled/disabled state of the tile
POST_PROCESSING.disparityCorrelationParameters.filter2UpdateMax?POST_PROCESSING.disparityCorrelationParameters.filter2MinRelative:Double.NaN, //double minRelative,
POST_PROCESSING.disparityCorrelationParameters.filter2ByForeground, //boolean filterByForeground, // apply known certain masks
......@@ -2668,7 +2668,7 @@ private Panel panel1,
POST_PROCESSING.disparityCorrelationParameters.debugColumn,
0 ,// int combineMode, // different image pairs - 0
POST_PROCESSING.disparityCorrelationParameters.filter2DisparityMax, //double disparityMax,
POST_PROCESSING.disparityCorrelationParameters.filter2DisaprityMin, //double disaprityMin,
POST_PROCESSING.disparityCorrelationParameters.filter2disparityMin, //double disparityMin,
(POST_PROCESSING.disparityCorrelationParameters.filter2UpdateMax?POST_PROCESSING.disparityCorrelationParameters.filter2MinAbsolute:Double.NaN), //double minAbsolute, // or NaN - will use enabled/disabled state of the tile
(POST_PROCESSING.disparityCorrelationParameters.filter2UpdateMax?POST_PROCESSING.disparityCorrelationParameters.filter2MinRelative:Double.NaN), //double minRelative,
POST_PROCESSING.disparityCorrelationParameters.filter2ByForeground, //boolean filterByForeground, // apply known certain masks
......
......@@ -6958,7 +6958,7 @@ public class PixelMapping {
int debugColumn,
double disparityMax,
double disaprityMin,
double disparityMin,
double minAbsolute, // or NaN - will use enabled/disabled state of the tile
double minRelative,
boolean filterByForeground, // apply known certain masks
......@@ -7000,7 +7000,7 @@ public class PixelMapping {
debugRow,
debugColumn,
disparityMax,
disaprityMin,
disparityMin,
minAbsolute, // or NaN - will use enabled/disabled state of the tile
minRelative,
filterByForeground, // apply known certain masks
......@@ -7042,7 +7042,7 @@ public class PixelMapping {
final int debugColumn,
final double disparityMax,
final double disaprityMin,
final double disparityMin,
final double minAbsolute, // or NaN - will use enabled/disabled state of the tile
final double minRelative,
final boolean filterByForeground, // apply known certain masks
......@@ -7115,7 +7115,7 @@ public class PixelMapping {
// refineWindow,
// refineFHT,
disparityMax,
disaprityMin,
disparityMin,
minAbsolute, // or NaN - will use enabled/disabled state of the tile
minRelative,
filterByForeground, // apply known certain masks
......@@ -7181,7 +7181,7 @@ public class PixelMapping {
// new arguments
// int combineMode, // different image pairs - 0
double disparityMax,
double disaprityMin,
double disparityMin,
double minAbsolute, // or NaN - will use enabled/disabled state of the tile
double minRelative,
boolean filterByForeground, // apply known certain masks
......@@ -7253,7 +7253,7 @@ public class PixelMapping {
}
if (!(zTile.getPlaneDisparity(plane)<disaprityMin) && !(zTile.getPlaneDisparity(plane)>disparityMax)){ // NaN is OK
if (!(zTile.getPlaneDisparity(plane)<disparityMin) && !(zTile.getPlaneDisparity(plane)>disparityMax)){ // NaN is OK
double disparity= zTile.getPlaneDisparity(plane);
if (debugLevel>3) {
// double testDisparityError=0.5;
......@@ -7604,7 +7604,7 @@ public class PixelMapping {
int combineMode, // different image pairs - 0
double disparityMax,
double disaprityMin,
double disparityMin,
double minAbsolute, // or NaN - will use enabled/disabled state of the tile
double minRelative,
boolean filterByForeground, // apply known certain masks
......@@ -7651,7 +7651,7 @@ public class PixelMapping {
combineMode, // different image pairs - 0
disparityMax,
disaprityMin,
disparityMin,
minAbsolute, // or NaN - will use enabled/disabled state of the tile
minRelative,
filterByForeground, // apply known certain masks
......@@ -7697,7 +7697,7 @@ public class PixelMapping {
final int combineMode, // different image pairs - 0
final double disparityMax,
final double disaprityMin,
final double disparityMin,
final double minAbsolute, // or NaN - will use enabled/disabled state of the tile
final double minRelative,
final boolean filterByForeground, // apply known certain masks
......@@ -7775,7 +7775,7 @@ public class PixelMapping {
subTileFHT,
combineMode, // different image pairs - 0
disparityMax,
disaprityMin,
disparityMin,
minAbsolute, // or NaN - will use enabled/disabled state of the tile
minRelative,
filterByForeground, // apply known certain masks
......@@ -7843,7 +7843,7 @@ public class PixelMapping {
// new arguments
int combineMode, // different image pairs - 0
double disparityMax,
double disaprityMin,
double disparityMin,
double minAbsolute, // or NaN - will use enabled/disabled state of the tile
double minRelative,
boolean filterByForeground, // apply known certain masks
......@@ -7923,7 +7923,7 @@ public class PixelMapping {
" disparity="+zTile.getPlaneDisparity(plane)+" strength="+zTile.getPlaneStrength(plane));
}
if (!(zTile.getPlaneDisparity(plane)<disaprityMin) && !(zTile.getPlaneDisparity(plane)>disparityMax)){ // NaN is OK
if (!(zTile.getPlaneDisparity(plane)<disparityMin) && !(zTile.getPlaneDisparity(plane)>disparityMax)){ // NaN is OK
planeStrength[plane]=new double [sImgSet.length][];
double disparity= zTile.getPlaneDisparity(plane);
if (debugLevel>3) {
......
......@@ -40,7 +40,7 @@ public class PoleProcessor {
class PoleCluster{
double mean_disparity = 0.0;
double target_disparity = 0.0;
double target_previous = 0.0;
double target_previous = Double.NaN;
double mean_x = 0.0;
double mean_y = 0.0;
double strength = 0.0;
......@@ -98,31 +98,21 @@ public class PoleProcessor {
// int min_mask = 10; // good - min 12
int min_height = 10; // good - min 12
boolean headlessOK = false;
// double min_fraction = 0.3; // worst 0.3478
double min_fraction = 0.5; // worst 0.3478 , next - 0.57
double min_frac_height = 0.5; // worst 0.25 , next - 0.556
double min_frac_box = 0.7; // worst 0.75 , next - 0.556
/*
boolean unselected_only = true;
double bg_strength = cluster.getAverageBgStrength(unselected_only);
double meas_strength = cluster.getAverageStrength(true); // divided by measured tiles only
double mask_strength = cluster.getAverageStrength(false); // divided by a total number of pole tiles (by mask)
double rstrength = mask_strength/bg_strength;
*/
// if (getMaskSize() < min_mask) return false;
// return 0;
double min_disparity = 0.3;
double max_disparity = 3.05; // (2.95 - 3.15)
// if (!disabled) return 0;
if (disabled) return -1;
if (eBox.height < min_height) return -1;
if (!headlessOK && (getNumTiles() == 0)) return -1; // skip headless clusters
if (getFractSelected() < min_fraction) return -1;
if (getFractHeight() < min_frac_height) return -1;
if (getFractBoxHeight() < min_frac_box) return -1;
if (getTargetDisparity() < min_disparity)return -1;
if (getTargetDisparity() > max_disparity)return -1;
return 0;
}
......@@ -751,7 +741,6 @@ public class PoleProcessor {
}
public void createPoleMask( // shoud run copyNormDS before
// double [][] norm_ds,
int min_neibs,
boolean use_seed,
double width,
......@@ -870,9 +859,9 @@ public class PoleProcessor {
double disparity_scale, // target disparity to differential disparity scale (baseline ratio) (~0.2)
double diff_power, // bias towards higher disparities - (disparity+offset) is raised to this power and applied to weight
// if 0.0 - do not apply value to weight
double diff_offset, // add to measured differential disaprity before raising to specified power
double diff_offset, // add to measured differential disparity before raising to specified power
int cut_bottom, // cut few tile rows from the very bottom - they may be influenced by ground objects
double keep_bottom, // do not cut more that this fraction of the bounding bow height
double keep_bottom, // do not cut more that this fraction of the bounding box height
int debugLevel) // debug level
{
int cut = (int) Math.round(Math.min(eBox.height * keep_bottom, cut_bottom));
......@@ -1016,14 +1005,17 @@ public class PoleProcessor {
}
public ArrayList<PoleCluster> initPoleClusters(
final double max_dx,
final double max_dy,
final double max_dd,
double max_dx,
double max_dy,
double max_dd,
boolean [] bseeds,
double [][] norm_ds,
final int debugLevel)
{
final TileNeibs tnImage = biCamDSI.tnImage;
if (max_dx < 0) max_dx = Double.NaN;
if (max_dy < 0) max_dy = Double.NaN;
if (max_dd < 0) max_dd = Double.NaN;
ArrayList<PoleCluster> clusters = new ArrayList<PoleCluster>();
for (int nTile = 0; nTile < bseeds.length; nTile++) if (bseeds[nTile]){
double this_disp = norm_ds[0][nTile];
......@@ -1247,7 +1239,37 @@ public class PoleProcessor {
return num_split;
}
double [][] exportPoleDisparityStrength(
int filter_value,
ArrayList<PoleCluster> clusters)
{
final TileNeibs tnImage = biCamDSI.tnImage;
int num_tiles = tilesY*tilesX;
double [][] ds = new double [2][num_tiles];
for (int i = 0; i < num_tiles; i++) ds[0][i]=Double.NaN;
for (PoleCluster cluster: clusters) {
if ((filter_value >= 0) && (cluster.poleFilter() < filter_value)) continue;
double disparity = cluster.getTargetDisparity(); // getMeanDisp();
double strength = cluster.getAverageStrength(true);
Rectangle box = cluster.getEBox();
int nTile = box.y * tilesX + box.x;
for (int dy = 0; dy < box.height; dy++) {
for (int dx = 0; dx < box.width; dx++) {
if (cluster.getMask (dx, dy)) {
int nTile1 = tnImage.getNeibIndex(nTile, dx, dy);
if (nTile1 >= 0) {
if (!(ds[0][nTile1] > disparity)) { // Double.NaN OK also
ds[0][nTile1] = disparity;
ds[1][nTile1] = strength;
}
}
}
}
}
}
return ds;
}
double [][] dbgClusterLayers( // layer and eBox should be set
......@@ -1520,7 +1542,6 @@ public class PoleProcessor {
PoleCluster cluster = clusters.get(nClust);
cluster.copyNormDS(norm_ds);
cluster.createPoleMask(
// norm_ds, // double [][] norm_ds,
min_neibs, // int min_neibs,
use_seed, // boolean use_seed,
width, // double width,
......@@ -1593,9 +1614,9 @@ public class PoleProcessor {
final double disparity_scale, // target disparity to differential disparity scale (baseline ratio)
final double diff_power, // bias towards higher disparities - (disparity+offset) is raised to this power and applied to weight
// if 0.0 - do not apply value to weight
final double diff_offset, // add to measured differential disaprity before raising to specified power
final double diff_offset, // add to measured differential disparity before raising to specified power
final int cut_bottom, // cut few tile rows from the very bottom - they may be influenced by ground objects
final double keep_bottom, // do not cut more that this fraction of the bounding bow height
final double keep_bottom, // do not cut more that this fraction of the bounding box height
final ArrayList<PoleCluster> clusters,
final int debugLevel) // debug level
{
......@@ -1612,9 +1633,9 @@ public class PoleProcessor {
disparity_scale, // double disparity_scale, // target disparity to differential disparity scale (baseline ratio)
diff_power, // double diff_power, // bias towards higher disparities - (disparity+offset) is raised to this power and applied to weight
// if 0.0 - do not apply value to weight
diff_offset, // double diff_offset, // add to measured differential disaprity before raising to specified power
diff_offset, // double diff_offset, // add to measured differential disparity before raising to specified power
cut_bottom, // int cut_bottom, // cut few tile rows from the very bottom - they may be influenced by ground objects
keep_bottom, // double keep_bottom, // do not cut more that this fraction of the bounding bow height
keep_bottom, // double keep_bottom, // do not cut more that this fraction of the bounding box height
debugLevel); // int debugLevel); // debug level
if (debugLevel > -2) {
System.out.println("applyMeasuredDisparity() for cluster "+cluster.toString()+" -> target disparity change: "+diff);
......@@ -1634,6 +1655,7 @@ public class PoleProcessor {
}
public void printClusterStats(
final int min_filter,
final ArrayList<PoleCluster> clusters)
{
int [][] real_poles = {
......@@ -1652,7 +1674,7 @@ public class PoleProcessor {
for (int nClust = 0; nClust < clusters.size(); nClust++) {
PoleCluster cluster = clusters.get(nClust);
if (cluster.poleFilter() >= 0) {
if (cluster.poleFilter() >= min_filter) {
boolean real_pole = false;
for (int i = 0; i < real_poles.length; i++) {
if ((real_poles[i][0] == cluster.eBox.x) && (real_poles[i][1] == cluster.eBox.y)) {
......
This diff is collapsed.
......@@ -1102,7 +1102,7 @@ public class PostProcessing {
public int fillFgGapNeib= 3;
public double filter2DisparityMax =100.0;
public double filter2DisaprityMin = 50.0;
public double filter2disparityMin = 50.0;
public boolean filter2UpdateMax= true;
public double filter2MinAbsolute= 0.01;
public double filter2MinRelative= 0.1;
......@@ -1231,7 +1231,7 @@ public class PostProcessing {
properties.setProperty(prefix+"fillFgGapNeib",this.fillFgGapNeib+"");
properties.setProperty(prefix+"filter2DisparityMax",this.filter2DisparityMax+"");
properties.setProperty(prefix+"filter2DisaprityMin",this.filter2DisaprityMin+"");
properties.setProperty(prefix+"filter2disparityMin",this.filter2disparityMin+"");
properties.setProperty(prefix+"filter2UpdateMax",this.filter2UpdateMax+"");
properties.setProperty(prefix+"filter2MinAbsolute",this.filter2MinAbsolute+"");
properties.setProperty(prefix+"filter2MinRelative",this.filter2MinRelative+"");
......@@ -1375,7 +1375,7 @@ public class PostProcessing {
if (properties.getProperty(prefix+"fillFgGapNeib")!=null) this.fillFgGapNeib=Integer.parseInt(properties.getProperty(prefix+"fillFgGapNeib"));
if (properties.getProperty(prefix+"filter2DisparityMax")!=null) this.filter2DisparityMax=Double.parseDouble(properties.getProperty(prefix+"filter2DisparityMax"));
if (properties.getProperty(prefix+"filter2DisaprityMin")!=null) this.filter2DisaprityMin=Double.parseDouble(properties.getProperty(prefix+"filter2DisaprityMin"));
if (properties.getProperty(prefix+"filter2disparityMin")!=null) this.filter2disparityMin=Double.parseDouble(properties.getProperty(prefix+"filter2disparityMin"));
if (properties.getProperty(prefix+"filter2UpdateMax")!=null)this.filter2UpdateMax=Boolean.parseBoolean(properties.getProperty(prefix+"filter2UpdateMax"));
if (properties.getProperty(prefix+"filter2MinAbsolute")!=null) this.filter2MinAbsolute=Double.parseDouble(properties.getProperty(prefix+"filter2MinAbsolute"));
if (properties.getProperty(prefix+"filter2MinRelative")!=null) this.filter2MinRelative=Double.parseDouble(properties.getProperty(prefix+"filter2MinRelative"));
......@@ -1537,7 +1537,7 @@ public class PostProcessing {
if ((mode & 512)!=0){
gd.addMessage(" -------------- filter2 parameters --------------");
gd.addNumericField("Maximal disparity to process",this.filter2DisparityMax,2,6,"pix");
gd.addNumericField("Minimal disparity to process",this.filter2DisaprityMin,2,6,"pix");
gd.addNumericField("Minimal disparity to process",this.filter2disparityMin,2,6,"pix");
gd.addCheckbox ("Update abolute/relative maximums", this.filter2UpdateMax); // true;
gd.addNumericField("Absolute threshold for correlation vs. disparity maximums",this.filter2MinAbsolute,4,5,"");
gd.addNumericField("Relative threshold for correlation vs. disparity maximums",100*this.filter2MinRelative,2,6,"%");
......@@ -1681,7 +1681,7 @@ public class PostProcessing {
}
if ((mode & 512)!=0){
this.filter2DisparityMax= gd.getNextNumber();
this.filter2DisaprityMin= gd.getNextNumber();
this.filter2disparityMin= gd.getNextNumber();
this.filter2UpdateMax= gd.getNextBoolean();
this.filter2MinAbsolute= gd.getNextNumber();
this.filter2MinRelative= 0.01*gd.getNextNumber();
......
......@@ -2634,7 +2634,7 @@ public class SuperTiles{
}
public TilePlanes.PlaneData [][] createPlanesFromSelections(
public TilePlanes.PlaneData [][] createPlanesFromSelections( // never finished?
final boolean [][][][] plane_selections, // = new boolean [nStiles][][][]; // num_tiles
final double [][][][] disp_strength,
final double plDispNorm,
......@@ -2854,7 +2854,7 @@ public class SuperTiles{
}
};
}
ImageDtt.startAndJoin(threads);
ImageDtt.startAndJoin(threads); // Never finished?
return result_planes;
}
......
......@@ -1940,6 +1940,7 @@ public class TilePlanes {
y,
d,
this.correctDistortions);
tiles_xyzw[nl][indx][0] = wxyz[0];
tiles_xyzw[nl][indx][1] = wxyz[1];
tiles_xyzw[nl][indx][2] = wxyz[2];
......@@ -1948,6 +1949,14 @@ public class TilePlanes {
swz += w * wxyz[2];
swx += w * wxyz[0];
swy += w * wxyz[1];
if (Double.isNaN(tiles_xyzw[nl][indx][0])) {
System.out.println("--*--BUG! tiles_xyzw[nl][indx][0] is NaN");
}
if (Double.isInfinite(swx) || Double.isInfinite(swz) || Double.isInfinite(w)) {
System.out.println("BUG!!!: getPlaneFromMeas(): num_tiles="+num_tiles+", sw = "+sw +", swz = "+swz +", swx = "+swx +", swy = "+swy);
}
// end of difference from getPlaneFromMeas
}
}
......@@ -1975,10 +1984,16 @@ public class TilePlanes {
if (sw == 0.0) {
return null; //
}
if (Double.isInfinite(swx)) {
System.out.println("BUG!!!: getPlaneFromMeas(): num_tiles="+num_tiles+", sw = "+sw +", swz = "+swz +", swx = "+swx +", swy = "+swy);
}
swz /= sw;
swx /= sw;
swy /= sw;
setWxyz(swx, swy, swz);
if (Double.isInfinite(swx)) {
System.out.println("BUG!!!: getPlaneFromMeas(): num_tiles="+num_tiles+", sw = "+sw +", swz = "+swz +", swx = "+swx +", swy = "+swy);
}
// double kz = ((dispNorm > 0.0) && (swz > dispNorm)) ? (dispNorm / swz) : 1.0;
......@@ -2003,6 +2018,9 @@ public class TilePlanes {
acovar [1][1] += w * y * y;
acovar [1][2] += w * y * z;
acovar [2][2] += w * z * z;
if (Double.isNaN(acovar [0][0])) {
System.out.println("--*--BUG! acovar[0][0] is NaN");
}
}
}
}
......@@ -2011,6 +2029,7 @@ public class TilePlanes {
acovar [1][0] = acovar [0][1];
acovar [2][0] = acovar [0][2];
acovar [2][1] = acovar [1][2];
Matrix covar = new Matrix(acovar);
EigenvalueDecomposition eig = covar.eig();
......
......@@ -584,7 +584,9 @@ public class TwoQuadCLT {
int iAux = (iQuadComb >= quad_main) ? 1 : 0;
int iSubCam= iQuadComb - iAux * quad_main;
String title=name+"-"+String.format("%s%02d", ((iAux>0)?"A":"M"),iSubCam);
// Uncomment to have master/aux names
// String title=name+"-"+String.format("%s%02d", ((iAux>0)?"A":"M"),iSubCam);
String title=name+"-"+String.format("%02d", iQuadComb);
if (clt_parameters.corr_sigma > 0){ // no filter at all
for (int chn = 0; chn < clt_bidata[iAux][iSubCam].length; chn++) {
......@@ -1406,6 +1408,13 @@ if (debugLevel > -100) return true; // temporarily !
pole_clusters); // final ArrayList<PoleCluster> clusters)
if (debugLevel > -2) {
System.out.println(" === unfiltered \"pole\" clusters ===");
pp.printClusterStats(
-1, // minimal filter value
pole_clusters);
}
final double sep_min_strength = 0.07;
final double sep_disp_adiff = 0.15;
final double sep_disp_rdiff = 0.05;
......@@ -1416,7 +1425,6 @@ if (debugLevel > -100) return true; // temporarily !
sep_disp_rdiff, // final double disp_rdiff,
norm_ds, // final double [][] norn_ds,
pole_clusters); // final ArrayList<PoleCluster> clusters)
int num_removed =pp.removeFilteredClusters(
pole_clusters, // ArrayList<PoleCluster> clusters,
debugLevel); // int debugLevel)
......@@ -1430,20 +1438,20 @@ if (debugLevel > -100) return true; // temporarily !
if (debugLevel > -2) {
System.out.println("Reaasigned layers: "+num_layers);
}
final double disparity_scale = 0.3; // 2; // target disaprity to differential disparity scale (baseline ratio)
final double disparity_scale = 0.3; // 2; // target disparity to differential disparity scale (baseline ratio)
final double diff_power = 1.0; // bias towards higher disparities - (disparity+offset) is raised to this power and applied to weight
// if 0.0 - do not apply value to weight
final double diff_offset = 0.5; // add to measured differential disaprity before raising to specified power
final double diff_offset = 0.5; // add to measured differential disparity before raising to specified power
final int cut_bottom = 2; // cut few tile rows from the very bottom - they may be influenced by ground objects
final double keep_bottom = 0.1; // do not cut more that this fraction of the bounding bow height
final double keep_bottom = 0.1; // do not cut more that this fraction of the bounding box height
double max_target_diff = pp.applyMeasuredDisparity(
disparity_scale, // final double disparity_scale, // target disparity to differential disparity scale (baseline ratio)
diff_power, // final double diff_power, // bias towards higher disparities - (disparity+offset) is raised to this power and applied to weight
// if 0.0 - do not apply value to weight
diff_offset, // final double diff_offset, // add to measured differential disaprity before raising to specified power
diff_offset, // final double diff_offset, // add to measured differential disparity before raising to specified power
cut_bottom, // final int cut_bottom, // cut few tile rows from the very bottom - they may be influenced by ground objects
keep_bottom, //final double keep_bottom, // do not cut more that this fraction of the bounding bow height
keep_bottom, //final double keep_bottom, // do not cut more that this fraction of the bounding box height
pole_clusters, // final ArrayList<PoleCluster> clusters,
debugLevel); // final int debugLevel) // debug level
if (debugLevel > -2) {
......@@ -1609,8 +1617,10 @@ if (debugLevel > -100) return true; // temporarily !
true,
"MEAS-COMBO",
titles);
pp.printClusterStats(pole_clusters);
System.out.println(" === filtered \"pole\" clusters ===");
pp.printClusterStats(
0, // minimal filter value
pole_clusters);
}
}
final int max_refines = 20;
......@@ -1630,9 +1640,9 @@ if (debugLevel > -100) return true; // temporarily !
disparity_scale, // final double disparity_scale, // target disparity to differential disparity scale (baseline ratio)
diff_power, // final double diff_power, // bias towards higher disparities - (disparity+offset) is raised to this power and applied to weight
// if 0.0 - do not apply value to weight
diff_offset, // final double diff_offset, // add to measured differential disaprity before raising to specified power
diff_offset, // final double diff_offset, // add to measured differential disparity before raising to specified power
cut_bottom, // final int cut_bottom, // cut few tile rows from the very bottom - they may be influenced by ground objects
keep_bottom, //final double keep_bottom, // do not cut more that this fraction of the bounding bow height
keep_bottom, //final double keep_bottom, // do not cut more that this fraction of the bounding box height
pole_clusters, // final ArrayList<PoleCluster> clusters,
debugLevel); // final int debugLevel) // debug level
if (debugLevel > -2) {
......@@ -1675,7 +1685,7 @@ if (debugLevel > -100) return true; // temporarily !
if (debugLevel > -2){
if ((debugLevel > -2) && ((nRefine >= (max_refines -1)) || (debugLevel > -1))){
boolean filter_poles = true;
double [][] dbg_layers_meas = pp.dbgClusterLayers( // layer and eBox should be set
false, // boolean show_bbox,
......@@ -1752,15 +1762,68 @@ if (debugLevel > -100) return true; // temporarily !
"MEAS-COMBO-REFINE_"+nRefine,
titles);
pp.printClusterStats(pole_clusters);
pp.printClusterStats(
0, // minimal filter value
pole_clusters);
}
} // for (int nRefine = 0; nRefine < max_refines; nRefine ++) {
double [][] poleDisparityStrength = pp.exportPoleDisparityStrength(
-1, // int filter_value,
pole_clusters); // ArrayList<PoleCluster> clusters)
double [][] all_ds = biScan.getDisparityStrength(
false, // only_strong,
false, // only_trusted,
true); // only_enabled);
/* Random rand = new Random();
for (int nTile = 0; nTile < all_ds[0].length; nTile++) {
if (!Double.isNaN(poleDisparityStrength[0][nTile]) && !(poleDisparityStrength[0][nTile] < all_ds[0][nTile])) {
all_ds[0][nTile] = poleDisparityStrength[0][nTile] + 0.001*rand.nextDouble();
all_ds[1][nTile] = poleDisparityStrength[1][nTile] + 0.001*rand.nextDouble();
}
}
*/
for (int nTile = 0; nTile < all_ds[0].length; nTile++) {
if (!Double.isNaN(poleDisparityStrength[0][nTile]) && !(poleDisparityStrength[0][nTile] < all_ds[0][nTile])) {
all_ds[0][nTile] = poleDisparityStrength[0][nTile];
all_ds[1][nTile] = poleDisparityStrength[1][nTile];
}
}
for (int nTile = 0; nTile < all_ds[0].length; nTile++) {
if (Double.isNaN(all_ds[0][nTile]) || (all_ds[0][nTile] < 0.001)) {
all_ds[0][nTile] = Double.NaN;
all_ds[1][nTile] = 0.0;
}
}
} // for (int nRefine = 0; nRefine < max_refines; nRefine ++) {
if (debugLevel> -2) {
biScan.showScan(quadCLT_main.image_name+"-POLES-"+scan_index, poleDisparityStrength);
biScan.showScan(quadCLT_main.image_name+"-ALL-AND-POLES-"+scan_index, all_ds);
}
System.out.println("quadCLT_main.tp.clt_3d_passes_size="+quadCLT_main.tp.clt_3d_passes_size+", quadCLT_main.tp.clt_3d_passes.size()="+quadCLT_main.tp.clt_3d_passes.size());
// CLTPass3d scan_last = quadCLT_main.tp.clt_3d_passes.get( quadCLT_main.tp.clt_3d_passes_size -1); // get last one
CLTPass3d scan_last = quadCLT_main.tp.clt_3d_passes.get( quadCLT_main.tp.clt_3d_passes.size() -1); // get really last one
boolean [] selection = scan_last.getSelected();
for (int nTile = 0; nTile < all_ds[0].length; nTile++) {
if (!Double.isNaN(poleDisparityStrength[0][nTile])) {
selection[nTile] = true;
}
}
quadCLT_main.tp.trimCLTPasses(false); // remove rig composite scan if any
CLTPass3d rig_scan = quadCLT_main.tp.compositeScan(
all_ds[0], // final double [] disparity,
all_ds[1], // final double [] strength,
selection, // final boolean [] selected,
debugLevel); // final int debugLevel)
rig_scan.texture_tiles = scan_last.texture_tiles;
// scan_last
quadCLT_main.tp.clt_3d_passes.add(rig_scan);
quadCLT_main.tp.saveCLTPasses(true); // rig pass
return true;
}
......@@ -2896,7 +2959,7 @@ if (debugLevel > -100) return true; // temporarily !
* calcTrusted should be called before to set up trusted/cond_trusted tiles
* suggested tiles will be compared against and made sure they differ by more than a specified margin
* 1) current measured (refined) disparity value
* 2) target disaprity that lead to the current measurement after refinement
* 2) target disparity that lead to the current measurement after refinement
* 3) any other disable measurement
* 4) any target disparity that lead to the disabled measurement
* @return number of new tiles to measure in the array of suggested disparities - Double.NaN - nothing suggested
......
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