Commit efe4ede4 authored by Andrey Filippov's avatar Andrey Filippov

LY adjustment for each sequence

parent eeacc90a
...@@ -44,6 +44,15 @@ public class EstimateSceneRange { ...@@ -44,6 +44,15 @@ public class EstimateSceneRange {
return center; return center;
} }
public void limitRange(int range) {
int late_lim = center + range/2; // will be symmetrical for odd values
latest = Math.min(latest, late_lim);
int early_lim = latest - range+1;
earliest = Math.max(earliest, early_lim);
earliest_prescan = Math.max(earliest_prescan, earliest);
latest_prescan = Math.min(latest_prescan, latest);
needs_prescan = (earliest_prescan > earliest) || (latest_prescan < latest);
}
public static EstimateSceneRange getPrescanRange( public static EstimateSceneRange getPrescanRange(
final CLTParameters clt_parameters, final CLTParameters clt_parameters,
...@@ -57,7 +66,8 @@ public class EstimateSceneRange { ...@@ -57,7 +66,8 @@ public class EstimateSceneRange {
System.out.println("getPrescanRange(): Will re-evaluate ranges, so new center may be different than"+ System.out.println("getPrescanRange(): Will re-evaluate ranges, so new center may be different than"+
" early_scene of the current ref_index"); " early_scene of the current ref_index");
} }
// Will only limit scan around the center, the center location is the same regardless. It is to keep the same
// center reference scene (it can still change caused by LY adjustment?)
boolean lock_position = clt_parameters.imp.lock_position; boolean lock_position = clt_parameters.imp.lock_position;
int tilesX = quadCLTs[ref_index].getTileProcessor().getTilesX(); int tilesX = quadCLTs[ref_index].getTileProcessor().getTilesX();
int tile_size = quadCLTs[ref_index].getTileProcessor().getTileSize(); int tile_size = quadCLTs[ref_index].getTileProcessor().getTileSize();
......
...@@ -150,6 +150,7 @@ public class Interscene { ...@@ -150,6 +150,7 @@ public class Interscene {
*/ */
public static int setInitialOrientationsCenterIms( public static int setInitialOrientationsCenterIms(
final CLTParameters clt_parameters, final CLTParameters clt_parameters,
final int operation_mode, // 0 - normal, 1 - prepare for LY field calibration (reduced scenes)
final boolean compensate_ims_rotation, // probably deprecated final boolean compensate_ims_rotation, // probably deprecated
final boolean inertial_only, final boolean inertial_only,
int min_num_scenes, int min_num_scenes,
...@@ -245,6 +246,7 @@ public class Interscene { ...@@ -245,6 +246,7 @@ public class Interscene {
// find earliest, center and last scenes from the average altitude, IMS and max_meters. if it is a limiting factor, // find earliest, center and last scenes from the average altitude, IMS and max_meters. if it is a limiting factor,
// perform short scan around the center and use SFP to improve disparity before trying to adjust orientations for // perform short scan around the center and use SFP to improve disparity before trying to adjust orientations for
// the full scene range // the full scene range
// TODO: apply the same range limit to other modes
EstimateSceneRange prescan_range_center= EstimateSceneRange.getPrescanRange( EstimateSceneRange prescan_range_center= EstimateSceneRange.getPrescanRange(
clt_parameters, // final CLTParameters clt_parameters, clt_parameters, // final CLTParameters clt_parameters,
quadCLTs, // final QuadCLT[] quadCLTs, quadCLTs, // final QuadCLT[] quadCLTs,
...@@ -253,6 +255,13 @@ public class Interscene { ...@@ -253,6 +255,13 @@ public class Interscene {
set_channels, // final SetChannels [] set_channels, set_channels, // final SetChannels [] set_channels,
batch_mode, // final boolean batch_mode, batch_mode, // final boolean batch_mode,
debugLevel); // final int debugLevel) { debugLevel); // final int debugLevel) {
// Will only limit scan around the center, the center location is the same regardless. It is to keep the same
// center reference scene (it can still change caused by LY adjustment?)
if (operation_mode == OpticalFlow.RESULTS_BUILD_SEQ_LY) {
prescan_range_center.limitRange(clt_parameters.imp.run_ly_scenes);
}
boolean prescan_ok = EstimateSceneRange.scanSfmIMS( boolean prescan_ok = EstimateSceneRange.scanSfmIMS(
clt_parameters, // final CLTParameters clt_parameters, clt_parameters, // final CLTParameters clt_parameters,
prescan_range_center, // EstimateSceneRange estimateSceneRange, prescan_range_center, // EstimateSceneRange estimateSceneRange,
...@@ -316,21 +325,26 @@ public class Interscene { ...@@ -316,21 +325,26 @@ public class Interscene {
// set pointers Check here - why reference is not set? // set pointers Check here - why reference is not set?
String cent_ts = quadCLTs[cent_index].getImageName(); String cent_ts = quadCLTs[cent_index].getImageName();
quadCLTs[latest_scene2].setRefPointer(cent_ts); // write pointer to center scene to reference scene quadCLTs[ref_index].setRefPointer(cent_ts); // write pointer to center scene to reference scene
quadCLTs[latest_scene2].saveInterProperties( // save properties for interscene processing (extrinsics, ers, ...) // null pointer quadCLTs[ref_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);
if (latest_scene2 != ref_index) { if (latest_scene2 != ref_index) {
if(operation_mode == OpticalFlow.RESULTS_BUILD_SEQ_LY) {
System.out.println("Using reference scene "+quadCLTs[ref_index].getImageName()+" ("+ref_index+
") even as it does not match latest_scene2="+latest_scene2+
" in LY mode that has shortened sequence for faster adjustment.");
} else {
System.out.println("*** setInitialOrientationsCenterIms(): assumed that latest_scene2("+latest_scene2+ System.out.println("*** setInitialOrientationsCenterIms(): assumed that latest_scene2("+latest_scene2+
") == ref_index ("+ref_index+"), but they are different. Decide what to do - see EstimateSceneRange.getPrescanRange(). ***"); ") == ref_index ("+ref_index+"), but they are different. Decide what to do - see EstimateSceneRange.getPrescanRange(). ***");
System.out.println("The problem is that the center index will have pointers to the first and last, but the last will not have a pointrer back."); System.out.println("The problem is that the center index will have pointers to the first and last, but the last will not have a pointrer back. Resolution - using a separate index scene (latest).");
quadCLTs[latest_scene2].setRefPointer(cent_ts); // write pointer to center scene to reference scene
quadCLTs[ref_index].setRefPointer(cent_ts); // write pointer to center scene to reference scene quadCLTs[latest_scene2].saveInterProperties( // save properties for interscene processing (extrinsics, ers, ...) // null pointer
quadCLTs[ref_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);
} }
}
// Here we a // Here we a
quadCLTs[cent_index].setFirstLastPointers(quadCLTs[earliest_scene2],quadCLTs[latest_scene2]);// set first/last to center scene quadCLTs[cent_index].setFirstLastPointers(quadCLTs[earliest_scene2],quadCLTs[latest_scene2]);// set first/last to center scene
quadCLTs[cent_index].set_orient(1); // first orientation quadCLTs[cent_index].set_orient(1); // first orientation
...@@ -350,6 +364,7 @@ public class Interscene { ...@@ -350,6 +364,7 @@ public class Interscene {
// TODO: add ref scene itself to the list? // TODO: add ref scene itself to the list?
cent_index = setInitialOrientationsIms( // process latest "half" cent_index = setInitialOrientationsIms( // process latest "half"
clt_parameters, // final CLTParameters clt_parameters, clt_parameters, // final CLTParameters clt_parameters,
operation_mode, // final int operation_mode, // 0 - normal, 1 - prepare for LY field calibration (reduced scenes)
compensate_ims_rotation, // final boolean compensate_ims_rotation, compensate_ims_rotation, // final boolean compensate_ims_rotation,
inertial_only, // final boolean inertial_only, inertial_only, // final boolean inertial_only,
min_num_scenes_half, // int min_num_scenes, min_num_scenes_half, // int min_num_scenes,
...@@ -402,7 +417,7 @@ public class Interscene { ...@@ -402,7 +417,7 @@ public class Interscene {
boolean generate_egomotion = clt_parameters.imp.generate_egomotion; // generate egomotion table (image-based and ims) boolean generate_egomotion = clt_parameters.imp.generate_egomotion; // generate egomotion table (image-based and ims)
if (generate_egomotion) { if (generate_egomotion) {
String ego_path = quadCLTs[ref_index].getX3dDirectory()+Prefs.getFileSeparator()+ String ego_path = quadCLTs[ref_index].getX3dDirectory(true)+Prefs.getFileSeparator()+
quadCLTs[ref_index].getImageName()+ quadCLTs[ref_index].getImageName()+
"-ego-first_half.csv"; "-ego-first_half.csv";
String ego_comment = null; String ego_comment = null;
...@@ -456,6 +471,7 @@ public class Interscene { ...@@ -456,6 +471,7 @@ public class Interscene {
quadCLTs[cent_index].setQuatCorr(quadCLTs[ref_index].getQuatCorr()); quadCLTs[cent_index].setQuatCorr(quadCLTs[ref_index].getQuatCorr());
int earliest_scene2 = setInitialOrientationsIms( // process earliest "half". Should copy quat_corr from the latest_half build int earliest_scene2 = setInitialOrientationsIms( // process earliest "half". Should copy quat_corr from the latest_half build
clt_parameters, // final CLTParameters clt_parameters, clt_parameters, // final CLTParameters clt_parameters,
operation_mode, // final int operation_mode, // 0 - normal, 1 - prepare for LY field calibration (reduced scenes)
compensate_ims_rotation, // final boolean compensate_ims_rotation, compensate_ims_rotation, // final boolean compensate_ims_rotation,
inertial_only, // final boolean inertial_only, inertial_only, // final boolean inertial_only,
min_num_scenes_half, // int min_num_scenes, min_num_scenes_half, // int min_num_scenes,
...@@ -506,7 +522,7 @@ public class Interscene { ...@@ -506,7 +522,7 @@ public class Interscene {
if (generate_egomotion) { if (generate_egomotion) {
String ego_path = quadCLTs[cent_index].getX3dDirectory()+Prefs.getFileSeparator()+ String ego_path = quadCLTs[cent_index].getX3dDirectory(true)+Prefs.getFileSeparator()+
quadCLTs[ref_index].getImageName()+ quadCLTs[ref_index].getImageName()+
"-ego-preinvert-"+quadCLTs[cent_index].getNumOrient()+".csv"; "-ego-preinvert-"+quadCLTs[cent_index].getNumOrient()+".csv";
String ego_comment = null; String ego_comment = null;
...@@ -548,7 +564,7 @@ public class Interscene { ...@@ -548,7 +564,7 @@ public class Interscene {
// here - calculate quat_corr and update it in ref_index. It will be used to pull to IMU when refining. // here - calculate quat_corr and update it in ref_index. It will be used to pull to IMU when refining.
if (generate_egomotion) { if (generate_egomotion) {
String ego_path = quadCLTs[cent_index].getX3dDirectory()+Prefs.getFileSeparator()+ String ego_path = quadCLTs[cent_index].getX3dDirectory(true)+Prefs.getFileSeparator()+
quadCLTs[ref_index].getImageName()+ quadCLTs[ref_index].getImageName()+
"-ego-afterinvert-"+quadCLTs[cent_index].getNumOrient()+".csv"; "-ego-afterinvert-"+quadCLTs[cent_index].getNumOrient()+".csv";
String ego_comment = null; String ego_comment = null;
...@@ -1088,6 +1104,7 @@ public class Interscene { ...@@ -1088,6 +1104,7 @@ public class Interscene {
public static int setInitialOrientationsIms( public static int setInitialOrientationsIms(
final CLTParameters clt_parameters, final CLTParameters clt_parameters,
final int operation_mode, // 0 - normal, 1 - prepare for LY field calibration (reduced scenes)
final boolean compensate_ims_rotation, final boolean compensate_ims_rotation,
final boolean inertial_only, final boolean inertial_only,
int min_num_scenes, int min_num_scenes,
...@@ -1800,6 +1817,7 @@ public class Interscene { ...@@ -1800,6 +1817,7 @@ public class Interscene {
public static int setInitialOrientationsCuas( public static int setInitialOrientationsCuas(
final CLTParameters clt_parameters, final CLTParameters clt_parameters,
final int operation_mode, // 0 - normal, 1 - prepare for LY field calibration (reduced scenes)
final double [][] center_xyzatr, // center_xyzatr[0]=ZERO3 - for this sequence final double [][] center_xyzatr, // center_xyzatr[0]=ZERO3 - for this sequence
final QuadCLT center_CLT, // contains center CLT and DSI final QuadCLT center_CLT, // contains center CLT and DSI
final boolean compensate_ims_rotation, final boolean compensate_ims_rotation,
...@@ -2225,7 +2243,7 @@ public class Interscene { ...@@ -2225,7 +2243,7 @@ public class Interscene {
} }
if (generate_egomotion) { if (generate_egomotion) {
String ego_path = center_CLT.getX3dDirectory()+Prefs.getFileSeparator()+ String ego_path = center_CLT.getX3dDirectory(true)+Prefs.getFileSeparator()+
center_CLT.getImageName()+ center_CLT.getImageName()+
"-ego-initial-cuas-"+center_CLT.getNumOrient()+".csv"; "-ego-initial-cuas-"+center_CLT.getNumOrient()+".csv";
String ego_comment = null; String ego_comment = null;
...@@ -2411,6 +2429,7 @@ public class Interscene { ...@@ -2411,6 +2429,7 @@ public class Interscene {
public static int setInitialOrientations( public static int setInitialOrientations(
final CLTParameters clt_parameters, final CLTParameters clt_parameters,
final int operation_mode, // 0 - normal, 1 - prepare for LY field calibration (reduced scenes)
int min_num_scenes, int min_num_scenes,
final ColorProcParameters colorProcParameters, final ColorProcParameters colorProcParameters,
final QuadCLT[] quadCLTs, // final QuadCLT[] quadCLTs, //
......
...@@ -318,6 +318,9 @@ public class IntersceneMatchParameters { ...@@ -318,6 +318,9 @@ public class IntersceneMatchParameters {
public boolean force_ref_dsi = false; // true; public boolean force_ref_dsi = false; // true;
public boolean force_orientations = false; public boolean force_orientations = false;
public boolean run_ly = false; // will return just after LY adjustments, skipping all output generation public boolean run_ly = false; // will return just after LY adjustments, skipping all output generation
public boolean force_ly = false; // calculate field calibration for this series even if it was calibrated earlier
public boolean continue_ly = true; // re-run series after performing LY correction (and rename version subdirectory)
public int run_ly_scenes = 11; // Limit number of scenes to use for LY adjustments
public int run_ly_mode = 3; // +1 - lazy eye, +2 - infinity public int run_ly_mode = 3; // +1 - lazy eye, +2 - infinity
public boolean run_ly_ims = false; // adjust infinity (if enabled) using horizontal movement from the IMS public boolean run_ly_ims = false; // adjust infinity (if enabled) using horizontal movement from the IMS
public boolean run_ly_lma = true; public boolean run_ly_lma = true;
...@@ -1789,6 +1792,13 @@ min_str_neib_fpn 0.35 ...@@ -1789,6 +1792,13 @@ min_str_neib_fpn 0.35
"Calculate relative poses of each scene camera relative to the reference scene even if the data exists."); "Calculate relative poses of each scene camera relative to the reference scene even if the data exists.");
gd.addCheckbox ("Run LY adjustments", this.run_ly, gd.addCheckbox ("Run LY adjustments", this.run_ly,
"Adjust cameras orientations (after building DSI) and exit without generatin result files."); "Adjust cameras orientations (after building DSI) and exit without generatin result files.");
gd.addCheckbox ("Force LY adjustments", this.force_ly,
"Perform calibration even if it was already done earlier. requires Run LY to be set");
gd.addCheckbox ("Continue after LY adjustments", this.continue_ly,
"Restart series after LY calibration and rename version directory left after orientation for LY.");
gd.addNumericField("Number of LY scenes", this.run_ly_scenes, 0,3,"",
"Limit the number of oriented scenes to calculate and use for LY adjustment.");
gd.addNumericField("LY mode",this.run_ly_mode, 0,3,"", "+1 - Lazy Eye, +2 - infinity"); gd.addNumericField("LY mode",this.run_ly_mode, 0,3,"", "+1 - Lazy Eye, +2 - infinity");
gd.addCheckbox ("LY infinity from IMS", this.run_ly_ims, gd.addCheckbox ("LY infinity from IMS", this.run_ly_ims,
"Use horizontal movement from the IMS to adjust infinity disparity (if enabled above)."); "Use horizontal movement from the IMS to adjust infinity disparity (if enabled above).");
...@@ -3782,6 +3792,9 @@ min_str_neib_fpn 0.35 ...@@ -3782,6 +3792,9 @@ min_str_neib_fpn 0.35
this.force_ref_dsi = gd.getNextBoolean(); this.force_ref_dsi = gd.getNextBoolean();
this.force_orientations = gd.getNextBoolean(); this.force_orientations = gd.getNextBoolean();
this.run_ly = gd.getNextBoolean(); this.run_ly = gd.getNextBoolean();
this.force_ly = gd.getNextBoolean();
this.continue_ly = gd.getNextBoolean();
this.run_ly_scenes = (int) gd.getNextNumber();
this.run_ly_mode = ((int) gd.getNextNumber()) & 3; this.run_ly_mode = ((int) gd.getNextNumber()) & 3;
this.run_ly_ims = gd.getNextBoolean(); this.run_ly_ims = gd.getNextBoolean();
this.run_ly_lma = gd.getNextBoolean(); this.run_ly_lma = gd.getNextBoolean();
...@@ -5020,6 +5033,9 @@ min_str_neib_fpn 0.35 ...@@ -5020,6 +5033,9 @@ min_str_neib_fpn 0.35
properties.setProperty(prefix+"force_ref_dsi", this.force_ref_dsi + ""); // boolean properties.setProperty(prefix+"force_ref_dsi", this.force_ref_dsi + ""); // boolean
properties.setProperty(prefix+"force_orientations", this.force_orientations + ""); // boolean properties.setProperty(prefix+"force_orientations", this.force_orientations + ""); // boolean
properties.setProperty(prefix+"run_ly", this.run_ly + ""); // boolean properties.setProperty(prefix+"run_ly", this.run_ly + ""); // boolean
properties.setProperty(prefix+"force_ly", this.force_ly + ""); // boolean
properties.setProperty(prefix+"continue_ly", this.continue_ly + ""); // boolean
properties.setProperty(prefix+"run_ly_scenes", this.run_ly_scenes+""); // int
properties.setProperty(prefix+"run_ly_mode", this.run_ly_mode+""); // int properties.setProperty(prefix+"run_ly_mode", this.run_ly_mode+""); // int
properties.setProperty(prefix+"run_ly_ims", this.run_ly_ims + ""); // boolean properties.setProperty(prefix+"run_ly_ims", this.run_ly_ims + ""); // boolean
properties.setProperty(prefix+"run_ly_lma", this.run_ly_lma + ""); // boolean properties.setProperty(prefix+"run_ly_lma", this.run_ly_lma + ""); // boolean
...@@ -6200,6 +6216,9 @@ min_str_neib_fpn 0.35 ...@@ -6200,6 +6216,9 @@ min_str_neib_fpn 0.35
if (properties.getProperty(prefix+"force_ref_dsi")!=null) this.force_ref_dsi=Boolean.parseBoolean(properties.getProperty(prefix+"force_ref_dsi")); if (properties.getProperty(prefix+"force_ref_dsi")!=null) this.force_ref_dsi=Boolean.parseBoolean(properties.getProperty(prefix+"force_ref_dsi"));
if (properties.getProperty(prefix+"force_orientations")!=null) this.force_orientations=Boolean.parseBoolean(properties.getProperty(prefix+"force_orientations")); if (properties.getProperty(prefix+"force_orientations")!=null) this.force_orientations=Boolean.parseBoolean(properties.getProperty(prefix+"force_orientations"));
if (properties.getProperty(prefix+"run_ly")!=null) this.run_ly=Boolean.parseBoolean(properties.getProperty(prefix+"run_ly")); if (properties.getProperty(prefix+"run_ly")!=null) this.run_ly=Boolean.parseBoolean(properties.getProperty(prefix+"run_ly"));
if (properties.getProperty(prefix+"force_ly")!=null) this.force_ly=Boolean.parseBoolean(properties.getProperty(prefix+"force_ly"));
if (properties.getProperty(prefix+"continue_ly")!=null) this.continue_ly=Boolean.parseBoolean(properties.getProperty(prefix+"continue_ly"));
if (properties.getProperty(prefix+"run_ly_scenes")!=null) this.run_ly_scenes=Integer.parseInt(properties.getProperty(prefix+"run_ly_scenes"));
if (properties.getProperty(prefix+"run_ly_mode")!=null) this.run_ly_mode=Integer.parseInt(properties.getProperty(prefix+"run_ly_mode")); if (properties.getProperty(prefix+"run_ly_mode")!=null) this.run_ly_mode=Integer.parseInt(properties.getProperty(prefix+"run_ly_mode"));
if (properties.getProperty(prefix+"run_ly_ims")!=null) this.run_ly_ims=Boolean.parseBoolean(properties.getProperty(prefix+"run_ly_ims")); if (properties.getProperty(prefix+"run_ly_ims")!=null) this.run_ly_ims=Boolean.parseBoolean(properties.getProperty(prefix+"run_ly_ims"));
if (properties.getProperty(prefix+"run_ly_lma")!=null) this.run_ly_lma=Boolean.parseBoolean(properties.getProperty(prefix+"run_ly_lma")); if (properties.getProperty(prefix+"run_ly_lma")!=null) this.run_ly_lma=Boolean.parseBoolean(properties.getProperty(prefix+"run_ly_lma"));
...@@ -7412,6 +7431,9 @@ min_str_neib_fpn 0.35 ...@@ -7412,6 +7431,9 @@ min_str_neib_fpn 0.35
imp.force_ref_dsi = this.force_ref_dsi; imp.force_ref_dsi = this.force_ref_dsi;
imp.force_orientations = this.force_orientations; imp.force_orientations = this.force_orientations;
imp.run_ly = this.run_ly; imp.run_ly = this.run_ly;
imp.force_ly = this.force_ly;
imp.continue_ly = this.continue_ly;
imp.run_ly_scenes = this.run_ly_scenes;
imp.run_ly_mode = this.run_ly_mode; imp.run_ly_mode = this.run_ly_mode;
imp.run_ly_ims = this.run_ly_ims; imp.run_ly_ims = this.run_ly_ims;
imp.run_ly_lma = this.run_ly_lma; imp.run_ly_lma = this.run_ly_lma;
......
...@@ -902,6 +902,7 @@ public class QuadCLT extends QuadCLTCPU { ...@@ -902,6 +902,7 @@ public class QuadCLT extends QuadCLTCPU {
// added 12/21 // added 12/21
@Deprecated
public void processCLTQuadCorrs( // not used in lwir public void processCLTQuadCorrs( // not used in lwir
CLTParameters clt_parameters, CLTParameters clt_parameters,
ColorProcParameters colorProcParameters, ColorProcParameters colorProcParameters,
...@@ -3927,7 +3928,7 @@ public class QuadCLT extends QuadCLTCPU { ...@@ -3927,7 +3928,7 @@ public class QuadCLT extends QuadCLTCPU {
if (clt_parameters.gen_4_img) { // save 4 JPEG images if (clt_parameters.gen_4_img) { // save 4 JPEG images
// Save as individual JPEG images in the model directory // Save as individual JPEG images in the model directory
String x3d_path = getX3dDirectory(); String x3d_path = getX3dDirectory(true);
for (int sub_img = 0; sub_img < imps_RGB.length; sub_img++){ for (int sub_img = 0; sub_img < imps_RGB.length; sub_img++){
EyesisCorrections.saveAndShow( EyesisCorrections.saveAndShow(
imps_RGB[sub_img], imps_RGB[sub_img],
...@@ -4677,7 +4678,7 @@ public class QuadCLT extends QuadCLTCPU { ...@@ -4677,7 +4678,7 @@ public class QuadCLT extends QuadCLTCPU {
if (clt_parameters.gen_4_img) { // save 4 JPEG images if (clt_parameters.gen_4_img) { // save 4 JPEG images
// Save as individual JPEG images in the model directory // Save as individual JPEG images in the model directory
String x3d_path= quadCLT_main.getX3dDirectory(); String x3d_path= quadCLT_main.getX3dDirectory(true);
for (int sub_img = 0; sub_img < imps_RGB.length; sub_img++){ for (int sub_img = 0; sub_img < imps_RGB.length; sub_img++){
EyesisCorrections.saveAndShow( EyesisCorrections.saveAndShow(
imps_RGB[sub_img], imps_RGB[sub_img],
......
...@@ -3212,7 +3212,7 @@ public class TexturedModel { ...@@ -3212,7 +3212,7 @@ public class TexturedModel {
EyesisCorrectionParameters.CorrectionParameters correctionsParameters = ref_scene.correctionsParameters; EyesisCorrectionParameters.CorrectionParameters correctionsParameters = ref_scene.correctionsParameters;
String x3d_dir = ref_scene.getX3dDirectory(); String x3d_dir = ref_scene.getX3dDirectory(true);
boolean use_png = (jpeg_quality <= 0) || !no_alpha; boolean use_png = (jpeg_quality <= 0) || !no_alpha;
if (save_full_textures) { // || !split_textures) { if (save_full_textures) { // || !split_textures) {
for (int nslice = 0; nslice < combined_textures.length; nslice++) { for (int nslice = 0; nslice < combined_textures.length; nslice++) {
......
...@@ -8457,6 +8457,10 @@ if (debugLevel > -100) return true; // temporarily ! ...@@ -8457,6 +8457,10 @@ if (debugLevel > -100) return true; // temporarily !
String video_codec_combo = clt_parameters.imp.video_codec_combo.toLowerCase(); String video_codec_combo = clt_parameters.imp.video_codec_combo.toLowerCase();
boolean use_cuas = clt_parameters.imp.cuas_rotation && clt_parameters.imp.ims_use; // lock_position & ims_use; // needs boolean use_cuas = clt_parameters.imp.cuas_rotation && clt_parameters.imp.ims_use; // lock_position & ims_use; // needs
int min_num_scenes = use_cuas ? ((int) clt_parameters.imp.cuas_min_series): clt_parameters.imp.min_num_scenes; // abandon series if there are less than this number of scenes in it int min_num_scenes = use_cuas ? ((int) clt_parameters.imp.cuas_min_series): clt_parameters.imp.min_num_scenes; // abandon series if there are less than this number of scenes in it
boolean run_ly = clt_parameters.imp.run_ly; // run LY adjustments after initial orientation, for the first in series only
boolean continue_ly = clt_parameters.imp.continue_ly; // calculate field calibration for this series even if it was calibrated earlier
int run_ly_mode= clt_parameters.imp.run_ly_mode; // 3; // +1 - lazy eye, +2 - infinity
if (min_num_scenes < 1) { if (min_num_scenes < 1) {
min_num_scenes = 1; min_num_scenes = 1;
} }
...@@ -8577,11 +8581,20 @@ if (debugLevel > -100) return true; // temporarily ! ...@@ -8577,11 +8581,20 @@ if (debugLevel > -100) return true; // temporarily !
if (debugLevel > -4) { if (debugLevel > -4) {
System.out.println("cuas_centers="+((cuas_centers != null)?("[\""+cuas_centers[0]+"\",\""+cuas_centers[1]+"\"]"):"null")); System.out.println("cuas_centers="+((cuas_centers != null)?("[\""+cuas_centers[0]+"\",\""+cuas_centers[1]+"\"]"):"null"));
} }
// boolean continue_ly = clt_parameters.imp.continue_ly; // calculate field calibration for this series even if it was calibrated earlier
int operation_mode = 0;
if (run_ly && (run_ly_mode > 0) && (run_ly_mode <= 3) ) { // do not yet know if ity is needed
operation_mode =OpticalFlow.RESULTS_BUILD_SEQ_LY;
}
int initial_operation_mode = operation_mode;
while ((ref_index < 0) || ((ref_index + 1) >= min_num_scenes)) { while ((ref_index < 0) || ((ref_index + 1) >= min_num_scenes)) {
String model_directory = opticalFlow.buildSeries( int [] build_series_result = new int[1]; // 0, normal return will not change it
String model_directory = null;
while (true) {
model_directory = opticalFlow.buildSeries(
(pathFirstLast != null), // boolean batch_mode, (pathFirstLast != null), // boolean batch_mode,
operation_mode, // int operation_mode, // 0 - default, 1 - prepare LY (only works for initial orientation)
index_scenes, // QuadCLT[] index_scenes, index_scenes, // QuadCLT[] index_scenes,
// first_in_series, // boolean first_in_series,
quadCLT_main, // QuadCLT quadCLT_main, // tiles should be set quadCLT_main, // QuadCLT quadCLT_main, // tiles should be set
ref_index, // int ref_index, // -1 - last ref_index, // int ref_index, // -1 - last
clt_parameters, // CLTParameters clt_parameters, clt_parameters, // CLTParameters clt_parameters,
...@@ -8597,14 +8610,48 @@ if (debugLevel > -100) return true; // temporarily ! ...@@ -8597,14 +8610,48 @@ if (debugLevel > -100) return true; // temporarily !
cuas_centers, // String [] cuas_centers, // [0] - cumulative input, [1] - cumulative output cuas_centers, // String [] cuas_centers, // [0] - cumulative input, [1] - cumulative output
// processing UAS logs // processing UAS logs
uasLogReader, // UasLogReader uasLogReader, uasLogReader, // UasLogReader uasLogReader,
build_series_result, // int [] build_series_result,
threadsMax, // final int threadsMax, // maximal number of threads to launch threadsMax, // final int threadsMax, // maximal number of threads to launch
updateStatus, // final boolean updateStatus, updateStatus, // final boolean updateStatus,
debugLevel+2); // final int debugLevel) debugLevel+2); // final int debugLevel)
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"));
} }
if (operation_mode == OpticalFlow.RESULTS_BUILD_SEQ_DEFAULT) {
break;
}
if (operation_mode == OpticalFlow.RESULTS_BUILD_SEQ_LY) {
if (debugLevel > -4){
System.out.println("Performed/(skipped if availble and not forced) LY field calbration.");
}
operation_mode = 0;
if (continue_ly) {
if (debugLevel > -4){
System.out.println("Restarting the same series using new correction vector.");
index_scenes[0] = null;
start_ref_pointers[0] = 0; // probably it is not needed
start_ref_pointers[1] = 0; // probably it is not needed
// continue; // while (build_series_result[0] != 0);
}
} else {
if (debugLevel > -4){
System.out.println("Going to the new series.");
}
start_ref_pointers[0] = 0;
build_series_result[0] = 0;
break;
}
}
}
if (model_directory == null) { if (model_directory == null) {
if (initial_operation_mode == OpticalFlow.RESULTS_BUILD_SEQ_LY) {
System.out.println("\n ----- LY FIELD CALIBRATION SCENE SEQUENCE "+nseq+" (last is "+(num_seq-1)+") IS FINISHED in "+
IJ.d2s(0.000000001*(System.nanoTime()-start_time_seq),3)+" sec ("+
IJ.d2s(0.000000001*(System.nanoTime()-start_time_all),3)+" sec from the overall start\n");
break; // go to the next series
}
// TODO: Save continuation after failure not to retry each run // TODO: Save continuation after failure not to retry each run
System.out.println("Failed to build sequence for series "+ref_index); System.out.println("Failed to build sequence for series "+ref_index);
if (start_ref_pointers[0] < (min_num_scenes-1)) { if (start_ref_pointers[0] < (min_num_scenes-1)) {
...@@ -8614,6 +8661,8 @@ if (debugLevel > -100) return true; // temporarily ! ...@@ -8614,6 +8661,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
} }
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 "+
IJ.d2s(0.000000001*(System.nanoTime()-start_time_seq),3)+" sec ("+ IJ.d2s(0.000000001*(System.nanoTime()-start_time_seq),3)+" sec ("+
...@@ -8621,7 +8670,7 @@ if (debugLevel > -100) return true; // temporarily ! ...@@ -8621,7 +8670,7 @@ if (debugLevel > -100) return true; // temporarily !
break; break;
} }
// first_in_series = false; // at least once success in this series // first_in_series = false; // at least once success in this series
System.out.println("adding to video_sets_list start="+start_ref_pointers[0]+", end="+ref_index); // start_ref_pointers[1]); System.out.println("adding to video_sets_list start="+start_ref_pointers[0]+", end="+ref_index); // start_ref_pointers[1]);
// if ((video_list != null) && (video_list.length>0) && (video_list[0] == null)) { // if ((video_list != null) && (video_list.length>0) && (video_list[0] == null)) {
// video_list[0]= new String[0]; // video_list[0]= new String[0];
...@@ -8689,10 +8738,7 @@ if (debugLevel > -100) return true; // temporarily ! ...@@ -8689,10 +8738,7 @@ if (debugLevel > -100) return true; // temporarily !
if (debugLevel > -4){ if (debugLevel > -4){
System.out.println("createSymbolicLink "+link.toPath()+" -> "+pathRelative); System.out.println("createSymbolicLink "+link.toPath()+" -> "+pathRelative);
} }
} }
// cuas_centers[0] = cuas_centers[1];
// cuas_centers[1] = "";
} }
if (start_ref_pointers[0] < (min_num_scenes-1)) { if (start_ref_pointers[0] < (min_num_scenes-1)) {
break; break;
...@@ -8703,8 +8749,15 @@ if (debugLevel > -100) return true; // temporarily ! ...@@ -8703,8 +8749,15 @@ 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) {
System.out.println("Performed only LY adjustment for the series.");
continue;
}
if ((cuas_centers != null) && (cuas_centers[1] != null) && (cuas_centers[1].length()>0)) { if ((cuas_centers != null) && (cuas_centers[1] != null) && (cuas_centers[1].length()>0)) {
cuas_centers[0] = cuas_centers[1]; cuas_centers[0] = cuas_centers[1];
cuas_centers[1] = ""; cuas_centers[1] = "";
...@@ -8725,7 +8778,7 @@ if (debugLevel > -100) return true; // temporarily ! ...@@ -8725,7 +8778,7 @@ if (debugLevel > -100) return true; // temporarily !
false, // true, // boolean print_rslt, false, // true, // boolean print_rslt,
debugLevel); // int debugLevel){ debugLevel); // int debugLevel){
if ((map_gp != null) && !map_gp.isEmpty()) { if ((map_gp != null) && !map_gp.isEmpty()) {
String gp_path =index_scenes[0].getX3dDirectory()+Prefs.getFileSeparator()+ String gp_path =index_scenes[0].getX3dDirectory(true)+Prefs.getFileSeparator()+
index_scenes[0].getImageName()+ index_scenes[0].getImageName()+
"-ground_planes.csv"; "-ground_planes.csv";
GroundPlane.csvGroundPlanes( GroundPlane.csvGroundPlanes(
...@@ -13318,7 +13371,7 @@ if (debugLevel > -100) return true; // temporarily ! ...@@ -13318,7 +13371,7 @@ if (debugLevel > -100) return true; // temporarily !
true); //newAllowed, // save true); //newAllowed, // save
*/ */
// String x3d_path = quadCLT_main.getX3dDirectory(); // String x3d_path = quadCLT_main.getX3dDirectory();
String x3d_path = quadCLT.getX3dDirectory(); String x3d_path = quadCLT.getX3dDirectory(true);
path = x3d_path+Prefs.getFileSeparator()+path; path = x3d_path+Prefs.getFileSeparator()+path;
} }
if (properties == null) { if (properties == null) {
......
...@@ -833,7 +833,7 @@ public class VegetationModel { ...@@ -833,7 +833,7 @@ public class VegetationModel {
return; return;
} }
String dir_state = quadCLTs[ref_index].getX3dDirectory(); // getX3dTopDirectory(); String dir_state = quadCLTs[ref_index].getX3dDirectory(true); // getX3dTopDirectory();
String title_state = quadCLTs[ref_index].getImageName()+"-TERR-VEG-STATE"; String title_state = quadCLTs[ref_index].getImageName()+"-TERR-VEG-STATE";
vegetationModel.saveState( vegetationModel.saveState(
dir_state, // String dir, dir_state, // String dir,
......
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