Commit c56a3a77 authored by Andrey Filippov's avatar Andrey Filippov

Before correcting imu drift

parent a38fdb10
......@@ -141,8 +141,9 @@ public class CalibrationFileManagement {
(dir!=null) &&
(defaultPath.length()>1) && // skip "/"
save &&
!dir.exists()) dir.mkdirs();
!dir.exists()) {
dir.mkdirs();
}
// see if defaultPath matches
if (smart &&
......@@ -155,9 +156,11 @@ public class CalibrationFileManagement {
}
if ((dir==null) || (!dir.exists())) {
if (DEFAULT_DIRECTORY!=null) {
if (smart && (DEFAULT_DIRECTORY!=null)) { // 07.15.2025
defaultPath = DEFAULT_DIRECTORY;
dir = new File(defaultPath);
} else { // 07.15.2025
return null;
}
}
if ((dir==null) || (!dir.exists())) {
......
......@@ -2576,6 +2576,9 @@ public class EyesisCorrectionParameters {
null, // filter
name); //this.x3dDirectory + Prefs.getFileSeparator()+name); //this.sourceDirectory);
}
if (dir == null) {
return null; // 07.15.2025
}
while (dir.endsWith(Prefs.getFileSeparator())) {
dir = dir.substring(0, dir.length()-1);
}
......
......@@ -1604,7 +1604,17 @@ public class Interscene {
quat_corr, // double [] quat_corr, // only applies to rotations - verify!
debugLevel) ; // int debugLevel)
}
if (true) { // lock_position) { // zero linear offsets
boolean debug_ims_xyzatr = true;
if (debug_ims_xyzatr) {
System.out.println("setInitialOrientationsCuas(): lock_position(set x,y,z = 0)="+lock_position);
System.out.println(String.format("%6s, %20s, %15s, %15s, %15s, %15s, %15s, %15s", "index","timestamp", "X", "Y", "Z", "Azimuth", "Tilt", "Roll"));
for (int i = 0; i < quadCLTs.length; i++) {
System.out.println(String.format("%6d, %20s, %15.12f, %15.12f, %15.12f, %15.12f, %15.12f, %15.12f", i,quadCLTs[i].getImageName(),
ims_xyzatr[i][0][0],ims_xyzatr[i][0][1],ims_xyzatr[i][0][2],ims_xyzatr[i][1][0],ims_xyzatr[i][1][1],ims_xyzatr[i][1][2]));
}
}
if (lock_position) { // lock_position) { // zero linear offsets
for (int i = 0; i < quadCLTs.length; i++) for (int j = 0; j < 3; j++){
ims_xyzatr[i][0][j]=0.0;
}
......
......@@ -4451,8 +4451,8 @@ public class OpticalFlow {
dsi = quadCLT_ref.dsi;
}
double [][] combo_dsi = null;
if (dsi[TwoQuadCLT.DSI_SPREAD_AUX] == null) {
System.out.println("DSI_MAIN file has old format and does not have spread data, will recalculate.");
if ((dsi[TwoQuadCLT.DSI_SPREAD_AUX] == null) && (!quadCLT_ref.hasCenterClt())) {
System.out.println("DSI_MAIN file has old format and does not have spread data, no center/cuas, will recalculate.");
} else {
if ((dsi[TwoQuadCLT.DSI_BLUE_SKY_AUX] == null) || sky_recalc) { //
// Sets quadCLT_ref.dsi and blue sky (if exists)
......@@ -5096,11 +5096,13 @@ public class OpticalFlow {
// String center_ts = null; // name of the center scene - not yet known
double [][] combo_dsn_final = null;
if (reset_photometric && first_in_series && build_ref_dsi) {
if (debugLevel > -3) {
System.out.println("buildSeries(): *** resetting photometric calibration for a new series ***");
}
quadCLT_main.resetLwirCalibration();
// if (reset_photometric && first_in_series && build_ref_dsi) {
if (reset_photometric && first_in_series) {
if (build_ref_dsi || ((center_CLT != null) && center_CLT.hasCenterClt())) {
if (debugLevel > -3) {
System.out.println("buildSeries(): *** resetting photometric calibration for a new series ***");
}
quadCLT_main.resetLwirCalibration();
// and immediately recalibrate offsets
quadCLTs[last_index] = (QuadCLT) quadCLT_main.spawnNoModelQuadCLT( // will conditionImageSet
set_channels[last_index].set_name,
......@@ -5108,6 +5110,7 @@ public class OpticalFlow {
colorProcParameters, //
threadsMax,
debugLevel-2);
}
}
//************* move loading center DSI here before building reference DSI. Or after "blue sky
......@@ -5115,7 +5118,9 @@ public class OpticalFlow {
QuadCLT source_CLT = (center_CLT != null) ? center_CLT :quadCLTs[last_index];
/// while ((quadCLTs[last_index] == null) || !quadCLTs[last_index].hasBlueSky()) { // null
// while ((quadCLTs[last_index] == null) || (!source_CLT.hasBlueSky() && !use_cuas)) { // null FIXME 07.08.2025. added && !use_cuas to prevent forever loop
while ((quadCLTs[last_index] == null) || !source_CLT.hasBlueSky()) { // null FIXME 07.08.2025. added && !use_cuas to prevent forever loop. Restores - needs once at least, will break
// while ((quadCLTs[last_index] == null) || !source_CLT.hasBlueSky()) { // null FIXME 07.08.2025. added && !use_cuas to prevent forever loop. Restores - needs once at least, will break
// while ((quadCLTs[last_index] == null) || !source_CLT.hasBlueSky()) { // null FIXME 07.08.2025. added && !use_cuas to prevent forever loop. Restores - needs once at least, will break
while (true) { // null FIXME 07.08.2025. added && !use_cuas to prevent forever loop. Restores - needs once at least, will break
if (build_ref_dsi) {
TwoQuadCLT.copyJP4src( // actually there is no sense to process multiple image sets. Combine with other
// processing?
......@@ -5195,6 +5200,9 @@ public class OpticalFlow {
// center_ts = getReferenceTimestamp(); //??
}
}
if ((quadCLTs[last_index] != null) && source_CLT.hasBlueSky()) { // null FIXME 07.08.2025. added && !use_cuas to prevent forever loop. Restores - needs once at least, will break
break; // was while header
}
if (use_cuas) {
System.out.println("Breaking in cuas mode without hasBlueSky() - fix later?");
break;
......
......@@ -414,8 +414,8 @@ public class QuadCLTCPU {
String center_name = QuadCLT.getCenterDirName(ref_clt.getImageName());
// allow creation, otherwise returns config
String center_dir_path = ref_clt.setX3dDirectory(center_name); // setX3dDirectory(center_name); // gets /home/elphel/lwir16-proc/eagle_mountain/configs!
File cdir = new File(center_dir_path);
QuadCLT center_CLT = null;
File cdir = (center_dir_path!=null) ? new File(center_dir_path) : null;
if (!ignore_this) {
// Try to read this (created/tuned) center_CLT
try_read_center: {
......@@ -423,6 +423,7 @@ public class QuadCLTCPU {
System.out.println("restoreCenterClt(): directory does not exist: "+center_dir_path);
break try_read_center;
}
// cdir = new File(center_dir_path);
if (!cdir.exists() || !cdir.isDirectory()) {
System.out.println("restoreCenterClt(): directory does not exist or is not a directory: "+center_dir_path);
break try_read_center;
......@@ -489,8 +490,16 @@ public class QuadCLTCPU {
if ((center_CLT == null) && (full_path == null)) {
System.out.println("restoreCenterClt(): parent directory is not provided, and this model data does not exist - bailing out.");
return null;
}
}
if (use_parent_dsi || (center_CLT == null)) { // so parent parentCuasData and parent_dsi both exist
if (cdir == null) {
System.out.println("restoreCenterClt(): cdir == null - bailing out.");
return null;
}
// Create new center_CLT
if (center_CLT == null) {
center_CLT = new QuadCLT(ref_clt, center_name);
......@@ -3165,6 +3174,9 @@ public class QuadCLTCPU {
this.lwir_cold_hot = ErsCorrection.clone1d(qParent.lwir_cold_hot);
this.ds_from_main = ErsCorrection.clone2d(qParent.ds_from_main);
this.tp = qParent.tp;
// 07.15.2025
this.quat_corr = (qParent.quat_corr != null) ? qParent.quat_corr.clone():null;
this.enu_corr_metric = (qParent.enu_corr_metric != null) ? qParent.enu_corr_metric.clone():null;
}
public boolean hasGPU() {
......@@ -3327,7 +3339,7 @@ public class QuadCLTCPU {
String x3d_path = correctionsParameters.selectX3dDirectory( // for x3d and obj
name, // quad timestamp. Will be ignored if correctionsParameters.use_x3d_subdirs is false
correctionsParameters.x3dModelVersion,
false, // smart,
true, // smart,
true); //newAllowed, // save
return x3d_path;
}
......@@ -4798,7 +4810,7 @@ public class QuadCLTCPU {
ers.getPropertiesERS(prefix, properties);
ers.getPropertiesScenes(prefix, properties);
ers.getPropertiesLineTime(prefix, properties); // will set old value if not in the file
System.out.println("Restored interframe properties from :"+path);
System.out.println("Restored interframe properties from :"+path); // here often gets configs folder:/media/elphel/NVME/lwir16-proc/eagle_mountain/configs
return properties;
}
......@@ -9437,7 +9449,7 @@ public class QuadCLTCPU {
};
// temporary applying scaleExposures[srcChannel] here, setting it to all 1.0
if (debugLevel > -3) {
if (debugLevel > -2) {
System.out.println("Temporarily applying scaleExposures[] here - 1" );
}
......
......@@ -13408,7 +13408,7 @@ if (debugLevel > -100) return true; // temporarily !
e.printStackTrace();
}
if (debugLevel> -3) {
System.out.println("Configuration parameters are saved to "+path);
System.out.println("TwoQuadCLT: Configuration parameters are saved to "+path);
}
}
}
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