Commit 0648b656 authored by Andrey Filippov's avatar Andrey Filippov

next snapshot for dual camera

parent f19a4557
......@@ -228,7 +228,7 @@ public class EyesisCorrectionParameters {
cp.x3dDirectory= this.x3dDirectory;
cp.use_x3d_subdirs= this.use_x3d_subdirs;
cp.x3dSubdirPrefix= this.x3dSubdirPrefix;
cp.x3dSubdirSuffix= this.x3dSubdirSuffix;
// cp.x3dSubdirSuffix= this.x3dSubdirSuffix;
cp.x3dModelVersion= this.x3dModelVersion;
cp.clt_batch_apply_man= this.clt_batch_apply_man;
cp.clt_batch_extrinsic= this.clt_batch_extrinsic;
......@@ -254,6 +254,8 @@ public class EyesisCorrectionParameters {
cp.sensorSuffix= this.sensorSuffix;
cp.cltKernelPrefix= this.cltKernelPrefix;
cp.cltSuffix= this.cltSuffix;
cp.x3dSubdirSuffix= this.x3dSubdirSuffix+"-aux";
}
public void auxFromExternal(CorrectionParameters ecp) { // from master to aux
......@@ -266,6 +268,7 @@ public class EyesisCorrectionParameters {
this.aux_camera.sensorSuffix= ecp.sensorSuffix;
this.aux_camera.cltKernelPrefix= ecp.cltKernelPrefix;
this.aux_camera.cltSuffix= ecp.cltSuffix;
this.aux_camera.x3dSubdirSuffix= ecp.x3dSubdirSuffix + "-aux";
}
......@@ -387,6 +390,7 @@ public class EyesisCorrectionParameters {
properties.setProperty(aux_prefix+"sensorSuffix", this.aux_camera.sensorSuffix);
properties.setProperty(aux_prefix+"cltKernelPrefix", this.aux_camera.cltKernelPrefix);
properties.setProperty(aux_prefix+"cltSuffix", this.aux_camera.cltSuffix);
properties.setProperty(aux_prefix+"x3dSubdirSuffix", this.aux_camera.x3dSubdirSuffix);
}
}
......@@ -512,6 +516,7 @@ public class EyesisCorrectionParameters {
if (properties.getProperty(aux_prefix+"sensorSuffix")!= null) this.aux_camera.sensorSuffix=properties.getProperty(aux_prefix+"sensorSuffix");
if (properties.getProperty(aux_prefix+"cltKernelPrefix")!= null) this.aux_camera.cltKernelPrefix=properties.getProperty(aux_prefix+"cltKernelPrefix");
if (properties.getProperty(aux_prefix+"cltSuffix")!= null) this.aux_camera.cltSuffix=properties.getProperty(aux_prefix+"cltSuffix");
if (properties.getProperty(aux_prefix+"x3dSubdirSuffix")!= null) this.aux_camera.x3dSubdirSuffix=properties.getProperty(aux_prefix+"x3dSubdirSuffix");
}
public boolean showJDialog(String title) {
......@@ -741,6 +746,9 @@ public class EyesisCorrectionParameters {
gd.addStringField ("Source files prefix", this.sourcePrefix, 60); // 13
gd.addStringField ("Source files suffix", this.sourceSuffix, 60); // 14
gd.addStringField ("x3d subdirectory prefix", this.x3dSubdirPrefix, 10, // 14a
"When using timestamp as a subdirectory, add this prefix");
gd.addMessage ("============ Main camera============");
......@@ -757,6 +765,9 @@ public class EyesisCorrectionParameters {
gd.addStringField ("CLT kernel files prefix", this.cltKernelPrefix, 40); // 19
gd.addStringField ("CLT kernel files suffix", this.cltSuffix, 40); // 20
gd.addStringField ("x3d subdirectory suffix", this.x3dSubdirSuffix, 10, // 20a
"When using timestamp as a subdirectory, add this suffix");
gd.addMessage ("============ Auxiliary camera============");
gd.addStringField ("Aux sensor calibration directory", this.aux_camera.sensorDirectory, 60); // 4b
......@@ -772,6 +783,8 @@ public class EyesisCorrectionParameters {
gd.addStringField ("Aux CLT kernel files prefix", this.aux_camera.cltKernelPrefix, 40); // 19b
gd.addStringField ("Aux CLT kernel files suffix", this.aux_camera.cltSuffix, 40); // 20b
gd.addStringField ("Aux x3d subdirectory suffix", this.aux_camera.x3dSubdirSuffix, 10, // 20ba
"When using timestamp as a subdirectory, add this suffix");
......@@ -809,6 +822,7 @@ public class EyesisCorrectionParameters {
this.use_x3d_subdirs= gd.getNextBoolean(); // 10
this.sourcePrefix= gd.getNextString(); // 13
this.sourceSuffix= gd.getNextString(); // 14
this.x3dSubdirPrefix= gd.getNextString(); // 14a
// main camera
this.sensorDirectory= gd.getNextString(); if (gd.getNextBoolean()) selectSensorDirectory(false, false); // 5
......@@ -820,6 +834,7 @@ public class EyesisCorrectionParameters {
this.sensorSuffix= gd.getNextString(); // 18
this.cltKernelPrefix= gd.getNextString(); // 19
this.cltSuffix= gd.getNextString(); // 20
this.x3dSubdirSuffix= gd.getNextString(); // 20a
// aux camera
this.aux_camera.sensorDirectory= gd.getNextString(); if (gd.getNextBoolean()) aux_camera.selectSensorDirectory(false, false); // 5b
......@@ -831,6 +846,7 @@ public class EyesisCorrectionParameters {
this.aux_camera.sensorSuffix= gd.getNextString(); // 18b
this.aux_camera.cltKernelPrefix= gd.getNextString(); // 19b
this.aux_camera.cltSuffix= gd.getNextString(); // 20b
this.aux_camera.x3dSubdirSuffix= gd.getNextString(); // 20ba
this.clt_batch_apply_man= gd.getNextBoolean(); // 21
this.clt_batch_extrinsic= gd.getNextBoolean(); // 22
......
This diff is collapsed.
This diff is collapsed.
import ij.IJ;
import ij.ImagePlus;
/**
** TwoQuadCLT - Process images from a pair of Quad/Octal cameras
**
** Copyright (C) 2018 Elphel, Inc.
**
** -----------------------------------------------------------------------------**
**
** TwoQuadCLT.java is free software: you can redistribute it and/or modify
** it under the terms of the GNU General Public License as published by
** the Free Software Foundation, either version 3 of the License, or
** (at your option) any later version.
**
** This program is distributed in the hope that it will be useful,
** but WITHOUT ANY WARRANTY; without even the implied warranty of
** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
** GNU General Public License for more details.
**
** You should have received a copy of the GNU General Public License
** along with this program. If not, see <http://www.gnu.org/licenses/>.
** -----------------------------------------------------------------------------**
**
*/
public class TwoQuadCLT {
public long startTime; // start of batch processing
public long startSetTime; // start of set processing
public long startStepTime; // start of step processing
/*
public QuadCLT quadCLT_main;
public QuadCLT quadCLT_aux;
public TwoQuadCLT (
QuadCLT quadCLT_main,
QuadCLT quadCLT_aux
) {
this.quadCLT_main = quadCLT_main;
this.quadCLT_aux = quadCLT_aux;
}
*/
public void processCLTQuadCorrs(
QuadCLT quadCLT_main,
QuadCLT quadCLT_aux,
EyesisCorrectionParameters.CLTParameters clt_parameters,
EyesisCorrectionParameters.DebayerParameters debayerParameters,
EyesisCorrectionParameters.ColorProcParameters colorProcParameters,
CorrectionColorProc.ColorGainsParameters channelGainParameters_main,
CorrectionColorProc.ColorGainsParameters channelGainParameters_aux,
EyesisCorrectionParameters.RGBParameters rgbParameters,
final int threadsMax, // maximal number of threads to launch
final boolean updateStatus,
final int debugLevel) throws Exception
{
this.startTime=System.nanoTime();
String [] sourceFiles=quadCLT_main.correctionsParameters.getSourcePaths();
QuadCLT.SetChannels [] set_channels_main = quadCLT_main.setChannels(debugLevel);
QuadCLT.SetChannels [] set_channels_aux = quadCLT_aux.setChannels(debugLevel);
if ((set_channels_main == null) || (set_channels_main.length==0) || (set_channels_aux == null) || (set_channels_aux.length==0)) {
System.out.println("No files to process (of "+sourceFiles.length+")");
return;
}
double [] referenceExposures_main = quadCLT_main.eyesisCorrections.calcReferenceExposures(debugLevel); // multiply each image by this and divide by individual (if not NaN)
double [] referenceExposures_aux = quadCLT_aux.eyesisCorrections.calcReferenceExposures(debugLevel); // multiply each image by this and divide by individual (if not NaN)
for (int nSet = 0; nSet < set_channels_main.length; nSet++){
// check it is the same set for both cameras
if (set_channels_aux.length <= nSet ) {
throw new Exception ("Set naims for cameras do not match: main camera: '"+set_channels_main[nSet].name()+"', aux. camera: nothing");
}
if (!set_channels_main[nSet].name().equals(set_channels_aux[nSet].name())) {
throw new Exception ("Set naims for cameras do not match: main camera: '"+set_channels_main[nSet].name()+"', aux. camera: '"+set_channels_main[nSet].name()+"'");
}
int [] channelFiles_main = set_channels_main[nSet].fileNumber();
int [] channelFiles_aux = set_channels_aux[nSet].fileNumber();
boolean [][] saturation_imp_main = (clt_parameters.sat_level > 0.0)? new boolean[channelFiles_main.length][] : null;
boolean [][] saturation_imp_aux = (clt_parameters.sat_level > 0.0)? new boolean[channelFiles_main.length][] : null;
double [] scaleExposures_main = new double[channelFiles_main.length];
double [] scaleExposures_aux = new double[channelFiles_main.length];
ImagePlus [] imp_srcs_main = quadCLT_main.conditionImageSet(
clt_parameters, // EyesisCorrectionParameters.CLTParameters clt_parameters,
sourceFiles, // String [] sourceFiles,
set_channels_main[nSet].name(), // String set_name,
referenceExposures_main, // double [] referenceExposures,
channelFiles_main, // int [] channelFiles,
scaleExposures_main, //output // double [] scaleExposures
saturation_imp_main, //output // boolean [][] saturation_imp,
debugLevel); // int debugLevel);
ImagePlus [] imp_srcs_aux = quadCLT_aux.conditionImageSet(
clt_parameters, // EyesisCorrectionParameters.CLTParameters clt_parameters,
sourceFiles, // String [] sourceFiles,
set_channels_aux[nSet].name(), // String set_name,
referenceExposures_aux, // double [] referenceExposures,
channelFiles_aux, // int [] channelFiles,
scaleExposures_aux, //output // double [] scaleExposures
saturation_imp_aux, //output // boolean [][] saturation_imp,
debugLevel); // int debugLevel);
// Tempporarily processing individaully with the old code
quadCLT_main.processCLTQuadCorr( // returns ImagePlus, but it already should be saved/shown
imp_srcs_main, // [srcChannel], // should have properties "name"(base for saving results), "channel","path"
saturation_imp_main, // boolean [][] saturation_imp, // (near) saturated pixels or null
clt_parameters,
debayerParameters,
colorProcParameters,
channelGainParameters_main,
rgbParameters,
scaleExposures_main,
false, // apply_corr, // calculate and apply additional fine geometry correction
false, // infinity_corr, // calculate and apply geometry correction at infinity
threadsMax, // maximal number of threads to launch
updateStatus,
debugLevel);
Runtime.getRuntime().gc();
if (debugLevel >-1) System.out.println("Processing set "+(nSet+1)+" (of "+set_channels_main.length+") finished at "+
IJ.d2s(0.000000001*(System.nanoTime()-this.startTime),3)+" sec, --- Free memory="+Runtime.getRuntime().freeMemory()+" (of "+Runtime.getRuntime().totalMemory()+")");
quadCLT_aux.processCLTQuadCorr( // returns ImagePlus, but it already should be saved/shown
imp_srcs_aux, // [srcChannel], // should have properties "name"(base for saving results), "channel","path"
saturation_imp_aux, // boolean [][] saturation_imp, // (near) saturated pixels or null
clt_parameters,
debayerParameters,
colorProcParameters,
channelGainParameters_aux,
rgbParameters,
scaleExposures_aux,
false, // apply_corr, // calculate and apply additional fine geometry correction
false, // infinity_corr, // calculate and apply geometry correction at infinity
threadsMax, // maximal number of threads to launch
updateStatus,
debugLevel);
Runtime.getRuntime().gc();
if (debugLevel >-1) System.out.println("Processing set "+(nSet+1)+" (of "+set_channels_aux.length+") finished at "+
IJ.d2s(0.000000001*(System.nanoTime()-this.startTime),3)+" sec, --- Free memory="+Runtime.getRuntime().freeMemory()+" (of "+Runtime.getRuntime().totalMemory()+")");
if (quadCLT_aux.eyesisCorrections.stopRequested.get()>0) {
System.out.println("User requested stop");
System.out.println("Processing "+(nSet + 1)+" file sets (of "+set_channels_main.length+") finished at "+
IJ.d2s(0.000000001*(System.nanoTime()-this.startTime),3)+" sec, --- Free memory="+Runtime.getRuntime().freeMemory()+" (of "+Runtime.getRuntime().totalMemory()+")");
return;
}
}
System.out.println("processCLTQuadCorrs(): processing "+(quadCLT_main.getTotalFiles(set_channels_main)+quadCLT_aux.getTotalFiles(set_channels_aux))+" files ("+set_channels_main.length+" file sets) finished at "+
IJ.d2s(0.000000001*(System.nanoTime()-this.startTime),3)+" sec, --- Free memory="+Runtime.getRuntime().freeMemory()+" (of "+Runtime.getRuntime().totalMemory()+")");
}
}
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