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

More work on poles

parent 7dac691f
...@@ -39,11 +39,20 @@ ...@@ -39,11 +39,20 @@
<artifactId>commons-configuration</artifactId> <artifactId>commons-configuration</artifactId>
<version>1.7</version> <version>1.7</version>
</dependency> </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> <dependency>
<groupId>jama</groupId> <groupId>jama</groupId>
<artifactId>jama</artifactId> <artifactId>jama</artifactId>
<version>1.0.2</version> <version>1.0.3</version>
</dependency> </dependency>
-->
<dependency> <dependency>
<groupId>commons-lang</groupId> <groupId>commons-lang</groupId>
<artifactId>commons-lang</artifactId> <artifactId>commons-lang</artifactId>
......
...@@ -398,7 +398,7 @@ public class AlignmentCorrection { ...@@ -398,7 +398,7 @@ public class AlignmentCorrection {
use_poly, // final boolean use_poly, use_poly, // final boolean use_poly,
clt_parameters.fcorr_inf_quad, // final boolean use_quadratic, clt_parameters.fcorr_inf_quad, // final boolean use_quadratic,
clt_parameters.fcorr_inf_vert, // final boolean use_vertical, 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) 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 // For ly_inf_en need to make sure that programmed disparity was 0.0, so
clt_parameters.ly_inf_disp, //final boolean allow_dispatity, clt_parameters.ly_inf_disp, //final boolean allow_dispatity,
...@@ -1933,7 +1933,7 @@ B = |+dy0 -dy1 -2*dy3 | ...@@ -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 // double norm_ly_disparity = 100.0; // disabling
for (int nTile = 0; nTile < num_tiles; nTile++) { for (int nTile = 0; nTile < num_tiles; nTile++) {
if ((combo_mismatch[0][nTile] > 0) && (combo_mismatch[0][nTile] > ly_norm_disp)) { 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 ** BiQuadParameters - parameters defining Operation of a two quad camera rig
...@@ -24,6 +22,8 @@ import java.util.Properties; ...@@ -24,6 +22,8 @@ import java.util.Properties;
** **
*/ */
import java.util.Properties;
public class BiQuadParameters { public class BiQuadParameters {
public boolean rig_mode_debug = true; 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 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 { ...@@ -447,7 +447,7 @@ public class BiQuadParameters {
"Try trimming hanging FG (need improvement)"); "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", 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)"); "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)?"); "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,"", 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"); "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 { ...@@ -486,7 +486,7 @@ public class BiScan {
* calcTrusted should be called before to set up trusted/cond_trusted tiles * 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 * suggested tiles will be compared against and made sure they differ by more than a specified margin
* 1) current measured (refined) disparity value * 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 * 3) any other disable measurement
* 4) any target disparity that lead to the disabled measurement * 4) any target disparity that lead to the disabled measurement
* @param area_of_interest - limit results to these tiles (if provided) * @param area_of_interest - limit results to these tiles (if provided)
...@@ -518,7 +518,7 @@ public class BiScan { ...@@ -518,7 +518,7 @@ public class BiScan {
* @param use_alt use tiles from other scans if they fit better * @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 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 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_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 fourq_gap symmetrical vertical and horizontal center areas that do not belong to any corner
* @param dbg_x tileX to debug * @param dbg_x tileX to debug
......
...@@ -30,7 +30,7 @@ public class CLTPass3d{ ...@@ -30,7 +30,7 @@ public class CLTPass3d{
// static double max_overexposed = 0.8; // TODO: make parameter // static double max_overexposed = 0.8; // TODO: make parameter
public double [][] disparity; // per-tile disparity set for the pass[tileY][tileX] public double [][] disparity; // per-tile disparity set for the pass[tileY][tileX]
public int [][] tile_op; // what was done in the current pass 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 private int [][] tile_op_sav; // saved tile_op
public double [][] disparity_map = null; // add 4 layers - worst difference for the port 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 double [] calc_disparity = null; // composite disparity, calculated from "disparity", and "disparity_map" fields
......
...@@ -3037,6 +3037,7 @@ public class EyesisCorrectionParameters { ...@@ -3037,6 +3037,7 @@ public class EyesisCorrectionParameters {
public ImageDttParameters img_dtt = new ImageDttParameters(); public ImageDttParameters img_dtt = new ImageDttParameters();
public BiQuadParameters rig = new BiQuadParameters(); public BiQuadParameters rig = new BiQuadParameters();
public PoleProcessorParameters poles = new PoleProcessorParameters();
public MeasuredLayersFilterParameters mlfp = new MeasuredLayersFilterParameters(); public MeasuredLayersFilterParameters mlfp = new MeasuredLayersFilterParameters();
public HashMap<String,Double> z_corr_map = new HashMap<String,Double>(); public HashMap<String,Double> z_corr_map = new HashMap<String,Double>();
...@@ -3681,6 +3682,8 @@ public class EyesisCorrectionParameters { ...@@ -3681,6 +3682,8 @@ public class EyesisCorrectionParameters {
img_dtt.setProperties (prefix+"_img_dtt", properties); img_dtt.setProperties (prefix+"_img_dtt", properties);
mlfp.setProperties (prefix+"_mlfp", properties); mlfp.setProperties (prefix+"_mlfp", properties);
rig.setProperties (prefix+"_rig", properties); rig.setProperties (prefix+"_rig", properties);
poles.setProperties (prefix+"_poles", properties);
} }
public void getProperties(String prefix,Properties properties){ public void getProperties(String prefix,Properties properties){
...@@ -4329,6 +4332,7 @@ public class EyesisCorrectionParameters { ...@@ -4329,6 +4332,7 @@ public class EyesisCorrectionParameters {
img_dtt.getProperties (prefix+"_img_dtt", properties); img_dtt.getProperties (prefix+"_img_dtt", properties);
mlfp.getProperties (prefix+"_mlfp", properties); mlfp.getProperties (prefix+"_mlfp", properties);
rig.getProperties (prefix+"_rig", properties); rig.getProperties (prefix+"_rig", properties);
poles.getProperties (prefix+"_poles", properties);
} }
public boolean showJDialog() { public boolean showJDialog() {
...@@ -4387,6 +4391,8 @@ public class EyesisCorrectionParameters { ...@@ -4387,6 +4391,8 @@ public class EyesisCorrectionParameters {
this.img_dtt.dialogQuestions(gd); this.img_dtt.dialogQuestions(gd);
gd.addTab ("Rig", "Parameters for the wide baseline rig with two quad cameras"); gd.addTab ("Rig", "Parameters for the wide baseline rig with two quad cameras");
this.rig.dialogQuestions(gd); 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"); gd.addTab ("vert/hor", "Enhance detection of horizontal/vertical features (when enh_ortho is enabled for tile");
...@@ -4760,7 +4766,7 @@ public class EyesisCorrectionParameters { ...@@ -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.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.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 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.addTab ("Macro", "Macro tiles correlation parameters");
gd.addMessage ("--- Macro correlation parameters ---"); gd.addMessage ("--- Macro correlation parameters ---");
...@@ -5120,6 +5126,7 @@ public class EyesisCorrectionParameters { ...@@ -5120,6 +5126,7 @@ public class EyesisCorrectionParameters {
this.img_dtt.dialogAnswers(gd); this.img_dtt.dialogAnswers(gd);
this.rig.dialogAnswers(gd); this.rig.dialogAnswers(gd);
this.poles.dialogAnswers(gd);
this.max_corr_double= gd.getNextBoolean(); this.max_corr_double= gd.getNextBoolean();
this.corr_mode= (int) gd.getNextNumber(); this.corr_mode= (int) gd.getNextNumber();
......
...@@ -2457,7 +2457,7 @@ private Panel panel1, ...@@ -2457,7 +2457,7 @@ private Panel panel1,
POST_PROCESSING.disparityCorrelationParameters.debugRow, POST_PROCESSING.disparityCorrelationParameters.debugRow,
POST_PROCESSING.disparityCorrelationParameters.debugColumn, POST_PROCESSING.disparityCorrelationParameters.debugColumn,
POST_PROCESSING.disparityCorrelationParameters.filter2DisparityMax, //double disparityMax, 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.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.filter2UpdateMax?POST_PROCESSING.disparityCorrelationParameters.filter2MinRelative:Double.NaN, //double minRelative,
POST_PROCESSING.disparityCorrelationParameters.filter2ByForeground, //boolean filterByForeground, // apply known certain masks POST_PROCESSING.disparityCorrelationParameters.filter2ByForeground, //boolean filterByForeground, // apply known certain masks
...@@ -2668,7 +2668,7 @@ private Panel panel1, ...@@ -2668,7 +2668,7 @@ private Panel panel1,
POST_PROCESSING.disparityCorrelationParameters.debugColumn, POST_PROCESSING.disparityCorrelationParameters.debugColumn,
0 ,// int combineMode, // different image pairs - 0 0 ,// int combineMode, // different image pairs - 0
POST_PROCESSING.disparityCorrelationParameters.filter2DisparityMax, //double disparityMax, 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.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.filter2UpdateMax?POST_PROCESSING.disparityCorrelationParameters.filter2MinRelative:Double.NaN), //double minRelative,
POST_PROCESSING.disparityCorrelationParameters.filter2ByForeground, //boolean filterByForeground, // apply known certain masks POST_PROCESSING.disparityCorrelationParameters.filter2ByForeground, //boolean filterByForeground, // apply known certain masks
......
...@@ -6958,7 +6958,7 @@ public class PixelMapping { ...@@ -6958,7 +6958,7 @@ public class PixelMapping {
int debugColumn, int debugColumn,
double disparityMax, double disparityMax,
double disaprityMin, double disparityMin,
double minAbsolute, // or NaN - will use enabled/disabled state of the tile double minAbsolute, // or NaN - will use enabled/disabled state of the tile
double minRelative, double minRelative,
boolean filterByForeground, // apply known certain masks boolean filterByForeground, // apply known certain masks
...@@ -7000,7 +7000,7 @@ public class PixelMapping { ...@@ -7000,7 +7000,7 @@ public class PixelMapping {
debugRow, debugRow,
debugColumn, debugColumn,
disparityMax, disparityMax,
disaprityMin, disparityMin,
minAbsolute, // or NaN - will use enabled/disabled state of the tile minAbsolute, // or NaN - will use enabled/disabled state of the tile
minRelative, minRelative,
filterByForeground, // apply known certain masks filterByForeground, // apply known certain masks
...@@ -7042,7 +7042,7 @@ public class PixelMapping { ...@@ -7042,7 +7042,7 @@ public class PixelMapping {
final int debugColumn, final int debugColumn,
final double disparityMax, final double disparityMax,
final double disaprityMin, final double disparityMin,
final double minAbsolute, // or NaN - will use enabled/disabled state of the tile final double minAbsolute, // or NaN - will use enabled/disabled state of the tile
final double minRelative, final double minRelative,
final boolean filterByForeground, // apply known certain masks final boolean filterByForeground, // apply known certain masks
...@@ -7115,7 +7115,7 @@ public class PixelMapping { ...@@ -7115,7 +7115,7 @@ public class PixelMapping {
// refineWindow, // refineWindow,
// refineFHT, // refineFHT,
disparityMax, disparityMax,
disaprityMin, disparityMin,
minAbsolute, // or NaN - will use enabled/disabled state of the tile minAbsolute, // or NaN - will use enabled/disabled state of the tile
minRelative, minRelative,
filterByForeground, // apply known certain masks filterByForeground, // apply known certain masks
...@@ -7181,7 +7181,7 @@ public class PixelMapping { ...@@ -7181,7 +7181,7 @@ public class PixelMapping {
// new arguments // new arguments
// int combineMode, // different image pairs - 0 // int combineMode, // different image pairs - 0
double disparityMax, double disparityMax,
double disaprityMin, double disparityMin,
double minAbsolute, // or NaN - will use enabled/disabled state of the tile double minAbsolute, // or NaN - will use enabled/disabled state of the tile
double minRelative, double minRelative,
boolean filterByForeground, // apply known certain masks boolean filterByForeground, // apply known certain masks
...@@ -7253,7 +7253,7 @@ public class PixelMapping { ...@@ -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); double disparity= zTile.getPlaneDisparity(plane);
if (debugLevel>3) { if (debugLevel>3) {
// double testDisparityError=0.5; // double testDisparityError=0.5;
...@@ -7604,7 +7604,7 @@ public class PixelMapping { ...@@ -7604,7 +7604,7 @@ public class PixelMapping {
int combineMode, // different image pairs - 0 int combineMode, // different image pairs - 0
double disparityMax, double disparityMax,
double disaprityMin, double disparityMin,
double minAbsolute, // or NaN - will use enabled/disabled state of the tile double minAbsolute, // or NaN - will use enabled/disabled state of the tile
double minRelative, double minRelative,
boolean filterByForeground, // apply known certain masks boolean filterByForeground, // apply known certain masks
...@@ -7651,7 +7651,7 @@ public class PixelMapping { ...@@ -7651,7 +7651,7 @@ public class PixelMapping {
combineMode, // different image pairs - 0 combineMode, // different image pairs - 0
disparityMax, disparityMax,
disaprityMin, disparityMin,
minAbsolute, // or NaN - will use enabled/disabled state of the tile minAbsolute, // or NaN - will use enabled/disabled state of the tile
minRelative, minRelative,
filterByForeground, // apply known certain masks filterByForeground, // apply known certain masks
...@@ -7697,7 +7697,7 @@ public class PixelMapping { ...@@ -7697,7 +7697,7 @@ public class PixelMapping {
final int combineMode, // different image pairs - 0 final int combineMode, // different image pairs - 0
final double disparityMax, final double disparityMax,
final double disaprityMin, final double disparityMin,
final double minAbsolute, // or NaN - will use enabled/disabled state of the tile final double minAbsolute, // or NaN - will use enabled/disabled state of the tile
final double minRelative, final double minRelative,
final boolean filterByForeground, // apply known certain masks final boolean filterByForeground, // apply known certain masks
...@@ -7775,7 +7775,7 @@ public class PixelMapping { ...@@ -7775,7 +7775,7 @@ public class PixelMapping {
subTileFHT, subTileFHT,
combineMode, // different image pairs - 0 combineMode, // different image pairs - 0
disparityMax, disparityMax,
disaprityMin, disparityMin,
minAbsolute, // or NaN - will use enabled/disabled state of the tile minAbsolute, // or NaN - will use enabled/disabled state of the tile
minRelative, minRelative,
filterByForeground, // apply known certain masks filterByForeground, // apply known certain masks
...@@ -7843,7 +7843,7 @@ public class PixelMapping { ...@@ -7843,7 +7843,7 @@ public class PixelMapping {
// new arguments // new arguments
int combineMode, // different image pairs - 0 int combineMode, // different image pairs - 0
double disparityMax, double disparityMax,
double disaprityMin, double disparityMin,
double minAbsolute, // or NaN - will use enabled/disabled state of the tile double minAbsolute, // or NaN - will use enabled/disabled state of the tile
double minRelative, double minRelative,
boolean filterByForeground, // apply known certain masks boolean filterByForeground, // apply known certain masks
...@@ -7923,7 +7923,7 @@ public class PixelMapping { ...@@ -7923,7 +7923,7 @@ public class PixelMapping {
" disparity="+zTile.getPlaneDisparity(plane)+" strength="+zTile.getPlaneStrength(plane)); " 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][]; planeStrength[plane]=new double [sImgSet.length][];
double disparity= zTile.getPlaneDisparity(plane); double disparity= zTile.getPlaneDisparity(plane);
if (debugLevel>3) { if (debugLevel>3) {
......
...@@ -40,7 +40,7 @@ public class PoleProcessor { ...@@ -40,7 +40,7 @@ public class PoleProcessor {
class PoleCluster{ class PoleCluster{
double mean_disparity = 0.0; double mean_disparity = 0.0;
double target_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_x = 0.0;
double mean_y = 0.0; double mean_y = 0.0;
double strength = 0.0; double strength = 0.0;
...@@ -98,31 +98,21 @@ public class PoleProcessor { ...@@ -98,31 +98,21 @@ public class PoleProcessor {
// int min_mask = 10; // good - min 12 // int min_mask = 10; // good - min 12
int min_height = 10; // good - min 12 int min_height = 10; // good - min 12
boolean headlessOK = false; boolean headlessOK = false;
// double min_fraction = 0.3; // worst 0.3478
double min_fraction = 0.5; // worst 0.3478 , next - 0.57 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_height = 0.5; // worst 0.25 , next - 0.556
double min_frac_box = 0.7; // worst 0.75 , next - 0.556 double min_frac_box = 0.7; // worst 0.75 , next - 0.556
double min_disparity = 0.3;
/* double max_disparity = 3.05; // (2.95 - 3.15)
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;
// if (!disabled) return 0; // if (!disabled) return 0;
if (disabled) return -1; if (disabled) return -1;
if (eBox.height < min_height) return -1; if (eBox.height < min_height) return -1;
if (!headlessOK && (getNumTiles() == 0)) return -1; // skip headless clusters if (!headlessOK && (getNumTiles() == 0)) return -1; // skip headless clusters
if (getFractSelected() < min_fraction) return -1; if (getFractSelected() < min_fraction) return -1;
if (getFractHeight() < min_frac_height) return -1; if (getFractHeight() < min_frac_height) return -1;
if (getFractBoxHeight() < min_frac_box) return -1; if (getFractBoxHeight() < min_frac_box) return -1;
if (getTargetDisparity() < min_disparity)return -1;
if (getTargetDisparity() > max_disparity)return -1;
return 0; return 0;
} }
...@@ -751,7 +741,6 @@ public class PoleProcessor { ...@@ -751,7 +741,6 @@ public class PoleProcessor {
} }
public void createPoleMask( // shoud run copyNormDS before public void createPoleMask( // shoud run copyNormDS before
// double [][] norm_ds,
int min_neibs, int min_neibs,
boolean use_seed, boolean use_seed,
double width, double width,
...@@ -870,9 +859,9 @@ public class PoleProcessor { ...@@ -870,9 +859,9 @@ public class PoleProcessor {
double disparity_scale, // target disparity to differential disparity scale (baseline ratio) (~0.2) 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 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 // 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 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 debugLevel) // debug level
{ {
int cut = (int) Math.round(Math.min(eBox.height * keep_bottom, cut_bottom)); int cut = (int) Math.round(Math.min(eBox.height * keep_bottom, cut_bottom));
...@@ -1016,14 +1005,17 @@ public class PoleProcessor { ...@@ -1016,14 +1005,17 @@ public class PoleProcessor {
} }
public ArrayList<PoleCluster> initPoleClusters( public ArrayList<PoleCluster> initPoleClusters(
final double max_dx, double max_dx,
final double max_dy, double max_dy,
final double max_dd, double max_dd,
boolean [] bseeds, boolean [] bseeds,
double [][] norm_ds, double [][] norm_ds,
final int debugLevel) final int debugLevel)
{ {
final TileNeibs tnImage = biCamDSI.tnImage; 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>(); ArrayList<PoleCluster> clusters = new ArrayList<PoleCluster>();
for (int nTile = 0; nTile < bseeds.length; nTile++) if (bseeds[nTile]){ for (int nTile = 0; nTile < bseeds.length; nTile++) if (bseeds[nTile]){
double this_disp = norm_ds[0][nTile]; double this_disp = norm_ds[0][nTile];
...@@ -1247,7 +1239,37 @@ public class PoleProcessor { ...@@ -1247,7 +1239,37 @@ public class PoleProcessor {
return num_split; 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 double [][] dbgClusterLayers( // layer and eBox should be set
...@@ -1520,7 +1542,6 @@ public class PoleProcessor { ...@@ -1520,7 +1542,6 @@ public class PoleProcessor {
PoleCluster cluster = clusters.get(nClust); PoleCluster cluster = clusters.get(nClust);
cluster.copyNormDS(norm_ds); cluster.copyNormDS(norm_ds);
cluster.createPoleMask( cluster.createPoleMask(
// norm_ds, // double [][] norm_ds,
min_neibs, // int min_neibs, min_neibs, // int min_neibs,
use_seed, // boolean use_seed, use_seed, // boolean use_seed,
width, // double width, width, // double width,
...@@ -1593,9 +1614,9 @@ public class PoleProcessor { ...@@ -1593,9 +1614,9 @@ public class PoleProcessor {
final double disparity_scale, // target disparity to differential disparity scale (baseline ratio) 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 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 // 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 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 ArrayList<PoleCluster> clusters,
final int debugLevel) // debug level final int debugLevel) // debug level
{ {
...@@ -1612,9 +1633,9 @@ public class PoleProcessor { ...@@ -1612,9 +1633,9 @@ public class PoleProcessor {
disparity_scale, // double disparity_scale, // target disparity to differential disparity scale (baseline ratio) 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 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 // 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 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 debugLevel); // int debugLevel); // debug level
if (debugLevel > -2) { if (debugLevel > -2) {
System.out.println("applyMeasuredDisparity() for cluster "+cluster.toString()+" -> target disparity change: "+diff); System.out.println("applyMeasuredDisparity() for cluster "+cluster.toString()+" -> target disparity change: "+diff);
...@@ -1634,6 +1655,7 @@ public class PoleProcessor { ...@@ -1634,6 +1655,7 @@ public class PoleProcessor {
} }
public void printClusterStats( public void printClusterStats(
final int min_filter,
final ArrayList<PoleCluster> clusters) final ArrayList<PoleCluster> clusters)
{ {
int [][] real_poles = { int [][] real_poles = {
...@@ -1652,7 +1674,7 @@ public class PoleProcessor { ...@@ -1652,7 +1674,7 @@ public class PoleProcessor {
for (int nClust = 0; nClust < clusters.size(); nClust++) { for (int nClust = 0; nClust < clusters.size(); nClust++) {
PoleCluster cluster = clusters.get(nClust); PoleCluster cluster = clusters.get(nClust);
if (cluster.poleFilter() >= 0) { if (cluster.poleFilter() >= min_filter) {
boolean real_pole = false; boolean real_pole = false;
for (int i = 0; i < real_poles.length; i++) { for (int i = 0; i < real_poles.length; i++) {
if ((real_poles[i][0] == cluster.eBox.x) && (real_poles[i][1] == cluster.eBox.y)) { if ((real_poles[i][0] == cluster.eBox.x) && (real_poles[i][1] == cluster.eBox.y)) {
......
import java.util.Properties;
/**
**
** PoleProcessorParameters - parameters for PoleProcessor class that identifies
** thin vertical object (such as street lights) and measures distances
**
** Copyright (C) 2018 Elphel, Inc.
**
** -----------------------------------------------------------------------------**
**
** PoleProcessorParameters.java is free software: you can redistribute it and/or modify
** it under the terms of the GNU General Public License as published by
** the Free Software Foundation, either version 3 of the License, or
** (at your option) any later version.
**
** This program is distributed in the hope that it will be useful,
** but WITHOUT ANY WARRANTY; without even the implied warranty of
** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
** GNU General Public License for more details.
**
** You should have received a copy of the GNU General Public License
** along with this program. If not, see <http://www.gnu.org/licenses/>.
** -----------------------------------------------------------------------------**
**
*/
public class PoleProcessorParameters {
public boolean poles_en = true;
// Creating initial pole seeds (tops need to be detected and available in the available DSI
public double seed_rsrength = 0.8; // pole top seed relative strength (fraction of the strong trusted value that may change with correlation fat zero or other parameters
public int seed_down = 5; // seed disparity should be greater than average of this number of tiles below
public double seed_aover = 0.2; // how much seed disparity should exceed that of the tiles below
public double seed_rover = 0.05; // increase the previous by each 1 pixel of disparity
public double max_disparity = 5.0; // maximal disparity to consider (near objects can be handled well without these tricks
// Seed (pole heads) tiles initial clustering
public double max_dd = 0.1; // Maximal difference among seed tiles (compares to average of the already included)
public double max_dx = 5; // Maximal horizontal difference between tiles to be included in the same initial cluster
public double max_dy = -1.0; // Maximal horizontal difference between tiles to be included in the same initial cluster
public int ext_side = 2; // Extend initial cluster bounding box horizontally
public int ext_up = 2; // Extend initial cluster bounding box up
public int ext_down = 30; // Extend initial cluster bounding box down
public double pedestal_strength = 0.15; // Pole pedestal minimal normalized strength
public double pedestal_disp_over = 0.3; // Pole pedestal disparity over the head
// cluster merge and split parameters
public boolean merge_extended = false; // merge if only original clusters intersect
public double merge_rtolerance = 1.5; // max_dd;
public int split_min_dist = 3; // minimal distance between local maximums to split
public boolean split_must_zero = false; // true; // false; // there should be complete zero-strength on the profile to enable split
// Creating pole centerline and selection mask
public double max_diff = 2.0; // maximal horizontal distance between the pole centerline and contributing tiles
public double max_tilt = 0.1; // maximal pole center line tilt (dx/dy) from the vertical
public double max_rms = 1.0; // Maximal horizontal weighted RMS between the contributing tiles and the centerline
public int min_tiles = 3; // Minimal number of the remaining tiles to calculate centerline
public double damp_tilt = 0.1; // "Force" to make centerline vertical
public boolean use_seed = true; // use the original seed (pole head) in the selection mask
public double hwidth = 0.75; // maximal horizontal distance between the centerline and pole tiles in the selection
public double disp_aover = 0.2; // interrupt mask if there is some FG object in front of it, with disparity exceeding by this margin
public double disp_rover = 0.05; // increment above value per each pixel of disparity
public int min_neibs = 3; // minimal number of neighbors to keep tile in the pole mask
// More tile filtering: trim unoccupied bottoms and check that the cluster head is separated on both right and left sides
public boolean trim_bottoms = true; // Trim bounding box bottom that does not contain any measured tiles
public int extra_margin = 2; // check for the pole head separation from the same/closer objects on both (right and left) sides, up to this far from the extended bounding box
public double sep_min_strength = 0.07; // require that the pole head is separated from right and left with the weaker tiles or farther ones
public double sep_disp_adiff = 0.15; // separation should have objects with disparity by this lower than the head
public double sep_disp_rdiff = 0.05; // increase required disparity separation margin proportionally to the absolute disparity
// measurements/re-measurements parameters with notch filtering to emphasize vertical lines
public int remeasure_hheight = 4; // half maximum number of tiles vertical column to combine correlations
public double high_disp_tolerance =0.3; // count only tiles that had measured residual disparity not exceeding this value
public double low_disp_tolerance = 0.3; // count only tiles that had measured residual disparity not less than minus this value
public double min_strength = 0.15; // minimal measured strength to consider
public boolean use_fittest = true; // when selecting measurement among ones with different vertical integration, use the one closest to 0, false - use strongest result
// Updating disparity using the measurement results
public int max_refines = 20; // maximal number of re-measure/update disparity cycles
public double min_refine_diff = 0.001; // minimal disparity difference to keep refining
public double disparity_scale = 0.3; // 2; // target disparity to differential disparity scale (baseline ratio)
public 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
public double diff_offset = 0.5; // add to measured differential disparity before raising to specified power
public int cut_bottom = 2; // cut few tile rows from the very bottom - they may be influenced by ground objects
public double keep_bottom = 0.1; // do not cut more that this fraction of the bounding box height
// Filtering clusters (removing those that fail
public boolean filter_headlessOK = false; // allow clusters that do not have heads (generated by splitting)
public boolean filter_en = true; // enable cluster filtering (off - pass all)
public int filter_min_height = 10; // minimal extended bounding box height (good - min 12)
public double filter_min_fraction = 0.5; // minimal fraction of the pole mask that has measured valid tiles (worst 0.3478 , next - 0.57)
public double filter_min_frac_height =0.5; // vertical profile: minimal fraction of the pole selection mask that has valid measurements worst 0.25 , next - 0.556
public double filter_min_frac_box = 0.7; // same as above, but denominator includes full mask height including gaps if any worst 0.75 , next - 0.556
public double filter_min_disparity = 0.3; // minimal pole absolutre disparity
public double filter_max_disparity = 3.05; // maximal mole absolute disparity (2.95 - 3.15)
public int poles_debug_level = -1; // debug level for the poles
public void dialogQuestions(GenericJTabbedDialog gd) {
gd.addCheckbox ("Enable poles detection and usage", this.poles_en,"Enable poles detection and usege to improve DSI");
gd.addMessage("Creating initial pole seeds (tops need to be detected and available in the available DSI");
gd.addNumericField("Pole relative (to trusted tiles strength) to qualify for the pole seed", this.seed_rsrength, 3,6,"",
"Pole top seed relative strength (fraction of the strong trusted value that may change with correlation fat zero or other parameters");
gd.addNumericField("Seed disparity should be greater than average of this number of tiles below it", this.seed_down, 0,3,"tiles",
"Seed (pole head) tiles should appear closer (higher disparity) than the (presumably BG) tiles resolved below it. This is how many tiles below the seed should be averaged to compare");
gd.addNumericField("Seed disparity should exceed BG below by this margin", this.seed_aover, 3,6,"pix",
"How much seed disparity should exceed that of the tiles below");
gd.addNumericField("Relative seed disparity margin (per each disparity pixel)", this.seed_rover, 3,6,"pix/pix",
"Add to the previous parameter after multiplying by the absolute disparity");
gd.addNumericField("Maximal disparity to consider as a seed", this.max_disparity, 3,6,"pix",
"Near objects are handled nicely without such tricks, and they usually have larger horizontal dimension (more than a tile wide)");
gd.addMessage("Seed (pole heads) tiles initial clustering");
gd.addNumericField("Maximal disparity difference among seed tiles", this.max_dd, 3,6,"pix",
"Disparity of each new tile is compared to average disparity of the already included tiles. Set to -1 if don't care");
gd.addNumericField("Maximal horizontal difference between tiles to be included in the same initial cluster", this.max_dx, 3,6,"tiles",
"Compare added tile horizontal position to that of the average of the already included tiles. Set to -1.0 if don't care");
gd.addNumericField("Maximal vertical difference between tiles to be included in the same initial cluster", this.max_dy, 3,6,"tiles",
"Compare added tile vertical position to that of the average of the already included tiles. Set to -1.0 if don't care");
gd.addNumericField("Extend initial cluster horizontally (each side)", this.ext_side, 0,3,"tiles",
"Extend initial cluster bounding box (and search area) horizontally, each side");
gd.addNumericField("Extend initial cluster up from the initial seed cluster", this.ext_up, 0,3,"tiles",
"Extend initial cluster bounding box (and search area) up");
gd.addNumericField("Extend initial cluster bounding box down", this.ext_down, 0,3,"tiles",
"Search for the pole pedestal (tiles definitely closer than the seed tiles) this many tiles down from the seed");
gd.addNumericField("Pole pedestal minimal normalized strength", this.pedestal_strength, 3,6,"",
"Minimal normalized strength (after subtracting strength floor and optionally raising to specified power of teh pole base");
gd.addNumericField("Pole pedestal disparity over the head", this.pedestal_disp_over, 3,6,"pix",
"Pole base should have tiles closer (and so have higher disparity) than the pole seed by this margin");
gd.addMessage("Cluster merge and split parameters");
gd.addCheckbox ("Merge if even extended bounding boxes intersect", this.merge_extended,
"Unchecked - merge only if the seed bounding boxes intersect");
gd.addNumericField("Merge relative (to maximum cluster disparity difference) disparity tolerance", this.merge_rtolerance, 3,6,"",
"Merge if the disparity differs by less than this times scaled seed disparity allowed difference");
gd.addNumericField("Minimal distance between local maximums to split", this.split_min_dist, 0,3,"tiles",
"Calculate horizontal profile for the cluster seed and split if the distance between local maximums does not exceed this value");
gd.addCheckbox ("There should be a complete zero (empty) point on the horizontal profile to allow split", this.split_must_zero,
"Local maximums for the cluster split should be separated by at least one complete empty point");
gd.addMessage("Creating pole centerline and selection mask");
gd.addNumericField("Distance from the centerline", this.max_diff, 3,6,"tiles",
"Maximal horizontal distance between the pole centerline and contributing tiles");
gd.addNumericField("Maximal pole tilt", this.max_tilt, 3,6,"",
"Maximal pole center line tilt (dx/dy) from the vertical");
gd.addNumericField("Maximal horizontal RMS from the centerline", this.max_rms, 3,6,"tiles",
"Maximal horizontal weighted RMS between the contributing tiles and the centerline");
gd.addNumericField("Minimal number of tiles for the centerline calculation", this.min_tiles, 0,3,"tiles",
"Minimal number of the remaining tiles to calculate centerline");
gd.addNumericField("\"Force\" to make centerline vertical", this.damp_tilt, 3,6,"",
"Relative penalty for tilted pole centerline");
gd.addCheckbox ("Include cluster seed tiles in the cluster tile selection", this.use_seed,
"Include cluster seed tiles in addition to the centerline in the cluster tile selection");
gd.addNumericField("Half-width of the pole selection", this.hwidth, 3,6,"tiles",
"Maximal horizontal distance between the centerline and pole tiles in the selection");
gd.addNumericField("Disapritry difference to occlude the pole by the FG objects", this.disp_aover, 3,6,"pix",
"Interrupt pole mask if there is some FG object in front of it, with disparity exceeding by this margin");
gd.addNumericField("Relative disparity difference required for occlusion", this.disp_rover, 3,6,"pix/pix",
"Increase the required disparity difference proportionally to the absolute disparity");
gd.addNumericField("Minimal number of neighbors to keep tile in the pole mask", this.min_neibs, 0,3,"tiles",
"Filtering out lone or poorly connected tiles in the pole selection mask");
gd.addMessage("More tile filtering: trim unoccupied bottoms and check that the cluster head is separated on both right and left sides");
gd.addCheckbox ("Trim bounding box bottom that does not contain any measured tiles", this.trim_bottoms,
"Remove unused bottom portion of the extended bounding box of each cluster");
gd.addNumericField("Extra horizontal margins to look for cluster separation", this.extra_margin, 0,3,"tiles",
"Cluster head should be an \"island\" not the overhanging part of some larger objet. This value specifies how far to look for connections to other objects");
gd.addNumericField("Minimal normalized strength of the right/left head connection to be considered", this.sep_min_strength, 3,6,"",
"When looking for the suspected pole head connection to right/left objects consider only tiles stronger thatn that");
gd.addNumericField("Disconnection disparity difference", this.sep_disp_adiff, 3,6,"pix",
"To be disconnected, the pole head has to have neighbors with disparity this less than its own disparity");
gd.addNumericField("Relative disconnection disparity difference addition", this.sep_disp_rdiff, 3,6,"pix/pix",
"Increase the previous value proportionally to the absolute disparity");
gd.addMessage("Measurements/re-measurements parameters with notch filtering to emphasize vertical lines and suppress random texture of the background");
gd.addNumericField("Half maximum number of tiles vertical column to combine correlations", this.remeasure_hheight, 0,3,"tiles",
"Try to acquire poles using different number of vertically combined tiles, staring from 0 (center only). 1 - up to 3 tiles, 2 - up to 5 tiles, and so on");
gd.addNumericField("Maximal measured (residual) disparity", this.high_disp_tolerance, 3,6,"pix/pix",
"Count only tiles that had measured residual disparity not exceeding this value");
gd.addNumericField("Absolute value of the minimal measured (residual) disparity", this.low_disp_tolerance, 3,6,"pix/pix",
"Count only tiles that had measured residual disparity not less than negative of this value");
gd.addNumericField("Minimal measured strength to consider", this.min_strength, 3,6,"pix/pix",
"Increase the previous value proportionally to the absolute disparity");
gd.addCheckbox ("Use fittest of the measurements for each tile (unchecked - use strongest)", this.use_fittest,
"when selecting measurement among ones with different vertical integration, use the one closest to 0, false - use strongest result");
gd.addMessage("Updating disparity using the measurement results");
gd.addNumericField("Maximal number of re-measure/update disparity cycles", this.max_refines, 0,3,"",
"Number of update pole disparity - re-measure cycles to perform (if not reached maximal diff limit below");
gd.addNumericField("Minimal disparity difference to keep refining", this.min_refine_diff, 3,6,"",
"Stop updating disparity for a pole if the last difference is less than this value");
gd.addNumericField("Target disparity to differential disparity scale (baseline ratio)", this.disparity_scale, 3,6,"",
"Ideally it should be the ratio of the master camera baseline to inter-camera baseline, but because the interaction"+
"of the correlation window and correlation maximum width reduces reported disparity, it should be increased");
gd.addNumericField("Increase weight of the higher disparity measurements (>=1.0), 0.0 - use normal weighted average ", this.diff_power, 3,6,"",
"Bias towards higher disparities - (disparity+offset) is raised to this power and applied to weight if 0.0 - do not apply value to weight");
gd.addNumericField("Add to disparity before raising to the power specified above", this.diff_offset, 3,6,"",
"Disregard samples below negative of this value, multiply weight by the sum of the residual disparity (around 0.0) and this value raised to certain power");
gd.addNumericField("Do not use this many bottom tiles as their disparity may be influenced by the pedestal", this.cut_bottom, 0,3,"tiles",
"These cut-off tiles are still used in the pole mask. The amount of cut tiles may be reduced for the short objects by the next parameter");
gd.addNumericField("Do not cut pole bottoms by more than this fraction of its height", this.keep_bottom, 3,6,"",
"This parameter allows to reduce the number specified in the previous one for the short poles");
gd.addMessage("Filtering clusters (removing those that fail)");
gd.addCheckbox ("Allow headless clusters ", this.filter_headlessOK,
"Allow clusters that do not have heads (generated by splitting)");
gd.addCheckbox ("Enable cluster filtering", this.filter_en,
"Uncheck to process and report all clusters (headless are controlled independently)");
gd.addNumericField("Minimal cluster height", this.filter_min_height, 0,3,"tiles",
"Minimal cluster extended bounding box height");
gd.addNumericField("minimal tile ratio measured/pole mask", this.filter_min_fraction, 3,6,"",
"Minimal fraction of the pole mask that has measured valid tiles");
gd.addNumericField("Minimal ratio of measured/mask in the vertical profile", this.filter_min_frac_height, 3,6,"",
"Vertical profile: minimal fraction of the pole selection mask that has valid measurements");
gd.addNumericField("Minimal ration of the measured/full height tiles in the vertical profile", this.filter_min_frac_box, 3,6,"",
"Denominator includes full selection height, including gaps if any");
gd.addNumericField("Minimal final pole disparity", this.filter_min_disparity, 3,6,"pix",
"Exclude too far poles as determined after disparity refinement");
gd.addNumericField("Minimal final pole disparity", this.filter_max_disparity, 3,6,"pix",
"Exclude too far poles as determined after disparity refinement. Closer poles are usually resolved by normal correlation, pole extraction"+
"make the result objects fronto parallel billboards");
gd.addNumericField("Debug level for the pole processing", this.poles_debug_level, 0,3,"",
"Change independently of the global debug level, that later may still be used to disable ");
/*
// Filtering clusters (removing those that fail
gd.addNumericField("", this.merge_rtolerance, 3,6,"",
"");
gd.addNumericField("", this.split_min_dist, 0,3,"tiles",
"");
gd.addCheckbox ("", this.merge_extended,
"");
// Filtering clusters (removing those that fail
this.filter_headlessOK,
this.filter_en,
this.filter_min_height, 0,3,"tiles",
this.filter_min_fraction, 3,6,"",
this.filter_min_frac_height, 3,6,"",
this.filter_min_frac_box, 3,6,"",
this.filter_min_disparity, 3,6,"pix",
this.filter_max_disparity, 3,6,"pix",
this.poles_debug_level, 0,3,"",
*/
}
public void dialogAnswers(GenericJTabbedDialog gd) {
this.poles_en = gd.getNextBoolean();
// Creating initial pole seeds (tops need to be detected and available in the available DSI
this.seed_rsrength = gd.getNextNumber();
this.seed_down = (int) gd.getNextNumber();
this.seed_aover = gd.getNextNumber();
this.seed_rover = gd.getNextNumber();
this.max_disparity = gd.getNextNumber();
// Seed (pole heads) tiles initial clustering
this.max_dd = gd.getNextNumber();
this.max_dx = gd.getNextNumber();
this.max_dy = gd.getNextNumber();
this.ext_side = (int) gd.getNextNumber();
this.ext_up = (int) gd.getNextNumber();
this.ext_down = (int) gd.getNextNumber();
this.pedestal_strength = gd.getNextNumber();
this.pedestal_disp_over = gd.getNextNumber();
// Cluster merge and split parameters
this.merge_extended = gd.getNextBoolean();
this.merge_rtolerance = gd.getNextNumber();
this.split_min_dist = (int) gd.getNextNumber();
this.split_must_zero = gd.getNextBoolean();
// Creating pole centerline and selection mask
this.max_diff = gd.getNextNumber();
this.max_tilt = gd.getNextNumber();
this.max_rms = gd.getNextNumber();
this.min_tiles = (int) gd.getNextNumber();
this.damp_tilt = gd.getNextNumber();
this.use_seed= gd.getNextBoolean();
this.hwidth = gd.getNextNumber();
this.disp_aover = gd.getNextNumber();
this.disp_rover = gd.getNextNumber();
this.min_neibs = (int) gd.getNextNumber();
// More tile filtering: trim unoccupied bottoms and check that the cluster head is separated on both right and left sides
this.trim_bottoms = gd.getNextBoolean();
this.extra_margin = (int) gd.getNextNumber();
this.sep_min_strength = gd.getNextNumber();
this.sep_disp_adiff = gd.getNextNumber();
this.sep_disp_rdiff = gd.getNextNumber();
//Measurements/re-measurements parameters with notch filtering to emphasize vertical lines and suppress random texture of the background
this.remeasure_hheight = (int) gd.getNextNumber();
this.high_disp_tolerance = gd.getNextNumber();
this.low_disp_tolerance = gd.getNextNumber();
this.min_strength = gd.getNextNumber();
this.use_fittest = gd.getNextBoolean();
// Updating disparity using the measurement results
this.max_refines = (int) gd.getNextNumber();
this.min_refine_diff = gd.getNextNumber();
this.disparity_scale = gd.getNextNumber();
this.diff_power = gd.getNextNumber();
this.diff_offset = gd.getNextNumber();
this.cut_bottom = (int) gd.getNextNumber();
this.keep_bottom = gd.getNextNumber();
// Filtering clusters (removing those that fail
this.filter_headlessOK = gd.getNextBoolean();
this.filter_en = gd.getNextBoolean();
this.filter_min_height = (int) gd.getNextNumber();
this.filter_min_fraction = gd.getNextNumber();
this.filter_min_frac_height = gd.getNextNumber();
this.filter_min_frac_box = gd.getNextNumber();
this.filter_min_disparity = gd.getNextNumber();
this.filter_max_disparity = gd.getNextNumber();
this.poles_debug_level = (int) gd.getNextNumber();
}
public void setProperties(String prefix,Properties properties){
properties.setProperty(prefix+"poles_en", this.poles_en+"");
// Creating initial pole seeds (tops need to be detected and available in the available DSI
properties.setProperty(prefix+"seed_rsrength", this.seed_rsrength+"");
properties.setProperty(prefix+"seed_down", this.seed_down+"");
properties.setProperty(prefix+"seed_aover", this.seed_aover+"");
properties.setProperty(prefix+"seed_rover", this.seed_rover+"");
properties.setProperty(prefix+"max_disparity", this.max_disparity+"");
// Seed (pole heads) tiles initial clustering
properties.setProperty(prefix+"max_dd", this.max_dd+"");
properties.setProperty(prefix+"max_dx", this.max_dx+"");
properties.setProperty(prefix+"max_dy", this.max_dy+"");
properties.setProperty(prefix+"ext_side", this.ext_side+"");
properties.setProperty(prefix+"ext_up", this.ext_up+"");
properties.setProperty(prefix+"ext_down", this.ext_down+"");
properties.setProperty(prefix+"pedestal_strength", this.pedestal_strength+"");
properties.setProperty(prefix+"pedestal_disp_over", this.pedestal_disp_over+"");
// Cluster merge and split parameters
properties.setProperty(prefix+"merge_extended", this.merge_extended+"");
properties.setProperty(prefix+"merge_rtolerance", this.merge_rtolerance+"");
properties.setProperty(prefix+"split_min_dist", this.split_min_dist+"");
properties.setProperty(prefix+"split_must_zero", this.split_must_zero+"");
// Creating pole centerline and selection mask
properties.setProperty(prefix+"max_diff", this.max_diff+"");
properties.setProperty(prefix+"max_tilt", this.max_tilt+"");
properties.setProperty(prefix+"max_rms", this.max_rms+"");
properties.setProperty(prefix+"min_tiles", this.min_tiles+"");
properties.setProperty(prefix+"damp_tilt", this.damp_tilt+"");
properties.setProperty(prefix+"use_seed", this.use_seed+"");
properties.setProperty(prefix+"hwidth", this.hwidth+"");
properties.setProperty(prefix+"disp_aover", this.disp_aover+"");
properties.setProperty(prefix+"disp_rover", this.disp_rover+"");
properties.setProperty(prefix+"min_neibs", this.min_neibs+"");
// More tile filtering: trim unoccupied bottoms and check that the cluster head is separated on both right and left sides
properties.setProperty(prefix+"trim_bottoms", this.trim_bottoms+"");
properties.setProperty(prefix+"extra_margin", this.extra_margin+"");
properties.setProperty(prefix+"sep_min_strength", this.sep_min_strength+"");
properties.setProperty(prefix+"sep_disp_adiff", this.sep_disp_adiff+"");
properties.setProperty(prefix+"sep_disp_rdiff", this.sep_disp_rdiff+"");
//Measurements/re-measurements parameters with notch filtering to emphasize vertical lines and suppress random texture of the background
properties.setProperty(prefix+"remeasure_hheight", this.remeasure_hheight+"");
properties.setProperty(prefix+"high_disp_tolerance", this.high_disp_tolerance+"");
properties.setProperty(prefix+"low_disp_tolerance", this.low_disp_tolerance+"");
properties.setProperty(prefix+"min_strength", this.min_strength+"");
properties.setProperty(prefix+"use_fittest", this.use_fittest+"");
// Updating disparity using the measurement results
properties.setProperty(prefix+"max_refines", this.max_refines+"");
properties.setProperty(prefix+"min_refine_diff", this.min_refine_diff+"");
properties.setProperty(prefix+"disparity_scale", this.disparity_scale+"");
properties.setProperty(prefix+"diff_power", this.diff_power+"");
properties.setProperty(prefix+"diff_offset", this.diff_offset+"");
properties.setProperty(prefix+"cut_bottom", this.cut_bottom+"");
properties.setProperty(prefix+"keep_bottom", this.keep_bottom+"");
// Filtering clusters (removing those that fail
properties.setProperty(prefix+"filter_headlessOK", this.filter_headlessOK+"");
properties.setProperty(prefix+"filter_en", this.filter_en+"");
properties.setProperty(prefix+"filter_min_height", this.filter_min_height+"");
properties.setProperty(prefix+"filter_min_fraction", this.filter_min_fraction+"");
properties.setProperty(prefix+"filter_min_frac_height", this.filter_min_frac_height+"");
properties.setProperty(prefix+"filter_min_frac_box", this.filter_min_frac_box+"");
properties.setProperty(prefix+"filter_min_disparity", this.filter_min_disparity+"");
properties.setProperty(prefix+"filter_max_disparity", this.filter_max_disparity+"");
properties.setProperty(prefix+"poles_debug_level", this.poles_debug_level+"");
}
public void getProperties(String prefix,Properties properties){
if (properties.getProperty(prefix+"poles_en")!=null) this.poles_en=Boolean.parseBoolean(properties.getProperty(prefix+"poles_en"));
// Creating initial pole seeds (tops need to be detected and available in the available DSI
if (properties.getProperty(prefix+"seed_rsrength")!=null) this.seed_rsrength=Double.parseDouble(properties.getProperty(prefix+"seed_rsrength"));
if (properties.getProperty(prefix+"seed_down")!=null) this.seed_down=Integer.parseInt(properties.getProperty(prefix+"seed_down"));
if (properties.getProperty(prefix+"seed_aover")!=null) this.seed_aover=Double.parseDouble(properties.getProperty(prefix+"seed_aover"));
if (properties.getProperty(prefix+"seed_rover")!=null) this.seed_rover=Double.parseDouble(properties.getProperty(prefix+"seed_rover"));
if (properties.getProperty(prefix+"max_disparity")!=null) this.max_disparity=Double.parseDouble(properties.getProperty(prefix+"max_disparity"));
// Seed (pole heads) tiles initial clustering
if (properties.getProperty(prefix+"max_dd")!=null) this.max_dd=Double.parseDouble(properties.getProperty(prefix+"max_dd"));
if (properties.getProperty(prefix+"max_dx")!=null) this.max_dx=Double.parseDouble(properties.getProperty(prefix+"max_dx"));
if (properties.getProperty(prefix+"max_dy")!=null) this.max_dy=Double.parseDouble(properties.getProperty(prefix+"max_dy"));
if (properties.getProperty(prefix+"ext_side")!=null) this.ext_side=Integer.parseInt(properties.getProperty(prefix+"ext_side"));
if (properties.getProperty(prefix+"ext_up")!=null) this.ext_up=Integer.parseInt(properties.getProperty(prefix+"ext_up"));
if (properties.getProperty(prefix+"ext_down")!=null) this.ext_down=Integer.parseInt(properties.getProperty(prefix+"ext_down"));
if (properties.getProperty(prefix+"pedestal_strength")!=null) this.pedestal_strength=Double.parseDouble(properties.getProperty(prefix+"pedestal_strength"));
if (properties.getProperty(prefix+"pedestal_disp_over")!=null) this.pedestal_disp_over=Double.parseDouble(properties.getProperty(prefix+"pedestal_disp_over"));
// Cluster merge and split parameters
if (properties.getProperty(prefix+"merge_extended")!=null) this.merge_extended=Boolean.parseBoolean(properties.getProperty(prefix+"merge_extended"));
if (properties.getProperty(prefix+"merge_rtolerance")!=null) this.merge_rtolerance=Double.parseDouble(properties.getProperty(prefix+"merge_rtolerance"));
if (properties.getProperty(prefix+"split_min_dist")!=null) this.split_min_dist=Integer.parseInt(properties.getProperty(prefix+"split_min_dist"));
if (properties.getProperty(prefix+"split_must_zero")!=null) this.split_must_zero=Boolean.parseBoolean(properties.getProperty(prefix+"split_must_zero"));
// Creating pole centerline and selection mask
if (properties.getProperty(prefix+"max_diff")!=null) this.max_diff=Double.parseDouble(properties.getProperty(prefix+"max_diff"));
if (properties.getProperty(prefix+"max_tilt")!=null) this.max_tilt=Double.parseDouble(properties.getProperty(prefix+"max_tilt"));
if (properties.getProperty(prefix+"max_rms")!=null) this.max_rms=Double.parseDouble(properties.getProperty(prefix+"max_rms"));
if (properties.getProperty(prefix+"min_tiles")!=null) this.min_tiles=Integer.parseInt(properties.getProperty(prefix+"min_tiles"));
if (properties.getProperty(prefix+"damp_tilt")!=null) this.damp_tilt=Double.parseDouble(properties.getProperty(prefix+"damp_tilt"));
if (properties.getProperty(prefix+"use_seed")!=null) this.use_seed=Boolean.parseBoolean(properties.getProperty(prefix+"use_seed"));
if (properties.getProperty(prefix+"hwidth")!=null) this.hwidth=Double.parseDouble(properties.getProperty(prefix+"hwidth"));
if (properties.getProperty(prefix+"disp_aover")!=null) this.disp_aover=Double.parseDouble(properties.getProperty(prefix+"disp_aover"));
if (properties.getProperty(prefix+"disp_rover")!=null) this.disp_rover=Double.parseDouble(properties.getProperty(prefix+"disp_rover"));
if (properties.getProperty(prefix+"min_neibs")!=null) this.min_neibs=Integer.parseInt(properties.getProperty(prefix+"min_neibs"));
// More tile filtering: trim unoccupied bottoms and check that the cluster head is separated on both right and left sides
if (properties.getProperty(prefix+"trim_bottoms")!=null) this.trim_bottoms=Boolean.parseBoolean(properties.getProperty(prefix+"trim_bottoms"));
if (properties.getProperty(prefix+"extra_margin")!=null) this.extra_margin=Integer.parseInt(properties.getProperty(prefix+"extra_margin"));
if (properties.getProperty(prefix+"sep_min_strength")!=null) this.sep_min_strength=Double.parseDouble(properties.getProperty(prefix+"sep_min_strength"));
if (properties.getProperty(prefix+"sep_disp_adiff")!=null) this.sep_disp_adiff=Double.parseDouble(properties.getProperty(prefix+"sep_disp_adiff"));
if (properties.getProperty(prefix+"sep_disp_rdiff")!=null) this.sep_disp_rdiff=Double.parseDouble(properties.getProperty(prefix+"sep_disp_rdiff"));
//Measurements/re-measurements parameters with notch filtering to emphasize vertical lines and suppress random texture of the background
if (properties.getProperty(prefix+"remeasure_hheight")!=null) this.remeasure_hheight=Integer.parseInt(properties.getProperty(prefix+"remeasure_hheight"));
if (properties.getProperty(prefix+"high_disp_tolerance")!=null) this.high_disp_tolerance=Double.parseDouble(properties.getProperty(prefix+"high_disp_tolerance"));
if (properties.getProperty(prefix+"low_disp_tolerance")!=null) this.low_disp_tolerance=Double.parseDouble(properties.getProperty(prefix+"low_disp_tolerance"));
if (properties.getProperty(prefix+"min_strength")!=null) this.min_strength=Double.parseDouble(properties.getProperty(prefix+"min_strength"));
if (properties.getProperty(prefix+"use_fittest")!=null) this.use_fittest=Boolean.parseBoolean(properties.getProperty(prefix+"use_fittest"));
// Updating disparity using the measurement results
if (properties.getProperty(prefix+"max_refines")!=null) this.max_refines=Integer.parseInt(properties.getProperty(prefix+"max_refines"));
if (properties.getProperty(prefix+"min_refine_diff")!=null) this.min_refine_diff=Double.parseDouble(properties.getProperty(prefix+"min_refine_diff"));
if (properties.getProperty(prefix+"disparity_scale")!=null) this.disparity_scale=Double.parseDouble(properties.getProperty(prefix+"disparity_scale"));
if (properties.getProperty(prefix+"diff_power")!=null) this.diff_power=Double.parseDouble(properties.getProperty(prefix+"diff_power"));
if (properties.getProperty(prefix+"diff_offset")!=null) this.diff_offset=Double.parseDouble(properties.getProperty(prefix+"diff_offset"));
if (properties.getProperty(prefix+"cut_bottom")!=null) this.cut_bottom=Integer.parseInt(properties.getProperty(prefix+"cut_bottom"));
if (properties.getProperty(prefix+"keep_bottom")!=null) this.keep_bottom=Double.parseDouble(properties.getProperty(prefix+"keep_bottom"));
// Filtering clusters (removing those that fail
if (properties.getProperty(prefix+"filter_headlessOK")!=null) this.filter_headlessOK=Boolean.parseBoolean(properties.getProperty(prefix+"filter_headlessOK"));
if (properties.getProperty(prefix+"filter_en")!=null) this.filter_en=Boolean.parseBoolean(properties.getProperty(prefix+"filter_en"));
if (properties.getProperty(prefix+"filter_min_height")!=null) this.filter_min_height=Integer.parseInt(properties.getProperty(prefix+"filter_min_height"));
if (properties.getProperty(prefix+"filter_min_fraction")!=null) this.filter_min_fraction=Double.parseDouble(properties.getProperty(prefix+"filter_min_fraction"));
if (properties.getProperty(prefix+"filter_min_frac_height")!=null) this.filter_min_frac_height=Double.parseDouble(properties.getProperty(prefix+"filter_min_frac_height"));
if (properties.getProperty(prefix+"filter_min_frac_box")!=null) this.filter_min_frac_box=Double.parseDouble(properties.getProperty(prefix+"filter_min_frac_box"));
if (properties.getProperty(prefix+"filter_min_disparity")!=null) this.filter_min_disparity=Double.parseDouble(properties.getProperty(prefix+"filter_min_disparity"));
if (properties.getProperty(prefix+"filter_max_disparity")!=null) this.filter_max_disparity=Double.parseDouble(properties.getProperty(prefix+"filter_max_disparity"));
if (properties.getProperty(prefix+"poles_debug_level")!=null) this.poles_debug_level=Integer.parseInt(properties.getProperty(prefix+"poles_debug_level"));
}
@Override
public PoleProcessorParameters clone() { // throws CloneNotSupportedException {
PoleProcessorParameters ppp = new PoleProcessorParameters();
ppp.poles_en= this.poles_en;
// Creating initial pole seeds (tops need to be detected and available in the available DSI
ppp.seed_rsrength= this.seed_rsrength;
ppp.seed_down= this.seed_down;
ppp.seed_aover= this.seed_aover;
ppp.seed_rover= this.seed_rover;
ppp.max_disparity= this.max_disparity;
// Seed (pole heads) tiles initial clustering
ppp.max_dd= this.max_dd;
ppp.max_dx= this.max_dx;
ppp.max_dy= this.max_dy;
ppp.ext_side= this.ext_side;
ppp.ext_up= this.ext_up;
ppp.ext_down= this.ext_down;
ppp.pedestal_strength= this.pedestal_strength;
ppp.pedestal_disp_over= this.pedestal_disp_over;
// Cluster merge and split parameters
ppp.merge_extended = this.merge_extended;
ppp.merge_rtolerance = this.merge_rtolerance;
ppp.split_min_dist = this.split_min_dist;
ppp.split_must_zero = this.split_must_zero;
// Creating pole centerline and selection mask
ppp.max_diff = this.max_diff;
ppp.max_tilt = this.max_tilt;
ppp.max_rms = this.max_rms;
ppp.min_tiles = this.min_tiles;
ppp.damp_tilt = this.damp_tilt;
ppp.use_seed = this.use_seed;
ppp.hwidth = this.hwidth;
ppp.disp_aover = this.disp_aover;
ppp.disp_rover = this.disp_rover;
ppp.min_neibs = this.min_neibs;
// More tile filtering: trim unoccupied bottoms and check that the cluster head is separated on both right and left sides
ppp.trim_bottoms = this.trim_bottoms;
ppp.extra_margin = this.extra_margin;
ppp.sep_min_strength = this.sep_min_strength;
ppp.sep_disp_adiff = this.sep_disp_adiff;
ppp.sep_disp_rdiff = this.sep_disp_rdiff;
//Measurements/re-measurements parameters with notch filtering to emphasize vertical lines and suppress random texture of the background
ppp.remeasure_hheight = this.remeasure_hheight;
ppp.high_disp_tolerance = this.high_disp_tolerance;
ppp.low_disp_tolerance = this.low_disp_tolerance;
ppp.min_strength = this.min_strength;
ppp.use_fittest= this.use_fittest;
// Updating disparity using the measurement results
ppp.max_refines = this.max_refines;
ppp.min_refine_diff = this.min_refine_diff;
ppp.disparity_scale = this.disparity_scale;
ppp.diff_power = this.diff_power;
ppp.diff_offset = this.diff_offset;
ppp.cut_bottom = this.cut_bottom;
ppp.keep_bottom = this.keep_bottom;
// Filtering clusters (removing those that fail
ppp.filter_headlessOK = this.filter_headlessOK;
ppp.filter_en = this.filter_en;
ppp.filter_min_height = this.filter_min_height;
ppp.filter_min_fraction = this.filter_min_fraction;
ppp.filter_min_frac_height = this.filter_min_frac_height;
ppp.filter_min_frac_box = this.filter_min_frac_box;
ppp.filter_min_disparity = this.filter_min_disparity;
ppp.filter_max_disparity = this.filter_max_disparity;
ppp.poles_debug_level = this.poles_debug_level;
return ppp;
}
}
...@@ -1102,7 +1102,7 @@ public class PostProcessing { ...@@ -1102,7 +1102,7 @@ public class PostProcessing {
public int fillFgGapNeib= 3; public int fillFgGapNeib= 3;
public double filter2DisparityMax =100.0; public double filter2DisparityMax =100.0;
public double filter2DisaprityMin = 50.0; public double filter2disparityMin = 50.0;
public boolean filter2UpdateMax= true; public boolean filter2UpdateMax= true;
public double filter2MinAbsolute= 0.01; public double filter2MinAbsolute= 0.01;
public double filter2MinRelative= 0.1; public double filter2MinRelative= 0.1;
...@@ -1231,7 +1231,7 @@ public class PostProcessing { ...@@ -1231,7 +1231,7 @@ public class PostProcessing {
properties.setProperty(prefix+"fillFgGapNeib",this.fillFgGapNeib+""); properties.setProperty(prefix+"fillFgGapNeib",this.fillFgGapNeib+"");
properties.setProperty(prefix+"filter2DisparityMax",this.filter2DisparityMax+""); 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+"filter2UpdateMax",this.filter2UpdateMax+"");
properties.setProperty(prefix+"filter2MinAbsolute",this.filter2MinAbsolute+""); properties.setProperty(prefix+"filter2MinAbsolute",this.filter2MinAbsolute+"");
properties.setProperty(prefix+"filter2MinRelative",this.filter2MinRelative+""); properties.setProperty(prefix+"filter2MinRelative",this.filter2MinRelative+"");
...@@ -1375,7 +1375,7 @@ public class PostProcessing { ...@@ -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+"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+"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+"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+"filter2MinAbsolute")!=null) this.filter2MinAbsolute=Double.parseDouble(properties.getProperty(prefix+"filter2MinAbsolute"));
if (properties.getProperty(prefix+"filter2MinRelative")!=null) this.filter2MinRelative=Double.parseDouble(properties.getProperty(prefix+"filter2MinRelative")); if (properties.getProperty(prefix+"filter2MinRelative")!=null) this.filter2MinRelative=Double.parseDouble(properties.getProperty(prefix+"filter2MinRelative"));
...@@ -1537,7 +1537,7 @@ public class PostProcessing { ...@@ -1537,7 +1537,7 @@ public class PostProcessing {
if ((mode & 512)!=0){ if ((mode & 512)!=0){
gd.addMessage(" -------------- filter2 parameters --------------"); gd.addMessage(" -------------- filter2 parameters --------------");
gd.addNumericField("Maximal disparity to process",this.filter2DisparityMax,2,6,"pix"); 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.addCheckbox ("Update abolute/relative maximums", this.filter2UpdateMax); // true;
gd.addNumericField("Absolute threshold for correlation vs. disparity maximums",this.filter2MinAbsolute,4,5,""); 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,"%"); gd.addNumericField("Relative threshold for correlation vs. disparity maximums",100*this.filter2MinRelative,2,6,"%");
...@@ -1681,7 +1681,7 @@ public class PostProcessing { ...@@ -1681,7 +1681,7 @@ public class PostProcessing {
} }
if ((mode & 512)!=0){ if ((mode & 512)!=0){
this.filter2DisparityMax= gd.getNextNumber(); this.filter2DisparityMax= gd.getNextNumber();
this.filter2DisaprityMin= gd.getNextNumber(); this.filter2disparityMin= gd.getNextNumber();
this.filter2UpdateMax= gd.getNextBoolean(); this.filter2UpdateMax= gd.getNextBoolean();
this.filter2MinAbsolute= gd.getNextNumber(); this.filter2MinAbsolute= gd.getNextNumber();
this.filter2MinRelative= 0.01*gd.getNextNumber(); this.filter2MinRelative= 0.01*gd.getNextNumber();
......
...@@ -2634,7 +2634,7 @@ public class SuperTiles{ ...@@ -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 boolean [][][][] plane_selections, // = new boolean [nStiles][][][]; // num_tiles
final double [][][][] disp_strength, final double [][][][] disp_strength,
final double plDispNorm, final double plDispNorm,
...@@ -2854,7 +2854,7 @@ public class SuperTiles{ ...@@ -2854,7 +2854,7 @@ public class SuperTiles{
} }
}; };
} }
ImageDtt.startAndJoin(threads); ImageDtt.startAndJoin(threads); // Never finished?
return result_planes; return result_planes;
} }
......
...@@ -1940,6 +1940,7 @@ public class TilePlanes { ...@@ -1940,6 +1940,7 @@ public class TilePlanes {
y, y,
d, d,
this.correctDistortions); this.correctDistortions);
tiles_xyzw[nl][indx][0] = wxyz[0]; tiles_xyzw[nl][indx][0] = wxyz[0];
tiles_xyzw[nl][indx][1] = wxyz[1]; tiles_xyzw[nl][indx][1] = wxyz[1];
tiles_xyzw[nl][indx][2] = wxyz[2]; tiles_xyzw[nl][indx][2] = wxyz[2];
...@@ -1948,6 +1949,14 @@ public class TilePlanes { ...@@ -1948,6 +1949,14 @@ public class TilePlanes {
swz += w * wxyz[2]; swz += w * wxyz[2];
swx += w * wxyz[0]; swx += w * wxyz[0];
swy += w * wxyz[1]; 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 // end of difference from getPlaneFromMeas
} }
} }
...@@ -1975,10 +1984,16 @@ public class TilePlanes { ...@@ -1975,10 +1984,16 @@ public class TilePlanes {
if (sw == 0.0) { if (sw == 0.0) {
return null; // 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; swz /= sw;
swx /= sw; swx /= sw;
swy /= sw; swy /= sw;
setWxyz(swx, swy, swz); 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; // double kz = ((dispNorm > 0.0) && (swz > dispNorm)) ? (dispNorm / swz) : 1.0;
...@@ -2003,6 +2018,9 @@ public class TilePlanes { ...@@ -2003,6 +2018,9 @@ public class TilePlanes {
acovar [1][1] += w * y * y; acovar [1][1] += w * y * y;
acovar [1][2] += w * y * z; acovar [1][2] += w * y * z;
acovar [2][2] += w * z * 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 { ...@@ -2011,6 +2029,7 @@ public class TilePlanes {
acovar [1][0] = acovar [0][1]; acovar [1][0] = acovar [0][1];
acovar [2][0] = acovar [0][2]; acovar [2][0] = acovar [0][2];
acovar [2][1] = acovar [1][2]; acovar [2][1] = acovar [1][2];
Matrix covar = new Matrix(acovar); Matrix covar = new Matrix(acovar);
EigenvalueDecomposition eig = covar.eig(); EigenvalueDecomposition eig = covar.eig();
......
...@@ -584,7 +584,9 @@ public class TwoQuadCLT { ...@@ -584,7 +584,9 @@ public class TwoQuadCLT {
int iAux = (iQuadComb >= quad_main) ? 1 : 0; int iAux = (iQuadComb >= quad_main) ? 1 : 0;
int iSubCam= iQuadComb - iAux * quad_main; 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 if (clt_parameters.corr_sigma > 0){ // no filter at all
for (int chn = 0; chn < clt_bidata[iAux][iSubCam].length; chn++) { for (int chn = 0; chn < clt_bidata[iAux][iSubCam].length; chn++) {
...@@ -1406,6 +1408,13 @@ if (debugLevel > -100) return true; // temporarily ! ...@@ -1406,6 +1408,13 @@ if (debugLevel > -100) return true; // temporarily !
pole_clusters); // final ArrayList<PoleCluster> clusters) 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_min_strength = 0.07;
final double sep_disp_adiff = 0.15; final double sep_disp_adiff = 0.15;
final double sep_disp_rdiff = 0.05; final double sep_disp_rdiff = 0.05;
...@@ -1416,7 +1425,6 @@ if (debugLevel > -100) return true; // temporarily ! ...@@ -1416,7 +1425,6 @@ if (debugLevel > -100) return true; // temporarily !
sep_disp_rdiff, // final double disp_rdiff, sep_disp_rdiff, // final double disp_rdiff,
norm_ds, // final double [][] norn_ds, norm_ds, // final double [][] norn_ds,
pole_clusters); // final ArrayList<PoleCluster> clusters) pole_clusters); // final ArrayList<PoleCluster> clusters)
int num_removed =pp.removeFilteredClusters( int num_removed =pp.removeFilteredClusters(
pole_clusters, // ArrayList<PoleCluster> clusters, pole_clusters, // ArrayList<PoleCluster> clusters,
debugLevel); // int debugLevel) debugLevel); // int debugLevel)
...@@ -1430,20 +1438,20 @@ if (debugLevel > -100) return true; // temporarily ! ...@@ -1430,20 +1438,20 @@ if (debugLevel > -100) return true; // temporarily !
if (debugLevel > -2) { if (debugLevel > -2) {
System.out.println("Reaasigned layers: "+num_layers); 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 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 // 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 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( double max_target_diff = pp.applyMeasuredDisparity(
disparity_scale, // final double disparity_scale, // target disparity to differential disparity scale (baseline ratio) 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 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 // 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 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, pole_clusters, // final ArrayList<PoleCluster> clusters,
debugLevel); // final int debugLevel) // debug level debugLevel); // final int debugLevel) // debug level
if (debugLevel > -2) { if (debugLevel > -2) {
...@@ -1609,8 +1617,10 @@ if (debugLevel > -100) return true; // temporarily ! ...@@ -1609,8 +1617,10 @@ if (debugLevel > -100) return true; // temporarily !
true, true,
"MEAS-COMBO", "MEAS-COMBO",
titles); titles);
System.out.println(" === filtered \"pole\" clusters ===");
pp.printClusterStats(pole_clusters); pp.printClusterStats(
0, // minimal filter value
pole_clusters);
} }
} }
final int max_refines = 20; final int max_refines = 20;
...@@ -1630,9 +1640,9 @@ if (debugLevel > -100) return true; // temporarily ! ...@@ -1630,9 +1640,9 @@ if (debugLevel > -100) return true; // temporarily !
disparity_scale, // final double disparity_scale, // target disparity to differential disparity scale (baseline ratio) 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 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 // 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 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, pole_clusters, // final ArrayList<PoleCluster> clusters,
debugLevel); // final int debugLevel) // debug level debugLevel); // final int debugLevel) // debug level
if (debugLevel > -2) { if (debugLevel > -2) {
...@@ -1675,7 +1685,7 @@ if (debugLevel > -100) return true; // temporarily ! ...@@ -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; boolean filter_poles = true;
double [][] dbg_layers_meas = pp.dbgClusterLayers( // layer and eBox should be set double [][] dbg_layers_meas = pp.dbgClusterLayers( // layer and eBox should be set
false, // boolean show_bbox, false, // boolean show_bbox,
...@@ -1752,15 +1762,68 @@ if (debugLevel > -100) return true; // temporarily ! ...@@ -1752,15 +1762,68 @@ if (debugLevel > -100) return true; // temporarily !
"MEAS-COMBO-REFINE_"+nRefine, "MEAS-COMBO-REFINE_"+nRefine,
titles); 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; return true;
} }
...@@ -2896,7 +2959,7 @@ if (debugLevel > -100) return true; // temporarily ! ...@@ -2896,7 +2959,7 @@ if (debugLevel > -100) return true; // temporarily !
* calcTrusted should be called before to set up trusted/cond_trusted tiles * 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 * suggested tiles will be compared against and made sure they differ by more than a specified margin
* 1) current measured (refined) disparity value * 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 * 3) any other disable measurement
* 4) any target disparity that lead to the disabled 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 * @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