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

Improving basic depth map generation

parent f801b9b5
...@@ -59,6 +59,7 @@ public class CLTPass3d{ ...@@ -59,6 +59,7 @@ public class CLTPass3d{
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
...@@ -70,6 +71,7 @@ public class CLTPass3d{ ...@@ -70,6 +71,7 @@ public class CLTPass3d{
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;
...@@ -362,6 +364,15 @@ public class CLTPass3d{ ...@@ -362,6 +364,15 @@ public class CLTPass3d{
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;
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[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)
......
...@@ -2305,6 +2305,7 @@ public class ImageDttCPU { ...@@ -2305,6 +2305,7 @@ public class ImageDttCPU {
} }
if (lma2 != null) { if (lma2 != null) {
disp_str[cTile] = lma2.lmaDisparityStrength( disp_str[cTile] = 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)
...@@ -2357,6 +2358,7 @@ public class ImageDttCPU { ...@@ -2357,6 +2358,7 @@ public class ImageDttCPU {
double [][] ddnd = lma2.getDdNd(); double [][] ddnd = lma2.getDdNd();
double [] stats = lma2.getStats(num_good_tiles); double [] stats = lma2.getStats(num_good_tiles);
double [][] lma_ds = lma2.lmaDisparityStrength( double [][] lma_ds = lma2.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)
...@@ -2425,6 +2427,7 @@ public class ImageDttCPU { ...@@ -2425,6 +2427,7 @@ public class ImageDttCPU {
// just for debugging, can be removed // just for debugging, can be removed
if (disparity_map != null){ if (disparity_map != null){
double [][] lma2_ds = lma2.lmaDisparityStrength( double [][] lma2_ds = lma2.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)
...@@ -3107,6 +3110,7 @@ public class ImageDttCPU { ...@@ -3107,6 +3110,7 @@ public class ImageDttCPU {
if (lma2 != null) { if (lma2 != null) {
dbg_num_good_lma ++; dbg_num_good_lma ++;
disp_str[cTile] = lma2.lmaDisparityStrength( disp_str[cTile] = 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)
...@@ -3289,6 +3293,7 @@ public class ImageDttCPU { ...@@ -3289,6 +3293,7 @@ public class ImageDttCPU {
double [][] ddnd = lma2.getDdNd(); double [][] ddnd = lma2.getDdNd();
double [] stats = lma2.getStats(num_good_tiles); double [] stats = lma2.getStats(num_good_tiles);
double [][] lma_ds = lma2.lmaDisparityStrength( double [][] lma_ds = lma2.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)
...@@ -4141,17 +4146,9 @@ public class ImageDttCPU { ...@@ -4141,17 +4146,9 @@ public class ImageDttCPU {
} }
} }
// calculate CM maximums for all mixed channels // calculate CM maximums for all mixed channels
// First get integer correlation center, relative to the center // First get integer correlation center, relative to the center
double [] corr_combo_max = corr_combo[Correlation2d.MCORR_COMB.ALL.ordinal()]; double [] corr_combo_max = corr_combo[Correlation2d.MCORR_COMB.ALL.ordinal()];
/*
int [] ixy = corr2d.getMaxXYInt( // find integer pair or null if below threshold
strip_combo, // double [] data,
true, // boolean axis_only,
imgdtt_params.min_corr, // double minMax, // minimal value to consider (at integer location, not interpolated)
tile_lma_debug_level > 0); // boolean debug);
*/
if (debugTile0) { if (debugTile0) {
System.out.println("tileX = "+tileX+", tileY = "+tileY); System.out.println("tileX = "+tileX+", tileY = "+tileY);
} }
...@@ -4175,6 +4172,7 @@ public class ImageDttCPU { ...@@ -4175,6 +4172,7 @@ public class ImageDttCPU {
// disp_str[1] = strip_combo[ixy[0]+transform_size-1]; // strength at integer max on axis // disp_str[1] = strip_combo[ixy[0]+transform_size-1]; // strength at integer max on axis
disp_str = disp_str_int; disp_str = disp_str_int;
disparity_map[DISPARITY_INDEX_INT][tIndex] = disp_str[0]; // -ixy[0]; disparity_map[DISPARITY_INDEX_INT][tIndex] = disp_str[0]; // -ixy[0];
disparity_map[DISPARITY_INDEX_CM+1][tIndex] = disp_str[1]; // reusing old fine-corr
disparity_map[DISPARITY_STRENGTH_INDEX][tIndex] = disp_str[1]; disparity_map[DISPARITY_STRENGTH_INDEX][tIndex] = disp_str[1];
if (Double.isNaN(disparity_map[DISPARITY_STRENGTH_INDEX][tIndex])) { if (Double.isNaN(disparity_map[DISPARITY_STRENGTH_INDEX][tIndex])) {
...@@ -4190,6 +4188,7 @@ public class ImageDttCPU { ...@@ -4190,6 +4188,7 @@ public class ImageDttCPU {
(tile_lma_debug_level > 0)); // boolean debug); (tile_lma_debug_level > 0)); // boolean debug);
if (corr_stat != null) { if (corr_stat != null) {
disparity_map[DISPARITY_INDEX_CM][tIndex] = -corr_stat[0]; // -ixy[0]; disparity_map[DISPARITY_INDEX_CM][tIndex] = -corr_stat[0]; // -ixy[0];
disparity_map[DISPARITY_INDEX_CM+1][tIndex] = corr_stat[1]; // reusing old fine-corr
disparity_map[DISPARITY_STRENGTH_INDEX][tIndex] = corr_stat[1]; disparity_map[DISPARITY_STRENGTH_INDEX][tIndex] = corr_stat[1];
} }
} }
...@@ -4228,7 +4227,8 @@ public class ImageDttCPU { ...@@ -4228,7 +4227,8 @@ public class ImageDttCPU {
if (corr_stat != null) { if (corr_stat != null) {
// skipping DISPARITY_VARIATIONS_INDEX - it was not used // skipping DISPARITY_VARIATIONS_INDEX - it was not used
disp_str[0] = -corr_stat[0]; disp_str[0] = -corr_stat[0];
disparity_map[DISPARITY_INDEX_CM][tIndex] = disp_str[0]; // disparity is negative X disp_str[1] = corr_stat[1];
// disparity_map[DISPARITY_INDEX_CM][tIndex] = disp_str[0]; // disparity is negative X. Already done above
if (tile_lma_debug_level > 0) { if (tile_lma_debug_level > 0) {
System.out.println("Will run getMaxXSOrtho( ) for tileX="+tileX+", tileY="+tileY); System.out.println("Will run getMaxXSOrtho( ) for tileX="+tileX+", tileY="+tileY);
} }
...@@ -4260,6 +4260,7 @@ public class ImageDttCPU { ...@@ -4260,6 +4260,7 @@ public class ImageDttCPU {
double [][] ds = null; double [][] ds = null;
if (lma2 != null) { if (lma2 != null) {
ds = lma2.lmaDisparityStrength( ds = 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)
...@@ -4271,8 +4272,11 @@ public class ImageDttCPU { ...@@ -4271,8 +4272,11 @@ public class ImageDttCPU {
if (ds != null) { // always true if (ds != null) { // always true
disparity_map[DISPARITY_INDEX_POLY][tIndex] = ds[0][0]; disparity_map[DISPARITY_INDEX_POLY][tIndex] = ds[0][0];
disparity_map[DISPARITY_INDEX_POLY+1][tIndex] = ds[0][1]; disparity_map[DISPARITY_INDEX_POLY+1][tIndex] = ds[0][1];
disparity_map[DISPARITY_STRENGTH_INDEX][tIndex] = ds[0][1]; // overwrite with LMA strength
if (debugTile0) { if (debugTile0) {
lma2.printStats(ds,1); lma2.printStats(ds,1);
if (imgdtt_params.lmas_LY_single) {
double [][] ddnd = lma2.getDdNd(); double [][] ddnd = lma2.getDdNd();
if (ddnd != null) { if (ddnd != null) {
double [][] dxy= new double [ddnd.length][2]; double [][] dxy= new double [ddnd.length][2];
...@@ -4291,10 +4295,12 @@ public class ImageDttCPU { ...@@ -4291,10 +4295,12 @@ public class ImageDttCPU {
System.out.print("Y = ["); System.out.print("Y = [");
for (int i = 0; i < dxy.length; i++) System.out.print(String.format(" %6.3f,", dxy[i][1])); System.out.println("]"); for (int i = 0; i < dxy.length; i++) System.out.print(String.format(" %6.3f,", dxy[i][1])); System.out.println("]");
System.out.println(); System.out.println();
} else {
System.out.println("No dd/nd and x/y offsets data is available ");
}
} else {
System.out.println("LY offsets are not measured");
} }
} }
} }
} }
...@@ -13876,6 +13882,7 @@ public class ImageDttCPU { ...@@ -13876,6 +13882,7 @@ public class ImageDttCPU {
double [][] ds = null; double [][] ds = null;
if (lma2 != null) { if (lma2 != null) {
ds = lma2.lmaDisparityStrength( ds = 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);
......
...@@ -7160,7 +7160,7 @@ public class QuadCLTCPU { ...@@ -7160,7 +7160,7 @@ public class QuadCLTCPU {
false, // final boolean no_weak, false, // final boolean no_weak,
false, // final boolean use_last, // false, // final boolean use_last, //
// TODO: when useCombo - pay attention to borders (disregard) // TODO: when useCombo - pay attention to borders (disregard)
false, // final boolean usePoly) // use polynomial method to find max), valid if useCombo == false // false, // final boolean usePoly) // use polynomial method to find max), valid if useCombo == false
true, // final boolean copyDebug) true, // final boolean copyDebug)
debugLevel); debugLevel);
...@@ -7243,7 +7243,7 @@ public class QuadCLTCPU { ...@@ -7243,7 +7243,7 @@ public class QuadCLTCPU {
false, // final boolean no_weak, false, // final boolean no_weak,
false, // final boolean use_last, // false, // final boolean use_last, //
// TODO: when useCombo - pay attention to borders (disregard) // TODO: when useCombo - pay attention to borders (disregard)
false, // final boolean usePoly) // use polynomial method to find max), valid if useCombo == false // false, // final boolean usePoly) // use polynomial method to find max), valid if useCombo == false
true, // final boolean copyDebug) true, // final boolean copyDebug)
debugLevel); debugLevel);
...@@ -7469,7 +7469,7 @@ public class QuadCLTCPU { ...@@ -7469,7 +7469,7 @@ public class QuadCLTCPU {
boolean [] bgmask = getBackgroundImageMasks( boolean [] bgmask = getBackgroundImageMasks(
clt_parameters, clt_parameters,
name, // .getTitle(), //String name=(String) imp_src.getProperty("name"); name, // .getTitle(), //String name=(String) imp_src.getProperty("name");
ImageDtt.DISPARITY_INDEX_CM, // index of disparity value in disparity_map == 2 (0,2 or 4) // ImageDtt.DISPARITY_INDEX_CM, // 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);
...@@ -7480,7 +7480,7 @@ public class QuadCLTCPU { ...@@ -7480,7 +7480,7 @@ public class QuadCLTCPU {
colorProcParameters, colorProcParameters,
rgbParameters, rgbParameters,
name, // .getTitle(), //String name=(String) imp_src.getProperty("name"); name, // .getTitle(), //String name=(String) imp_src.getProperty("name");
ImageDtt.DISPARITY_INDEX_CM, // index of disparity value in disparity_map == 2 (0,2 or 4) // ImageDtt.DISPARITY_INDEX_CM, // 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);
...@@ -7690,8 +7690,7 @@ public class QuadCLTCPU { ...@@ -7690,8 +7690,7 @@ public class QuadCLTCPU {
true, // final boolean keep_raw_fg, // do not replace raw tiles by the plates, if raw is closer (like poles) true, // final boolean keep_raw_fg, // do not replace raw tiles by the plates, if raw is closer (like poles)
0.0, // final double scale_filtered_strength_pre, // scale plate_ds[1] before comparing to raw strength 0.0, // final double scale_filtered_strength_pre, // scale plate_ds[1] before comparing to raw strength
0.0, // final double scale_filtered_strength_post,// scale plate_ds[1] when replacing raw (generally plate_ds is more reliable if it exists) 0.0, // final double scale_filtered_strength_post,// scale plate_ds[1] when replacing raw (generally plate_ds is more reliable if it exists)
// ImageDtt.DISPARITY_INDEX_CM, // index of disparity value in disparity_map == 2 (0,2 or 4)
ImageDtt.DISPARITY_INDEX_CM, // index of disparity value in disparity_map == 2 (0,2 or 4)
geometryCorrection, geometryCorrection,
threadsMax, // maximal number of threads to launch threadsMax, // maximal number of threads to launch
updateStatus, updateStatus,
...@@ -7830,8 +7829,7 @@ public class QuadCLTCPU { ...@@ -7830,8 +7829,7 @@ public class QuadCLTCPU {
true, // final boolean keep_raw_fg, // do not replace raw tiles by the plates, if raw is closer (like poles) true, // final boolean keep_raw_fg, // do not replace raw tiles by the plates, if raw is closer (like poles)
0.0, // final double scale_filtered_strength_pre, // scale plate_ds[1] before comparing to raw strength 0.0, // final double scale_filtered_strength_pre, // scale plate_ds[1] before comparing to raw strength
0.0, // final double scale_filtered_strength_post,// scale plate_ds[1] when replacing raw (generally plate_ds is more reliable if it exists) 0.0, // final double scale_filtered_strength_post,// scale plate_ds[1] when replacing raw (generally plate_ds is more reliable if it exists)
// ImageDtt.DISPARITY_INDEX_CM, // index of disparity value in disparity_map == 2 (0,2 or 4)
ImageDtt.DISPARITY_INDEX_CM, // index of disparity value in disparity_map == 2 (0,2 or 4)
geometryCorrection, geometryCorrection,
threadsMax, // maximal number of threads to launch threadsMax, // maximal number of threads to launch
updateStatus, updateStatus,
...@@ -7892,6 +7890,28 @@ public class QuadCLTCPU { ...@@ -7892,6 +7890,28 @@ public class QuadCLTCPU {
false, // final boolean usePoly) // use polynomial method to find max), valid if useCombo == false false, // final boolean usePoly) // use polynomial method to find max), valid if useCombo == false
true, // final boolean copyDebug) true, // final boolean copyDebug)
debugLevel); debugLevel);
for (int nexpand = 0; nexpand < 20; nexpand++) {
int num_added = tp.expandCertain (
combo_pass, // final CLTPass3d combo_pass, // modify
tp.clt_3d_passes, // final ArrayList <CLTPass3d> passes,
bg_pass, // final int firstPass,
tp.clt_3d_passes.size(), // final int lastPassPlus1,
0.5, // final int disp_avg_arange, // average neighbors with disparity not more than that from the lowest
0.1, // final int disp_avg_rrange, // same, relative to disparity
1.0, // final int disp_arange, // look for a fit within range from the neighbor
0.1, // final int disp_rrange, // same, relative to disparity
2, // final int min_defined, // minimal number of defined neighbors that fit into the range
tp.getTrustedCorrelation(), // final double trustedCorrelation,
tp.getMaxOverexposure(), // final double max_overexposure,
debugLevel); // final int debugLevel)
if (num_added==0) {
break;
}
if (show_init_refine) tp.showScan(
combo_pass, // CLTPass3d scan,
"expamded-"+nexpand+"-added-"+num_added);
}
if (show_init_refine) tp.showScan( if (show_init_refine) tp.showScan(
combo_pass, // CLTPass3d scan, combo_pass, // CLTPass3d scan,
...@@ -9770,7 +9790,7 @@ public class QuadCLTCPU { ...@@ -9770,7 +9790,7 @@ public class QuadCLTCPU {
pt_keep_raw_fg, // final boolean keep_raw_fg, // do not replace raw tiles by the plates, if raw is closer (like poles) pt_keep_raw_fg, // final boolean keep_raw_fg, // do not replace raw tiles by the plates, if raw is closer (like poles)
pt_scale_pre, // final double scale_filtered_strength_pre, // scale plate_ds[1] before comparing to raw strength pt_scale_pre, // final double scale_filtered_strength_pre, // scale plate_ds[1] before comparing to raw strength
pt_scale_post, // final double scale_filtered_strength_post,// scale plate_ds[1] when replacing raw (generally plate_ds is more reliable if it exists) pt_scale_post, // final double scale_filtered_strength_post,// scale plate_ds[1] when replacing raw (generally plate_ds is more reliable if it exists)
ImageDtt.DISPARITY_INDEX_CM, // index of disparity value in disparity_map == 2 (0,2 or 4) // ImageDtt.DISPARITY_INDEX_CM, // index of disparity value in disparity_map == 2 (0,2 or 4)
geometryCorrection, geometryCorrection,
tp.threadsMax, // maximal number of threads to launch tp.threadsMax, // maximal number of threads to launch
false, // updateStatus, false, // updateStatus,
...@@ -10472,7 +10492,7 @@ public class QuadCLTCPU { ...@@ -10472,7 +10492,7 @@ public class 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
...@@ -10500,7 +10520,7 @@ public class QuadCLTCPU { ...@@ -10500,7 +10520,7 @@ public class QuadCLTCPU {
clt_parameters.sure_smth, // if 2-nd worst image difference (noise-normalized) exceeds this - do not propagate bgnd clt_parameters.sure_smth, // if 2-nd worst image difference (noise-normalized) exceeds this - do not propagate bgnd
clt_parameters.min_clstr_seed, // number of tiles in a cluster to seed (just background?) clt_parameters.min_clstr_seed, // number of tiles in a cluster to seed (just background?)
clt_parameters.min_clstr_block,// number of tiles in a cluster to block (just non-background?) clt_parameters.min_clstr_block,// number of tiles in a cluster to block (just non-background?)
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)
clt_parameters.show_bgnd_nonbgnd, clt_parameters.show_bgnd_nonbgnd,
(clt_parameters.debug_filters ? (debugLevel) : -1)); (clt_parameters.debug_filters ? (debugLevel) : -1));
boolean [] bgnd_tiles_new = tp.getBackgroundMask_new( // which tiles do belong to the background boolean [] bgnd_tiles_new = tp.getBackgroundMask_new( // which tiles do belong to the background
...@@ -10510,7 +10530,7 @@ public class QuadCLTCPU { ...@@ -10510,7 +10530,7 @@ public class QuadCLTCPU {
clt_parameters.sure_smth, // if 2-nd worst image difference (noise-normalized) exceeds this - do not propagate bgnd clt_parameters.sure_smth, // if 2-nd worst image difference (noise-normalized) exceeds this - do not propagate bgnd
clt_parameters.min_clstr_seed, // number of tiles in a cluster to seed (just background?) clt_parameters.min_clstr_seed, // number of tiles in a cluster to seed (just background?)
clt_parameters.min_clstr_block,// number of tiles in a cluster to block (just non-background?) clt_parameters.min_clstr_block,// number of tiles in a cluster to block (just non-background?)
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)
clt_parameters.show_bgnd_nonbgnd, clt_parameters.show_bgnd_nonbgnd,
(clt_parameters.debug_filters ? (debugLevel) : -1)); (clt_parameters.debug_filters ? (debugLevel) : -1));
boolean [] bgnd_dbg = bgnd_tiles.clone(); // only these have non 0 alpha boolean [] bgnd_dbg = bgnd_tiles.clone(); // only these have non 0 alpha
...@@ -10567,7 +10587,7 @@ public class QuadCLTCPU { ...@@ -10567,7 +10587,7 @@ public class 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
......
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