for (int j =0 ; j < double_stacks[i][0].length; j++){
double_stacks[i][2][j]*=0.5; // Scale green 0.5 to compensate more pixels than R,B
}
} else {
for (int j =0 ; j < double_stacks[i][0].length; j++){
double_stacks[i][0][j]*=1.0; // Scale mono by 1/4 - to have the same overall "gain" as for bayer
}
}
}
setTiles (imp_quad[0], // set global tp.tilesX, tp.tilesY
clt_parameters,
threadsMax);
*/
ImageDttimage_dtt=newImageDtt(
ImageDttimage_dtt=newImageDtt(
getNumSensors(),
clt_parameters.transform_size,
clt_parameters.transform_size,
clt_parameters.img_dtt,
isMonochrome(),
isMonochrome(),
isLwir(),
isLwir(),
clt_parameters.getScaleStrength(isAux()));
clt_parameters.getScaleStrength(isAux()));
...
@@ -4655,49 +4647,54 @@ public class QuadCLTCPU {
...
@@ -4655,49 +4647,54 @@ public class QuadCLTCPU {
//TODO: Add array of default disparity - use for combining images in force disparity mode (no correlation), when disparity is predicted from other tiles
//TODO: Add array of default disparity - use for combining images in force disparity mode (no correlation), when disparity is predicted from other tiles
disparity_map=newdouble[ImageDtt.DISPARITY_TITLES.length][];//[0] -residual disparity, [1] - orthogonal (just for debugging) last 4 - max pixel differences
clt_mismatch=newdouble[12][];// What is 12?// not used in lwir
}
}
}
// Includes all 3 colors - will have zeros in unused
// Includes all 3 colors - will have zeros in unused
double[][]disparity_map=newdouble[ImageDtt.DISPARITY_TITLES.length][];//[0] -residual disparity, [1] - orthogonal (just for debugging) last 4 - max pixel differences
doublemin_corr_selected=clt_parameters.min_corr;
doublemin_corr_selected=clt_parameters.min_corr;
double[][]shiftXY=newdouble[4][2];
double[][]shiftXY=newdouble[getNumSensors()][2];
if(!clt_parameters.fine_corr_ignore){
if(!clt_parameters.fine_corr_ignore){// invalid for AUX!
clt_parameters.img_dtt,// final ImageDttParameters imgdtt_params, // Now just extra correlation parameters, later will include, most others
clt_parameters.img_dtt,// final ImageDttParameters imgdtt_params, // Now just extra correlation parameters, later will include, most others
1,// final int macro_scale, // to correlate tile data instead of the pixel data: 1 - pixels, 8 - tiles
1,// final int macro_scale, // to correlate tile data instead of the pixel data: 1 - pixels, 8 - tiles
...
@@ -4712,10 +4722,9 @@ public class QuadCLTCPU {
...
@@ -4712,10 +4722,9 @@ public class QuadCLTCPU {
disparity_array,// final double disparity,
disparity_array,// final double disparity,
image_data,// double_stacks, // final double [][][] imade_data, // first index - number of image in a quad
image_data,// double_stacks, // final double [][][] imade_data, // first index - number of image in a quad
saturation_imp,// boolean [][] saturation_imp, // (near) saturated pixels or null
saturation_imp,// boolean [][] saturation_imp, // (near) saturated pixels or null
// correlation results - final and partial
// correlation results
clt_corr_combo,// [tp.tilesY][tp.tilesX][(2*transform_size-1)*(2*transform_size-1)] // if null - will not calculate
clt_corr_out,// final double [][][][] clt_corr_out, // sparse (by the first index) [type][tilesY][tilesX][(2*transform_size-1)*(2*transform_size-1)] or null
clt_corr_partial,// [tp.tilesY][tp.tilesX][pair][color][(2*transform_size-1)*(2*transform_size-1)] // if null - will not calculate
clt_combo_out,// final double [][][][] clt_combo_out, // sparse (by the first index) [type][tilesY][tilesX][(combo_tile_size] or null
clt_mismatch,// [12][tp.tilesY * tp.tilesX] // transpose unapplied. null - do not calculate
clt_parameters.corr_magic_scale,// still not understood coefficient that reduces reported disparity value. Seems to be around 0.85
clt_parameters.corr_magic_scale,// still not understood coefficient that reduces reported disparity value. Seems to be around 0.85
clt_parameters.shift_x,// final int shiftX, // shift image horizontally (positive - right) - just for testing
clt_parameters.shift_x,// final int shiftX, // shift image horizontally (positive - right) - just for testing
clt_parameters.shift_y,// final int shiftY, // shift image vertically (positive - down)
clt_parameters.shift_y,// final int shiftY, // shift image vertically (positive - down)
clt_parameters.img_dtt.mcorr_comb_width,// final int mcorr_comb_width, // combined correlation tile width
clt_parameters.img_dtt.mcorr_comb_height,// final int mcorr_comb_height, // combined correlation tile full height
clt_parameters.img_dtt.mcorr_comb_offset,// final int mcorr_comb_offset, // combined correlation tile height offset: 0 - centered (-height/2 to height/2), height/2 - only positive (0 to height)
clt_parameters.img_dtt.mcorr_comb_disp,// final double mcorr_comb_disp, // Combined tile per-pixel disparity for baseline == side of a square
clt_parameters.tileX,// -1234, // clt_parameters.tileX, // final int debug_tileX,
clt_parameters.tileX,// -1234, // clt_parameters.tileX, // final int debug_tileX,
clt_parameters.tileY,// final int debug_tileY, -1234 will cause port coordinates debug images
clt_parameters.tileY,// final int debug_tileY, -1234 will cause port coordinates debug images
(clt_parameters.dbg_mode&64)!=0,// no fract shift
(clt_parameters.dbg_mode&64)!=0,// no fract shift
...
@@ -4779,7 +4788,6 @@ public class QuadCLTCPU {
...
@@ -4779,7 +4788,6 @@ public class QuadCLTCPU {
if(clt_parameters.show_nonoverlap){// not used in lwir
if(clt_parameters.show_nonoverlap){// not used in lwir
texture_nonoverlap=image_dtt.combineRBGATiles(
texture_nonoverlap=image_dtt.combineRBGATiles(
texture_tiles,// array [tp.tilesY][tp.tilesX][4][4*transform_size] or [tp.tilesY][tp.tilesX]{null}
texture_tiles,// array [tp.tilesY][tp.tilesX][4][4*transform_size] or [tp.tilesY][tp.tilesX]{null}
/// image_dtt.transform_size,
false,// when false - output each tile as 16x16, true - overlap to make 8x8
false,// when false - output each tile as 16x16, true - overlap to make 8x8
clt_parameters.sharp_alpha,// combining mode for alpha channel: false - treat as RGB, true - apply center 8x8 only
clt_parameters.sharp_alpha,// combining mode for alpha channel: false - treat as RGB, true - apply center 8x8 only
threadsMax,// maximal number of threads to launch
threadsMax,// maximal number of threads to launch
...
@@ -4797,7 +4805,6 @@ public class QuadCLTCPU {
...
@@ -4797,7 +4805,6 @@ public class QuadCLTCPU {
intalpha_index=3;
intalpha_index=3;
texture_overlap=image_dtt.combineRBGATiles(
texture_overlap=image_dtt.combineRBGATiles(
texture_tiles,// array [tp.tilesY][tp.tilesX][4][4*transform_size] or [tp.tilesY][tp.tilesX]{null}
texture_tiles,// array [tp.tilesY][tp.tilesX][4][4*transform_size] or [tp.tilesY][tp.tilesX]{null}
/// image_dtt.transform_size,
true,// when false - output each tile as 16x16, true - overlap to make 8x8
true,// when false - output each tile as 16x16, true - overlap to make 8x8
clt_parameters.sharp_alpha,// combining mode for alpha channel: false - treat as RGB, true - apply center 8x8 only
clt_parameters.sharp_alpha,// combining mode for alpha channel: false - treat as RGB, true - apply center 8x8 only
threadsMax,// maximal number of threads to launch
threadsMax,// maximal number of threads to launch
...
@@ -4845,6 +4852,9 @@ public class QuadCLTCPU {
...
@@ -4845,6 +4852,9 @@ public class QuadCLTCPU {
}
}
}
}
}
}
/*
// visualize correlation results
// visualize correlation results
// bo-b3 non-zero, r*, g* - zero
// bo-b3 non-zero, r*, g* - zero
if (clt_corr_combo!=null){
if (clt_corr_combo!=null){
...
@@ -5011,47 +5021,60 @@ public class QuadCLTCPU {
...
@@ -5011,47 +5021,60 @@ public class QuadCLTCPU {
titles );
titles );
}
}
if(!batch_mode&&!infinity_corr&&(clt_corr_partial!=null)){// not used in lwir FALSE
//TODO: Add array of default disparity - use for combining images in force disparity mode (no correlation), when disparity is predicted from other tiles
// Includes all 3 colors - will have zeros in unused
geometryCorrection,// GeometryCorrection gc,
double[][]disparity_map=newdouble[ImageDtt.DISPARITY_TITLES.length][];//[0] -residual disparity, [1] - orthogonal (just for debugging) last 4 - max pixel differences
clt_parameters.ly_ers_rot,// boolean ers_rot, // Enable ERS correction of the camera rotation
clt_parameters.ly_ers_forw,// boolean ers_forw, // Enable ERS correction of the camera linear movement in z direction
clt_parameters.ly_ers_side,// boolean ers_side, // Enable ERS correction of the camera linear movement in x direction
clt_parameters.ly_ers_vert,// boolean ers_vert, // Enable ERS correction of the camera linear movement in y direction
// add balancing-related here?
clt_parameters.ly_par_sel,// int manual_par_sel, // Manually select the parameter mask bit 0 - sym0, bit1 - sym1, ... (0 - use boolean flags, != 0 - ignore boolean flags)
clt_parameters.ly_weight_infinity,//0.3, // double weight_infinity, // 0.3, total weight of infinity tiles fraction (0.0 - 1.0)
clt_parameters.ly_weight_disparity,//0.0, // double weight_disparity, // 0.0 disparity weight relative to the sum of 8 lazy eye values of the same tile
clt_parameters.ly_weight_disparity_inf,//0.5, // double weight_disparity_inf,// 0.5 disparity weight relative to the sum of 8 lazy eye values of the same tile for infinity
clt_parameters.ly_max_disparity_far,//5.0, // double max_disparity_far, // 5.0 reduce weights of near tiles proportional to sqrt(max_disparity_far/disparity)
clt_parameters.ly_max_disparity_use,//5.0, // double max_disparity_use, // 5.0 (default 1000)disable near objects completely - use to avoid ERS
clt_parameters.corr_magic_scale, // double magic_coeff, // still not understood coefficent that reduces reported disparity value. Seems to be around 8.5
debugLevel + (clt_parameters.fine_dbg ? 1:0)); // int debugLevel)
if ((new_corr != null) && (debugLevel > -1)){
System.out.println("process_infinity_corr(): ready to apply infinity correction");
show_fine_corr(
new_corr, // double [][][] corr,
"");// String prefix)
}
if (clt_parameters.inf_disp_apply){
apply_fine_corr(
new_corr,
debugLevel + 2);
}
}
}
if (!batch_mode && !infinity_corr && clt_parameters.corr_show && (debugLevel > -1)){ // not used in lwir FALSE
double [][] corr_rslt = new double [clt_corr_combo.length][];
String [] titles = new String[clt_corr_combo.length]; // {"combo","sum"};
for (int i = 0; i< titles.length; i++) titles[i] = ImageDtt.TCORR_TITLES[i];
clt_parameters.ly_ers_rot,// boolean ers_rot, // Enable ERS correction of the camera rotation
clt_parameters.ly_ers_forw,// boolean ers_forw, // Enable ERS correction of the camera linear movement in z direction
clt_parameters.ly_ers_side,// boolean ers_side, // Enable ERS correction of the camera linear movement in x direction
clt_parameters.ly_ers_vert,// boolean ers_vert, // Enable ERS correction of the camera linear movement in y direction
// add balancing-related here?
clt_parameters.ly_par_sel,// int manual_par_sel, // Manually select the parameter mask bit 0 - sym0, bit1 - sym1, ... (0 - use boolean flags, != 0 - ignore boolean flags)
clt_parameters.ly_weight_infinity,//0.3, // double weight_infinity, // 0.3, total weight of infinity tiles fraction (0.0 - 1.0)
clt_parameters.ly_weight_disparity,//0.0, // double weight_disparity, // 0.0 disparity weight relative to the sum of 8 lazy eye values of the same tile
clt_parameters.ly_weight_disparity_inf,//0.5, // double weight_disparity_inf,// 0.5 disparity weight relative to the sum of 8 lazy eye values of the same tile for infinity
clt_parameters.ly_max_disparity_far,//5.0, // double max_disparity_far, // 5.0 reduce weights of near tiles proportional to sqrt(max_disparity_far/disparity)
clt_parameters.ly_max_disparity_use,//5.0, // double max_disparity_use, // 5.0 (default 1000)disable near objects completely - use to avoid ERS
// int convolveFFTSize, // 128 - fft size, kernel size should be size/2
double[]scaleExposures,// probably not needed here
double[]scaleExposures,// probably not needed here
finalintthreadsMax,// maximal number of threads to launch
finalintthreadsMax,// maximal number of threads to launch
finalbooleanupdateStatus,
finalbooleanupdateStatus,
...
@@ -6660,7 +7295,9 @@ public class QuadCLTCPU {
...
@@ -6660,7 +7295,9 @@ public class QuadCLTCPU {
}
}
// =================
// =================
ImageDttimage_dtt=newImageDtt(
ImageDttimage_dtt=newImageDtt(
getNumSensors(),
clt_parameters.transform_size,
clt_parameters.transform_size,
clt_parameters.img_dtt,
isMonochrome(),
isMonochrome(),
isLwir(),
isLwir(),
clt_parameters.getScaleStrength(isAux()));
clt_parameters.getScaleStrength(isAux()));
...
@@ -6683,9 +7320,7 @@ public class QuadCLTCPU {
...
@@ -6683,9 +7320,7 @@ public class QuadCLTCPU {
//TODO: Add array of default disparity - use for combining images in force disparity mode (no correlation), when disparity is predicted from other tiles
//TODO: Add array of default disparity - use for combining images in force disparity mode (no correlation), when disparity is predicted from other tiles
// undecided, so 2 modes of combining alpha - same as rgb, or use center tile only
// undecided, so 2 modes of combining alpha - same as rgb, or use center tile only
double[][][][]clt_corr_combo=newdouble[ImageDtt.TCORR_TITLES.length][tilesY][tilesX][];// will only be used inside?
doublemin_corr_selected=clt_parameters.min_corr;
doublemin_corr_selected=clt_parameters.min_corr;
double[][][]disparity_maps=newdouble[clt_parameters.disp_scan_count][ImageDtt.DISPARITY_TITLES.length][];//[0] -residual disparity, [1] - orthogonal (just for debugging)
double[][][]disparity_maps=newdouble[clt_parameters.disp_scan_count][ImageDtt.DISPARITY_TITLES.length][];//[0] -residual disparity, [1] - orthogonal (just for debugging)
clt_corr_combo=null;// Something is broke in old code, tries to use color==3 ==colors.weights.length
// clt_corr_combo = null; // Something is broke in old code, tries to use color==3 ==colors.weights.length
image_dtt.clt_aberrations_quad_corr(
image_dtt.clt_aberrations_quad_corr(
clt_parameters.img_dtt,// final ImageDttParameters imgdtt_params, // Now just extra correlation parameters, later will include, most others
clt_parameters.img_dtt,// final ImageDttParameters imgdtt_params, // Now just extra correlation parameters, later will include, most others
1,// final int macro_scale, // to correlate tile data instead of the pixel data: 1 - pixels, 8 - tiles
1,// final int macro_scale, // to correlate tile data instead of the pixel data: 1 - pixels, 8 - tiles
...
@@ -11021,8 +11628,8 @@ public class QuadCLTCPU {
...
@@ -11021,8 +11628,8 @@ public class QuadCLTCPU {
image_data,// final double [][][] imade_data, // first index - number of image in a quad
image_data,// final double [][][] imade_data, // first index - number of image in a quad
saturation_imp,// boolean [][] saturation_imp, // (near) saturated pixels or null
saturation_imp,// boolean [][] saturation_imp, // (near) saturated pixels or null
// correlation results - final and partial
// correlation results - final and partial
clt_corr_combo,// [tp.tilesY][tp.tilesX][(2*transform_size-1)*(2*transform_size-1)] // if null - will not calculate
null,// clt_corr_combo, // [tp.tilesY][tp.tilesX][(2*transform_size-1)*(2*transform_size-1)] // if null - will not calculate
clt_corr_partial,// null, // clt_corr_partial, // [tp.tilesY][tp.tilesX][quad]color][(2*transform_size-1)*(2*transform_size-1)] // if null - will not calculate
null,// clt_corr_partial, // null, // clt_corr_partial, // [tp.tilesY][tp.tilesX][quad]color][(2*transform_size-1)*(2*transform_size-1)] // if null - will not calculate
null,// [tp.tilesY][tp.tilesX][pair]{dx,dy,weight}[(2*transform_size-1)*(2*transform_size-1)] // transpose unapplied. null - do not calculate
null,// [tp.tilesY][tp.tilesX][pair]{dx,dy,weight}[(2*transform_size-1)*(2*transform_size-1)] // transpose unapplied. null - do not calculate
// Use it with disparity_maps[scan_step]? clt_mismatch, // [tp.tilesY][tp.tilesX][pair]{dx,dy,weight}[(2*transform_size-1)*(2*transform_size-1)] // transpose unapplied. null - do not calculate
// Use it with disparity_maps[scan_step]? clt_mismatch, // [tp.tilesY][tp.tilesX][pair]{dx,dy,weight}[(2*transform_size-1)*(2*transform_size-1)] // transpose unapplied. null - do not calculate
image_data,// final double [][][] imade_data, // first index - number of image in a quad
image_data,// final double [][][] imade_data, // first index - number of image in a quad
saturation_imp,// boolean [][] saturation_imp, // (near) saturated pixels or null
saturation_imp,// boolean [][] saturation_imp, // (near) saturated pixels or null
// correlation results - final and partial
// correlation results - final and partial
clt_corr_combo,// [tp.tilesY][tp.tilesX][(2*transform_size-1)*(2*transform_size-1)] // if null - will not calculate
null,// clt_corr_combo, // [tp.tilesY][tp.tilesX][(2*transform_size-1)*(2*transform_size-1)] // if null - will not calculate
null,// clt_corr_partial, // [tp.tilesY][tp.tilesX][quad]color][(2*transform_size-1)*(2*transform_size-1)] // if null - will not calculate
null,// clt_corr_partial, // [tp.tilesY][tp.tilesX][quad]color][(2*transform_size-1)*(2*transform_size-1)] // if null - will not calculate
mismatch,// null, // [tp.tilesY][tp.tilesX][pair]{dx,dy,weight}[(2*transform_size-1)*(2*transform_size-1)] // transpose unapplied. null - do not calculate
mismatch,// null, // [tp.tilesY][tp.tilesX][pair]{dx,dy,weight}[(2*transform_size-1)*(2*transform_size-1)] // transpose unapplied. null - do not calculate
// Use it with disparity_maps[scan_step]? clt_mismatch, // [tp.tilesY][tp.tilesX][pair]{dx,dy,weight}[(2*transform_size-1)*(2*transform_size-1)] // transpose unapplied. null - do not calculate
// Use it with disparity_maps[scan_step]? clt_mismatch, // [tp.tilesY][tp.tilesX][pair]{dx,dy,weight}[(2*transform_size-1)*(2*transform_size-1)] // transpose unapplied. null - do not calculate
...
@@ -11337,7 +11946,7 @@ public class QuadCLTCPU {
...
@@ -11337,7 +11946,7 @@ public class QuadCLTCPU {
int[][]tile_op=scan.tile_op;
int[][]tile_op=scan.tile_op;
double[][]disparity_array=scan.disparity;
double[][]disparity_array=scan.disparity;
// undecided, so 2 modes of combining alpha - same as rgb, or use center tile only
// undecided, so 2 modes of combining alpha - same as rgb, or use center tile only
double[][][][]clt_corr_combo=null;// new double [ImageDtt.TCORR_TITLES.length][tilesY][tilesX][]; // will only be used inside?
// double [][][][] clt_corr_combo = null; // new double [ImageDtt.TCORR_TITLES.length][tilesY][tilesX][]; // will only be used inside?
image_data,// final double [][][] imade_data, // first index - number of image in a quad
image_data,// final double [][][] imade_data, // first index - number of image in a quad
saturation_imp,// boolean [][] saturation_imp, // (near) saturated pixels or null
saturation_imp,// boolean [][] saturation_imp, // (near) saturated pixels or null
// correlation results - final and partial
// correlation results - final and partial
clt_corr_combo,// [tp.tilesY][tp.tilesX][(2*transform_size-1)*(2*transform_size-1)] // if null - will not calculate
null,// clt_corr_combo, // [tp.tilesY][tp.tilesX][(2*transform_size-1)*(2*transform_size-1)] // if null - will not calculate
null,// clt_corr_partial, // [tp.tilesY][tp.tilesX][quad]color][(2*transform_size-1)*(2*transform_size-1)] // if null - will not calculate
null,// clt_corr_partial, // [tp.tilesY][tp.tilesX][quad]color][(2*transform_size-1)*(2*transform_size-1)] // if null - will not calculate
mismatch,// null, // [tp.tilesY][tp.tilesX][pair]{dx,dy,weight}[(2*transform_size-1)*(2*transform_size-1)] // transpose unapplied. null - do not calculate
mismatch,// null, // [tp.tilesY][tp.tilesX][pair]{dx,dy,weight}[(2*transform_size-1)*(2*transform_size-1)] // transpose unapplied. null - do not calculate
// Use it with disparity_maps[scan_step]? clt_mismatch, // [tp.tilesY][tp.tilesX][pair]{dx,dy,weight}[(2*transform_size-1)*(2*transform_size-1)] // transpose unapplied. null - do not calculate
// Use it with disparity_maps[scan_step]? clt_mismatch, // [tp.tilesY][tp.tilesX][pair]{dx,dy,weight}[(2*transform_size-1)*(2*transform_size-1)] // transpose unapplied. null - do not calculate
double[][]disparity_bimap=newdouble[ImageDtt.BIDISPARITY_TITLES.length][];//[0] -residual disparity, [1] - orthogonal (just for debugging) last 4 - max pixel differences
double[][]disparity_bimap=newdouble[ImageDtt.BIDISPARITY_TITLES.length][];//[0] -residual disparity, [1] - orthogonal (just for debugging) last 4 - max pixel differences
ImageDttimage_dtt=newImageDtt(
ImageDttimage_dtt=newImageDtt(
quadCLT_main.getNumSensors(),
clt_parameters.transform_size,
clt_parameters.transform_size,
clt_parameters.img_dtt,
quadCLT_main.isMonochrome(),
quadCLT_main.isMonochrome(),
quadCLT_main.isLwir(),
quadCLT_main.isLwir(),
clt_parameters.getScaleStrength(false));
clt_parameters.getScaleStrength(false));
...
@@ -1380,7 +1382,9 @@ public class TwoQuadCLT {
...
@@ -1380,7 +1382,9 @@ public class TwoQuadCLT {
}
}
double[][]disparity_bimap=newdouble[ImageDtt.BIDISPARITY_TITLES.length][];//[0] -residual disparity, [1] - orthogonal (just for debugging) last 4 - max pixel differences
double[][]disparity_bimap=newdouble[ImageDtt.BIDISPARITY_TITLES.length][];//[0] -residual disparity, [1] - orthogonal (just for debugging) last 4 - max pixel differences