Commit ef473c40 authored by Andrey Filippov's avatar Andrey Filippov

matched interscene pair

parent 468688b4
......@@ -13,6 +13,7 @@ import com.elphel.imagej.lwir.LwirReaderParameters;
import com.elphel.imagej.tileprocessor.BiQuadParameters;
import com.elphel.imagej.tileprocessor.ImageDtt;
import com.elphel.imagej.tileprocessor.ImageDttParameters;
import com.elphel.imagej.tileprocessor.IntersceneLmaParameters;
import com.elphel.imagej.tileprocessor.MeasuredLayersFilterParameters;
import com.elphel.imagej.tileprocessor.OpticalFlowParameters;
import com.elphel.imagej.tileprocessor.PoleProcessorParameters;
......@@ -871,6 +872,7 @@ public class CLTParameters {
public MeasuredLayersFilterParameters mlfp = new MeasuredLayersFilterParameters();
public LwirReaderParameters lwir = new LwirReaderParameters();
public OpticalFlowParameters ofp = new OpticalFlowParameters();
public IntersceneLmaParameters ilp = new IntersceneLmaParameters();
public HashMap<String,Double> z_corr_map = new HashMap<String,Double>(); //old one
......@@ -1716,8 +1718,9 @@ public class CLTParameters {
mlfp.setProperties (prefix+"_mlfp", properties);
rig.setProperties (prefix+"_rig", properties);
poles.setProperties (prefix+"_poles", properties);
lwir.setProperties (prefix+"_lwir", properties);
ofp.setProperties (prefix+"_ofp_", properties);
lwir.setProperties (prefix+"_lwir", properties);
ofp.setProperties (prefix+"_ofp_", properties);
ilp.setProperties (prefix+"_ilp_", properties);
}
......@@ -2540,6 +2543,7 @@ public class CLTParameters {
poles.getProperties (prefix+"_poles", properties);
lwir.getProperties (prefix+"_lwir", properties);
ofp.getProperties (prefix+"_ofp_", properties);
ilp.getProperties (prefix+"_ilp_", properties);
}
public boolean showJDialog() {
......@@ -3507,6 +3511,9 @@ public class CLTParameters {
gd.addTab ("O-Flow", "parameters for the interscene Optical FLow calculations");
this.ofp.dialogQuestions(gd);
gd.addTab ("Intra-LMA", "parameters for the interscene LMA fitting");
this.ilp.dialogQuestions(gd);
gd.addTab ("Debug", "Other debug images");
......@@ -4304,6 +4311,7 @@ public class CLTParameters {
this.lwir.dialogAnswers(gd);
this.ofp.dialogAnswers(gd);
this.ilp.dialogAnswers(gd);
this.debug_initial_discriminate= gd.getNextBoolean();
this.dbg_migrate= gd.getNextBoolean();
......
......@@ -699,7 +699,8 @@ 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);
addButton("Inter Test", panelClt5, color_stop);
addButton("Inter LMA", panelClt5, color_stop);
plugInFrame.add(panelClt5);
}
......@@ -5107,6 +5108,13 @@ private Panel panel1,
CLT_PARAMETERS.batch_run = true;
testInterScene();
return;
/* ======================================================================== */
} else if (label.equals("Inter LMA")) {
DEBUG_LEVEL=MASTER_DEBUG_LEVEL;
EYESIS_CORRECTIONS.setDebug(DEBUG_LEVEL);
CLT_PARAMETERS.batch_run = true;
testInterLMA();
return;
/* ======================================================================== */
} else if (label.equals("CLT rig edit")) {
......@@ -6475,6 +6483,75 @@ private Panel panel1,
}
public boolean testInterLMA() {
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);
}
}
try {
TWO_QUAD_CLT.TestInterLMA(
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;
}
......
......@@ -92,33 +92,33 @@ public class ErsCorrection extends GeometryCorrection {
static final int DW_DZ = 14; // dw_dz}; (m)
static final String [] DP_DERIV_NAMES = {
"dp_dpX", // (pix) 0
"dp_dpY", // (pix) 1
"dp_dd", // (pix) 2
"dp_dvaz", // (rad/sec) 3
"dp_dvtl", // (rad/sec) 4
"dp_dvrl", // (rad/sec) 5
"dp_dvx", // (m/s) 6
"dp_dvy", // (m/s) 7
"dp_dvz", // (m/s) 8
"dp_daz", // (rad) 9
"dp_dtl", // (rad) 10
"dp_drl", // (rad) 11
"dp_dx", // (m) 12
"dp_dy", // (m) 13
"dp_dz", // (m) 14
"dp_dsvaz", // (rad/sec)15
"dp_dsvtl", // (rad/sec)16
"dp_dsvrl", // (rad/sec)17
"dp_dsvx", // (m/s) 18
"dp_dsvy", // (m/s) 19
"dp_dsvz", // (m/s) 20
"dp_dsaz", // (rad) 21
"dp_dstl", // (rad) 22
"dp_dsrl", // (rad) 23
"dp_dsx", // (m) 24
"dp_dsy", // (m) 25
"dp_dsz"}; // (m) 26
"pX", // (pix) 0
"pY", // (pix) 1
"disp", // (pix) 2
"ers_vaz_ref", // (rad/sec) 3
"ers_vtl_ref", // (rad/sec) 4
"ers_vrl_ref", // (rad/sec) 5
"ers_dvx_ref", // (m/s) 6
"ers_dvy_ref", // (m/s) 7
"ers_dvz_ref", // (m/s) 8
"azimuth_ref", // (rad) 9
"tilt_ref", // (rad) 10
"roll_ref", // (rad) 11
"X_ref", // (m) 12
"Y_ref", // (m) 13
"Z_ref", // (m) 14
"ers_vaz_scene", // (rad/sec)15
"ers_vtl_scene", // (rad/sec)16
"ers_vrl_scene", // (rad/sec)17
"ers_dvx_scene", // (m/s) 18
"ers_dvy_scene", // (m/s) 19
"ers_dvz_scene", // (m/s) 20
"azimuth_scene", // (rad) 21
"tilt_scene", // (rad) 22
"Roll_scene", // (rad) 23
"X_scene", // (m) 24
"Y_scene", // (m) 25
"Z_scene"}; // (m) 26
// returned arrays have the zero element with coordinates, not derivatives
// Reference parameters
......@@ -150,6 +150,7 @@ public class ErsCorrection extends GeometryCorrection {
static final int DP_DSX = 24; // dw_dx, (m)
static final int DP_DSY = 25; // dw_dy, (m)
static final int DP_DSZ = 26; // dw_dz}; (m)
static final int DP_NUM_PARS = DP_DSZ+1;
static final RotationConvention ROT_CONV = RotationConvention.FRAME_TRANSFORM;
static final double THRESHOLD = 1E-10;
......@@ -922,7 +923,7 @@ public class ErsCorrection extends GeometryCorrection {
0.002}; // dw_dz}; (m) 14 was 0.1
double scale_delta = 1.0; // 0.1; // 1.0; // 0.1; // 0.5;
// double [] deltas = deltas0.clone();
double [] deltas = new double [DP_DSZ + 1];
double [] deltas = new double [DP_NUM_PARS];
System.arraycopy(deltas0, 0, deltas, 0, deltas0.length);
System.arraycopy(deltas0, 3, deltas, deltas0.length, deltas0.length - 3);
for (int i = 0; i < deltas.length; i++) deltas[i] *= scale_delta;
......@@ -2010,7 +2011,7 @@ public class ErsCorrection extends GeometryCorrection {
Matrix dpscene_dxyz = dx_dpscene.inverse();
Matrix dpscene_dxyz_minus = dpscene_dxyz.times(-1.0); // negated to calculate /d{pX,pY,D) for the scene parameters
double[][] derivatives = new double[DP_DSZ+2][]; // includes [0] - pXpYD vector
double[][] derivatives = new double[DP_NUM_PARS+1][]; // includes [0] - pXpYD vector
// scene pX, pY, Disparity
derivatives[0] = pXpYD_scene;
// derivatives by the reference parameters, starting with /dpX, /dpY, /dd
......@@ -2026,7 +2027,7 @@ public class ErsCorrection extends GeometryCorrection {
derivatives[vindx] = matrixTimesVector(dpscene_dxyz, reference_vectors[vindx]).toArray();
}
}
for (int indx = DP_DSVAZ; indx <= DP_DSZ; indx++) { // 15,16, ...
for (int indx = DP_DSVAZ; indx < DP_NUM_PARS; indx++) { // 15,16, ...
int indx_out = indx+1; // 16, 17,
int indx_in = indx_out - DP_DSVAZ + DW_DVAZ; // 4, 5, ...
if (is_infinity) {
......
......@@ -535,46 +535,6 @@ public class ExtrinsicAdjustment {
}
/*
private double [] getYminusFx(
GeometryCorrection.CorrVector corr_vector)
{
int clusters = clustersX * clustersY;
Matrix [] corr_rots = corr_vector.getRotMatrices(); // get array of per-sensor rotation matrices
Matrix [][] deriv_rots = corr_vector.getRotDeriveMatrices();
double [] y_minus_fx = new double [clusters * POINTS_SAMPLE];
double [] imu = corr_vector.getIMU(); // i)
for (int cluster = 0; cluster < clusters; cluster++) if (measured_dsxy[cluster] != null){
double [] ddnd = geometryCorrection.getPortsDDNDAndDerivatives( // USED in lwir
geometryCorrection, // GeometryCorrection gc_main,
use_rig_offsets, // boolean use_rig_offsets,
corr_rots, // Matrix [] rots,
deriv_rots, // Matrix [][] deriv_rots,
null, // double [][] DDNDderiv, // if not null, should be double[8][]
dy_ddisparity[cluster], // double [] dy_ddisparity, // double [][] disp_dist, //disp_dist[i][2] or null
imu, // double [] imu,
x0y0[cluster], // double [] pXYND0, // per-port non-distorted coordinates corresponding to the correlation measurements
world_xyz[cluster], // double [] xyz, // world XYZ for ERS correction
measured_dsxy[cluster][ExtrinsicAdjustment.INDX_PX + 0], // double px,
measured_dsxy[cluster][ExtrinsicAdjustment.INDX_PX + 1], // double py,
measured_dsxy[cluster][ExtrinsicAdjustment.INDX_TARGET]); // double disparity);
//arraycopy(Object src, int srcPos, Object dest, int destPos, int length)
ddnd[0] = -ddnd[0];
if ((force_disparity != null) && force_disparity[cluster]) {
ddnd[0] -= measured_dsxy[cluster][ExtrinsicAdjustment.INDX_DIFF];
}
/// ddnd[0] = -measured_dsxy[cluster][ExtrinsicAdjustment.INDX_DIFF] - ddnd[0];
for (int i = 0; i < NUM_SENSORS; i++) {
ddnd[i + 1] = -measured_dsxy[cluster][ExtrinsicAdjustment.INDX_DD0 + i] - ddnd[i + 1];
ddnd[i + 5] = -measured_dsxy[cluster][ExtrinsicAdjustment.INDX_ND0 + i] - ddnd[i + 5];
}
System.arraycopy(ddnd, 0, y_minus_fx, cluster * POINTS_SAMPLE, POINTS_SAMPLE);
}
return y_minus_fx;
}
*/
private double [] getWYmFxRms( // USED in lwir
double [] fx) {
int clusters = clustersX * clustersY;
......@@ -1125,7 +1085,7 @@ public class ExtrinsicAdjustment {
}
return clouds;
}
@Deprecated
private double [] getWeights(
double [][] measured_dsxy,
boolean [] force_disparity, // same dimension as dsdn, true if disparity should be controlled
......@@ -1395,13 +1355,7 @@ public class ExtrinsicAdjustment {
double [] imu = corr_vector.getIMU(); // i)
double [] y_minus_fx = new double [clusters * POINTS_SAMPLE];
for (int cluster = 0; cluster < clusters; cluster++) {
// if ((cluster == 1892) || (cluster == 1894) ||(cluster == 3205)) {
// System.out.println("getFx() cluster="+cluster);
// }
if (measured_dsxy[cluster] != null){
// if ((cluster == 1735 ) || (cluster==1736)){
// System.out.print("");
// }
double [] ddnd = geometryCorrection.getPortsDDNDAndDerivativesNew( // USED in lwir
geometryCorrection, // GeometryCorrection gc_main,
use_rig_offsets, // boolean use_rig_offsets,
......@@ -2220,13 +2174,8 @@ public class ExtrinsicAdjustment {
double lambda,
double rms_diff,
int debug_level) {
// int num_points = this.weights.length; // includes 2 extra for regularization
// int num_pars = getNumPars();
boolean [] rslt = {false,false};
if (this.last_rms == null) { //first time, need to calculate all (vector is valid)
// this.last_ymfx = getFxJt(
// this.vector, // double [] vector,
// this.last_jt); // double [][] jt) { // should be either [vector.length][samples.size()] or null - then only fx is calculated
this.last_jt = getJacobianTransposed(corr_vector); // new double [num_pars][num_points];
this.last_ymfx = getFx(corr_vector);
if (debug_level > -1) { // temporary
......@@ -2304,19 +2253,10 @@ public class ExtrinsicAdjustment {
double [] delta = mdelta.getColumnPackedCopy();
GeometryCorrection.CorrVector corr_delta = geometryCorrection.getCorrVector(delta, par_mask);
/// double [] new_vector = this.vector.clone();
GeometryCorrection.CorrVector new_vector = this.corr_vector.clone();
double scale = 1.0;
// boolean ok =
new_vector.incrementVector(corr_delta, scale); // ok = false if there are nay NaN-s
/// for (int i = 0; i < num_pars; i++) new_vector[i]+= delta[i];
// being optimistic, modify jt and last_ymfx in place, restore if failed
/// this.last_ymfx = getFxJt(
/// new_vector, // double [] vector,
/// this.last_jt); // double [][] jt) { // should be either [vector.length][samples.size()] or null - then only fx is calculated
this.last_jt = getJacobianTransposed(new_vector); // new double [num_pars][num_points];
this.last_ymfx = getFx(new_vector);
if (debug_level > 2) {
......@@ -2339,18 +2279,12 @@ public class ExtrinsicAdjustment {
if (debug_level > 2) {
System.out.print("delta: "+corr_delta.toString()+"\n");
System.out.print("New vector: "+new_vector.toString()+"\n");
/// for (int np = 0; np < vector.length; np++) {
/// System.out.print(this.vector[np]+" ");
/// }
System.out.println();
}
} else { // worsened
rslt[0] = false;
rslt[1] = false; // do not know, caller will decide
// restore state
/// this.last_ymfx = getFxJt( // recalculate fx
/// this.vector, // double [] vector,
/// this.last_jt); // double [][] jt) { // should be either [vector.length][samples.size()] or null - then only fx is calculated
this.last_jt = getJacobianTransposed(corr_vector); // new double [num_pars][num_points];
this.last_ymfx = getFx(corr_vector);
......
package com.elphel.imagej.tileprocessor;
import java.util.Properties;
import com.elphel.imagej.common.GenericJTabbedDialog;
public class IntersceneLmaParameters {
public boolean [] ilma_lma_select = new boolean [ErsCorrection.DP_NUM_PARS]; // first three will not be used
public double [] ilma_regularization_weights = new double [ErsCorrection.DP_NUM_PARS]; // first three will not be used
public double ilma_lambda = 0.1;
public double ilma_lambda_scale_good = 0.5;
public double ilma_lambda_scale_bad = 8.0;
public double ilma_lambda_max = 100;
public double ilma_rms_diff = 0.001;
public int ilma_num_iter = 20;
public int ilma_debug_level = 1;
public IntersceneLmaParameters() {
ilma_lma_select[ErsCorrection.DP_DSAZ]= true;
ilma_lma_select[ErsCorrection.DP_DSTL]= true;
ilma_lma_select[ErsCorrection.DP_DSRL]= true;
ilma_lma_select[ErsCorrection.DP_DSX]= true;
ilma_lma_select[ErsCorrection.DP_DSY]= true;
ilma_lma_select[ErsCorrection.DP_DSZ]= true;
}
public void dialogQuestions(GenericJTabbedDialog gd) {
gd.addMessage("Interframe LMA parameters selection");
for (int i = ErsCorrection.DP_DVAZ; i < ErsCorrection.DP_NUM_PARS; i++) {
gd.addCheckbox (ErsCorrection.DP_DERIV_NAMES[i], this.ilma_lma_select[i],
"Adjust parameter "+ErsCorrection.DP_DERIV_NAMES[i]+" with interscene LMA" );
}
gd.addMessage("Regularization parameters - pull strength to the initial values");
for (int i = ErsCorrection.DP_DVAZ; i < ErsCorrection.DP_NUM_PARS; i++) {
gd.addNumericField(ErsCorrection.DP_DERIV_NAMES[i], this.ilma_regularization_weights[i], 6,8,"",
"Weight of "+ErsCorrection.DP_DERIV_NAMES[i]+" pull, 1.0 means that the paramter offset from initial corresponding to 1 image pixel\n"+
" will cause error equal to all reprojection ones");
}
gd.addMessage("LMA other parameters");
gd.addNumericField("LMA lambda", this.ilma_lambda, 6,8,"",
"Initial value of the LMA lambda");
gd.addNumericField("Scale lambda after successful LMA iteration", this.ilma_lambda_scale_good, 3,5,"",
"Scale lambda (reduce) if the new RMSE is lower than the previous one.");
gd.addNumericField("Scale lambda after failed LMA iteration", this.ilma_lambda_scale_bad, 3,5,"",
"Scale lambda (increase) if the new RMSE is higher than the previous one.");
gd.addNumericField("Maximal value of lambda to try", this.ilma_lambda_max, 2,7,"",
"Fail LMA if the result is still worse than before parameters were updates.");
gd.addNumericField("Minimal relative RMSE improvement", this.ilma_rms_diff, 5,7,"",
"Exit LMA iterations if relative RMSE improvement drops below this value.");
gd.addNumericField("Maximal number of LMA iterations", this.ilma_num_iter, 0,3,"",
"A hard limit on LMA iterations.");
gd.addNumericField("Debug level", this.ilma_debug_level, 0,3,"",
"Debug level of interscene LMA operation.");
}
public void dialogAnswers(GenericJTabbedDialog gd) {
for (int i = ErsCorrection.DP_DVAZ; i < ErsCorrection.DP_NUM_PARS; i++) {
this.ilma_lma_select[i] = gd.getNextBoolean();
}
for (int i = ErsCorrection.DP_DVAZ; i < ErsCorrection.DP_NUM_PARS; i++) {
this.ilma_regularization_weights[i] = gd.getNextNumber();
}
this.ilma_lambda = gd.getNextNumber();
this.ilma_lambda_scale_good = gd.getNextNumber();
this.ilma_lambda_scale_bad = gd.getNextNumber();
this.ilma_lambda_max = gd.getNextNumber();
this.ilma_rms_diff = gd.getNextNumber();
this.ilma_num_iter = (int) gd.getNextNumber();
this.ilma_debug_level = (int) gd.getNextNumber();
}
public void setProperties(String prefix,Properties properties){
for (int i = ErsCorrection.DP_DVAZ; i < ErsCorrection.DP_NUM_PARS; i++) {
properties.setProperty(prefix+ErsCorrection.DP_DERIV_NAMES[i]+"_sel", this.ilma_lma_select[i]+"");
properties.setProperty(prefix+ErsCorrection.DP_DERIV_NAMES[i]+"_regweight", this.ilma_regularization_weights[i]+"");
}
properties.setProperty(prefix+"ilma_lambda", this.ilma_lambda+"");
properties.setProperty(prefix+"ilma_lambda_scale_good", this.ilma_lambda_scale_good+"");
properties.setProperty(prefix+"ilma_lambda_scale_bad", this.ilma_lambda_scale_bad+"");
properties.setProperty(prefix+"ilma_lambda_max", this.ilma_lambda_max+"");
properties.setProperty(prefix+"ilma_rms_diff", this.ilma_rms_diff+"");
properties.setProperty(prefix+"ilma_num_iter", this.ilma_num_iter+"");
properties.setProperty(prefix+"ilma_debug_level", this.ilma_debug_level+"");
}
public void getProperties(String prefix,Properties properties){
for (int i = ErsCorrection.DP_DVAZ; i < ErsCorrection.DP_NUM_PARS; i++) {
String pn_sel = prefix+ErsCorrection.DP_DERIV_NAMES[i]+"_sel";
if (properties.getProperty(pn_sel)!=null) this.ilma_lma_select[i]=Boolean.parseBoolean(properties.getProperty(pn_sel));
pn_sel = prefix+ErsCorrection.DP_DERIV_NAMES[i]+"_regweight";
if (properties.getProperty(pn_sel)!=null) this.ilma_regularization_weights[i]=Double.parseDouble(properties.getProperty(pn_sel));
}
if (properties.getProperty(prefix+"ilma_lambda")!=null) this.ilma_lambda=Double.parseDouble(properties.getProperty(prefix+"ilma_lambda"));
if (properties.getProperty(prefix+"ilma_lambda_scale_good")!=null) this.ilma_lambda_scale_good=Double.parseDouble(properties.getProperty(prefix+"ilma_lambda_scale_good"));
if (properties.getProperty(prefix+"ilma_lambda_scale_bad")!=null) this.ilma_lambda_scale_bad=Double.parseDouble(properties.getProperty(prefix+"ilma_lambda_scale_bad"));
if (properties.getProperty(prefix+"ilma_lambda_max")!=null) this.ilma_lambda_max=Double.parseDouble(properties.getProperty(prefix+"ilma_lambda_max"));
if (properties.getProperty(prefix+"ilma_rms_diff")!=null) this.ilma_rms_diff=Double.parseDouble(properties.getProperty(prefix+"ilma_rms_diff"));
if (properties.getProperty(prefix+"ilma_num_iter")!=null) this.ilma_num_iter=Integer.parseInt(properties.getProperty(prefix+"ilma_num_iter"));
if (properties.getProperty(prefix+"ilma_debug_level")!=null) this.ilma_debug_level=Integer.parseInt(properties.getProperty(prefix+"ilma_debug_level"));
}
@Override
public IntersceneLmaParameters clone() throws CloneNotSupportedException {
IntersceneLmaParameters ilp = new IntersceneLmaParameters();
System.arraycopy(this.ilma_lma_select, 0, ilp.ilma_lma_select, 0, ilma_lma_select.length);
System.arraycopy(this.ilma_regularization_weights, 0, ilp.ilma_regularization_weights, 0, ilma_regularization_weights.length);
ilp.ilma_lambda = this.ilma_lambda;
ilp.ilma_lambda_scale_good = this.ilma_lambda_scale_good;
ilp.ilma_lambda_scale_bad = this.ilma_lambda_scale_bad;
ilp.ilma_lambda_max = this.ilma_lambda_max;
ilp.ilma_rms_diff = this.ilma_rms_diff;
ilp.ilma_num_iter = this.ilma_num_iter;
ilp.ilma_debug_level = this.ilma_debug_level;
return ilp;
}
}
......@@ -8279,6 +8279,86 @@ if (debugLevel > -100) return true; // temporarily !
System.out.println("End of test");
}
public void TestInterLMA(
QuadCLT quadCLT_main, // tiles should be set
CLTParameters clt_parameters,
EyesisCorrectionParameters.DebayerParameters debayerParameters,
ColorProcParameters colorProcParameters,
ColorProcParameters colorProcParameters_aux,
CorrectionColorProc.ColorGainsParameters channelGainParameters,
EyesisCorrectionParameters.RGBParameters rgbParameters,
EyesisCorrectionParameters.EquirectangularParameters equirectangularParameters,
Properties properties,
final int threadsMax, // maximal number of threads to launch
final boolean updateStatus,
final int debugLevel) throws Exception
{
if ((quadCLT_main != null) && (quadCLT_main.getGPU() != null)) {
quadCLT_main.getGPU().resetGeometryCorrection();
quadCLT_main.gpuResetCorrVector(); // .getGPU().resetGeometryCorrectionVector();
}
// final boolean batch_mode = clt_parameters.batch_run;
this.startTime=System.nanoTime();
String [] sourceFiles0=quadCLT_main.correctionsParameters.getSourcePaths();
QuadCLT.SetChannels [] set_channels_main = quadCLT_main.setChannels(debugLevel);
if ((set_channels_main == null) || (set_channels_main.length==0)) {
System.out.println("No files to process (of "+sourceFiles0.length+")");
return;
}
QuadCLT.SetChannels [] set_channels=quadCLT_main.setChannels(debugLevel);
// String set_name = set_channels[0].set_name;
QuadCLT [] quadCLTs = new QuadCLT [set_channels.length];
for (int i = 0; i < quadCLTs.length; i++) {
quadCLTs[i] = quadCLT_main.spawnQuadCLT(
set_channels[i].set_name,
clt_parameters,
colorProcParameters, //
threadsMax,
debugLevel);
// temporarily fix wrong sign:
ErsCorrection ers = (ErsCorrection) (quadCLTs[i].getGeometryCorrection());
ers.setupERSfromExtrinsics();
quadCLTs[i].setDSRBG(
clt_parameters, // CLTParameters clt_parameters,
threadsMax, // int threadsMax, // maximal number of threads to launch
updateStatus, // boolean updateStatus,
debugLevel); // int debugLevel)
/// quadCLTs[i].showDSIMain();
}
OpticalFlow opticalFlow = new OpticalFlow(
threadsMax, // int threadsMax, // maximal number of threads to launch
updateStatus); // boolean updateStatus);
for (int i = 1; i < quadCLTs.length; i++) {
QuadCLT qPrev = (i > 0) ? quadCLTs[i - 1] : null;
// double [][][] pair_sets =
/*
opticalFlow.test_LMA(
clt_parameters, // CLTParameters clt_parameters,
clt_parameters.ofp.k_prev, // k_prev,
quadCLTs[i],
qPrev,
clt_parameters.ofp.ers_to_pose_scale, // corr_scale,
clt_parameters.ofp.debug_level_optical); // 1); // -1); // int debug_level);
*/
opticalFlow.test_LMA(
clt_parameters, // CLTParameters clt_parameters,
clt_parameters.ofp.k_prev, // k_prev,
qPrev,
quadCLTs[i],
clt_parameters.ofp.ers_to_pose_scale, // corr_scale,
clt_parameters.ofp.debug_level_optical); // 1); // -1); // int debug_level);
}
System.out.println("End of test");
}
public void batchLwirRig(
......
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