...
 
Commits (2)
......@@ -167,7 +167,7 @@ public class CLTParameters {
public boolean inf_restore_disp = true; // Add disparity back to d{x,y}[i] (debug feature)
// Lazy eye parameters
public boolean ly_lma_ers = true; // Use 2020 LMA-based measurement of mismatch
public boolean ly_lma_ers = true; // Use 2020 LMA-based measurement of mismatch (GPU-supported)
public double ly_gt_strength = 0.18; // use some configurable parameters
public boolean ly_gt_use_wnd = true; //
public double ly_gt_rms = 0.2; // split small source samples to FG/BG if all aux tile RMS exceeds this value
......@@ -797,6 +797,7 @@ public class CLTParameters {
public boolean gpu_use_aux = false; // accelerate tile processor for the aux (lwir) quad camera
public boolean gpu_use_aux_macro = false; // accelerate tile processor for the aux (lwir) quad camera in macro mode
public boolean gpu_use_aux_adjust = false; // accelerate tile processor for the aux (lwir) quad camera for field calibration
public boolean gpu_debug_accum = false; // debug multi-tile TD accumulation
public boolean replaceWeakOutliers = true; // false;
......@@ -1600,6 +1601,7 @@ public class CLTParameters {
properties.setProperty(prefix+"gpu_use_aux", this.gpu_use_aux +"");
properties.setProperty(prefix+"gpu_use_aux_macro", this.gpu_use_aux_macro +"");
properties.setProperty(prefix+"gpu_use_aux_adjust", this.gpu_use_aux_adjust +"");
properties.setProperty(prefix+"gpu_debug_accum", this.gpu_debug_accum +"");
properties.setProperty(prefix+"debug_initial_discriminate", this.debug_initial_discriminate+"");
properties.setProperty(prefix+"dbg_migrate", this.dbg_migrate+"");
......@@ -2387,6 +2389,7 @@ public class CLTParameters {
if (properties.getProperty(prefix+"gpu_use_aux")!=null) this.gpu_use_aux=Boolean.parseBoolean(properties.getProperty(prefix+"gpu_use_aux"));
if (properties.getProperty(prefix+"gpu_use_aux_macro")!=null) this.gpu_use_aux_macro=Boolean.parseBoolean(properties.getProperty(prefix+"gpu_use_aux_macro"));
if (properties.getProperty(prefix+"gpu_use_aux_adjust")!=null) this.gpu_use_aux_adjust=Boolean.parseBoolean(properties.getProperty(prefix+"gpu_use_aux_adjust"));
if (properties.getProperty(prefix+"gpu_debug_accum")!=null) this.gpu_debug_accum=Boolean.parseBoolean(properties.getProperty(prefix+"gpu_debug_accum"));
if (properties.getProperty(prefix+"debug_initial_discriminate")!=null) this.debug_initial_discriminate=Boolean.parseBoolean(properties.getProperty(prefix+"debug_initial_discriminate"));
if (properties.getProperty(prefix+"dbg_migrate")!=null) this.dbg_migrate=Boolean.parseBoolean(properties.getProperty(prefix+"dbg_migrate"));
......@@ -2612,7 +2615,7 @@ public class CLTParameters {
gd.addTab ("Lazy eye", "Lazy eye parameters");
gd.addCheckbox ("Use 2020 LMA-based measurement of mismatch", this.ly_lma_ers);
gd.addCheckbox ("Use 2020 LMA-based measurement of mismatch (GPU-supported)", this.ly_lma_ers);
gd.addMessage ("--- main-to-aux depth map parameters ---");
gd.addNumericField("Minimal reference (main) channel correlation strength", this.ly_gt_strength, 3);
gd.addCheckbox ("Use window for AUX tiles to reduce weight of the hi-res tiles near low-res tile boundaries", this.ly_gt_use_wnd);
......@@ -3337,6 +3340,7 @@ public class CLTParameters {
gd.addCheckbox ("Accelerate tile processor for the aux (lwir) quad camera", this.gpu_use_aux);
gd.addCheckbox ("Accelerate tile processor for the aux (lwir) quad camera in macro mode", this.gpu_use_aux_macro);
gd.addCheckbox ("Accelerate tile processor for the aux (lwir) quad camera for field calibration", this.gpu_use_aux_adjust);
gd.addCheckbox ("Debug multi-tile TD accumulation", this.gpu_debug_accum);
gd.addTab ("LWIR", "parameters for LWIR/EO 8-camera rig");
this.lwir.dialogQuestions(gd);
......@@ -4097,6 +4101,7 @@ public class CLTParameters {
this.gpu_use_aux= gd.getNextBoolean();
this.gpu_use_aux_macro= gd.getNextBoolean();
this.gpu_use_aux_adjust= gd.getNextBoolean();
this.gpu_debug_accum= gd.getNextBoolean();
this.lwir.dialogAnswers(gd);
......
This source diff could not be displayed because it is too large. You can view the blob instead.
......@@ -1509,7 +1509,7 @@ public class ImageDttCPU {
}
// removing macro and FPGA modes
public double [][] cltMeasureLazyEye ( // returns d,s lazy eye parameters
public double[][] cltMeasureLazyEye ( // returns d,s lazy eye parameters
final ImageDttParameters imgdtt_params, // Now just extra correlation parameters, later will include, most others
final int [][] tile_op, // [tilesY][tilesX] - what to do - 0 - nothing for this tile
final double [][] disparity_array, // [tilesY][tilesX] - individual per-tile expected disparity
......@@ -1753,6 +1753,7 @@ public class ImageDttCPU {
// filter only tiles with similar disparity to enable lazy eye for the ERS.
int num_good_tiles = 0;
while (true) {
// num_good_tiles = 0; // FIXME: Was missing - uncomment?
int mnTx = -1, mnTy = -1, mxTx = -1, mxTy = -1;
double mn = Double.NaN;
double mx = Double.NaN;
......@@ -2148,7 +2149,7 @@ public class ImageDttCPU {
imgdtt_params.lmas_max_rel_rms, // maximal relative (to average max/min amplitude LMA RMS) // May be up to 0.3)
imgdtt_params.lmas_min_strength, // minimal composite strength (sqrt(average amp squared over absolute RMS)
imgdtt_params.lmas_min_ac, // minimal of A and C coefficients maximum (measures sharpest point/line)
imgdtt_params.lmas_max_area, //double lma_max_area, // maximal half-area (if > 0.0)
imgdtt_params.lmas_max_area, // double lma_max_area, // maximal half-area (if > 0.0)
imgdtt_params.lma_str_scale, // convert lma-generated strength to match previous ones - scale
imgdtt_params.lma_str_offset // convert lma-generated strength to match previous ones - add to result
)[0];
......
......@@ -7403,17 +7403,37 @@ public class QuadCLTCPU {
tp.clt_3d_passes.get(refine_pass), // CLTPass3d scan,
"after_refinePassSetup-"+tp.clt_3d_passes.size());
// Just debugging
if (clt_parameters.gpu_debug_accum) {
CLTMeasureCorrTesting( // perform single pass according to prepared tiles operations and disparity
clt_parameters,
0,
false, // true, // final boolean save_textures,
threadsMax, // maximal number of threads to launch
updateStatus,
debugLevel);
CLTMeasureCorrTesting( // perform single pass according to prepared tiles operations and disparity
clt_parameters,
refine_pass,
false, // true, // final boolean save_textures,
threadsMax, // maximal number of threads to launch
updateStatus,
debugLevel);
}
// End of just debugging
CLTMeasureCorr( // perform single pass according to prepared tiles operations and disparity
// image_data, // first index - number of image in a quad
// saturation_imp, //final boolean [][] saturation_imp, // (near) saturated pixels or null
clt_parameters,
refine_pass,
false, // true, // final boolean save_textures,
threadsMax, // maximal number of threads to launch
updateStatus,
debugLevel);
if (debugLevel > -1){
System.out.println("CLTMeasure("+refine_pass+")");
if (debugLevel > -3){
System.out.println("CLTMeasure("+refine_pass+")-*");
}
if (show_init_refine) tp.showScan(
tp.clt_3d_passes.get(refine_pass), // CLTPass3d scan,
......@@ -7664,12 +7684,28 @@ public class QuadCLTCPU {
for (int nTile = 0 ; nTile < bg_use.length; nTile++) {
if (bg_sel[nTile] &&
(filtered_bgnd_disp_strength[1][nTile] > 0.0) &&
(bg_str[nTile] > clt_parameters.fcorr_inf_strength) &&
((bg_overexp == null) || (bg_overexp[nTile] < clt_parameters.lym_overexp))
(bg_str[nTile] > clt_parameters.fcorr_inf_strength) && // 0.13
((bg_overexp == null) || (bg_overexp[nTile] < clt_parameters.lym_overexp)) //1e-4
){
bg_use[nTile] = true;
}
}
if (true) {
String [] dbg_titles = {"fdisp", "fstr", "disp", "str", "overexp","sel","use"};
double [][] ddd = {filtered_bgnd_disp_strength[0],filtered_bgnd_disp_strength[1],null,bg_str,bg_overexp, null, null};
ddd[5] = new double [bg_sel.length];
ddd[6] = new double [bg_sel.length];
for (int nTile = 0 ; nTile < bg_use.length; nTile++) {
ddd[5][nTile] = bg_sel[nTile]?1.0:0.0;
ddd[6][nTile] = bg_use[nTile]?1.0:0.0;
}
(new ShowDoubleFloatArrays()).showArrays(
ddd,
tp.getTilesX(),
tp.getTilesY(),
true,
"filtered_bgnd_disp_strength",dbg_titles);
}
int num_bg = tp.clt_3d_passes.get(bg_scan).setTileOpDisparity( // other minimal strength?
bg_use, // boolean [] selection,
null); // double [] disparity); // null for 0
......@@ -7694,12 +7730,8 @@ public class QuadCLTCPU {
System.out.println("Number of background tiles = " + num_bg+", number of lazy eye tiles = " + num_combo);
}
// measure combo
CLTMeasure( // perform single pass according to prepared tiles operations and disparity
// image_data, // first index - number of image in a quad
// saturation_imp, // boolean [][] saturation_imp, // (near) saturated pixels or null
/*
CLTMeasure( // perform single pass according to prepared tiles operations and disparity **** CPU?
clt_parameters,
combo_scan,
false, // final boolean save_textures,
......@@ -7708,9 +7740,18 @@ public class QuadCLTCPU {
tp.threadsMax, // maximal number of threads to launch
false, // updateStatus,
debugLevelInner - 1);
if (!batch_mode && clt_parameters.show_extrinsic && (debugLevel >-1)) {
*/
CLTMeasureCorr( // perform single pass according to prepared tiles operations and disparity **** CPU?
clt_parameters,
combo_scan,
false, // final boolean save_textures,
tp.threadsMax, // maximal number of threads to launch
false, // updateStatus,
debugLevelInner - 1);
if (!batch_mode && clt_parameters.show_extrinsic && (debugLevel >-3)) {
tp.showScan(
tp.clt_3d_passes.get(bg_scan), // CLTPass3d scan,
tp.clt_3d_passes.get(bg_scan), // CLTPass3d scan, badly filtered?
"bg_scan_post"); //String title)
tp.showScan(
tp.clt_3d_passes.get(combo_scan), // CLTPass3d scan,
......@@ -7755,7 +7796,25 @@ public class QuadCLTCPU {
combo_use[nTile] = true;
}
}
int num_combo1 = tp.clt_3d_passes.get(combo_scan).setTileOpDisparity(
if (true) {
String [] dbg_titles = {"fdisp", "fstr", "disp", "str", "overexp","sel","use"};
double [][] ddd = {filtered_combo_scand_isp_strength[0],filtered_combo_scand_isp_strength[1],combo_disp,combo_str,combo_overexp, null, null};
ddd[5] = new double [combo_use.length];
ddd[6] = new double [combo_use.length];
for (int nTile = 0 ; nTile < combo_use.length; nTile++) {
//ddd[5][nTile] = bg_sel[nTile]?1.0:0.0;
ddd[6][nTile] = combo_use[nTile]?1.0:0.0;
}
(new ShowDoubleFloatArrays()).showArrays(
ddd,
tp.getTilesX(),
tp.getTilesY(),
true,
"filtered_combo_scand_isp_strength",dbg_titles);
}
int num_combo1 = tp.clt_3d_passes.get(combo_scan).setTileOpDisparity( // GPU ==0 !
combo_use, // boolean [] selection,
combo_disp); // double [] disparity);
if (debugLevel > -1) {
......@@ -7772,7 +7831,7 @@ public class QuadCLTCPU {
dbg_bg_use[i] = bg_use[i]? 1.0:0.0;
dbg_combo_use[i] = combo_use[i]? 1.0:0.0;
}
double [][]dbg_img = {
double [][]dbg_img = { // bg_use - all 0? (never assigned)?
filtered_bgnd_disp_strength[0],
filtered_bgnd_disp_strength[1],
filtered_combo_scand_isp_strength[0],
......@@ -7816,9 +7875,9 @@ public class QuadCLTCPU {
false, // updateStatus,
debugLevelInner -1); // - 1); // -5-1
if (debugLevel > -2) {
tp.showScan(
tp.clt_3d_passes.get(combo_scan), // CLTPass3d scan,
"LY_combo_scan-"+combo_scan+"_post"); //String title)
tp.showScan(
tp.clt_3d_passes.get(combo_scan), // CLTPass3d scan,
"LY_combo_scan-"+combo_scan+"_post"); //String title)
}
int tilesX = tp.getTilesX();
......@@ -7913,9 +7972,8 @@ public class QuadCLTCPU {
break;
}
if (update_disp_from_latest) {
/*
CLTMeasure( // perform single pass according to prepared tiles operations and disparity
// image_data, // first index - number of image in a quad
// saturation_imp, // boolean [][] saturation_imp, // (near) saturated pixels or null
clt_parameters,
combo_scan,
false, // final boolean save_textures,
......@@ -7924,14 +7982,20 @@ public class QuadCLTCPU {
tp.threadsMax, // maximal number of threads to launch
false, // updateStatus,
debugLevelInner - 1);
*/
CLTMeasureCorr( // perform single pass according to prepared tiles operations and disparity
clt_parameters,
combo_scan,
false, // final boolean save_textures,
tp.threadsMax, // maximal number of threads to launch
false, // updateStatus,
debugLevelInner - 1);
}
} else {
} else { // Old, no-GPU
double [][] bg_mismatch = new double[12][];
double [][] combo_mismatch = new double[12][];
CLTMeasure( // perform single pass according to prepared tiles operations and disparity
// image_data, // first index - number of image in a quad
// saturation_imp, // boolean [][] saturation_imp, // (near) saturated pixels or null
clt_parameters,
bg_scan,
false, // final boolean save_textures,
......@@ -7941,8 +8005,6 @@ public class QuadCLTCPU {
false, // updateStatus,
debugLevelInner - 1);
CLTMeasure( // perform single pass according to prepared tiles operations and disparity
// image_data, // first index - number of image in a quad
// saturation_imp, // boolean [][] saturation_imp, // (near) saturated pixels or null
clt_parameters,
combo_scan,
false, // final boolean save_textures,
......@@ -11317,4 +11379,21 @@ public class QuadCLTCPU {
}
scan.setTilesRBGA(tileTones);
}
// non-trivial in QuadCLT (for the GPU)
public CLTPass3d CLTMeasureCorrTesting( // perform single pass according to prepared tiles operations and disparity // not used in lwir
CLTParameters clt_parameters,
final int scanIndex,
final boolean save_textures,
final int threadsMax, // maximal number of threads to launch
final boolean updateStatus,
final int debugLevel)
{
return CLTMeasureCorrTesting( // perform single pass according to prepared tiles operations and disparity // not used in lwir
clt_parameters,
scanIndex,
save_textures,
threadsMax, // maximal number of threads to launch
updateStatus,
debugLevel);
}
}
......@@ -8303,6 +8303,18 @@ if (debugLevel > -100) return true; // temporarily !
System.out.println("Adjusting main camera image set for "+quadCLT_main.image_name+
", pass "+(num_adjust_main+1)+" of "+adjust_main);
}
if (debugLevel > -5){
int scan_index = quadCLT_main.tp.clt_3d_passes.size() -1;
quadCLT_main.tp.showScan(
quadCLT_main.tp.clt_3d_passes.get(scan_index), // CLTPass3d scan,
"pre-adjust-extrinsic-scan-"+scan_index); //String title)
for (int s = 0; (s < 5) && (s < scan_index); s++) {
quadCLT_main.tp.showScan(
quadCLT_main.tp.clt_3d_passes.get(s), // CLTPass3d scan,
"pre-adjust-extrinsic-scan-"+s); //String title)
}
}
boolean ok = quadCLT_main.extrinsicsCLT(
clt_parameters, // EyesisCorrectionParameters.CLTParameters clt_parameters,
false, // adjust_poly,
......@@ -8312,7 +8324,6 @@ if (debugLevel > -100) return true; // temporarily !
// clear memory for main
quadCLT_main.tp.resetCLTPasses();
if (!ok) break;
}
// Generate 4 main camera images and thumbnail
if (quadCLT_main.correctionsParameters.clt_batch_4img){
......@@ -8378,6 +8389,15 @@ if (debugLevel > -100) return true; // temporarily !
quadCLT_main.tp.clt_3d_passes.get( quadCLT_main.tp.clt_3d_passes.size() -1),
false); // boolean force_final);
if (debugLevel > -5){
int scan_index = quadCLT_main.tp.clt_3d_passes.size() -1;
quadCLT_main.tp.showScan(
quadCLT_main.tp.clt_3d_passes.get(scan_index), // CLTPass3d scan,
"test_pre-after-"+scan_index); //String title)
}
dsi[DSI_DISPARITY_MAIN] = main_last_scan[0];
dsi[DSI_STRENGTH_MAIN] = main_last_scan[1];
if (quadCLT_main.correctionsParameters.clt_batch_dsi) { // Should be always enabled ?
......@@ -8479,6 +8499,16 @@ if (debugLevel > -100) return true; // temporarily !
// 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]};
if ((adjust_aux == 0) &&
!quadCLT_main.correctionsParameters.clt_batch_4img_aux &&
!quadCLT_main.correctionsParameters.clt_batch_dsi_aux &&
!quadCLT_main.correctionsParameters.clt_batch_genMl &&
!quadCLT_main.correctionsParameters.clt_batch_save_extrinsics &&
!quadCLT_main.correctionsParameters.clt_batch_save_all) {
continue;
}
quadCLT_aux.ds_from_main = quadCLT_aux.depthMapMainToAux( // only 2 layers for adjustments
main_ds, // double [][] ds,
quadCLT_main.getGeometryCorrection(), // GeometryCorrection geometryCorrection_main,
......