Commit a7a1e850 authored by Andrey Filippov's avatar Andrey Filippov

Debugging batch processing

parent cb61d659
...@@ -118,8 +118,11 @@ public class EyesisCorrectionParameters { ...@@ -118,8 +118,11 @@ public class EyesisCorrectionParameters {
public String x3dSubdirSuffix= ""; public String x3dSubdirSuffix= "";
// CLT 3d batch parameters // CLT 3d batch parameters
public int rig_batch_adjust_main = 0;
public int rig_batch_adjust_aux = 0;
public int rig_batch_adjust_rig = 0;
public boolean clt_batch_apply_man = true; // Apply (and disable) manual pixel shift public boolean clt_batch_apply_man = false; // Apply (and disable) manual pixel shift
public boolean clt_batch_extrinsic = false; // Calibrate extrinsic parameters for each set public boolean clt_batch_extrinsic = false; // Calibrate extrinsic parameters for each set
public boolean clt_batch_poly = false; // Calculate fine polynomial correction for each set public boolean clt_batch_poly = false; // Calculate fine polynomial correction for each set
public boolean clt_batch_4img = true; // Create a set of 4 images, usually for disparity = 0 public boolean clt_batch_4img = true; // Create a set of 4 images, usually for disparity = 0
...@@ -240,6 +243,12 @@ public class EyesisCorrectionParameters { ...@@ -240,6 +243,12 @@ public class EyesisCorrectionParameters {
cp.x3dSubdirPrefix= this.x3dSubdirPrefix; cp.x3dSubdirPrefix= this.x3dSubdirPrefix;
cp.x3dModelVersion= this.x3dModelVersion; cp.x3dModelVersion= this.x3dModelVersion;
cp.jp4SubDir= this.jp4SubDir; cp.jp4SubDir= this.jp4SubDir;
cp.rig_batch_adjust_main= this.rig_batch_adjust_main;
cp.rig_batch_adjust_aux= this.rig_batch_adjust_aux;
cp.rig_batch_adjust_rig= this.rig_batch_adjust_rig;
cp.clt_batch_apply_man= this.clt_batch_apply_man; cp.clt_batch_apply_man= this.clt_batch_apply_man;
cp.clt_batch_extrinsic= this.clt_batch_extrinsic; cp.clt_batch_extrinsic= this.clt_batch_extrinsic;
cp.clt_batch_poly= this.clt_batch_poly; cp.clt_batch_poly= this.clt_batch_poly;
...@@ -380,6 +389,10 @@ public class EyesisCorrectionParameters { ...@@ -380,6 +389,10 @@ public class EyesisCorrectionParameters {
properties.setProperty(prefix+"mlDirectory", this.mlDirectory); properties.setProperty(prefix+"mlDirectory", this.mlDirectory);
properties.setProperty(prefix+"rig_batch_adjust_main", this.rig_batch_adjust_main+"");
properties.setProperty(prefix+"rig_batch_adjust_aux", this.rig_batch_adjust_aux+"");
properties.setProperty(prefix+"rig_batch_adjust_rig", this.rig_batch_adjust_rig+"");
properties.setProperty(prefix+"clt_batch_apply_man", this.clt_batch_apply_man+""); properties.setProperty(prefix+"clt_batch_apply_man", this.clt_batch_apply_man+"");
properties.setProperty(prefix+"clt_batch_extrinsic", this.clt_batch_extrinsic+""); properties.setProperty(prefix+"clt_batch_extrinsic", this.clt_batch_extrinsic+"");
properties.setProperty(prefix+"clt_batch_poly", this.clt_batch_poly+""); properties.setProperty(prefix+"clt_batch_poly", this.clt_batch_poly+"");
...@@ -517,6 +530,10 @@ public class EyesisCorrectionParameters { ...@@ -517,6 +530,10 @@ public class EyesisCorrectionParameters {
if (properties.getProperty(prefix+"mlDirectory")!= null) this.mlDirectory=properties.getProperty(prefix+"mlDirectory"); if (properties.getProperty(prefix+"mlDirectory")!= null) this.mlDirectory=properties.getProperty(prefix+"mlDirectory");
if (properties.getProperty(prefix+"rig_batch_adjust_main")!=null) this.rig_batch_adjust_main=Integer.parseInt(properties.getProperty(prefix+"rig_batch_adjust_main"));
if (properties.getProperty(prefix+"rig_batch_adjust_aux")!=null) this.rig_batch_adjust_aux=Integer.parseInt(properties.getProperty(prefix+"rig_batch_adjust_aux"));
if (properties.getProperty(prefix+"rig_batch_adjust_rig")!=null) this.rig_batch_adjust_rig=Integer.parseInt(properties.getProperty(prefix+"rig_batch_adjust_rig"));
if (properties.getProperty(prefix+"clt_batch_apply_man")!= null) this.clt_batch_apply_man=Boolean.parseBoolean(properties.getProperty(prefix+"clt_batch_apply_man")); if (properties.getProperty(prefix+"clt_batch_apply_man")!= null) this.clt_batch_apply_man=Boolean.parseBoolean(properties.getProperty(prefix+"clt_batch_apply_man"));
if (properties.getProperty(prefix+"clt_batch_extrinsic")!= null) this.clt_batch_extrinsic=Boolean.parseBoolean(properties.getProperty(prefix+"clt_batch_extrinsic")); if (properties.getProperty(prefix+"clt_batch_extrinsic")!= null) this.clt_batch_extrinsic=Boolean.parseBoolean(properties.getProperty(prefix+"clt_batch_extrinsic"));
if (properties.getProperty(prefix+"clt_batch_poly")!= null) this.clt_batch_poly=Boolean.parseBoolean(properties.getProperty(prefix+"clt_batch_poly")); if (properties.getProperty(prefix+"clt_batch_poly")!= null) this.clt_batch_poly=Boolean.parseBoolean(properties.getProperty(prefix+"clt_batch_poly"));
...@@ -534,7 +551,6 @@ public class EyesisCorrectionParameters { ...@@ -534,7 +551,6 @@ public class EyesisCorrectionParameters {
if (properties.getProperty(prefix+"thumb_size") !=null) this.thumb_size= Double.parseDouble(properties.getProperty(prefix+"thumb_size")); if (properties.getProperty(prefix+"thumb_size") !=null) this.thumb_size= Double.parseDouble(properties.getProperty(prefix+"thumb_size"));
if (properties.getProperty(prefix+"default_rating") !=null) this.default_rating= Integer.parseInt(properties.getProperty(prefix+"default_rating")); if (properties.getProperty(prefix+"default_rating") !=null) this.default_rating= Integer.parseInt(properties.getProperty(prefix+"default_rating"));
// copy common parameters to the auxiliary camera ones // copy common parameters to the auxiliary camera ones
updateAuxFromMain(); updateAuxFromMain();
String aux_prefix = prefix + AUX_PREFIX; String aux_prefix = prefix + AUX_PREFIX;
...@@ -853,6 +869,10 @@ public class EyesisCorrectionParameters { ...@@ -853,6 +869,10 @@ public class EyesisCorrectionParameters {
gd.addTab ("Batch", "Select Batch parameters"); gd.addTab ("Batch", "Select Batch parameters");
gd.addNumericField("Repeat main camera field adjustment", this.rig_batch_adjust_main, 0);
gd.addNumericField("Repeat aux camera field adjustment", this.rig_batch_adjust_aux, 0);
gd.addNumericField("Repeat 2-quad camera rig field adjustment", this.rig_batch_adjust_rig, 0);
gd.addCheckbox ("Apply (and disable) manual pixel shift", this.clt_batch_apply_man); // 21 gd.addCheckbox ("Apply (and disable) manual pixel shift", this.clt_batch_apply_man); // 21
gd.addCheckbox ("Calibrate extrinsic parameters for each set", this.clt_batch_extrinsic); // 22 gd.addCheckbox ("Calibrate extrinsic parameters for each set", this.clt_batch_extrinsic); // 22
gd.addCheckbox ("Calculate fine polynomial correction for each set", this.clt_batch_poly); // 23 gd.addCheckbox ("Calculate fine polynomial correction for each set", this.clt_batch_poly); // 23
...@@ -914,6 +934,10 @@ public class EyesisCorrectionParameters { ...@@ -914,6 +934,10 @@ public class EyesisCorrectionParameters {
this.aux_camera.cltSuffix= gd.getNextString(); // 20b this.aux_camera.cltSuffix= gd.getNextString(); // 20b
this.aux_camera.x3dSubdirSuffix= gd.getNextString(); // 20ba this.aux_camera.x3dSubdirSuffix= gd.getNextString(); // 20ba
this.rig_batch_adjust_main = (int) gd.getNextNumber();
this.rig_batch_adjust_aux = (int) gd.getNextNumber();
this.rig_batch_adjust_rig = (int) gd.getNextNumber();
this.clt_batch_apply_man= gd.getNextBoolean(); // 21 this.clt_batch_apply_man= gd.getNextBoolean(); // 21
this.clt_batch_extrinsic= gd.getNextBoolean(); // 22 this.clt_batch_extrinsic= gd.getNextBoolean(); // 22
this.clt_batch_poly= gd.getNextBoolean(); // 23 this.clt_batch_poly= gd.getNextBoolean(); // 23
......
...@@ -583,21 +583,21 @@ private Panel panel1, ...@@ -583,21 +583,21 @@ private Panel panel1,
// addButton("CLT 2*4 images", panelClt4, color_conf_process); // addButton("CLT 2*4 images", panelClt4, color_conf_process);
// addButton("CLT 2*4 images - 2", panelClt4, color_conf_process); // addButton("CLT 2*4 images - 2", panelClt4, color_conf_process);
// addButton("CLT 2*4 images - 3", panelClt4, color_conf_process); // addButton("CLT 2*4 images - 3", panelClt4, color_conf_process);
addButton("SHOW extrinsics", panelClt4, color_configure); addButton("SHOW extrinsics", panelClt4, color_configure);
addButton("MAIN extrinsics", panelClt4, color_process); addButton("MAIN extrinsics", panelClt4, color_process);
addButton("RIG extrinsics", panelClt4, color_conf_process);
addButton("AUX extrinsics", panelClt4, color_process); addButton("AUX extrinsics", panelClt4, color_process);
addButton("RIG extrinsics", panelClt4, color_conf_process);
addButton("Rig8 images", panelClt4, color_conf_process); addButton("Rig8 images", panelClt4, color_conf_process);
// addButton("Rig enhance", panelClt4, color_conf_process); // addButton("Rig enhance", panelClt4, color_conf_process);
// /"Reset GT" // /"Reset GT"
addButton("Reset GT", panelClt4, color_stop); addButton("Reset GT", panelClt4, color_stop);
// addButton("Ground truth 0", panelClt4, color_configure);
addButton("Ground truth", panelClt4, color_conf_process); addButton("Ground truth", panelClt4, color_conf_process);
addButton("Show biscan", panelClt4, color_configure); addButton("Show biscan", panelClt4, color_configure);
addButton("Poles GT", panelClt4, color_process); addButton("Poles GT", panelClt4, color_process);
addButton("ML export", panelClt4, color_conf_process); addButton("ML export", panelClt4, color_conf_process);
addButton("JP4 copy", panelClt4, color_conf_process); addButton("JP4 copy", panelClt4, color_conf_process);
addButton("Rig batch", panelClt4, color_process);
add(panelClt4); add(panelClt4);
...@@ -4556,17 +4556,11 @@ private Panel panel1, ...@@ -4556,17 +4556,11 @@ private Panel panel1,
EYESIS_CORRECTIONS.setDebug(DEBUG_LEVEL); EYESIS_CORRECTIONS.setDebug(DEBUG_LEVEL);
getPairImages(); getPairImages();
return; return;
/* ======================================================================== */
} else if (label.equals("CLT 2*4 images - 2")) {
DEBUG_LEVEL=MASTER_DEBUG_LEVEL;
EYESIS_CORRECTIONS.setDebug(DEBUG_LEVEL);
getPairImages2(false);
return;
/* ======================================================================== */ /* ======================================================================== */
} else if (label.equals("Rig8 images")) { } else if (label.equals("Rig8 images")) {
DEBUG_LEVEL=MASTER_DEBUG_LEVEL; DEBUG_LEVEL=MASTER_DEBUG_LEVEL;
EYESIS_CORRECTIONS.setDebug(DEBUG_LEVEL); EYESIS_CORRECTIONS.setDebug(DEBUG_LEVEL);
getPairImages2(true); getPairImages2();
return; return;
/* ======================================================================== */ /* ======================================================================== */
} else if (label.equals("RIG extrinsics")) { } else if (label.equals("RIG extrinsics")) {
...@@ -4615,17 +4609,10 @@ private Panel panel1, ...@@ -4615,17 +4609,10 @@ private Panel panel1,
return; return;
/* ======================================================================== */ /* ======================================================================== */
} else if (label.equals("Ground truth 0")) {
DEBUG_LEVEL=MASTER_DEBUG_LEVEL;
EYESIS_CORRECTIONS.setDebug(DEBUG_LEVEL);
enhanceByRig(false);
return;
/* ======================================================================== */
} else if (label.equals("Ground truth")) { } else if (label.equals("Ground truth")) {
DEBUG_LEVEL=MASTER_DEBUG_LEVEL; DEBUG_LEVEL=MASTER_DEBUG_LEVEL;
EYESIS_CORRECTIONS.setDebug(DEBUG_LEVEL); EYESIS_CORRECTIONS.setDebug(DEBUG_LEVEL);
enhanceByRig(true); groundTruth();
return; return;
/* ======================================================================== */ /* ======================================================================== */
} else if (label.equals("Show biscan")) { } else if (label.equals("Show biscan")) {
...@@ -4659,6 +4646,13 @@ private Panel panel1, ...@@ -4659,6 +4646,13 @@ private Panel panel1,
EYESIS_CORRECTIONS.setDebug(DEBUG_LEVEL); EYESIS_CORRECTIONS.setDebug(DEBUG_LEVEL);
copyJP4src(); copyJP4src();
return; return;
/* ======================================================================== */
} else if (label.equals("Rig batch")) {
DEBUG_LEVEL=MASTER_DEBUG_LEVEL;
EYESIS_CORRECTIONS.setDebug(DEBUG_LEVEL);
CLT_PARAMETERS.batch_run = true;
batchRig();
return;
/* ======================================================================== */ /* ======================================================================== */
} else if (label.equals("CLT rig edit")) { } else if (label.equals("CLT rig edit")) {
...@@ -5015,12 +5009,11 @@ private Panel panel1, ...@@ -5015,12 +5009,11 @@ private Panel panel1,
return true; return true;
} }
public boolean getPairImages2( boolean new_mode) { public boolean getPairImages2() {
if (!prepareRigImages()) return false; if (!prepareRigImages()) return false;
String configPath=getSaveCongigPath(); String configPath=getSaveCongigPath();
if (configPath.equals("ABORT")) return false; if (configPath.equals("ABORT")) return false;
if (new_mode) {
if (DEBUG_LEVEL > -2){ if (DEBUG_LEVEL > -2){
System.out.println("++++++++++++++ Calculating combined correlations ++++++++++++++"); System.out.println("++++++++++++++ Calculating combined correlations ++++++++++++++");
} }
...@@ -5041,29 +5034,6 @@ private Panel panel1, ...@@ -5041,29 +5034,6 @@ private Panel panel1,
// TODO Auto-generated catch block // TODO Auto-generated catch block
e.printStackTrace(); e.printStackTrace();
} //final int debugLevel); } //final int debugLevel);
} else {
if (DEBUG_LEVEL > -2){
System.out.println("++++++++++++++ Calculating per quad camera correlations ++++++++++++++");
}
try {
TWO_QUAD_CLT.processCLTQuadCorrs(
QUAD_CLT, // QuadCLT quadCLT_main,
QUAD_CLT_AUX, // QuadCLT quadCLT_aux,
CLT_PARAMETERS, // EyesisCorrectionParameters.DCTParameters dct_parameters,
DEBAYER_PARAMETERS, //EyesisCorrectionParameters.DebayerParameters debayerParameters,
COLOR_PROC_PARAMETERS, //EyesisCorrectionParameters.ColorProcParameters colorProcParameters,
CHANNEL_GAINS_PARAMETERS, //CorrectionColorProc.ColorGainsParameters channelGainParameters,
CHANNEL_GAINS_PARAMETERS_AUX, //CorrectionColorProc.ColorGainsParameters channelGainParameters_aux,
RGB_PARAMETERS, //EyesisCorrectionParameters.RGBParameters rgbParameters,
THREADS_MAX, //final int threadsMax, // maximal number of threads to launch
UPDATE_STATUS, //final boolean updateStatus,
DEBUG_LEVEL);
} catch (Exception e) {
// TODO Auto-generated catch block
e.printStackTrace();
} //final int debugLevel);
}
if (configPath!=null) { if (configPath!=null) {
saveTimestampedProperties( // save config again saveTimestampedProperties( // save config again
...@@ -5157,7 +5127,7 @@ private Panel panel1, ...@@ -5157,7 +5127,7 @@ private Panel panel1,
true, true,
PROPERTIES); PROPERTIES);
} }
System.out.println("enhanceByRig(): Processing finished at "+ System.out.println("processPoles(): Processing finished at "+
IJ.d2s(0.000000001*(System.nanoTime()-startTime),3)+" sec, --- Free memory="+ IJ.d2s(0.000000001*(System.nanoTime()-startTime),3)+" sec, --- Free memory="+
Runtime.getRuntime().freeMemory()+" (of "+Runtime.getRuntime().totalMemory()+")"); Runtime.getRuntime().freeMemory()+" (of "+Runtime.getRuntime().totalMemory()+")");
...@@ -5251,7 +5221,7 @@ private Panel panel1, ...@@ -5251,7 +5221,7 @@ private Panel panel1,
return true; return true;
} }
public boolean enhanceByRig( boolean use_planes) { public boolean groundTruth() {
long startTime=System.nanoTime(); long startTime=System.nanoTime();
if ((QUAD_CLT == null) || (QUAD_CLT.tp == null) || (QUAD_CLT.tp.clt_3d_passes == null)) { if ((QUAD_CLT == null) || (QUAD_CLT.tp == null) || (QUAD_CLT.tp.clt_3d_passes == null)) {
boolean OK = clt3d( boolean OK = clt3d(
...@@ -5271,11 +5241,10 @@ private Panel panel1, ...@@ -5271,11 +5241,10 @@ private Panel panel1,
if (DEBUG_LEVEL > -2){ if (DEBUG_LEVEL > -2){
System.out.println("++++++++++++++ Enhancing single-camera DSI by the dual-camera rig using planes ++++++++++++++"); System.out.println("++++++++++++++ Enhancing single-camera DSI by the dual-camera rig using planes ++++++++++++++");
} }
TWO_QUAD_CLT.enhanceByRig( // actually there is no sense to process multiple image sets. Combine with other processing? TWO_QUAD_CLT.groundTruth( // actually there is no sense to process multiple image sets. Combine with other processing?
QUAD_CLT, // QuadCLT quadCLT_main, QUAD_CLT, // QuadCLT quadCLT_main,
QUAD_CLT_AUX, // QuadCLT quadCLT_aux, QUAD_CLT_AUX, // QuadCLT quadCLT_aux,
CLT_PARAMETERS, // EyesisCorrectionParameters.DCTParameters dct_parameters, CLT_PARAMETERS, // EyesisCorrectionParameters.DCTParameters dct_parameters,
use_planes, // final boolean use_planes,
THREADS_MAX, //final int threadsMax, // maximal number of threads to launch THREADS_MAX, //final int threadsMax, // maximal number of threads to launch
UPDATE_STATUS, //final boolean updateStatus, UPDATE_STATUS, //final boolean updateStatus,
DEBUG_LEVEL -2); DEBUG_LEVEL -2);
...@@ -5286,13 +5255,68 @@ private Panel panel1, ...@@ -5286,13 +5255,68 @@ private Panel panel1,
true, true,
PROPERTIES); PROPERTIES);
} }
System.out.println("enhanceByRig(): Processing finished at "+ System.out.println("groundTruth(): Processing finished at "+
IJ.d2s(0.000000001*(System.nanoTime()-startTime),3)+" sec, --- Free memory="+ IJ.d2s(0.000000001*(System.nanoTime()-startTime),3)+" sec, --- Free memory="+
Runtime.getRuntime().freeMemory()+" (of "+Runtime.getRuntime().totalMemory()+")"); Runtime.getRuntime().freeMemory()+" (of "+Runtime.getRuntime().totalMemory()+")");
return true; return true;
} }
public boolean batchRig() {
long startTime=System.nanoTime();
/* if ((QUAD_CLT == null) || (QUAD_CLT.tp == null) || (QUAD_CLT.tp.clt_3d_passes == null)) {
boolean OK = clt3d(
false, // boolean adjust_extrinsics,
false); // boolean adjust_poly);
if (! OK) {
String msg = "DSI data is not available and \"CLT 3D\" failed";
IJ.showMessage("Error",msg);
System.out.println(msg);
return false;
}
}
*/
// load needed sensor and kernels files
if (!prepareRigImages()) return false;
String configPath=getSaveCongigPath();
if (configPath.equals("ABORT")) return false;
if (DEBUG_LEVEL > -2){
System.out.println("++++++++++++++ Running batch processing of dual-quad camera rig ++++++++++++++");
}
try {
TWO_QUAD_CLT.batchRig(
QUAD_CLT, // QuadCLT quadCLT_main,
QUAD_CLT_AUX, // QuadCLT quadCLT_aux,
CLT_PARAMETERS, // EyesisCorrectionParameters.DCTParameters dct_parameters,
DEBAYER_PARAMETERS, //EyesisCorrectionParameters.DebayerParameters debayerParameters,
COLOR_PROC_PARAMETERS, //EyesisCorrectionParameters.ColorProcParameters colorProcParameters,
CHANNEL_GAINS_PARAMETERS, //CorrectionColorProc.ColorGainsParameters channelGainParameters,
RGB_PARAMETERS, //EyesisCorrectionParameters.RGBParameters rgbParameters,
EQUIRECTANGULAR_PARAMETERS, // EyesisCorrectionParameters.EquirectangularParameters equirectangularParameters,
THREADS_MAX, //final int threadsMax, // maximal number of threads to launch
UPDATE_STATUS, //final boolean updateStatus,
DEBUG_LEVEL);
} catch (Exception e) {
// TODO Auto-generated catch block
e.printStackTrace();
} //final int debugLevel);
if (configPath!=null) {
saveTimestampedProperties( // save config again
configPath, // full path or null
null, // use as default directory if path==null
true,
PROPERTIES);
}
System.out.println("batchRig(): Processing finished at "+
IJ.d2s(0.000000001*(System.nanoTime()-startTime),3)+" sec, --- Free memory="+
Runtime.getRuntime().freeMemory()+" (of "+Runtime.getRuntime().totalMemory()+")");
return true;
}
public boolean exportMLData() { public boolean exportMLData() {
long startTime=System.nanoTime(); long startTime=System.nanoTime();
if ((QUAD_CLT == null) || (QUAD_CLT.tp == null) || (QUAD_CLT.tp.rig_pre_poles_ds == null)) { if ((QUAD_CLT == null) || (QUAD_CLT.tp == null) || (QUAD_CLT.tp.rig_pre_poles_ds == null)) {
......
This diff is collapsed.
...@@ -110,6 +110,13 @@ public class TileProcessor { ...@@ -110,6 +110,13 @@ public class TileProcessor {
clt_3d_passes = new ArrayList<CLTPass3d>(); clt_3d_passes = new ArrayList<CLTPass3d>();
clt_3d_passes_size = 0; clt_3d_passes_size = 0;
clt_3d_passes_rig_size = 0; clt_3d_passes_rig_size = 0;
rig_disparity_strength = null; // invalidate
rig_pre_poles_ds = null;
rig_post_poles_ds = null;
rig_pre_poles_sel = null;
rig_post_poles_sel = null;
clt_3d_passes_rig_size = 0;
Runtime runtime = Runtime.getRuntime(); Runtime runtime = Runtime.getRuntime();
runtime.gc(); runtime.gc();
System.out.println("--- Free memory="+runtime.freeMemory()+" (of "+runtime.totalMemory()+")"); System.out.println("--- Free memory="+runtime.freeMemory()+" (of "+runtime.totalMemory()+")");
......
This diff is collapsed.
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