Commit 684b347d authored by Andrey Filippov's avatar Andrey Filippov

Updating CUAS

parent baed6b68
......@@ -109,6 +109,10 @@ public class EyesisCorrectionParameters {
public String sourceDirectory= "";
public String sourceSequencesList= "";
public boolean useSourceList= false;
public String cuasSeedDir= "";
public boolean useCuasSeedDir= false;
// public String sourceImsDirectory= ""; // source IMS log files
public String imsRootDirectory= ""; // source IMS log files
......@@ -293,6 +297,10 @@ public class EyesisCorrectionParameters {
cp.sourceSequencesList= this.sourceSequencesList;
cp.useSourceList= this.useSourceList;
cp.cuasSeedDir= this.cuasSeedDir;
cp.useCuasSeedDir= this.useCuasSeedDir;
/// cp.sourceImsDirectory= this.sourceImsDirectory;
cp.imsRootDirectory = this.imsRootDirectory;
cp.imsDataSubdirectory = this.imsDataSubdirectory;
......@@ -491,8 +499,12 @@ public class EyesisCorrectionParameters {
properties.setProperty(prefix+"sourceDirectory",this.sourceDirectory);
properties.setProperty(prefix+"sourceSequencesList",this.sourceSequencesList);
properties.setProperty(prefix+"useSourceList",this.useSourceList+"");
properties.setProperty(prefix+"sourceSequencesList", this.sourceSequencesList);
properties.setProperty(prefix+"useSourceList", this.useSourceList+"");
properties.setProperty(prefix+"cuasSeedDir", this.cuasSeedDir);
properties.setProperty(prefix+"useCuasSeedDir", this.useCuasSeedDir+"");
/// properties.setProperty(prefix+"sourceImsDirectory",this.sourceImsDirectory);
properties.setProperty(prefix+"imsRootDirectory", this.imsRootDirectory);
......@@ -691,8 +703,13 @@ public class EyesisCorrectionParameters {
if (properties.getProperty(prefix+"saveSettings")!=null) this.saveSettings=Boolean.parseBoolean(properties.getProperty(prefix+"saveSettings"));
if (properties.getProperty(prefix+"sourceDirectory")!= null) this.sourceDirectory=properties.getProperty(prefix+"sourceDirectory");
if (properties.getProperty(prefix+"sourceSequencesList")!= null) this.sourceSequencesList=properties.getProperty(prefix+"sourceSequencesList");
if (properties.getProperty(prefix+"useSourceList")!=null) this.useSourceList=Boolean.parseBoolean(properties.getProperty(prefix+"useSourceList")); // save 32-bit tiff also if the end result is 8 or 16 bit
/// if (properties.getProperty(prefix+"sourceImsDirectory")!= null) this.sourceImsDirectory=properties.getProperty(prefix+"sourceImsDirectory");
if (properties.getProperty(prefix+"useSourceList")!=null) this.useSourceList=Boolean.parseBoolean(properties.getProperty(prefix+"useSourceList")); // save 32-bit tiff also if the end result is 8 or 16 bit
if (properties.getProperty(prefix+"cuasSeedDir")!= null) this.cuasSeedDir=properties.getProperty(prefix+"cuasSeedDir");
if (properties.getProperty(prefix+"useCuasSeedDir")!=null) this.useCuasSeedDir=Boolean.parseBoolean(properties.getProperty(prefix+"useCuasSeedDir")); // save 32-bit tiff also if the end result is 8 or 16 bit
/// if (properties.getProperty(prefix+"sourceImsDirectory")!= null) this.sourceImsDirectory=properties.getProperty(prefix+"sourceImsDirectory");
if (properties.getProperty(prefix+"imsRootDirectory")!= null) this.imsRootDirectory =properties.getProperty(prefix+"imsRootDirectory");
if (properties.getProperty(prefix+"imsDataSubdirectory")!= null) this.imsDataSubdirectory =properties.getProperty(prefix+"imsDataSubdirectory");
if (properties.getProperty(prefix+"imsPrintSubdirectory")!= null) this.imsPrintSubdirectory=properties.getProperty(prefix+"imsPrintSubdirectory");
......@@ -921,6 +938,9 @@ public class EyesisCorrectionParameters {
gd.addCheckbox ("Select source sequences file", false);
gd.addCheckbox ("Use source list to iterate multiple sequences", this.useSourceList);
gd.addStringField ("CUAS seed directory", this.cuasSeedDir, 80);
gd.addCheckbox ("Use CUAS seed", this.useCuasSeedDir);
gd.addStringField ("Sensor calibration directory", this.sensorDirectory, 80);
gd.addCheckbox ("Select sensor calibration directory", false);
......@@ -1070,10 +1090,9 @@ public class EyesisCorrectionParameters {
this.imsPrintSubdirectory= gd.getNextString();
this.imsSuffix= gd.getNextString();
this.egomotionSuffix= gd.getNextString();
this.sourceSequencesList= gd.getNextString(); if (gd.getNextBoolean()) selectSourceSequencesList(false, false);
this.useSourceList = gd.getNextBoolean();
this.cuasSeedDir= gd.getNextString();
this.sensorDirectory= gd.getNextString(); if (gd.getNextBoolean()) selectSensorDirectory(false, false);
this.sharpKernelDirectory= gd.getNextString(); if (gd.getNextBoolean()) selectSharpKernelDirectory(false, false);
this.smoothKernelDirectory= gd.getNextString(); if (gd.getNextBoolean()) selectSmoothKernelDirectory(false, true);
......@@ -1162,6 +1181,9 @@ public class EyesisCorrectionParameters {
gd.addCheckbox ("Select source sequences file", false); // 10y
gd.addCheckbox ("Use source list to iterate multiple sequences", this.useSourceList); // 10z
gd.addStringField ("CUAS seed directory", this.cuasSeedDir, 80);
gd.addCheckbox ("Use CUAS seed", this.useCuasSeedDir);
gd.addStringField ("x3d model version", this.x3dModelVersion, 80); // 10a
gd.addStringField ("jp4 source copy subdirectory", this.jp4SubDir, 80); // 10b
......@@ -1347,6 +1369,9 @@ public class EyesisCorrectionParameters {
this.sourceSequencesList= gd.getNextString(); if (gd.getNextBoolean()) selectSourceSequencesList(false, false); // 10x,10y
this.useSourceList = gd.getNextBoolean(); // 10z
this.cuasSeedDir= gd.getNextString();
this.useCuasSeedDir = gd.getNextBoolean();
this.x3dModelVersion= gd.getNextString(); // 10a
this.jp4SubDir= gd.getNextString(); // 10b
this.linkedModels= gd.getNextString(); if (gd.getNextBoolean()) selectLinkedModelsDirectory(false, true);
......@@ -1739,7 +1764,6 @@ public class EyesisCorrectionParameters {
public boolean selectSourceSets(int debugLevel) {
// PathFirstLast [] pfl=getSourceSets(this.sourceSequencesList);
String [] defaultPaths = getSetList(this.sourcePaths); // returns non-null 99 scenes list
File [] defaultFiles = new File[defaultPaths.length]; // 99 directories
for (int i = 0; i < defaultPaths.length; i++) {
......@@ -2339,6 +2363,22 @@ public class EyesisCorrectionParameters {
return this.imsRootDirectory + Prefs.getFileSeparator() + this.imsPrintSubdirectory;
}
public String getCuasDir() {
if ((this.cuasSeedDir == null) || (this.cuasSeedDir.length() == 0)|| !this.useCuasSeedDir) {
return null;
}
// while (this.cuasSeedDir.startsWith(Prefs.getFileSeparator())) {
// this.cuasSeedDir=this.cuasSeedDir.substring(1);
// }
while (this.cuasSeedDir.endsWith(Prefs.getFileSeparator())) {
this.cuasSeedDir=this.cuasSeedDir.substring(0, this.cuasSeedDir.length()-1);
}
return this.cuasSeedDir + Prefs.getFileSeparator();
}
public String selectSourceSequencesList(boolean smart, boolean newAllowed) { // normally newAllowed=false
String path= CalibrationFileManagement.selectFile(
......
......@@ -23,8 +23,8 @@ import ij.ImagePlus;
import ij.Prefs;
public class Cuas {
public static QuadCLT makeCenterClt(
@Deprecated
public static QuadCLT makeCenterClt( // not used
QuadCLT [] quadCLTs,
QuadCLT ref_scene,
int [] range, // or null
......
......@@ -5776,7 +5776,7 @@ public class OpticalFlow {
}
}
}
if (!done_sfm) { // first pass or sfm failed
if (!done_sfm) { // first pass or sfm failed. Always here in CUAS mode
boolean compensate_dsi = true;
// should skip scenes w/o orientation 06/29/2022
......@@ -13935,7 +13935,7 @@ public class OpticalFlow {
final int num_pairs = Correlation2d.getNumPairs(ref_scene.getNumSensors());
final double [][][][][] dcorr_td_acc = new double[num_pairs][][][][];
final float [][][][] fcorr_td_acc = new float [tilesY][tilesX][][];
final float [][][] num_acc = new float [tilesY][tilesX][num_pairs];
final float [][][] accum_weights = new float [tilesY][tilesX][num_pairs];
boolean show_accumulated_correlations = show_2d_corr || debug_level > -5;
boolean show_reference_correlations = show_2d_corr || debug_level > -5;
final float [][][] fclt_corr = ((accum_2d_corr != null) || show_accumulated_correlations || show_reference_correlations) ?
......@@ -14096,7 +14096,7 @@ public class OpticalFlow {
}
// Verify tasks are now updated
accumulateCorrelations(
num_acc, // final int [][][] num_acc, // number of accumulated tiles [tilesY][tilesX][pair]
accum_weights, // final int [][][] num_acc, // number of accumulated tiles [tilesY][tilesX][pair]
fcorr_td, // final float [][][][] fcorr_td, // [tilesY][tilesX][pair][256] sparse transform domain representation of corr pairs
fcorr_td_acc); // final float [][][][] fcorr_td_acc // [tilesY][tilesX][pair][256] sparse transform domain representation of corr pairs
if (image_dtt.getGPU().getGpu_debug_level() > -1) {
......@@ -14170,7 +14170,7 @@ public class OpticalFlow {
accumulateCorrelations(
tp_tasks, // final TpTask [] tp_tasks,
num_acc, // final int [][][] num_acc, // number of accumulated tiles [tilesY][tilesX][pair]
accum_weights, // final int [][][] num_acc, // number of accumulated tiles [tilesY][tilesX][pair]
dcorr_td, // final double [][][][][] dcorr_td, // [tile][pair][4][64] sparse transform domain representation of corr pairs
dcorr_td_acc); // final double [][][][][] dcorr_td_acc // [pair][tilesY][tilesX][4][64] sparse transform domain representation of corr pairs
......@@ -14218,7 +14218,7 @@ public class OpticalFlow {
fclt_corr); // float [][][] fclt_corr) // new float [tilesX * tilesY][][] or null
}
} // GPU-version, CPU-version
// render reference scene when processing it (one of the sequence). Never in cuas mode.
if ((scenes[nscene] == ref_scene) && show_reference_correlations) { // visualize prepare ref_scene correlation data
float [][] dbg_corr_rslt_partial = ImageDtt.corr_partial_dbg( // not used in lwir
fclt_corr, // final float [][][] fcorr_data, // [tile][pair][(2*transform_size-1)*(2*transform_size-1)] // if null - will not calculate
......@@ -14253,19 +14253,20 @@ public class OpticalFlow {
// Normalize accumulated correlations
if (ref_scene.hasGPU()) {
accumulateCorrelationsAcOnly(
num_acc, // final int [][][] num_acc, // number of accumulated tiles [tilesY][tilesX][pair]
accum_weights, // final float [][][] num_acc, // number of accumulated tiles [tilesY][tilesX][pair]
fcorr_td_acc); // final float [][][][] fcorr_td_acc // [tilesY][tilesX][pair][256] sparse transform domain representation of corr pairs
} else {
accumulateCorrelations(
num_acc, // final int [][][] num_acc, // number of accumulated tiles [tilesY][tilesX][pair]
accum_weights, // final float [][][] num_acc, // number of accumulated tiles [tilesY][tilesX][pair]
dcorr_td_acc); // final double [][][][][] dcorr_td_acc // [pair][tilesY][tilesX][4][64] sparse transform domain representation of corr pairs
}
if (ref_scene.hasGPU()) {
double [][][] dcorr_tiles = (fclt_corr != null)? (new double [tp_tasks_ref.length][][]):null;
image_dtt.clt_process_tl_correlations( // convert to pixel domain and process correlations already prepared in fcorr_td and/or fcorr_combo_td
clt_parameters.img_dtt, // final ImageDttParameters imgdtt_params, // Now just extra correlation parameters, later will include, most others
fcorr_td_acc, // final float [][][][] fcorr_td, // [tilesY][tilesX][pair][4*64] transform domain representation of all selected corr pairs
num_acc, // float [][][] num_acc, // number of accumulated tiles [tilesY][tilesX][pair] (or null)
accum_weights, // float [][][] num_acc, // number of accumulated tiles [tilesY][tilesX][pair] (or null)
null, // dcorr_weight, // double [] dcorr_weight, // alternative to num_acc, compatible with CPU processing (only one non-zero enough)
clt_parameters.gpu_corr_scale, // final double gpu_corr_scale, // 0.75; // reduce GPU-generated correlation values
clt_parameters.getGpuFatZero(ref_scene.isMonochrome()), // final double gpu_fat_zero, // clt_parameters.getGpuFatZero(is_mono);absolute == 30.0
......@@ -14299,7 +14300,7 @@ public class OpticalFlow {
ImageDtt.convertFcltCorr(
dcorr_tiles, // double [][][] dcorr_tiles,// [tile][sparse, correlation pair][(2*transform_size-1)*(2*transform_size-1)] // if null - will not calculate
fclt_corr); // float [][][] fclt_corr) // new float [tilesX * tilesY][][] or null
} else {
} else { // no-GPU version
double [][][][] dcorr_td = new double[tp_tasks_ref.length][][][]; // [tile][pair][4][64] sparse transform domain representation of corr pairs
double [] dcorr_weight = new double[tp_tasks_ref.length];
for (int iTile = 0; iTile < dcorr_td.length; iTile++) {
......@@ -14309,7 +14310,7 @@ public class OpticalFlow {
dcorr_td[iTile] = new double [num_pairs][][];
for (int npair = 0; npair < num_pairs; npair++) if (dcorr_td_acc[npair] != null){
dcorr_td[iTile][npair] = dcorr_td_acc[npair][tileY][tileX];
dcorr_weight[iTile] = num_acc[tileY][tileX][npair]; // number of accumulated tiles [tilesY][tilesX][pair]
dcorr_weight[iTile] = accum_weights[tileY][tileX][npair]; // number of accumulated tiles [tilesY][tilesX][pair]
}
}
double [][][] dcorr_tiles = (fclt_corr != null)? (new double [tp_tasks_ref.length][][]):null;
......
......@@ -8631,6 +8631,8 @@ if (debugLevel > -100) return true; // temporarily !
String [] cuas_centers = null; // [0] - cumulative input, [1] - cumulative output
if ((quadCLT_main.correctionsParameters.cuasSeed != null) && (quadCLT_main.correctionsParameters.cuasSeed.length()>0)) {
cuas_centers = new String [] {quadCLT_main.correctionsParameters.cuasSeed,""};
} else if (quadCLT_main.correctionsParameters.getCuasDir() != null) {
cuas_centers = new String [] {quadCLT_main.correctionsParameters.getCuasDir(),""};
}
for (int nseq = 0; nseq < num_seq; nseq++) {
long start_time_seq = System.nanoTime();
......
......@@ -6404,7 +6404,7 @@ public class VegetationLMA {
for (int n = 0; n < TVAO_TYPES; n++) {
num_pars += par_nums[n];
}
parameters_vector = new double [num_pars];
// parameters_vector = new double [num_pars];
parameters_vector = new double [num_pars];
// if (terr_elevation_full) { // only initialize if terrain elevation was saved in the image, otherwise keep new initialized
// par_rindex = new int [num_pars][2];
......@@ -6470,7 +6470,17 @@ public class VegetationLMA {
tvao_data[n] = new double [width*height];
}
}
// TODO: build other data structures and make instance consistent, without it this does not allow reading from file
// TODO: build other data structures and make instance consistent, without it this does not allow reading from file
boolean show_final_result = false;
if ((show_final_result) && (debugLevel > -2)) { // 0)) {
String reconstructed_title = "reference_scene"+"-recnstr-pre-step"; // +step_restore; //
showYfX(
null, // double [] vector,
reconstructed_title); // String title)
}
}
return tvao_data;
}
......
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