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.
......@@ -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