Commit c430b2f4 authored by Andrey Filippov's avatar Andrey Filippov

more cleanup

parent 95647831
...@@ -138,6 +138,9 @@ public class EyesisCorrectionParameters { ...@@ -138,6 +138,9 @@ public class EyesisCorrectionParameters {
public String x3dSubdirSuffix= ""; public String x3dSubdirSuffix= "";
// CLT 3d batch parameters // CLT 3d batch parameters
public boolean process_main_sources = false;
public boolean process_aux_sources = true;
public int rig_batch_adjust_main = 0; public int rig_batch_adjust_main = 0;
public int rig_batch_adjust_aux = 0; public int rig_batch_adjust_aux = 0;
public int rig_batch_adjust_rig = 0; public int rig_batch_adjust_rig = 0;
...@@ -298,6 +301,10 @@ public class EyesisCorrectionParameters { ...@@ -298,6 +301,10 @@ public class EyesisCorrectionParameters {
cp.x3dModelVersion= this.x3dModelVersion; cp.x3dModelVersion= this.x3dModelVersion;
cp.jp4SubDir= this.jp4SubDir; cp.jp4SubDir= this.jp4SubDir;
cp.process_main_sources= this.process_main_sources;
cp.process_aux_sources= this.process_aux_sources;
cp.rig_batch_adjust_main= this.rig_batch_adjust_main; cp.rig_batch_adjust_main= this.rig_batch_adjust_main;
cp.rig_batch_adjust_aux= this.rig_batch_adjust_aux; cp.rig_batch_adjust_aux= this.rig_batch_adjust_aux;
cp.rig_batch_adjust_rig= this.rig_batch_adjust_rig; cp.rig_batch_adjust_rig= this.rig_batch_adjust_rig;
...@@ -498,6 +505,9 @@ public class EyesisCorrectionParameters { ...@@ -498,6 +505,9 @@ public class EyesisCorrectionParameters {
properties.setProperty(prefix+"mlDirectory", this.mlDirectory); properties.setProperty(prefix+"mlDirectory", this.mlDirectory);
properties.setProperty(prefix+"process_main_sources", this.process_main_sources+"");
properties.setProperty(prefix+"process_aux_sources", this.process_aux_sources+"");
properties.setProperty(prefix+"rig_batch_adjust_main", this.rig_batch_adjust_main+""); properties.setProperty(prefix+"rig_batch_adjust_main", this.rig_batch_adjust_main+"");
properties.setProperty(prefix+"rig_batch_adjust_aux", this.rig_batch_adjust_aux+""); properties.setProperty(prefix+"rig_batch_adjust_aux", this.rig_batch_adjust_aux+"");
properties.setProperty(prefix+"rig_batch_adjust_rig", this.rig_batch_adjust_rig+""); properties.setProperty(prefix+"rig_batch_adjust_rig", this.rig_batch_adjust_rig+"");
...@@ -680,6 +690,9 @@ public class EyesisCorrectionParameters { ...@@ -680,6 +690,9 @@ public class EyesisCorrectionParameters {
if (properties.getProperty(prefix+"mlDirectory")!= null) this.mlDirectory=properties.getProperty(prefix+"mlDirectory"); if (properties.getProperty(prefix+"mlDirectory")!= null) this.mlDirectory=properties.getProperty(prefix+"mlDirectory");
if (properties.getProperty(prefix+"process_main_sources")!= null) this.process_main_sources=Boolean.parseBoolean(properties.getProperty(prefix+"process_main_sources"));
if (properties.getProperty(prefix+"process_aux_sources")!= null) this.process_aux_sources=Boolean.parseBoolean(properties.getProperty(prefix+"process_aux_sources"));
if (properties.getProperty(prefix+"rig_batch_adjust_main")!=null) this.rig_batch_adjust_main=Integer.parseInt(properties.getProperty(prefix+"rig_batch_adjust_main")); if (properties.getProperty(prefix+"rig_batch_adjust_main")!=null) this.rig_batch_adjust_main=Integer.parseInt(properties.getProperty(prefix+"rig_batch_adjust_main"));
if (properties.getProperty(prefix+"rig_batch_adjust_aux")!=null) this.rig_batch_adjust_aux=Integer.parseInt(properties.getProperty(prefix+"rig_batch_adjust_aux")); if (properties.getProperty(prefix+"rig_batch_adjust_aux")!=null) this.rig_batch_adjust_aux=Integer.parseInt(properties.getProperty(prefix+"rig_batch_adjust_aux"));
if (properties.getProperty(prefix+"rig_batch_adjust_rig")!=null) this.rig_batch_adjust_rig=Integer.parseInt(properties.getProperty(prefix+"rig_batch_adjust_rig")); if (properties.getProperty(prefix+"rig_batch_adjust_rig")!=null) this.rig_batch_adjust_rig=Integer.parseInt(properties.getProperty(prefix+"rig_batch_adjust_rig"));
...@@ -1069,9 +1082,10 @@ public class EyesisCorrectionParameters { ...@@ -1069,9 +1082,10 @@ public class EyesisCorrectionParameters {
gd.addStringField ("Aux x3d subdirectory suffix", this.aux_camera.x3dSubdirSuffix, 10, // 20ba gd.addStringField ("Aux x3d subdirectory suffix", this.aux_camera.x3dSubdirSuffix, 10, // 20ba
"When using timestamp as a subdirectory, add this suffix"); "When using timestamp as a subdirectory, add this suffix");
gd.addTab ("Batch", "Select Batch parameters"); gd.addTab ("Batch", "Select Batch parameters");
gd.addCheckbox ("Process main camera source images (false - ignore)", this.process_main_sources); // 20c
gd.addCheckbox ("Process AUX camera source images (false - ignore)", this.process_aux_sources); // 20d
gd.addNumericField("Repeat main camera field adjustment (early, before rig)", this.rig_batch_adjust_main, 0); gd.addNumericField("Repeat main camera field adjustment (early, before rig)", this.rig_batch_adjust_main, 0);
gd.addNumericField("Repeat aux camera field adjustment (early, before rig)", this.rig_batch_adjust_aux, 0); gd.addNumericField("Repeat aux camera field adjustment (early, before rig)", this.rig_batch_adjust_aux, 0);
gd.addNumericField("Repeat 2-quad camera rig field adjustment (early, before late main/aux)", this.rig_batch_adjust_rig, 0); gd.addNumericField("Repeat 2-quad camera rig field adjustment (early, before late main/aux)", this.rig_batch_adjust_rig, 0);
...@@ -1209,6 +1223,9 @@ public class EyesisCorrectionParameters { ...@@ -1209,6 +1223,9 @@ public class EyesisCorrectionParameters {
this.aux_camera.cltSuffix= gd.getNextString(); // 20b this.aux_camera.cltSuffix= gd.getNextString(); // 20b
this.aux_camera.x3dSubdirSuffix= gd.getNextString(); // 20ba this.aux_camera.x3dSubdirSuffix= gd.getNextString(); // 20ba
this.process_main_sources= gd.getNextBoolean(); // 20c
this.process_aux_sources= gd.getNextBoolean(); // 20d
this.rig_batch_adjust_main = (int) gd.getNextNumber(); this.rig_batch_adjust_main = (int) gd.getNextNumber();
this.rig_batch_adjust_aux = (int) gd.getNextNumber(); this.rig_batch_adjust_aux = (int) gd.getNextNumber();
this.rig_batch_adjust_rig = (int) gd.getNextNumber(); this.rig_batch_adjust_rig = (int) gd.getNextNumber();
......
...@@ -767,8 +767,10 @@ public class CLTPass3d{ ...@@ -767,8 +767,10 @@ public class CLTPass3d{
double [] strength) { double [] strength) {
this.calc_disparity = disparity; this.calc_disparity = disparity;
this.strength = strength; this.strength = strength;
if (calc_disparity_combo != null) {
calc_disparity_combo = calc_disparity.clone(); calc_disparity_combo = calc_disparity.clone();
} }
}
/** /**
* Replaces current combo disparity for tiles that are weak and do not have any neighbor within disparity range from this one * Replaces current combo disparity for tiles that are weak and do not have any neighbor within disparity range from this one
......
...@@ -30,6 +30,18 @@ import com.elphel.imagej.common.GenericJTabbedDialog; ...@@ -30,6 +30,18 @@ import com.elphel.imagej.common.GenericJTabbedDialog;
public class IntersceneMatchParameters { public class IntersceneMatchParameters {
// Maybe add parameters to make sure there is enough data? Enough in each zone? Enough spread? // Maybe add parameters to make sure there is enough data? Enough in each zone? Enough spread?
public boolean force_ref_dsi = false; // true;
public boolean force_orientations = false;
public boolean force_interscene = false; // true;
public boolean export_images = true; // 16-slice images (same disparity, COMBO_DSN_INDX_DISP_FG and COMBO_DSN_INDX_DISP_BG_ALL,
public boolean show_images = false;
public boolean show_ranges = true;
public double range_disparity_offset = -0.08;
public double range_min_strength = 0.5;
public double range_max = 5000.0;
// Some "AGC" to adjust how much to discard // Some "AGC" to adjust how much to discard
public int margin = 1; // do not use tiles if their centers are closer to the image edge public int margin = 1; // do not use tiles if their centers are closer to the image edge
public int sensor_mask_inter = -1; // bitmask of the sensors to use (-1 - all) public int sensor_mask_inter = -1; // bitmask of the sensors to use (-1 - all)
...@@ -85,6 +97,28 @@ public class IntersceneMatchParameters { ...@@ -85,6 +97,28 @@ public class IntersceneMatchParameters {
public void dialogQuestions(GenericJTabbedDialog gd) { public void dialogQuestions(GenericJTabbedDialog gd) {
// gd.addMessage ("Scene parameters selection"); // gd.addMessage ("Scene parameters selection");
gd.addMessage ("Build series options");
gd.addCheckbox ("Force reference scene DSI calculation", this.force_ref_dsi,
"Calculate reference scene DSI even if the file exists.");
gd.addCheckbox ("Force egomotion calculation", this.force_orientations,
"Calculate relative poses of each scene camera relative to the reference scene even if the data exists.");
gd.addCheckbox ("Force interscene DSI accumulation", this.force_interscene,
"Force interscene calculation (+ML export) even if it was performed before.");
gd.addCheckbox ("Export all-sensor images", this.export_images,
"Export multi-slice images: with constant disparity, with foreground disparity, and with background disparity");
gd.addCheckbox ("Show exported images", this.show_images,
"Display generated/saved images");
gd.addCheckbox ("Show distances in meters", this.show_ranges,
"Calculate strength, distance, X, and Y in meters");
gd.addNumericField("Disparity at infinity", this.range_disparity_offset, 5,7,"pix",
"Disparity at infinity - subtract from measured disparity when converting to ranges.");
gd.addNumericField("Minimal strength for range calculation", this.range_min_strength, 5,7,"",
"Disregard weaker results when measuring range.");
gd.addNumericField("Maximal displayed range", this.range_max, 5,7,"m",
"Do not display extremely far objects.");
gd.addMessage ("Interscene match parameters");
gd.addNumericField("Image margin", this.margin, 0,5,"pix", gd.addNumericField("Image margin", this.margin, 0,5,"pix",
"Do not use tiles if their centers are closer to the virtual image edge"); "Do not use tiles if their centers are closer to the virtual image edge");
gd.addNumericField("Used sensors mask", this.sensor_mask_inter, 0,5,"", gd.addNumericField("Used sensors mask", this.sensor_mask_inter, 0,5,"",
...@@ -112,7 +146,7 @@ public class IntersceneMatchParameters { ...@@ -112,7 +146,7 @@ public class IntersceneMatchParameters {
gd.addNumericField("Difference from neighbors average ", this.half_avg_diff, 5,7,"", gd.addNumericField("Difference from neighbors average ", this.half_avg_diff, 5,7,"",
"Reduce twice for high difference from neighbors average."); "Reduce twice for high difference from neighbors average.");
gd.addMessage ("Initial search for the intre-scene match"); gd.addMessage ("Initial search for the inter-scene match");
gd.addNumericField("Azimuth/tilt step", this.pix_step, 0,3,"pix", gd.addNumericField("Azimuth/tilt step", this.pix_step, 0,3,"pix",
"Search in a spiral starting with no-shift with this step between probes, in approximate pixels"); "Search in a spiral starting with no-shift with this step between probes, in approximate pixels");
gd.addNumericField("Search spiral radius", this.search_rad, 0,3,"steps", gd.addNumericField("Search spiral radius", this.search_rad, 0,3,"steps",
...@@ -173,6 +207,16 @@ public class IntersceneMatchParameters { ...@@ -173,6 +207,16 @@ public class IntersceneMatchParameters {
} }
public void dialogAnswers(GenericJTabbedDialog gd) { public void dialogAnswers(GenericJTabbedDialog gd) {
this.force_ref_dsi = gd.getNextBoolean();
this.force_orientations = gd.getNextBoolean();
this.force_interscene = gd.getNextBoolean();
this.export_images = gd.getNextBoolean();
this.show_images = gd.getNextBoolean();
this.show_ranges = gd.getNextBoolean();
this.range_disparity_offset = gd.getNextNumber();
this.range_min_strength = gd.getNextNumber();
this.range_max = gd.getNextNumber();
this.margin = (int) gd.getNextNumber(); this.margin = (int) gd.getNextNumber();
this.sensor_mask_inter= (int) gd.getNextNumber(); this.sensor_mask_inter= (int) gd.getNextNumber();
this.use_partial = gd.getNextBoolean(); this.use_partial = gd.getNextBoolean();
...@@ -214,6 +258,17 @@ public class IntersceneMatchParameters { ...@@ -214,6 +258,17 @@ public class IntersceneMatchParameters {
} }
public void setProperties(String prefix,Properties properties){ public void setProperties(String prefix,Properties properties){
properties.setProperty(prefix+"force_ref_dsi", this.force_ref_dsi + ""); // boolean
properties.setProperty(prefix+"force_orientations", this.force_orientations + "");// boolean
properties.setProperty(prefix+"force_interscene", this.force_interscene + ""); // boolean
properties.setProperty(prefix+"export_images", this.export_images + ""); // boolean
properties.setProperty(prefix+"show_images", this.show_images + ""); // boolean
properties.setProperty(prefix+"show_ranges", this.show_ranges + ""); // boolean
properties.setProperty(prefix+"range_disparity_offset",this.range_disparity_offset+""); // double
properties.setProperty(prefix+"range_min_strength", this.range_min_strength+""); // double
properties.setProperty(prefix+"range_max", this.range_max+""); // double
properties.setProperty(prefix+"margin", this.margin+""); // int properties.setProperty(prefix+"margin", this.margin+""); // int
properties.setProperty(prefix+"sensor_mask_inter", this.sensor_mask_inter+""); // int properties.setProperty(prefix+"sensor_mask_inter", this.sensor_mask_inter+""); // int
properties.setProperty(prefix+"use_partial", this.use_partial+""); // boolean properties.setProperty(prefix+"use_partial", this.use_partial+""); // boolean
...@@ -253,12 +308,21 @@ public class IntersceneMatchParameters { ...@@ -253,12 +308,21 @@ public class IntersceneMatchParameters {
} }
public void getProperties(String prefix,Properties properties){ public void getProperties(String prefix,Properties properties){
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_interscene")!=null) this.force_interscene=Boolean.parseBoolean(properties.getProperty(prefix+"force_interscene"));
if (properties.getProperty(prefix+"export_images")!=null) this.export_images=Boolean.parseBoolean(properties.getProperty(prefix+"export_images"));
if (properties.getProperty(prefix+"show_images")!=null) this.show_images=Boolean.parseBoolean(properties.getProperty(prefix+"show_images"));
if (properties.getProperty(prefix+"show_ranges")!=null) this.show_images=Boolean.parseBoolean(properties.getProperty(prefix+"show_ranges"));
if (properties.getProperty(prefix+"range_disparity_offset")!=null) this.range_disparity_offset=Double.parseDouble(properties.getProperty(prefix+"range_disparity_offset"));
if (properties.getProperty(prefix+"range_min_strength")!=null) this.range_min_strength=Double.parseDouble(properties.getProperty(prefix+"range_min_strength"));
if (properties.getProperty(prefix+"range_max")!=null) this.range_max=Double.parseDouble(properties.getProperty(prefix+"range_max"));
if (properties.getProperty(prefix+"margin")!=null) this.margin=Integer.parseInt(properties.getProperty(prefix+"margin")); if (properties.getProperty(prefix+"margin")!=null) this.margin=Integer.parseInt(properties.getProperty(prefix+"margin"));
if (properties.getProperty(prefix+"sensor_mask_inter")!=null) this.sensor_mask_inter=Integer.parseInt(properties.getProperty(prefix+"sensor_mask_inter")); if (properties.getProperty(prefix+"sensor_mask_inter")!=null) this.sensor_mask_inter=Integer.parseInt(properties.getProperty(prefix+"sensor_mask_inter"));
if (properties.getProperty(prefix+"use_partial")!=null) this.use_partial=Boolean.parseBoolean(properties.getProperty(prefix+"use_partial")); if (properties.getProperty(prefix+"use_partial")!=null) this.use_partial=Boolean.parseBoolean(properties.getProperty(prefix+"use_partial"));
if (properties.getProperty(prefix+"run_poly")!=null) this.run_poly=Boolean.parseBoolean(properties.getProperty(prefix+"run_poly")); if (properties.getProperty(prefix+"run_poly")!=null) this.run_poly=Boolean.parseBoolean(properties.getProperty(prefix+"run_poly"));
if (properties.getProperty(prefix+"centroid_radius")!=null) this.centroid_radius=Double.parseDouble(properties.getProperty(prefix+"centroid_radius")); if (properties.getProperty(prefix+"centroid_radius")!=null) this.centroid_radius=Double.parseDouble(properties.getProperty(prefix+"centroid_radius"));
if (properties.getProperty(prefix+"margin")!=null) this.margin=Integer.parseInt(properties.getProperty(prefix+"margin")); if (properties.getProperty(prefix+"n_recenter")!=null) this.n_recenter=Integer.parseInt(properties.getProperty(prefix+"n_recenter"));
if (properties.getProperty(prefix+"min_str")!=null) this.min_str=Double.parseDouble(properties.getProperty(prefix+"min_str")); if (properties.getProperty(prefix+"min_str")!=null) this.min_str=Double.parseDouble(properties.getProperty(prefix+"min_str"));
if (properties.getProperty(prefix+"min_str_sum")!=null) this.min_str_sum=Double.parseDouble(properties.getProperty(prefix+"min_str_sum")); if (properties.getProperty(prefix+"min_str_sum")!=null) this.min_str_sum=Double.parseDouble(properties.getProperty(prefix+"min_str_sum"));
if (properties.getProperty(prefix+"min_neibs")!=null) this.min_neibs=Integer.parseInt(properties.getProperty(prefix+"min_neibs")); if (properties.getProperty(prefix+"min_neibs")!=null) this.min_neibs=Integer.parseInt(properties.getProperty(prefix+"min_neibs"));
...@@ -294,6 +358,15 @@ public class IntersceneMatchParameters { ...@@ -294,6 +358,15 @@ public class IntersceneMatchParameters {
@Override @Override
public IntersceneMatchParameters clone() throws CloneNotSupportedException { public IntersceneMatchParameters clone() throws CloneNotSupportedException {
IntersceneMatchParameters imp = new IntersceneMatchParameters(); IntersceneMatchParameters imp = new IntersceneMatchParameters();
imp.force_ref_dsi = this.force_ref_dsi;
imp.force_orientations = this.force_orientations;
imp.force_interscene = this.force_interscene;
imp.export_images = this.export_images;
imp.show_images = this.show_images;
imp.show_ranges = this.show_ranges;
imp.range_disparity_offset = this.range_disparity_offset;
imp.range_min_strength = this.range_min_strength;
imp.range_max = this.range_max;
imp.margin = this.margin; imp.margin = this.margin;
imp.sensor_mask_inter = this.sensor_mask_inter; imp.sensor_mask_inter = this.sensor_mask_inter;
imp.use_partial = this.use_partial; imp.use_partial = this.use_partial;
......
...@@ -238,7 +238,7 @@ public class QuadCLT extends QuadCLTCPU { ...@@ -238,7 +238,7 @@ public class QuadCLT extends QuadCLTCPU {
final Thread[] threads = ImageDtt.newThreadArray(threadsMax); final Thread[] threads = ImageDtt.newThreadArray(threadsMax);
final AtomicInteger ai = new AtomicInteger(0); final AtomicInteger ai = new AtomicInteger(0);
final AtomicInteger anum_updated = new AtomicInteger(0); final AtomicInteger anum_updated = new AtomicInteger(0);
final int dbg_tile = 1066; final int dbg_tile = 1235;
anum_updated.set(0); anum_updated.set(0);
for (int ithread = 0; ithread < threads.length; ithread++) { for (int ithread = 0; ithread < threads.length; ithread++) {
threads[ithread] = new Thread() { threads[ithread] = new Thread() {
...@@ -5847,7 +5847,7 @@ if (debugLevel < -100) { ...@@ -5847,7 +5847,7 @@ if (debugLevel < -100) {
{ {
QuadCLT quadCLT = new QuadCLT(this, set_name); //null QuadCLT quadCLT = new QuadCLT(this, set_name); //null
quadCLT.restoreNoModel( return (QuadCLT) quadCLT.restoreNoModel(
clt_parameters, clt_parameters,
colorProcParameters, colorProcParameters,
null, // double [] noise_sigma_level, null, // double [] noise_sigma_level,
...@@ -5855,8 +5855,7 @@ if (debugLevel < -100) { ...@@ -5855,8 +5855,7 @@ if (debugLevel < -100) {
null, // final QuadCLTCPU ref_scene, // may be null if scale_fpn <= 0 null, // final QuadCLTCPU ref_scene, // may be null if scale_fpn <= 0
threadsMax, threadsMax,
debugLevel); debugLevel);
// return quadCLT;
return quadCLT;
} }
......
...@@ -88,6 +88,10 @@ import loci.formats.FormatException; ...@@ -88,6 +88,10 @@ import loci.formats.FormatException;
public class QuadCLTCPU { public class QuadCLTCPU {
public static final String [] DSI_SUFFIXES = {"-INTER-INTRA-LMA","-INTER-INTRA","-DSI_MAIN"};
public static int INDEX_INTER = 0;
public static int INDEX_INTER_LMA = 1;
public static int INDEX_DSI_MAIN = 2;
public static final String [] FGBG_TITLES_ADJ = {"disparity","strength"}; public static final String [] FGBG_TITLES_ADJ = {"disparity","strength"};
// public static final String [] FGBG_TITLES = {"disparity","strength", "rms","rms-split","fg-disp","fg-str","bg-disp","bg-str"}; // public static final String [] FGBG_TITLES = {"disparity","strength", "rms","rms-split","fg-disp","fg-str","bg-disp","bg-str"};
public static final String [] FGBG_TITLES_AUX = {"disparity","strength", "rms","rms-split","fg-disp","fg-str","bg-disp","bg-str","aux-disp","aux-str"}; public static final String [] FGBG_TITLES_AUX = {"disparity","strength", "rms","rms-split","fg-disp","fg-str","bg-disp","bg-str","aux-disp","aux-str"};
...@@ -355,6 +359,45 @@ public class QuadCLTCPU { ...@@ -355,6 +359,45 @@ public class QuadCLTCPU {
return x3d_path; return x3d_path;
} }
public void setDSI(
double [][] dsi) {
this.dsi = dsi;
}
public void setDSIFromCombo(
double [][] combo_dsi) {
this.dsi = new double [TwoQuadCLT.DSI_SLICES.length][];
this.dsi[is_aux?TwoQuadCLT.DSI_DISPARITY_AUX:TwoQuadCLT.DSI_DISPARITY_MAIN] =
combo_dsi[OpticalFlow.COMBO_DSN_INDX_DISP_FG];
this.dsi[is_aux?TwoQuadCLT.DSI_STRENGTH_AUX:TwoQuadCLT.DSI_STRENGTH_MAIN] =
combo_dsi[OpticalFlow.COMBO_DSN_INDX_STRENGTH];
this.dsi[is_aux?TwoQuadCLT.DSI_DISPARITY_AUX_LMA:TwoQuadCLT.DSI_DISPARITY_MAIN_LMA] =
combo_dsi[OpticalFlow.COMBO_DSN_INDX_LMA];
}
public boolean dsiExists() {
int num_slices = restoreDSI(
DSI_SUFFIXES[INDEX_DSI_MAIN], // String suffix, // "-DSI_COMBO", "-DSI_MAIN" (DSI_COMBO_SUFFIX, DSI_MAIN_SUFFIX)
null, // double [][] dsi, // if null - just check file exists
true); // boolean silent);
return num_slices >= 0;
}
public boolean interDsiExists() {
int num_slices = restoreDSI(
DSI_SUFFIXES[INDEX_INTER_LMA], // String suffix, // "-DSI_COMBO", "-DSI_MAIN" (DSI_COMBO_SUFFIX, DSI_MAIN_SUFFIX)
null, // double [][] dsi, // if null - just check file exists
true); // boolean silent);
if (num_slices >= 0) {
return true;
}
num_slices = restoreDSI(
DSI_SUFFIXES[INDEX_INTER], // String suffix, // "-DSI_COMBO", "-DSI_MAIN" (DSI_COMBO_SUFFIX, DSI_MAIN_SUFFIX)
null, // double [][] dsi, // if null - just check file exists
true); // boolean silent);
return num_slices >= 0;
}
public int restoreDSI( public int restoreDSI(
String suffix, String suffix,
...@@ -395,10 +438,15 @@ public class QuadCLTCPU { ...@@ -395,10 +438,15 @@ public class QuadCLTCPU {
} }
return -1; return -1;
} }
if (dsi == null) {
return 0; // just check file exists
}
int num_slices_read = 0; int num_slices_read = 0;
ImageStack dsi_stack = imp.getStack(); ImageStack dsi_stack = imp.getStack();
for (int nl = 0; nl < imp.getStackSize(); nl++) { for (int nl = 0; nl < imp.getStackSize(); nl++) {
for (int n = 0; n < TwoQuadCLT.DSI_SLICES.length; n++) multiformat:
{
for (int n = 0; n < TwoQuadCLT.DSI_SLICES.length; n++) {
if (TwoQuadCLT.DSI_SLICES[n].equals(dsi_stack.getSliceLabel(nl + 1))) { if (TwoQuadCLT.DSI_SLICES[n].equals(dsi_stack.getSliceLabel(nl + 1))) {
float [] fpixels = (float[]) dsi_stack.getPixels(nl + 1); float [] fpixels = (float[]) dsi_stack.getPixels(nl + 1);
dsi[n] = new double [fpixels.length]; dsi[n] = new double [fpixels.length];
...@@ -406,7 +454,21 @@ public class QuadCLTCPU { ...@@ -406,7 +454,21 @@ public class QuadCLTCPU {
dsi[n][i] = fpixels[i]; dsi[n][i] = fpixels[i];
} }
num_slices_read ++; num_slices_read ++;
break; break multiformat;
}
}
for (int n = 0; n < OpticalFlow.COMBO_DSN_TITLES.length; n++) {
if (OpticalFlow.COMBO_DSN_TITLES[n].equals(dsi_stack.getSliceLabel(nl + 1))) {
float [] fpixels = (float[]) dsi_stack.getPixels(nl + 1);
dsi[n] = new double [fpixels.length];
for (int i = 0; i < fpixels.length; i++) {
dsi[n][i] = fpixels[i];
}
num_slices_read ++;
break multiformat;
}
}
} }
} }
return num_slices_read; return num_slices_read;
...@@ -476,6 +538,7 @@ public class QuadCLTCPU { ...@@ -476,6 +538,7 @@ public class QuadCLTCPU {
public Properties restoreInterProperties( // restore properties for interscene processing (extrinsics, ers, ...) public Properties restoreInterProperties( // restore properties for interscene processing (extrinsics, ers, ...)
String path, // full name with extension or null to use x3d directory String path, // full name with extension or null to use x3d directory
boolean all_properties, boolean all_properties,
int debugLevel) int debugLevel)
{ {
if (path == null) { if (path == null) {
...@@ -505,8 +568,30 @@ public class QuadCLTCPU { ...@@ -505,8 +568,30 @@ public class QuadCLTCPU {
ers.getPropertiesLineTime(prefix, properties); // will set old value if not in the file 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);
return properties; return properties;
}
public boolean propertiesContainString (
String needle) {
return propertiesContainString (
needle,
this.properties);
}
public static boolean propertiesContainString (
String needle,
Properties properties) {
Set<String> set_keys = properties.stringPropertyNames();
boolean found = false;
for (String haystack:set_keys) {
if (haystack.indexOf(needle) >= 0) {
found = true;
break;
}
} }
return found;
}
// Moving here form QC: // Moving here form QC:
public double [][] getDSRBG (){ public double [][] getDSRBG (){
...@@ -524,7 +609,13 @@ public class QuadCLTCPU { ...@@ -524,7 +609,13 @@ public class QuadCLTCPU {
boolean updateStatus, boolean updateStatus,
int debugLevel) int debugLevel)
{ {
setDSRBG( if (this.dsi == null) {
if (debugLevel > -4) {
System.out.println ("--- No DSI available for "+this.getImageName());
}
return;
}
setDSRBG( // will likely not be used at all. Use getDLS() instead
this.dsi[is_aux?TwoQuadCLT.DSI_DISPARITY_AUX:TwoQuadCLT.DSI_DISPARITY_MAIN], this.dsi[is_aux?TwoQuadCLT.DSI_DISPARITY_AUX:TwoQuadCLT.DSI_DISPARITY_MAIN],
this.dsi[is_aux?TwoQuadCLT.DSI_STRENGTH_AUX:TwoQuadCLT.DSI_STRENGTH_MAIN], this.dsi[is_aux?TwoQuadCLT.DSI_STRENGTH_AUX:TwoQuadCLT.DSI_STRENGTH_MAIN],
this.dsi[is_aux?TwoQuadCLT.DSI_DISPARITY_AUX_LMA:TwoQuadCLT.DSI_DISPARITY_MAIN_LMA], this.dsi[is_aux?TwoQuadCLT.DSI_DISPARITY_AUX_LMA:TwoQuadCLT.DSI_DISPARITY_MAIN_LMA],
...@@ -533,6 +624,7 @@ public class QuadCLTCPU { ...@@ -533,6 +624,7 @@ public class QuadCLTCPU {
updateStatus, updateStatus,
debugLevel); debugLevel);
} }
public void setDSRBG( public void setDSRBG(
double [] disparity, double [] disparity,
double [] strength, double [] strength,
...@@ -561,17 +653,24 @@ public class QuadCLTCPU { ...@@ -561,17 +653,24 @@ public class QuadCLTCPU {
threadsMax, // maximal number of threads to launch threadsMax, // maximal number of threads to launch
updateStatus, updateStatus,
debugLevel); debugLevel);
if (rbg == null) { // will likely not be used at all. Use getDLS() instead
this.dsrbg = new double[][] {
disparity,
strength,
disparity_lma};
} else {
if (isMonochrome()) { // only [2] is non-zero if (isMonochrome()) { // only [2] is non-zero
this.dsrbg = new double[][] { this.dsrbg = new double[][] {
disparity, disparity,
strength, strength,
// disparity_lma, // disparity_lma,
((rbg.length>2)?rbg[2]:rbg[0])}; // [2] - for old compatibility, [0] - new (2021) ((rbg.length>2)?rbg[2]:rbg[0])}; // [2] - for old compatibility, [0] - new (2021)
} else { } else {
this.dsrbg = new double[][] { this.dsrbg = new double[][] {
disparity, disparity,
strength, strength,
// disparity_lma, // disparity_lma,
rbg[0],rbg[1],rbg[2]}; rbg[0],rbg[1],rbg[2]};
} }
if (debugLevel > 1) { // -2) { if (debugLevel > 1) { // -2) {
...@@ -585,9 +684,7 @@ public class QuadCLTCPU { ...@@ -585,9 +684,7 @@ public class QuadCLTCPU {
title, title,
titles); titles);
} }
}
} }
public double[][] getTileRBG( public double[][] getTileRBG(
...@@ -670,6 +767,12 @@ public class QuadCLTCPU { ...@@ -670,6 +767,12 @@ public class QuadCLTCPU {
true, // smart, true, // smart,
true); //newAllowed, // save true); //newAllowed, // save
String [] sourceFiles = correctionsParameters.selectSourceFileInSet(jp4_copy_path, debugLevel); String [] sourceFiles = correctionsParameters.selectSourceFileInSet(jp4_copy_path, debugLevel);
if (sourceFiles.length < getNumSensors()) {
if (sourceFiles.length > 0) {
System.out.println("not enough source files ("+sourceFiles.length+") in "+jp4_copy_path);
}
return null;
}
SetChannels [] set_channels=setChannels( SetChannels [] set_channels=setChannels(
null, // single set name null, // single set name
sourceFiles, sourceFiles,
...@@ -705,19 +808,32 @@ public class QuadCLTCPU { ...@@ -705,19 +808,32 @@ public class QuadCLTCPU {
1); // debugLevel); // final int debug_level) 1); // debugLevel); // final int debug_level)
} }
// try to restore DSI generated from interscene if available, if not use single-scene -DSI_MAIN // try to restore DSI generated from interscene if available, if not use single-scene -DSI_MAIN
if (restoreDSI( int dsi_result = -1;
"-DSI_INTER", double [][] dsi_tmp = new double [11][];
true // silent for (int i = 0; i <DSI_SUFFIXES.length; i++) {
) < 0) { dsi_result =restoreDSI(
restoreDSI( DSI_SUFFIXES[i],
"-DSI_MAIN", // "-DSI_COMBO", "-DSI_MAIN" (DSI_COMBO_SUFFIX, DSI_MAIN_SUFFIX) dsi_tmp, //double [][] dsi,
false); // silent (i < (DSI_SUFFIXES.length -1))); // silent
if (dsi_result >= 0) {
System.out.println ("Using "+getX3dDirectory()+ Prefs.getFileSeparator() + image_name + DSI_SUFFIXES[i] + ".tiff");
if (i < 2) { // DSI format for COMBO_DSN_INDX_* is different,
setDSIFromCombo(dsi_tmp); // reformat
} else {
setDSI(dsi_tmp); // as is
} }
break;
}
}
if (dsi_result < 0) {
System.out.println("No DSI data for the scene "+this.getImageName()+", setting this.dsi=null");
setDSI(null);
} else {
restoreInterProperties( // restore properties for interscene processing (extrinsics, ers, ...) // get relative poses (98) restoreInterProperties( // restore properties for interscene processing (extrinsics, ers, ...) // get relative poses (98)
null, // String path, // full name with extension or null to use x3d directory null, // String path, // full name with extension or null to use x3d directory
false, // boolean all_properties,// null, // Properties properties, // if null - will only save extrinsics) false, // boolean all_properties,// null, // Properties properties, // if null - will only save extrinsics)
debugLevel); debugLevel);
// showDSIMain(); }
return this; // can only be QuadCLT instance return this; // can only be QuadCLT instance
} }
...@@ -738,6 +854,12 @@ public class QuadCLTCPU { ...@@ -738,6 +854,12 @@ public class QuadCLTCPU {
true, // smart, true, // smart,
true); //newAllowed, // save true); //newAllowed, // save
String [] sourceFiles = correctionsParameters.selectSourceFileInSet(jp4_copy_path, debugLevel); String [] sourceFiles = correctionsParameters.selectSourceFileInSet(jp4_copy_path, debugLevel);
if (sourceFiles.length < getNumSensors()) {
if (sourceFiles.length > 0) {
System.out.println("not enough source files ("+sourceFiles.length+") in "+jp4_copy_path);
}
return null;
}
SetChannels [] set_channels=setChannels( SetChannels [] set_channels=setChannels(
null, // single set name null, // single set name
sourceFiles, sourceFiles,
......
...@@ -11311,7 +11311,7 @@ if (debugLevel > -100) return true; // temporarily ! ...@@ -11311,7 +11311,7 @@ if (debugLevel > -100) return true; // temporarily !
// QuadCLT last_scene = quadCLTs[last_scene_index]; // QuadCLT last_scene = quadCLTs[last_scene_index];
QuadCLT ref_scene = quadCLTs[ref_scene_index]; QuadCLT ref_scene = quadCLTs[ref_scene_index];
String composite_suffix = "-INTER-INTRA-LMA"; String composite_suffix = "-INTER-INTRA-LMA"; // is already read if available!
String num_corr_max_suffix = "-NUM-CORR-MAX"; String num_corr_max_suffix = "-NUM-CORR-MAX";
int [] wh = new int[2]; int [] wh = new int[2];
double [][] composite_ds = ref_scene.readDoubleArrayFromModelDirectory( double [][] composite_ds = ref_scene.readDoubleArrayFromModelDirectory(
...@@ -11337,7 +11337,7 @@ if (debugLevel > -100) return true; // temporarily ! ...@@ -11337,7 +11337,7 @@ if (debugLevel > -100) return true; // temporarily !
// int [] num_tiles = new int [clusters]; // may be null;; // null; // int [] num_tiles = new int [clusters]; // may be null;; // null;
// boolean [] inf_cluster = new boolean [clusters]; // null; // boolean [] inf_cluster = new boolean [clusters]; // null;
boolean debug = debugLevel > -2; boolean debug = debugLevel > -3;
if (proc_infinity) { if (proc_infinity) {
double [] inf_avg = new double[1]; double [] inf_avg = new double[1];
...@@ -11666,6 +11666,8 @@ if (debugLevel > -100) return true; // temporarily ! ...@@ -11666,6 +11666,8 @@ if (debugLevel > -100) return true; // temporarily !
final boolean updateStatus, final boolean updateStatus,
final int debugLevel) throws Exception final int debugLevel) throws Exception
{ {
if ((quadCLT_main != null) && (quadCLT_main.getGPU() != null)) { if ((quadCLT_main != null) && (quadCLT_main.getGPU() != null)) {
quadCLT_main.setQuadClt(); // ignore previous result, quadCLT_main.setQuadClt(); // ignore previous result,
} }
...@@ -11673,6 +11675,7 @@ if (debugLevel > -100) return true; // temporarily ! ...@@ -11673,6 +11675,7 @@ if (debugLevel > -100) return true; // temporarily !
quadCLT_aux.setQuadClt(); quadCLT_aux.setQuadClt();
} }
//quadCLT_main.correctionsParameters.rig_batch_adjust_main_gt
// final boolean batch_mode = clt_parameters.batch_run; // final boolean batch_mode = clt_parameters.batch_run;
// Reset dsi data (only 2 slices will be used) // Reset dsi data (only 2 slices will be used)
...@@ -11684,8 +11687,22 @@ if (debugLevel > -100) return true; // temporarily ! ...@@ -11684,8 +11687,22 @@ if (debugLevel > -100) return true; // temporarily !
this.startTime=System.nanoTime(); this.startTime=System.nanoTime();
String [] sourceFiles=quadCLT_main.correctionsParameters.getSourcePaths(); String [] sourceFiles=quadCLT_main.correctionsParameters.getSourcePaths();
QuadCLT.SetChannels [] set_channels_main = quadCLT_main.setChannels(debugLevel); boolean process_main_sources = false;
QuadCLT.SetChannels [] set_channels_aux = quadCLT_aux.setChannels(debugLevel); boolean process_aux_sources = false;
// TODO: clean up - are there duplicates
if (quadCLT_main != null) {
process_main_sources |= quadCLT_main.correctionsParameters.process_main_sources;
process_aux_sources |= quadCLT_main.correctionsParameters.process_aux_sources;
}
if (quadCLT_aux != null) {
process_aux_sources |= quadCLT_aux.correctionsParameters.process_main_sources;
process_aux_sources |= quadCLT_aux.correctionsParameters.process_aux_sources;
}
//quadCLT_main.correctionsParameters.rig_batch_adjust_main_gt
QuadCLT.SetChannels [] set_channels_main = process_main_sources? quadCLT_main.setChannels(debugLevel):null;
QuadCLT.SetChannels [] set_channels_aux = process_aux_sources? quadCLT_aux.setChannels(debugLevel):null;
QuadCLT.SetChannels [] set_channels = set_channels_main; QuadCLT.SetChannels [] set_channels = set_channels_main;
if ((set_channels == null) || ((set_channels_aux != null) && (set_channels_aux.length > set_channels.length))) { if ((set_channels == null) || ((set_channels_aux != null) && (set_channels_aux.length > set_channels.length))) {
set_channels = set_channels_aux; set_channels = set_channels_aux;
......
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