Commit 26cdc535 authored by Andrey Filippov's avatar Andrey Filippov

Implementing batch mode for EO/LWIR images

parent be9da419
......@@ -169,6 +169,7 @@ public class EyesisCorrectionParameters {
public String mlDirectory="ml";
public boolean thumb_overwrite = true;
public int thumb_width = 200;
public int thumb_height = 100;
public double thumb_h_center = 0.5;
......@@ -296,6 +297,17 @@ public class EyesisCorrectionParameters {
cp.clt_batch_dsi_aux= this.clt_batch_dsi_aux;
cp.clt_batch_save_extrinsics= this.clt_batch_save_extrinsics;
cp.clt_batch_save_all= this.clt_batch_save_all;
cp.thumb_overwrite = this.thumb_overwrite;
cp.thumb_width = this.thumb_width;
cp.thumb_height = this.thumb_height;
cp.thumb_h_center = this.thumb_h_center;
cp.thumb_v_center = this.thumb_v_center;
cp.thumb_size = this.thumb_size;
cp.default_rating = this.default_rating;
}
......@@ -462,6 +474,7 @@ public class EyesisCorrectionParameters {
properties.setProperty(prefix+"clt_batch_save_extrinsics", this.clt_batch_save_extrinsics+"");
properties.setProperty(prefix+"clt_batch_save_all", this.clt_batch_save_all+"");
properties.setProperty(prefix+"thumb_overwrite", this.thumb_overwrite+"");
properties.setProperty(prefix+"thumb_width", this.thumb_width+"");
properties.setProperty(prefix+"thumb_height", this.thumb_height+"");
properties.setProperty(prefix+"thumb_h_center", this.thumb_h_center+"");
......@@ -616,6 +629,7 @@ public class EyesisCorrectionParameters {
if (properties.getProperty(prefix+"clt_batch_save_extrinsics")!= null) this.clt_batch_save_extrinsics=Boolean.parseBoolean(properties.getProperty(prefix+"clt_batch_save_extrinsics"));
if (properties.getProperty(prefix+"clt_batch_save_all")!= null) this.clt_batch_save_all=Boolean.parseBoolean(properties.getProperty(prefix+"clt_batch_save_all"));
if (properties.getProperty(prefix+"thumb_overwrite")!= null) this.thumb_overwrite=Boolean.parseBoolean(properties.getProperty(prefix+"thumb_overwrite"));
if (properties.getProperty(prefix+"thumb_width")!=null) this.thumb_width=Integer.parseInt(properties.getProperty(prefix+"thumb_width"));
if (properties.getProperty(prefix+"thumb_height")!=null) this.thumb_height=Integer.parseInt(properties.getProperty(prefix+"thumb_height"));
if (properties.getProperty(prefix+"thumb_h_center")!=null) this.thumb_h_center= Double.parseDouble(properties.getProperty(prefix+"thumb_h_center"));
......@@ -769,6 +783,7 @@ public class EyesisCorrectionParameters {
gd.addCheckbox ("Swap top and equator images", this.swapSubchannels01);
gd.addTab("Thumbnails","Thumbnail image generation");
gd.addCheckbox("Overwrite existing thumbnail images",this.thumb_overwrite);
gd.addNumericField("Thumbnail image width", this.thumb_width, 0,4,"pix",
"");
gd.addNumericField("Thumbnail image height", this.thumb_height, 0,4,"pix",
......@@ -871,6 +886,7 @@ public class EyesisCorrectionParameters {
this.removeUnusedSensorData= gd.getNextBoolean();
this.swapSubchannels01= gd.getNextBoolean();
this.thumb_overwrite = gd.getNextBoolean();
this.thumb_width= (int) gd.getNextNumber();
this.thumb_height= (int) gd.getNextNumber();
this.thumb_h_center= gd.getNextNumber();
......
......@@ -705,6 +705,10 @@ private Panel panel1,
addButton("GPU files", panelClt_GPU, color_conf_process);
addButton("Rig8 gpu", panelClt_GPU, color_conf_process);
addButton("ShowGPU", panelClt_GPU, color_conf_process);
addButton("LWIR_TEST", panelClt_GPU, color_conf_process);
addButton("LWIR_ACQUIRE", panelClt_GPU, color_conf_process);
plugInFrame.add(panelClt_GPU);
}
if (LWIR_MODE) {
......@@ -730,13 +734,13 @@ private Panel panel1,
addButton("AUX OUT 3D", panelLWIR, color_process_aux);
addButton("Main img AUX", panelLWIR, color_process_aux);
addButton("Main to AUX", panelLWIR, color_process_aux);
addButton("LWIR_TEST", panelLWIR, color_conf_process);
addButton("LWIR_ACQUIRE", panelLWIR, color_conf_process);
addButton("LWIR batch", panelClt4, color_process);
// addButton("LWIR_TEST", panelLWIR, color_conf_process);
// addButton("LWIR_ACQUIRE", panelLWIR, color_conf_process);
plugInFrame.add(panelLWIR);
}
plugInFrame.pack();
//"LWIR batch"
GUI.center(plugInFrame);
plugInFrame.setVisible(true);
FHT_INSTANCE= new DoubleFHT();
......@@ -3960,12 +3964,6 @@ private Panel panel1,
IJ.showMessage("Warning",msg);
return;
}
/*
EYESIS_CORRECTIONS.initSensorFiles(DEBUG_LEVEL,
true, // true - ignore missing files
true, // boolean all_sensors,
COLOR_PROC_PARAMETERS.correct_vignetting); //boolean correct_vignetting
*/
QUAD_CLT.resetGeometryCorrection();
QUAD_CLT.initGeometryCorrection(DEBUG_LEVEL+2);
......@@ -5016,6 +5014,14 @@ private Panel panel1,
batchRig();
return;
/* ======================================================================== */
} else if (label.equals("LWIR batch")) {
DEBUG_LEVEL=MASTER_DEBUG_LEVEL;
EYESIS_CORRECTIONS.setDebug(DEBUG_LEVEL);
CLT_PARAMETERS.batch_run = true;
batchLwir();
return;
/* ======================================================================== */
} else if (label.equals("CLT rig edit")) {
DEBUG_LEVEL=MASTER_DEBUG_LEVEL;
......@@ -5464,7 +5470,7 @@ private Panel panel1,
return true;
}
// inverted false/true in initSensorFiles(), should work with LWIR also
public boolean prepareRigImages() {
if (QUAD_CLT == null){
QUAD_CLT = new QuadCLT (
......@@ -5489,8 +5495,6 @@ private Panel panel1,
System.out.println("Created new QuadCLT instance, will need to read CLT kernels");
}
}
// QuadCLT dbg_QUAD_CLT = QUAD_CLT;
// QuadCLT dbg_QUAD_CLT_AUX = QUAD_CLT_AUX;
String configPath=getSaveCongigPath();
if (configPath.equals("ABORT")) return false;
if (DEBUG_LEVEL > -2){
......@@ -5498,15 +5502,15 @@ private Panel panel1,
}
EYESIS_CORRECTIONS.initSensorFiles(
DEBUG_LEVEL+2,
true,
false,
false, // true,
true, // false,
COLOR_PROC_PARAMETERS.correct_vignetting); //boolean correct_vignetting
if (DEBUG_LEVEL > -2){
System.out.println("++++++++++++++ Running initSensorFiles for the auxiliary camera ++++++++++++++");
}
EYESIS_CORRECTIONS_AUX.initSensorFiles(DEBUG_LEVEL+2,
true,
false,
false, // true,
true, // false,
COLOR_PROC_PARAMETERS_AUX.correct_vignetting); //boolean correct_vignetting
......@@ -6149,6 +6153,52 @@ private Panel panel1,
return true;
}
public boolean batchLwir() {
long startTime=System.nanoTime();
// load needed sensor and kernels files
if (!prepareRigImages()) return false;
String configPath=getSaveCongigPath();
if (configPath.equals("ABORT")) return false;
setAllProperties(PROPERTIES); // batchRig may save properties with the model. Extrinsics will be updated, others should be set here
if (DEBUG_LEVEL > -2){
System.out.println("++++++++++++++ Running batch processing of dual-quad EO/LWIR camera rig ++++++++++++++");
}
// parameters are different
/// if (COLOR_PROC_PARAMETERS_AUX == null) {
/// COLOR_PROC_PARAMETERS_AUX = COLOR_PROC_PARAMETERS.clone();
/// }
try {
TWO_QUAD_CLT.batchLwirRig(
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,
COLOR_PROC_PARAMETERS_AUX, //EyesisCorrectionParameters.ColorProcParameters colorProcParameters_aux,
CHANNEL_GAINS_PARAMETERS, //CorrectionColorProc.ColorGainsParameters channelGainParameters,
RGB_PARAMETERS, //EyesisCorrectionParameters.RGBParameters rgbParameters,
EQUIRECTANGULAR_PARAMETERS, // EyesisCorrectionParameters.EquirectangularParameters equirectangularParameters,
PROPERTIES, // Properties properties,
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;
}
......@@ -6337,7 +6387,9 @@ private Panel panel1,
String mask = ".*EXTRINSICS\\.corr-xml";
String full_conf_suffix = ".corr-xml";
String dsi_suffix = "-DSI_COMBO.tiff";
// String dsi_suffix = "-DSI_COMBO.tiff";
String dsi_suffix = TwoQuadCLT.DSI_COMBO_SUFFIX+".tiff";
String correction_parameters_prefix = "CORRECTION_PARAMETERS.";
System.out.println("File mask = "+mask);
......
......@@ -998,6 +998,9 @@ public class GeometryCorrection {
}
public void showRig() {
if (this.rigOffset == null) {
this.rigOffset = new RigOffset();
}
this.rigOffset.showRigOffsets();
}
......@@ -1401,18 +1404,22 @@ public class GeometryCorrection {
public void incrementVector(double [] incr,
// returns false if any component is NaN, in that case do not increment
public boolean incrementVector(double [] incr,
double scale)
{
for (int i = 0; i < incr.length; i++){
if (Double.isNaN(vector[i])) return false;
}
for (int i = 0; i < incr.length; i++){
vector[i]+= incr[i] * scale;
}
return true;
}
public void incrementVector(CorrVector incr, double scale)
public boolean incrementVector(CorrVector incr, double scale)
{
incrementVector(incr.toArray(), scale);
return incrementVector(incr.toArray(), scale);
}
@Override
......
......@@ -83,7 +83,8 @@ public class MLStats {
int result_disparity_step = 10; // bins
String mask = ".*-DSI_COMBO\\.tiff";
// String mask = ".*-DSI_COMBO\\.tiff";
String mask = ".*"+TwoQuadCLT.DSI_COMBO_SUFFIX+"\\.tiff";
GenericDialog gd = new GenericDialog("Select file mask and histogram parameters");
gd.addStringField ("Combined DSI file mask: ", mask, 40);
......@@ -443,7 +444,8 @@ public class MLStats {
{
String mask = ".*EXTRINSICS\\.corr-xml";
String full_conf_suffix = ".corr-xml";
String dsi_suffix = "-DSI_COMBO.tiff";
// String dsi_suffix = "-DSI_COMBO.tiff";
String dsi_suffix = TwoQuadCLT.DSI_COMBO_SUFFIX+".tiff";
String correction_parameters_prefix = "CORRECTION_PARAMETERS.";
System.out.println("File mask = "+mask);
......
......@@ -23,7 +23,6 @@ package com.elphel.imagej.tileprocessor;
**
*/
import java.awt.Point;
import java.io.IOException;
import java.util.ArrayList;
import java.util.Collections;
import java.util.Comparator;
......@@ -4016,7 +4015,7 @@ public class TilePlanes {
System.out.println("getPlaneToThis(), px_py = {"+px_py[0]+", "+px_py[1]+"}, px_py_other = {"+px_py_other[0]+", "+px_py_other[1]+"}");
System.out.println("getPlaneToThis(), disp = "+disp);
System.out.println("getPlaneToThis(), pd="+ pd.toString());
// System.out.println("getPlaneToThis(), otherPd="+ otherPd.toString());
// System.out.println("getPlaneToThis(), otherPd="+ otherPd.toString());
// System.out.println("getPlaneToThis(), pd.getWorldXYZ(this.correctDistortions)="+ pd.getWorldXYZ(this.correctDistortions));
// System.out.println("getPlaneToThis(), wv1 = {"+ wv1[0]+", "+ wv1[1]+", "+ wv1[2]+"}");
// System.out.println("getPlaneToThis(), wv2 = {"+ wv2[0]+", "+ wv2[1]+", "+ wv2[2]+"}");
......@@ -4216,7 +4215,9 @@ public class TilePlanes {
if (world_xyz != null) {
double l2 = world_xyz[0]*world_xyz[0] + world_xyz[1]*world_xyz[1]+world_xyz[2]*world_xyz[2];
if (l2 < 0.5) {
System.out.println("getWorldXYZ(): l2="+l2); // +" this=\n"+this.toString());
if (debugLevel > -1) {
System.out.println("getWorldXYZ(): l2="+l2); // +" this=\n"+this.toString());
}
world_xyz = null;
}
}
......@@ -4316,7 +4317,9 @@ public class TilePlanes {
world_xyz = norm_xyz.times((xyz.transpose().times(norm_xyz).get(0,0))).getColumnPackedCopy();
double l2 = world_xyz[0]*world_xyz[0] + world_xyz[1]*world_xyz[1]+world_xyz[2]*world_xyz[2];
if (l2 < 0.5) {
System.out.println("getWorldXYZ(): l2="+l2); // +" this=\n"+this.toString());
if (debugLevel > -1) {
System.out.println("getWorldXYZ(): l2="+l2); // +" this=\n"+this.toString());
}
}
return world_xyz;
}
......
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