Commit 1f6a9eb9 authored by Andrey Filippov's avatar Andrey Filippov

bug fix in readjust

parent e1616ff9
...@@ -437,7 +437,8 @@ public class Interscene { ...@@ -437,7 +437,8 @@ public class Interscene {
// int search_rad = clt_parameters.imp.search_rad; // 10; // int search_rad = clt_parameters.imp.search_rad; // 10;
boolean scale_ims_velocities = true; boolean scale_ims_velocities = true;
Did_ins_2 d2_ref = quadCLTs[ref_index].did_ins_2; Did_ins_2 d2_ref = quadCLTs[ref_index].did_ins_2;
// apply correction to orientation // apply correction to orientation - better not to prevent extra loops.
// And it only applies to rotations
double [] cam_quat_ref_enu =Imx5.quaternionImsToCam(d2_ref.getQEnu() , double [] cam_quat_ref_enu =Imx5.quaternionImsToCam(d2_ref.getQEnu() ,
ims_mount_atr, ims_mount_atr,
ims_ortho); ims_ortho);
...@@ -450,7 +451,7 @@ public class Interscene { ...@@ -450,7 +451,7 @@ public class Interscene {
ers_reference.addScene(quadCLTs[ref_index].getImageName(), // add reference scene (itself) too ers_reference.addScene(quadCLTs[ref_index].getImageName(), // add reference scene (itself) too
scenes_xyzatr[ref_index][0], scenes_xyzatr[ref_index][0],
scenes_xyzatr[ref_index][1], scenes_xyzatr[ref_index][1],
cam_dxyzatr_ref[0], // ZERO3, // ers_scene.getErsXYZ_dt(), cam_dxyzatr_ref[0], // later may overwrite from overlap
cam_dxyzatr_ref[1]); // ZERO3);// ers_scene.getErsATR_dt() cam_dxyzatr_ref[1]); // ZERO3);// ers_scene.getErsATR_dt()
// Will be used in prepareLMA() // Will be used in prepareLMA()
quadCLTs[ref_index].getErsCorrection().setErsDt( // set for ref also (should be set before non-ref!) quadCLTs[ref_index].getErsCorrection().setErsDt( // set for ref also (should be set before non-ref!)
...@@ -488,7 +489,7 @@ public class Interscene { ...@@ -488,7 +489,7 @@ public class Interscene {
double [] scene_abs_atr_enu = Imx5.quatToCamAtr(cam_quat_enu); double [] scene_abs_atr_enu = Imx5.quatToCamAtr(cam_quat_enu);
double [][] ims_scene_xyzatr_enu = {cam_xyz_enu, scene_abs_atr_enu }; // try with xyz? double [][] ims_scene_xyzatr_enu = {cam_xyz_enu, scene_abs_atr_enu }; // try with xyz?
// set initial approximation from IMS, subtract reference XYZATR // set initial approximation from IMS, subtract reference XYZATR
// predicted bny IMU from the reference scene // predicted by IMU from the reference scene
double [][] pose_ims = ErsCorrection.combineXYZATR( double [][] pose_ims = ErsCorrection.combineXYZATR(
ims_scene_xyzatr_enu, ims_scene_xyzatr_enu,
ErsCorrection.invertXYZATR(ims_ref_xyzatr_enu)); ErsCorrection.invertXYZATR(ims_ref_xyzatr_enu));
...@@ -613,7 +614,7 @@ public class Interscene { ...@@ -613,7 +614,7 @@ public class Interscene {
last_corr_xyzatr = ErsCorrection.combineXYZATR ( last_corr_xyzatr = ErsCorrection.combineXYZATR (
last_corr_xyzatr, last_corr_xyzatr,
corr_diff); corr_diff);
// not used here with IMS: after_spiral == false
if (after_spiral && (scene_index < (ref_index-1))) { // need to interpolate skipped scenes if (after_spiral && (scene_index < (ref_index-1))) { // need to interpolate skipped scenes
// here we expect very small translations/angles, so linear scaling is OK // here we expect very small translations/angles, so linear scaling is OK
double s = 1.0 / (ref_index - scene_index); double s = 1.0 / (ref_index - scene_index);
...@@ -1303,11 +1304,11 @@ public class Interscene { ...@@ -1303,11 +1304,11 @@ public class Interscene {
scaled_dxyzatr_dt[0], // (ers_use_xyz? dxyzatr_dt[nscene][0]: ZERO3), //, // dxyzatr_dt[nscene][0], // double [] ers_xyz_dt, scaled_dxyzatr_dt[0], // (ers_use_xyz? dxyzatr_dt[nscene][0]: ZERO3), //, // dxyzatr_dt[nscene][0], // double [] ers_xyz_dt,
scaled_dxyzatr_dt[1]); // dxyzatr_dt[nscene][1]); // double [] ers_atr_dt)(ers_scene_original_xyz_dt); scaled_dxyzatr_dt[1]); // dxyzatr_dt[nscene][1]); // double [] ers_atr_dt)(ers_scene_original_xyz_dt);
*/
quadCLTs[nscene].getErsCorrection().setErsDt( // set for ref also (should be set before non-ref!) quadCLTs[nscene].getErsCorrection().setErsDt( // set for ref also (should be set before non-ref!)
QuadCLTCPU.scaleDtToErs( QuadCLTCPU.scaleDtToErs(
clt_parameters, clt_parameters,
dxyzatr_dt[nscene])); dxyzatr_dt[nscene]));
*/
if (dbg_mb_img != null) { if (dbg_mb_img != null) {
boolean show_corrected = false; boolean show_corrected = false;
if (nscene == debug_scene) { if (nscene == debug_scene) {
......
...@@ -5088,7 +5088,7 @@ public class OpticalFlow { ...@@ -5088,7 +5088,7 @@ public class OpticalFlow {
// double [][] combo_dsn_final = null; // double [][] combo_dsn_final = null;
// below ref_index is not necessary the last (fix all where it is supposed to be the last // below ref_index is not necessary the last (fix all where it is supposed to be the last
ErsCorrection ers_reference = quadCLTs[ref_index].getErsCorrection(); ErsCorrection ers_reference = quadCLTs[ref_index].getErsCorrection(); // only used in ml_export
while (!reuse_video && ((quadCLTs[ref_index].getNumOrient() < min_num_orient) || (quadCLTs[ref_index].getNumAccum() < min_num_interscene))) { while (!reuse_video && ((quadCLTs[ref_index].getNumOrient() < min_num_orient) || (quadCLTs[ref_index].getNumAccum() < min_num_interscene))) {
if ((quadCLTs[ref_index].getNumAccum() < min_num_interscene) && if ((quadCLTs[ref_index].getNumAccum() < min_num_interscene) &&
((quadCLTs[ref_index].getNumAccum() < quadCLTs[ref_index].getNumOrient())|| ((quadCLTs[ref_index].getNumAccum() < quadCLTs[ref_index].getNumOrient())||
...@@ -5224,12 +5224,18 @@ public class OpticalFlow { ...@@ -5224,12 +5224,18 @@ public class OpticalFlow {
mb_max_gain = clt_parameters.imp.mb_max_gain_inter; mb_max_gain = clt_parameters.imp.mb_max_gain_inter;
} }
boolean disable_ers = (quadCLTs[ref_index].getNumOrient() < 2); // first orient - no ERS! boolean disable_ers = (quadCLTs[ref_index].getNumOrient() < 2); // first orient - no ERS!
boolean ers_from_ims = false; // change later boolean ers_from_ims = true; // false; // change later
// int ers_mode = (quadCLTs[ref_index].getNumOrient() < 2) ? (ers_from_ims? 2 : 1):0; // int ers_mode = (quadCLTs[ref_index].getNumOrient() < 2) ? (ers_from_ims? 2 : 1):0;
int ers_mode = 0; // keep int ers_mode = 0; // keep
// with IMS it is already set during initial orientation. In non-IMS mode // with IMS it is already set during initial orientation. In non-IMS mode
if (!ers_from_ims && (quadCLTs[ref_index].getNumOrient() < 2)) { if (!ers_from_ims && (quadCLTs[ref_index].getNumOrient() < 2)) {
ers_mode = 1; // calculate velocity ers_mode = 1; // calculate velocity
if (debugLevel > -3) {
System.out.println("Setting ERS data from velocity");
}
}
if (debugLevel > -3) {
System.out.println("ers_mode="+ers_mode);
} }
earliest_scene = Interscene.reAdjustPairsLMAInterscene( // after combo dsi is available and preliminary poses are known earliest_scene = Interscene.reAdjustPairsLMAInterscene( // after combo dsi is available and preliminary poses are known
clt_parameters, // CLTParameters clt_parameters, clt_parameters, // CLTParameters clt_parameters,
......
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