Commit 5b919b27 authored by Andrey Filippov's avatar Andrey Filippov

switched multi-tile processing (in low-contrast areas) to new set of

low-level TP methods
parent e57130aa
...@@ -63,11 +63,13 @@ public class CLTParameters { ...@@ -63,11 +63,13 @@ public class CLTParameters {
public int ishift_y = 0; // debug feature - shift source image by this pixels down public int ishift_y = 0; // debug feature - shift source image by this pixels down
private double fat_zero = 0.05; // modify phase correlation to prevent division by very small numbers private double fat_zero = 0.05; // modify phase correlation to prevent division by very small numbers
private double fat_zero_mono = 0.03; // modify phase correlation to prevent division by very small numbers private double fat_zero_mono = 0.03; // modify phase correlation to prevent division by very small numbers
private double corr_sigma = 0.8; // LPF correlation sigma private double corr_sigma = 0.9; // LPF correlation sigma
private double corr_sigma_mono = 0.1; // LPF correlation sigma for monochrome images private double corr_sigma_mono = 0.15; // LPF correlation sigma for monochrome images
private double scale_strength_main = 1.0; // leave as is private double texture_sigma = 0.9; // LPF correlation sigma
private double scale_strength_aux = 0.3; // reduce to match lower sigma private double texture_sigma_mono =0.15; // LPF correlation sigma for monochrome images
private double scale_strength_main = 1.0;// leave as is
private double scale_strength_aux = 0.3;// reduce to match lower sigma
public boolean norm_kern = true; // normalize kernels public boolean norm_kern = true; // normalize kernels
public boolean gain_equalize = false;// equalize green channel gain (bug fix for wrong exposure in Exif ?) public boolean gain_equalize = false;// equalize green channel gain (bug fix for wrong exposure in Exif ?)
public boolean colors_equalize = true; // equalize R/G, B/G of the individual channels public boolean colors_equalize = true; // equalize R/G, B/G of the individual channels
...@@ -938,6 +940,9 @@ public class CLTParameters { ...@@ -938,6 +940,9 @@ public class CLTParameters {
public double getCorrSigma(boolean monochrome) { public double getCorrSigma(boolean monochrome) {
return monochrome ? corr_sigma_mono : corr_sigma; return monochrome ? corr_sigma_mono : corr_sigma;
} }
public double getTextureSigma(boolean monochrome) {
return monochrome ? texture_sigma_mono : texture_sigma;
}
public double getFatZero(boolean monochrome) { public double getFatZero(boolean monochrome) {
return monochrome ? fat_zero_mono : fat_zero; return monochrome ? fat_zero_mono : fat_zero;
} }
...@@ -994,6 +999,8 @@ public class CLTParameters { ...@@ -994,6 +999,8 @@ public class CLTParameters {
properties.setProperty(prefix+"fat_zero_mono", this.fat_zero_mono+""); properties.setProperty(prefix+"fat_zero_mono", this.fat_zero_mono+"");
properties.setProperty(prefix+"corr_sigma", this.corr_sigma+""); properties.setProperty(prefix+"corr_sigma", this.corr_sigma+"");
properties.setProperty(prefix+"corr_sigma_mono", this.corr_sigma_mono+""); properties.setProperty(prefix+"corr_sigma_mono", this.corr_sigma_mono+"");
properties.setProperty(prefix+"texture_sigma", this.texture_sigma+"");
properties.setProperty(prefix+"texture_sigma_mono", this.texture_sigma_mono+"");
properties.setProperty(prefix+"scale_strength_main", this.scale_strength_main+""); properties.setProperty(prefix+"scale_strength_main", this.scale_strength_main+"");
properties.setProperty(prefix+"scale_strength_aux", this.scale_strength_aux+""); properties.setProperty(prefix+"scale_strength_aux", this.scale_strength_aux+"");
...@@ -1808,6 +1815,8 @@ public class CLTParameters { ...@@ -1808,6 +1815,8 @@ public class CLTParameters {
if (properties.getProperty(prefix+"fat_zero_mono")!=null) this.fat_zero_mono=Double.parseDouble(properties.getProperty(prefix+"fat_zero_mono")); if (properties.getProperty(prefix+"fat_zero_mono")!=null) this.fat_zero_mono=Double.parseDouble(properties.getProperty(prefix+"fat_zero_mono"));
if (properties.getProperty(prefix+"corr_sigma")!=null) this.corr_sigma=Double.parseDouble(properties.getProperty(prefix+"corr_sigma")); if (properties.getProperty(prefix+"corr_sigma")!=null) this.corr_sigma=Double.parseDouble(properties.getProperty(prefix+"corr_sigma"));
if (properties.getProperty(prefix+"corr_sigma_mono")!=null) this.corr_sigma_mono=Double.parseDouble(properties.getProperty(prefix+"corr_sigma_mono")); if (properties.getProperty(prefix+"corr_sigma_mono")!=null) this.corr_sigma_mono=Double.parseDouble(properties.getProperty(prefix+"corr_sigma_mono"));
if (properties.getProperty(prefix+"texture_sigma")!=null) this.texture_sigma=Double.parseDouble(properties.getProperty(prefix+"texture_sigma"));
if (properties.getProperty(prefix+"texture_sigma_mono")!=null) this.texture_sigma_mono=Double.parseDouble(properties.getProperty(prefix+"texture_sigma_mono"));
if (properties.getProperty(prefix+"scale_strength_main")!=null) this.scale_strength_main=Double.parseDouble(properties.getProperty(prefix+"scale_strength_main")); if (properties.getProperty(prefix+"scale_strength_main")!=null) this.scale_strength_main=Double.parseDouble(properties.getProperty(prefix+"scale_strength_main"));
if (properties.getProperty(prefix+"scale_strength_aux")!=null) this.scale_strength_aux=Double.parseDouble(properties.getProperty(prefix+"scale_strength_aux")); if (properties.getProperty(prefix+"scale_strength_aux")!=null) this.scale_strength_aux=Double.parseDouble(properties.getProperty(prefix+"scale_strength_aux"));
...@@ -2636,9 +2645,14 @@ public class CLTParameters { ...@@ -2636,9 +2645,14 @@ public class CLTParameters {
gd.addNumericField("ishift_y: shift source image by this pixels down", this.ishift_y, 0); gd.addNumericField("ishift_y: shift source image by this pixels down", this.ishift_y, 0);
gd.addNumericField("Modify phase correlation to prevent division by very small numbers", this.fat_zero, 4); gd.addNumericField("Modify phase correlation to prevent division by very small numbers", this.fat_zero, 4);
gd.addNumericField("Modify phase correlation for monochrome images", this.fat_zero_mono, 4); gd.addNumericField("Modify phase correlation for monochrome images", this.fat_zero_mono, 4);
gd.addNumericField("LPF correlarion sigma for Bayer color images", this.corr_sigma, 4); gd.addNumericField("LPF correlarion sigma for Bayer color images (correlation)", this.corr_sigma, 4);
gd.addNumericField("LPF correlarion sigma for monochrome images", this.corr_sigma_mono, 4); gd.addNumericField("LPF correlarion sigma for monochrome images (correlation)", this.corr_sigma_mono, 4);
gd.addNumericField("LPF correlarion sigma for Bayer color images (textures)", this.texture_sigma, 4);
gd.addNumericField("LPF correlarion sigma for monochrome images (textures)", this.texture_sigma_mono, 4);
gd.addNumericField("Scale all correlation strengths (to compensate correlation sigma) for main camera", this.scale_strength_main, 4); gd.addNumericField("Scale all correlation strengths (to compensate correlation sigma) for main camera", this.scale_strength_main, 4);
gd.addNumericField("Scale all correlation strengths (to compensate correlation sigma) for aux camera", this.scale_strength_aux, 4); gd.addNumericField("Scale all correlation strengths (to compensate correlation sigma) for aux camera", this.scale_strength_aux, 4);
...@@ -3668,6 +3682,8 @@ public class CLTParameters { ...@@ -3668,6 +3682,8 @@ public class CLTParameters {
this.fat_zero_mono = gd.getNextNumber(); this.fat_zero_mono = gd.getNextNumber();
this.corr_sigma = gd.getNextNumber(); this.corr_sigma = gd.getNextNumber();
this.corr_sigma_mono = gd.getNextNumber(); this.corr_sigma_mono = gd.getNextNumber();
this.texture_sigma = gd.getNextNumber();
this.texture_sigma_mono = gd.getNextNumber();
this.scale_strength_main = gd.getNextNumber(); this.scale_strength_main = gd.getNextNumber();
this.scale_strength_aux = gd.getNextNumber(); this.scale_strength_aux = gd.getNextNumber();
this.norm_kern= gd.getNextBoolean(); this.norm_kern= gd.getNextBoolean();
......
...@@ -996,11 +996,15 @@ public class GpuQuad{ // quad camera description ...@@ -996,11 +996,15 @@ public class GpuQuad{ // quad camera description
final int transform_size, final int transform_size,
final double [][] disparity_array, // [tilesY][tilesX] - individual per-tile expected disparity final double [][] disparity_array, // [tilesY][tilesX] - individual per-tile expected disparity
final double disparity_corr, final double disparity_corr,
final int [][] tile_op, // [tilesY][tilesX] - what to do - 0 - nothing for this tile final int [][] tile_op, // [tilesY][tilesX] - what to do - 0 - nothing for this tile, null - use non-NaN in disparity_array
final GeometryCorrection geometryCorrection, final GeometryCorrection geometryCorrection,
final int threadsMax) // maximal number of threads to launch final int threadsMax) // maximal number of threads to launch
{ {
final int tilesY = disparity_array.length; final int tilesY = disparity_array.length;
int op = ImageDtt.setImgMask(0, 0xf); // use if tile_op is not provided
op = ImageDtt.setPairMask(op,0xf);
op = ImageDtt.setForcedDisparity(op,true);
final int fop = op;
int tx = -1; int tx = -1;
for (int i = 0; i < disparity_array.length; i++) if (disparity_array[i] != null) { for (int i = 0; i < disparity_array.length; i++) if (disparity_array[i] != null) {
tx = disparity_array[i].length; tx = disparity_array[i].length;
...@@ -1022,11 +1026,15 @@ public class GpuQuad{ // quad camera description ...@@ -1022,11 +1026,15 @@ public class GpuQuad{ // quad camera description
for (int iTile = ai.getAndIncrement(); iTile < tp_tasks_xy.length; iTile = ai.getAndIncrement()) { for (int iTile = ai.getAndIncrement(); iTile < tp_tasks_xy.length; iTile = ai.getAndIncrement()) {
int tileY = iTile /tilesX; int tileY = iTile /tilesX;
int tileX = iTile % tilesX; int tileX = iTile % tilesX;
if ((tile_op[tileY][tileX] != 0) && !Double.isNaN(disparity_array[tileY][tileX])) { int op = fop;
if (tile_op != null) {
op = tile_op[tileY][tileX];
}
if ((op != 0) && !Double.isNaN(disparity_array[tileY][tileX])) {
tp_tasks_xy[iTile] = setTask( tp_tasks_xy[iTile] = setTask(
num_cams, // int num_cams, num_cams, // int num_cams,
transform_size, // int transform_size, transform_size, // int transform_size,
tile_op[tileY][tileX], // int task_code, op, // int task_code,
tileX, // int tileX, tileX, // int tileX,
tileY, // int tileY, tileY, // int tileY,
disparity_array[tileY][tileX] + disparity_corr, // double target_disparity, // include disparity_corr disparity_array[tileY][tileX] + disparity_corr, // double target_disparity, // include disparity_corr
......
...@@ -25,6 +25,7 @@ package com.elphel.imagej.tileprocessor; ...@@ -25,6 +25,7 @@ package com.elphel.imagej.tileprocessor;
*/ */
import java.awt.Rectangle; import java.awt.Rectangle;
import java.util.Arrays;
import java.util.concurrent.atomic.AtomicInteger; import java.util.concurrent.atomic.AtomicInteger;
public class CLTPass3d{ public class CLTPass3d{
...@@ -559,6 +560,9 @@ public class CLTPass3d{ ...@@ -559,6 +560,9 @@ public class CLTPass3d{
double trustedCorrelation = tileProcessor.getTrustedCorrelation(); double trustedCorrelation = tileProcessor.getTrustedCorrelation();
double max_overexposure = tileProcessor.getMaxOverexposure(); double max_overexposure = tileProcessor.getMaxOverexposure();
if (strength_hor == null) { if (strength_hor == null) {
if (disparity_map[ImageDtt.DISPARITY_INDEX_HOR_STRENGTH] == null) {
return null;
}
strength_hor = disparity_map[ImageDtt.DISPARITY_INDEX_HOR_STRENGTH].clone(); strength_hor = disparity_map[ImageDtt.DISPARITY_INDEX_HOR_STRENGTH].clone();
if (trustedCorrelation > 0.0){ if (trustedCorrelation > 0.0){
for (int i = 0; i < strength_hor.length; i++){ for (int i = 0; i < strength_hor.length; i++){
...@@ -583,6 +587,9 @@ public class CLTPass3d{ ...@@ -583,6 +587,9 @@ public class CLTPass3d{
double trustedCorrelation = tileProcessor.getTrustedCorrelation(); double trustedCorrelation = tileProcessor.getTrustedCorrelation();
double max_overexposure = tileProcessor.getMaxOverexposure(); double max_overexposure = tileProcessor.getMaxOverexposure();
if (strength_vert == null) { if (strength_vert == null) {
if (disparity_map[ImageDtt.DISPARITY_INDEX_VERT_STRENGTH] == null) {
return null;
}
strength_vert = disparity_map[ImageDtt.DISPARITY_INDEX_VERT_STRENGTH].clone(); strength_vert = disparity_map[ImageDtt.DISPARITY_INDEX_VERT_STRENGTH].clone();
if (trustedCorrelation > 0.0){ if (trustedCorrelation > 0.0){
for (int i = 0; i < strength_vert.length; i++){ for (int i = 0; i < strength_vert.length; i++){
...@@ -639,7 +646,22 @@ public class CLTPass3d{ ...@@ -639,7 +646,22 @@ public class CLTPass3d{
} }
return disparityLMA; return disparityLMA;
} }
public double getDisprityHor(int nt) {
return (disparity_map[ImageDtt.DISPARITY_INDEX_HOR] == null) ? Double.NaN : disparity_map[ImageDtt.DISPARITY_INDEX_HOR][nt];
}
public double getDisprityVert(int nt) {
return (disparity_map[ImageDtt.DISPARITY_INDEX_VERT] == null) ? Double.NaN : disparity_map[ImageDtt.DISPARITY_INDEX_VERT][nt];
}
public double getStrengthHor(int nt) {
return (disparity_map[ImageDtt.DISPARITY_INDEX_HOR_STRENGTH] == null) ? 0.0 : disparity_map[ImageDtt.DISPARITY_INDEX_HOR_STRENGTH][nt];
}
public double getStrengthVert(int nt) {
return (disparity_map[ImageDtt.DISPARITY_INDEX_VERT_STRENGTH] == null) ? 0.0 : disparity_map[ImageDtt.DISPARITY_INDEX_VERT_STRENGTH][nt];
}
// methods to "condition" measured disparity values // methods to "condition" measured disparity values
public void conditionDisparity() public void conditionDisparity()
{ {
...@@ -650,6 +672,9 @@ public class CLTPass3d{ ...@@ -650,6 +672,9 @@ public class CLTPass3d{
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];
Arrays.fill(calc_disparity, Double.NaN);
Arrays.fill(calc_disparity_hor, Double.NaN);
Arrays.fill(calc_disparity_vert, Double.NaN);
double [] lma_disparity = (lma_disparity_index >= 0) ? disparity_map[lma_disparity_index] : null; double [] lma_disparity = (lma_disparity_index >= 0) ? disparity_map[lma_disparity_index] : null;
double [] lma_strength = (lma_disparity_index >= 0) ? disparity_map[lma_disparity_index+1] : null; double [] lma_strength = (lma_disparity_index >= 0) ? disparity_map[lma_disparity_index+1] : null;
...@@ -664,11 +689,25 @@ public class CLTPass3d{ ...@@ -664,11 +689,25 @@ public class CLTPass3d{
} else { } 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_vert[indx] = disparity_map[ImageDtt.DISPARITY_INDEX_VERT][indx]/corr_magic_scale + this.disparity[i][j];
} }
} }
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
if (disparity_map[ImageDtt.DISPARITY_INDEX_HOR] != null) {
for (int i = 0; i < tilesY; i++){
for (int j = 0; j < tilesX; j++){
int indx = i * tilesX + j;
calc_disparity_hor[indx] = disparity_map[ImageDtt.DISPARITY_INDEX_HOR][indx]/corr_magic_scale + this.disparity[i][j];
}
}
}
if (disparity_map[ImageDtt.DISPARITY_INDEX_VERT] != null) {
for (int i = 0; i < tilesY; i++){
for (int j = 0; j < tilesX; j++){
int indx = i * tilesX + j;
calc_disparity_vert[indx] = disparity_map[ImageDtt.DISPARITY_INDEX_VERT][indx]/corr_magic_scale + this.disparity[i][j];
}
}
}
} }
public boolean [] hasLMADefined(){ // will try not to create this.has_lma public boolean [] hasLMADefined(){ // will try not to create this.has_lma
...@@ -975,13 +1014,15 @@ public class CLTPass3d{ ...@@ -975,13 +1014,15 @@ public class CLTPass3d{
} }
} else { } else {
if (selection[indx]) { if (selection[indx]) {
this.disparity[ty][tx] = (disparity == null)? 0.0: disparity[indx]; // this.disparity[ty][tx] = (disparity == null)? 0.0: disparity[indx];
this.tile_op[ty][tx] = tile_op; this.tile_op[ty][tx] = tile_op;
num_op_tiles ++; num_op_tiles ++;
} else { } else {
this.disparity[ty][tx] = 0.0; // this.disparity[ty][tx] = 0.0;
this.tile_op[ty][tx] = 0; this.tile_op[ty][tx] = 0;
} }
this.disparity[ty][tx] = (disparity == null)? 0.0: disparity[indx];
} }
} }
return num_op_tiles; return num_op_tiles;
......
...@@ -2125,7 +2125,7 @@ public class Corr2dLMA { ...@@ -2125,7 +2125,7 @@ public class Corr2dLMA {
double lma_str_scale, // convert lma-generated strength to match previous ones - scale double lma_str_scale, // convert lma-generated strength to match previous ones - scale
double lma_str_offset // convert lma-generated strength to match previous ones - add to result double lma_str_offset // convert lma-generated strength to match previous ones - add to result
){ ){
double [][] ds = new double[numTiles][2]; double [][] ds = new double[numTiles][3];
double [] rms = getRmsTile(); double [] rms = getRmsTile();
double [][] maxmin_amp = getMaxMinAmpTile(); double [][] maxmin_amp = getMaxMinAmpTile();
double [][] abc = getABCTile(); double [][] abc = getABCTile();
...@@ -2173,6 +2173,7 @@ public class Corr2dLMA { ...@@ -2173,6 +2173,7 @@ public class Corr2dLMA {
strength = Math.sqrt(strength * Math.sqrt(ac)); // / area ); // new strength strength = Math.sqrt(strength * Math.sqrt(ac)); // / area ); // new strength
ds[tile][0] = disparity; ds[tile][0] = disparity;
ds[tile][1] = (strength * lma_str_scale) + lma_str_offset; ds[tile][1] = (strength * lma_str_scale) + lma_str_offset;
ds[tile][2] = strength; // as is
} }
return ds; return ds;
} }
......
...@@ -144,6 +144,13 @@ public class ImageDttParameters { ...@@ -144,6 +144,13 @@ public class ImageDttParameters {
public double pcorr_dbg_offsx = 0.0; // X-offset correlation in TD public double pcorr_dbg_offsx = 0.0; // X-offset correlation in TD
public double pcorr_dbg_offsy = 0.0; // Y-offset correlation in TD public double pcorr_dbg_offsy = 0.0; // Y-offset correlation in TD
// Multi-tile averaging tilt
public double tilt_arange = 1.0; //absolute disparity range to consolidate
public double tilt_rrange = 0.1; // relative disparity range to consolidate
public double tilt_no_tilt = 0.5; // no tilt if center disparity is lower
public double tilt_damp_tilt = 0.01; // 0.1?
public int tilt_clust_extra = 2; // 0.1? measure tilt by larger cluster radius than for averaging
// LMA parameters // LMA parameters
public double lma_disp_range = 5.0; // disparity range to combine in one cluster (to mitigate ERS public double lma_disp_range = 5.0; // disparity range to combine in one cluster (to mitigate ERS
// LMA single parameters // LMA single parameters
...@@ -217,8 +224,8 @@ public class ImageDttParameters { ...@@ -217,8 +224,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; // LWIR16: 0.2 convert lma-generated strength to match previous ones - scale public double lma_str_scale = 0.2665; // LWIR16: 0.2 convert lma-generated strength to match previous ones - scale
public double lma_str_offset = 0.05; // LWIR16: 0.05 convert lma-generated strength to match previous ones - add to result public double lma_str_offset = 0.1046; // LWIR16: 0.05 convert lma-generated strength to match previous ones - add to result
// Lazy eye results interpretation // Lazy eye results interpretation
...@@ -511,6 +518,18 @@ public class ImageDttParameters { ...@@ -511,6 +518,18 @@ public class ImageDttParameters {
gd.addNumericField("Debug feature - shift correlation result Y", this.pcorr_dbg_offsy, 3, 6, "", gd.addNumericField("Debug feature - shift correlation result Y", this.pcorr_dbg_offsy, 3, 6, "",
"Rotate in Transform Domain"); "Rotate in Transform Domain");
gd.addMessage("Multi-tile averaging");
gd.addNumericField("Absolute disparity range to consolidate", this.tilt_arange, 3, 6, "",
"Only use neighbor tiles if their differ less from the center");
gd.addNumericField("Relative disparity range to consolidate", this.tilt_rrange, 3, 6, "",
"Only use neighbor tiles if their differ less from the center relative to the center disparity");
gd.addNumericField("No tilt if center disparity is smaller", this.tilt_no_tilt, 3, 6, "",
"Use constant disparity for the whole cluster if center disparity is below");
gd.addNumericField("Tilt regularization", this.tilt_damp_tilt, 3, 6, "",
"Minimize tilt when data is insufficient to determine it");
gd.addNumericField ("Increase cluster radius for measuring tilt by this", this.tilt_clust_extra, 0, 3, "",
"Before averaging calculate tilt using larger square, e.g. ==2 - use 7x7 for tilt for 3x3 averaging");
gd.addTab("Corr LMA","Parameters for LMA fitting of the correlation maximum parameters"); gd.addTab("Corr LMA","Parameters for LMA fitting of the correlation maximum parameters");
gd.addMessage("Single-tile (no lazy eye) only parameters (some are common"); gd.addMessage("Single-tile (no lazy eye) only parameters (some are common");
gd.addNumericField("Cluster disparity range", this.lma_disp_range, 3, 6, "pix", gd.addNumericField("Cluster disparity range", this.lma_disp_range, 3, 6, "pix",
...@@ -804,6 +823,13 @@ public class ImageDttParameters { ...@@ -804,6 +823,13 @@ public class ImageDttParameters {
this.pcorr_fat_zero_mono = gd.getNextNumber(); this.pcorr_fat_zero_mono = gd.getNextNumber();
this.pcorr_dbg_offsx = gd.getNextNumber(); this.pcorr_dbg_offsx = gd.getNextNumber();
this.pcorr_dbg_offsy = gd.getNextNumber(); this.pcorr_dbg_offsy = gd.getNextNumber();
this.tilt_arange = gd.getNextNumber();
this.tilt_rrange = gd.getNextNumber();
this.tilt_no_tilt = gd.getNextNumber();
this.tilt_damp_tilt = gd.getNextNumber();
this.tilt_clust_extra= (int) gd.getNextNumber();
//LMA tab //LMA tab
this.lma_disp_range = gd.getNextNumber(); this.lma_disp_range = gd.getNextNumber();
this.lmas_gaussian= (int) gd.getNextNumber(); this.lmas_gaussian= (int) gd.getNextNumber();
...@@ -997,6 +1023,14 @@ public class ImageDttParameters { ...@@ -997,6 +1023,14 @@ public class ImageDttParameters {
properties.setProperty(prefix+"pcorr_dbg_offsx", this.pcorr_dbg_offsx +""); properties.setProperty(prefix+"pcorr_dbg_offsx", this.pcorr_dbg_offsx +"");
properties.setProperty(prefix+"pcorr_dbg_offsy", this.pcorr_dbg_offsy +""); properties.setProperty(prefix+"pcorr_dbg_offsy", this.pcorr_dbg_offsy +"");
properties.setProperty(prefix+"tilt_arange", this.tilt_arange +"");
properties.setProperty(prefix+"tilt_rrange", this.tilt_rrange +"");
properties.setProperty(prefix+"tilt_no_tilt", this.tilt_no_tilt +"");
properties.setProperty(prefix+"tilt_damp_tilt", this.tilt_damp_tilt +"");
properties.setProperty(prefix+"tilt_clust_extra", this.tilt_clust_extra +"");
properties.setProperty(prefix+"lma_disp_range", this.lma_disp_range +""); properties.setProperty(prefix+"lma_disp_range", this.lma_disp_range +"");
properties.setProperty(prefix+"lmas_gaussian", this.lmas_gaussian +""); properties.setProperty(prefix+"lmas_gaussian", this.lmas_gaussian +"");
properties.setProperty(prefix+"lmas_adjust_wm", this.lmas_adjust_wm +""); properties.setProperty(prefix+"lmas_adjust_wm", this.lmas_adjust_wm +"");
...@@ -1192,6 +1226,13 @@ public class ImageDttParameters { ...@@ -1192,6 +1226,13 @@ public class ImageDttParameters {
if (properties.getProperty(prefix+"pcorr_fat_zero_mono")!=null) this.pcorr_fat_zero_mono=Double.parseDouble(properties.getProperty(prefix+"pcorr_fat_zero_mono")); if (properties.getProperty(prefix+"pcorr_fat_zero_mono")!=null) this.pcorr_fat_zero_mono=Double.parseDouble(properties.getProperty(prefix+"pcorr_fat_zero_mono"));
if (properties.getProperty(prefix+"pcorr_dbg_offsx")!=null) this.pcorr_dbg_offsx=Double.parseDouble(properties.getProperty(prefix+"pcorr_dbg_offsx")); if (properties.getProperty(prefix+"pcorr_dbg_offsx")!=null) this.pcorr_dbg_offsx=Double.parseDouble(properties.getProperty(prefix+"pcorr_dbg_offsx"));
if (properties.getProperty(prefix+"pcorr_dbg_offsy")!=null) this.pcorr_dbg_offsy=Double.parseDouble(properties.getProperty(prefix+"pcorr_dbg_offsy")); if (properties.getProperty(prefix+"pcorr_dbg_offsy")!=null) this.pcorr_dbg_offsy=Double.parseDouble(properties.getProperty(prefix+"pcorr_dbg_offsy"));
if (properties.getProperty(prefix+"tilt_arange")!=null) this.tilt_arange=Double.parseDouble(properties.getProperty(prefix+"tilt_arange"));
if (properties.getProperty(prefix+"tilt_rrange")!=null) this.tilt_rrange=Double.parseDouble(properties.getProperty(prefix+"tilt_rrange"));
if (properties.getProperty(prefix+"tilt_no_tilt")!=null) this.tilt_no_tilt=Double.parseDouble(properties.getProperty(prefix+"tilt_no_tilt"));
if (properties.getProperty(prefix+"tilt_damp_tilt")!=null) this.tilt_damp_tilt=Double.parseDouble(properties.getProperty(prefix+"tilt_damp_tilt"));
if (properties.getProperty(prefix+"tilt_clust_extra")!=null) this.tilt_clust_extra=Integer.parseInt(properties.getProperty(prefix+"tilt_clust_extra"));
if (properties.getProperty(prefix+"lma_disp_range")!=null) this.lma_disp_range=Double.parseDouble(properties.getProperty(prefix+"lma_disp_range")); if (properties.getProperty(prefix+"lma_disp_range")!=null) this.lma_disp_range=Double.parseDouble(properties.getProperty(prefix+"lma_disp_range"));
if (properties.getProperty(prefix+"lmas_gaussian")!=null) { if (properties.getProperty(prefix+"lmas_gaussian")!=null) {
...@@ -1407,6 +1448,12 @@ public class ImageDttParameters { ...@@ -1407,6 +1448,12 @@ public class ImageDttParameters {
idp.pcorr_fat_zero_mono = this.pcorr_fat_zero_mono; idp.pcorr_fat_zero_mono = this.pcorr_fat_zero_mono;
idp.pcorr_dbg_offsx = this.pcorr_dbg_offsx; idp.pcorr_dbg_offsx = this.pcorr_dbg_offsx;
idp.pcorr_dbg_offsy = this.pcorr_dbg_offsy; idp.pcorr_dbg_offsy = this.pcorr_dbg_offsy;
idp.tilt_arange = this.tilt_arange;
idp.tilt_rrange = this.tilt_rrange;
idp.tilt_no_tilt = this.tilt_no_tilt;
idp.tilt_damp_tilt = this.tilt_damp_tilt;
idp.tilt_clust_extra = this.tilt_clust_extra;
idp.lma_disp_range= this.lma_disp_range; idp.lma_disp_range= this.lma_disp_range;
idp.lmas_gaussian = this.lmas_gaussian; idp.lmas_gaussian = this.lmas_gaussian;
......
...@@ -1517,6 +1517,10 @@ public class OpticalFlow { ...@@ -1517,6 +1517,10 @@ public class OpticalFlow {
} }
int iwidth = imax_tX - imin_tX + 1; int iwidth = imax_tX - imin_tX + 1;
int iheight = imax_tY - imin_tY + 1; int iheight = imax_tY - imin_tY + 1;
if ((iwidth <= 0) || (iheight <= 0)) {
System.out.println ("prepareSceneTiles(): iwidth ="+iwidth+", iheight ="+iheight+", min_tX="+min_tX+", imin_tY="+imin_tY+", max_tX="+max_tX+", imax_tY="+imax_tY);
continue;
}
double [][] scene_slices = new double [dsrbg_scene.length][iwidth*iheight]; //OOM here double [][] scene_slices = new double [dsrbg_scene.length][iwidth*iheight]; //OOM here
for (int iY = 0; iY < iheight; iY++) { for (int iY = 0; iY < iheight; iY++) {
int tY = imin_tY + iY; int tY = imin_tY + iY;
...@@ -1653,7 +1657,7 @@ public class OpticalFlow { ...@@ -1653,7 +1657,7 @@ public class OpticalFlow {
scene_slices, // final double [][] slices, scene_slices, // final double [][] slices,
num_passes, // final int num_passes, num_passes, // final int num_passes,
max_change, // final double max_change, max_change, // final double max_change,
iwidth); // final int width iwidth); // final int width // got zero!
if ((debug_level>1) && (iMTile == dbg_mtile)) { if ((debug_level>1) && (iMTile == dbg_mtile)) {
String [] dbg_titles= scene_QuadClt.getDSRGGTiltes(); //{"d","s","r","b","g"}; String [] dbg_titles= scene_QuadClt.getDSRGGTiltes(); //{"d","s","r","b","g"};
...@@ -3077,7 +3081,7 @@ public class OpticalFlow { ...@@ -3077,7 +3081,7 @@ public class OpticalFlow {
double [] new_from_last_atr = ers_scene_last_known.getSceneATR(scene_ts); double [] new_from_last_atr = ers_scene_last_known.getSceneATR(scene_ts);
// combine two rotations and two translations // combine two rotations and two translations
System.out.println("Processing scene "+i); System.out.println("Processing scene "+i+": "+scene_QuadClt.getImageName());
double [][] combo_XYZATR = ErsCorrection.combineXYZATR( double [][] combo_XYZATR = ErsCorrection.combineXYZATR(
last_known_xyz, // double [] reference_xyz, last_known_xyz, // double [] reference_xyz,
last_known_atr, // double [] reference_atr, // null? last_known_atr, // double [] reference_atr, // null?
...@@ -5625,6 +5629,7 @@ public double[][] correlateIntersceneDebug( // only uses GPU and quad ...@@ -5625,6 +5629,7 @@ public double[][] correlateIntersceneDebug( // only uses GPU and quad
clt_parameters.tileY, // final int debug_tileY, clt_parameters.tileY, // final int debug_tileY,
threadsMax, // final int threadsMax, // maximal number of threads to launch threadsMax, // final int threadsMax, // maximal number of threads to launch
debug_level); //final int globalDebugLevel) debug_level); //final int globalDebugLevel)
accumulateCorrelations( accumulateCorrelations(
num_acc, // final int [][][] num_acc, // number of accumulated tiles [tilesY][tilesX][pair] num_acc, // final int [][][] num_acc, // number of accumulated tiles [tilesY][tilesX][pair]
dcorr_td, // final double [][][][][] dcorr_td, // [pair][tilesY][tilesX][4][64] sparse transform domain representation of corr pairs dcorr_td, // final double [][][][][] dcorr_td, // [pair][tilesY][tilesX][4][64] sparse transform domain representation of corr pairs
......
...@@ -1314,12 +1314,12 @@ public class TileProcessor { ...@@ -1314,12 +1314,12 @@ public class TileProcessor {
double mdisp = m_lma? double mdisp = m_lma?
mdisp_lma_arr[nt] : pass.disparity_map[ImageDtt.DISPARITY_INDEX_CM][nt]; mdisp_lma_arr[nt] : pass.disparity_map[ImageDtt.DISPARITY_INDEX_CM][nt];
double corr_magic = m_lma ? corr_magic_scale_lma : corr_magic_scale; double corr_magic = m_lma ? corr_magic_scale_lma : corr_magic_scale;
double mdisp_hor = pass.disparity_map[ImageDtt.DISPARITY_INDEX_HOR][nt]; double mdisp_hor = pass.getDisprityHor(nt); // disparity_map[ImageDtt.DISPARITY_INDEX_HOR][nt];
double mdisp_vert = pass.disparity_map[ImageDtt.DISPARITY_INDEX_VERT][nt]; double mdisp_vert = pass.getDisprityVert(nt); // disparity_map[ImageDtt.DISPARITY_INDEX_VERT][nt];
double strength = pass.disparity_map[ImageDtt.DISPARITY_STRENGTH_INDEX][nt]; double strength = pass.disparity_map[ImageDtt.DISPARITY_STRENGTH_INDEX][nt];
double strength_hor = pass.disparity_map[ImageDtt.DISPARITY_INDEX_HOR_STRENGTH][nt]; double strength_hor = pass.getStrengthHor(nt); // disparity_map[ImageDtt.DISPARITY_INDEX_HOR_STRENGTH][nt];
double strength_vert = pass.disparity_map[ImageDtt.DISPARITY_INDEX_VERT_STRENGTH][nt]; double strength_vert = pass.getStrengthVert(nt); // disparity_map[ImageDtt.DISPARITY_INDEX_VERT_STRENGTH][nt];
boolean overexposed = (max_overexposure > 0.0) && boolean overexposed = (max_overexposure > 0.0) &&
(pass.disparity_map[ImageDtt.OVEREXPOSED] != null) && (pass.disparity_map[ImageDtt.OVEREXPOSED] != null) &&
...@@ -3364,6 +3364,71 @@ ImageDtt.startAndJoin(threads); ...@@ -3364,6 +3364,71 @@ ImageDtt.startAndJoin(threads);
titles); titles);
System.out.println("showScan("+title+"): isMeasured()="+scan.isMeasured()+", isProcessed()="+scan.isProcessed()+", isCombo()="+scan.isCombo()); System.out.println("showScan("+title+"): isMeasured()="+scan.isMeasured()+", isProcessed()="+scan.isProcessed()+", isCombo()="+scan.isCombo());
} }
public void showLmaCmStrength(
CLTPass3d scan,
int bins,
String title) {
double [][] strengths = {
scan.disparity_map[ImageDtt.DISPARITY_INDEX_CM + 1],
scan.disparity_map[ImageDtt.DISPARITY_INDEX_POLY + 1]};
double mx_cm = 0.0, mx_lma = 0.0;
for (int i = 0; i < strengths[0].length; i++) {
if (strengths[0][i] > mx_cm) mx_cm = strengths[0][i];
if (strengths[1][i] > mx_lma) mx_lma = strengths[1][i];
}
System.out.println("showLmaCmStrength(): mx_cm="+mx_cm+", mx_lma="+mx_lma);
double step_cm = mx_cm / bins;
double step_lma = mx_lma / bins; // / 10.0;
double [] hist_arr = new double [bins*bins];
for (int i = 0; i < strengths[0].length; i++) if (strengths[1][i] > 0.0){
int b_cm = (int) Math.floor(strengths[0][i] / step_cm);
int b_lma = (int) Math.floor(strengths[1][i] / step_lma);
if (b_cm >= bins) b_cm = bins -1;
if (b_lma >= bins) b_lma = bins -1;
hist_arr[b_lma * bins + b_cm] += 1.0;
}
for (int i = 0; i < hist_arr.length; i++) {
if (hist_arr[i] <= 0.0) {
hist_arr[i] = Double.NaN;
}
}
(new ShowDoubleFloatArrays()).showArrays(
hist_arr,
bins,
bins,
title);
return;
}
public void adjustLmaStrength (
ImageDttParameters imgdtt_params,
CLTPass3d scan,
int debugLevel)
{
double [][] strengths = {
scan.disparity_map[ImageDtt.DISPARITY_INDEX_CM + 1],
scan.disparity_map[ImageDtt.DISPARITY_INDEX_POLY + 1]};
double s0 = 0.0, sx = 0.0, sx2 = 0.0, sy = 0.0, sxy = 0.0;
for (int i = 0; i < strengths[0].length; i++) if ((strengths[1][i] > 0.0) && (strengths[0][i] > 0)){
double x = strengths[1][i];
double y = strengths[0][i];
s0 += 1.0;
sx += x;
sx2 += x*x;
sy += y;
sxy += x * y;
}
imgdtt_params.lma_str_scale = (sxy * s0 - sy * sx) / (sx2 * s0 - sx * sx);
imgdtt_params.lma_str_offset = (sy * sx2 - sxy * sx) / (sx2 * s0 - sx * sx);
if (debugLevel > 0) {
System.out.println("adjustLmaStrength(): lma_str_scale="+imgdtt_params.lma_str_scale+", lma_str_offset="+imgdtt_params.lma_str_offset);
}
for (int i = 0; i < strengths[1].length; i++) if (strengths[1][i] > 0.0){
scan.disparity_map[ImageDtt.DISPARITY_STRENGTH_INDEX][i] = (strengths[1][i] * imgdtt_params.lma_str_scale) + imgdtt_params.lma_str_offset;
}
}
public void ShowScansSFB( public void ShowScansSFB(
...@@ -5752,13 +5817,13 @@ ImageDtt.startAndJoin(threads); ...@@ -5752,13 +5817,13 @@ ImageDtt.startAndJoin(threads);
disparityTask[ty][tx] = prev_disparity[indx]; disparityTask[ty][tx] = prev_disparity[indx];
tile_op[ty][tx] = op; tile_op[ty][tx] = op;
} else { } else {
disparityTask[ty][tx] = 0.0; disparityTask[ty][tx] = Double.NaN; // 0.0;
tile_op[ty][tx] = 0; tile_op[ty][tx] = 0;
borderTiles[indx] = false; borderTiles[indx] = false;
} }
} }
scan_next.setClustRadius(clust_radius); scan_next.setClustRadius(clust_radius);
scan_next.disparity = disparityTask; scan_next.disparity = disparityTask; // will have NaN-s
scan_next.tile_op = tile_op; scan_next.tile_op = tile_op;
scan_next.setBorderTiles (borderTiles); scan_next.setBorderTiles (borderTiles);
scan_next.setSelected(need_meas); // includes border_tiles scan_next.setSelected(need_meas); // includes border_tiles
......
...@@ -8311,7 +8311,7 @@ if (debugLevel > -100) return true; // temporarily ! ...@@ -8311,7 +8311,7 @@ if (debugLevel > -100) return true; // temporarily !
threadsMax, // int threadsMax, // maximal number of threads to launch threadsMax, // int threadsMax, // maximal number of threads to launch
updateStatus, // boolean updateStatus, updateStatus, // boolean updateStatus,
debugLevel); // int debugLevel) debugLevel); // int debugLevel)
if (debugLevel > -10) { if (debugLevel > 10) { // =================== change to -10 for test (single-scene)
quadCLTs[i].showDSIMain(); quadCLTs[i].showDSIMain();
quadCLTs[i].testAltCorr ( quadCLTs[i].testAltCorr (
clt_parameters, // CLTParameters clt_parameters, clt_parameters, // CLTParameters clt_parameters,
......
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