Commit c5a13cd6 authored by Andrey Filippov's avatar Andrey Filippov

Fixed CM bug for bi-quad, more on low-texture filtering

parent 2ea2b2c9
......@@ -120,6 +120,15 @@ public class BiQuadParameters {
public double pf_damp_tilt = 0.001; // Tilt cost for damping insufficient plane data
public double pf_rwsigma = 0.7; // influence of far neighbors diminish as a Gaussian with this sigma
public double pf_rwsigma_narrow = 0.2; // used to determine initial tilt ( 1/radius)
public boolean pf_use_alt = false; // When fitting for the best plane - look for alernative measured tiles too
public double pf_goal_fraction_rms = 0.5; // Try to make rms to be this fraction of maximal acceptable by removing outliers
public double pf_boost_low_density = 0.8; // Strength assigned to fake tiles from neighbors (the lower - the higher)
// Apply when filling gaps, not when growing
public int pf_fourq_min = 1; // Each of the 4 corners should have at least this number of tiles.
public int pf_fourq_gap = 1; // Symmetrical vertical and horizontal center areas that do not belong to any corner
// int trimWeakFG(
public boolean pf_en_trim_fg = false; // Trim weak FZG
......@@ -371,6 +380,20 @@ public class BiQuadParameters {
"Sigma is relative to selection radius (square half-side)");
gd.addNumericField("Weight function Gaussian sigma (relative to radius) for initial plane fitting", this.pf_rwsigma_narrow, 4,6,"",
"Weight function Gaussian sigma (relative to selection radius) for initial plane fitting. May be ~=1/radius");
gd.addCheckbox ("When fitting for the best plane - look for alernative measured tiles too", this.pf_use_alt,
"When selecting tiles that fit best to the plane, try alternative (weaker) disparities too");
gd.addNumericField("Try to make rms to be this fraction of maximal acceptable by removing outliers", this.pf_goal_fraction_rms, 4,6,"pix",
"When removing outliers to fit planes, stop removing when the RMS of the remaining drops below this fraction of the maxium allowed RMS (should be < 1.0");
gd.addNumericField("Strength assigned to fake tiles from neighbors (the lower - the higher)", this.pf_boost_low_density, 4,6,"pix",
"Returned strength assigned to the tiles increases with this value - seems to be a bug");
gd.addNumericField("Each of the 4 corners should have at least this number of tiles", this.pf_fourq_min, 0,3,"",
"Apply (>0) only for filling gaps, not during expansion. It requires that every of the 4 corners of the sample square has this number of tiles for a plane");
gd.addNumericField("Four corners center gap half-width (1 - 1 tile, 2 - 3 tiles, 3 - 5 tiles, ...", this.pf_fourq_gap, 0,3,"",
"Specifies corners of the sample square that should have tiles remain, after removing centre columns and center rows");
gd.addCheckbox ("Trim hanging FG", this.pf_en_trim_fg,
"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",
......@@ -574,6 +597,14 @@ public class BiQuadParameters {
this.pf_damp_tilt= gd.getNextNumber();
this.pf_rwsigma= gd.getNextNumber();
this.pf_rwsigma_narrow= gd.getNextNumber();
this.pf_use_alt= gd.getNextBoolean();
this.pf_goal_fraction_rms= gd.getNextNumber();
this.pf_boost_low_density= gd.getNextNumber();
this.pf_fourq_min= (int) gd.getNextNumber();
this.pf_fourq_gap= (int) gd.getNextNumber();
this.pf_en_trim_fg= gd.getNextBoolean();
this.pf_atolerance= gd.getNextNumber();
this.pf_rtolerance= gd.getNextNumber();
......@@ -590,7 +621,6 @@ public class BiQuadParameters {
this.pf_new_diff= gd.getNextNumber();
this.pf_min_new= (int) gd.getNextNumber();
this.ltfar_en= gd.getNextBoolean();
this.ltfar_auto_floor= gd.getNextBoolean();
this.ltfar_min_disparity= gd.getNextNumber();
......@@ -719,6 +749,13 @@ public class BiQuadParameters {
properties.setProperty(prefix+"pf_damp_tilt", this.pf_damp_tilt+"");
properties.setProperty(prefix+"pf_rwsigma", this.pf_rwsigma+"");
properties.setProperty(prefix+"pf_rwsigma_narrow", this.pf_rwsigma_narrow+"");
properties.setProperty(prefix+"pf_use_alt", this.pf_use_alt+"");
properties.setProperty(prefix+"pf_goal_fraction_rms", this.pf_goal_fraction_rms+"");
properties.setProperty(prefix+"pf_boost_low_density", this.pf_boost_low_density+"");
properties.setProperty(prefix+"pf_fourq_min", this.pf_fourq_min+"");
properties.setProperty(prefix+"pf_fourq_gap", this.pf_fourq_gap+"");
properties.setProperty(prefix+"pf_en_trim_fg", this.pf_en_trim_fg+"");
properties.setProperty(prefix+"pf_atolerance", this.pf_atolerance+"");
properties.setProperty(prefix+"pf_rtolerance", this.pf_rtolerance+"");
......@@ -845,8 +882,8 @@ public class BiQuadParameters {
if (properties.getProperty(prefix+"pf_strength_rfloor")!=null) this.pf_strength_rfloor=Double.parseDouble(properties.getProperty(prefix+"pf_strength_rfloor"));
if (properties.getProperty(prefix+"pf_cond_rtrusted")!=null) this.pf_cond_rtrusted=Double.parseDouble(properties.getProperty(prefix+"pf_cond_rtrusted"));
if (properties.getProperty(prefix+"pf_strength_pow")!=null) this.pf_strength_pow=Double.parseDouble(properties.getProperty(prefix+"pf_strength_pow"));
if (properties.getProperty(prefix+"pf_disp_afloor")!=null) this.pf_strength_pow=Double.parseDouble(properties.getProperty(prefix+"pf_disp_afloor"));
if (properties.getProperty(prefix+"pf_disp_rfloor")!=null) this.pf_strength_pow=Double.parseDouble(properties.getProperty(prefix+"pf_disp_rfloor"));
if (properties.getProperty(prefix+"pf_disp_afloor")!=null) this.pf_disp_afloor=Double.parseDouble(properties.getProperty(prefix+"pf_disp_afloor"));
if (properties.getProperty(prefix+"pf_disp_rfloor")!=null) this.pf_disp_rfloor=Double.parseDouble(properties.getProperty(prefix+"pf_disp_rfloor"));
if (properties.getProperty(prefix+"pf_smpl_radius")!=null) this.pf_smpl_radius=Integer.parseInt(properties.getProperty(prefix+"pf_smpl_radius"));
if (properties.getProperty(prefix+"pf_smpl_num")!=null) this.pf_smpl_num=Integer.parseInt(properties.getProperty(prefix+"pf_smpl_num"));
if (properties.getProperty(prefix+"pf_smpl_num_narrow")!=null) this.pf_smpl_num_narrow=Integer.parseInt(properties.getProperty(prefix+"pf_smpl_num_narrow"));
......@@ -861,6 +898,12 @@ public class BiQuadParameters {
if (properties.getProperty(prefix+"pf_rwsigma")!=null) this.pf_rwsigma=Double.parseDouble(properties.getProperty(prefix+"pf_rwsigma"));
if (properties.getProperty(prefix+"pf_rwsigma_narrow")!=null) this.pf_rwsigma_narrow=Double.parseDouble(properties.getProperty(prefix+"pf_rwsigma_narrow"));
if (properties.getProperty(prefix+"pf_use_alt")!=null) this.pf_use_alt=Boolean.parseBoolean(properties.getProperty(prefix+"pf_use_alt"));
if (properties.getProperty(prefix+"pf_goal_fraction_rms")!=null) this.pf_goal_fraction_rms=Double.parseDouble(properties.getProperty(prefix+"pf_goal_fraction_rms"));
if (properties.getProperty(prefix+"pf_boost_low_density")!=null) this.pf_boost_low_density=Double.parseDouble(properties.getProperty(prefix+"pf_boost_low_density"));
if (properties.getProperty(prefix+"pf_fourq_min")!=null) this.pf_fourq_min=Integer.parseInt(properties.getProperty(prefix+"pf_fourq_min"));
if (properties.getProperty(prefix+"pf_fourq_gap")!=null) this.pf_fourq_gap=Integer.parseInt(properties.getProperty(prefix+"pf_fourq_gap"));
if (properties.getProperty(prefix+"pf_en_trim_fg")!=null) this.pf_en_trim_fg=Boolean.parseBoolean(properties.getProperty(prefix+"pf_en_trim_fg"));
if (properties.getProperty(prefix+"pf_atolerance")!=null) this.pf_atolerance=Double.parseDouble(properties.getProperty(prefix+"pf_atolerance"));
......@@ -1005,6 +1048,14 @@ public class BiQuadParameters {
bqp.pf_damp_tilt= this.pf_damp_tilt;
bqp.pf_rwsigma= this.pf_rwsigma;
bqp.pf_rwsigma_narrow= this.pf_rwsigma_narrow;
bqp.pf_use_alt= this.pf_use_alt;
bqp.pf_goal_fraction_rms = this.pf_goal_fraction_rms;
bqp.pf_boost_low_density= this.pf_boost_low_density;
bqp.pf_fourq_min= this.pf_fourq_min;
bqp.pf_fourq_gap= this.pf_fourq_gap;
bqp.pf_en_trim_fg = this.pf_en_trim_fg;
bqp.pf_atolerance= this.pf_atolerance;
bqp.pf_rtolerance= this.pf_rtolerance;
......
This diff is collapsed.
......@@ -38,6 +38,7 @@ public class Correlation2d {
private final double [] ortho_notch_filter;
private final double [] corr_wndx;
private final double [] corr_wndy;
private final double [] corr_wndy_notch;
// configuration for 8-lens and 4-lens cameras. 8-lens has baseline = 1 for 1..4 and 1/2 for 4..7
/*0 1
......@@ -133,16 +134,25 @@ public class Correlation2d {
this.ortho_notch_filter = new double [corr_size];
this.corr_wndy = halfFlatTopWindow(
imgdtt_params.corr_wndy_size, // int ihwidth,
imgdtt_params.corr_wndy_hwidth, // double hwidth,
imgdtt_params.corr_wndy_hwidth, // double hwidth,
imgdtt_params.corr_wndy_blur, // double blur,
true, // boolean normalize,
true, // boolean normalize,
false, // boolean notch,
1.0); // double scale);
this.corr_wndx = halfFlatTopWindow(
imgdtt_params.corr_wndx_size, // int ihwidth,
imgdtt_params.corr_wndx_hwidth, // double hwidth,
imgdtt_params.corr_wndx_blur, // double blur,
true, // boolean normalize,
false, // boolean notch,
wndx_scale); // double scale);
this.corr_wndy_notch = halfFlatTopWindow(
imgdtt_params.corr_strip_notch, // int ihwidth,
imgdtt_params.corr_notch_hwidth,// double hwidth,
imgdtt_params.corr_notch_blur, // double blur,
true, // boolean normalize,
true, // boolean notch,
wndx_scale); // double scale);
}
......@@ -908,9 +918,20 @@ public class Correlation2d {
this.corr_wndx, // double [] window_x, // half of a window function in x (disparity) direction
debug);// boolean debug);
}
public double [] getMaxXCm( // get fractional center as a "center of mass" inside circle/square from the integer max
public double [] getMaxXCmNotch( // get fractional center as a "center of mass" inside circle/square from the integer max
double [] data, // [data_size * data_size]
int ixcenter, // integer center x
boolean debug) {
return getMaxXCm( // get fractional center as a "center of mass" inside circle/square from the integer max
data, // double [] data, // [data_size * data_size]
ixcenter, // int ixcenter, // integer center x
this.corr_wndy_notch, // double [] window_y, // (half) window function in y-direction(perpendicular to disparity: for row0 ==1
this.corr_wndx, // double [] window_x, // half of a window function in x (disparity) direction
debug); // boolean debug);
}
public double [] getMaxXCm( // get fractional center as a "center of mass" inside circle/square from the integer max
double [] data, // rectangular strip of 1/2 of the correlation are with odd rows shifted by 1/2 pixels
int ixcenter, // integer center x
double [] window_y, // (half) window function in y-direction(perpendicular to disparity: for row0 ==1
double [] window_x, // half of a window function in x (disparity) direction
boolean debug) {
......@@ -926,7 +947,29 @@ public class Correlation2d {
wy_scale = 1.0/swy;
}
double [][]dbg_data = null;
if (debug) {
String [] dbg_titles = {"strip","*wnd_y"};
dbg_data = new double [2][];
dbg_data[0] = debugStrip3(data);
double [] data_0 = data.clone();
for (int i = 0; i < data_height; i++) {
for (int j = 0; j < data_width; j++) {
data_0[i * data_width + j] *= (i < window_y.length) ? (wy_scale * window_y[i]): 0.0;
}
}
dbg_data[1] = debugStrip3(data_0);
int long_width = 2 * (2 * transform_size-1);
if (dbg_data[0] != null) {
(new showDoubleFloatArrays()).showArrays(
dbg_data,
long_width,
dbg_data[0].length/long_width,
true,
"Strip",
dbg_titles);
}
System.out.println("getMaxXCm(), ixcenter = "+ixcenter);
for (int dy = 0; dy < data_height; dy++) {
if ((dy & 1) != 0) System.out.print(" ");
......@@ -937,7 +980,6 @@ public class Correlation2d {
}
System.out.println();
}
double s0=0.0, sx=0.0, sx2 = 0.0;
int x0 = center + ixcenter; // index of the argmax, starting with 0
for (int dy = 0; dy < data_height; dy++) {
......@@ -993,6 +1035,7 @@ public class Correlation2d {
* @param blur full width of transition from top value to zero
* @param normalize: false - no normalization, [0] = 1.0 (blur permitting),
* true - sum of zero element and twice each other == 1.0
* @param notch: true - make it a notch filter
* @param scale multiply each value
* @return half-window array [ihwidth]
*/
......@@ -1002,6 +1045,7 @@ public class Correlation2d {
double hwidth,
double blur,
boolean normalize,
boolean notch,
double scale) {
double [] wnd = new double [ihwidth];
for (int i = 0; i < ihwidth; i++) {
......@@ -1012,6 +1056,9 @@ public class Correlation2d {
else if (i > hwidth + blur/2) wnd[i] = 0.0;
else wnd[i] = 0.5*(1.0 - Math.sin(Math.PI * (i-hwidth)/blur));
}
if (notch) {
wnd[i] = 1.0 - wnd[i];
}
}
if (normalize) {
double s = 0.0;
......@@ -1256,6 +1303,32 @@ public class Correlation2d {
return padded_strip;
}
// Full size/resolution.but on a larger rectangle
public double [] debugStrip3(
double [] strip) {
if (strip == null) return null;
int center = transform_size - 1;
int width = 2 * center + 1;// 2* transform_siza-1
int long_width = 2 * width;
int height = strip.length/width;
int long_height = 2 * height - 1;
double [] padded_strip = new double [long_height * long_width];
for (int row = 0; row < long_height; row++) {
int srow = (row >= height)? (row - height) : (height - row);
int odd = srow & 1;
for (int j = 0; j<width; j++) {
int j1 = transform_size / 2 + ((j - odd) >> 1);
if ((j1 < 0) || (j1 >- width)) {
padded_strip[row * width + j] = Double.NaN;
} else {
padded_strip[row * width + j] = strip[srow * width + j1];
}
}
}
return padded_strip;
}
public double [] mismatchPairsCM( // returns x-xcenter, y, strength (sign same as disparity)
ImageDttParameters imgdtt_params,
double [][] corrs,
......
......@@ -592,6 +592,8 @@ private Panel panel1,
addButton("Reset GT", panelClt4, color_stop);
addButton("Ground truth 0", panelClt4, color_configure);
addButton("Ground truth", panelClt4, color_conf_process);
addButton("Show biscan", panelClt4, color_configure);
addButton("Poles GT", panelClt4, color_process);
addButton("ML export", panelClt4, color_conf_process);
addButton("Rig planes", panelClt4, color_conf_process);
......@@ -4615,8 +4617,19 @@ private Panel panel1,
DEBUG_LEVEL=MASTER_DEBUG_LEVEL;
EYESIS_CORRECTIONS.setDebug(DEBUG_LEVEL);
enhanceByRig(true);
return;
/* ======================================================================== */
} else if (label.equals("Show biscan")) {
DEBUG_LEVEL=MASTER_DEBUG_LEVEL;
EYESIS_CORRECTIONS.setDebug(DEBUG_LEVEL);
showBiScan();
return;
/* ======================================================================== */
} else if (label.equals("Poles GT")) {
DEBUG_LEVEL=MASTER_DEBUG_LEVEL;
EYESIS_CORRECTIONS.setDebug(DEBUG_LEVEL);
processPoles();
return;
/* ======================================================================== */
} else if (label.equals("CLT planes")) {
DEBUG_LEVEL=MASTER_DEBUG_LEVEL;
......@@ -5047,6 +5060,8 @@ private Panel panel1,
return true;
}
public boolean rigPlanes() {
if ((QUAD_CLT == null) || (QUAD_CLT.tp == null) || (QUAD_CLT.tp.clt_3d_passes == null)) {
String msg = "DSI data is not available. Please run \"CLT 3D\" first";
......@@ -5069,6 +5084,70 @@ private Panel panel1,
return true;
}
public boolean showBiScan() {
if ((QUAD_CLT == null) ||
(QUAD_CLT.tp == null) ||
(QUAD_CLT.tp.clt_3d_passes == null) ||
(TWO_QUAD_CLT == null) ||
(TWO_QUAD_CLT.biCamDSI_persistent== null) ||
(TWO_QUAD_CLT.biCamDSI_persistent.biScans== null)) {
String msg = "Data is not available. Please run \"Ground truth\" first";
IJ.showMessage("Error",msg);
System.out.println(msg);
return false;
}
TWO_QUAD_CLT.showBiScan(
QUAD_CLT, // QuadCLT quadCLT_main, // tiles should be set
CLT_PARAMETERS, // EyesisCorrectionParameters.CLTParameters clt_parameters,
DEBUG_LEVEL); // final int debugLevel) // throws Exception
return true;
}
public boolean processPoles() {
long startTime=System.nanoTime();
if ((QUAD_CLT == null) ||
(QUAD_CLT.tp == null) ||
(QUAD_CLT.tp.clt_3d_passes == null) ||
(TWO_QUAD_CLT == null) ||
(TWO_QUAD_CLT.biCamDSI_persistent== null) ||
(TWO_QUAD_CLT.biCamDSI_persistent.biScans== null)) {
String msg = "Data is not available. Please run \"Ground truth\" first";
IJ.showMessage("Error",msg);
System.out.println(msg);
return false;
}
String configPath=getSaveCongigPath();
if (configPath.equals("ABORT")) return false;
if (DEBUG_LEVEL > -2){
System.out.println("++++++++++++++ Enhancing single-camera DSI by the dual-camera rig using planes ++++++++++++++");
}
TWO_QUAD_CLT.processPoles( // actually there is no sense to process multiple image sets. Combine with other processing?
// QUAD_CLT, // QuadCLT quadCLT_main,
// QUAD_CLT_AUX, // QuadCLT quadCLT_aux,
TWO_QUAD_CLT.biCamDSI_persistent, // BiCamDSI biCamDSI,
CLT_PARAMETERS, // EyesisCorrectionParameters.DCTParameters dct_parameters,
THREADS_MAX, //final int threadsMax, // maximal number of threads to launch
UPDATE_STATUS, //final boolean updateStatus,
DEBUG_LEVEL);
if (configPath!=null) {
saveTimestampedProperties( // save config again
configPath, // full path or null
null, // use as default directory if path==null
true,
PROPERTIES);
}
System.out.println("enhanceByRig(): Processing finished at "+
IJ.d2s(0.000000001*(System.nanoTime()-startTime),3)+" sec, --- Free memory="+
Runtime.getRuntime().freeMemory()+" (of "+Runtime.getRuntime().totalMemory()+")");
return true;
}
//resetGroundTruthByRig()
public boolean resetGroundTruth() {
if ((QUAD_CLT == null) || (QUAD_CLT.tp == null)) return false;
......
......@@ -7188,6 +7188,7 @@ public class ImageDtt {
* @param ml hwidth Optional to output data for ML: half width of the output tile (0 -> 1x1, 1-> 3x3, 2->5x5). Used only if center_corr != null
* @param ml_center_corr Optional to output data for ML: output array [(2*hwidth+1)*(2*hwidth+1)] or null
* @param tcorr_combo if not null then tcorr_combo will contain full 2d correlation for debugging (now 15x15 in line scan order)
* @param notch_mode - detect vertical poles, use a notch filter for Y, normal - for X
* @param tileX debug tile X
* @param tileY debug tile X
* @param debugLevel debug level
......@@ -7204,9 +7205,11 @@ public class ImageDtt {
final int ml_hwidth,
final double [] ml_center_corr,
final double [][] tcorr_combo,
final boolean notch_mode,
final int tileX, // only used in debug output
final int tileY,
final int debugLevel) {
int strip_hight = notch_mode? clt_parameters.img_dtt.corr_strip_notch : clt_parameters.img_dtt.corr_strip_hight;
double [] result = {Double.NaN, 0.0, Double.NaN, Double.NaN};
double [] inter_cam_corr = corr2d.correlateInterCamerasFD(
clt_data_tile_main, // double [][][][] clt_data_tile_main,
......@@ -7217,7 +7220,7 @@ public class ImageDtt {
double [] stripe_inter = corr2d. scaleRotateInterpoateSingleCorrelation(
inter_cam_corr, // double [] corr,
clt_parameters.img_dtt.corr_strip_hight, // int hwidth,
strip_hight, // int hwidth,
Correlation2d.PAIR_HORIZONTAL, // int dir, // 0 - hor, 1 - vert, 2 - parallel to row = col (main) diagonal (0->3), 3 -2->1
1, // int ss,
(debugLevel > 0)); // boolean debug
......@@ -7240,6 +7243,7 @@ public class ImageDtt {
// First get integer correlation center, relative to the center
// TODO: multiply/acummulate by Y window?
int [] ixy = corr2d.getMaxXYInt( // find integer pair or null if below threshold
stripe_inter, // double [] data,
true, // boolean axis_only, for strip it is always true
......@@ -7259,19 +7263,39 @@ public class ImageDtt {
if (Double.isNaN(strength)) {
System.out.println("BUG: 1. strength should not be NaN");
}
corr_stat = corr2d.getMaxXCm( // get fractional center as a "center of mass" inside circle/square from the integer max
stripe_inter, // double [] data, // [data_size * data_size]
ixy[0], // int ixcenter, // integer center x
// corr_wndy, // double [] window_y, // (half) window function in y-direction(perpendicular to disparity: for row0 ==1
// corr_wndx, // double [] window_x, // half of a window function in x (disparity) direction
(debugLevel > 0)); // boolean debug);
//getMaxXCmNotch if
if (notch_mode) {
corr_stat = corr2d.getMaxXCmNotch( // get fractional center as a "center of mass" inside circle/square from the integer max
stripe_inter, // double [] data, // [data_size * data_size]
ixy[0], // int ixcenter, // integer center x
// corr_wndy, // double [] window_y, // (half) window function in y-direction(perpendicular to disparity: for row0 ==1
// corr_wndx, // double [] window_x, // half of a window function in x (disparity) direction
(debugLevel > 0)); // boolean debug);
} else {
corr_stat = corr2d.getMaxXCm( // get fractional center as a "center of mass" inside circle/square from the integer max
stripe_inter, // double [] data, // [data_size * data_size]
ixy[0], // int ixcenter, // integer center x
// corr_wndy, // double [] window_y, // (half) window function in y-direction(perpendicular to disparity: for row0 ==1
// corr_wndx, // double [] window_x, // half of a window function in x (disparity) direction
(debugLevel > 0)); // boolean debug);
}
}
if (corr_stat != null) {
if (debugLevel > 0){
System.out.println(String.format("Tile X/Y = %d/%d corr_stat= {%f, %f, %f} ",tileX, tileY,corr_stat[0],corr_stat[1],corr_stat[2]));
System.out.println("notch_mode ="+notch_mode);
}
disparity = -corr_stat[0];
result[INDEX_DISP] = disparity;
double eff_radius = corr_stat[2] * clt_parameters.img_dtt.cm_max_normalization;
strength = corr_stat[1]/(eff_radius * eff_radius); // total mass by square effective radius
result[INDEX_STRENGTH] = strength;
// see if strength is enough to proceed with LMA/poly (otherwise keep disp/strength
if (strength > clt_parameters.img_dtt.min_poly_strength) {
if ((strength > clt_parameters.img_dtt.min_poly_strength) && !notch_mode) { // for now notch mode is only for CM
// create LMA instance, calculate LMA composite argmax
// Create 2 groups: ortho & diag
Correlations2dLMA lma = corr2d.corrLMA(
......@@ -7705,6 +7729,7 @@ public class ImageDtt {
public double [][][][][][][] clt_bi_quad(
final EyesisCorrectionParameters.CLTParameters clt_parameters,
final double fatzero, // May use correlation fat zero from 2 different parameters - fat_zero and rig.ml_fatzero
final boolean notch_mode, // use notch filter for inter-camera correlation to detect poles
final int [][] tile_op, // [tilesY][tilesX] - what to do - 0 - nothing for this tile
final double [][] disparity_array, // [tilesY][tilesX] - individual per-tile expected disparity
final double [][][] image_data_main, // first index - number of image in a quad
......@@ -7786,7 +7811,7 @@ public class ImageDtt {
}
}
if (globalDebugLevel > 0) {
if (globalDebugLevel > -2) {
System.out.println("clt_aberrations_quad_corr(): width="+width+" height="+height+" transform_size="+clt_parameters.transform_size+
" debug_tileX="+debug_tileX+" debug_tileY="+debug_tileY+" globalDebugLevel="+globalDebugLevel);
}
......@@ -8182,6 +8207,7 @@ public class ImageDtt {
ml_hwidth, // final int ml_hwidth,
ml_data_inter, // final double [] ml_center_corr,
tcorr_combo, // double [][] tcorr_combo,
notch_mode, // final boolean notch_mode,
tileX, // final int tileX, // only used in debug output
tileY, // final int tileY,
tile_lma_debug_level); // final int debugLevel)
......@@ -8262,6 +8288,7 @@ public class ImageDtt {
ml_hwidth, // final int ml_hwidth,
ml_data_dbg1, // final double [] ml_center_corr,
null, // double [][] tcorr_combo,
false, // final boolean notch_mode,
tileX, // final int tileX, // only used in debug output
tileY, // final int tileY,
tile_lma_debug_level); // final int debugLevel)
......@@ -8640,6 +8667,7 @@ public class ImageDtt {
0, // ml_hwidth, // final int ml_hwidth,
null, // ml_data_inter, // final double [] ml_center_corr,
null, // tcorr_combo, // double [][] tcorr_combo,
false, // final boolean notch_mode,
tileX, // final int tileX, // only used in debug output
tileY, // final int tileY,
tile_lma_debug_level); // final int debugLevel)
......
......@@ -74,6 +74,12 @@ public class ImageDttParameters {
public double cnvx_weight = 0.5; // relative weight of non-convex (border) cell
public boolean cnvx_add3x3 = true; // always select 3x3 cells around integer maximum
// pole window will be inverted
public int corr_strip_notch = 11; // number of rows to calculate for vertical poles
public double corr_notch_hwidth = 2.0; // 6.0; // 50% window cutoff height
public double corr_notch_blur = 2.0; // 5.0; // 100% to 0 % vertical transition range
// Used for common interpolated stripes
public int corr_wndy_size = 2; // 9; // number of rows to calculate CM disparity
public double corr_wndy_hwidth = 1.0; // 6.0; // 50% window cutoff height
......@@ -100,6 +106,8 @@ public class ImageDttParameters {
public int lma_num_iter = 20; //
public int lma_debug_level = 3; //
public boolean corr_var_cam = true; // New correlation mode compatible with 8 subcameras
public double cm_max_normalization = 0.55; // fraction of correlation maximum radius, being squared multiplied by maximum to have the same total mass
public void dialogQuestions(GenericJTabbedDialog gd) {
gd.addCheckbox ("Enable ImageDtt correlation debug layers", this.corr_mode_debug,
......@@ -178,10 +186,19 @@ public class ImageDttParameters {
"Create selection mask for quadratic approximation inside square around initial maximum position, specify distance from the center");
gd.addNumericField("Relative weight of non-convex (border) cell", this.cnvx_weight, 6,8,"",
"Weight of the bi-convex points is 1.0, this value specifies reduced weight of the border (non-bi-convex) points");
gd.addCheckbox ("Always select 3x3 cells around integer maximum", this.cnvx_add3x3,
gd.addCheckbox ("Always select 3x3 cells around integer maximum", this.cnvx_add3x3,
"Add 3x3 cells selection around the original argmax, regardless of bi-convex property");
gd.addMessage("Window for pole detection mode");
gd.addNumericField("Strip height for pole detection", this.corr_strip_notch, 0, 3, "half-pix",
"Number of rows to combine/interpolate correlation results. Rows are twice denser than pixels correponding to largest baseline disparity");
gd.addNumericField("50% correlation window cutoff height for poles (0 in the center)",this.corr_notch_hwidth, 3, 6, "half-pix",
"Correlation window height argument for 50% value");
gd.addNumericField("0% to 100 % transition range for poles", this.corr_notch_blur, 3,6,"half-pix",
"Transition range, shifted sine is used");
gd.addMessage("Window for niormal correlations");
gd.addNumericField("Number of rows to calculate CM disparity", this.corr_wndy_size, 0, 3, "",
"Number of rows to calculate maximum. Normally should be equal to the previous parameter");
......@@ -233,6 +250,9 @@ public class ImageDttParameters {
gd.addCheckbox ("Use new correlation methods compatible with x8 camera", this.corr_var_cam,
"Debug feature to compare old/new methods");
gd.addNumericField("Normalization for the CM correlation strength", this.cm_max_normalization, 6, 8, "",
"Fraction of correlation maximum radius, being squared multiplied by maximum to have the same total mass. ~= 0.5, the lower the value, the higher strength reported by the CM");
// public double cm_max_normalization = 0.55; //
}
public void dialogAnswers(GenericJTabbedDialog gd) {
......@@ -285,6 +305,10 @@ public class ImageDttParameters {
this.cnvx_weight = gd.getNextNumber();
this.cnvx_add3x3 = gd.getNextBoolean();
this.corr_strip_notch= (int) gd.getNextNumber();
this.corr_notch_hwidth= gd.getNextNumber();
this.corr_notch_blur= gd.getNextNumber();
this.corr_wndy_size= (int) gd.getNextNumber();
this.corr_wndy_hwidth = gd.getNextNumber();
......@@ -314,6 +338,7 @@ public class ImageDttParameters {
this.lma_num_iter= (int) gd.getNextNumber();
this.lma_debug_level= (int) gd.getNextNumber();
this.corr_var_cam = gd.getNextBoolean();
this.cm_max_normalization= gd.getNextNumber();
}
......@@ -366,6 +391,11 @@ public class ImageDttParameters {
properties.setProperty(prefix+"cnvx_weight", this.cnvx_weight +"");
properties.setProperty(prefix+"cnvx_add3x3", this.cnvx_add3x3 +"");
properties.setProperty(prefix+"corr_strip_notch", this.corr_strip_notch +"");
properties.setProperty(prefix+"corr_notch_hwidth", this.corr_notch_hwidth +"");
properties.setProperty(prefix+"corr_notch_blur", this.corr_notch_blur +"");
properties.setProperty(prefix+"corr_wndy_size", this.corr_wndy_size +"");
properties.setProperty(prefix+"corr_wndy_hwidth", this.corr_wndy_hwidth +"");
properties.setProperty(prefix+"corr_wndy_blur", this.corr_wndy_blur +"");
......@@ -395,6 +425,9 @@ public class ImageDttParameters {
properties.setProperty(prefix+"lma_num_iter", this.lma_num_iter +"");
properties.setProperty(prefix+"lma_debug_level", this.lma_debug_level +"");
properties.setProperty(prefix+"corr_var_cam", this.corr_var_cam +"");
properties.setProperty(prefix+"cm_max_normalization", this.cm_max_normalization +"");
}
public void getProperties(String prefix,Properties properties){
......@@ -447,6 +480,12 @@ public class ImageDttParameters {
if (properties.getProperty(prefix+"cnvx_weight")!=null) this.cnvx_weight=Double.parseDouble(properties.getProperty(prefix+"cnvx_weight"));
if (properties.getProperty(prefix+"cnvx_add3x3")!=null) this.cnvx_add3x3=Boolean.parseBoolean(properties.getProperty(prefix+"cnvx_add3x3"));
if (properties.getProperty(prefix+"corr_strip_notch")!=null) this.corr_strip_notch=Integer.parseInt(properties.getProperty(prefix+"corr_strip_notch"));
if (properties.getProperty(prefix+"corr_notch_hwidth")!=null) this.corr_notch_hwidth=Double.parseDouble(properties.getProperty(prefix+"corr_notch_hwidth"));
if (properties.getProperty(prefix+"corr_notch_blur")!=null) this.corr_notch_blur=Double.parseDouble(properties.getProperty(prefix+"corr_notch_blur"));
if (properties.getProperty(prefix+"corr_wndy_size")!=null) this.corr_wndy_size=Integer.parseInt(properties.getProperty(prefix+"corr_wndy_size"));
if (properties.getProperty(prefix+"corr_wndy_hwidth")!=null) this.corr_wndy_hwidth=Double.parseDouble(properties.getProperty(prefix+"corr_wndy_hwidth"));
......@@ -478,6 +517,7 @@ public class ImageDttParameters {
if (properties.getProperty(prefix+"lma_debug_level")!=null) this.lma_debug_level=Integer.parseInt(properties.getProperty(prefix+"lma_debug_level"));
if (properties.getProperty(prefix+"corr_var_cam")!=null) this.corr_var_cam=Boolean.parseBoolean(properties.getProperty(prefix+"corr_var_cam"));
if (properties.getProperty(prefix+"cm_max_normalization")!=null) this.cm_max_normalization=Double.parseDouble(properties.getProperty(prefix+"cm_max_normalization"));
}
@Override
......@@ -530,6 +570,10 @@ public class ImageDttParameters {
idp.cnvx_weight= this.cnvx_weight;
idp.cnvx_add3x3= this.cnvx_add3x3;
idp.corr_strip_notch= this.corr_strip_notch;
idp.corr_notch_hwidth= this.corr_notch_hwidth;
idp.corr_notch_blur= this.corr_notch_blur;
idp.corr_wndy_size= this.corr_wndy_size;
idp.corr_wndy_hwidth = this.corr_wndy_hwidth;
......@@ -559,6 +603,8 @@ public class ImageDttParameters {
idp.lma_debug_level = this.lma_debug_level;
idp.corr_var_cam = this.corr_var_cam;
idp.cm_max_normalization= this.cm_max_normalization;
return idp;
}
}
This diff is collapsed.
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment