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.
...@@ -971,6 +971,7 @@ public class ImageDtt { ...@@ -971,6 +971,7 @@ public class ImageDtt {
// centerY, // centerY,
// disparity); // disparity);
double [][] centersXY = geometryCorrection.getPortsCoordinatesAndDerivatives( double [][] centersXY = 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][]
...@@ -1689,8 +1690,8 @@ public class ImageDtt { ...@@ -1689,8 +1690,8 @@ public class ImageDtt {
double [][] tcorr_combo = null; // [15*15] pixel space double [][] tcorr_combo = null; // [15*15] pixel space
double [][][] tcorr_partial = null; // [quad][numcol+1][15*15] double [][][] tcorr_partial = null; // [quad][numcol+1][15*15]
double [][][][] tcorr_tpartial = null; // [quad][numcol+1][4][8*8] double [][][][] tcorr_tpartial = null; // [quad][numcol+1][4][8*8]
PolynomialApproximation pa = null; // PolynomialApproximation pa = null;
if (corr_max_weights_poly !=null) pa = new PolynomialApproximation(0); // debug level // if (corr_max_weights_poly !=null) pa = new PolynomialApproximation(0); // debug level
Correlation2d corr2d = new Correlation2d( Correlation2d corr2d = new Correlation2d(
imgdtt_params, // ImageDttParameters imgdtt_params, imgdtt_params, // ImageDttParameters imgdtt_params,
transform_size, // int transform_size, transform_size, // int transform_size,
...@@ -1738,6 +1739,7 @@ public class ImageDtt { ...@@ -1738,6 +1739,7 @@ public class ImageDtt {
} else { } else {
centersXY = geometryCorrection.getPortsCoordinatesAndDerivatives( centersXY = 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][]
...@@ -5956,6 +5958,7 @@ public class ImageDtt { ...@@ -5956,6 +5958,7 @@ public class ImageDtt {
} else { } else {
centersXY = geometryCorrection.getPortsCoordinatesAndDerivatives( centersXY = 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][]
...@@ -7205,14 +7208,35 @@ public class ImageDtt { ...@@ -7205,14 +7208,35 @@ public class ImageDtt {
dir_corr_strength[0][0],dir_corr_strength[0][1],dir_corr_strength[1][0],dir_corr_strength[1][1], dir_corr_strength[0][0],dir_corr_strength[0][1],dir_corr_strength[1][0],dir_corr_strength[1][1],
dir_corr_strength[2][0],dir_corr_strength[2][1],dir_corr_strength[3][0],dir_corr_strength[3][1])); dir_corr_strength[2][0],dir_corr_strength[2][1],dir_corr_strength[3][0],dir_corr_strength[3][1]));
} }
if (dir_corr_strength[0] != null) {
result[DISP_HOR_INDEX] = dir_corr_strength[0][0]; result[DISP_HOR_INDEX] = dir_corr_strength[0][0];
result[STR_HOR_INDEX] = dir_corr_strength[0][1]; result[STR_HOR_INDEX] = dir_corr_strength[0][1];
} else {
result[DISP_HOR_INDEX] = Double.NaN;
result[STR_HOR_INDEX] = 0.0;
}
if (dir_corr_strength[1] != null) {
result[DISP_VERT_INDEX] = dir_corr_strength[1][0]; result[DISP_VERT_INDEX] = dir_corr_strength[1][0];
result[STR_VERT_INDEX] = dir_corr_strength[1][1]; result[STR_VERT_INDEX] = dir_corr_strength[1][1];
} else {
result[DISP_VERT_INDEX] = Double.NaN;
result[STR_VERT_INDEX] = 0.0;
}
if (dir_corr_strength[2] != null) {
result[DISP_DIAGM_INDEX] = dir_corr_strength[2][0]; result[DISP_DIAGM_INDEX] = dir_corr_strength[2][0];
result[STR_DIAGM_INDEX] = dir_corr_strength[2][1]; result[STR_DIAGM_INDEX] = dir_corr_strength[2][1];
result[DISP_DIAGM_INDEX] = dir_corr_strength[3][0]; } else {
result[DISP_DIAGM_INDEX] = Double.NaN;
result[STR_DIAGM_INDEX] = 0.0;
}
if (dir_corr_strength[3] != null) {
result[DISP_DIAGO_INDEX] = dir_corr_strength[3][0];
result[STR_DIAGO_INDEX] = dir_corr_strength[3][1]; result[STR_DIAGO_INDEX] = dir_corr_strength[3][1];
} else {
result[DISP_DIAGO_INDEX] = Double.NaN;
result[STR_DIAGO_INDEX] = 0.0;
}
mod_disparity_diff = corr2d.foregroundCorrect( mod_disparity_diff = corr2d.foregroundCorrect(
clt_parameters.img_dtt.fo_far, // boolean bg, clt_parameters.img_dtt.fo_far, // boolean bg,
...@@ -7385,8 +7409,6 @@ public class ImageDtt { ...@@ -7385,8 +7409,6 @@ public class ImageDtt {
public double [][][][][][][] clt_bi_quad( public double [][][][][][][] clt_bi_quad(
final EyesisCorrectionParameters.CLTParameters clt_parameters, final EyesisCorrectionParameters.CLTParameters clt_parameters,
// final ImageDttParameters imgdtt_params, // Now just extra correlation parameters, later will include, most others
// final int macro_scale, // to correlate tile data instead of the pixel data: 1 - pixels, 8 - tiles
final int [][] tile_op_main, // [tilesY][tilesX] - what to do - 0 - nothing for this tile final int [][] tile_op_main, // [tilesY][tilesX] - what to do - 0 - nothing for this tile
final int [][] tile_op_aux, // [tilesY][tilesX] - what to do - 0 - nothing for this tile final int [][] tile_op_aux, // [tilesY][tilesX] - what to do - 0 - nothing for this tile
final double [][] disparity_array, // [tilesY][tilesX] - individual per-tile expected disparity final double [][] disparity_array, // [tilesY][tilesX] - individual per-tile expected disparity
...@@ -7419,7 +7441,7 @@ public class ImageDtt { ...@@ -7419,7 +7441,7 @@ public class ImageDtt {
final int debug_tileX = clt_parameters.tileX; final int debug_tileX = clt_parameters.tileX;
final int debug_tileY = clt_parameters.tileY; final int debug_tileY = clt_parameters.tileY;
// final boolean debug_ports_coordinates = (debug_tileX == -1234); // final boolean debug_ports_coordinates = (debug_tileX == -1234);
final double poly_corr = clt_parameters.img_dtt.poly_corr_scale; // maybe add per-tile task bits to select none/near/far // final double poly_corr = clt_parameters.img_dtt.poly_corr_scale; // maybe add per-tile task bits to select none/near/far
final int quad_main = image_data_main.length; // number of subcameras final int quad_main = image_data_main.length; // number of subcameras
final int quad_aux = image_data_aux.length; // number of subcameras final int quad_aux = image_data_aux.length; // number of subcameras
final int numcol = 3; // number of colors final int numcol = 3; // number of colors
...@@ -7474,11 +7496,13 @@ public class ImageDtt { ...@@ -7474,11 +7496,13 @@ public class ImageDtt {
System.out.println("clt_aberrations_quad_corr(): width="+width+" height="+height+" transform_size="+clt_parameters.transform_size+ System.out.println("clt_aberrations_quad_corr(): width="+width+" height="+height+" transform_size="+clt_parameters.transform_size+
" debug_tileX="+debug_tileX+" debug_tileY="+debug_tileY+" globalDebugLevel="+globalDebugLevel); " debug_tileX="+debug_tileX+" debug_tileY="+debug_tileY+" globalDebugLevel="+globalDebugLevel);
} }
/*
final int [][] zi = final int [][] zi =
{{ 0, 1, 2, 3}, {{ 0, 1, 2, 3},
{-1, 0, -3, 2}, {-1, 0, -3, 2},
{-2, -3, 0, 1}, {-2, -3, 0, 1},
{ 3, -2, -1, 0}}; { 3, -2, -1, 0}};
*/
final int [][] corr_pairs ={ // {first, second, rot} rot: 0 - as is, 1 - swap y,x final int [][] corr_pairs ={ // {first, second, rot} rot: 0 - as is, 1 - swap y,x
{0,1,0}, {0,1,0},
{2,3,0}, {2,3,0},
...@@ -7543,8 +7567,8 @@ public class ImageDtt { ...@@ -7543,8 +7567,8 @@ public class ImageDtt {
} }
} }
final double [] corr_max_weights_poly =(((clt_parameters.max_corr_sigma > 0) && (disparity_bimap != null))? // final double [] corr_max_weights_poly =(((clt_parameters.max_corr_sigma > 0) && (disparity_bimap != null))?
setMaxXYWeights(clt_parameters.max_corr_sigma,max_search_radius_poly): null); // here use square anyway // setMaxXYWeights(clt_parameters.max_corr_sigma,max_search_radius_poly): null); // here use square anyway
dtt.set_window(clt_parameters.clt_window); dtt.set_window(clt_parameters.clt_window);
final double [] lt_window = dtt.getWin2d(); // [256] final double [] lt_window = dtt.getWin2d(); // [256]
...@@ -7558,7 +7582,9 @@ public class ImageDtt { ...@@ -7558,7 +7582,9 @@ public class ImageDtt {
} }
final Matrix [] corr_rots_main = geometryCorrection_main.getCorrVector().getRotMatrices(); // get array of per-sensor rotation matrices final Matrix [] corr_rots_main = geometryCorrection_main.getCorrVector().getRotMatrices(); // get array of per-sensor rotation matrices
final Matrix [] corr_rots_aux = geometryCorrection_aux.getCorrVector().getRotMatrices(); // get array of per-sensor rotation matrices final Matrix rigMatrix = geometryCorrection_aux.getRotMatrix(true);
final Matrix [] corr_rots_aux = geometryCorrection_aux.getCorrVector().getRotMatrices(rigMatrix); // get array of per-sensor rotation matrices
for (int ithread = 0; ithread < threads.length; ithread++) { for (int ithread = 0; ithread < threads.length; ithread++) {
threads[ithread] = new Thread() { threads[ithread] = new Thread() {
@Override @Override
...@@ -7572,14 +7598,14 @@ public class ImageDtt { ...@@ -7572,14 +7598,14 @@ public class ImageDtt {
double [][] fract_shiftsXY_main = new double[quad_main][]; double [][] fract_shiftsXY_main = new double[quad_main][];
double [][] fract_shiftsXY_aux = new double[quad_aux][]; double [][] fract_shiftsXY_aux = new double[quad_aux][];
double [][] tcorr_combo = null; // [15*15] pixel space double [][] tcorr_combo = null; // [15*15] pixel space
double [][][] tcorr_partial = null; // [quad][numcol+1][15*15] // double [][][] tcorr_partial = null; // [quad][numcol+1][15*15]
double [][][][] tcorr_tpartial = null; // [quad][numcol+1][4][8*8] // double [][][][] tcorr_tpartial = null; // [quad][numcol+1][4][8*8]
double [][][][] clt_data_main = new double[quad_main][nChn][][]; double [][][][] clt_data_main = new double[quad_main][nChn][][];
double [][][][] clt_data_aux = new double[quad_aux][nChn][][]; double [][][][] clt_data_aux = new double[quad_aux][nChn][][];
PolynomialApproximation pa = null; // PolynomialApproximation pa = null;
if (corr_max_weights_poly !=null) pa = new PolynomialApproximation(0); // debug level // if (corr_max_weights_poly !=null) pa = new PolynomialApproximation(0); // debug level
Correlation2d corr2d = new Correlation2d( Correlation2d corr2d = new Correlation2d(
clt_parameters.img_dtt, // ImageDttParameters imgdtt_params, clt_parameters.img_dtt, // ImageDttParameters imgdtt_params,
clt_parameters.transform_size, // int transform_size, clt_parameters.transform_size, // int transform_size,
...@@ -7608,7 +7634,7 @@ public class ImageDtt { ...@@ -7608,7 +7634,7 @@ public class ImageDtt {
corr_mask_aux &= ~ (1 << i); corr_mask_aux &= ~ (1 << i);
} }
} }
boolean debugTile =(tileX == debug_tileX) && (tileY == debug_tileY); // boolean debugTile =(tileX == debug_tileX) && (tileY == debug_tileY);
final int [] overexp_main = (saturation_main != null) ? ( new int [2]): null; final int [] overexp_main = (saturation_main != null) ? ( new int [2]): null;
final int [] overexp_aux = (saturation_aux != null) ? ( new int [2]): null; final int [] overexp_aux = (saturation_aux != null) ? ( new int [2]): null;
...@@ -7619,21 +7645,25 @@ public class ImageDtt { ...@@ -7619,21 +7645,25 @@ public class ImageDtt {
// TODO: move port coordinates out of color channel loop // TODO: move port coordinates out of color channel loop
double [][] centersXY_main; double [][] centersXY_main;
double [][] centersXY_aux; double [][] centersXY_aux;
double disparity_main = disparity_array[tileY][tileX];
double disparity_aux = disparity_main * geometryCorrection_aux.getDisparityRadius()/geometryCorrection_main.getDisparityRadius();
centersXY_main = geometryCorrection_main.getPortsCoordinatesAndDerivatives( centersXY_main = geometryCorrection_main.getPortsCoordinatesAndDerivatives(
false, // boolean use_rig_offsets,
corr_rots_main, // Matrix [] rots, corr_rots_main, // 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][]
centerX, centerX,
centerY, centerY,
disparity_array[tileY][tileX]); // + disparity_corr); disparity_main); // + disparity_corr);
centersXY_aux = geometryCorrection_aux.getPortsCoordinatesAndDerivatives( centersXY_aux = geometryCorrection_aux.getPortsCoordinatesAndDerivatives(
true, // boolean use_rig_offsets,
corr_rots_aux, // Matrix [] rots, corr_rots_aux, // 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][]
centerX, centerX,
centerY, centerY,
disparity_array[tileY][tileX]); // + disparity_corr); disparity_aux); // + disparity_corr);
if ((globalDebugLevel > 0) && (tileX == debug_tileX) && (tileY == debug_tileY)) { if ((globalDebugLevel > 0) && (tileX == debug_tileX) && (tileY == debug_tileY)) {
for (int i = 0; i < quad_main; i++) { for (int i = 0; i < quad_main; i++) {
......
...@@ -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){
// keep rig offsets if edited
if (geometryCorrection == null) {
geometryCorrection = new GeometryCorrection(extrinsic_corr); 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