Commit c325ea24 authored by Andrey Filippov's avatar Andrey Filippov

Generating combined results table

parent c8e09488
......@@ -170,6 +170,9 @@ public class ComboMatch {
double metric_error = 0.05; // 0.02;// 2 cm
boolean update_lla = false; // re-read file metadata
boolean update_kernel_patterns = false;
boolean update_bl_bc = false;
String [] suffixes_bl_bc= {"","-BL","-BC"};
int suffix_bc_bl_indx = 2;
if (!use_marked_image) {
process_correlation=false; // use already adjusted by default
}
......@@ -223,8 +226,17 @@ public class ComboMatch {
if (use_marked_image ) {
gd.addCheckbox ("Use marked image data", true, "Use markes from the selected image");
}
gd.addCheckbox ("Update files metadata", update_lla, "Re-read files metadata (if it was modified)");
gd.addCheckbox ("Update files metadata", update_lla, "Re-read files metadata (if it was modified)");
gd.addCheckbox ("Update kernels/patterns", update_kernel_patterns, "Re-read kernels and patterns from *.list file");
gd.addCheckbox ("Update BC/BL suffix", update_bl_bc,
"Change source filenames to use -BC for bicubic, -BL - for bilinear, or empty - for old bilinear files");
gd.addChoice("BL/BC suffix:",
suffixes_bl_bc,
suffixes_bl_bc[suffix_bc_bl_indx],
"Select interpolation mode of the source files: old bilinear (empty), bilinear (-BL), or bicubic (-BC)", 0);
// update_kernel_patterns
gd.showDialog();
if (gd.wasCanceled()) return false;
......@@ -273,6 +285,8 @@ public class ComboMatch {
}
update_lla= gd.getNextBoolean();
update_kernel_patterns= gd.getNextBoolean();
update_bl_bc= gd.getNextBoolean();
suffix_bc_bl_indx = gd.getNextChoiceIndex();
OrthoMapsCollection maps_collection=null;
if (use_saved_collection) {
try {
......@@ -291,6 +305,16 @@ public class ComboMatch {
maps_collection.updateNumberScenes();
maps_collection.updateSfmGain();
}
if (update_bl_bc) {
boolean OK = updateBlBcFileNames(
suffixes_bl_bc[suffix_bc_bl_indx], // String suffix,
"-FLAT",// String before,
maps_collection); // OrthoMapsCollection maps_collection)
if (!OK) {
System.out.println("Failed to update filenames for different interpolation mode");
}
}
String [] names = maps_collection.getNames(); // null
if (object_list != null) {
int corr_size = 128;
......@@ -955,6 +979,35 @@ public class ComboMatch {
return true;
}
public static boolean updateBlBcFileNames(
String suffix,
String before,
OrthoMapsCollection maps_collection) {
String [] filenames = new String [maps_collection.ortho_maps.length];
for (int i = 0; i < filenames.length; i++) {
filenames[i] = maps_collection.ortho_maps[i].getFileName(); // getName();
}
String [] old_names = filenames.clone();
for (int i = 0; i < filenames.length; i++) {
int insert_indx = filenames[i].indexOf(before);
if (insert_indx < 0) {
System.out.println("updateBlBcFileNames(): no substring '"+
before+"' in filename "+filenames[i]);
return false;
}
String stail = filenames[i].substring(insert_indx);
String prefix = filenames[i].substring(0, insert_indx);
if (prefix.endsWith("-BL") || prefix.endsWith("-BC")) {
prefix = prefix.substring(0, insert_indx - "-BC".length());
}
filenames[i] = prefix + suffix + stail;
}
for (int i = 0; i < filenames.length; i++) {
maps_collection.ortho_maps[i].setFileName(filenames[i]);
}
return true;
}
/*
double [][] affine1 = {
......
......@@ -462,6 +462,31 @@ public class OrthoMap implements Comparable <OrthoMap>, Serializable{
public String getName() {
return name;
}
public String getPath() {
return path;
}
public void setPath(String path) {
this.path = path;
}
public String getFileName() {
int p1 = path.lastIndexOf(Prefs.getFileSeparator());
if (p1 < 0) {
return null;
}
return path.substring(p1+1);
}
public boolean setFileName(String filename) {
int p1 = path.lastIndexOf(Prefs.getFileSeparator());
if (p1 < 0) {
return false;
}
path= path.substring(0, p1+1) + filename;
return true;
}
public void setAffine(double [][] affine) {
this.affine = affine;
}
......
......@@ -65,13 +65,14 @@ public class OrthoMapsParameters {
public boolean corr_centered; // re-correlate first scene centered at candidates
public int debugLevel;
public String save_top_dir;
public String sub_dir;
public String sub_dir; // also the bas of the name to save combined results
public boolean show_images;
public boolean show_final_image;
public boolean save_images;
public boolean show_results;
public boolean append_log;
public String alt_mode;
public boolean results_multi; // save multiple scenes result in the same file
public OrthoMapsParameters() {
setDefaults();
......@@ -119,7 +120,7 @@ public class OrthoMapsParameters {
convolve_after = false; // true for old kernel tuning (kernel decimation before convolution)
corr_centered = true; // re-correlate first scene centered at candidates
save_top_dir = "/media/elphel/NVME/lwir16-proc/ortho_videos/debug/sept12-13/pattern_match/";
sub_dir = "dbg_recenter_07";
sub_dir = "bicubic_01";
show_images = false;
show_final_image = true;
save_images = true;
......@@ -129,6 +130,7 @@ public class OrthoMapsParameters {
append_log = true;
alt_mode= "??m";
debugLevel = 0;
results_multi = true;
}
public void setDefaults50() {
......@@ -163,7 +165,8 @@ public class OrthoMapsParameters {
lpf_sigma = new double [] {0.25, 0.25};
phaseCoeff = new double [] {0.95, 0.95};
// min_corrs[0] = 0.0119;
min_corrs = new double[]{0.0090,0.008}; // A1: .0654
// min_corrs = new double[]{0.0090,0.008}; // A1: .0654
min_corrs = new double[]{0.0087,0.008}; // A1: .0654
abs_edge_frac = 0.35;
abs_oversize = 2.2;
filt_abs_contrast = 75; // 70;
......@@ -173,7 +176,7 @@ public class OrthoMapsParameters {
// parameters for force round
abs_force_round = true;
filt_roundness[0] = 0.56; // 0.55;
filt_best[0] = 0.009; //****** tune, this one is inactive
filt_best[0] = 0.0087; // 0.009; //****** tune, this one is inactive
filt_max_radius = new double [][] {{0.35,0.2},{0.35,0.2}}; // {1.0,1.0}}; // [second/main][full/half] - inactive now
filt_elongation = new double [][] {{1.45,1.55},{1.45,1.55}}; // [second/main][full/half] ellipse axis ratio
filt_other_rad = 25; // should be no disconnected high peaks in this radius (only for halves multiplied)
......@@ -281,6 +284,7 @@ public class OrthoMapsParameters {
gd.addCheckbox ("Append results table", append_table,"Append results table.");
gd.addCheckbox ("Date/time when appending", table_datetime, "Include date/time when appending results.");
gd.addCheckbox ("Write to log", append_log, "Append log file.");
gd.addCheckbox ("Save multi-scene results", results_multi, "Save multi-scene results to a single table.");
//
gd.addNumericField("Debug level", debugLevel, 0,4,"", "Debug level.");
gd.showDialog();
......@@ -348,6 +352,7 @@ public class OrthoMapsParameters {
append_table= gd.getNextBoolean();
table_datetime= gd.getNextBoolean();
append_log= gd.getNextBoolean();
results_multi = gd.getNextBoolean();
debugLevel= (int) gd.getNextNumber();
setSaveDir(
indices, // int [] indices,
......@@ -380,6 +385,7 @@ public class OrthoMapsParameters {
}
}
public void printReport(
boolean gen_results,
boolean gen_parameters,
......@@ -784,6 +790,21 @@ public class OrthoMapsParameters {
sb.append("\n");
sb.append(sb_body_params);
}
if (save && results_multi) { // no date stamp
String multi_path = save_top_dir;
if (!multi_path.endsWith(Prefs.getFileSeparator())) {
multi_path+= Prefs.getFileSeparator();
}
multi_path += sub_dir+RESULTS_SUFFIX;
CalibrationFileManagement.saveStringToFile (
multi_path, //String path,
sb.toString(), // data,
append_table); // boolean append)
if (debugLevel > -4) {
System.out.println ("Results appended to "+multi_path);
}
}
if (save_images && save && (gen_results || gen_parameters)) {
StringBuffer sb1 = new StringBuffer();
if (table_datetime && append_table) {
......
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