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

Improving basic depth map generation

parent f801b9b5
...@@ -57,8 +57,9 @@ public class CLTPass3d{ ...@@ -57,8 +57,9 @@ public class CLTPass3d{
// exceeds minBgFract, otherwise proceed to the next one (and accumulate strength) // exceeds minBgFract, otherwise proceed to the next one (and accumulate strength)
private double [] bgTileDisparity = null; private double [] bgTileDisparity = null;
private double [] bgTileStrength = null; private double [] bgTileStrength = null;
private boolean [] border_tiles = null; // these are border tiles, zero out alpha private boolean [] border_tiles = null; // these are border tiles, zero out alpha
private boolean [] selected = null; // which tiles are selected for this layer private boolean [] selected = null; // which tiles are selected for this layer
boolean [] has_lma = null; // which tiles are measured with LMA (reliable strength)
public double [][][][] texture_tiles; public double [][][][] texture_tiles;
// texture_selection is only used for the GPU and if not null means it is for the GPU // texture_selection is only used for the GPU and if not null means it is for the GPU
public boolean [] texture_selection = null; // use by the GPU to set texture to generate public boolean [] texture_selection = null; // use by the GPU to set texture to generate
...@@ -69,7 +70,8 @@ public class CLTPass3d{ ...@@ -69,7 +70,8 @@ public class CLTPass3d{
public String texture = null; // relative (to x3d) path public String texture = null; // relative (to x3d) path
public Rectangle texture_bounds; // in tiles, not pixels ! public Rectangle texture_bounds; // in tiles, not pixels !
public int dbg_index; public int dbg_index;
public int disparity_index = ImageDtt.DISPARITY_INDEX_CM; // may also be ImageDtt.DISPARITY_INDEX_POLY public int disparity_index = ImageDtt.DISPARITY_INDEX_CM; // may also be ImageDtt.DISPARITY_INDEX_POLY
public int lma_disparity_index = ImageDtt.DISPARITY_INDEX_POLY; // set to -1 to ignore and always use just CM (also applies to lma_strength - next)
public double [][] tiles_RBGA = null; public double [][] tiles_RBGA = null;
SuperTiles superTiles = null; SuperTiles superTiles = null;
...@@ -361,7 +363,16 @@ public class CLTPass3d{ ...@@ -361,7 +363,16 @@ public class CLTPass3d{
public void setBorderTiles (boolean [] border_tiles) { public void setBorderTiles (boolean [] border_tiles) {
this.border_tiles = border_tiles; this.border_tiles = border_tiles;
} }
public boolean [] getLMA() {
if (has_lma == null) {
has_lma = hasLMADefined();
}
return has_lma;
}
public void setLMA(boolean [] has_lma) {// use for combo tiles
this.has_lma = has_lma;
}
public void fixNaNDisparity() public void fixNaNDisparity()
{ {
...@@ -599,24 +610,31 @@ public class CLTPass3d{ ...@@ -599,24 +610,31 @@ public class CLTPass3d{
// methods to "condition" measured disparity values // methods to "condition" measured disparity values
public void conditionDisparity() public void conditionDisparity()
{ {
/*
conditionDisparity(disparity_index); conditionDisparity(disparity_index);
} }
public void conditionDisparity(int disparity_index) public void conditionDisparity(int disparity_index) // only called from above
{ {
*/
int tilesX = tileProcessor.getTilesX(); int tilesX = tileProcessor.getTilesX();
int tilesY = tileProcessor.getTilesY(); int tilesY = tileProcessor.getTilesY();
double corr_magic_scale = tileProcessor.getMagicScale(); double corr_magic_scale = tileProcessor.getMagicScale();
double corr_magic_scale_LMA = 1.0;
// int lma_disparity_index = ImageDtt.DISPARITY_INDEX_POLY;
this.disparity_index = disparity_index; // this.disparity_index = disparity_index;
calc_disparity = new double[tilesY*tilesX]; calc_disparity = new double[tilesY*tilesX];
calc_disparity_hor = new double[tilesY*tilesX]; calc_disparity_hor = new double[tilesY*tilesX];
calc_disparity_vert = new double[tilesY*tilesX]; calc_disparity_vert = new double[tilesY*tilesX];
double [] lma_disparity = (lma_disparity_index >= 0) ? disparity_map[lma_disparity_index] : null;
for (int i = 0; i < tilesY; i++){ for (int i = 0; i < tilesY; i++){
for (int j = 0; j < tilesX; j++){ for (int j = 0; j < tilesX; j++){
int indx = i * tilesX + j; int indx = i * tilesX + j;
calc_disparity[indx] = disparity_map[disparity_index][indx]/corr_magic_scale + this.disparity[i][j]; if ((lma_disparity != null) && !Double.isNaN(lma_disparity[indx])) {
calc_disparity[indx] = lma_disparity[indx]/corr_magic_scale_LMA + this.disparity[i][j];
} else {
calc_disparity[indx] = disparity_map[disparity_index][indx]/corr_magic_scale + this.disparity[i][j];
}
calc_disparity_hor[indx] = disparity_map[ImageDtt.DISPARITY_INDEX_HOR][indx]/corr_magic_scale + this.disparity[i][j]; calc_disparity_hor[indx] = disparity_map[ImageDtt.DISPARITY_INDEX_HOR][indx]/corr_magic_scale + this.disparity[i][j];
calc_disparity_vert[indx] = disparity_map[ImageDtt.DISPARITY_INDEX_VERT][indx]/corr_magic_scale + this.disparity[i][j]; calc_disparity_vert[indx] = disparity_map[ImageDtt.DISPARITY_INDEX_VERT][indx]/corr_magic_scale + this.disparity[i][j];
} }
...@@ -624,6 +642,28 @@ public class CLTPass3d{ ...@@ -624,6 +642,28 @@ public class CLTPass3d{
calc_disparity_combo = calc_disparity.clone(); // for now - just clone, can be modified separately and combined with hor/vert calc_disparity_combo = calc_disparity.clone(); // for now - just clone, can be modified separately and combined with hor/vert
} }
public boolean [] hasLMADefined(){ // will try not to create this.has_lma
if (disparity_map == null) {
if (has_lma==null) {
return null;
} else {
return has_lma;
}
}
int tilesX = tileProcessor.getTilesX();
int tilesY = tileProcessor.getTilesY();
double [] lma_disparity = (lma_disparity_index >= 0) ? disparity_map[lma_disparity_index] : null;
boolean [] lma_defined = new boolean[tilesX * tilesY];
if (lma_disparity != null) {
for (int i = 0; i < lma_disparity.length; i++) {
lma_defined[i] = !Double.isNaN(lma_disparity[i]);
}
}
return lma_defined;
}
// bypassing calculations // bypassing calculations
public void setCalcDisparityStrength( public void setCalcDisparityStrength(
double [] disparity, double [] disparity,
...@@ -644,7 +684,7 @@ public class CLTPass3d{ ...@@ -644,7 +684,7 @@ public class CLTPass3d{
* *
* Replace weak by a weighted average of non-weak. If there are none - use weak ones, including this one too. * Replace weak by a weighted average of non-weak. If there are none - use weak ones, including this one too.
*/ */
public boolean[] replaceWeakOutliers( public boolean[] replaceWeakOutliers( // does not replace tiles with LMA available, busts LMA-defined strengths when averaging
final boolean [] selection, final boolean [] selection,
final double weakStrength, // strength to be considered weak, subject to this replacement final double weakStrength, // strength to be considered weak, subject to this replacement
final double maxDiff, final double maxDiff,
...@@ -654,6 +694,7 @@ public class CLTPass3d{ ...@@ -654,6 +694,7 @@ public class CLTPass3d{
final double disparityNear, final double disparityNear,
final int debugLevel) final int debugLevel)
{ {
final double scale_strength_lma = 5.0; // increase LMA-defined strength during averaging
final int tilesX = tileProcessor.getTilesX(); final int tilesX = tileProcessor.getTilesX();
final int tilesY = tileProcessor.getTilesY(); final int tilesY = tileProcessor.getTilesY();
...@@ -663,6 +704,8 @@ public class CLTPass3d{ ...@@ -663,6 +704,8 @@ public class CLTPass3d{
final int [] dirs = dirs8; final int [] dirs = dirs8;
final double [] disparity = getDisparity(0); final double [] disparity = getDisparity(0);
final double [] strength = getStrength(); final double [] strength = getStrength();
final boolean [] has_lma = getLMA();
final double absMinDisparity = 0.5 * disparityFar; // adjust? below this is definitely wrong (weak) final double absMinDisparity = 0.5 * disparityFar; // adjust? below this is definitely wrong (weak)
final double absMaxDisparity = 1.5 * disparityNear; // change? final double absMaxDisparity = 1.5 * disparityNear; // change?
final int dbg_nTile = (debugLevel > 0) ? 43493: -1; // x=77,y=134; // 42228; // x = 108, y = 130 46462; // 41545; final int dbg_nTile = (debugLevel > 0) ? 43493: -1; // x=77,y=134; // 42228; // x = 108, y = 130 46462; // 41545;
...@@ -674,7 +717,7 @@ public class CLTPass3d{ ...@@ -674,7 +717,7 @@ public class CLTPass3d{
@Override @Override
public void run() { public void run() {
for (int nTile = ai.getAndIncrement(); nTile < nTiles; nTile = ai.getAndIncrement()) { for (int nTile = ai.getAndIncrement(); nTile < nTiles; nTile = ai.getAndIncrement()) {
if (((strength[nTile] < weakStrength) || if (((!has_lma[nTile] && (strength[nTile] < weakStrength)) ||
(disparity[nTile] < absMinDisparity) || (disparity[nTile] < absMinDisparity) ||
(disparity[nTile] > absMaxDisparity))&& ((selection == null) || selection[nTile])) { (disparity[nTile] > absMaxDisparity))&& ((selection == null) || selection[nTile])) {
if (nTile == dbg_nTile){ if (nTile == dbg_nTile){
...@@ -698,6 +741,9 @@ public class CLTPass3d{ ...@@ -698,6 +741,9 @@ public class CLTPass3d{
(disparity[nTile1] >= disparityFar) && // don't count on too near/too far for averaging (disparity[nTile1] >= disparityFar) && // don't count on too near/too far for averaging
(disparity[nTile1] <= disparityNear)){ (disparity[nTile1] <= disparityNear)){
double w = strength[nTile1]; double w = strength[nTile1];
if (has_lma[nTile1]) {
w *= scale_strength_lma;
}
sw += w; sw += w;
sd += w * disparity[nTile1]; sd += w * disparity[nTile1];
hasNeighbors = true; hasNeighbors = true;
...@@ -742,12 +788,18 @@ public class CLTPass3d{ ...@@ -742,12 +788,18 @@ public class CLTPass3d{
int nTile1 = nTile + dirs[dir]; int nTile1 = nTile + dirs[dir];
if (!weakOutliers[nTile1] && ((selection == null) || selection[nTile1 ]) ) { if (!weakOutliers[nTile1] && ((selection == null) || selection[nTile1 ]) ) {
double w = strength[nTile1]; double w = strength[nTile1];
if (has_lma[nTile1]) {
w *= scale_strength_lma;
}
sw += w; sw += w;
sd += w * src_disparity[nTile1]; sd += w * src_disparity[nTile1];
} }
} }
if (sw == 0) { // Nothing strong around - repeat with weak and this one too. if (sw == 0) { // Nothing strong around - repeat with weak and this one too.
double w = strength[nTile]; double w = strength[nTile];
if (has_lma[nTile]) {
w *= scale_strength_lma;
}
if (!Double.isNaN( src_disparity[nTile])) { if (!Double.isNaN( src_disparity[nTile])) {
sw += w; sw += w;
sd += w * src_disparity[nTile]; sd += w * src_disparity[nTile];
...@@ -756,6 +808,9 @@ public class CLTPass3d{ ...@@ -756,6 +808,9 @@ public class CLTPass3d{
int nTile1 = nTile + dirs[dir]; int nTile1 = nTile + dirs[dir];
if ((selection == null) || selection[nTile1 ]) { if ((selection == null) || selection[nTile1 ]) {
w = strength[nTile1]; w = strength[nTile1];
if (has_lma[nTile1]) {
w *= scale_strength_lma;
}
if (!Double.isNaN( src_disparity[nTile1])) { if (!Double.isNaN( src_disparity[nTile1])) {
sw += w; sw += w;
sd += w * src_disparity[nTile1]; sd += w * src_disparity[nTile1];
......
...@@ -79,7 +79,7 @@ public class Corr2dLMA { ...@@ -79,7 +79,7 @@ public class Corr2dLMA {
/// final static int NUM_CAMS = 4; // not all have to be used, so it is maximal number of cameras /// final static int NUM_CAMS = 4; // not all have to be used, so it is maximal number of cameras
/// final static int NUM_PAIRS = NUM_CAMS* (NUM_CAMS -1)/2; // number of possible pairs /// final static int NUM_PAIRS = NUM_CAMS* (NUM_CAMS -1)/2; // number of possible pairs
final static int NTILE0 = 0; final static int NTILE0 = 0;
final static int DISP_INDEX = 0; // common/average disparity final static int DISP_INDEX = 0; // common/average disparity (negative!)
final static int A_INDEX = 1; // A*(x-x0)^2 final static int A_INDEX = 1; // A*(x-x0)^2
final static int B_INDEX = 2; // 2*B*(x-x0)*(y-y0) final static int B_INDEX = 2; // 2*B*(x-x0)*(y-y0)
final static int CMA_INDEX = 3; // C*(y-y0)^2, encode C-A final static int CMA_INDEX = 3; // C*(y-y0)^2, encode C-A
...@@ -2116,6 +2116,7 @@ public class Corr2dLMA { ...@@ -2116,6 +2116,7 @@ public class Corr2dLMA {
public double [][] lmaDisparityStrength( public double [][] lmaDisparityStrength(
double lmas_min_amp, // minimal ratio of minimal pair correlation amplitude to maximal pair correlation amplitude
double lma_max_rel_rms, // maximal relative (to average max/min amplitude LMA RMS) // May be up to 0.3) double lma_max_rel_rms, // maximal relative (to average max/min amplitude LMA RMS) // May be up to 0.3)
double lma_min_strength, // minimal composite strength (sqrt(average amp squared over absolute RMS) double lma_min_strength, // minimal composite strength (sqrt(average amp squared over absolute RMS)
double lma_min_max_ac, // minimal of A and C coefficients maximum (measures sharpest point/line) double lma_min_max_ac, // minimal of A and C coefficients maximum (measures sharpest point/line)
...@@ -2136,6 +2137,9 @@ public class Corr2dLMA { ...@@ -2136,6 +2137,9 @@ public class Corr2dLMA {
if (maxmin_amp[tile][1] < 0.0) { if (maxmin_amp[tile][1] < 0.0) {
continue; // inverse maximum - discard tile continue; // inverse maximum - discard tile
} }
if ((maxmin_amp[tile][1]/maxmin_amp[tile][0]) < lmas_min_amp) {
continue; // inverse maximum - discard tile
}
double avg = 0.50*(maxmin_amp[tile][0]+maxmin_amp[tile][1]); // max_min[1] can be negative - filter it out? double avg = 0.50*(maxmin_amp[tile][0]+maxmin_amp[tile][1]); // max_min[1] can be negative - filter it out?
double rrms = rms[tile]/avg; double rrms = rms[tile]/avg;
if (((lma_max_rel_rms > 0.0) && (rrms > lma_max_rel_rms)) || if (((lma_max_rel_rms > 0.0) && (rrms > lma_max_rel_rms)) ||
......
...@@ -3422,6 +3422,7 @@ public class Correlation2d { ...@@ -3422,6 +3422,7 @@ public class Correlation2d {
// double [][] ds = lma.getDisparityStrength(); // double [][] ds = lma.getDisparityStrength();
ds = lma.lmaDisparityStrength( ds = lma.lmaDisparityStrength(
imgdtt_params.lmas_min_amp, // minimal ratio of minimal pair correlation amplitude to maximal pair correlation amplitude
imgdtt_params.lma_max_rel_rms, // maximal relative (to average max/min amplitude LMA RMS) // May be up to 0.3) imgdtt_params.lma_max_rel_rms, // maximal relative (to average max/min amplitude LMA RMS) // May be up to 0.3)
imgdtt_params.lma_min_strength, // minimal composite strength (sqrt(average amp squared over absolute RMS) imgdtt_params.lma_min_strength, // minimal composite strength (sqrt(average amp squared over absolute RMS)
imgdtt_params.lma_min_ac, // minimal of A and C coefficients maximum (measures sharpest point/line) imgdtt_params.lma_min_ac, // minimal of A and C coefficients maximum (measures sharpest point/line)
...@@ -3521,6 +3522,7 @@ public class Correlation2d { ...@@ -3521,6 +3522,7 @@ public class Correlation2d {
} }
// double [][] ds = lma.getDisparityStrength(); // double [][] ds = lma.getDisparityStrength();
ds = lma.lmaDisparityStrength( ds = lma.lmaDisparityStrength(
imgdtt_params.lmas_min_amp, // minimal ratio of minimal pair correlation amplitude to maximal pair correlation amplitude
imgdtt_params.lma_max_rel_rms, // maximal relative (to average max/min amplitude LMA RMS) // May be up to 0.3) imgdtt_params.lma_max_rel_rms, // maximal relative (to average max/min amplitude LMA RMS) // May be up to 0.3)
imgdtt_params.lma_min_strength, // minimal composite strength (sqrt(average amp squared over absolute RMS) imgdtt_params.lma_min_strength, // minimal composite strength (sqrt(average amp squared over absolute RMS)
imgdtt_params.lma_min_ac, // minimal of A and C coefficients maximum (measures sharpest point/line) imgdtt_params.lma_min_ac, // minimal of A and C coefficients maximum (measures sharpest point/line)
...@@ -3858,6 +3860,7 @@ public class Correlation2d { ...@@ -3858,6 +3860,7 @@ public class Correlation2d {
double [][] dispStr = lma.lmaDisparityStrength( //TODO: add parameter to filter out negative minimums ? double [][] dispStr = lma.lmaDisparityStrength( //TODO: add parameter to filter out negative minimums ?
imgdtt_params.lmas_min_amp, // minimal ratio of minimal pair correlation amplitude to maximal pair correlation amplitude
imgdtt_params.lmas_max_rel_rms, // maximal relative (to average max/min amplitude LMA RMS) // May be up to 0.3) imgdtt_params.lmas_max_rel_rms, // maximal relative (to average max/min amplitude LMA RMS) // May be up to 0.3)
imgdtt_params.lmas_min_strength, // minimal composite strength (sqrt(average amp squared over absolute RMS) imgdtt_params.lmas_min_strength, // minimal composite strength (sqrt(average amp squared over absolute RMS)
imgdtt_params.lmas_min_ac, // minimal of A and C coefficients maximum (measures sharpest point/line) imgdtt_params.lmas_min_ac, // minimal of A and C coefficients maximum (measures sharpest point/line)
......
...@@ -268,6 +268,7 @@ public class DisparityProcessor { ...@@ -268,6 +268,7 @@ public class DisparityProcessor {
final double [] disparity, // current disparity value final double [] disparity, // current disparity value
final double [] measured_disparity, // measured disparity final double [] measured_disparity, // measured disparity
final double [] strength, final double [] strength,
final boolean [] has_lma,
final double [] hor_disparity, // not yet used final double [] hor_disparity, // not yet used
final double [] hor_strength, // not yet used final double [] hor_strength, // not yet used
final boolean [] selected, final boolean [] selected,
...@@ -276,6 +277,7 @@ public class DisparityProcessor { ...@@ -276,6 +277,7 @@ public class DisparityProcessor {
final int threadsMax, // maximal number of threads to launch final int threadsMax, // maximal number of threads to launch
final int debugLevel) final int debugLevel)
{ {
final double scale_strength_lma = 5.0; // increase LMA-defined strength during averaging
final int dbg_tile = -1; // 28643; // x=131, y=88 final int dbg_tile = -1; // 28643; // x=131, y=88
ShowDoubleFloatArrays sdfa_instance = null; ShowDoubleFloatArrays sdfa_instance = null;
if (debugLevel > 0) sdfa_instance = new ShowDoubleFloatArrays(); // just for debugging? if (debugLevel > 0) sdfa_instance = new ShowDoubleFloatArrays(); // just for debugging?
...@@ -382,7 +384,12 @@ public class DisparityProcessor { ...@@ -382,7 +384,12 @@ public class DisparityProcessor {
// } // }
// calculate pull by the measured disparity // calculate pull by the measured disparity
double disparity_diff = (measured_disparity[nTile] - disp_data[0][nTile]); double disparity_diff = (measured_disparity[nTile] - disp_data[0][nTile]);
double eff_strength = ((border != null) && border[nTile])? 0.0: (strength[nTile] - clt_parameters.tiStrengthOffset); double str = strength[nTile];
if (has_lma[nTile]) {
str *= scale_strength_lma;
}
// double eff_strength = ((border != null) && border[nTile])? 0.0: (strength[nTile] - clt_parameters.tiStrengthOffset);
double eff_strength = ((border != null) && border[nTile])? 0.0: (str - clt_parameters.tiStrengthOffset);
if (eff_strength < 0) eff_strength = 0; if (eff_strength < 0) eff_strength = 0;
double disparity_pull = eff_strength; double disparity_pull = eff_strength;
// if (tileY == 89){ // if (tileY == 89){
......
...@@ -3291,6 +3291,7 @@ public class ImageDtt extends ImageDttCPU { ...@@ -3291,6 +3291,7 @@ public class ImageDtt extends ImageDttCPU {
if (dbg_img != null) dbg_img[1][nclust] = 1.0; if (dbg_img != null) dbg_img[1][nclust] = 1.0;
// was for single tile // was for single tile
disp_str = lma2.lmaDisparityStrength( disp_str = lma2.lmaDisparityStrength(
imgdtt_params.lmas_min_amp, // minimal ratio of minimal pair correlation amplitude to maximal pair correlation amplitude
imgdtt_params.lmas_max_rel_rms, // maximal relative (to average max/min amplitude LMA RMS) // May be up to 0.3) imgdtt_params.lmas_max_rel_rms, // maximal relative (to average max/min amplitude LMA RMS) // May be up to 0.3)
imgdtt_params.lmas_min_strength, // minimal composite strength (sqrt(average amp squared over absolute RMS) imgdtt_params.lmas_min_strength, // minimal composite strength (sqrt(average amp squared over absolute RMS)
imgdtt_params.lmas_min_ac, // minimal of A and C coefficients maximum (measures sharpest point/line) imgdtt_params.lmas_min_ac, // minimal of A and C coefficients maximum (measures sharpest point/line)
...@@ -3583,31 +3584,10 @@ public class ImageDtt extends ImageDttCPU { ...@@ -3583,31 +3584,10 @@ public class ImageDtt extends ImageDttCPU {
tileX, // int tileX, // just for debug output tileX, // int tileX, // just for debug output
tileY); // int tileY tileY); // int tileY
/*
double [][] poly_disp2 = {{Double.NaN, 0.0}};
double [][][] corrs2 = {corrs};
double [][][] tile_disp_dist2 = {tile_disp_dist};
// TODO: maybe use corrLMA2Single again, but take care of initVector!
Corr2dLMA lma2 = corr2d.corrLMA2Multi( // multitile num_tiles_super == 1
imgdtt_params, // ImageDttParameters imgdtt_params,
1, // int clust_width,
corr_wnd, // double [][] corr_wnd, // correlation window to save on re-calculation of the window
corr_wnd_inv_limited, // corr_wnd_limited, // correlation window, limited not to be smaller than threshold - used for finding max/convex areas (or null)
corrs2, // corrs, // double [][] corrs,
tile_disp_dist2,
rXY, // double [][] rXY, // non-distorted X,Y offset per nominal pixel of disparity
imgdtt_params.dbg_pair_mask, // int pair_mask, // which pairs to process
// null, // disp_str[cTile], //corr_stat[0], // double xcenter, // preliminary center x in pixels for largest baseline
poly_disp2, // double[] poly_ds, // null or pair of disparity/strength
imgdtt_params.ortho_vasw_pwr, // double vasw_pwr, // value as weight to this power,
tdl, // tile_lma_debug_level, //+2, // int debug_level,
tileX, // int tileX, // just for debug output
tileY); // int tileY
*/
if (lma2 != null) { if (lma2 != null) {
// was for single tile // was for single tile
disp_str = lma2.lmaDisparityStrength( disp_str = lma2.lmaDisparityStrength(
imgdtt_params.lmas_min_amp, // minimal ratio of minimal pair correlation amplitude to maximal pair correlation amplitude
imgdtt_params.lmas_max_rel_rms, // maximal relative (to average max/min amplitude LMA RMS) // May be up to 0.3) imgdtt_params.lmas_max_rel_rms, // maximal relative (to average max/min amplitude LMA RMS) // May be up to 0.3)
imgdtt_params.lmas_min_strength, // minimal composite strength (sqrt(average amp squared over absolute RMS) imgdtt_params.lmas_min_strength, // minimal composite strength (sqrt(average amp squared over absolute RMS)
imgdtt_params.lmas_min_ac, // minimal of A and C coefficients maximum (measures sharpest point/line) imgdtt_params.lmas_min_ac, // minimal of A and C coefficients maximum (measures sharpest point/line)
......
...@@ -164,11 +164,14 @@ public class ImageDttParameters { ...@@ -164,11 +164,14 @@ public class ImageDttParameters {
public double lmas_rms_diff = 0.0003; // public double lmas_rms_diff = 0.0003; //
public int lmas_num_iter = 20; ///10 public int lmas_num_iter = 20; ///10
// Filtering and strength calculation // Filtering and strength calculation
public double lmas_max_rel_rms = 0.3; // maximal relative (to average max/min amplitude LMA RMS) // May be up to 0.3) // High ratio of amplitudes may be caused by "neighbors" correlations when the same object disappears from the tile
public double lmas_min_strength = 0.7; // minimal composite strength (sqrt(average amp squared over absolute RMS) // for small disparities 0.5...0.7 is OK, for larger, and small objects on uniform background, may need 0.2
public double lmas_min_ac = 0.02; // minimal of a and C coefficients maximum (measures sharpest point/line) public double lmas_min_amp = 0.25; // minimal ratio of minimal pair correlation amplitude to maximal pair correlation amplitude
public double lmas_min_min_ac = 0.007; // minimal of a and C coefficients minimum (measures sharpest point) public double lmas_max_rel_rms = 0.3; // LWIR16: 0.5 maximal relative (to average max/min amplitude LMA RMS) // May be up to 0.3)
public double lmas_max_area = 0.0; // maximal half-area (if > 0.0) public double lmas_min_strength = 0.7; // LWIR16: 0.4 minimal composite strength (sqrt(average amp squared over absolute RMS)
public double lmas_min_ac = 0.02; // LWIR16: 0.01 minimal of a and C coefficients maximum (measures sharpest point/line)
public double lmas_min_min_ac = 0.007; // LWIR16: 0.007 minimal of a and C coefficients minimum (measures sharpest point)
public double lmas_max_area = 0.0; // LWIR16: 0.0 maximal half-area (if > 0.0)
// public boolean lma_gaussian = false; // model correlation maximum as a Gaussian (false - as a parabola) // public boolean lma_gaussian = false; // model correlation maximum as a Gaussian (false - as a parabola)
public int lma_gaussian = 0; // 0 - parabola, 1 - Gaussian, 2 - limited parabola, 3 - limited squared parabola public int lma_gaussian = 0; // 0 - parabola, 1 - Gaussian, 2 - limited parabola, 3 - limited squared parabola
...@@ -214,8 +217,8 @@ public class ImageDttParameters { ...@@ -214,8 +217,8 @@ public class ImageDttParameters {
public double lma_min_min_ac = 0.015; // minimal of a and C coefficients minimum (measures sharpest point) public double lma_min_min_ac = 0.015; // minimal of a and C coefficients minimum (measures sharpest point)
public double lma_max_area = 30.0; //45.0; // maximal half-area (if > 0.0) public double lma_max_area = 30.0; //45.0; // maximal half-area (if > 0.0)
public double lma_str_scale = 0.2; // convert lma-generated strength to match previous ones - scale public double lma_str_scale = 0.2; // LWIR16: 0.2 convert lma-generated strength to match previous ones - scale
public double lma_str_offset = 0.05; // convert lma-generated strength to match previous ones - add to result public double lma_str_offset = 0.05; // LWIR16: 0.05 convert lma-generated strength to match previous ones - add to result
// Lazy eye results interpretation // Lazy eye results interpretation
...@@ -546,6 +549,8 @@ public class ImageDttParameters { ...@@ -546,6 +549,8 @@ public class ImageDttParameters {
gd.addNumericField("LMA maximal iterations", this.lmas_num_iter, 0, 3, "", gd.addNumericField("LMA maximal iterations", this.lmas_num_iter, 0, 3, "",
"Limit LMA cycles, so it will exit after certain number of small improvements"); "Limit LMA cycles, so it will exit after certain number of small improvements");
gd.addMessage("LMA (single) results filtering"); gd.addMessage("LMA (single) results filtering");
gd.addNumericField("Minimal weakest pair to strongest pair correlation amplitude ratio",this.lmas_min_amp, 6, 8, "",
"Discard tile if ratio of the weakest correlation pair amplitude to that of the strongest one is lower than this");
gd.addNumericField("Maximal relative RMS ", this.lmas_max_rel_rms, 6, 8, "", gd.addNumericField("Maximal relative RMS ", this.lmas_max_rel_rms, 6, 8, "",
"Discard tile if ratio of RMS to average of min and max amplitude exceeds this value"); "Discard tile if ratio of RMS to average of min and max amplitude exceeds this value");
gd.addNumericField("Minimal composite strength", this.lmas_min_strength, 6, 8, "", gd.addNumericField("Minimal composite strength", this.lmas_min_strength, 6, 8, "",
...@@ -816,6 +821,7 @@ public class ImageDttParameters { ...@@ -816,6 +821,7 @@ public class ImageDttParameters {
this.lmas_lambda_initial = gd.getNextNumber(); this.lmas_lambda_initial = gd.getNextNumber();
this.lmas_rms_diff = gd.getNextNumber(); this.lmas_rms_diff = gd.getNextNumber();
this.lmas_num_iter= (int) gd.getNextNumber(); this.lmas_num_iter= (int) gd.getNextNumber();
this.lmas_min_amp = gd.getNextNumber();
this.lmas_max_rel_rms = gd.getNextNumber(); this.lmas_max_rel_rms = gd.getNextNumber();
this.lmas_min_strength = gd.getNextNumber(); this.lmas_min_strength = gd.getNextNumber();
this.lmas_min_ac = gd.getNextNumber(); this.lmas_min_ac = gd.getNextNumber();
...@@ -1007,6 +1013,7 @@ public class ImageDttParameters { ...@@ -1007,6 +1013,7 @@ public class ImageDttParameters {
properties.setProperty(prefix+"lmas_lambda_initial", this.lmas_lambda_initial +""); properties.setProperty(prefix+"lmas_lambda_initial", this.lmas_lambda_initial +"");
properties.setProperty(prefix+"lmas_rms_diff", this.lmas_rms_diff +""); properties.setProperty(prefix+"lmas_rms_diff", this.lmas_rms_diff +"");
properties.setProperty(prefix+"lmas_num_iter", this.lmas_num_iter +""); properties.setProperty(prefix+"lmas_num_iter", this.lmas_num_iter +"");
properties.setProperty(prefix+"lmas_min_amp", this.lmas_min_amp +"");
properties.setProperty(prefix+"lmas_max_rel_rms", this.lmas_max_rel_rms +""); properties.setProperty(prefix+"lmas_max_rel_rms", this.lmas_max_rel_rms +"");
properties.setProperty(prefix+"lmas_min_strength", this.lmas_min_strength +""); properties.setProperty(prefix+"lmas_min_strength", this.lmas_min_strength +"");
properties.setProperty(prefix+"lmas_min_ac", this.lmas_min_ac +""); properties.setProperty(prefix+"lmas_min_ac", this.lmas_min_ac +"");
...@@ -1209,6 +1216,7 @@ public class ImageDttParameters { ...@@ -1209,6 +1216,7 @@ public class ImageDttParameters {
if (properties.getProperty(prefix+"lmas_lambda_initial")!=null) this.lmas_lambda_initial=Double.parseDouble(properties.getProperty(prefix+"lmas_lambda_initial")); if (properties.getProperty(prefix+"lmas_lambda_initial")!=null) this.lmas_lambda_initial=Double.parseDouble(properties.getProperty(prefix+"lmas_lambda_initial"));
if (properties.getProperty(prefix+"lmas_rms_diff")!=null) this.lmas_rms_diff=Double.parseDouble(properties.getProperty(prefix+"lmas_rms_diff")); if (properties.getProperty(prefix+"lmas_rms_diff")!=null) this.lmas_rms_diff=Double.parseDouble(properties.getProperty(prefix+"lmas_rms_diff"));
if (properties.getProperty(prefix+"lmas_num_iter")!=null) this.lmas_num_iter=Integer.parseInt(properties.getProperty(prefix+"lmas_num_iter")); if (properties.getProperty(prefix+"lmas_num_iter")!=null) this.lmas_num_iter=Integer.parseInt(properties.getProperty(prefix+"lmas_num_iter"));
if (properties.getProperty(prefix+"lmas_min_amp")!=null) this.lmas_min_amp=Double.parseDouble(properties.getProperty(prefix+"lmas_min_amp"));
if (properties.getProperty(prefix+"lmas_max_rel_rms")!=null) this.lmas_max_rel_rms=Double.parseDouble(properties.getProperty(prefix+"lmas_max_rel_rms")); if (properties.getProperty(prefix+"lmas_max_rel_rms")!=null) this.lmas_max_rel_rms=Double.parseDouble(properties.getProperty(prefix+"lmas_max_rel_rms"));
if (properties.getProperty(prefix+"lmas_min_strength")!=null) this.lmas_min_strength=Double.parseDouble(properties.getProperty(prefix+"lmas_min_strength")); if (properties.getProperty(prefix+"lmas_min_strength")!=null) this.lmas_min_strength=Double.parseDouble(properties.getProperty(prefix+"lmas_min_strength"));
if (properties.getProperty(prefix+"lmas_min_ac")!=null) this.lmas_min_ac=Double.parseDouble(properties.getProperty(prefix+"lmas_min_ac")); if (properties.getProperty(prefix+"lmas_min_ac")!=null) this.lmas_min_ac=Double.parseDouble(properties.getProperty(prefix+"lmas_min_ac"));
...@@ -1416,6 +1424,7 @@ public class ImageDttParameters { ...@@ -1416,6 +1424,7 @@ public class ImageDttParameters {
idp.lmas_lambda_initial = this.lmas_lambda_initial; idp.lmas_lambda_initial = this.lmas_lambda_initial;
idp.lmas_rms_diff = this.lmas_rms_diff; idp.lmas_rms_diff = this.lmas_rms_diff;
idp.lmas_num_iter = this.lmas_num_iter; idp.lmas_num_iter = this.lmas_num_iter;
idp.lmas_min_amp= this.lmas_min_amp;
idp.lmas_max_rel_rms= this.lmas_max_rel_rms; idp.lmas_max_rel_rms= this.lmas_max_rel_rms;
idp.lmas_min_strength= this.lmas_min_strength; idp.lmas_min_strength= this.lmas_min_strength;
idp.lmas_min_ac= this.lmas_min_ac; idp.lmas_min_ac= this.lmas_min_ac;
......
...@@ -3158,7 +3158,7 @@ public class QuadCLT extends QuadCLTCPU { ...@@ -3158,7 +3158,7 @@ public class QuadCLT extends QuadCLTCPU {
ColorProcParameters colorProcParameters, ColorProcParameters colorProcParameters,
EyesisCorrectionParameters.RGBParameters rgbParameters, EyesisCorrectionParameters.RGBParameters rgbParameters,
String name, String name,
int disparity_index, // index of disparity value in disparity_map == 2 (0,2 or 4) // int disparity_index, // index of disparity value in disparity_map == 2 (0,2 or 4)
int threadsMax, // maximal number of threads to launch int threadsMax, // maximal number of threads to launch
boolean updateStatus, boolean updateStatus,
int debugLevel int debugLevel
...@@ -3170,7 +3170,7 @@ public class QuadCLT extends QuadCLTCPU { ...@@ -3170,7 +3170,7 @@ public class QuadCLT extends QuadCLTCPU {
colorProcParameters, colorProcParameters,
rgbParameters, rgbParameters,
name, name,
disparity_index, // index of disparity value in disparity_map == 2 (0,2 or 4) // disparity_index, // index of disparity value in disparity_map == 2 (0,2 or 4)
threadsMax, // maximal number of threads to launch threadsMax, // maximal number of threads to launch
updateStatus, updateStatus,
debugLevel); debugLevel);
......
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