Commit c0c2cd6a authored by Andrey Filippov's avatar Andrey Filippov

updating macro mode (preliminary correlation)

parent a2bb43cd
......@@ -2850,12 +2850,21 @@ public class EyesisCorrectionParameters {
public double mc_disp8_trust = 2.0; //Trust measured disparity within +/- this value
public double mc_strength = 0.2; // Minimal composite correlation to process (0.2..0.3)
public double mc_unique_tol = 0.05; // Do not re-measure macro correlation if target disparity differs from some previous by this
public double mc_trust_fin = 0.3; // When consolidating macro results, exclude high residual disparity
public double mc_trust_sigma = 0.2; // Gaussian sigma to reduce weight of large residual disparity
public double mc_ortho_weight = 0.5; // Weight from ortho neighbor supertiles
public double mc_diag_weight = 0.25; // Weight from diagonal neighbor supertiles
public double mc_gap = 0.4; // Do not remove measurements farther from the kept ones
public double mc_weight_var = 1.0; // weight of variance data (old, detects thin wires?)
public double mc_weight_Y = 1.0; // weight of average intensity
public double mc_weight_RBmG = 5.0; // weight of average color difference (0.5*(R+B)-G), shoukld be ~5*weight_Y
// 0x1e, // 0x1f, // final int variants_mask,
public int gr_min_new = 20; // Discard variant if it requests too few tiles
public boolean gr_var_new_sngl = false;// Expand only unambiguous tiles over previously undefined
......@@ -3546,6 +3555,10 @@ public class EyesisCorrectionParameters {
properties.setProperty(prefix+"mc_diag_weight", this.mc_diag_weight +"");
properties.setProperty(prefix+"mc_gap", this.mc_gap +"");
properties.setProperty(prefix+"mc_weight_var", this.mc_weight_var +"");
properties.setProperty(prefix+"mc_weight_Y", this.mc_weight_Y +"");
properties.setProperty(prefix+"mc_weight_RBmG", this.mc_weight_RBmG +"");
properties.setProperty(prefix+"gr_min_new", this.gr_min_new+"");
properties.setProperty(prefix+"gr_var_new_sngl", this.gr_var_new_sngl+"");
properties.setProperty(prefix+"gr_var_new_fg", this.gr_var_new_fg+"");
......@@ -4212,6 +4225,10 @@ public class EyesisCorrectionParameters {
if (properties.getProperty(prefix+"mc_diag_weight")!=null) this.mc_diag_weight=Double.parseDouble(properties.getProperty(prefix+"mc_diag_weight"));
if (properties.getProperty(prefix+"mc_gap")!=null) this.mc_gap=Double.parseDouble(properties.getProperty(prefix+"mc_gap"));
if (properties.getProperty(prefix+"mc_weight_var")!=null) this.mc_weight_var=Double.parseDouble(properties.getProperty(prefix+"mc_weight_var"));
if (properties.getProperty(prefix+"mc_weight_Y")!=null) this.mc_weight_Y=Double.parseDouble(properties.getProperty(prefix+"mc_weight_Y"));
if (properties.getProperty(prefix+"mc_weight_RBmG")!=null) this.mc_weight_RBmG=Double.parseDouble(properties.getProperty(prefix+"mc_weight_RBmG"));
if (properties.getProperty(prefix+"gr_min_new")!=null) this.gr_min_new=Integer.parseInt(properties.getProperty(prefix+"gr_min_new"));
if (properties.getProperty(prefix+"gr_var_new_sngl")!=null) this.gr_var_new_sngl=Boolean.parseBoolean(properties.getProperty(prefix+"gr_var_new_sngl"));
if (properties.getProperty(prefix+"gr_var_new_fg")!=null) this.gr_var_new_fg=Boolean.parseBoolean(properties.getProperty(prefix+"gr_var_new_fg"));
......@@ -4973,6 +4990,15 @@ public class EyesisCorrectionParameters {
gd.addNumericField("Weight from diagonal neighbor supertiles", this.mc_diag_weight, 6);
gd.addNumericField("Do not remove measurements farther from the kept ones", this.mc_gap, 6);
gd.addNumericField("weight of variance data ", this.mc_weight_var, 4, 6,"",
"This is what was used before - can detect tin wires, probably");
gd.addNumericField("Weight of average intensity", this.mc_weight_Y, 4, 6,"",
"Combination of R,G,B fro the tile");
gd.addNumericField("Weight of average color difference", this.mc_weight_RBmG, 4, 6,"",
"0.5*(R+B)-G");
gd.addTab ("Grow2", "More disparity range growing parameters");
gd.addMessage ("--- more growing parameters ---");
gd.addNumericField("Discard variant if it requests too few tiles", this.gr_min_new, 0);
......@@ -5671,11 +5697,15 @@ public class EyesisCorrectionParameters {
this.mc_strength= gd.getNextNumber();
this.mc_unique_tol= gd.getNextNumber();
this.mc_unique_tol= gd.getNextNumber();
this.mc_unique_tol= gd.getNextNumber();
this.mc_unique_tol= gd.getNextNumber();
this.mc_unique_tol= gd.getNextNumber();
this.mc_unique_tol= gd.getNextNumber();
this.mc_trust_fin= gd.getNextNumber();
this.mc_trust_sigma= gd.getNextNumber();
this.mc_ortho_weight= gd.getNextNumber();
this.mc_diag_weight= gd.getNextNumber();
this.mc_gap= gd.getNextNumber();
this.mc_weight_var= gd.getNextNumber();
this.mc_weight_Y= gd.getNextNumber();
this.mc_weight_RBmG= gd.getNextNumber();
this.gr_min_new= (int) gd.getNextNumber();
this.gr_var_new_sngl= gd.getNextBoolean();
......
......@@ -68,30 +68,16 @@ public class ImageDtt {
static int DISPARITY_VARIATIONS_INDEX = 11; // index of strength data in disparity map ==6
static int IMG_DIFF0_INDEX = 12; // index of noise- normalized image difference for port 0 in disparity map
static int OVEREXPOSED = 16; // index of overexposed fraction of all pixels
static int IMG_TONE_RGB = 17; // 12 entries of r0,r1,r2,r3,g0,g1,g2,g3,b0,b1,b2,b3
// remove when not needed
static int DBG0_INDEX = 17; // index of dbg0 data (copy of CM)
static int DBG1_INDEX = 18; // index of dbg1 data (poly 1)
static int DBG2_INDEX = 19; // index of dbg2 data (poly 2)
static int DBG3_INDEX = 20; // index of dbg3 data (poly 3)
static int DBG4_INDEX = 21; // index of dbg3 data (poly 3)
static int DBG5_INDEX = 22; // index of dbg3 data (poly 3)
static int DBG6_INDEX = 23; // index of dbg3 data (poly 3)
static int DBG7_INDEX = 24; // index of dbg3 data (poly 3)
static int DBG8_INDEX = 25; // index of dbg3 data (poly 3)
static int DBG9_INDEX = 26; // index of dbg3 data (poly 3)
static int DBG10_INDEX = 27; // index of dbg3 data (poly 3)
static int DBG11_INDEX = 28; // index of dbg3 data (poly 3)
static int DBG12_INDEX = 29; // index of dbg3 data (poly 3)
static int DBG13_INDEX = 30; // index of dbg3 data (poly 3)
static int DBG14_INDEX = 31; // index of dbg3 data (poly 3)
static int DBG15_INDEX = 32; // index of dbg3 data (poly 3)
static int DBG16_INDEX = 33; // index of dbg3 data (poly 3)
static int DBG17_INDEX = 34; // index of dbg3 data (poly 3)
static int DBG18_INDEX = 35; // index of dbg3 data (poly 3)
static String [] DISPARITY_TITLES = {
"int_disp","int_y_disp","cm_disp","cm_y_disp","hor_disp","hor_strength","vert_disp","vert_strength",
"poly_disp", "poly_y_disp", "strength_disp", "vary_disp","diff0","diff1","diff2","diff3","overexp",
"dbg0","dbg1","dbg2","dbg3","dbg4","dbg5","dbg6","dbg7","dbg8","dbg9","dbg10","dbg11","dbg12","dbg13","dbg14","dbg15","dbg16","dbg17","dbg18"};
"r0","r1","r2","r3",
"g0","g1","g2","g3",
"b0","b1","b2","b3",
};
// "dbg0","dbg1","dbg2","dbg3","dbg4","dbg5","dbg6","dbg7","dbg8","dbg9","dbg10","dbg11","dbg12","dbg13","dbg14","dbg15","dbg16","dbg17","dbg18"};
static int BI_DISP_FULL_INDEX = 0; // 0 - disparity for all directions of the main camera
static int BI_DISP_HOR_INDEX = 1; // 1 - disparity for 2 horizontal pairs of the main camera
......@@ -1564,6 +1550,7 @@ public class ImageDtt {
// final boolean debug_ports_coordinates = (debug_tileX == -1234);
// final double poly_corr = imgdtt_params.poly_corr_scale; // maybe add per-tile task bits to select none/near/far
final boolean macro_mode = macro_scale != 1; // correlate tile data instead of the pixel data
final int quad = 4; // number of subcameras
final int numcol = 3; // number of colors
final int nChn = image_data[0].length;
......@@ -1575,9 +1562,17 @@ public class ImageDtt {
final Thread[] threads = newThreadArray(threadsMax);
final AtomicInteger ai = new AtomicInteger(0);
final double [] col_weights= new double [numcol]; // colors are RBG
col_weights[2] = 1.0/(1.0 + corr_red + corr_blue); // green color
col_weights[0] = corr_red * col_weights[2];
col_weights[1] = corr_blue * col_weights[2];
if (macro_mode) { // all the same as they now mean different
//compensating Bayer correction
col_weights[0] = 0.25; // 1.0/3;
col_weights[1] = 0.25; // 1.0/3;
col_weights[2] = 0.5; // 1.0/3;
} else {
col_weights[2] = 1.0/(1.0 + corr_red + corr_blue); // green color
col_weights[0] = corr_red * col_weights[2];
col_weights[1] = corr_blue * col_weights[2];
}
final int corr_size = transform_size * 2 -1;
final int [][] transpose_indices = new int [corr_size*(corr_size-1)/2][2];
int indx = 0;
......@@ -1702,8 +1697,16 @@ public class ImageDtt {
// add optional initialization of debug layers here
if (disparity_map != null){
for (int i = 0; i<disparity_map.length;i++){
if ((i != OVEREXPOSED) || (saturation_imp!= null)){
if (i < OVEREXPOSED) {
disparity_map[i] = new double [tilesY*tilesX];
} else if (i == OVEREXPOSED) {
if (saturation_imp!= null) {
disparity_map[i] = new double [tilesY*tilesX];
}
} else if (i >= IMG_TONE_RGB) {
if (texture_tiles != null) { // for now - enable 12 tone layers only together with texture tiles
disparity_map[i] = new double [tilesY*tilesX];
}
}
}
}
......@@ -1751,6 +1754,7 @@ public class ImageDtt {
double [][] tcorr_combo = null; // [15*15] pixel space
double [][][] tcorr_partial = null; // [quad][numcol+1][15*15]
double [][][][] tcorr_tpartial = null; // [quad][numcol+1][4][8*8]
double [] ports_rgb = null;
// PolynomialApproximation pa = null;
// if (corr_max_weights_poly !=null) pa = new PolynomialApproximation(0); // debug level
Correlation2d corr2d = new Correlation2d(
......@@ -2199,7 +2203,6 @@ public class ImageDtt {
// corr_wndy, // double [] window_y, // (half) window function in y-direction(perpendicular to disparity: for row0 ==1
// corr_wndx, // double [] window_x, // half of a window function in x (disparity) direction
(tile_lma_debug_level > 0)); // boolean debug);
if (dmExists(disparity_map, DBG14_INDEX)) disparity_map[DBG14_INDEX][tIndex] = strength;
}
// for compatibility with old code executed unconditionally. TODO: Move to if (corr_stat != null) ... condition below
......@@ -2236,9 +2239,6 @@ public class ImageDtt {
if (tile_lma_debug_level > 0) {
System.out.println("Will run getMaxXSOrtho( ) for tileX="+tileX+", tileY="+tileY);
}
if (disparity_map[DBG0_INDEX] != null) {
disparity_map[DBG0_INDEX][tIndex] = disparity; // just a backup if [DISPARITY_INDEX_CM] will be replaced
}
// disparity_map[DISPARITY_INDEX_CM + 1][tIndex] = // y not available here
// calculate/fill out hor and vert
// convert to multi-baseline combining results from several integer scales
......@@ -2268,8 +2268,6 @@ public class ImageDtt {
lma_disparity_strength[0],lma_disparity_strength[1]));
}
disparity_map[DISPARITY_INDEX_POLY] [tIndex] = lma_disparity_strength[0];
if (dmExists(disparity_map, DBG1_INDEX)) disparity_map[DBG1_INDEX][tIndex] = lma_disparity_strength[0];
if (dmExists(disparity_map, DBG15_INDEX)) disparity_map[DBG15_INDEX][tIndex] = lma_disparity_strength[1];
// if enabled overwrite - replace DISPARITY_INDEX_CM and DISPARITY_STRENGTH_INDEX
if (imgdtt_params.mix_corr_poly) {
......@@ -2306,14 +2304,6 @@ public class ImageDtt {
dir_corr_strength[0][0],dir_corr_strength[0][1],dir_corr_strength[1][0],dir_corr_strength[1][1],
dir_corr_strength[2][0],dir_corr_strength[2][1],dir_corr_strength[3][0],dir_corr_strength[3][1]));
}
if (dmExists(disparity_map, DBG4_INDEX) && (dir_corr_strength[0] != null)) disparity_map[DBG4_INDEX][tIndex] = dir_corr_strength[0][0];
if (dmExists(disparity_map, DBG5_INDEX) && (dir_corr_strength[1] != null)) disparity_map[DBG5_INDEX][tIndex] = dir_corr_strength[1][0];
if (dmExists(disparity_map, DBG6_INDEX) && (dir_corr_strength[2] != null)) disparity_map[DBG6_INDEX][tIndex] = dir_corr_strength[2][0];
if (dmExists(disparity_map, DBG7_INDEX) && (dir_corr_strength[3] != null)) disparity_map[DBG7_INDEX][tIndex] = dir_corr_strength[3][0];
if (dmExists(disparity_map, DBG8_INDEX) && (dir_corr_strength[0] != null)) disparity_map[DBG8_INDEX][tIndex] = dir_corr_strength[0][1];
if (dmExists(disparity_map, DBG9_INDEX) && (dir_corr_strength[1] != null)) disparity_map[DBG9_INDEX][tIndex] = dir_corr_strength[1][1];
if (dmExists(disparity_map, DBG10_INDEX) && (dir_corr_strength[2] != null)) disparity_map[DBG10_INDEX][tIndex] = dir_corr_strength[2][1];
if (dmExists(disparity_map, DBG11_INDEX) && (dir_corr_strength[3] != null)) disparity_map[DBG11_INDEX][tIndex] = dir_corr_strength[3][1];
mod_disparity_diff = corr2d.foregroundCorrect(
imgdtt_params.fo_far, // boolean bg,
......@@ -2328,17 +2318,12 @@ public class ImageDtt {
imgdtt_params.fo_overcorrection, // double fo_overcorrection,
imgdtt_params.fo_lim_overcorr, // double fo_lim_overcorr,
(tile_lma_debug_level > 0) ); // boolean debug);
if (dmExists(disparity_map, DBG2_INDEX)) disparity_map[DBG2_INDEX][tIndex] = mod_disparity_diff[0];
if (dmExists(disparity_map, DBG12_INDEX)) disparity_map[DBG12_INDEX][tIndex] = mod_disparity_diff[1];
// Do not use modified far object distance when mismatch is measured
if ((mod_disparity_diff[0] != disparity) && (clt_mismatch == null)){ // if it changed
if (imgdtt_params.fo_correct && (strength > imgdtt_params.fo_min_strength)) { // always
disparity = mod_disparity_diff[0];
disparity_map[DISPARITY_INDEX_CM] [tIndex] = disparity;
if (dmExists(disparity_map, DBG3_INDEX)) {
disparity_map[DBG3_INDEX][tIndex] = mod_disparity_diff[0];
}
}
}
......@@ -2713,6 +2698,7 @@ public class ImageDtt {
}
}
}
// iclt here: [quad][color][256]
if ((globalDebugLevel > 0) && debugTile) {
showDoubleFloatArrays sdfa_instance = new showDoubleFloatArrays(); // just for debugging?
String [] titles = {"red0","blue0","green0","red1","blue1","green1","red2","blue2","green2","red3","blue3","green3"};
......@@ -2757,8 +2743,13 @@ public class ImageDtt {
if ((disparity_map != null) && (disparity_map.length >= (IMG_DIFF0_INDEX + quad))){
max_diff = new double[quad];
}
int ports_rgb_len = quad*numcol; // 12
if ((disparity_map != null) && (disparity_map.length >= (IMG_TONE_RGB + ports_rgb_len))) {
ports_rgb = new double[ports_rgb_len];
}
texture_tiles[tileY][tileX] = tile_combine_rgba(
tiles_debayered, // iclt_tile, // [port][numcol][256]
ports_rgb, // double [] ports_rgb, // average values of R,G,B for each camera (R0,R1,...,B2,B3)
max_diff, // maximal (weighted) deviation of each channel from the average
lt_window2, // [256]
port_offsets, // [port]{x_off, y_off}
......@@ -2791,6 +2782,11 @@ public class ImageDtt {
disparity_map[IMG_DIFF0_INDEX + i][tIndex] = max_diff[i];
}
}
if (ports_rgb != null) {
for (int i = 0; i < ports_rgb.length; i++){
disparity_map[IMG_TONE_RGB + i][tIndex] = ports_rgb[i];
}
}
}
}
}
......@@ -2810,10 +2806,11 @@ public class ImageDtt {
}
public double [][] tile_combine_rgba(
double [][][] iclt_tile, // [port][numcol][256]
double [] max_diff, // maximal (weighted) deviation of each channel from the average
double [] lt_window, // [256]
double [][] port_offsets, // [port]{x_off, y_off} - just to scale pixel value differences
double [][][] iclt_tile, // [port][numcol][256]
double [] ports_rgb, // average values of R,G,B for each camera (R0,R1,...,B2,B3)
double [] max_diff, // maximal (weighted) deviation of each channel from the average
double [] lt_window, // [256]
double [][] port_offsets, // [port]{x_off, y_off} - just to scale pixel value differences
int port_mask, // which port to use, 0xf - all 4 (will modify as local variable)
double diff_sigma, // pixel value/pixel change
double diff_threshold, // pixel value/pixel change
......@@ -2921,49 +2918,6 @@ public class ImageDtt {
}
}
/*
// remove outlayers (if any) here completely? diff_threshold
// threshold2
while ((d2[0] > threshold2) || (d2[1] > threshold2) || (d2[2] > threshold2) || (d2[3] > threshold2)){ // assuming ports==4!
// find worst channel
int iworst = 0;
for (int ip = 1; ip < ports; ip++) if (d2[ip] > d2[iworst]) iworst = ip;
port_mask &= ~ (1 << iworst); // remove worst port
port_weights[iworst][i] = 0.0;
// recalculate new average after worst is removed
k = 0.0;
for (int ip = 0; ip < ports; ip++) k+=port_weights[ip][i];
k = 1.0/k;
for (int chn = 0; chn < numcol; chn++){
color_avg[chn][i] = 0;
for (int ip = 0; ip < ports; ip++) {
color_avg[chn][i] += k* port_weights[ip][i] * iclt_tile[ip][chn][i];
}
}
// recalculate all weights using difference from this average of the best pair
d2 = new double [ports]; //weighted squared differences
for (int ip = 0; ip < ports; ip++) if ((port_mask & ( 1 << ip)) != 0){
d2[ip] = 0;
for (int chn = 0; chn < numcol; chn++){
double dc = iclt_tile[ip][chn][i] - color_avg[chn][i];
dc /= lt_window[i]; // to compensate fading near the edges
d2[ip]+= chn_weights[chn]*dc*dc;
}
port_weights[ip][i] = Math.exp(-ksigma * d2[ip]);
}
}
// one last time re-average? (weights will change)
k = 0.0;
for (int ip = 0; ip < ports; ip++) k+=port_weights[ip][i];
k = 1.0/k;
for (int chn = 0; chn < numcol; chn++){
color_avg[chn][i] = 0;
for (int ip = 0; ip < ports; ip++) {
color_avg[chn][i] += k* port_weights[ip][i] * iclt_tile[ip][chn][i];
}
}
*/
} // or (int i = 0; i < tile_len; i++){
} else if (usedPorts > 0){ // just copy from a single channel
......@@ -3008,7 +2962,18 @@ public class ImageDtt {
max_diff[ip] = Math.sqrt(max_diff[ip]);
}
}
if (ports_rgb != null) {
for (int ip = 0; ip < ports; ip++){
for (int chn = 0; chn < numcol; chn++){
int indx = chn*ports+ip;
ports_rgb[indx]=0;
for (int i = 0; i < tile_len; i++){
ports_rgb[indx] += iclt_tile[ip][chn][i];
}
ports_rgb[indx] /= tile_len;
}
}
}
return rgba;
}
......@@ -3052,7 +3017,7 @@ public class ImageDtt {
for (int i = 0; i < tile.length; i++) tile_db[i] = scale_shot* ((tile_db[i] > min_shot)? Math.sqrt(tile_db[i]) : (k*tile_db[i]));
}
if (window_back != null) {
for (int i = 0; i < tile.length; i++) tile_db[i] = tile_db[i] * window_back[i]; // optionally re-apply window (may bve a different one)
for (int i = 0; i < tile.length; i++) tile_db[i] = tile_db[i] * window_back[i]; // optionally re-apply window (may be a different one)
}
return tile_db;
}
......@@ -6625,10 +6590,6 @@ public class ImageDtt {
clt_mismatch[3*pair + 2 ][tIndex] = Double.NaN;
}
}
if (disparity_map[DBG0_INDEX] != null) disparity_map[DBG0_INDEX][tIndex] = Double.NaN;
if (disparity_map[DBG1_INDEX] != null) disparity_map[DBG1_INDEX][tIndex] = Double.NaN;
if (disparity_map[DBG2_INDEX] != null) disparity_map[DBG2_INDEX][tIndex] = Double.NaN;
if (disparity_map[DBG3_INDEX] != null) disparity_map[DBG3_INDEX][tIndex] = Double.NaN;
} else {
double [] corr_max_XYi = {icorr_max[0],icorr_max[1]};
......@@ -6742,227 +6703,8 @@ public class ImageDtt {
disparity_map[DISPARITY_INDEX_POLY+1][tIndex] = corr_max_XY[1];
// just debug (up to 4 layers)
if (disparity_map[DBG0_INDEX] != null) {
disparity_map[DBG0_INDEX][tIndex] = transform_size - 1 -corr_max_XYm[0];
}
if (disparity_map[DBG2_INDEX] != null) {
disparity_map[DBG2_INDEX][tIndex] = corr_max_XY[0];
}
if (disparity_map[DBG1_INDEX] != null) {
disparity_map[DBG1_INDEX][tIndex] = disparity_map[DBG0_INDEX][tIndex];
disparity_map[DBG3_INDEX][tIndex] = Double.NaN;
if ((corr_max_XY.length > 4) &&
!Double.isNaN(corr_max_XY[3]) && !Double.isNaN(corr_max_XY[4]) &&
(corr_max_XY[3] < imgdtt_params.max_poly_hwidth) &&
(corr_max_XY[4] < imgdtt_params.max_poly_hwidth) &&
(disparity_map[DISPARITY_STRENGTH_INDEX][tIndex] > imgdtt_params.min_poly_strength)) { // debug threshold
disparity_map[DBG1_INDEX][tIndex] = corr_max_XY[0];
disparity_map[DBG3_INDEX][tIndex] = corr_max_XY[0]; // Double.NaN;
}
}
/*
if (disparity_map[DBG6_INDEX] != null) {
if ((corr_max_XY.length > 4) &&
(disparity_map[DISPARITY_STRENGTH_INDEX][tIndex] > imgdtt_params.min_poly_strength)) {
// disparity_map[DBG4_INDEX][tIndex] = corr_max_XY[2]; // value
disparity_map[DBG5_INDEX][tIndex] = corr_max_XY[3]; // half-width x
disparity_map[DBG6_INDEX][tIndex] = corr_max_XY[4]; // half-width y
disparity_map[DBG4_INDEX][tIndex] = (corr_max_XY[3]-corr_max_XY[4]); // value
} else {
disparity_map[DBG5_INDEX][tIndex] = Double.NaN;
disparity_map[DBG6_INDEX][tIndex] = Double.NaN;
disparity_map[DBG4_INDEX][tIndex] = Double.NaN;
}
}
*/
if (disparity_map[DBG12_INDEX] != null) {
if ((corr_max_XY.length > 4) && // only show for strong enough poly correlation
(disparity_map[DISPARITY_STRENGTH_INDEX][tIndex] > imgdtt_params.min_poly_strength)) {
disparity_map[DBG4_INDEX ][tIndex] = corr_max_XY[0]; // argmax
disparity_map[DBG7_INDEX ][tIndex] = corr_max_XY[2]; // max
disparity_map[DBG10_INDEX][tIndex] = corr_max_XY[3]; // half-width x
disparity_map[DBG5_INDEX ][tIndex] = corr_max_ortho[0][0]; // argmax
disparity_map[DBG8_INDEX ][tIndex] = corr_max_ortho[0][1]; // max
disparity_map[DBG11_INDEX][tIndex] = corr_max_ortho[0][2]; // half-width x
disparity_map[DBG6_INDEX ][tIndex] = corr_max_ortho[1][0]; // argmax
disparity_map[DBG9_INDEX ][tIndex] = corr_max_ortho[1][1]; // max
disparity_map[DBG12_INDEX][tIndex] = corr_max_ortho[1][2]; // half-width x
} else {
disparity_map[DBG4_INDEX ][tIndex] = Double.NaN;
disparity_map[DBG5_INDEX ][tIndex] = Double.NaN;
disparity_map[DBG6_INDEX ][tIndex] = Double.NaN;
disparity_map[DBG7_INDEX ][tIndex] = Double.NaN;
disparity_map[DBG8_INDEX ][tIndex] = Double.NaN;
disparity_map[DBG9_INDEX ][tIndex] = Double.NaN;
disparity_map[DBG10_INDEX][tIndex] = Double.NaN;
disparity_map[DBG11_INDEX][tIndex] = Double.NaN;
disparity_map[DBG12_INDEX][tIndex] = Double.NaN;
}
}
// use poly only if half-width y < limit (now it is ~2.0 for good corr)
// test new correlations
if (disparity_map[DBG12_INDEX] != null) {
// Correlation2d corr2d = new Correlation2d(transform_size);
// recalculate correlations
double [][] corrs = corr2d.correlateCompositeFD(
clt_data, // double [][][][][][] clt_data,
tileX, // int tileX,
tileY, // int tileY,
0x3f, // int pairs_mask,
filter, // double [] lpf,
col_weights, // double [] col_weights,
corr_fat_zero);// double fat_zero)
double [][] strips = corr2d.scaleRotateInterpoateCorrelations(
corrs, // double [][] correlations,
0x3f, // int pairs_mask,
imgdtt_params.corr_strip_hight, //); // int hwidth);
((globalDebugLevel > -2) && (tileX == debug_tileX) && (tileY == debug_tileY))?0x3f:0); // debugMax);
double [] strip_ortho = corr2d.combineInterpolatedCorrelations(
strips, // double [][] strips,
0x0f, // int pairs_mask,
imgdtt_params.corr_offset, // double offset);
imgdtt_params.twice_diagonal); // boolean twice_diagonal)
double [] strip_diag = corr2d.combineInterpolatedCorrelations(
strips, // double [][] strips,
0x30, // int pairs_mask,
imgdtt_params.corr_offset, // double offset);
imgdtt_params.twice_diagonal); // boolean twice_diagonal)
double [] strip_all = corr2d.combineInterpolatedCorrelations(
strips, // double [][] strips,
0x3f, // int pairs_mask,
imgdtt_params.corr_offset, // double offset);
imgdtt_params.twice_diagonal); // boolean twice_diagonal)
double [] strip_combo = corr2d.combineInterpolatedCorrelations(
strips, // double [][] strips,
imgdtt_params.dbg_pair_mask, // int pairs_mask,
imgdtt_params.corr_offset, // double offset);
imgdtt_params.twice_diagonal); // boolean twice_diagonal)
// reuse clt_corr_partial,// [tilesY][tilesX][quad]color][(2*transform_size-1)*(2*transform_size-1)] // if null - will not calculate
if (clt_corr_partial != null) {
clt_corr_partial[tileY][tileX][0][0] = corrs[0]; // 1
clt_corr_partial[tileY][tileX][0][1] = corrs[1]; // 2
clt_corr_partial[tileY][tileX][0][2] = corrs[2]; // 3
clt_corr_partial[tileY][tileX][0][3] = corrs[3]; // 4
clt_corr_partial[tileY][tileX][1][0] = corrs[4]; // 5
clt_corr_partial[tileY][tileX][1][1] = corrs[5]; // 6
clt_corr_partial[tileY][tileX][1][2] = corr2d.debugStrip(strips[0]); // 7
clt_corr_partial[tileY][tileX][1][3] = corr2d.debugStrip(strips[1]); // 8
clt_corr_partial[tileY][tileX][2][0] = corr2d.debugStrip(strips[2]); // 9
clt_corr_partial[tileY][tileX][2][1] = corr2d.debugStrip(strips[3]); // 10
clt_corr_partial[tileY][tileX][2][2] = corr2d.debugStrip(strips[4]); // 11
clt_corr_partial[tileY][tileX][2][3] = corr2d.debugStrip(strips[5]); // 12
clt_corr_partial[tileY][tileX][3][0] = corr2d.debugStrip(strip_ortho); // 13
clt_corr_partial[tileY][tileX][3][1] = corr2d.debugStrip(strip_diag); // 14
clt_corr_partial[tileY][tileX][3][2] = corr2d.debugStrip(strip_all); // 15
clt_corr_partial[tileY][tileX][3][3] = corr2d.debugStrip2(strip_combo); // 16
}
if ((globalDebugLevel > -2) && (tileX == debug_tileX) && (tileY == debug_tileY)) {
System.out.println(String.format("tileX=%d, tileY=%d, dbg_pair_mask= 0x%x,corr_offset = %8.5f",
debug_tileX,debug_tileY,imgdtt_params.dbg_pair_mask, imgdtt_params.corr_offset ));
}
// find integer correlation center, relative to the center
int [] ixy = corr2d.getMaxXYInt( // find integer pair or null if below threshold
strip_combo, // double [] data, // [data_size * data_size]
true, // boolean axis_only,
imgdtt_params.min_corr, // double minMax, // minimal value to consider (at integer location, not interpolated)
((globalDebugLevel > -2) && (tileX == debug_tileX) && (tileY == debug_tileY))); // boolean debug);
double [] corr_stat = null;
if (ixy != null) {
corr_stat = corr2d.getMaxXCm( // get fractional center as a "center of mass" inside circle/square from the integer max
strip_combo, // double [] data, // [data_size * data_size]
ixy[0], // int ixcenter, // integer center x
// corr_wndy, // double [] window_y, // (half) window function in y-direction(perpendicular to disparity: for row0 ==1
// corr_wndx, // double [] window_x, // half of a window function in x (disparity) direction
((globalDebugLevel > -2) && (tileX == debug_tileX) && (tileY == debug_tileY))); // boolean debug);
} else {
corr_stat = new double[3];
for (int i = 0; i < corr_stat.length; i++) corr_stat[i] = Double.NaN;
}
if (disparity_map[DBG18_INDEX] != null) {
disparity_map[DBG13_INDEX][tIndex] = -corr_stat[0]; // disparity is negative X
disparity_map[DBG14_INDEX][tIndex] = corr_stat[2]; // half-width
disparity_map[DBG15_INDEX][tIndex] = corr_stat[1]/corr_stat[2]; // height?
disparity_map[DBG16_INDEX][tIndex] = corr_stat[1]; // weight
if (ixy != null) {
disparity_map[DBG17_INDEX][tIndex] = strip_combo[ixy[0]+transform_size-1];
disparity_map[DBG18_INDEX][tIndex] = -ixy[0];
}else {
disparity_map[DBG17_INDEX][tIndex] = Double.NaN;
disparity_map[DBG18_INDEX][tIndex] = Double.NaN;
}
}
// initially try LMA for only the debug tile
// if (imgdtt_params.corr_var_cam) // new mode
if ((corr_stat != null) && (globalDebugLevel > -2) && (tileX == debug_tileX) && (tileY == debug_tileY)) {
System.out.println(String.format("Testing correlation maximum LMA tileX=%d, tileY=%d, dbg_pair_mask= 0x%x,corr_offset = %8.5f",
debug_tileX,debug_tileY,imgdtt_params.dbg_pair_mask, imgdtt_params.corr_offset ));
// Create 2 groups: ortho & diag
Correlations2dLMA lma = corr2d.corrLMA(
imgdtt_params, // ImageDttParameters imgdtt_params,
corrs, // double [][] corrs,
imgdtt_params.dbg_pair_mask, // int pair_mask, // which pairs to process
false, // boolean run_poly_instead, // true - run LMA, false - run 2d polynomial approximation
corr_stat[0], // double xcenter, // preliminary center x in pixels for largest baseline
imgdtt_params.ortho_vasw_pwr, // double vasw_pwr, // value as weight to this power,
imgdtt_params.lma_debug_level,// int debug_level,
tileX, // int tileX, // just for debug output
tileY ); // int tileY
double [] lma_disparity_strength = (lma != null) ? lma.getDisparityStrength():null;
if (lma != null) {
if (imgdtt_params.lma_debug_level > 0) {
System.out.println(String.format("LMA disparity = %7.4f, strength = %7.4f",
lma_disparity_strength[0],lma_disparity_strength[1]));
}
// try all dirs:
double [][] dir_corr_strength = corr2d.corr4dirsLMA(
imgdtt_params, // ImageDttParameters imgdtt_params,
corrs, // double [][] corrs,
imgdtt_params.dbg_pair_mask, // int pair_mask, // which pairs to process
-lma_disparity_strength[0], // double xcenter, // preliminary center x in pixels for largest baseline
imgdtt_params.ortho_vasw_pwr, // double vasw_pwr, // value as weight to this power,
imgdtt_params.lma_debug_level,// int debug_level,
tileX, // int tileX, // just for debug output
tileY ); // int tileY
if ((imgdtt_params.lma_debug_level > 0) && (dir_corr_strength != null)) {
double [] nan2 = {Double.NaN, Double.NaN};
for (int ii = 0; ii < dir_corr_strength.length; ii++) {
if (dir_corr_strength[ii] == null) dir_corr_strength[ii] = nan2;
}
System.out.println(String.format("corr4dirsLMA -> ↔: %7.4f (%7.4f) ↕:%7.4f (%7.4f) ⤡:%7.4f (%7.4f) ⤢:%7.4f (%7.4f)",
dir_corr_strength[0][0],dir_corr_strength[0][1],dir_corr_strength[1][0],dir_corr_strength[1][1],
dir_corr_strength[2][0],dir_corr_strength[2][1],dir_corr_strength[3][0],dir_corr_strength[3][1]));
}
// try mismatch (later
double [] mismatch_result = corr2d.mismatchPairs( // returns x-xcenter, y, strength (sign same as disparity)
imgdtt_params, // ImageDttParameters imgdtt_params,
corrs, // double [][] corrs,
0x3f, // all pairs imgdtt_params.dbg_pair_mask, // int pair_mask, // which pairs to process
-lma_disparity_strength[0], // double xcenter, // preliminary center x in pixels for largest baseline
imgdtt_params.ortho_vasw_pwr, // double vasw_pwr, // value as weight to this power,
imgdtt_params.lma_debug_level,// int debug_level,
tileX, // int tileX, // just for debug output
tileY ); // int tileY
if (imgdtt_params.lma_debug_level > 0) {
System.out.println("Lazy eye mismatch:");
for (int np = 0; np < mismatch_result.length/3; np++) {
System.out.println(String.format("%2d: dx = %7.4f, dy = %7.4f, strength = %7.4f,",
np, mismatch_result[3 * np + 0], mismatch_result[3 * np + 1], mismatch_result[3 * np + 2]));
}
}
}
}
}
if (imgdtt_params.mix_corr_poly) { // regardless of debug
// apply
......@@ -7153,6 +6895,8 @@ public class ImageDtt {
}
texture_tiles[tileY][tileX] = tile_combine_rgba(
tiles_debayered, // iclt_tile, // [port][numcol][256]
null, // double [] ports_rgb, // average values of R,G,B for each camera (R0,R1,...,B2,B3)
max_diff, // maximal (weighted) deviation of each channel from the average
lt_window2, // [256]
port_offsets, // [port]{x_off, y_off}
......@@ -7782,6 +7526,7 @@ public class ImageDtt {
// }
texture_tiles[tileY][tileX] = tile_combine_rgba(
tiles_debayered, // iclt_tile, // [port][numcol][256]
null, // double [] ports_rgb, // average values of R,G,B for each camera (R0,R1,...,B2,B3)
null, // max_diff, // maximal (weighted) deviation of each channel from the average
lt_window2, // [256]
port_offsets, // [port]{x_off, y_off}
......
......@@ -32,9 +32,21 @@ import java.util.concurrent.atomic.AtomicInteger;
public class MacroCorrelation {
TileProcessor tp; // pixel tile processor
TileProcessor mtp; // macro tile processor
double weight_var = 1.0; // weight of variance data (old, detects thin wires?)
double weight_Y = 1.0; // weight of average intensity
double weight_RBmG = 5.0; // weight of average color difference (0.5*(R+B)-G), shoukld be ~5*weight_Y
public MacroCorrelation(
TileProcessor tp,
double trusted_correlation){
double trusted_correlation,
double weight_var, // = 1.0; // weight of variance data (old, detects thin wires?)
double weight_Y, // = 1.0; // weight of average intensity
double weight_RBmG // = 5.0; // weight of average color difference (0.5*(R+B)-G), shoukld be ~5*weight_Y
){
this.weight_var = weight_var; // weight of variance data (old, detects thin wires?)
this.weight_Y = weight_Y; // weight of average intensity
this.weight_RBmG = weight_RBmG; // = 5.0; // weight of average color difference (0.5*(R+B)-G), shoukld be ~5*weight_Y
this.tp = tp;
final int pTilesX = tp.getTilesX();
final int pTilesY = tp.getTilesY();
......@@ -61,40 +73,102 @@ public class MacroCorrelation {
final double macro_disparity_step,
final int debugLevel){
double [][][] input_data = CLTMacroSetData( // perform single pass according to prepared tiles operations and disparity
src_scan, // final CLTPass3d src_scan, // results of the normal correlations (now expecting infinity)
null); // final double [][][] other_channels, // other channels to correlate, such as average RGB (first index - subcamera, 2-nd - channel, 3-rd - pixel)
double [][][] input_data = CLTMacroSetData( // perform single pass according to prepared tiles operations and disparity
src_scan); // final CLTPass3d src_scan, // results of the normal correlations (now expecting infinity)
if (debugLevel > 0) {
final int pTilesX = tp.getTilesX();
final int pTilesY = tp.getTilesY();
final int tileSize = tp.getTileSize(); //
final int mTilesX = (pTilesX + tileSize - 1) / tileSize; // clt_aberrations_quad_corr truncates
final int mTilesY = (pTilesY + tileSize - 1) / tileSize;
String [] titles = {
"chn0-0","chn0-1","chn0-2",
"chn1-0","chn1-1","chn1-2",
"chn2-0","chn2-1","chn2-2",
"chn3-0","chn3-1","chn3-2"};
double [][] dbg_img = new double [input_data.length*input_data[0].length][];
for (int i=0; i < 12;i++) {
dbg_img[i] = input_data[i /3][i%3];
}
(new showDoubleFloatArrays()).showArrays(dbg_img, mTilesX*tileSize, mTilesY*tileSize, true, "input_data",titles);
}
mtp.resetCLTPasses();
for (double mdisp = macro_disparity_low; mdisp < (macro_disparity_high - macro_disparity_step); mdisp +=macro_disparity_step){
final CLTPass3d macro_scan = new CLTPass3d(mtp);
CLTMacroSetMeasure( // perform single pass according to prepared tiles operations and disparity
macro_scan, // final CLTPass3d macro_scan, // new, will be filled out
clt_parameters, // EyesisCorrectionParameters.CLTParameters clt_parameters,
geometryCorrection, // GeometryCorrection geometryCorrection,
mdisp, // final double macro_disparity,
false, // final boolean show_corr_partial,
false, // final boolean show_corr_combo,
debugLevel); // final int debugLevel)
CLTMacroMeasure( // perform single pass according to prepared tiles operations and disparity
macro_scan, // final CLTPass3d macro_scan, //
input_data, // final double [][][] input_data,
clt_parameters, // EyesisCorrectionParameters.CLTParameters clt_parameters,
geometryCorrection, // GeometryCorrection geometryCorrection,
""+mdisp, // final String suffix,
false, // final boolean show_corr_partial,
false, // final boolean show_corr_combo,
debugLevel); // final int debugLevel)
mtp.clt_3d_passes.add(macro_scan);
if (input_data != null) {
final CLTPass3d macro_scan = new CLTPass3d(mtp);
CLTMacroSetMeasure( // perform single pass according to prepared tiles operations and disparity
macro_scan, // final CLTPass3d macro_scan, // new, will be filled out
clt_parameters, // EyesisCorrectionParameters.CLTParameters clt_parameters,
geometryCorrection, // GeometryCorrection geometryCorrection,
mdisp, // final double macro_disparity,
false, // final boolean show_corr_partial,
false, // final boolean show_corr_combo,
debugLevel); // final int debugLevel)
CLTMacroMeasure( // perform single pass according to prepared tiles operations and disparity
macro_scan, // final CLTPass3d macro_scan, //
input_data, // final double [][][] input_data,
clt_parameters, // EyesisCorrectionParameters.CLTParameters clt_parameters,
geometryCorrection, // GeometryCorrection geometryCorrection,
""+mdisp, // final String suffix,
false, // final boolean show_corr_partial,
false, // final boolean show_corr_combo,
debugLevel); // final int debugLevel)
mtp.clt_3d_passes.add(macro_scan);
}
}
return mtp;
}
public double [][][] CLTMacroSetData( // perform single pass according to prepared tiles operations and disparity
public double [][][] CLTMacroSetData( // perform single pass according to prepared tiles operations and disparity
final CLTPass3d src_scan // results of the normal correlations (now expecting infinity)
)
{
// final int dbg_x = 295;
// final int dbg_y = 160;
final int pTilesX = tp.getTilesX();
final int pTilesY = tp.getTilesY();
final int tileSize = tp.getTileSize(); //
final int mTilesX = (pTilesX + tileSize - 1) / tileSize; // clt_aberrations_quad_corr truncates
final int mTilesY = (pTilesY + tileSize - 1) / tileSize;
final int mTiles = mTilesX * mTilesY;
final int num_chn = 3;
double corr_red = 0.5; // Red to green correlation weight
double corr_blue = 0.2; // Blue to green correlation weight
double [] col_weights = new double[3];
col_weights[2] = 1.0/(1.0 + corr_red + corr_blue); // green color
col_weights[0] = corr_red * col_weights[2];
col_weights[1] = corr_blue * col_weights[2];
final double [][][] input_data = new double [ImageDtt.QUAD][num_chn][mTiles*tileSize*tileSize];
final int INDX_R0 = ImageDtt.IMG_TONE_RGB;
final int INDX_B0 = ImageDtt.IMG_TONE_RGB + ImageDtt.QUAD;
final int INDX_G0 = ImageDtt.IMG_TONE_RGB + 2 * ImageDtt.QUAD;
for (int sub_cam =0; sub_cam < input_data.length; sub_cam++){
for (int pty = 0; pty < pTilesY; pty++){
for (int ptx = 0; ptx < pTilesX; ptx++){
int pTile = ptx + pty * pTilesX;
int mTile = ptx + pty * (mTilesX * tileSize);
input_data[sub_cam][0][mTile]= weight_var * src_scan.disparity_map[ImageDtt.IMG_DIFF0_INDEX + sub_cam][pTile];
double r = src_scan.disparity_map[INDX_R0 + sub_cam][pTile];
double b = src_scan.disparity_map[INDX_B0 + sub_cam][pTile];
double g = src_scan.disparity_map[INDX_G0 + sub_cam][pTile];
input_data[sub_cam][1][mTile]= weight_Y * (r * col_weights[0] + b * col_weights[1] + g * col_weights[2]);
input_data[sub_cam][2][mTile]= weight_RBmG * (0.5*(r + b) - g);
}
}
}
return input_data;
}
public double [][][] CLTMacroSetData_old( // perform single pass according to prepared tiles operations and disparity
final CLTPass3d src_scan, // results of the normal correlations (now expecting infinity)
final double [][][] other_channels // other channels to correlate, such as average RGB (first index - subcamera, 2-nd - channel, 3-rd - pixel)
)
......@@ -141,6 +215,7 @@ public class MacroCorrelation {
public CLTPass3d CLTMacroSetMeasure( // perform single pass according to prepared tiles operations and disparity
final CLTPass3d macro_scan, // new, will be filled out
EyesisCorrectionParameters.CLTParameters clt_parameters,
......
......@@ -5883,15 +5883,26 @@ public class QuadCLT {
"after_bg-"+tp.clt_3d_passes.size());
}
// Test macro correlation and exit.
// final double weight_var = 1.0; // 1.0; // weight of variance data (old, detects thin wires?)
// final double weight_Y = 1.0; // weight of average intensity
// final double weight_RBmG = 5.0; // weight of average color difference (0.5*(R+B)-G), shoukld be ~5*weight_Y
// TODO: Make double pass - with only weight_var (thin wires) and weight_Y, weight_RBmG - larger objects
// just use two instances of MacroCorrelation, run one after another (move code to MacroCorrelation class)
// and then join
MacroCorrelation mc = new MacroCorrelation(
tp,
clt_parameters.mc_disp8_trust);
clt_parameters.mc_disp8_trust,
clt_parameters.mc_weight_var, // final double weight_var, // weight of variance data (old, detects thin wires?)
clt_parameters.mc_weight_Y, // final double weight_Y, // weight of average intensity
clt_parameters.mc_weight_RBmG // final double weight_RBmG, // weight of average color difference (0.5*(R+B)-G), shoukld be ~5*weight_Y
);
double [][][] input_data = mc.CLTMacroSetData( // perform single pass according to prepared tiles operations and disparity
bgnd_data, // final CLTPass3d src_scan, // results of the normal correlations (now expecting infinity)
null); // final double [][][] other_channels, // other channels to correlate, such as average RGB (first index - subcamera, 2-nd - channel, 3-rd - pixel)
bgnd_data); // final CLTPass3d src_scan, // results of the normal correlations (now expecting infinity)
// null); // final double [][][] other_channels, // other channels to correlate, such as average RGB (first index - subcamera, 2-nd - channel, 3-rd - pixel)
TileProcessor mtp = mc.CLTMacroScan( // perform single pass according to prepared tiles operations and disparity
......
......@@ -51,7 +51,13 @@ public class TileProcessor {
"diff2max", // 17
"diff2maxAvg", // 18
"normStrength", // 19
"overexp"}; // 20
"overexp", // 20
"r0","r1","r2","r3",
"b0","b1","b2","b3",
"g0","g1","g2","g3",
"y0","y1","y2","y3",
"d0","d1","d2","d3"
};
public ArrayList <CLTPass3d> clt_3d_passes = null;
public double [][] rig_disparity_strength = null; // Disparity and strength created by a two-camera rig, with disparity scale and distortions of the main camera
......@@ -2241,10 +2247,22 @@ public class TileProcessor {
public double [][] getShowScan(
CLTPass3d scan)
{
int NUM_SLICES=getScanTitles().length;
int this_IMG_TONE_RGB = 21;
double corr_red = 0.5; // Red to green correlation weight
double corr_blue = 0.2; // Blue to green correlation weight
double scale_diff = 5.0; // scale 0.5*(r+b)-G to match Y
double [] col_weights = new double[3];
col_weights[2] = 1.0/(1.0 + corr_red + corr_blue); // green color
col_weights[0] = corr_red * col_weights[2];
col_weights[1] = corr_blue * col_weights[2];
int this_IMG_TONE_RGB_R = this_IMG_TONE_RGB + 0;
int this_IMG_TONE_RGB_B = this_IMG_TONE_RGB + 4;
int this_IMG_TONE_RGB_G = this_IMG_TONE_RGB + 8;
int this_IMG_TONE_RGB_Y = this_IMG_TONE_RGB+12;
int this_IMG_TONE_RGB_DIFF = this_IMG_TONE_RGB+16;
int tlen = tilesX*tilesY;
double [][] dbg_img = new double[NUM_SLICES][];
......@@ -2272,6 +2290,9 @@ public class TileProcessor {
dbg_img[ 8] = scan.disparity_map[ImageDtt.DISPARITY_INDEX_HOR_STRENGTH];
dbg_img[ 9] = scan.disparity_map[ImageDtt.DISPARITY_INDEX_VERT_STRENGTH];
dbg_img[20] = scan.disparity_map[ImageDtt.OVEREXPOSED];
for (int i = 0; i < 12; i++) {
dbg_img[this_IMG_TONE_RGB+i] = scan.disparity_map[ImageDtt.IMG_TONE_RGB + i];
}
}
dbg_img[1] = scan.calc_disparity_combo;
dbg_img[6] = scan.strength;
......@@ -2293,13 +2314,26 @@ public class TileProcessor {
}
}
}
if (dbg_img[this_IMG_TONE_RGB] != null) {
for (int np = 0; np < 4; 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++){
dbg_img[this_IMG_TONE_RGB_Y+np][i] =
col_weights[0]*dbg_img[this_IMG_TONE_RGB_R + np][i] +
col_weights[1]*dbg_img[this_IMG_TONE_RGB_B + np][i] +
col_weights[2]*dbg_img[this_IMG_TONE_RGB_G + np][i];
dbg_img[this_IMG_TONE_RGB_DIFF+np][i] =
scale_diff* 0.5 * dbg_img[this_IMG_TONE_RGB_R + np][i] +
scale_diff* 0.5 * dbg_img[this_IMG_TONE_RGB_B + np][i] -
scale_diff* 1.0 * dbg_img[this_IMG_TONE_RGB_G + np][i];
}
}
}
}
return dbg_img;
}
public boolean [] getBackgroundMask( // which tiles do belong to the background
double bgnd_range, // disparity range to be considered background
double bgnd_sure, // minimal strength to be considered definitely background
......
......@@ -1545,7 +1545,7 @@ if (debugLevel > -100) return true; // temporarily !
rig_disparity_strength[0], // double [] disparity,
rig_disparity_strength[1], // double [] strength)
cond_sel); // boolean [] selected)
// CLT ASSIGN needs best texture for each tile. Initially will just copy from teh previous master
// CLT ASSIGN needs best texture for each tile. Initially will just copy from the previous master
// composite scan, later - fill disparity gaps and re-measure
......
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