Commit df90e23a authored by Andrey Filippov's avatar Andrey Filippov

Debugging LY/no-LY runs

parent 48b56791
...@@ -554,7 +554,7 @@ public class EstimateSceneRange { ...@@ -554,7 +554,7 @@ public class EstimateSceneRange {
final double [] sfm_gain2 = new double [tilesX*tilesY]; // sfm gain squared final double [] sfm_gain2 = new double [tilesX*tilesY]; // sfm gain squared
final double [] sfm_confidence = new double [tilesX*tilesY]; // sfm gain squared final double [] sfm_confidence = new double [tilesX*tilesY]; // sfm gain squared
final double [] accum_weights = new double [tilesX*tilesY]; // sfm gain squared final double [] accum_weights = new double [tilesX*tilesY]; // sfm gain squared
int num_sfm = 0; // do not use if no sfm was performed (for LY with too few scenes and high altitude)
for (int scan_dir = 1; scan_dir >= -1; scan_dir -=2) { for (int scan_dir = 1; scan_dir >= -1; scan_dir -=2) {
...@@ -605,6 +605,10 @@ public class EstimateSceneRange { ...@@ -605,6 +605,10 @@ public class EstimateSceneRange {
scenes_xyzatr[scene_index],// double [][] xyzatr1, scenes_xyzatr[scene_index],// double [][] xyzatr1,
avg_z, // double average_z, avg_z, // double average_z,
fmg_rectilinear); // boolean fmg_rectilinear) fmg_rectilinear); // boolean fmg_rectilinear)
if (center_offset_xy == null) {
System.out.println("center_offset_xy== null");
}
boolean [] reliable_scene = quadCLTs[cent_index].maskByOverlap( boolean [] reliable_scene = quadCLTs[cent_index].maskByOverlap(
reliable_ref, // boolean [] reliable_ref_tiles, reliable_ref, // boolean [] reliable_ref_tiles,
center_offset_xy); // double [] offset) center_offset_xy); // double [] offset)
...@@ -780,8 +784,8 @@ public class EstimateSceneRange { ...@@ -780,8 +784,8 @@ public class EstimateSceneRange {
System.out.println("Filtered disparity SFM, result "+sfm_filter_OK); System.out.println("Filtered disparity SFM, result "+sfm_filter_OK);
} }
} }
tp_tasks_ref[0] = null; // force re-calculate from disparity inside next Interscene.adjustDiffPairsLMAInterscene( ) tp_tasks_ref[0] = null; // force re-calculate from disparity inside next Interscene.adjustDiffPairsLMAInterscene( )
num_sfm++; // number of performed SFMs
} }
} //for (int scene_index = cent_index + scan_dir;... } //for (int scene_index = cent_index + scan_dir;...
} // for (int scan_dir = 1; scan_dir >= -1; scan_dir -=2) { } // for (int scan_dir = 1; scan_dir >= -1; scan_dir -=2) {
...@@ -911,7 +915,11 @@ public class EstimateSceneRange { ...@@ -911,7 +915,11 @@ public class EstimateSceneRange {
"-prescan-initial"); // String suffix) "-prescan-initial"); // String suffix)
} }
// perform final filtering // perform final filtering
if (filt_en) { if (debugLevel > -3) {
System.out.println("Number of scenes with SfM = "+num_sfm);
}
if (num_sfm > 0) {
if (filt_en) { // check weights - min non-zero number
boolean sfm_filter_OK = FilterDisparitySFM( boolean sfm_filter_OK = FilterDisparitySFM(
clt_parameters, // final CLTParameters clt_parameters, clt_parameters, // final CLTParameters clt_parameters,
true, // final boolean final_filter, // true after all pose adjustments are finished, fals at intermediate steps true, // final boolean final_filter, // true after all pose adjustments are finished, fals at intermediate steps
...@@ -933,6 +941,8 @@ public class EstimateSceneRange { ...@@ -933,6 +941,8 @@ public class EstimateSceneRange {
// TODO: Maintain (similar to sfm_gain2) and set strength?? // TODO: Maintain (similar to sfm_gain2) and set strength??
// Do not yet set combo dsi - copy after disparity correction from IMS // Do not yet set combo dsi - copy after disparity correction from IMS
quadCLTs[cent_index].setSFMGain2(sfm_gain2); quadCLTs[cent_index].setSFMGain2(sfm_gain2);
} // if (num_sfm > 0) {
// Now always, then - conditional // Now always, then - conditional
boolean adjust_disparity_ims = clt_parameters.imp.air_mode_en; boolean adjust_disparity_ims = clt_parameters.imp.air_mode_en;
boolean apply_disparity_ims = clt_parameters.imp.air_disp_corr; boolean apply_disparity_ims = clt_parameters.imp.air_disp_corr;
...@@ -986,14 +996,18 @@ public class EstimateSceneRange { ...@@ -986,14 +996,18 @@ public class EstimateSceneRange {
} }
double [][] combo_dsn = quadCLTs[cent_index].comboFromMainFgBg(); // set FG/BG layers to avoid null pointers double [][] combo_dsn = quadCLTs[cent_index].comboFromMainFgBg(); // set FG/BG layers to avoid null pointers
QuadCLTCPU.cloneInner(combo_dsn); // separate data array from its source QuadCLTCPU.cloneInner(combo_dsn); // separate data array from its source
if (num_sfm > 0) {
quadCLTs[cent_index].saveDoubleArrayInModelDirectory( quadCLTs[cent_index].saveDoubleArrayInModelDirectory(
QuadCLTCPU.DSI_SUFFIXES[0], // String suffix, always with LMA QuadCLTCPU.DSI_SUFFIXES[0], // String suffix, always with LMA
OpticalFlow.COMBO_DSN_TITLES, // combo_dsn_titles_full, // null, // String [] labels, // or null OpticalFlow.COMBO_DSN_TITLES, // combo_dsn_titles_full, // null, // String [] labels, // or null
combo_dsn, // dbg_data, // double [][] data, combo_dsn, // dbg_data, // double [][] data,
tilesX, // int width, tilesX, // int width,
tilesY); // int height) tilesY); // int height)
} else {
if (debugLevel > -3) {
System.out.println("WARNING: Will not save INTER-INTRA as no SfM measurements were performed (can be high altitude during LY");
}
}
quadCLTs[cent_index].saveInterProperties( // save properties for interscene processing (extrinsics, ers, ...) // null pointer quadCLTs[cent_index].saveInterProperties( // save properties for interscene processing (extrinsics, ers, ...) // null pointer
null, // String path, // full name with extension or w/o path to use x3d directory null, // String path, // full name with extension or w/o path to use x3d directory
debugLevel+1); debugLevel+1);
......
...@@ -225,7 +225,7 @@ public class GroundPlane { ...@@ -225,7 +225,7 @@ public class GroundPlane {
final int debugLevel) { final int debugLevel) {
final boolean [] good_tiles = new boolean[ref_scene.getTilesX()*ref_scene.getTilesY()]; final boolean [] good_tiles = new boolean[ref_scene.getTilesX()*ref_scene.getTilesY()];
String dbg_title =ref_scene.getImageName()+"-ground tilts"; String dbg_title =ref_scene.getImageName()+"-ground_tilts";
double [][] to_ground_xyzatr_frac= getPlaneDualPassMetric( // returns to_ground_xyzatr (rotated around the ground point nadir of teh drone) double [][] to_ground_xyzatr_frac= getPlaneDualPassMetric( // returns to_ground_xyzatr (rotated around the ground point nadir of teh drone)
clt_parameters, // final CLTParameters clt_parameters, clt_parameters, // final CLTParameters clt_parameters,
ref_scene, // final QuadCLT ref_Clt, ref_scene, // final QuadCLT ref_Clt,
......
...@@ -5267,6 +5267,9 @@ public class OpticalFlow { ...@@ -5267,6 +5267,9 @@ public class OpticalFlow {
// set reference to scene properties and quadCLT_main // set reference to scene properties and quadCLT_main
CorrVector corr_vector = quadCLTs[last_index].getGeometryCorrection().getCorrVector(); // set in restoreFieldCalibration(true,...) CorrVector corr_vector = quadCLTs[last_index].getGeometryCorrection().getCorrVector(); // set in restoreFieldCalibration(true,...)
quadCLT_main.getGeometryCorrection().setCorrVector(corr_vector); // updated system corr vector with the current updated one quadCLT_main.getGeometryCorrection().setCorrVector(corr_vector); // updated system corr vector with the current updated one
} else { } else {
if (debugLevel > -3) { if (debugLevel > -3) {
System.out.println("No LY data is available, using global data for quadCLT_main ("+ System.out.println("No LY data is available, using global data for quadCLT_main ("+
...@@ -5454,9 +5457,18 @@ public class OpticalFlow { ...@@ -5454,9 +5457,18 @@ public class OpticalFlow {
if (operation_mode == RESULTS_BUILD_SEQ_LY) { if (operation_mode == RESULTS_BUILD_SEQ_LY) {
if (debugLevel >-3) { if (debugLevel >-3) {
System.out.println("===== LY field calibration is requested. ====="); System.out.println("===== LY field calibration is requested. force_ly="+force_ly+", extr_corr "+ ((extr_corr ==null)?" ==":"!=")+"null, continue_ly="+continue_ly+" =====");
} }
if (!force_ly && (extr_corr != null) && !continue_ly ) { // this is valid even if it is not force_initial_orientations // if (!force_ly && (extr_corr != null) && !continue_ly ) { // this is valid even if it is not force_initial_orientations
// Maybe if (continue_ly) still return with null, and the caller will restart. It will do initial disparity fro the reference scene twice, but the logic will be simpler
if (!force_ly && (extr_corr != null) ) { // this is valid even if it is not force_initial_orientations
if (!continue_ly) {
exec_ly_correction = false;
operation_mode = RESULTS_BUILD_SEQ_DEFAULT; // so adjustment range would not be shortened for LY
if (debugLevel >-3) {
System.out.println("===== LY calibration data already available, continue_ly is TRUE, and force_ly is FALSE, contiunue in normal mode =====");
}
} else {
if (debugLevel >-3) { if (debugLevel >-3) {
System.out.println("===== But LY calibration data already available, continue_ly is FALSE, and force_ly is FALSE, terminating processing ====="); System.out.println("===== But LY calibration data already available, continue_ly is FALSE, and force_ly is FALSE, terminating processing =====");
} }
...@@ -5466,6 +5478,7 @@ public class OpticalFlow { ...@@ -5466,6 +5478,7 @@ public class OpticalFlow {
return null; return null;
} }
} }
}
if (debugLevel >-3) { if (debugLevel >-3) {
System.out.println("===== Considering building initial orientations, force_initial_orientations="+force_initial_orientations+". ====="); System.out.println("===== Considering building initial orientations, force_initial_orientations="+force_initial_orientations+". =====");
} }
...@@ -6245,7 +6258,6 @@ public class OpticalFlow { ...@@ -6245,7 +6258,6 @@ public class OpticalFlow {
// Calculate and fill per-scene target disparities as scene.dsrbg // Calculate and fill per-scene target disparities as scene.dsrbg
double [] ref_target_disparity=master_CLT.getDLS()[0]; // 0]; double [] ref_target_disparity=master_CLT.getDLS()[0]; // 0];
// filter scenes, keeping only processed // filter scenes, keeping only processed
// now (11/24/2025) intepolateSceneDisparity() returns nulls for the scenes that do not have orientation // now (11/24/2025) intepolateSceneDisparity() returns nulls for the scenes that do not have orientation
double [][] interpolated_disparities = intepolateSceneDisparity( double [][] interpolated_disparities = intepolateSceneDisparity(
clt_parameters, // final CLTParameters clt_parameters, clt_parameters, // final CLTParameters clt_parameters,
...@@ -7311,8 +7323,11 @@ public class OpticalFlow { ...@@ -7311,8 +7323,11 @@ public class OpticalFlow {
/// "-INTER-INTRA-LMA", // String suffix, /// "-INTER-INTRA-LMA", // String suffix,
/// 0, // int num_slices, // (0 - all) /// 0, // int num_slices, // (0 - all)
/// null); // int [] wh); /// null); // int [] wh);
combo_dsn_final =master_CLT.restoreComboDSI(true); // also sets quadCLTs[ref_index].dsi and blue sky combo_dsn_final =master_CLT.restoreComboDSI(false); // Let it show that file is not available
if (combo_dsn_final == null) {
System.out.println("combo_dsn is not available (-INTER-INTRA-LMA.tiff) - bailing out");
return null;
}
} }
// re-load , should create quadCLTs[ref_index].dsi // re-load , should create quadCLTs[ref_index].dsi
......
...@@ -2144,6 +2144,11 @@ public class QuadCLTCPU { ...@@ -2144,6 +2144,11 @@ public class QuadCLTCPU {
xyzatr1_a[0], // double [] camera_xyz, // camera center in world coordinates xyzatr1_a[0], // double [] camera_xyz, // camera center in world coordinates
xyzatr1_a[1], // double [] camera_atr, // camera orientation relative to world frame xyzatr1_a[1], // double [] camera_atr, // camera orientation relative to world frame
OpticalFlow.LINE_ERR); // double line_err); // threshold error in scan lines (1.0) OpticalFlow.LINE_ERR); // double line_err); // threshold error in scan lines (1.0)
if (pXpYD == null) {
System.out.println("estimateCenterShiftXY(): pXpYD== null");
System.out.println("estimateCenterShiftXY(): pXpYD== null");
}
if (pXpYD == null) { if (pXpYD == null) {
return null; return null;
} else { } else {
......
...@@ -8618,7 +8618,8 @@ if (debugLevel > -100) return true; // temporarily ! ...@@ -8618,7 +8618,8 @@ if (debugLevel > -100) return true; // temporarily !
debugLevel+2); // final int debugLevel) debugLevel+2); // final int debugLevel)
LogTee.clearSceneLog(); // stop per‑scene logging LogTee.clearSceneLog(); // stop per‑scene logging
if (debugLevel > -4){ if (debugLevel > -4){
System.out.println("3. cuas_centers="+((cuas_centers != null)?("[\""+cuas_centers[0]+"\",\""+cuas_centers[1]+"\"]"):"null")); System.out.println("3. cuas_centers="+((cuas_centers != null)?("[\""+cuas_centers[0]+"\",\""+cuas_centers[1]+"\"]"):"null")+
", model_directory"+((model_directory == null)?"==":"!=")+"null");
} }
if (operation_mode == OpticalFlow.RESULTS_BUILD_SEQ_DEFAULT) { if (operation_mode == OpticalFlow.RESULTS_BUILD_SEQ_DEFAULT) {
break; break;
...@@ -8664,7 +8665,8 @@ if (debugLevel > -100) return true; // temporarily ! ...@@ -8664,7 +8665,8 @@ if (debugLevel > -100) return true; // temporarily !
System.out.println("Continue from index "+ref_index); System.out.println("Continue from index "+ref_index);
continue; // and go to the to next scene sequence from the list continue; // and go to the to next scene sequence from the list
} }
initial_operation_mode = OpticalFlow.RESULTS_BUILD_SEQ_DEFAULT; // to prevent trying to get field_calibration for all but the first (latest in time) segment in a sequence
operation_mode = OpticalFlow.RESULTS_BUILD_SEQ_DEFAULT;
if ((start_ref_pointers[0]==0) && (start_ref_pointers[1]==0)) { // bail out for debug if ((start_ref_pointers[0]==0) && (start_ref_pointers[1]==0)) { // bail out for debug
System.out.println("\n ----- PROCESSING SCENE SEQUENCE "+nseq+" (last is "+(num_seq-1)+") ABORTED in "+ System.out.println("\n ----- PROCESSING SCENE SEQUENCE "+nseq+" (last is "+(num_seq-1)+") ABORTED in "+
...@@ -8688,6 +8690,20 @@ if (debugLevel > -100) return true; // temporarily ! ...@@ -8688,6 +8690,20 @@ if (debugLevel > -100) return true; // temporarily !
ref_index)); // start_ref_pointers[1])); // int reference_scene); ref_index)); // start_ref_pointers[1])); // int reference_scene);
// testing half-step // testing half-step
if (start_ref_pointers[0] >= (min_num_scenes-1)) {
System.out.println("testing half-step: start_ref_pointers[0]="+start_ref_pointers[0]+
", start_ref_pointers[1]="+start_ref_pointers[1]+", ref_index="+ref_index);
int offset1 = (int) (overlap_scale * (start_ref_pointers[1] - start_ref_pointers[0]));
int offset2 = (start_ref_pointers[1] - start_ref_pointers[0]) - offset1;
System.out.println("testing half-step: offset1="+offset1+
", offset2="+offset2+" overlap_scale="+overlap_scale);
start_ref_pointers[0] = start_ref_pointers[1] - offset1;
// incorrect, fix "-1" to actual last scene
start_ref_pointers[1] += offset2;
System.out.println("testing half-step: start_ref_pointers[0]="+start_ref_pointers[0]+
", start_ref_pointers[1]="+start_ref_pointers[1]+", ref_index="+ref_index);
}
/*
if (start_ref_pointers[0] >= (min_num_scenes-1)) { if (start_ref_pointers[0] >= (min_num_scenes-1)) {
System.out.println("testing half-step: start_ref_pointers[0]="+start_ref_pointers[0]+ System.out.println("testing half-step: start_ref_pointers[0]="+start_ref_pointers[0]+
", start_ref_pointers[1]="+start_ref_pointers[1]+", ref_index="+ref_index); ", start_ref_pointers[1]="+start_ref_pointers[1]+", ref_index="+ref_index);
...@@ -8697,6 +8713,9 @@ if (debugLevel > -100) return true; // temporarily ! ...@@ -8697,6 +8713,9 @@ if (debugLevel > -100) return true; // temporarily !
System.out.println("testing half-step: start_ref_pointers[0]="+start_ref_pointers[0]+ System.out.println("testing half-step: start_ref_pointers[0]="+start_ref_pointers[0]+
", start_ref_pointers[1]="+start_ref_pointers[1]+", ref_index="+ref_index); ", start_ref_pointers[1]="+start_ref_pointers[1]+", ref_index="+ref_index);
} }
*/
String series_action = (start_ref_pointers[0] < (min_num_scenes-1))?"is FINISHED ":("will continue down from scene "+(start_ref_pointers[0])); String series_action = (start_ref_pointers[0] < (min_num_scenes-1))?"is FINISHED ":("will continue down from scene "+(start_ref_pointers[0]));
...@@ -8752,6 +8771,9 @@ if (debugLevel > -100) return true; // temporarily ! ...@@ -8752,6 +8771,9 @@ if (debugLevel > -100) return true; // temporarily !
System.out.println("Exiting after processing the first series."); System.out.println("Exiting after processing the first series.");
return; return;
} }
} // while ((ref_index < 0) || ((ref_index + 1) >= min_num_scenes)) { } // while ((ref_index < 0) || ((ref_index + 1) >= min_num_scenes)) {
if ((initial_operation_mode == OpticalFlow.RESULTS_BUILD_SEQ_LY) && !continue_ly) { if ((initial_operation_mode == OpticalFlow.RESULTS_BUILD_SEQ_LY) && !continue_ly) {
......
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