...
 
Commits (3)
......@@ -142,10 +142,12 @@ public class EyesisCorrectionParameters {
public int rig_batch_adjust_aux = 0;
public int rig_batch_adjust_rig = 0;
public int rig_batch_adjust_main_gt = 0; // adjust main camera using rig disparity as ground truth
public int rig_batch_adjust_aux_gt = 0; // adjust aux camera using rig disparity as ground truth (TODO: finish geometry in derivatives)
public int rig_batch_adjust_rig_gt = 0; // adjust rig after main and aux are adjusted with rig GT (late rig adjustment)
public boolean clt_batch_dsi1 = true; // experimental for interscene
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_poly = false; // Calculate fine polynomial correction for each set
......@@ -285,6 +287,7 @@ public class EyesisCorrectionParameters {
cp.rig_batch_adjust_aux_gt = this.rig_batch_adjust_aux_gt;
cp.rig_batch_adjust_rig_gt = this.rig_batch_adjust_rig_gt;
cp.clt_batch_dsi1= this.clt_batch_dsi1;
cp.clt_batch_apply_man= this.clt_batch_apply_man;
cp.clt_batch_extrinsic= this.clt_batch_extrinsic;
cp.clt_batch_poly= this.clt_batch_poly;
......@@ -463,6 +466,7 @@ public class EyesisCorrectionParameters {
properties.setProperty(prefix+"rig_batch_adjust_aux_gt", this.rig_batch_adjust_aux_gt+"");
properties.setProperty(prefix+"rig_batch_adjust_rig_gt", this.rig_batch_adjust_rig_gt+"");
properties.setProperty(prefix+"clt_batch_dsi1", this.clt_batch_dsi1+"");
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_poly", this.clt_batch_poly+"");
......@@ -620,6 +624,7 @@ public class EyesisCorrectionParameters {
if (properties.getProperty(prefix+"rig_batch_adjust_aux_gt")!=null) this.rig_batch_adjust_aux_gt=Integer.parseInt(properties.getProperty(prefix+"rig_batch_adjust_aux_gt"));
if (properties.getProperty(prefix+"rig_batch_adjust_rig_gt")!=null) this.rig_batch_adjust_rig_gt=Integer.parseInt(properties.getProperty(prefix+"rig_batch_adjust_rig_gt"));
if (properties.getProperty(prefix+"clt_batch_dsi1")!= null) this.clt_batch_dsi1=Boolean.parseBoolean(properties.getProperty(prefix+"clt_batch_dsi1"));
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_poly")!= null) this.clt_batch_poly=Boolean.parseBoolean(properties.getProperty(prefix+"clt_batch_poly"));
......@@ -991,6 +996,7 @@ public class EyesisCorrectionParameters {
gd.addNumericField("Repeat aux camera field adjustment (late, with GT disparity from rig)", this.rig_batch_adjust_aux_gt, 0);
gd.addNumericField("Repeat 2-quad camera rig field adjustment (late, after all others)", this.rig_batch_adjust_rig_gt, 0);
gd.addCheckbox ("Experimental DSI", this.clt_batch_dsi1); // 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 ("Calculate fine polynomial correction for each set", this.clt_batch_poly); // 23
......@@ -1083,6 +1089,7 @@ public class EyesisCorrectionParameters {
this.rig_batch_adjust_aux_gt = (int) gd.getNextNumber();
this.rig_batch_adjust_rig_gt = (int) gd.getNextNumber();
this.clt_batch_dsi1= gd.getNextBoolean(); // 21
this.clt_batch_apply_man= gd.getNextBoolean(); // 21
this.clt_batch_extrinsic= gd.getNextBoolean(); // 22
this.clt_batch_poly= gd.getNextBoolean(); // 23
......@@ -1340,7 +1347,38 @@ public class EyesisCorrectionParameters {
return true;
}
// get list of source files in a directory
public String[] selectSourceFileInSet(String setdir, int debugLevel) {
int num_chn_main = numSubCameras;
int num_chn_aux = ((aux_camera != null)? aux_camera.numSubCameras : 0);
int num_chn_files = num_chn_main + num_chn_aux;
String [] extensions = getSourceSuffixes();// ={this.sourceSuffix};
String [] prefixes = getSourcePrefixes();
extensions[0] = sourceSuffix;
prefixes[0] = sourcePrefix;
MultipleExtensionsFileFilter setFilter = new MultipleExtensionsFileFilter(prefixes,extensions,"Image sets");
File fsetdir = new File(setdir);
ArrayList<File> setFilesList = new ArrayList<File>(); // list of set files
File [] setChnFiles = fsetdir.listFiles(setFilter);
int num_match = setChnFiles.length;
if ( (num_match == num_chn_files) || // all files for main and aux
(num_match == num_chn_main) || // only main camera files
(num_match == num_chn_aux)) // only aux camera files
{ // only use sets of exact number of files
for (File f: setChnFiles) {
setFilesList.add(f);
}
}
String [] sourcePaths = new String[setFilesList.size()];
for (int nFile = 0; nFile < sourcePaths.length; nFile++) {
sourcePaths[nFile]= setFilesList.get(nFile).getPath();
}
return sourcePaths;
}
public boolean selectSourceFiles(boolean allFiles) {
return selectSourceFiles(allFiles, 1); // debug level 1 - modify here
......
......@@ -294,6 +294,11 @@ public class EyesisCorrections {
// FIXME: Use only this PixelMappings's channels, do not mix exposures from main/aux!
public double [] calcReferenceExposures(int debugLevel){
String [] paths=this.correctionsParameters.getSourcePaths();
return calcReferenceExposures(paths, debugLevel);
}
public double [] calcReferenceExposures(String [] paths,int debugLevel){
// String [] paths=this.correctionsParameters.getSourcePaths();
double [] exposures=new double [paths.length];
if (this.correctionsParameters.exposureCorrectionMode<2){
for (int nFile=0;nFile<paths.length;nFile++) {
......
......@@ -699,6 +699,7 @@ private Panel panel1,
addButton("LIST extrinsics", panelClt5, color_report);
addButton("DSI histogram", panelClt5, color_report);
addButton("ML recalc", panelClt5, color_process);
addButton("Inter Test", panelClt5, color_stop);
plugInFrame.add(panelClt5);
}
......@@ -5099,7 +5100,14 @@ private Panel panel1,
CLT_PARAMETERS.batch_run = true;
batchLwir();
return;
/* ======================================================================== */
} else if (label.equals("Inter Test")) {
DEBUG_LEVEL=MASTER_DEBUG_LEVEL;
EYESIS_CORRECTIONS.setDebug(DEBUG_LEVEL);
CLT_PARAMETERS.batch_run = true;
testInterScene();
return;
/* ======================================================================== */
} else if (label.equals("CLT rig edit")) {
DEBUG_LEVEL=MASTER_DEBUG_LEVEL;
......@@ -5700,6 +5708,9 @@ private Panel panel1,
return true;
}
public boolean getPairImages2() {
if (!prepareRigImages()) return false;
String configPath=getSaveCongigPath();
......@@ -6378,7 +6389,96 @@ private Panel panel1,
}
public boolean testInterScene() {
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("++++++++++++++ Testing Interscene processing ++++++++++++++");
}
if (CLT_PARAMETERS.useGPU()) { // only init GPU instances if it is used
if (GPU_TILE_PROCESSOR == null) {
try {
GPU_TILE_PROCESSOR = new GPUTileProcessor(CORRECTION_PARAMETERS.tile_processor_gpu);
} catch (Exception e) {
System.out.println("Failed to initialize GPU class");
// TODO Auto-generated catch block
e.printStackTrace();
return false;
} //final int debugLevel);
}
if (CLT_PARAMETERS.useGPU(false) && (QUAD_CLT != null) && (GPU_QUAD == null)) { // if GPU main is needed
try {
GPU_QUAD = GPU_TILE_PROCESSOR.new GpuQuad(
QUAD_CLT,
4,
3);
} catch (Exception e) {
System.out.println("Failed to initialize GpuQuad class");
// TODO Auto-generated catch block
e.printStackTrace();
return false;
} //final int debugLevel);
QUAD_CLT.setGPU(GPU_QUAD);
}
/*
if (CLT_PARAMETERS.useGPU(true) && (QUAD_CLT_AUX != null) && (GPU_QUAD_AUX == null)) { // if GPU AUX is needed
try {
GPU_QUAD_AUX = GPU_TILE_PROCESSOR. new GpuQuad(//
QUAD_CLT_AUX,
4,
3);
} catch (Exception e) {
System.out.println("Failed to initialize GpuQuad class");
// TODO Auto-generated catch block
e.printStackTrace();
return false;
} //final int debugLevel);
QUAD_CLT_AUX.setGPU(GPU_QUAD_AUX);
}*/
}
try {
TWO_QUAD_CLT.TestInterScene(
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;
}
public boolean exportMLData() {
long startTime=System.nanoTime();
......
......@@ -590,7 +590,7 @@ public class GPUTileProcessor {
}
public class GpuQuad{ // quad camera description
public final QuadCLT quadCLT;
public QuadCLT quadCLT;
public final int img_width;
public final int img_height;
public final int kernels_hor; // int kernels_hor,
......@@ -657,6 +657,16 @@ public class GPUTileProcessor {
private boolean geometry_correction_set = false;
private boolean geometry_correction_vector_set = false;
public int gpu_debug_level = 1;
// should only be updated with the same cameras instance
public void updateQuadCLT(final QuadCLT quadCLT) {
this.quadCLT = quadCLT;
resetGeometryCorrection();
resetGeometryCorrectionVector();
bayer_set = false;
}
public QuadCLT getQuadCLT( ) {
return this.quadCLT;
}
public GpuQuad(
final QuadCLT quadCLT,
// final int img_width,
......
......@@ -614,6 +614,15 @@ public class CLTPass3d{
}
calc_disparity_combo = calc_disparity.clone(); // for now - just clone, can be modified separately and combined with hor/vert
}
// bypassing calculations
public void setCalcDisparityStrength(
double [] disparity,
double [] strength) {
this.calc_disparity = disparity;
this.strength = strength;
calc_disparity_combo = calc_disparity.clone();
}
/**
* Replaces current combo disparity for tiles that are weak and do not have any neighbor within disparity range from this one
......