Commit 71ac4a10 authored by Andrey Filippov's avatar Andrey Filippov

Debugging preExpandCLTQuad3d() with 16-sensor LWIR setup

parent 7135cb85
......@@ -126,14 +126,14 @@ public class CLTParameters {
public double diff_sigma = 5.0; // RMS difference from average to reduce weights (~ 1.0 - 1/255 full scale image)
public double diff_threshold = 1.5; // RMS difference from average to discard channel (~ 1.0 - 1/255 full scale image)
public boolean diff_gauss = true; // when averaging images, use gaussian around average as weight (false - sharp all/nothing)
public boolean diff_gauss = true; // when averaging images, use Gaussian around average as weight (false - sharp all/nothing)
public double min_agree = 3.0; // minimal number of channels to agree on a point (real number to work with fuzzy averages)
public boolean dust_remove = true; // Do not reduce average weight when only one image differes much from the average
public boolean black_back = true; // use Black for backdrop outside of the FOV
public boolean keep_weights = true; // add port weights to RGBA stack (debug feature)
public boolean sharp_alpha = false; // combining mode for alpha channel: false - treat as RGB, true - apply center 8x8 only
public double alpha0 = 0.6; // > .525 Alpha channel 0.0 thereshold (lower - transparent) (watch for far objects)
public double alpha0 = 0.6; // > .525 Alpha channel 0.0 threshold (lower - transparent) (watch for far objects)
public double alpha1 = 0.8; // Alpha channel 1.0 threshold (higher - opaque) (watch for window dust)
public boolean gen_chn_stacks = false; // generate shifted channel rgb stacks
......@@ -345,7 +345,7 @@ public class CLTParameters {
public int min_clstr_seed = 4; //2; // number of tiles in a cluster to seed (just background?)
public int min_clstr_lone = 4; // number of tiles in a cluster not close to other clusters (more than 2 tiles apart)
public double min_clstr_weight = 0.0; // Minimal total strength of the cluster
public double min_clstr_max = 0.25; // Minimal maximal strength of the cluster
public double min_clstr_max = 0.18; // Minimal maximal strength of the cluster
public int fill_gaps = 4; // same as in grow - 1: 4 directions by 1 step, 2: 8 directions by 1 step. +2*n - alternating hor/vert
public int fill_final = 50; // same as fill_gaps, on the final pass
......
......@@ -57,8 +57,8 @@ public class CLTPass3d{
// exceeds minBgFract, otherwise proceed to the next one (and accumulate strength)
private double [] bgTileDisparity = null;
private double [] bgTileStrength = null;
public boolean [] border_tiles = null; // these are border tiles, zero out alpha
public boolean [] selected = null; // which tiles are selected for this layer
private boolean [] border_tiles = null; // these are border tiles, zero out alpha
private boolean [] selected = null; // which tiles are selected for this layer
public double [][][][] texture_tiles;
// 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
......
......@@ -455,10 +455,10 @@ public class Correlation2d {
HashSet<Integer> contrib_set = new HashSet<Integer>();
Iterator<Integer> contrib_itr;
for (int num_pair = ai.getAndIncrement(); num_pair < corr_pairs.length; num_pair = ai.getAndIncrement()) {
if (num_pair == 62) {
System.out.println("num_pair="+num_pair);
System.out.println("num_pair="+num_pair);
}
// if (num_pair == 62) {
// System.out.println("num_pair="+num_pair);
// System.out.println("num_pair="+num_pair);
// }
if (corr_pairs[num_pair]) {
resample_indices[num_pair] = new int [mcorr_comb_width * mcorr_comb_height][];
resample_weights[num_pair] = new double [mcorr_comb_width * mcorr_comb_height][];
......@@ -485,10 +485,10 @@ public class Correlation2d {
int ix = j - mcorr_comb_width/2;
Arrays.fill(contrib, 0.0);
contrib_set.clear();
if ((num_pair == 62) && (i==7) && (j==7)) {
System.out.println("num_pair="+num_pair+", i="+i+", j="+j);
System.out.println("num_pair="+num_pair+", i="+i+", j="+j);
}
// if ((num_pair == 62) && (i==7) && (j==7)) {
// System.out.println("num_pair="+num_pair+", i="+i+", j="+j);
// System.out.println("num_pair="+num_pair+", i="+i+", j="+j);
// }
for (int idy = 0; idy < weights_size; idy++) {
mxy.set(1, 0, iy+ (idy - SUB_SAMPLE + 1) * ksub); //idy == (SUB_SAMPLE -1) - no fractional pixel
......@@ -564,10 +564,10 @@ public class Correlation2d {
ArrayList<Integer> contrib_list = new ArrayList<Integer>();
ArrayList<Double> contrib_weights_list = new ArrayList<Double>();
for (int num_pair = ai.getAndIncrement(); num_pair < corr_pairs.length; num_pair = ai.getAndIncrement()) {
if (num_pair == 62) {
System.out.println("num_pair="+num_pair);
System.out.println("num_pair="+num_pair);
}
// if (num_pair == 62) {
// System.out.println("num_pair="+num_pair);
// System.out.println("num_pair="+num_pair);
// }
if (corr_pairs[num_pair]) {
resample_indices[num_pair] = new int [mcorr_comb_width * mcorr_comb_height][];
resample_weights[num_pair] = new double [mcorr_comb_width * mcorr_comb_height][];
......@@ -596,10 +596,10 @@ public class Correlation2d {
int iy = i + mcorr_comb_offset - mcorr_comb_height/2;
for (int j = 0; j < mcorr_comb_width; j++) {
int ix = j - mcorr_comb_width/2;
if ((num_pair == 62) && (i==7) && (j==7)) {
System.out.println("num_pair="+num_pair+", i="+i+", j="+j);
System.out.println("num_pair="+num_pair+", i="+i+", j="+j);
}
// if ((num_pair == 62) && (i==7) && (j==7)) {
// System.out.println("num_pair="+num_pair+", i="+i+", j="+j);
// System.out.println("num_pair="+num_pair+", i="+i+", j="+j);
// }
// convert +/- 1 pixel to pair
double minXPair = Double.NaN,minYPair = Double.NaN, maxXPair = Double.NaN, maxYPair = Double.NaN;
for (int d = 0; d < four_corners.length; d++) {
......@@ -676,10 +676,10 @@ public class Correlation2d {
mxy.set(0, 0, ix);
mxy.set(1, 0, iy);
double [] xy_pair = toPair.times(mxy).getColumnPackedCopy();
if ((num_pair == 62) && (i==7) && (j==7)) {
System.out.println("num_pair="+num_pair+", i="+i+", j="+j);
System.out.println("num_pair="+num_pair+", i="+i+", j="+j);
}
// if ((num_pair == 62) && (i==7) && (j==7)) {
// System.out.println("num_pair="+num_pair+", i="+i+", j="+j);
// System.out.println("num_pair="+num_pair+", i="+i+", j="+j);
// }
// find 4 corners in the pair array
if ( (xy_pair[0] >= (1 - transform_size)) &&
(xy_pair[0] <= (transform_size - 1)) &&
......
......@@ -114,8 +114,9 @@ public class ImageDtt extends ImageDttCPU {
//gpuQuad
final boolean debug_distort= globalDebugLevel > 0; ///false; // true;
final double [][] debug_offsets = new double[imgdtt_params.lma_dbg_offset.length][2];
for (int i = 0; i < debug_offsets.length; i++) for (int j = 0; j < debug_offsets[i].length; j++) {
// final double [][] debug_offsets = new double[imgdtt_params.lma_dbg_offset.length][2];
final double [][] debug_offsets = new double[getNumSensors()][2];
for (int i = 0; i < imgdtt_params.lma_dbg_offset.length; i++) for (int j = 0; j < debug_offsets[i].length; j++) {
debug_offsets[i][j] = imgdtt_params.lma_dbg_offset[i][j]*imgdtt_params.lma_dbg_scale;
}
......@@ -929,8 +930,9 @@ public class ImageDtt extends ImageDttCPU {
//gpuQuad
final boolean debug_distort= globalDebugLevel > 0; ///false; // true;
final double [][] debug_offsets = new double[imgdtt_params.lma_dbg_offset.length][2];
for (int i = 0; i < debug_offsets.length; i++) for (int j = 0; j < debug_offsets[i].length; j++) {
// final double [][] debug_offsets = new double[imgdtt_params.lma_dbg_offset.length][2];
final double [][] debug_offsets = new double[getNumSensors()][2];
for (int i = 0; i < imgdtt_params.lma_dbg_offset.length; i++) for (int j = 0; j < debug_offsets[i].length; j++) {
debug_offsets[i][j] = imgdtt_params.lma_dbg_offset[i][j]*imgdtt_params.lma_dbg_scale;
}
......@@ -1617,8 +1619,9 @@ public class ImageDtt extends ImageDttCPU {
//gpuQuad
final boolean debug_distort= globalDebugLevel > 0; ///false; // true;
final double [][] debug_offsets = new double[imgdtt_params.lma_dbg_offset.length][2];
for (int i = 0; i < debug_offsets.length; i++) for (int j = 0; j < debug_offsets[i].length; j++) {
// final double [][] debug_offsets = new double[imgdtt_params.lma_dbg_offset.length][2];
final double [][] debug_offsets = new double[getNumSensors()][2];
for (int i = 0; i < imgdtt_params.lma_dbg_offset.length; i++) for (int j = 0; j < debug_offsets[i].length; j++) {
debug_offsets[i][j] = imgdtt_params.lma_dbg_offset[i][j]*imgdtt_params.lma_dbg_scale;
}
//dbg_pair_mask
......@@ -1967,8 +1970,9 @@ public class ImageDtt extends ImageDttCPU {
//gpuQuad
final boolean debug_distort= globalDebugLevel > 0; ///false; // true;
final double [][] debug_offsets = new double[imgdtt_params.lma_dbg_offset.length][2];
for (int i = 0; i < debug_offsets.length; i++) for (int j = 0; j < debug_offsets[i].length; j++) {
// final double [][] debug_offsets = new double[imgdtt_params.lma_dbg_offset.length][2];
final double [][] debug_offsets = new double[getNumSensors()][2];
for (int i = 0; i < imgdtt_params.lma_dbg_offset.length; i++) for (int j = 0; j < debug_offsets[i].length; j++) {
debug_offsets[i][j] = imgdtt_params.lma_dbg_offset[i][j]*imgdtt_params.lma_dbg_scale;
}
//dbg_pair_mask
......
......@@ -1705,8 +1705,9 @@ public class ImageDttCPU {
final boolean debug_distort= (globalDebugLevel >0); // .false; // true;
// final double [][] debug_offsets = null;
//lma_dbg_scale
final double [][] debug_offsets = new double[imgdtt_params.lma_dbg_offset.length][2];
for (int i = 0; i < debug_offsets.length; i++) for (int j = 0; j < debug_offsets[i].length; j++) {
// final double [][] debug_offsets = new double[imgdtt_params.lma_dbg_offset.length][2];
final double [][] debug_offsets = new double[getNumSensors()][2];
for (int i = 0; i < imgdtt_params.lma_dbg_offset.length; i++) for (int j = 0; j < debug_offsets[i].length; j++) {
debug_offsets[i][j] = imgdtt_params.lma_dbg_offset[i][j]*imgdtt_params.lma_dbg_scale;
}
......@@ -2563,8 +2564,9 @@ public class ImageDttCPU {
final int globalDebugLevel)
{
final boolean debug_distort= (globalDebugLevel >0); // .false; // true;
final double [][] debug_offsets = new double[imgdtt_params.lma_dbg_offset.length][2];
for (int i = 0; i < debug_offsets.length; i++) for (int j = 0; j < debug_offsets[i].length; j++) {
// final double [][] debug_offsets = new double[imgdtt_params.lma_dbg_offset.length][2];
final double [][] debug_offsets = new double[getNumSensors()][2];
for (int i = 0; i < imgdtt_params.lma_dbg_offset.length; i++) for (int j = 0; j < debug_offsets[i].length; j++) {
debug_offsets[i][j] = imgdtt_params.lma_dbg_offset[i][j]*imgdtt_params.lma_dbg_scale;
}
......@@ -3205,8 +3207,10 @@ public class ImageDttCPU {
final double [][][][] clt_combo_dbg, // generate sparse partial rotated/scaled pairs
// When clt_mismatch is non-zero, no far objects extraction will be attempted
// clt_mismatch is used in older code, not supported in GPU - there is cltMeasureLazyEye for that purpose
// this.correlation2d should be not null if disparity_map != null
final double [][] disparity_map, // [8][tilesY][tilesX], only [6][] is needed on input or null - do not calculate
// last 2 - contrast, avg/ "geometric average)
final double [][][][] texture_tiles, // [tilesY][tilesX]["RGBA".length()][]; null - will skip images combining
final int width,
final double corr_fat_zero, // add to denominator to modify phase correlation (same units as data1, data2). <0 - pure sum
......@@ -3322,8 +3326,9 @@ public class ImageDttCPU {
}
final boolean [][] combo_sels = pcombo_sels;
final boolean debug_distort= globalDebugLevel > 0; ///false; // true;
final double [][] debug_offsets = new double[imgdtt_params.lma_dbg_offset.length][2];
for (int i = 0; i < debug_offsets.length; i++) for (int j = 0; j < debug_offsets[i].length; j++) {
// final double [][] debug_offsets = new double[imgdtt_params.lma_dbg_offset.length][2];
final double [][] debug_offsets = new double[getNumSensors()][2];
for (int i = 0; i < imgdtt_params.lma_dbg_offset.length; i++) for (int j = 0; j < debug_offsets[i].length; j++) {
debug_offsets[i][j] = imgdtt_params.lma_dbg_offset[i][j]*imgdtt_params.lma_dbg_scale;
}
......@@ -3848,7 +3853,7 @@ public class ImageDttCPU {
double extra_disparity = 0.0; // used for textures: if allowed, shift images extra before trying to combine
// fill clt_corr_combo if it exists
if (disparity_map != null){ // not null - calculate correlations
if (disparity_map != null){ // not null - calculate correlations
for (int i = 0; i < disparity_map.length; i++) {
if (disparity_map[i] != null) disparity_map[i][nTile] = (
(i == DISPARITY_STRENGTH_INDEX) ||
......@@ -4112,12 +4117,16 @@ public class ImageDttCPU {
}
}
// iclt here: [quad][color][256]
if ((globalDebugLevel > 0) && debugTile) {
if ((globalDebugLevel > 0) && debugTile0) {
ShowDoubleFloatArrays sdfa_instance = new ShowDoubleFloatArrays(); // just for debugging?
String [] titles = {"red0","blue0","green0","red1","blue1","green1","red2","blue2","green2","red3","blue3","green3"};
String [] col_names= {"red","blue","green"};
String [] titles = new String[numSensors * numcol];
// String [] titles = {"red0","blue0","green0","red1","blue1","green1","red2","blue2","green2","red3","blue3","green3"};
double [][] dbg_tile = new double [numSensors*numcol][];
for (int i = 0; i < numSensors; i++) {
for (int ncol = 0; ncol <numcol; ncol++) if (iclt_tile[i][ncol] != null) { // color
String col_name = (ncol < col_names.length)?col_names[ncol]:("c<"+ncol+">");
titles[i * numcol + ncol] = col_name + i;
dbg_tile[i * numcol + ncol] = iclt_tile[i][ncol];
}
}
......@@ -4145,12 +4154,16 @@ public class ImageDttCPU {
}
}
}
if ((globalDebugLevel > 0) && debugTile) {
if ((globalDebugLevel > 0) && debugTile0) {
ShowDoubleFloatArrays sdfa_instance = new ShowDoubleFloatArrays(); // just for debugging?
String [] titles = {"red0","blue0","green0","red1","blue1","green1","red2","blue2","green2","red3","blue3","green3"};
String [] col_names= {"red","blue","green"};
String [] titles = new String[numSensors * numcol];
double [][] dbg_tile = new double [numSensors*numcol][];
for (int i = 0; i < numSensors; i++) {
for (int chn = 0; chn <numcol; chn++) { // color
String col_name = (chn< col_names.length)?col_names[chn]:("c<"+chn+">");
titles[i * numcol + chn] = col_name + i;
dbg_tile[i * numcol + chn] = tiles_debayered[i][chn];
}
}
......@@ -4182,7 +4195,10 @@ public class ImageDttCPU {
(globalDebugLevel > 0) && debugTile,
false); // boolean debug_gpu) // generate output fro matching with GPU processing
if ((globalDebugLevel > 0) && debugTile0) {
ShowDoubleFloatArrays sdfa_instance = new ShowDoubleFloatArrays(); // just for debugging?
sdfa_instance.showArrays(texture_tiles[tileY][tileX], 2* transform_size, 2* transform_size, true, "tile_combine_rgba_x"+tileX+"_y"+tileY);
}
// mix RGB from iclt_tile, mix alpha with - what? correlation strength or 'don't care'? good correlation or all > min?
for (int i = 0; i < iclt_tile[0][first_color].length; i++ ) {
double sw = 0.0;
......@@ -4197,6 +4213,10 @@ public class ImageDttCPU {
}
}
}
if ((globalDebugLevel > 0) && debugTile0) { // same as previous for mono
ShowDoubleFloatArrays sdfa_instance = new ShowDoubleFloatArrays(); // just for debugging?
sdfa_instance.showArrays(texture_tiles[tileY][tileX], 2* transform_size, 2* transform_size, true, "tile_mixed_rgba_x"+tileX+"_y"+tileY);
}
if ((disparity_map != null) && (disparity_map.length >= (IMG_DIFF0_INDEX + numSensors))){
for (int i = 0; i < max_diff.length; i++){
disparity_map[IMG_DIFF0_INDEX + i][tIndex] = max_diff[i];
......@@ -6702,8 +6722,9 @@ public class ImageDttCPU {
final boolean [][] saturation_imp = quadCLT.saturation_imp; // boolean [][] saturation_imp, // (near) saturated pixels or null
final boolean debug_distort= globalDebugLevel > 0; ///false; // true;
final double [][] debug_offsets = new double[imgdtt_params.lma_dbg_offset.length][2];
for (int i = 0; i < debug_offsets.length; i++) for (int j = 0; j < debug_offsets[i].length; j++) {
// final double [][] debug_offsets = new double[imgdtt_params.lma_dbg_offset.length][2];
final double [][] debug_offsets = new double[quadCLT.getNumSensors()][2];
for (int i = 0; i < imgdtt_params.lma_dbg_offset.length; i++) for (int j = 0; j < debug_offsets[i].length; j++) {
debug_offsets[i][j] = imgdtt_params.lma_dbg_offset[i][j]*imgdtt_params.lma_dbg_scale;
}
final int quad = 4; // number of subcameras
......@@ -12682,8 +12703,9 @@ public class ImageDttCPU {
final boolean debug_distort= globalDebugLevel > 0; ///false; // true;
final double [][] debug_offsets = new double[imgdtt_params.lma_dbg_offset.length][2];
for (int i = 0; i < debug_offsets.length; i++) for (int j = 0; j < debug_offsets[i].length; j++) {
// final double [][] debug_offsets = new double[imgdtt_params.lma_dbg_offset.length][2];
final double [][] debug_offsets = new double[getNumSensors()][2];
for (int i = 0; i < imgdtt_params.lma_dbg_offset.length; i++) for (int j = 0; j < debug_offsets[i].length; j++) {
debug_offsets[i][j] = imgdtt_params.lma_dbg_offset[i][j]*imgdtt_params.lma_dbg_scale;
}
......
......@@ -220,7 +220,11 @@ public class ImageDttParameters {
public boolean corr_var_cam = true; // New correlation mode compatible with 8 subcameras
public double cm_max_normalization = 0.55; // fraction of correlation maximum radius, being squared multiplied by maximum to have the same total mass
public double lma_dbg_scale = 0.0; // scale lma_dbg_offset
public double [][] lma_dbg_offset = {{ 1.0, 0.0},{ -1.0, 0.0},{-1.0, 0.0},{ 1.0, 0.0}}; // new double [4][2];
public double [][] lma_dbg_offset = {
{ 1.0, 0.0},
{ -1.0, 0.0},
{ -1.0, 0.0},
{ 1.0, 0.0}}; // new double [4][2];
public double getCorrSigma(boolean monochrome) {
return monochrome ? pcorr_sigma_mono : pcorr_sigma;
......
......@@ -2047,7 +2047,7 @@ public class QuadCLT extends QuadCLTCPU {
is_mono,
is_lwir,
clt_parameters.getScaleStrength(isAux())); // 1.0);
image_dtt.getCorrelation2d(); // initiate image_dtt.correlation2d, needed if disparity_map != null
float [][] lpf_rgb = new float[][] {
image_dtt.floatGetCltLpfFd(clt_parameters.gpu_sigma_r),
image_dtt.floatGetCltLpfFd(clt_parameters.gpu_sigma_b),
......@@ -2312,6 +2312,7 @@ public class QuadCLT extends QuadCLTCPU {
is_mono,
is_lwir,
1.0);
image_dtt.getCorrelation2d(); // initiate image_dtt.correlation2d, needed if disparity_map != null
float [][] lpf_rgb = new float[][] {
image_dtt.floatGetCltLpfFd(clt_parameters.gpu_sigma_r),
image_dtt.floatGetCltLpfFd(clt_parameters.gpu_sigma_b),
......@@ -3034,6 +3035,7 @@ public class QuadCLT extends QuadCLTCPU {
isLwir(),
clt_parameters.getScaleStrength(isAux()),
gpuQuad);
image_dtt.getCorrelation2d(); // initiate image_dtt.correlation2d, needed if disparity_map != null
double z_correction = clt_parameters.z_correction;
if (clt_parameters.z_corr_map.containsKey(image_name)){ // not used in lwir
z_correction +=clt_parameters.z_corr_map.get(image_name);
......@@ -3177,7 +3179,7 @@ public class QuadCLT extends QuadCLTCPU {
final int tilesX = tp.getTilesX();
final int tilesY = tp.getTilesY();
CLTPass3d bgnd_data = tp.clt_3d_passes.get(0);
boolean [] bgnd_tiles_grown2 = bgnd_data.selected.clone(); // only these have non 0 alpha
boolean [] bgnd_tiles_grown2 = bgnd_data.getSelected().clone(); // only these have non 0 alpha
tp.growTiles(
2, // grow tile selection by 1 over non-background tiles 1: 4 directions, 2 - 8 directions, 3 - 8 by 1, 4 by 1 more
bgnd_tiles_grown2,
......@@ -3291,6 +3293,7 @@ public class QuadCLT extends QuadCLTCPU {
isLwir(),
clt_parameters.getScaleStrength(isAux()),
gpuQuad);
image_dtt.getCorrelation2d(); // initiate image_dtt.correlation2d, needed if disparity_map != null
double z_correction = clt_parameters.z_correction;
if (clt_parameters.z_corr_map.containsKey(image_name)){ // not used in lwir
z_correction +=clt_parameters.z_corr_map.get(image_name);
......@@ -3433,6 +3436,7 @@ public class QuadCLT extends QuadCLTCPU {
isLwir(),
clt_parameters.getScaleStrength(isAux()),
gpuQuad);
image_dtt.getCorrelation2d(); // initiate image_dtt.correlation2d, needed if disparity_map != null
// double z_correction = clt_parameters.z_correction;
// if (clt_parameters.z_corr_map.containsKey(image_name)){ // not used in lwir
// z_correction +=clt_parameters.z_corr_map.get(image_name);
......@@ -3561,6 +3565,7 @@ public class QuadCLT extends QuadCLTCPU {
isLwir(),
clt_parameters.getScaleStrength(isAux()),
gpuQuad);
image_dtt.getCorrelation2d(); // initiate image_dtt.correlation2d, needed if disparity_map != null
GPUTileProcessor.TpTask[] tp_tasks = gpuQuad.setInterTasks(
pXpYD, // final double [][] pXpYD, // per-tile array of pX,pY,disparity triplets (or nulls)
geometryCorrection, // final GeometryCorrection geometryCorrection,
......@@ -4162,6 +4167,7 @@ public class QuadCLT extends QuadCLTCPU {
isLwir(),
clt_parameters.getScaleStrength(isAux()),
gpuQuad);
image_dtt.getCorrelation2d(); // initiate image_dtt.correlation2d, needed if disparity_map != null
double z_correction = clt_parameters.z_correction;
if (clt_parameters.z_corr_map.containsKey(image_name)){ // not used in lwir
z_correction +=clt_parameters.z_corr_map.get(image_name);
......@@ -4417,7 +4423,7 @@ public class QuadCLT extends QuadCLTCPU {
texture_woi_pix.y/transform_size,
texture_woi_pix.width/transform_size,
texture_woi_pix.height/transform_size);
scan.selected = scan.getTextureSelection().clone(); // null
scan.setSelected(scan.getTextureSelection().clone()); // null
ImagePlus imp_texture_cluster = linearStackToColor(
clt_parameters,
colorProcParameters,
......@@ -4624,6 +4630,7 @@ public class QuadCLT extends QuadCLTCPU {
isLwir(),
clt_parameters.getScaleStrength(isAux()),
gpuQuad);
image_dtt.getCorrelation2d(); // initiate image_dtt.correlation2d, needed if disparity_map != null
double z_correction = clt_parameters.z_correction;
if (clt_parameters.z_corr_map.containsKey(image_name)){ // not used in lwir
z_correction +=clt_parameters.z_corr_map.get(image_name);
......@@ -4744,6 +4751,7 @@ public class QuadCLT extends QuadCLTCPU {
isLwir(),
clt_parameters.getScaleStrength(isAux()),
gpuQuad);
image_dtt.getCorrelation2d(); // initiate image_dtt.correlation2d, needed if disparity_map != null
double z_correction = clt_parameters.z_correction;
if (clt_parameters.z_corr_map.containsKey(image_name)){ // not used in lwir
z_correction +=clt_parameters.z_corr_map.get(image_name);
......@@ -4935,14 +4943,17 @@ public class QuadCLT extends QuadCLTCPU {
}
}
double min_corr_selected = clt_parameters.min_corr;
double [][] shiftXY = new double [4][2];
if (!clt_parameters.fine_corr_ignore) {
double [][] shiftXY = new double [getNumSensors()][2];
if (!clt_parameters.fine_corr_ignore) {// invalid for AUX!
double [][] shiftXY0 = {
{clt_parameters.fine_corr_x_0,clt_parameters.fine_corr_y_0},
{clt_parameters.fine_corr_x_1,clt_parameters.fine_corr_y_1},
{clt_parameters.fine_corr_x_2,clt_parameters.fine_corr_y_2},
{clt_parameters.fine_corr_x_3,clt_parameters.fine_corr_y_3}};
shiftXY = shiftXY0;
// FIXME - only first 4 sensors have correction. And is it the same for aux and main?
for (int i = 0; i < shiftXY0.length;i++) {
shiftXY[i] = shiftXY0[i];
}
}
ImageDtt image_dtt = new ImageDtt(
......@@ -4953,6 +4964,8 @@ public class QuadCLT extends QuadCLTCPU {
isLwir(),
clt_parameters.getScaleStrength(isAux()),
gpuQuad);
image_dtt.getCorrelation2d(); // initiate image_dtt.correlation2d, needed if disparity_map != null
double z_correction = clt_parameters.z_correction;
if (clt_parameters.z_corr_map.containsKey(image_name)){ // not used in lwir
z_correction +=clt_parameters.z_corr_map.get(image_name);
......
This source diff could not be displayed because it is too large. You can view the blob instead.
......@@ -3072,11 +3072,11 @@ ImageDtt.startAndJoin(threads);
// double [] dbg_disparity = scan.getDisparity().clone(); // to modify in-place **** remove clone after debugged ****
boolean [] these_no_border = new boolean [tlen];
for (int i = 0; i < these_no_border.length; i++) {
these_no_border[i] = last_scan.selected[i] && !last_scan.border_tiles[i];
these_no_border[i] = last_scan.getSelected()[i] && !last_scan.getBorderTiles()[i]; // selected
}
boolean [] dbg_last_selected = last_scan.selected.clone();
boolean [] dbg_last_border = last_scan.border_tiles.clone();
boolean [] dbg_last_selected = last_scan.getSelected().clone(); // selected
boolean [] dbg_last_border = last_scan.getBorderTiles().clone();
@SuppressWarnings("unused")
boolean [] dbg_no_border = these_no_border.clone();
......@@ -3084,7 +3084,7 @@ ImageDtt.startAndJoin(threads);
// known are background or these tiles
if (bg_scan != null) {
for (int i = 0; i < known_tiles.length; i++) {
known_tiles[i] |= bg_scan.selected[i];
known_tiles[i] |= bg_scan.getSelected()[i]; // selected
}
}
// set combo disparity from last prepared
......@@ -3166,7 +3166,8 @@ ImageDtt.startAndJoin(threads);
// if ((last_scan.selected == null) || (expanded == null) || (disparity == null)) {
// System.out.println( " BUG in setupExpand()");
// } else {
selected[nTile] = (last_scan.selected[nTile] || expanded[nTile]) && !Double.isNaN(disparity[nTile]); // selected by refine and new java.lang.NullPointerException
/// selected[nTile] = (last_scan.selected[nTile] || expanded[nTile]) && !Double.isNaN(disparity[nTile]); // selected by refine and new java.lang.NullPointerException
selected[nTile] = (last_scan.getSelected()[nTile] || expanded[nTile]) && !Double.isNaN(disparity[nTile]); // selected by refine and new java.lang.NullPointerException
border[nTile] = selected[nTile] && !known_tiles[nTile];
// }
}
......@@ -3272,18 +3273,21 @@ ImageDtt.startAndJoin(threads);
double [] disparity = scan.getDisparity(); // to modify in-place
boolean [] these_no_border = new boolean [tlen];
for (int i = 0; i < these_no_border.length; i++) {
these_no_border[i] = last_scan.selected[i] && !last_scan.border_tiles[i];
// these_no_border[i] = last_scan.selected[i] && !last_scan.border_tiles[i];
these_no_border[i] = last_scan.getSelected()[i] && !last_scan.getBorderTiles()[i];
}
boolean [] dbg_last_selected = last_scan.selected.clone();
boolean [] dbg_last_border = last_scan.border_tiles.clone();
// boolean [] dbg_last_selected = last_scan.selected.clone();
boolean [] dbg_last_selected = last_scan.getSelected().clone();
boolean [] dbg_last_border = last_scan.getBorderTiles().clone();
boolean [] dbg_no_border = these_no_border.clone();
boolean [] known_tiles = these_no_border.clone();
// known are background or these tiles
if (bg_scan != null) {
for (int i = 0; i < known_tiles.length; i++) {
known_tiles[i] |= bg_scan.selected[i];
// known_tiles[i] |= bg_scan.selected[i];
known_tiles[i] |= bg_scan.getSelected()[i];
}
}
// set combo disparity from last prepared
......@@ -3313,7 +3317,8 @@ ImageDtt.startAndJoin(threads);
/// if (!grow_retry_inf && (bg_scan == null)){ // FIXME: BUG bg_scan == null here!
if (!grow_retry_inf && (bg_scan != null)){ // FIXME: BUG bg_scan == null here!
for (int i = 0; i < untested_bgnd.length; i++) {
if (bg_scan.selected[i]) untested_bgnd[i] = false;
// if (bg_scan.selected[i]) untested_bgnd[i] = false;
if (bg_scan.getSelected()[i]) untested_bgnd[i] = false;
}
}
// turn these tiles as if they are not known (really known or belong to bgnd)
......@@ -3453,8 +3458,9 @@ ImageDtt.startAndJoin(threads);
}
return 0;
}
scan.selected = grown;
scan.border_tiles = border;
// scan.selected = grown;
scan.setSelected(grown);
scan.setBorderTiles (border);
scan.disparity = new double [tilesY][tilesX];
scan.tile_op = new int [tilesY][tilesX];
int op = ImageDtt.setImgMask(0, 0xf);
......@@ -3466,7 +3472,8 @@ ImageDtt.startAndJoin(threads);
for (int ty = 0; ty < tilesY; ty++) for (int tx = 0; tx <tilesX; tx++){
int indx = tilesX * ty + tx;
if (scan.selected[indx]) {
// if (scan.selected[indx]) {
if (scan.getSelected()[indx]) {
scan.disparity[ty][tx] = disparity[indx];
scan.tile_op[ty][tx] = op;
num_op_tiles ++;
......@@ -3510,10 +3517,13 @@ ImageDtt.startAndJoin(threads);
dbg_img[0][i] = scan.max_tried_disparity[ty][tx];
dbg_img[2][i] = scan.disparity[ty][tx];
dbg_img[3][i] = strength[i];
if (bg_scan != null) dbg_img[4][i] = ((bg_scan.selected != null) && (bg_scan.selected[i]))? boolean_val:0.0 ;
dbg_img[5][i] = ((last_scan.selected != null) && (last_scan.selected[i]))? boolean_val:0.0 ;
// if (bg_scan != null) dbg_img[4][i] = ((bg_scan.selected != null) && (bg_scan.selected[i]))? boolean_val:0.0 ;
if (bg_scan != null) dbg_img[4][i] = ((bg_scan.getSelected() != null) && (bg_scan.getSelected()[i]))? boolean_val:0.0 ;
// dbg_img[5][i] = ((last_scan.selected != null) && (last_scan.selected[i]))? boolean_val:0.0 ;
dbg_img[5][i] = ((last_scan.getSelected() != null) && (last_scan.getSelected()[i]))? boolean_val:0.0 ;
dbg_img[6][i] = 0.05 * (dbg_img[4][i] + dbg_img[5][i]);
dbg_img[7][i] = (scan.selected[i]?4:0)+ (scan.border_tiles[i]?8:0);
// dbg_img[7][i] = (scan.selected[i]?4:0)+ (scan.border_tiles[i]?8:0);
dbg_img[7][i] = (scan.getSelected()[i]?4:0)+ (scan.getBorderTiles()[i]?8:0);
dbg_img[8][i] = (dbg_last_selected[i]?4:0)+ (dbg_last_border[i]?8:0);
dbg_img[9][i] = dbg_no_border[i]?boolean_val:0;
......@@ -3794,12 +3804,14 @@ ImageDtt.startAndJoin(threads);
double [][] dbg_img = new double[NUM_SLICES][];
if (scan.tile_op != null) dbg_img[i_tile_op] = new double[tlen];
if (scan.disparity != null) dbg_img[i_disparity] = new double[tlen];
if (scan.selected != null) dbg_img[i_selection] = new double[tlen];
if (scan.border_tiles != null) dbg_img[i_border_tiles] = new double[tlen];
if (scan.getSelected() != null) dbg_img[i_selection] = new double[tlen];
if (scan.getBorderTiles() != null) dbg_img[i_border_tiles] = new double[tlen];
if (scan.max_tried_disparity != null) dbg_img[i_max_tried] = new double[tlen];
// if (ly_force != null) dbg_img[ly_force_indx] = new double[tlen];
boolean [] gotSelected = scan.getSelected();
boolean [] gotBorderTiles = scan.getBorderTiles();
for (int ty = 0; ty < tilesY; ty++) for (int tx = 0; tx < tilesX; tx++){
int nt = ty*tilesX + tx;
if (scan.tile_op != null) {
......@@ -3807,8 +3819,9 @@ ImageDtt.startAndJoin(threads);
measured[nt] = scan.tile_op[ty][tx] > 0;
}
if (scan.disparity != null) dbg_img[i_disparity] [nt] = scan.disparity[ty][tx];
if (scan.selected != null) dbg_img[i_selection] [nt] = scan.selected[nt]? 1.0:0.0;
if (scan.border_tiles != null) dbg_img[i_border_tiles][nt] = scan.border_tiles[nt]? 1.0:0.0;
// if (scan.selected != null) dbg_img[i_selection] [nt] = scan.selected[nt]? 1.0:0.0;
if (gotSelected != null) dbg_img[i_selection] [nt] = gotSelected[nt]? 1.0:0.0;
if (gotBorderTiles != null) dbg_img[i_border_tiles][nt] = gotBorderTiles[nt]? 1.0:0.0;
if (scan.max_tried_disparity != null) dbg_img[i_max_tried] [nt] = scan.max_tried_disparity[ty][tx];
// if (ly_force != null) dbg_img[ly_force_indx][nt] = ly_force[nt]? 1.0:0.0;
}
......@@ -3850,7 +3863,7 @@ ImageDtt.startAndJoin(threads);
}
}
if (dbg_img[this_IMG_TONE_RGB] != null) {
for (int np = 0; np < 4; np++) {
for (int np = 0; np < numSensors; np++) {
dbg_img[this_IMG_TONE_RGB_Y+np] = new double [tlen];
dbg_img[this_IMG_TONE_RGB_DIFF+np] = new double [tlen];
for (int i = 0; i < tlen; i++){
......@@ -3891,13 +3904,14 @@ ImageDtt.startAndJoin(threads);
boolean [] bgnd_tiles = new boolean [tilesY * tilesX];
boolean [] nonbgnd_tiles = new boolean [tilesY * tilesX];
boolean [] block_propagate = new boolean [tilesY * tilesX];
int quad = 4;
// int quad = 4;
ShowDoubleFloatArrays sdfa_instance = null;
if (debugLevel > -1)
sdfa_instance = new ShowDoubleFloatArrays(); // just for debugging?
CLTPass3d bgnd_data = clt_3d_passes.get(0);
double [][] disparity_map= bgnd_data.disparity_map;
int [] dbg_numtile = new int [2];
for (int tileY = 0; tileY < tilesY; tileY++){
for (int tileX = 0; tileX < tilesX; tileX++){
int tindx = tileY * tilesX + tileX;
......@@ -3905,26 +3919,32 @@ ImageDtt.startAndJoin(threads);
if (Math.abs(disparity_map[disparity_index][tindx]) < bgnd_range){
if (disparity_map[ImageDtt.DISPARITY_STRENGTH_INDEX][tindx] >= bgnd_sure){
bgnd_tiles[tindx] = true;
dbg_numtile[0]++;
}
} else {
if (disparity_map[ImageDtt.DISPARITY_STRENGTH_INDEX][tindx] > bgnd_maybe){ // maybe non-bkgnd
if (disparity_map[disparity_index][tindx] > 0.0) { // disregard negative disparity points
nonbgnd_tiles[tindx] = true;
dbg_numtile[1]++;
}
}
}
// see if the second worst variation exceeds sure_smth (like a window), really close object
int imax1 = 0;
for (int i = 1; i< quad; i++){
for (int i = 1; i< getNumSensors(); i++){
if (disparity_map[ImageDtt.IMG_DIFF0_INDEX+i][tindx] > disparity_map[ImageDtt.IMG_DIFF0_INDEX + imax1][tindx]) imax1 = i;
}
int imax2 = (imax1 == 0)? 1 : 0;
for (int i = 0; i< quad; i++) if (i != imax1) {
for (int i = 0; i< getNumSensors(); i++) if (i != imax1) {
if (disparity_map[ImageDtt.IMG_DIFF0_INDEX+i][tindx] > disparity_map[ImageDtt.IMG_DIFF0_INDEX + imax2][tindx]) imax2 = i;
}
block_propagate[tindx] = (disparity_map[ImageDtt.IMG_DIFF0_INDEX + imax2][tindx] > sure_smth);
}
}
if (debugLevel > -1) {
System.out.println("Before removing small clusters: number of background tiles = "+dbg_numtile[0]+", non-bgnd tiles = "+dbg_numtile[1]);
}
// TODO: check if minimal cluster strength should be limited here
if (min_clstr_seed > 1){
removeSmallClusters(
......@@ -3945,6 +3965,14 @@ ImageDtt.startAndJoin(threads);
0.0, //clt_parameters.min_clstr_weight, // double min_weight // minimal total weight of the cluster
0.0); // clt_parameters.min_clstr_max); // double min_max_weight // minimal value of the maximal strengh in the cluster
}
if (debugLevel > -1+0) {
dbg_numtile = new int [2];
for (int tindx = 0; tindx < bgnd_tiles.length; tindx++) {
if (bgnd_tiles[tindx]) dbg_numtile[0]++;
if (nonbgnd_tiles[tindx]) dbg_numtile[1]++;
}
System.out.println("After removing small clusters: number of background tiles = "+dbg_numtile[0]+", non-bgnd tiles = "+dbg_numtile[1]);
}
if ((sdfa_instance != null) && show_bgnd_nonbgnd) {
String [] titles = {"bgnd","nonbgnd","block","strength","disparity"};
......@@ -4032,7 +4060,7 @@ ImageDtt.startAndJoin(threads);
boolean [] bgnd_tiles = new boolean [tilesY * tilesX];
boolean [] nonbgnd_tiles = new boolean [tilesY * tilesX];
boolean [] block_propagate = new boolean [tilesY * tilesX];
int quad = 4;
// int quad = 4;
ShowDoubleFloatArrays sdfa_instance = null;
if (debugLevel > -1)
sdfa_instance = new ShowDoubleFloatArrays(); // just for debugging?
......@@ -4063,7 +4091,7 @@ ImageDtt.startAndJoin(threads);
int imax1 = 0;
double worst1 = 0.0;
// modified to look around for the 1-st maximum
for (int i = 1; i< quad; i++){
for (int i = 1; i< getNumSensors(); i++){
// if (disparity_map[ImageDtt.IMG_DIFF0_INDEX+i][tindx] > disparity_map[ImageDtt.IMG_DIFF0_INDEX + imax1][tindx]){
if (disparity_map[ImageDtt.IMG_DIFF0_INDEX+i][tindx] > worst1){
imax1 = i;
......@@ -4080,7 +4108,7 @@ ImageDtt.startAndJoin(threads);
}
}
int imax2 = (imax1 == 0)? 1 : 0;
for (int i = 0; i< quad; i++) if (i != imax1) {
for (int i = 0; i< getNumSensors(); i++) if (i != imax1) {
if (disparity_map[ImageDtt.IMG_DIFF0_INDEX+i][tindx] > disparity_map[ImageDtt.IMG_DIFF0_INDEX + imax2][tindx]) imax2 = i;
}
dbg_worst2[tindx] = disparity_map[ImageDtt.IMG_DIFF0_INDEX + imax2][tindx];
......@@ -4186,7 +4214,7 @@ ImageDtt.startAndJoin(threads);
}
}
// was not in tghe original
// was not in the original
tnSurface.growSelection(
4, // grow,
bgnd_tiles, // tiles,
......@@ -4365,7 +4393,7 @@ ImageDtt.startAndJoin(threads);
CLTPass3d scan_next =new CLTPass3d(this);
scan_next.disparity = disparityTask;
scan_next.tile_op = tile_op;
scan_next.border_tiles = borderTiles;
scan_next.setBorderTiles (borderTiles);
scan_next.dbg_index = ncl; // matching overlapClusters[]
clt_3d_passes.add(scan_next);
......@@ -4389,7 +4417,7 @@ ImageDtt.startAndJoin(threads);
for (int tx = 0; tx < tilesX; tx++){
int indx = ty*tilesX + tx;
if (dbg_scan.tile_op[ty][tx] !=0){
if (dbg_scan.border_tiles[indx]) {
if (dbg_scan.getBorderTiles()[indx]) {
dbg_shells[ns][indx] = 0.5*ampl;
} else {
dbg_shells[ns][indx] = 1.0*ampl;
......@@ -4638,7 +4666,7 @@ ImageDtt.startAndJoin(threads);
CLTPass3d scan_next =new CLTPass3d(this);
scan_next.disparity = disparityTask;
scan_next.tile_op = tile_op;
scan_next.border_tiles = borderTiles;
scan_next.setBorderTiles (borderTiles);
clt_3d_passes.add(scan_next);
numClusters++;
}
......@@ -4747,7 +4775,7 @@ ImageDtt.startAndJoin(threads);
CLTPass3d scan_next =new CLTPass3d(this);
scan_next.disparity = disparityTask;
scan_next.tile_op = tile_op;
scan_next.border_tiles = borderTiles;
scan_next.setBorderTiles (borderTiles);
clt_3d_passes.add(scan_next);
numClusters++;
}
......@@ -5291,7 +5319,7 @@ ImageDtt.startAndJoin(threads);
if (this_disparity[i] < disparity_far) {
if (this_strength[i] > this_maybe){
if (bg_tiles[i]) { // far can only be among previously selected for bgnd?
if (bg_tiles[i]) { // far can only be among previously selected for bgnd? bg_tiles = null ?
far_tiles[i] = true;
}
}
......@@ -5356,7 +5384,15 @@ ImageDtt.startAndJoin(threads);
}
//ex_nstrength
if (debugLevel > -1) {
int num_far=0, num_near=0, num_these = 0;
for (int i = 0; i <tlen; i++){
if (far_tiles[i]) num_far++;
if (near_tiles[i]) num_near++;
if (these_tiles[i]) num_these++;
}
System.out.println("num_far="+num_far+", num_near="+num_near+", num_these="+num_these);
}
boolean[] prohibit = null; // TBD
boolean[] dbg_before_small = null;
......@@ -5382,7 +5418,7 @@ ImageDtt.startAndJoin(threads);
0.0); // clt_parameters.min_clstr_max); // double min_max_weight // minimal value of the maximal strengh in the cluster
if ((sdfa_instance!=null) && show_scan) dbg_before_small = these_tiles.clone();
// only remove far outstanding clusters
removeSmallClusters( // remove single-tile clusters - anywhere
removeSmallClusters( // remove single-tile clusters - anywhere // removed all
false, // true, // boolean diag_en, // enable diagonal directions, false only up, dowm, right,left
these_tiles, // boolean [] tiles_src, // selected tiles, will modified
this_strength, // orig_strength, // null, // double [] weights_src, // or null
......@@ -5391,7 +5427,7 @@ ImageDtt.startAndJoin(threads);
min_clstr_max, // double min_max_weight // minimal value of the maximal strengh in the cluster
debugLevel);
if ((sdfa_instance!=null) && show_scan) dbg_before_lone = these_tiles.clone();
removeLoneClusters(
removeLoneClusters( // did not remove anything
false, // true, // boolean diag_en, // enable diagonal directions, false only up, dowm, right,left
these_tiles, // boolean [] tiles_src, // selected tiles, will modified
this_strength, // orig_strength, // null, // double [] weights_src, // or null
......@@ -5927,11 +5963,10 @@ ImageDtt.startAndJoin(threads);
final int debugLevel)
{
CLTPass3d scan_prev = clt_3d_passes.get(clt_3d_passes.size() -1);
CLTPass3d scan_bg = clt_3d_passes.get(bg_scan_index); //
CLTPass3d scan_bg = clt_3d_passes.get(bg_scan_index); // does it have .selected?
CLTPass3d scan_lm = getLastMeasured(-1);
// boolean [] border_tiles = (scan_lm != null) ? scan_lm.getBorderTiles() : null;
ShowDoubleFloatArrays sdfa_instance = null;
if (debugLevel > -1) sdfa_instance = new ShowDoubleFloatArrays(); // just for debugging?
// ShowDoubleFloatArrays sdfa_instance = null;
//TODO: for next passes - combine all selected for previous passes (all passes with smaller disparity)
int [] replaced = null; // +1 - hor, +2 - vert
int [] replaced0 = null; // +1 - hor, +2 - vert
......@@ -5940,7 +5975,8 @@ ImageDtt.startAndJoin(threads);
String [] dbg_titles = null;
boolean show_ortho = clt_parameters.show_ortho_combine || (debugLevel > 1);
boolean show_super = clt_parameters.show_refine_supertiles || (debugLevel > 1);
boolean show_st = clt_parameters.stShow || (debugLevel > 1);
boolean show_st = clt_parameters.stShow || (debugLevel > 2);
// if ((debugLevel > -1)) sdfa_instance = new ShowDoubleFloatArrays(); // just for debugging?
if (show_ortho){
String [] dbg_titles0 = {
"combo_disparity", // 0
......@@ -5985,7 +6021,8 @@ ImageDtt.startAndJoin(threads);
clt_parameters.or_maxDisp, // 5.0; // Maximal disparity to apply ortho correction
show_ortho, // show replacement of disparity/strength by those of hor/vert
debugLevel);
// replaced == null?
replaced0 = replaced.clone();
if (clt_parameters.poles_fix) {
boolean [] selection = new boolean [replaced.length];
boolean [] tilesHor = new boolean [replaced.length];
......@@ -6035,7 +6072,7 @@ ImageDtt.startAndJoin(threads);
}
dbg_img[12] = dreplaced0;
dbg_img[13] = dreplaced;
sdfa_instance.showArrays(dbg_img, tilesX, tilesY, true, "ortho_combine",dbg_titles);
(new ShowDoubleFloatArrays()).showArrays(dbg_img, tilesX, tilesY, true, "ortho_combine",dbg_titles);
}
if (debugLevel > 10){
......@@ -6047,7 +6084,7 @@ ImageDtt.startAndJoin(threads);
boolean [] these_tiles = FilterScan(
scan_prev, // final CLTPass3d scan,
scan_bg.selected, // get from selected in clt_3d_passes.get(0);
scan_bg.getSelected(), // selected, // get from selected in clt_3d_passes.get(0); // null?
clt_parameters.ex_min_over,// when expanding over previously detected (by error) background, disregard far tiles
// border_tiles, // final boolean [] border_tiles, // last measured boirder tiles
scan_lm, // final CLTPass3d last_meas, // last measured scan (with border_tiles and getSecondMaxDiff
......@@ -6118,7 +6155,7 @@ ImageDtt.startAndJoin(threads);
int hist_width0 = scan_prev.getSuperTiles().showDisparityHistogramWidth();
int hist_height0 = dbg_hist[0].length/hist_width0;
if (show_st){
sdfa_instance.showArrays(dbg_hist, hist_width0, hist_height0, true, "disparity_supertiles_histograms",dbg_st_titles);
(new ShowDoubleFloatArrays()).showArrays(dbg_hist, hist_width0, hist_height0, true, "disparity_supertiles_histograms",dbg_st_titles);
}
scan_prev.getBgDispStrength( // calculate (check non-null)?
......@@ -6184,7 +6221,7 @@ ImageDtt.startAndJoin(threads);
clt_parameters.transform_size, // int tile_size,
-1.0, // double bgnd,
1.0); // double fgnd)
sdfa_instance.showArrays(dbg_neib,tilesX*clt_parameters.transform_size, tilesY*clt_parameters.transform_size,"XXneighbors");
(new ShowDoubleFloatArrays()).showArrays(dbg_neib,tilesX*clt_parameters.transform_size, tilesY*clt_parameters.transform_size,"XXneighbors");
}
// double [] dbg_after2 = scan_prev.getDisparity().clone();
......@@ -6254,14 +6291,15 @@ ImageDtt.startAndJoin(threads);
dbg_disp[10][i] = borderTiles[i]? 1.0: 0.0;
}
sdfa_instance.showArrays(dbg_disp, tilesX, tilesY, true, "refine_disparity_supertiles-"+clt_3d_passes.size(),dbg_disp_tiltes);
(new ShowDoubleFloatArrays()).showArrays(dbg_disp, tilesX, tilesY, true, "refine_disparity_supertiles-"+clt_3d_passes.size(),dbg_disp_tiltes);
}
CLTPass3d scan_next =new CLTPass3d(this);
scan_next.disparity = disparityTask;
scan_next.tile_op = tile_op;
scan_next.border_tiles = borderTiles;
scan_next.selected = grown; // includes border_tiles
scan_next.setBorderTiles (borderTiles);
// scan_next.selected = grown; // includes border_tiles
scan_next.setSelected(grown); // includes border_tiles
return scan_next;
}
......@@ -7706,7 +7744,7 @@ ImageDtt.startAndJoin(threads);
}
these_tiles = FilterScan(
scan_prev, // final CLTPass3d scan,
scan_bg.selected, // get from selected in clt_3d_passes.get(0);
scan_bg.getSelected(), // selected, // get from selected in clt_3d_passes.get(0);
clt_parameters.ex_min_over,// when expanding over previously detected (by error) background, disregard far tiles
scan_lm, // final CLTPass3d last_meas, // last measured scan (with border_tiles and getSecondMaxDiff
replaced, // final int [] horVertMod, // +1 - modified by hor correlation, +2 - modified by vert correlation (or null)
......@@ -7735,7 +7773,8 @@ ImageDtt.startAndJoin(threads);
} else { //!ortho_old
these_tiles= combineHorVertDisparity_old(
scan_prev, // final CLTPass3d scan,
scan_bg.selected, // clt_3d_passes.get(0).selected, // final boolean [] bg_tiles, // get from selected in clt_3d_passes.get(0);
// scan_bg.selected, // clt_3d_passes.get(0).selected, // final boolean [] bg_tiles, // get from selected in clt_3d_passes.get(0);
scan_bg.getSelected(), // clt_3d_passes.get(0).selected, // final boolean [] bg_tiles, // get from selected in clt_3d_passes.get(0);
disparity_far, //
disparity_near, //
ex_strength, // this_sure, // minimal strength to be considered definitely background
......@@ -8004,7 +8043,7 @@ ImageDtt.startAndJoin(threads);
CLTPass3d scan_next =new CLTPass3d(this);
scan_next.disparity = disparityTask;
scan_next.tile_op = tile_op;
scan_next.border_tiles = borderTiles;
scan_next.setBorderTiles (borderTiles);
clt_3d_passes.add(scan_next);
numClusters++;
}
......
......@@ -9126,9 +9126,9 @@ if (debugLevel > -100) return true; // temporarily !
int [] channelFiles_main = set_channels_main[nSet].fileNumber();
int [] channelFiles_aux = set_channels_aux[nSet].fileNumber();
boolean [][] saturation_imp_main = (clt_parameters.sat_level > 0.0)? new boolean[channelFiles_main.length][] : null;
boolean [][] saturation_imp_aux = (clt_parameters.sat_level > 0.0)? new boolean[channelFiles_main.length][] : null;
boolean [][] saturation_imp_aux = (clt_parameters.sat_level > 0.0)? new boolean[channelFiles_aux.length][] : null;
double [] scaleExposures_main = new double[channelFiles_main.length];
double [] scaleExposures_aux = new double[channelFiles_main.length];
double [] scaleExposures_aux = new double[channelFiles_aux.length];
if (updateStatus) IJ.showStatus("Conditioning main camera image set for "+quadCLT_main.image_name);
ImagePlus [] imp_srcs_main = quadCLT_main.conditionImageSet(
clt_parameters, // EyesisCorrectionParameters.CLTParameters clt_parameters,
......@@ -9437,14 +9437,15 @@ if (debugLevel > -100) return true; // temporarily !
properties, // Properties properties, // if null - will only save extrinsics)
debugLevel);
}
continue; // skipping to the next file
/// continue; // skipping to the next file
}
}
// Process AUX (LWIR) camera data
// 1) Prepare DS for adjustments (just d/s, with ambiguous disparity tiles removed)
// 2) Prepare full D/S and FG/BG data to be embedded within the ML files
double [][] main_ds = {dsi[DSI_DISPARITY_MAIN], dsi[DSI_STRENGTH_MAIN]};
double [][] main_ds = {dsi[DSI_DISPARITY_MAIN], dsi[DSI_STRENGTH_MAIN]}; // {null, null}
if ((adjust_aux == 0) &&
!quadCLT_main.correctionsParameters.clt_batch_4img_aux &&
......@@ -9455,24 +9456,25 @@ if (debugLevel > -100) return true; // temporarily !
continue;
}
quadCLT_aux.ds_from_main = quadCLT_aux.depthMapMainToAux( // only 2 layers for adjustments
main_ds, // double [][] ds,
quadCLT_main.getGeometryCorrection(), // GeometryCorrection geometryCorrection_main,
quadCLT_aux.getGeometryCorrection(), // GeometryCorrection geometryCorrection_aux,
clt_parameters,
false, // split_fg_bg,
true, // for_adjust,
debugLevel); // DEBUG_LEVEL); // int debug_level
this.dsi_aux_from_main = quadCLT_aux.depthMapMainToAux( // 8 layers for ML generation/exporting + 2 zero layers
main_ds, // double [][] ds,
quadCLT_main.getGeometryCorrection(), // GeometryCorrection geometryCorrection_main,
quadCLT_aux.getGeometryCorrection(), // GeometryCorrection geometryCorrection_aux,
clt_parameters,
true, // split_fg_bg,
false, // for_adjust,
debugLevel); // int debug_level
if (main_ds[0] != null) {
quadCLT_aux.ds_from_main = quadCLT_aux.depthMapMainToAux( // only 2 layers for adjustments
main_ds, // double [][] ds,
quadCLT_main.getGeometryCorrection(), // GeometryCorrection geometryCorrection_main,
quadCLT_aux.getGeometryCorrection(), // GeometryCorrection geometryCorrection_aux,
clt_parameters,
false, // split_fg_bg,
true, // for_adjust,
debugLevel); // DEBUG_LEVEL); // int debug_level
this.dsi_aux_from_main = quadCLT_aux.depthMapMainToAux( // 8 layers for ML generation/exporting + 2 zero layers
main_ds, // double [][] ds,
quadCLT_main.getGeometryCorrection(), // GeometryCorrection geometryCorrection_main,
quadCLT_aux.getGeometryCorrection(), // GeometryCorrection geometryCorrection_aux,
clt_parameters,
true, // split_fg_bg,
false, // for_adjust,
debugLevel); // int debug_level
}
ImagePlus [] imp_srcs_aux = quadCLT_aux.conditionImageSet(
clt_parameters, // EyesisCorrectionParameters.CLTParameters clt_parameters,
......@@ -9485,14 +9487,13 @@ if (debugLevel > -100) return true; // temporarily !
saturation_imp_aux, //output // boolean [][] saturation_imp,
threadsMax, // int threadsMax,
debugLevelInner); // int debugLevel);
// optionally adjust AUX extrinsics (using quadCLT_aux.ds_from_main )
for (int num_adjust_aux = 0; num_adjust_aux < adjust_aux; num_adjust_aux++) {
if (updateStatus) IJ.showStatus("Building basic DSI for the AUX camera image set "+quadCLT_main.image_name+
" using main camera DSI, pass "+(num_adjust_aux+1)+" of "+num_adjust_aux);
" using main camera DSI, pass "+(num_adjust_aux+1)+" of "+adjust_aux);
if (debugLevel > -5) {
System.out.println("Building basic DSI for the AUX camera image set "+quadCLT_main.image_name+
" using main camera DSI, pass "+(num_adjust_aux+1)+" of "+num_adjust_aux);
" using main camera DSI, pass "+(num_adjust_aux+1)+" of "+adjust_aux);
}
quadCLT_aux.preExpandCLTQuad3d( // returns ImagePlus, but it already should be saved/shown
imp_srcs_aux, // [srcChannel], // should have properties "name"(base for saving results), "channel","path"
......@@ -9530,18 +9531,19 @@ if (debugLevel > -100) return true; // temporarily !
updateStatus,// final boolean updateStatus,
debugLevelInner); // final int debugLevel)
if (!ok) break;
} else {
boolean ok = quadCLT_aux.extrinsicsCLTfromGT(
null,
quadCLT_aux.ds_from_main, // gt_disp_strength,
clt_parameters, // EyesisCorrectionParameters.CLTParameters clt_parameters,
false, // adjust_poly,
threadsMax, // final int threadsMax, // maximal number of threads to launch
updateStatus, // final boolean updateStatus,
debugLevel + 2); // final int debugLevel)
if (!ok) break;
}
boolean ok = quadCLT_aux.extrinsicsCLTfromGT(
null,
quadCLT_aux.ds_from_main, // gt_disp_strength,
clt_parameters, // EyesisCorrectionParameters.CLTParameters clt_parameters,
false, // adjust_poly,
threadsMax, // final int threadsMax, // maximal number of threads to launch
updateStatus, // final boolean updateStatus,
debugLevel + 2); // final int debugLevel)
// clear memory for AUX
quadCLT_aux.tp.resetCLTPasses();
if (!ok) break;
}
// Generate 4 AUX camera images and thumbnail
if (quadCLT_main.correctionsParameters.clt_batch_4img_aux){
......
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