Commit c8fd13f4 authored by Andrey Filippov's avatar Andrey Filippov

Tested rig (2 quad cameras) matrices and manual adjustment

parent e59c6d14
...@@ -731,6 +731,7 @@ public class AlignmentCorrection { ...@@ -731,6 +731,7 @@ public class AlignmentCorrection {
double centerY = tileY * qc.tp.getTileSize() + qc.tp.getTileSize()/2;//- shiftY; double centerY = tileY * qc.tp.getTileSize() + qc.tp.getTileSize()/2;//- shiftY;
double [][] centersXY_disp = qc.geometryCorrection.getPortsCoordinatesAndDerivatives( double [][] centersXY_disp = qc.geometryCorrection.getPortsCoordinatesAndDerivatives(
false, // boolean use_rig_offsets,
corr_rots, // Matrix [] rots, corr_rots, // Matrix [] rots,
null, // Matrix [][] deriv_rots, null, // Matrix [][] deriv_rots,
null, // double [][] pXYderiv, // if not null, should be double[8][] null, // double [][] pXYderiv, // if not null, should be double[8][]
...@@ -738,6 +739,7 @@ public class AlignmentCorrection { ...@@ -738,6 +739,7 @@ public class AlignmentCorrection {
centerY, centerY,
disp_strength[2 * s.series + 0][s.tile]/magic_coeff); // disparity disp_strength[2 * s.series + 0][s.tile]/magic_coeff); // disparity
double [][] centersXY_inf = qc.geometryCorrection.getPortsCoordinatesAndDerivatives( double [][] centersXY_inf = qc.geometryCorrection.getPortsCoordinatesAndDerivatives(
false, // boolean use_rig_offsets,
corr_rots, // Matrix [] rots, corr_rots, // Matrix [] rots,
null, // Matrix [][] deriv_rots, null, // Matrix [][] deriv_rots,
null, // double [][] pXYderiv, // if not null, should be double[8][] null, // double [][] pXYderiv, // if not null, should be double[8][]
...@@ -2434,6 +2436,7 @@ System.out.println("test1234"); ...@@ -2434,6 +2436,7 @@ System.out.println("test1234");
double [][] deriv = new double [2 * NUM_SENSORS][]; double [][] deriv = new double [2 * NUM_SENSORS][];
int dbg_index =dbg_index (pXY, dbg_decimate); int dbg_index =dbg_index (pXY, dbg_decimate);
geometryCorrection.getPortsCoordinatesAndDerivatives( geometryCorrection.getPortsCoordinatesAndDerivatives(
false, // boolean use_rig_offsets,
corr_rots, // Matrix [] rots, corr_rots, // Matrix [] rots,
deriv_rots, // Matrix [][] deriv_rots, deriv_rots, // Matrix [][] deriv_rots,
deriv, // boolean calc_deriv, deriv, // boolean calc_deriv,
...@@ -2458,6 +2461,7 @@ System.out.println("test1234"); ...@@ -2458,6 +2461,7 @@ System.out.println("test1234");
double [][] deriv_dbg = new double [2 * NUM_SENSORS][]; double [][] deriv_dbg = new double [2 * NUM_SENSORS][];
double [] dbg_a_vector= null; double [] dbg_a_vector= null;
geometryCorrection.getPortsCoordinatesAndDerivatives( geometryCorrection.getPortsCoordinatesAndDerivatives(
false, // boolean use_rig_offsets,
dbg_a_vector, // double [] dbg_a_vector, // replace actual radial distortion coefficients dbg_a_vector, // double [] dbg_a_vector, // replace actual radial distortion coefficients
1E-9, // 1E-8, //6, // double delta, // 1e-6 1E-9, // 1E-8, //6, // double delta, // 1e-6
corr_vector, // CorrVector corr_vector, corr_vector, // CorrVector corr_vector,
...@@ -2596,6 +2600,7 @@ System.out.println("test1234"); ...@@ -2596,6 +2600,7 @@ System.out.println("test1234");
Mismatch mm = mismatch_list.get(indx); Mismatch mm = mismatch_list.get(indx);
double [] pXY = mm.getPXY(); double [] pXY = mm.getPXY();
double [][] f = geometryCorrection.getPortsCoordinatesAndDerivatives( // 4x2 double [][] f = geometryCorrection.getPortsCoordinatesAndDerivatives( // 4x2
false, // boolean use_rig_offsets,
corr_rots, // Matrix [] rots, corr_rots, // Matrix [] rots,
null, // Matrix [][] deriv_rots, null, // Matrix [][] deriv_rots,
null, // boolean calc_deriv, null, // boolean calc_deriv,
......
...@@ -730,7 +730,7 @@ public class EyesisCorrectionParameters { ...@@ -730,7 +730,7 @@ public class EyesisCorrectionParameters {
updateAuxFromMain(); updateAuxFromMain();
gd.addTab ("File paths", "Select files and directories paths (common to main and optional auxilliary)"); gd.addTab ("File paths", "Select files and directories paths (common to main and optional auxiliary)");
gd.addMessage ("============ Common to the main and optional auxiliary camera============"); gd.addMessage ("============ Common to the main and optional auxiliary camera============");
gd.addCheckbox ("Save current settings with results", this.saveSettings); // 1 gd.addCheckbox ("Save current settings with results", this.saveSettings); // 1
......
...@@ -578,6 +578,7 @@ private Panel panel1, ...@@ -578,6 +578,7 @@ private Panel panel1,
panelClt4.setLayout(new GridLayout(1, 0, 5, 5)); // rows, columns, vgap, hgap panelClt4.setLayout(new GridLayout(1, 0, 5, 5)); // rows, columns, vgap, hgap
addButton("Import Aux", panelClt4, color_restore); addButton("Import Aux", panelClt4, color_restore);
addButton("Setup CLT Batch parameters", panelClt4, color_configure); addButton("Setup CLT Batch parameters", panelClt4, color_configure);
addButton("CLT rig edit", panelClt4, color_configure);
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);
...@@ -4490,11 +4491,28 @@ private Panel panel1, ...@@ -4490,11 +4491,28 @@ private Panel panel1,
} }
} }
QUAD_CLT_AUX.showExtrinsicCorr("aux");// show_fine_corr("aux"); QUAD_CLT_AUX.showExtrinsicCorr("aux");// show_fine_corr("aux");
// QuadCLT dbg_QUAD_CLT = QUAD_CLT; QuadCLT dbg_QUAD_CLT = QUAD_CLT;
// QuadCLT dbg_QUAD_CLT_AUX = QUAD_CLT_AUX; QuadCLT dbg_QUAD_CLT_AUX = QUAD_CLT_AUX;
return; return;
/* ======================================================================== */
} else if (label.equals("CLT rig edit")) {
DEBUG_LEVEL=MASTER_DEBUG_LEVEL;
if (QUAD_CLT_AUX == null){
if (EYESIS_CORRECTIONS_AUX == null) {
EYESIS_CORRECTIONS_AUX = new EyesisCorrections(SYNC_COMMAND.stopRequested,CORRECTION_PARAMETERS.getAux());
}
QUAD_CLT_AUX = new QuadCLT (
QuadCLT.PREFIX_AUX,
PROPERTIES,
EYESIS_CORRECTIONS_AUX,
CORRECTION_PARAMETERS.getAux());
if (DEBUG_LEVEL > 0){
System.out.println("Created new QuadCLT instance, will need to read CLT kernels for aux camera");
}
}
QUAD_CLT_AUX.editRig();
return;
//JTabbedTest //JTabbedTest
// End of buttons code // End of buttons code
} }
...@@ -4559,8 +4577,6 @@ private Panel panel1, ...@@ -4559,8 +4577,6 @@ private Panel panel1,
CHANNEL_GAINS_PARAMETERS_AUX = new CorrectionColorProc.ColorGainsParameters(); CHANNEL_GAINS_PARAMETERS_AUX = new CorrectionColorProc.ColorGainsParameters();
} }
CHANNEL_GAINS_PARAMETERS_AUX.getProperties("CHANNEL_GAINS_PARAMETERS.", aux_properties); CHANNEL_GAINS_PARAMETERS_AUX.getProperties("CHANNEL_GAINS_PARAMETERS.", aux_properties);
// QUAD_CLT_AUX.getProperties(QuadCLT.PREFIX);
// QUAD_CLT_AUX.setProperties(QuadCLT.PREFIX_AUX);
/* /*
* public void copyPropertiesFrom(Properties other_properties, String other_prefix, String this_prefix){ // save * public void copyPropertiesFrom(Properties other_properties, String other_prefix, String this_prefix){ // save
...@@ -4834,6 +4850,9 @@ private Panel panel1, ...@@ -4834,6 +4850,9 @@ private Panel panel1,
TWO_QUAD_CLT = new TwoQuadCLT(); TWO_QUAD_CLT = new TwoQuadCLT();
} }
if (new_mode) { if (new_mode) {
if (DEBUG_LEVEL > -2){
System.out.println("++++++++++++++ Calculating combined correlations ++++++++++++++");
}
try { try {
TWO_QUAD_CLT.processCLTQuadCorrPairs( TWO_QUAD_CLT.processCLTQuadCorrPairs(
QUAD_CLT, // QuadCLT quadCLT_main, QUAD_CLT, // QuadCLT quadCLT_main,
...@@ -4852,6 +4871,9 @@ private Panel panel1, ...@@ -4852,6 +4871,9 @@ private Panel panel1,
e.printStackTrace(); e.printStackTrace();
} //final int debugLevel); } //final int debugLevel);
} else { } else {
if (DEBUG_LEVEL > -2){
System.out.println("++++++++++++++ Calculating per quad camera correlations ++++++++++++++");
}
try { try {
TWO_QUAD_CLT.processCLTQuadCorrs( TWO_QUAD_CLT.processCLTQuadCorrs(
QUAD_CLT, // QuadCLT quadCLT_main, QUAD_CLT, // QuadCLT quadCLT_main,
......
This diff is collapsed.
This diff is collapsed.
...@@ -67,6 +67,7 @@ public class QuadCLT { ...@@ -67,6 +67,7 @@ public class QuadCLT {
String image_name = null; String image_name = null;
double [][][] image_data = null; double [][][] image_data = null;
boolean [][] saturation_imp = null; // (near) saturated pixels or null boolean [][] saturation_imp = null; // (near) saturated pixels or null
boolean is_aux = false;
// magic scale should be set before using TileProcessor (calculated disparities depend on it) // magic scale should be set before using TileProcessor (calculated disparities depend on it)
...@@ -96,6 +97,7 @@ public class QuadCLT { ...@@ -96,6 +97,7 @@ public class QuadCLT {
this.eyesisCorrections= eyesisCorrections; this.eyesisCorrections= eyesisCorrections;
this.correctionsParameters = correctionsParameters; this.correctionsParameters = correctionsParameters;
this.properties = properties; this.properties = properties;
is_aux = prefix.equals(PREFIX_AUX);
// this.properties_prefix = prefix; // this.properties_prefix = prefix;
// System.out.println("new QuadCLT(), prefix = "+prefix); // System.out.println("new QuadCLT(), prefix = "+prefix);
getProperties(prefix); getProperties(prefix);
...@@ -125,6 +127,9 @@ public class QuadCLT { ...@@ -125,6 +127,9 @@ public class QuadCLT {
properties.setProperty(name, gc.getCorrVector().toArray()[i]+""); properties.setProperty(name, gc.getCorrVector().toArray()[i]+"");
// System.out.println("setProperties():"+i+": setProperty("+name+","+gc.getCorrVector().toArray()[i]+""); // System.out.println("setProperties():"+i+": setProperty("+name+","+gc.getCorrVector().toArray()[i]+"");
} }
if (is_aux && (gc.rigOffset != null)) {
gc.rigOffset.setProperties(prefix,properties);
}
} }
...@@ -197,8 +202,17 @@ public class QuadCLT { ...@@ -197,8 +202,17 @@ public class QuadCLT {
} }
} }
} }
} // if (is_aux && (geometryCorrection != null)) {
// geometryCorrection.setRigOffsetFromProperies(prefix, properties);
// }
if (geometryCorrection == null) {
geometryCorrection = new GeometryCorrection(this.extrinsic_corr);
}
if (is_aux) {
geometryCorrection.setRigOffsetFromProperies(prefix, properties);
}
}
public void setKernelImageFile(ImagePlus img_kernels){ public void setKernelImageFile(ImagePlus img_kernels){
eyesisKernelImage = img_kernels; eyesisKernelImage = img_kernels;
...@@ -212,10 +226,13 @@ public class QuadCLT { ...@@ -212,10 +226,13 @@ public class QuadCLT {
return clt_kernels != null; return clt_kernels != null;
} }
public boolean geometryCorrectionAvailable(){ public boolean geometryCorrectionAvailable(){
return geometryCorrection != null; return (geometryCorrection != null) && geometryCorrection.isInitialized();
} }
public boolean initGeometryCorrection(int debugLevel){ public boolean initGeometryCorrection(int debugLevel){
geometryCorrection = new GeometryCorrection(extrinsic_corr); // keep rig offsets if edited
if (geometryCorrection == null) {
geometryCorrection = new GeometryCorrection(extrinsic_corr);
}
PixelMapping.SensorData [] sensors = eyesisCorrections.pixelMapping.sensors; PixelMapping.SensorData [] sensors = eyesisCorrections.pixelMapping.sensors;
// verify that all sensors have the same distortion parameters // verify that all sensors have the same distortion parameters
int numSensors = sensors.length; int numSensors = sensors.length;
...@@ -4527,6 +4544,32 @@ public class QuadCLT { ...@@ -4527,6 +4544,32 @@ public class QuadCLT {
System.out.println(geometryCorrection.getCorrVector().toString()); System.out.println(geometryCorrection.getCorrVector().toString());
} }
} }
public boolean editRig()
{
if (!is_aux) {
System.out.println("Rig offsets can only be edited for the auxiliary camera, not for the amin one");
return false;
}
// GeometryCorrection gc = this.geometryCorrection;
if (this.geometryCorrection == null){
System.out.println("geometryCorrection is not set, creating one");
this.geometryCorrection = new GeometryCorrection(this.extrinsic_corr);
}
boolean edited = this.geometryCorrection.editRig();
// if (edited) {
// gc.rigOffset.setProperties(prefix,properties);
// }
return edited;
}
/*
if (is_aux && (gc.rigOffset != null)) {
gc.rigOffset.setProperties(prefix,properties);
}
*/
public void resetExtrinsicCorr( public void resetExtrinsicCorr(
EyesisCorrectionParameters.CLTParameters clt_parameters) EyesisCorrectionParameters.CLTParameters clt_parameters)
{ {
......
...@@ -381,7 +381,7 @@ public class TwoQuadCLT { ...@@ -381,7 +381,7 @@ public class TwoQuadCLT {
quadCLT_main.getGeometryCorrection(), // final GeometryCorrection geometryCorrection_main, quadCLT_main.getGeometryCorrection(), // final GeometryCorrection geometryCorrection_main,
quadCLT_aux.getGeometryCorrection(), // final GeometryCorrection geometryCorrection_aux, quadCLT_aux.getGeometryCorrection(), // final GeometryCorrection geometryCorrection_aux,
quadCLT_main.getCLTKernels(), // final double [][][][][][] clt_kernels_main, // [channel_in_quad][color][tileY][tileX][band][pixel] , size should match image (have 1 tile around) quadCLT_main.getCLTKernels(), // final double [][][][][][] clt_kernels_main, // [channel_in_quad][color][tileY][tileX][band][pixel] , size should match image (have 1 tile around)
quadCLT_main.getCLTKernels(), // final double [][][][][][] clt_kernels_aux, // [channel_in_quad][color][tileY][tileX][band][pixel] , size should match image (have 1 tile around) quadCLT_aux.getCLTKernels(), // final double [][][][][][] clt_kernels_aux, // [channel_in_quad][color][tileY][tileX][band][pixel] , size should match image (have 1 tile around)
clt_parameters.corr_magic_scale, // final double corr_magic_scale, // still not understood coefficient that reduces reported disparity value. Seems to be around 0.85 clt_parameters.corr_magic_scale, // final double corr_magic_scale, // still not understood coefficient that reduces reported disparity value. Seems to be around 0.85
true, // final boolean keep_clt_data, true, // final boolean keep_clt_data,
threadsMax, // final int threadsMax, // maximal number of threads to launch threadsMax, // final int threadsMax, // maximal number of threads to launch
...@@ -496,7 +496,7 @@ public class TwoQuadCLT { ...@@ -496,7 +496,7 @@ public class TwoQuadCLT {
colorProcParameters, colorProcParameters,
rgbParameters, rgbParameters,
name+"-texture", // String name, name+"-texture", // String name,
"-D"+clt_parameters.disparity, //String suffix, // such as disparity=... "-D"+clt_parameters.disparity+"-MAIN", //String suffix, // such as disparity=...
toRGB, toRGB,
!quadCLT_main.correctionsParameters.jpeg, // boolean bpp16, // 16-bit per channel color mode for result !quadCLT_main.correctionsParameters.jpeg, // boolean bpp16, // 16-bit per channel color mode for result
true, // boolean saveShowIntermediate, // save/show if set globally true, // boolean saveShowIntermediate, // save/show if set globally
...@@ -511,7 +511,7 @@ public class TwoQuadCLT { ...@@ -511,7 +511,7 @@ public class TwoQuadCLT {
colorProcParameters, colorProcParameters,
rgbParameters, rgbParameters,
name+"-texture", // String name, name+"-texture", // String name,
"-D"+clt_parameters.disparity, //String suffix, // such as disparity=... "-D"+clt_parameters.disparity+"-AUX", //String suffix, // such as disparity=...
toRGB, toRGB,
!quadCLT_aux.correctionsParameters.jpeg, // boolean bpp16, // 16-bit per channel color mode for result !quadCLT_aux.correctionsParameters.jpeg, // boolean bpp16, // 16-bit per channel color mode for result
true, // boolean saveShowIntermediate, // save/show if set globally true, // boolean saveShowIntermediate, // save/show if set globally
......
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