Commit c430b2f4 authored by Andrey Filippov's avatar Andrey Filippov

more cleanup

parent 95647831
......@@ -138,6 +138,9 @@ public class EyesisCorrectionParameters {
public String x3dSubdirSuffix= "";
// 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_aux = 0;
public int rig_batch_adjust_rig = 0;
......@@ -298,6 +301,10 @@ public class EyesisCorrectionParameters {
cp.x3dModelVersion= this.x3dModelVersion;
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_aux= this.rig_batch_adjust_aux;
cp.rig_batch_adjust_rig= this.rig_batch_adjust_rig;
......@@ -498,6 +505,9 @@ public class EyesisCorrectionParameters {
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_aux", this.rig_batch_adjust_aux+"");
properties.setProperty(prefix+"rig_batch_adjust_rig", this.rig_batch_adjust_rig+"");
......@@ -680,6 +690,9 @@ public class EyesisCorrectionParameters {
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_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"));
......@@ -1069,9 +1082,10 @@ public class EyesisCorrectionParameters {
gd.addStringField ("Aux x3d subdirectory suffix", this.aux_camera.x3dSubdirSuffix, 10, // 20ba
"When using timestamp as a subdirectory, add this suffix");
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 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);
......@@ -1209,7 +1223,10 @@ public class EyesisCorrectionParameters {
this.aux_camera.cltSuffix= gd.getNextString(); // 20b
this.aux_camera.x3dSubdirSuffix= gd.getNextString(); // 20ba
this.rig_batch_adjust_main = (int) gd.getNextNumber();
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_aux = (int) gd.getNextNumber();
this.rig_batch_adjust_rig = (int) gd.getNextNumber();
......
......@@ -767,7 +767,9 @@ public class CLTPass3d{
double [] strength) {
this.calc_disparity = disparity;
this.strength = strength;
calc_disparity_combo = calc_disparity.clone();
if (calc_disparity_combo != null) {
calc_disparity_combo = calc_disparity.clone();
}
}
/**
......
......@@ -30,6 +30,18 @@ import com.elphel.imagej.common.GenericJTabbedDialog;
public class IntersceneMatchParameters {
// 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
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)
......@@ -85,6 +97,28 @@ public class IntersceneMatchParameters {
public void dialogQuestions(GenericJTabbedDialog gd) {
// 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",
"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,"",
......@@ -112,7 +146,7 @@ public class IntersceneMatchParameters {
gd.addNumericField("Difference from neighbors average ", this.half_avg_diff, 5,7,"",
"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",
"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",
......@@ -173,6 +207,16 @@ public class IntersceneMatchParameters {
}
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.sensor_mask_inter= (int) gd.getNextNumber();
this.use_partial = gd.getNextBoolean();
......@@ -214,6 +258,17 @@ public class IntersceneMatchParameters {
}
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+"sensor_mask_inter", this.sensor_mask_inter+""); // int
properties.setProperty(prefix+"use_partial", this.use_partial+""); // boolean
......@@ -253,12 +308,21 @@ public class IntersceneMatchParameters {
}
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+"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+"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+"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_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"));
......@@ -294,6 +358,15 @@ public class IntersceneMatchParameters {
@Override
public IntersceneMatchParameters clone() throws CloneNotSupportedException {
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.sensor_mask_inter = this.sensor_mask_inter;
imp.use_partial = this.use_partial;
......
......@@ -238,7 +238,7 @@ public class QuadCLT extends QuadCLTCPU {
final Thread[] threads = ImageDtt.newThreadArray(threadsMax);
final AtomicInteger ai = new AtomicInteger(0);
final AtomicInteger anum_updated = new AtomicInteger(0);
final int dbg_tile = 1066;
final int dbg_tile = 1235;
anum_updated.set(0);
for (int ithread = 0; ithread < threads.length; ithread++) {
threads[ithread] = new Thread() {
......@@ -5847,7 +5847,7 @@ if (debugLevel < -100) {
{
QuadCLT quadCLT = new QuadCLT(this, set_name); //null
quadCLT.restoreNoModel(
return (QuadCLT) quadCLT.restoreNoModel(
clt_parameters,
colorProcParameters,
null, // double [] noise_sigma_level,
......@@ -5855,8 +5855,7 @@ if (debugLevel < -100) {
null, // final QuadCLTCPU ref_scene, // may be null if scale_fpn <= 0
threadsMax,
debugLevel);
return quadCLT;
// return quadCLT;
}
......
......@@ -11311,7 +11311,7 @@ if (debugLevel > -100) return true; // temporarily !
// QuadCLT last_scene = quadCLTs[last_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";
int [] wh = new int[2];
double [][] composite_ds = ref_scene.readDoubleArrayFromModelDirectory(
......@@ -11337,7 +11337,7 @@ if (debugLevel > -100) return true; // temporarily !
// int [] num_tiles = new int [clusters]; // may be null;; // null;
// boolean [] inf_cluster = new boolean [clusters]; // null;
boolean debug = debugLevel > -2;
boolean debug = debugLevel > -3;
if (proc_infinity) {
double [] inf_avg = new double[1];
......@@ -11666,6 +11666,8 @@ if (debugLevel > -100) return true; // temporarily !
final boolean updateStatus,
final int debugLevel) throws Exception
{
if ((quadCLT_main != null) && (quadCLT_main.getGPU() != null)) {
quadCLT_main.setQuadClt(); // ignore previous result,
}
......@@ -11673,6 +11675,7 @@ if (debugLevel > -100) return true; // temporarily !
quadCLT_aux.setQuadClt();
}
//quadCLT_main.correctionsParameters.rig_batch_adjust_main_gt
// final boolean batch_mode = clt_parameters.batch_run;
// Reset dsi data (only 2 slices will be used)
......@@ -11684,8 +11687,22 @@ if (debugLevel > -100) return true; // temporarily !
this.startTime=System.nanoTime();
String [] sourceFiles=quadCLT_main.correctionsParameters.getSourcePaths();
QuadCLT.SetChannels [] set_channels_main = quadCLT_main.setChannels(debugLevel);
QuadCLT.SetChannels [] set_channels_aux = quadCLT_aux.setChannels(debugLevel);
boolean process_main_sources = false;
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;
if ((set_channels == null) || ((set_channels_aux != null) && (set_channels_aux.length > set_channels.length))) {
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