Commit b5d06bab authored by Andrey Filippov's avatar Andrey Filippov

misalignment - converted to true rotations

parent 770a8d96
...@@ -612,11 +612,13 @@ public class AlignmentCorrection { ...@@ -612,11 +612,13 @@ public class AlignmentCorrection {
mdata = new double [8][samples_list.size()][3]; mdata = new double [8][samples_list.size()][3];
} }
int indx = 0; int indx = 0;
final Matrix [] corr_rots = qc.geometryCorrection.getCorrVector().getRotMatrices(); // get array of per-sensor rotation matrices
for (Sample s: samples_list){ for (Sample s: samples_list){
int tileX = s.tile % tilesX; int tileX = s.tile % tilesX;
int tileY = s.tile / tilesX; int tileY = s.tile / tilesX;
double centerX = tileX * qc.tp.getTileSize() + qc.tp.getTileSize()/2;// - shiftX; double centerX = tileX * qc.tp.getTileSize() + qc.tp.getTileSize()/2;// - shiftX;
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.getPortsCoordinates( double [][] centersXY_disp = qc.geometryCorrection.getPortsCoordinates(
centerX, centerX,
centerY, centerY,
...@@ -625,6 +627,22 @@ public class AlignmentCorrection { ...@@ -625,6 +627,22 @@ public class AlignmentCorrection {
centerX, centerX,
centerY, centerY,
0.0); // disparity 0.0); // disparity
*/
double [][] centersXY_disp = qc.geometryCorrection.getPortsCoordinatesAndDerivatives(
corr_rots, // Matrix [] rots,
null, // Matrix [][] deriv_rots,
null, // double [][] pXYderiv, // if not null, should be double[8][]
centerX,
centerY,
disp_strength[2 * s.series + 0][s.tile]/magic_coeff); // disparity
double [][] centersXY_inf = qc.geometryCorrection.getPortsCoordinatesAndDerivatives(
corr_rots, // Matrix [] rots,
null, // Matrix [][] deriv_rots,
null, // double [][] pXYderiv, // if not null, should be double[8][]
centerX,
centerY,
0.0); // disparity
for (int i = 0; i < centersXY_disp.length;i++){ for (int i = 0; i < centersXY_disp.length;i++){
centersXY_disp[i][0] -= centersXY_inf[i][0]; centersXY_disp[i][0] -= centersXY_inf[i][0];
centersXY_disp[i][1] -= centersXY_inf[i][1]; centersXY_disp[i][1] -= centersXY_inf[i][1];
...@@ -2077,7 +2095,7 @@ B = |+dy0 -dy1 -2*dy3 | ...@@ -2077,7 +2095,7 @@ B = |+dy0 -dy1 -2*dy3 |
qc.geometryCorrection, // GeometryCorrection geometryCorrection, qc.geometryCorrection, // GeometryCorrection geometryCorrection,
qc.geometryCorrection.getCorrVector(), // GeometryCorrection.CorrVector corr_vector, qc.geometryCorrection.getCorrVector(), // GeometryCorrection.CorrVector corr_vector,
old_new_rms, // double [] old_new_rms, // should be double[2] old_new_rms, // double [] old_new_rms, // should be double[2]
debugLevel); // 2); // 1); // int debugLevel) 2); // debugLevel); // 2); // 1); // int debugLevel)
if (debugLevel > -1){ if (debugLevel > -1){
System.out.println("Old extrinsic corrections:"); System.out.println("Old extrinsic corrections:");
System.out.println(qc.geometryCorrection.getCorrVector().toString()); System.out.println(qc.geometryCorrection.getCorrVector().toString());
...@@ -2218,20 +2236,31 @@ B = |+dy0 -dy1 -2*dy3 | ...@@ -2218,20 +2236,31 @@ B = |+dy0 -dy1 -2*dy3 |
jt_dbg = new double [num_pars][2 * NUM_SENSORS * mismatch_list.size()]; jt_dbg = new double [num_pars][2 * NUM_SENSORS * mismatch_list.size()];
} }
Matrix [] corr_rots = corr_vector.getRotMatrices(); // get array of per-sensor rotation matrices
Matrix [][] deriv_rots = corr_vector.getRotDeriveMatrices();
for (int indx = 0; indx<mismatch_list.size(); indx++){ // need indx value for (int indx = 0; indx<mismatch_list.size(); indx++){ // need indx value
Mismatch mm = mismatch_list.get(indx); Mismatch mm = mismatch_list.get(indx);
double [] pXY = mm.getPXY(); double [] pXY = mm.getPXY();
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);
// double [][] f = // double [][] f =
geometryCorrection.getPortsCoordinatesAndDerivatives( /*
geometryCorrection.getPortsCoordinatesAndDerivatives_old(
corr_vector, // CorrVector corr_vector, corr_vector, // CorrVector corr_vector,
deriv, // boolean calc_deriv, deriv, // boolean calc_deriv,
pXY[0], // double px, pXY[0], // double px,
pXY[1], // double py, pXY[1], // double py,
mm.getDisparityMeas()); // getDisparityTask()); // double disparity) mm.getDisparityMeas()); // getDisparityTask()); // double disparity)
// convert to symmetrical coordianets */
geometryCorrection.getPortsCoordinatesAndDerivatives(
corr_rots, // Matrix [] rots,
deriv_rots, // Matrix [][] deriv_rots,
deriv, // boolean calc_deriv,
pXY[0], // double px,
pXY[1], // double py,
mm.getDisparityMeas()); // getDisparityTask()); // double disparity)
// convert to symmetrical coordinates
double [][] jt_partial = corr_vector.getJtPartial( double [][] jt_partial = corr_vector.getJtPartial(
deriv, // double [][] port_coord_deriv, deriv, // double [][] port_coord_deriv,
...@@ -2381,17 +2410,27 @@ B = |+dy0 -dy1 -2*dy3 | ...@@ -2381,17 +2410,27 @@ B = |+dy0 -dy1 -2*dy3 |
{ {
double [][] dMismatch_dXY = (new Mismatch()).get_dMismatch_dXY(); // just a static array double [][] dMismatch_dXY = (new Mismatch()).get_dMismatch_dXY(); // just a static array
double [] mv = new double [2 * NUM_SENSORS * mismatch_list.size()]; double [] mv = new double [2 * NUM_SENSORS * mismatch_list.size()];
Matrix [] corr_rots = corr_vector.getRotMatrices(); // get array of per-sensor rotation matrices
for (int indx = 0; indx<mismatch_list.size(); indx++){ // need indx value for (int indx = 0; indx<mismatch_list.size(); indx++){ // need indx value
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_old( // 4x2
corr_vector, // CorrVector corr_vector, corr_vector, // CorrVector corr_vector,
null, // boolean calc_deriv, null, // boolean calc_deriv,
pXY[0], // double px, pXY[0], // double px,
pXY[1], // double py, pXY[1], // double py,
mm.getDisparityMeas()); // getDisparityTask()); // double disparity) mm.getDisparityMeas()); // getDisparityTask()); // double disparity)
// convert to symmetrical coordianets */
double [][] f = geometryCorrection.getPortsCoordinatesAndDerivatives( // 4x2
corr_rots, // Matrix [] rots,
null, // Matrix [][] deriv_rots,
null, // boolean calc_deriv,
pXY[0], // double px,
pXY[1], // double py,
mm.getDisparityMeas()); // getDisparityTask()); // double disparity)
// convert to symmetrical coordinates
// f is [4][2] array of port x,y coordinates - convert them to mv (linear array) // f is [4][2] array of port x,y coordinates - convert them to mv (linear array)
double [] mv_partial = new double [dMismatch_dXY.length]; double [] mv_partial = new double [dMismatch_dXY.length];
...@@ -2588,6 +2627,7 @@ B = |+dy0 -dy1 -2*dy3 | ...@@ -2588,6 +2627,7 @@ B = |+dy0 -dy1 -2*dy3 |
mismatch_list, // ArrayList<Mismatch> mismatch_list, mismatch_list, // ArrayList<Mismatch> mismatch_list,
geometryCorrection, // GeometryCorrection geometryCorrection, geometryCorrection, // GeometryCorrection geometryCorrection,
corr_vector, // GeometryCorrection.CorrVector corr_vector) corr_vector, // GeometryCorrection.CorrVector corr_vector)
// debugLevel); // int debugLevel)
debugLevel); // int debugLevel) debugLevel); // int debugLevel)
// convert Jacobian outputs to symmetrical measurement vectors (last one is non-zero only if disparity should be adjusted) // convert Jacobian outputs to symmetrical measurement vectors (last one is non-zero only if disparity should be adjusted)
......
...@@ -2327,7 +2327,7 @@ public class EyesisCorrections { ...@@ -2327,7 +2327,7 @@ public class EyesisCorrections {
saveAndShowEnable( imp, correctionsParameters , true, true); saveAndShowEnable( imp, correctionsParameters , true, true);
} }
private void saveAndShowEnable( public void saveAndShowEnable(
ImagePlus imp, ImagePlus imp,
EyesisCorrectionParameters.CorrectionParameters correctionsParameters, EyesisCorrectionParameters.CorrectionParameters correctionsParameters,
boolean enableSave, boolean enableSave,
......
...@@ -542,8 +542,8 @@ private Panel panel1, ...@@ -542,8 +542,8 @@ private Panel panel1,
if (DCT_MODE) { if (DCT_MODE) {
panelClt3 = new Panel(); panelClt3 = new Panel();
panelClt3.setLayout(new GridLayout(1, 0, 5, 5)); // rows, columns, vgap, hgap panelClt3.setLayout(new GridLayout(1, 0, 5, 5)); // rows, columns, vgap, hgap
addButton("Setup CLT Batch parameters", panelClt3, color_configure);
addButton("Setup CLT parameters", panelClt3, color_configure); addButton("Setup CLT parameters", panelClt3, color_configure);
addButton("Setup CLT Batch parameters", panelClt3, color_configure);
addButton("CLT batch process", panelClt3, color_process); addButton("CLT batch process", panelClt3, color_process);
add(panelClt3); add(panelClt3);
} }
...@@ -4604,7 +4604,7 @@ private Panel panel1, ...@@ -4604,7 +4604,7 @@ private Panel panel1,
System.out.println("Created new QuadCLT instance, will need to read CLT kernels"); System.out.println("Created new QuadCLT instance, will need to read CLT kernels");
} }
} }
QUAD_CLT.resetExtrinsicCorr(); QUAD_CLT.resetExtrinsicCorr(CLT_PARAMETERS);
return; return;
} else if (label.equals("CLT show fine corr")) { } else if (label.equals("CLT show fine corr")) {
if (QUAD_CLT == null){ if (QUAD_CLT == null){
......
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
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