Commit 9d47b1c6 authored by Andrey Filippov's avatar Andrey Filippov

Implemented augmentPairwiseAffines() to add more pairwise matches

after all scenes are matched and have defined affines
parent ef8c6ac2
...@@ -164,6 +164,7 @@ public class ComboMatch { ...@@ -164,6 +164,7 @@ public class ComboMatch {
boolean show_combo = false; // true; boolean show_combo = false; // true;
boolean create_pairwise_matches = false; boolean create_pairwise_matches = false;
boolean create_pairwise_affines = false; boolean create_pairwise_affines = false;
boolean augment_pairwise_affines = false; // needs to repeat create_pairwise_matches to update overlaps
boolean equalize_overlaps = false; boolean equalize_overlaps = false;
boolean create_map = false; boolean create_map = false;
boolean create_equalize = false; boolean create_equalize = false;
...@@ -240,6 +241,7 @@ public class ComboMatch { ...@@ -240,6 +241,7 @@ public class ComboMatch {
gd.addCheckbox ("Show combo maps/stats", show_combo, "Generate/save combo maps and stats."); gd.addCheckbox ("Show combo maps/stats", show_combo, "Generate/save combo maps and stats.");
gd.addCheckbox ("Create overlap pairs", create_pairwise_matches, "Create scene pairs overlaps."); gd.addCheckbox ("Create overlap pairs", create_pairwise_matches, "Create scene pairs overlaps.");
gd.addCheckbox ("Create pairwise affines", create_pairwise_affines, "Create affines for scene pairs."); gd.addCheckbox ("Create pairwise affines", create_pairwise_affines, "Create affines for scene pairs.");
gd.addCheckbox ("Augment pairwise affines", augment_pairwise_affines, "Augment pairwise affines after building initial map and re-running create_pairwise_matches.");
gd.addCheckbox ("Equalize overlap pairs", equalize_overlaps, "Equalize intensities in overlaps."); gd.addCheckbox ("Equalize overlap pairs", equalize_overlaps, "Equalize intensities in overlaps.");
gd.addCheckbox ("Create map", create_map, "Create combined map from pairwise matches."); gd.addCheckbox ("Create map", create_map, "Create combined map from pairwise matches.");
gd.addCheckbox ("Equalize intensities", create_equalize, "Create map intensities equalization from pairwise matches."); gd.addCheckbox ("Equalize intensities", create_equalize, "Create map intensities equalization from pairwise matches.");
...@@ -305,6 +307,7 @@ public class ComboMatch { ...@@ -305,6 +307,7 @@ public class ComboMatch {
show_combo = gd.getNextBoolean(); show_combo = gd.getNextBoolean();
create_pairwise_matches = gd.getNextBoolean(); create_pairwise_matches = gd.getNextBoolean();
create_pairwise_affines = gd.getNextBoolean(); create_pairwise_affines = gd.getNextBoolean();
augment_pairwise_affines = gd.getNextBoolean();
equalize_overlaps = gd.getNextBoolean(); equalize_overlaps = gd.getNextBoolean();
create_map = gd.getNextBoolean(); create_map = gd.getNextBoolean();
create_equalize = gd.getNextBoolean(); create_equalize = gd.getNextBoolean();
...@@ -823,17 +826,22 @@ public class ComboMatch { ...@@ -823,17 +826,22 @@ public class ComboMatch {
return ok; // Just exit, do not try other commands. if (!ok) return false; return ok; // Just exit, do not try other commands. if (!ok) return false;
} }
if (create_pairwise_affines) { if (augment_pairwise_affines) {
// boolean ok =maps_collection.getIntersectedPairs( boolean ok =maps_collection.augmentPairwiseAffines(
// clt_parameters, // CLTParameters clt_parameters, clt_parameters, // CLTParameters clt_parameters,
// orthoMapsCollection_savepath); // String orthoMapsCollection_path); orthoMapsCollection_savepath); // String orthoMapsCollection_path);
return ok; // Just exit, do not try other commands. if (!ok) return false;
}
if (create_pairwise_affines) {
boolean ok =maps_collection.generatePairwiseAffines( boolean ok =maps_collection.generatePairwiseAffines(
clt_parameters, // CLTParameters clt_parameters, clt_parameters, // CLTParameters clt_parameters,
orthoMapsCollection_savepath); // String orthoMapsCollection_path); orthoMapsCollection_savepath); // String orthoMapsCollection_path);
return ok; // Just exit, do not try other commands. if (!ok) return false; return ok; // Just exit, do not try other commands. if (!ok) return false;
} }
if (equalize_overlaps) { if (equalize_overlaps) {
boolean ok =maps_collection.equalizeIntersectedPairs( boolean ok =maps_collection.equalizeIntersectedPairs(
clt_parameters, // CLTParameters clt_parameters, clt_parameters, // CLTParameters clt_parameters,
...@@ -876,9 +884,14 @@ public class ComboMatch { ...@@ -876,9 +884,14 @@ public class ComboMatch {
double flt_min_rms = clt_parameters.imp.flt_min_rms; // 0.0; double flt_min_rms = clt_parameters.imp.flt_min_rms; // 0.0;
double flt_max_rms = clt_parameters.imp.flt_max_rms; // 2.0; double flt_max_rms = clt_parameters.imp.flt_max_rms; // 2.0;
boolean flt_nan_rms = clt_parameters.imp.flt_nan_rms; // false; boolean flt_nan_rms = clt_parameters.imp.flt_nan_rms; // false;
boolean flt_filt_zoom = clt_parameters.imp.flt_filt_zoom; // true;
int flt_min_zoom = clt_parameters.imp.flt_min_zoom; // -2;
int flt_max_zoom = clt_parameters.imp.flt_max_zoom; // 10;
boolean flt_show_names = clt_parameters.imp.flt_show_names; // true; boolean flt_show_names = clt_parameters.imp.flt_show_names; // true;
boolean flt_show_overlaps = clt_parameters.imp.flt_show_overlaps; // true; boolean flt_show_overlaps = clt_parameters.imp.flt_show_overlaps; // true;
boolean flt_show_rms = clt_parameters.imp.flt_show_rms; // true; boolean flt_show_rms = clt_parameters.imp.flt_show_rms; // true;
boolean flt_show_zoom = clt_parameters.imp.flt_show_zoom; // true;
boolean flt_update_config = false; boolean flt_update_config = false;
String flt_extra_line = "--- select a single image ---"; String flt_extra_line = "--- select a single image ---";
GenericJTabbedDialog gdf = new GenericJTabbedDialog("Select pairs filter/display",800,500); GenericJTabbedDialog gdf = new GenericJTabbedDialog("Select pairs filter/display",800,500);
...@@ -889,9 +902,15 @@ public class ComboMatch { ...@@ -889,9 +902,15 @@ public class ComboMatch {
gdf.addNumericField("Minimal RMSE", flt_min_rms, 3,7,"", "Minimal LMA RMSE of the scene pair."); gdf.addNumericField("Minimal RMSE", flt_min_rms, 3,7,"", "Minimal LMA RMSE of the scene pair.");
gdf.addNumericField("Maximal RMSE", flt_max_rms, 3,7,"", "Maximal LMA RMSE of the scene pair."); gdf.addNumericField("Maximal RMSE", flt_max_rms, 3,7,"", "Maximal LMA RMSE of the scene pair.");
gdf.addCheckbox ("NaN RMS (failed match)", flt_nan_rms, "Keep only failed matches with RMSE=NaN."); gdf.addCheckbox ("NaN RMS (failed match)", flt_nan_rms, "Keep only failed matches with RMSE=NaN.");
gdf.addCheckbox ("Filter by zoom level" , flt_filt_zoom, "Filter by the zoom level used for matching.");
gdf.addNumericField("Minimal zoom", flt_min_zoom, 0,3,"","Minimal zoom level used for matching.");
gdf.addNumericField("Maximal zoom", flt_max_zoom, 0,3,"","Maximal zoom level used for matching.");
gdf.addCheckbox ("Show scene names", flt_show_names, "Show scene full names (timestamps) in selection drop-down list."); gdf.addCheckbox ("Show scene names", flt_show_names, "Show scene full names (timestamps) in selection drop-down list.");
gdf.addCheckbox ("Show scene overlaps", flt_show_overlaps, "Show scene overlaps (in percents) in selection drop-down list."); gdf.addCheckbox ("Show scene overlaps", flt_show_overlaps, "Show scene overlaps (in percents) in selection drop-down list.");
gdf.addCheckbox ("Show pairs RMSE", flt_show_rms, "Show scene match RMSE in selection drop-down list."); gdf.addCheckbox ("Show pairs RMSE", flt_show_rms, "Show scene match RMSE in selection drop-down list.");
gdf.addCheckbox ("Show zoom level", flt_show_zoom, "Show zoom level.");
gdf.addCheckbox ("Update configuration", flt_update_config, "Update matching configuration parameters to be saved as defaults."); gdf.addCheckbox ("Update configuration", flt_update_config, "Update matching configuration parameters to be saved as defaults.");
gdf.showDialog(); gdf.showDialog();
if (gdf.wasCanceled()) return false; if (gdf.wasCanceled()) return false;
...@@ -902,6 +921,10 @@ public class ComboMatch { ...@@ -902,6 +921,10 @@ public class ComboMatch {
flt_min_rms = gdf.getNextNumber(); flt_min_rms = gdf.getNextNumber();
flt_max_rms = gdf.getNextNumber(); flt_max_rms = gdf.getNextNumber();
flt_nan_rms = gdf.getNextBoolean(); flt_nan_rms = gdf.getNextBoolean();
flt_filt_zoom = gdf.getNextBoolean();
flt_min_zoom =(int) gdf.getNextNumber();
flt_max_zoom =(int) gdf.getNextNumber();
flt_show_names = gdf.getNextBoolean(); flt_show_names = gdf.getNextBoolean();
flt_show_overlaps = gdf.getNextBoolean(); flt_show_overlaps = gdf.getNextBoolean();
flt_show_rms = gdf.getNextBoolean(); flt_show_rms = gdf.getNextBoolean();
...@@ -914,9 +937,13 @@ public class ComboMatch { ...@@ -914,9 +937,13 @@ public class ComboMatch {
clt_parameters.imp.flt_min_rms = flt_min_rms; clt_parameters.imp.flt_min_rms = flt_min_rms;
clt_parameters.imp.flt_max_rms = flt_max_rms; clt_parameters.imp.flt_max_rms = flt_max_rms;
clt_parameters.imp.flt_nan_rms = flt_nan_rms; clt_parameters.imp.flt_nan_rms = flt_nan_rms;
clt_parameters.imp.flt_filt_zoom = flt_filt_zoom;
clt_parameters.imp.flt_min_zoom = flt_min_zoom;
clt_parameters.imp.flt_max_zoom = flt_max_zoom;
clt_parameters.imp.flt_show_names = flt_show_names; clt_parameters.imp.flt_show_names = flt_show_names;
clt_parameters.imp.flt_show_overlaps = flt_show_overlaps; clt_parameters.imp.flt_show_overlaps = flt_show_overlaps;
clt_parameters.imp.flt_show_rms = flt_show_rms; clt_parameters.imp.flt_show_rms = flt_show_rms;
clt_parameters.imp.flt_show_zoom = flt_show_zoom;
} }
if (flt_list) { if (flt_list) {
...@@ -927,7 +954,10 @@ public class ComboMatch { ...@@ -927,7 +954,10 @@ public class ComboMatch {
flt_max_overlap, // double max_overlap, flt_max_overlap, // double max_overlap,
flt_min_rms, // double min_rms, flt_min_rms, // double min_rms,
flt_max_rms, // double max_rms, flt_max_rms, // double max_rms,
flt_nan_rms); // boolean nan_rms) flt_nan_rms, // boolean nan_rms)
flt_filt_zoom, // boolean filt_zoom,
flt_min_zoom, // int min_zoom,
flt_max_zoom); // int max_zoom)
} }
String [] choices_all = maps_collection.textPairs ( String [] choices_all = maps_collection.textPairs (
...@@ -935,19 +965,9 @@ public class ComboMatch { ...@@ -935,19 +965,9 @@ public class ComboMatch {
flt_show_names, // boolean show_names, flt_show_names, // boolean show_names,
flt_show_overlaps, // boolean show_overlap, flt_show_overlaps, // boolean show_overlap,
flt_show_rms, // boolean show_rms, flt_show_rms, // boolean show_rms,
flt_show_zoom, // boolean show_zoom,
flt_extra_line); // String extra_line) flt_extra_line); // String extra_line)
/*
String [] choices = getPairChoices(
available_pairs, // int [][] pairs,
names); // String [] names)
String [] choices_all = new String[choices.length+1];
System.arraycopy(choices, 0, choices_all, 0, choices.length);
choices_all[choices_all.length-1] = "--- select a single image ---";
*/
GenericJTabbedDialog gdc = new GenericJTabbedDialog("Select image pair",1200,100); GenericJTabbedDialog gdc = new GenericJTabbedDialog("Select image pair",1200,100);
int num_choice_lines = 50; int num_choice_lines = 50;
gdc.addChoice("Image pair:", gdc.addChoice("Image pair:",
...@@ -1220,6 +1240,9 @@ public class ComboMatch { ...@@ -1220,6 +1240,9 @@ public class ComboMatch {
} }
return true; return true;
} }
public static PairwiseOrthoMatch initialPairAdjust( public static PairwiseOrthoMatch initialPairAdjust(
CLTParameters clt_parameters, CLTParameters clt_parameters,
OrthoMapsCollection maps_collection, OrthoMapsCollection maps_collection,
......
...@@ -22,6 +22,7 @@ import java.util.ArrayList; ...@@ -22,6 +22,7 @@ import java.util.ArrayList;
import java.util.Arrays; import java.util.Arrays;
import java.util.Calendar; import java.util.Calendar;
import java.util.Collections; import java.util.Collections;
import java.util.Comparator;
import java.util.HashMap; import java.util.HashMap;
import java.util.HashSet; import java.util.HashSet;
import java.util.List; import java.util.List;
...@@ -5131,6 +5132,277 @@ public class OrthoMapsCollection implements Serializable{ ...@@ -5131,6 +5132,277 @@ public class OrthoMapsCollection implements Serializable{
return true; return true;
} }
/**
* Add new scene pairs from the already adjusted scenes
* @param clt_parameters
* @param orthoMapsCollection_path
* @return
*/
public boolean augmentPairwiseAffines(
CLTParameters clt_parameters,
String orthoMapsCollection_path) {
// Create list of all pairs (after recreating all overlaps with updated affines)
ArrayList<Point> pairs_list = new ArrayList<Point>();
for (OrthoMap map : ortho_maps) {
for (String other_name: map.pairwise_matches.keySet()) {
pairs_list.add(new Point(
getIndex(map.getName()),
getIndex(other_name)));
}
}
// sort pairs_list by x then y
Collections.sort(pairs_list, new Comparator<Point>() {
@Override
public int compare(Point lhs, Point rhs) {
return (rhs.x > lhs.x) ? -1 : (rhs.x < lhs.x) ? 1 :
((rhs.y > lhs.y) ? -1 : (rhs.y < lhs.y) ? 1 : 0); // increasing
}
});
// convert ArrayList<Point> to array int[][]
int [][] available_pairs = new int [pairs_list.size()][2];
for (int i = 0; i < available_pairs.length; i++) {
available_pairs[i][0] = pairs_list.get(i).x;
available_pairs[i][1] = pairs_list.get(i).y;
}
boolean flt_undef_only = false; // clt_parameters.imp.flt_undef_only; // false;
double flt_min_overlap = clt_parameters.imp.flt_min_overlap; // 0.0;
double flt_max_overlap = clt_parameters.imp.flt_max_overlap; // 1.0;
double flt_min_rms = 0; // clt_parameters.imp.flt_min_rms; // 0.0;
double flt_max_rms = 2.0; // clt_parameters.imp.flt_max_rms; // 2.0;
boolean flt_filt_zoom = clt_parameters.imp.flt_filt_zoom; // true;
int flt_min_zoom = clt_parameters.imp.flt_min_zoom; // -2;
int flt_max_zoom = clt_parameters.imp.flt_max_zoom; // 10;
boolean flt_nan_rms = true; // clt_parameters.imp.flt_nan_rms; // false;
boolean flt_show_names = true; // clt_parameters.imp.flt_show_names; // true;
boolean flt_show_overlaps = true; // clt_parameters.imp.flt_show_overlaps; // true;
boolean flt_show_rms = true; // clt_parameters.imp.flt_show_rms; // true;
boolean flt_show_zoom = true; // clt_parameters.imp.flt_show_zoom; // true;
//Initial spiral search for image matching
boolean ospir_augment = clt_parameters.imp.ospir_augment; // true
double max_rms = clt_parameters.imp.ospir_max_rms; // 0.35; //
double max_rms_refine = clt_parameters.imp.pwise_max_rms; // 0.35; //
int min_overlap_tiles = clt_parameters.imp.ospir_overlap; // 3000; // do not try to match if there is too small overlap (scaled pixels)
double double_threshold = clt_parameters.imp.ospir_double; // increase resolution if too small overlap in tiles
int num_iter_lma = clt_parameters.imp.ospir_num_iter; // 5;
double [] max_rms_iter = clt_parameters.imp.ospir_rms_iter; // {1.0, 0.6};//
boolean lores_ignore_rms = clt_parameters.imp.ospir_ignore_rms; // false
//Final pairwise scenes matching
double frac_remove = clt_parameters.imp.pmtch_frac_remove;// 0.15;
double metric_err = clt_parameters.imp.pmtch_metric_err;// 0.05; // 0.02;// 2 cm
// boolean pmtch_use_affine = clt_parameters.imp.pmtch_use_affine;
double max_std = clt_parameters.imp.pmtch_max_std;// 1.5; // maximal standard deviation to limit center area
double min_std_rad = clt_parameters.imp.pmtch_min_std_rad;// 2.0; // minimal radius of the central area (if less - fail)
boolean ignore_prev_rms = clt_parameters.imp.pmtch_ignore_rms;// true;
int num_tries = clt_parameters.imp.pmtch_num_iter;// 10;
double rad_fraction = clt_parameters.imp.pmtch_cent_rad; // center circle radius fraction of 0.5* min(width, height) in tiles
double max_tile_rad = clt_parameters.imp.pmtch_max_cent_rad;// maximal center radius in tiles (limit pmtch_cent_rad)
double fill_fraction = clt_parameters.imp.pmtch_cent_fill; // should be populated not less than this
double fill_fraction_final = clt_parameters.imp.pmtch_cent_final; // should be populated not less than this during final pass
double ease_nosfm = clt_parameters.imp.pmtch_ease_nosfm; // ease metric_error when no SfM gain == 0;
int min_scene = 0;
double pull_skew = clt_parameters.imp.pmtch_pull_skew; // ~rotation, = 0 fraction of the total weight == 1
double pull_tilt = clt_parameters.imp.pmtch_pull_tilt; // > 0
double pull_scale = clt_parameters.imp.pmtch_pull_scale; // = 0
// log/save parameters
boolean save_each = clt_parameters.imp.pwise_save_each; // save state file after each match
boolean log_append = clt_parameters.imp.pwise_log_append; //
String log_path = clt_parameters.imp.pwise_log_path; //
int debugLevel = clt_parameters.imp.pwise_debug; //
boolean flt_update_config = false;
GenericJTabbedDialog gdf = new GenericJTabbedDialog("Select pairs filter/display",800,1100);
gdf.addMessage("Filter pairs parameters");
gdf.addNumericField("Minimal scene overlap (0..1)",flt_min_overlap, 3,7,"", "Minimal overlap of the scenes to keep (0-no overlap, 1.0 - smaller scene is inside the parger one.");
gdf.addNumericField("Maximal scene overlap (0..1)",flt_max_overlap, 3,7,"", "Maximal overlap of the scenes to keep (0-no overlap, 1.0 - smaller scene is inside the parger one.");
gdf.addCheckbox ("Filter by zoom level" , flt_filt_zoom, "Filter by the zoom level used for matching.");
gdf.addNumericField("Minimal zoom", flt_min_zoom, 0,3,"","Minimal zoom level used for matching.");
gdf.addNumericField("Maximal zoom", flt_max_zoom, 0,3,"","Maximal zoom level used for matching.");
gdf.addMessage("Low-resolution match parameters");
gdf.addCheckbox ("Use low-res in augmentation", ospir_augment, "Use low-res matching during augmenting (false - skip, go to high-res).");
gdf.addNumericField("Good RMSE, low-res", max_rms, 3,7,"scaled pix", "Maximal RMSE to consider match, in scaled pixels, during spiral.");
gdf.addNumericField("Good RMSE, final", max_rms_refine,3,7,"scaled pix", "Maximal RMSE to consider match, in scaled pixels, during refine.");
gdf.addNumericField("Minimal overlap", min_overlap_tiles, 0,4,"scaled pix ^ 2","Minimal overlap area in square scaled pixels.");
gdf.addNumericField("Mitigate small overlap", double_threshold, 3,7,"","For small overlaps increase zoom by 1 and range - twice.");
gdf.addNumericField("LMA iterations", num_iter_lma, 0,2,"", "Number of LMA iterations during spiral search.");
gdf.addNumericField("RMSE at first iteration", max_rms_iter[0], 3,7,"scaled pix","Maximal RMSE at first iteration.");
gdf.addNumericField("RMSE at second iteration", max_rms_iter[1], 3,7,"scaled pix","Maximal RMSE at second iteration.");
gdf.addCheckbox ("Ignore worsening low-res RMSE",lores_ignore_rms, "Ignore worsening/not improving RMSE low-res matching.");
gdf.addMessage ("Final (high-res) pairwise scenes matching");
gdf.addNumericField("Remove fraction of worst matches", frac_remove, 3,7,"", "When fitting scenes remove this fraction of worst match tiles.");
gdf.addNumericField("Maximal metric error", metric_err, 3,7,"m", "Maximal tolerable fitting error caused by elevation variations.");
// gdf.addCheckbox ("Use scenes' affine", pmtch_use_affine, "Use known scenes' affine matrices, false - start from scratch (unity) ones.");
gdf.addNumericField("Central area standard deviation", max_std, 3,7,"", "Central area limit by the standard deviation.");
gdf.addNumericField("Central area minimal radius", min_std_rad, 3,7,"tile", "Minimal radius of the central area after all LMA passes.");
gdf.addCheckbox ("Ignore previous RMSE", ignore_prev_rms, "Do not exit full fitting cycles if the RMSE worsened/not improved.");
gdf.addNumericField("Number of fitting iterations", num_tries, 0,3,"","number of full fittng iterations.");
gdf.addNumericField("Central area radius as fraction", rad_fraction, 3,7,"", "Central area radius as fraction of half minimal WOI dimension.");
gdf.addNumericField("Maximal central area radius", max_tile_rad, 3,7,"tiles", "Absolute limit to the center area radius (eases bad peripheral matching).");
gdf.addNumericField("Central area minimal fill", fill_fraction, 3,7,"", "Central area minimal fill for all but the last iteration.");
gdf.addNumericField("Central area minimal fill final", fill_fraction_final, 3,7,"", "Central area minimal fill for the last iteration.");
gdf.addNumericField("Relax metric error for no-SfM", ease_nosfm, 3,7,"", "Relax metric error for no-SfM scenes (sfm_gain==0).");
gdf.addNumericField("Pull skew (rotation)", pull_skew, 3,7,"", "Prevent pairwise match from rotation.");
gdf.addNumericField("Pull tilt", pull_tilt, 3,7,"", "Prevent pairwise match from tilt.");
gdf.addNumericField("Pull scale", pull_scale, 3,7,"", "Prevent pairwise match from scaling.");
gdf.addMessage("Log and Save, and Debug parameters");
gdf.addCheckbox ("Save state after each match", save_each, "Update state file after each match generation to mitigate possible crashes.");
gdf.addCheckbox ("Write log file", log_append, "Enable writing log file with matching results.");
gdf.addStringField ("Log file full path", log_path, 150, "Path of the log file to be appended.");
gdf.addNumericField("Debug level", debugLevel, 0,3,"","Debug level during Spiral search.");
gdf.addNumericField("Start scene (skip all earlier)", min_scene, 0,3,"","To be able to continue skipping some.");
gdf.addCheckbox ("Update configuration", flt_update_config, "Update matching configuration parameters to be saved as defaults.");
gdf.showDialog();
if (gdf.wasCanceled()) return false;
flt_min_overlap = gdf.getNextNumber();
flt_max_overlap = gdf.getNextNumber();
flt_filt_zoom = gdf.getNextBoolean();
flt_min_zoom = (int) gdf.getNextNumber();
flt_max_zoom = (int) gdf.getNextNumber();
ospir_augment = gdf.getNextBoolean();
max_rms = gdf.getNextNumber();
max_rms_refine = gdf.getNextNumber();
min_overlap_tiles = (int) gdf.getNextNumber();
double_threshold = gdf.getNextNumber();
num_iter_lma = (int) gdf.getNextNumber();
max_rms_iter[0] = gdf.getNextNumber();
max_rms_iter[1] = gdf.getNextNumber();
lores_ignore_rms = gdf.getNextBoolean();
frac_remove = gdf.getNextNumber();
metric_err = gdf.getNextNumber();
// pmtch_use_affine= gdf.getNextBoolean();
max_std = gdf.getNextNumber();
min_std_rad = gdf.getNextNumber();
ignore_prev_rms = gdf.getNextBoolean();
num_tries = (int) gdf.getNextNumber();
rad_fraction = gdf.getNextNumber();
max_tile_rad = gdf.getNextNumber();
fill_fraction = gdf.getNextNumber();
fill_fraction_final= gdf.getNextNumber();
ease_nosfm = gdf.getNextNumber();
pull_skew = gdf.getNextNumber();
pull_tilt = gdf.getNextNumber();
pull_scale = gdf.getNextNumber();
save_each = gdf.getNextBoolean();
log_append = gdf.getNextBoolean();
log_path = gdf.getNextString();
debugLevel = (int) gdf.getNextNumber();
min_scene = (int) gdf.getNextNumber();
flt_update_config = gdf.getNextBoolean();
if (flt_update_config) {
clt_parameters.imp.flt_min_overlap = flt_min_overlap;
clt_parameters.imp.flt_max_overlap = flt_max_overlap;
clt_parameters.imp.flt_filt_zoom = flt_filt_zoom;
clt_parameters.imp.flt_min_zoom = flt_min_zoom;
clt_parameters.imp.flt_max_zoom = flt_max_zoom;
clt_parameters.imp.ospir_augment = ospir_augment;
clt_parameters.imp.ospir_max_rms = max_rms;
clt_parameters.imp.pwise_max_rms = max_rms_refine;
clt_parameters.imp.ospir_overlap = min_overlap_tiles;
clt_parameters.imp.ospir_double = double_threshold;
clt_parameters.imp.ospir_num_iter = num_iter_lma;
clt_parameters.imp.ospir_rms_iter = max_rms_iter;
clt_parameters.imp.ospir_ignore_rms = lores_ignore_rms;
clt_parameters.imp.pmtch_frac_remove = frac_remove;
clt_parameters.imp.pmtch_metric_err = metric_err;
// clt_parameters.imp.pmtch_use_affine = pmtch_use_affine;
clt_parameters.imp.pmtch_max_std = max_std;
clt_parameters.imp.pmtch_min_std_rad = min_std_rad;
clt_parameters.imp.pmtch_ignore_rms = ignore_prev_rms;
clt_parameters.imp.pmtch_num_iter = num_tries;
clt_parameters.imp.pmtch_cent_rad = rad_fraction;
clt_parameters.imp.pmtch_max_cent_rad = max_tile_rad;
clt_parameters.imp.pmtch_cent_fill = fill_fraction;
clt_parameters.imp.pmtch_cent_final = fill_fraction_final;
clt_parameters.imp.pmtch_ease_nosfm = ease_nosfm;
clt_parameters.imp.pmtch_pull_skew = pull_skew;
clt_parameters.imp.pmtch_pull_tilt = pull_tilt;
clt_parameters.imp.pmtch_pull_scale = pull_scale;
clt_parameters.imp.pwise_save_each = save_each;
clt_parameters.imp.pwise_log_append = log_append;
clt_parameters.imp.pwise_log_path = log_path;
clt_parameters.imp.pwise_debug = debugLevel;
}
available_pairs = filterPairs(
available_pairs, // int [][] plist_in,
flt_undef_only, // boolean undef_only,
flt_min_overlap, // double min_overlap,
flt_max_overlap, // double max_overlap,
flt_min_rms, // double min_rms,
flt_max_rms, // double max_rms,
flt_nan_rms, // boolean nan_rms)
flt_filt_zoom, // boolean filt_zoom,
flt_min_zoom, // int min_zoom,
flt_max_zoom); // int max_zoom)
String [] choices_all = textPairs (
available_pairs, // int [][] plist,
flt_show_names, // boolean show_names,
flt_show_overlaps, // boolean show_overlap,
flt_show_rms, // boolean show_rms,
flt_show_zoom, // boolean show_zoom,
null); // String extra_line)
if (debugLevel > 0) {
System.out.println("Selected "+available_pairs.length+" scene pairs for matching");
for (int i = 0; i < available_pairs.length; i++) {
System.out.println(String.format("%4d:%s",i,choices_all[i]));
}
}
if (available_pairs.length == 0) {
return false;
}
return augmentPairwiseAffines(
clt_parameters, // CLTParameters clt_parameters,
available_pairs, // int [][] available_pairs,
//Initial spiral search for image matching
ospir_augment, // boolean ospir_augment,
max_rms, // double max_rms,
max_rms_refine, // double max_rms_refine,
min_overlap_tiles, // int min_overlap_tiles,
double_threshold, // double double_threshold,
num_iter_lma, // int num_iter_lma,
max_rms_iter, // double [] max_rms_iter,
lores_ignore_rms, // boolean lores_ignore_rms
//Final pairwise scenes matching
frac_remove, // double frac_remove,
metric_err, // double metric_error,
// pmtch_use_affine, // boolean pmtch_use_affine,
max_std, // double max_std,
min_std_rad, // double min_std_rad,
ignore_prev_rms, // boolean ignore_prev_rms,
num_tries, // int num_tries,
rad_fraction, // double rad_fraction,
max_tile_rad, // double max_tile_rad,
fill_fraction, // double fill_fraction,
fill_fraction_final, // double fill_fraction_final,
ease_nosfm, // double ease_nosfm,
min_scene, // int min_scene,
pull_skew, // double pull_skew,
pull_tilt, // double pull_tilt,
pull_scale, // double pull_scale,
// log/save parameters
save_each, // boolean save_each,
log_append, // boolean log_append,
log_path, // String log_path,
orthoMapsCollection_path, // String orthoMapsCollection_path
debugLevel); // int debugLevel)
}
public boolean generatePairwiseAffines( public boolean generatePairwiseAffines(
CLTParameters clt_parameters, CLTParameters clt_parameters,
String orthoMapsCollection_path) { String orthoMapsCollection_path) {
...@@ -5168,10 +5440,6 @@ public class OrthoMapsCollection implements Serializable{ ...@@ -5168,10 +5440,6 @@ public class OrthoMapsCollection implements Serializable{
} }
boolean dry_run = false; boolean dry_run = false;
/// boolean skip_exist = clt_parameters.imp.pwise_skip_exist; //
/// boolean refine_exist = clt_parameters.imp.pwise_refine_exist; // if false, start from scratch, true - start from previous
/// boolean delete_failed = clt_parameters.imp.pwise_delete_fail; // delete existing match if now failed
/// boolean gen_inverse = clt_parameters.imp.pwise_gen_inverse; // generate inverse matches
boolean save_each = clt_parameters.imp.pwise_save_each; // save state file after each match boolean save_each = clt_parameters.imp.pwise_save_each; // save state file after each match
boolean log_append = clt_parameters.imp.pwise_log_append; // boolean log_append = clt_parameters.imp.pwise_log_append; //
String log_path = clt_parameters.imp.pwise_log_path; // String log_path = clt_parameters.imp.pwise_log_path; //
...@@ -5211,7 +5479,6 @@ public class OrthoMapsCollection implements Serializable{ ...@@ -5211,7 +5479,6 @@ public class OrthoMapsCollection implements Serializable{
double pull_tilt = clt_parameters.imp.pmtch_pull_tilt; // > 0 double pull_tilt = clt_parameters.imp.pmtch_pull_tilt; // > 0
double pull_scale = clt_parameters.imp.pmtch_pull_scale; // = 0 double pull_scale = clt_parameters.imp.pmtch_pull_scale; // = 0
// double max_rmse_reuse = 0.35;
boolean use_multi = true; boolean use_multi = true;
int heur = 15; int heur = 15;
int min_scene = 0; int min_scene = 0;
...@@ -5268,7 +5535,7 @@ public class OrthoMapsCollection implements Serializable{ ...@@ -5268,7 +5535,7 @@ public class OrthoMapsCollection implements Serializable{
gd.addNumericField("Start scene (skip all earlier)", min_scene, 0,3,"","To be able to continue skipping some."); gd.addNumericField("Start scene (skip all earlier)", min_scene, 0,3,"","To be able to continue skipping some.");
gd.addNumericField("Heuristics bitmap", heur, 0,3,"","Bitmap of modes to suggest the next pair."); gd.addNumericField("Heuristics bitmap", heur, 0,3,"","Bitmap of modes to suggest the next pair.");
gd.addCheckbox ("Use multiple threads", use_multi, "Use multipl tghreads (may be disabled in debug mode)."); gd.addCheckbox ("Use multiple threads", use_multi, "Use multiple threads (may be disabled in debug mode).");
// //
gd.showDialog(); gd.showDialog();
...@@ -5416,6 +5683,287 @@ public class OrthoMapsCollection implements Serializable{ ...@@ -5416,6 +5683,287 @@ public class OrthoMapsCollection implements Serializable{
} }
} }
public boolean augmentPairwiseAffines(
CLTParameters clt_parameters,
int [][] available_pairs,
//Initial spiral search for image matching
boolean ospir_augment,
double max_rms,
double max_rms_refine,
int min_overlap_tiles,
double double_threshold,
int num_iter_lma,
double [] max_rms_iter,
boolean lores_ignore_rms,
//Final pairwise scenes matching
double frac_remove,
double metric_error,
double max_std,
double min_std_rad,
boolean ignore_prev_rms,
int num_tries,
double rad_fraction,
double max_tile_rad,
double fill_fraction,
double fill_fraction_final,
double ease_nosfm,
int min_scene,
double pull_skew,
double pull_tilt,
double pull_scale,
// log/save parameters
boolean save_each,
boolean log_append,
String log_path,
String orthoMapsCollection_path,
int debugLevel) {
boolean batch_mode = true;
boolean show_vf = false;
double [][] ground_planes = null; // null or double[2] - will return ground planes:
if (log_append && (log_path != null)) { // assuming directory exists
StringBuffer sb = new StringBuffer();
sb.append(new SimpleDateFormat("yyyy/MM/dd HH:mm:ss").format(Calendar.getInstance().getTime())+"\n");
sb.append("number of scenes pairs\t"+ available_pairs.length+"\n");
sb.append(String.format("%4s\t%4s\t%17s\t%17s\t%6s\t%3s\t%6s\t%6s\t%7s\n",
"scn1","scn2","timestamp1","timestamp2","ovrlp","zl","RMS-sp","RMSfin","fzl","removed"));
CalibrationFileManagement.saveStringToFile (
log_path, //String path,
sb.toString(), // data,
true); // boolean append)
if (debugLevel>-3) {
System.out.print(sb.toString());
}
}
int num_pairs = 0; // available_pairs.length
ArrayList<Point> failed_pairs = new ArrayList<Point>();
for (int npair = 0; npair < available_pairs.length; npair++) {
int [] ipair = available_pairs[npair];
PairwiseOrthoMatch pairwiseOrthoMatch = ortho_maps[ipair[0]].getMatch(ortho_maps[ipair[1]].getName(), true);
double [][] daffine = null;
if (pairwiseOrthoMatch != null) {
double [][] aff0 = ortho_maps[ipair[0]].getAffine();
double [][] aff1 = ortho_maps[ipair[1]].getAffine();
double [] enuOffset = ortho_maps[ipair[1]].enuOffsetTo(ortho_maps[ipair[0]]);
double [] rd = {enuOffset[0], -enuOffset[1]}; // {right,down} of the image
PairwiseOrthoMatch aff_match = new PairwiseOrthoMatch (
aff0, // double [][] affine0,
aff1, // double [][] affine1,
rd); // double [] rd);
daffine = aff_match.getAffine();
pairwiseOrthoMatch.setAffine(daffine);
} else {
System.out.println("BUG: Missing pair for ["+ipair[0]+", "+ipair[1]+"] ");
continue;
}
if (ipair[0] < min_scene) {
System.out.println ("Skipping "+ipair[0]+":"+ipair[1]+" until "+min_scene);
continue;
}
// only do low-res if ospir_augment
// boolean direct = ipair[0] < ipair[1]; // always?
int min_zoom_lev = ortho_maps[ipair[0]].getOriginalZoomLevel();
int max_zoom_lev = ortho_maps[ipair[0]].getOriginalZoomLevel();
double max_agl = ortho_maps[ipair[0]].getAGL();
for (int i = 0; i < ipair.length; i++) {
max_agl = Math.max(max_agl, ortho_maps[ipair[i]].getAGL());
min_zoom_lev = Math.min(min_zoom_lev, ortho_maps[ipair[i]].getOriginalZoomLevel());
max_zoom_lev = Math.max(max_zoom_lev, ortho_maps[ipair[i]].getOriginalZoomLevel());
}
double agl_ratio = max_agl/50.0;
double metric_error_adj = metric_error * agl_ratio * agl_ratio; // metric_error settings is good for 50m. Increase for higher Maybe squared?
int initial_zoom = max_zoom_lev - 4; // another algorithm?
// overlaps
double overlap_frac = pairwiseOrthoMatch.getOverlap(); // .pairsGraph.getOverlap(next_pair);
double overlap_frac_mod = overlap_frac;
while (overlap_frac_mod < double_threshold) {
overlap_frac_mod *= 2;
initial_zoom += 1;
}
// unityAffine()
// use unityAffine() for 0; getaffine for second?
double [][] affine0 = unityAffine(); // ortho_maps[ipair[0]].getAffine();
double [][] affine1 = daffine; // ortho_maps[ipair[1]].getAffine();
double [][][] affines = new double[][][] {affine0,affine1};
boolean success = true;
Point pair = new Point(ipair[0],ipair[1]);
if (ospir_augment) {
correlateOrthoPair(
clt_parameters, // CLTParameters clt_parameters,
pairwiseOrthoMatch, // PairwiseOrthoMatch pairwiseOrthoMatch, // will return statistics
min_overlap_tiles, // int min_overlap,
max_std, // double max_std, // maximal standard deviation to limit center area
min_std_rad, // double min_std_rad, // minimal radius of the central area (if less - fail)
frac_remove, // double frac_remove, // = 0.25
metric_error_adj, // metric_error, // double metric_error,
lores_ignore_rms, // boolean ignore_prev_rms,
num_tries, // = 5int num_tries, // = 5
false, // boolean calc_warp, (will return null if false)
batch_mode, // boolean batch_mode,
ipair, // int [] gpu_pair,
affines, // double [][][] affines, // on top of GPS offsets
null, // woi, // Rectangle woi,
initial_zoom, // int zoom_lev,
show_vf, // boolean show_vf,
ground_planes, // double [][] ground_planes, // null or double[2] - will return ground planes
rad_fraction, // double rad_fraction,
max_tile_rad, // double max_tile_rad, // = 30;
fill_fraction, // double fill_fraction,
fill_fraction_final,// double fill_fraction_final,
ease_nosfm, // double ease_nosfm,
max_rms_iter, // double [] max_rms_iter, // = {1.0, 0.6};//
pull_skew, // double pull_skew, // ~rotation, = 0 fraction of the total weight == 1
pull_tilt, // double pull_tilt, // > 0
pull_scale, // double pull_scale, // = 0
debugLevel-4); // final int debugLevel)
pairwiseOrthoMatch.setAffine(affines[1]); // modified by correlateOrthoPair ALREADY SET
if (debugLevel > -4) {
System.out.println(String.format("Low-res Match(): %3d-%3d RMSE=%8.6f",
ipair[0], ipair[1], pairwiseOrthoMatch.rms)); // if NaN - provide reason
}
if (pairwiseOrthoMatch.rms < max_rms) {
pairwiseOrthoMatch.ok = true;
}
success &= pairwiseOrthoMatch.ok; // && !Double.isNaN(pairwiseOrthoMatch.rms)
if (!success) {
String str_failed = "%4d\t%4d\t%s\t%s\t%6.4f\t%3d\t%6.4f\tFAILED\n";
if (log_append && (log_path != null)) { // assuming directory exists
StringBuffer sb = new StringBuffer();
sb.append(String.format(str_failed,
ipair[0], ipair[1], ortho_maps[ipair[0]].getName(), ortho_maps[ipair[1]].getName(),
overlap_frac, initial_zoom,
// pairwiseOrthoMatch.nxy[0],pairwiseOrthoMatch.nxy[1],
pairwiseOrthoMatch.rms));
CalibrationFileManagement.saveStringToFile (
log_path, //String path,
sb.toString(), // data,
true); // boolean append)
}
failed_pairs.add(pair);
continue;
}
} // if (ospir_augment) {
// PairwiseOrthoMatch pairwiseOrthoMatch_lores = pairwiseOrthoMatch.clone();
double lores_rms = pairwiseOrthoMatch.getRMS();
// high-res
affines[1][0] = affines[1][0].clone();
affines[1][1] = affines[1][1].clone();
Rectangle woi = new Rectangle(); // used to return actual woi from correlateOrthoPair()
correlateOrthoPair(
clt_parameters, // CLTParameters clt_parameters,
pairwiseOrthoMatch, //PairwiseOrthoMatch pairwiseOrthoMatch, // will return statistics
0, // int min_overlap,
max_std, // double max_std, // maximal standard deviation to limit center area
min_std_rad, // double min_std_rad, // minimal radius of the central area (if less - fail)
frac_remove, // double frac_remove, // = 0.25
metric_error_adj,// double metric_error,
ignore_prev_rms, // boolean ignore_prev_rms,
num_tries, // = 5int num_tries, // = 5
false, // , // boolean calc_warp, (will return null if false)
batch_mode, // boolean batch_mode,
ipair, // String [] gpu_spair,
affines, // double [][][] affines, // on top of GPS offsets
woi, // Rectangle woi,
min_zoom_lev, // int zoom_lev,
false, // show_vf, // boolean show_vf,
null, // ground_planes, // double [][] ground_planes, // null or double[2] - will return ground planes
rad_fraction, // double rad_fraction,
max_tile_rad, // double max_tile_rad, // = 30;
fill_fraction, // double fill_fraction,
fill_fraction_final, // double fill_fraction_final,
ease_nosfm, // double ease_nosfm,
null, // double [] max_rms_iter, // = {1.0, 0.6};//
pull_skew, // double pull_skew, // ~rotation, = 0 fraction of the total weight == 1
pull_tilt, // double pull_tilt, // > 0
pull_scale, // double pull_scale, // = 0
debugLevel-4); // final int debugLevel)
boolean failed_refine = Double.isNaN(pairwiseOrthoMatch.rms) || (pairwiseOrthoMatch.rms > max_rms_refine);
// Create log line and write it
StringBuffer sb = new StringBuffer();
sb.append(String.format("%4d\t%4d\t%s\t%s\t%6.4f\t%3d",
ipair[0], ipair[1], ortho_maps[ipair[0]].getName(), ortho_maps[ipair[1]].getName(),
overlap_frac, initial_zoom));
sb.append(String.format("\t%6.4f",
// pairwiseOrthoMatch.nxy[0],pairwiseOrthoMatch.nxy[1],
lores_rms));
if (failed_refine) {
String str_failed = String.format("\t%6.4f\tFAILED\n",pairwiseOrthoMatch.rms);
failed_pairs.add(pair);
sb.append(String.format(str_failed));
if (debugLevel > -4) System.out.print("Final adjustment (3)"+str_failed);
} else {
pairwiseOrthoMatch.overlap = overlap_frac; // needed here if refining old/manual w/o overlap
sb.append(String.format("\t%6.4f\t%3d\n",pairwiseOrthoMatch.rms,pairwiseOrthoMatch.zoom_lev));
if (debugLevel > -4) System.out.println("Final adjustment (4) RMSE="+pairwiseOrthoMatch.rms+
", overlap = "+pairwiseOrthoMatch.overlap);
ortho_maps[ipair[0]].setMatch(ortho_maps[ipair[1]].getName(),pairwiseOrthoMatch);
if (save_each && (orthoMapsCollection_path != null)) {
try {
writeOrthoMapsCollection(orthoMapsCollection_path);
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
if (debugLevel > -4) {
System.out.println("Saved data to "+ orthoMapsCollection_path);
}
}
}
if (log_append && (log_path != null)) { // assuming directory exists
CalibrationFileManagement.saveStringToFile (
log_path, //String path,
sb.toString(), // data,
true); // boolean append)
}
success &= !failed_refine;
if (success) {
num_pairs++;
}
} // for (int npair = 0; npair < available_pairs.length; npair++) {
if (log_append && (log_path != null)) { // assuming directory exists
StringBuffer sb = new StringBuffer();
sb.append("\nSUMMARY\n");
sb.append("new\t"+ num_pairs+"\n");
// sb.append("new\t"+ new_pairs.size()+"\n");
sb.append("failed\t"+failed_pairs.size()+"\n");
if (!failed_pairs.isEmpty()) {
for (int i = 0; i < failed_pairs.size(); i++) {
// int [] ipair = {indices[failed_pairs.get(i).x], indices[failed_pairs.get(i).y]};
int [] ipair = {failed_pairs.get(i).x, failed_pairs.get(i).y};
sb.append(String.format("%4d\t%4d\t%s\t%s\n",
ipair[0], ipair[1], ortho_maps[ipair[0]].getName(), ortho_maps[ipair[1]].getName()));
}
}
CalibrationFileManagement.saveStringToFile (
log_path, //String path,
sb.toString(), // data,
true); // boolean append)
if (debugLevel > -4) {
System.out.println("Appended log file "+ log_path);
}
}
if (orthoMapsCollection_path != null) {
try {
writeOrthoMapsCollection(orthoMapsCollection_path);
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
if (debugLevel > -4) {
System.out.println("Saved data to "+ orthoMapsCollection_path);
}
}
return true;
}
public boolean generatePairwiseAffines( public boolean generatePairwiseAffines(
CLTParameters clt_parameters, CLTParameters clt_parameters,
PairsGraph pairsGraph, PairsGraph pairsGraph,
...@@ -6443,8 +6991,12 @@ public class OrthoMapsCollection implements Serializable{ ...@@ -6443,8 +6991,12 @@ public class OrthoMapsCollection implements Serializable{
* @param min_rms minimal RMSE * @param min_rms minimal RMSE
* @param max_rms maximal RMSE * @param max_rms maximal RMSE
* @param nan_rms use only NaN RMSE pairs * @param nan_rms use only NaN RMSE pairs
* @param filt_zoom filter by zoom
* @param min_zoom minimal zoom (including)
* @param max_zoom maximal zoom (including)
* @return filtered array of pair indices * @return filtered array of pair indices
*/ */
public int [][] filterPairs( public int [][] filterPairs(
int [][] list_in, int [][] list_in,
boolean undef_only, boolean undef_only,
...@@ -6452,7 +7004,10 @@ public class OrthoMapsCollection implements Serializable{ ...@@ -6452,7 +7004,10 @@ public class OrthoMapsCollection implements Serializable{
double max_overlap, double max_overlap,
double min_rms, double min_rms,
double max_rms, double max_rms,
boolean nan_rms){ boolean nan_rms,
boolean filt_zoom,
int min_zoom,
int max_zoom){
ArrayList<Point> plist = new ArrayList<Point>(); ArrayList<Point> plist = new ArrayList<Point>();
int num_all = 0; int num_all = 0;
int num_def = 0; int num_def = 0;
...@@ -6478,10 +7033,13 @@ public class OrthoMapsCollection implements Serializable{ ...@@ -6478,10 +7033,13 @@ public class OrthoMapsCollection implements Serializable{
plist.add(pair); plist.add(pair);
} }
} else if ((pairwiseOrthoMatch.rms >= min_rms) && (pairwiseOrthoMatch.rms <= max_rms)) { } else if ((pairwiseOrthoMatch.rms >= min_rms) && (pairwiseOrthoMatch.rms <= max_rms)) {
if (!filt_zoom ||
((pairwiseOrthoMatch.zoom_lev >= min_zoom) && (pairwiseOrthoMatch.zoom_lev <= max_zoom))) {
plist.add(pair); plist.add(pair);
} }
} }
} }
}
} else { } else {
// System.out.println("pair=["+pair.x+","+pair.y+"] "+ // System.out.println("pair=["+pair.x+","+pair.y+"] "+
// ortho_maps[pair.x].getName()+"->"+ortho_maps[pair.y].getName()); // ortho_maps[pair.x].getName()+"->"+ortho_maps[pair.y].getName());
...@@ -6502,6 +7060,7 @@ public class OrthoMapsCollection implements Serializable{ ...@@ -6502,6 +7060,7 @@ public class OrthoMapsCollection implements Serializable{
* @param show_names show full scene names (timestamps) * @param show_names show full scene names (timestamps)
* @param show_overlap show scene overlap in percents * @param show_overlap show scene overlap in percents
* @param show_rms show pairs RMSE * @param show_rms show pairs RMSE
* @param show_zoom show pairs zoom level
* @param extra_line null or an extra string to be added as a last element * @param extra_line null or an extra string to be added as a last element
* @return Array of strings to be shown in a drop-down list * @return Array of strings to be shown in a drop-down list
*/ */
...@@ -6510,6 +7069,7 @@ public class OrthoMapsCollection implements Serializable{ ...@@ -6510,6 +7069,7 @@ public class OrthoMapsCollection implements Serializable{
boolean show_names, boolean show_names,
boolean show_overlap, boolean show_overlap,
boolean show_rms, boolean show_rms,
boolean show_zoom,
String extra_line) { String extra_line) {
String [] text_pairs = new String [plist.length+((extra_line !=null)? 1 : 0)]; String [] text_pairs = new String [plist.length+((extra_line !=null)? 1 : 0)];
for (int i = 0; i < plist.length; i++) { for (int i = 0; i < plist.length; i++) {
...@@ -6532,6 +7092,9 @@ public class OrthoMapsCollection implements Serializable{ ...@@ -6532,6 +7092,9 @@ public class OrthoMapsCollection implements Serializable{
if (show_rms) { if (show_rms) {
text_pairs[i] += String.format(" %5.3f", pairwiseOrthoMatch.rms); text_pairs[i] += String.format(" %5.3f", pairwiseOrthoMatch.rms);
} }
if (show_zoom) {
text_pairs[i] += String.format(" Z%3d", pairwiseOrthoMatch.zoom_lev);
}
} }
} }
if (extra_line !=null) { if (extra_line !=null) {
......
...@@ -355,9 +355,11 @@ public class OrthoMultiLMA { ...@@ -355,9 +355,11 @@ public class OrthoMultiLMA {
max_rms, // double max_rmse, max_rms, // double max_rmse,
true, // boolean max_resolution, true, // boolean max_resolution,
null); // int [][] remove_pairs null); // int [][] remove_pairs
indices= maps_collection.getScenesFromPairs( indices= maps_collection.getScenesFromPairs(
pairs_defined_abs,// int [][] pairs, pairs_defined_abs,// int [][] pairs,
null); // int [] indices_in) // preselected indices or null null); // int [] indices_in) // preselected indices or null
int [][] defined_pairs = maps_collection.condensePairs (pairs_defined_abs,indices); int [][] defined_pairs = maps_collection.condensePairs (pairs_defined_abs,indices);
......
...@@ -150,6 +150,7 @@ public class IntersceneMatchParameters { ...@@ -150,6 +150,7 @@ public class IntersceneMatchParameters {
public double []ospir_rms_iter = {1.0, 0.6};// maximal rms per iteration public double []ospir_rms_iter = {1.0, 0.6};// maximal rms per iteration
public boolean ospir_ignore_rms = false; // ignore RMS worsening during spiral search public boolean ospir_ignore_rms = false; // ignore RMS worsening during spiral search
public int ospir_debug = 0; // Debug level during sppiral search public int ospir_debug = 0; // Debug level during sppiral search
public boolean ospir_augment = true; // Use low-res matching during augmenting (false - skip, go to high-res)
// pairwise match parameters // pairwise match parameters
public int pwise_zoom = -5; public int pwise_zoom = -5;
...@@ -197,9 +198,15 @@ public class IntersceneMatchParameters { ...@@ -197,9 +198,15 @@ public class IntersceneMatchParameters {
public double flt_min_rms = 0.0; public double flt_min_rms = 0.0;
public double flt_max_rms = 2.0; public double flt_max_rms = 2.0;
public boolean flt_nan_rms = false; public boolean flt_nan_rms = false;
public boolean flt_filt_zoom = true;
public int flt_min_zoom = -2;
public int flt_max_zoom = 10;
public boolean flt_show_names = true; public boolean flt_show_names = true;
public boolean flt_show_overlaps = true; public boolean flt_show_overlaps = true;
public boolean flt_show_rms = true; public boolean flt_show_rms = true;
public boolean flt_show_zoom = true;
public String patt_save_top = "/media/elphel/NVME/lwir16-proc/ortho_videos/debug/sept12-13/pattern_match/"; public String patt_save_top = "/media/elphel/NVME/lwir16-proc/ortho_videos/debug/sept12-13/pattern_match/";
...@@ -885,6 +892,7 @@ min_str_neib_fpn 0.35 ...@@ -885,6 +892,7 @@ min_str_neib_fpn 0.35
gd.addNumericField("RMSE at second iteration", this.ospir_rms_iter[1], 3,7,"scaled pix","Maximal RMSE at second iteration."); gd.addNumericField("RMSE at second iteration", this.ospir_rms_iter[1], 3,7,"scaled pix","Maximal RMSE at second iteration.");
gd.addCheckbox ("Ignore worsening RMSE", this.ospir_ignore_rms, "Ignore worsening/not improving RMSE during spiral search."); gd.addCheckbox ("Ignore worsening RMSE", this.ospir_ignore_rms, "Ignore worsening/not improving RMSE during spiral search.");
gd.addNumericField("Spiral search debug level", this.ospir_debug, 0,3,"","Debug level during Spiral search."); gd.addNumericField("Spiral search debug level", this.ospir_debug, 0,3,"","Debug level during Spiral search.");
gd.addCheckbox ("Use low-res in augmentation", this.ospir_augment, "Use low-res matching during augmenting (false - skip, go to high-res).");
gd.addMessage ("Pairwise image matching"); gd.addMessage ("Pairwise image matching");
gd.addNumericField("Zoom level", this.pwise_zoom, 0,3,"","Low-res images to determine overlaps."); gd.addNumericField("Zoom level", this.pwise_zoom, 0,3,"","Low-res images to determine overlaps.");
...@@ -933,9 +941,15 @@ min_str_neib_fpn 0.35 ...@@ -933,9 +941,15 @@ min_str_neib_fpn 0.35
gd.addNumericField("Minimal RMSE", this.flt_min_rms, 3,7,"", "Minimal LMA RMSE of the scene pair."); gd.addNumericField("Minimal RMSE", this.flt_min_rms, 3,7,"", "Minimal LMA RMSE of the scene pair.");
gd.addNumericField("Maximal RMSE", this.flt_max_rms, 3,7,"", "Maximal LMA RMSE of the scene pair."); gd.addNumericField("Maximal RMSE", this.flt_max_rms, 3,7,"", "Maximal LMA RMSE of the scene pair.");
gd.addCheckbox ("NaN RMS (failed match)", this.flt_nan_rms, "Keep only failed matches with RMSE=NaN."); gd.addCheckbox ("NaN RMS (failed match)", this.flt_nan_rms, "Keep only failed matches with RMSE=NaN.");
gd.addCheckbox ("Filter by zoom level" , this.flt_filt_zoom, "Filter by the zoom level used for matching.");
gd.addNumericField("Minimal zoom", this.flt_min_zoom, 0,3,"","Minimal zoom level used for matching.");
gd.addNumericField("Maximal zoom", this.flt_max_zoom, 0,3,"","Maximal zoom level used for matching.");
gd.addCheckbox ("Show scene names", this.flt_show_names, "Show scene full names (timestamps) in selection drop-down list."); gd.addCheckbox ("Show scene names", this.flt_show_names, "Show scene full names (timestamps) in selection drop-down list.");
gd.addCheckbox ("Show scene overlaps", this.flt_show_overlaps, "Show scene overlaps (in percents) in selection drop-down list."); gd.addCheckbox ("Show scene overlaps", this.flt_show_overlaps, "Show scene overlaps (in percents) in selection drop-down list.");
gd.addCheckbox ("Show pairs RMSE", this.flt_show_rms, "Show scene match RMSE in selection drop-down list."); gd.addCheckbox ("Show pairs RMSE", this.flt_show_rms, "Show scene match RMSE in selection drop-down list.");
gd.addCheckbox ("Show zoom level", this.flt_show_zoom, "Show zoom level.");
gd.addMessage ("Pattern match directories"); gd.addMessage ("Pattern match directories");
gd.addStringField ("Pattern match save directory",this.patt_save_top, 120, "Top directory to save combo maps"); gd.addStringField ("Pattern match save directory",this.patt_save_top, 120, "Top directory to save combo maps");
...@@ -1878,6 +1892,7 @@ min_str_neib_fpn 0.35 ...@@ -1878,6 +1892,7 @@ min_str_neib_fpn 0.35
this.ospir_rms_iter[1] = gd.getNextNumber(); this.ospir_rms_iter[1] = gd.getNextNumber();
this.ospir_ignore_rms = gd.getNextBoolean(); this.ospir_ignore_rms = gd.getNextBoolean();
this.ospir_debug = (int) gd.getNextNumber(); this.ospir_debug = (int) gd.getNextNumber();
this.ospir_augment = gd.getNextBoolean();
this.pwise_zoom = (int) gd.getNextNumber(); this.pwise_zoom = (int) gd.getNextNumber();
this.pwise_overlap = gd.getNextNumber(); this.pwise_overlap = gd.getNextNumber();
...@@ -1922,9 +1937,14 @@ min_str_neib_fpn 0.35 ...@@ -1922,9 +1937,14 @@ min_str_neib_fpn 0.35
this.flt_min_rms = gd.getNextNumber(); this.flt_min_rms = gd.getNextNumber();
this.flt_max_rms = gd.getNextNumber(); this.flt_max_rms = gd.getNextNumber();
this.flt_nan_rms = gd.getNextBoolean(); this.flt_nan_rms = gd.getNextBoolean();
this.flt_filt_zoom = gd.getNextBoolean();
this.flt_min_zoom = (int) gd.getNextNumber();
this.flt_max_zoom = (int) gd.getNextNumber();
this.flt_show_names = gd.getNextBoolean(); this.flt_show_names = gd.getNextBoolean();
this.flt_show_overlaps = gd.getNextBoolean(); this.flt_show_overlaps = gd.getNextBoolean();
this.flt_show_rms = gd.getNextBoolean(); this.flt_show_rms = gd.getNextBoolean();
this.flt_show_zoom = gd.getNextBoolean();
this.patt_save_top= gd.getNextString(); this.patt_save_top= gd.getNextString();
this.patt_save_subdir = gd.getNextString(); this.patt_save_subdir = gd.getNextString();
...@@ -2454,6 +2474,7 @@ min_str_neib_fpn 0.35 ...@@ -2454,6 +2474,7 @@ min_str_neib_fpn 0.35
properties.setProperty(prefix+"ospir_ignore_rms", this.ospir_ignore_rms +""); // boolean properties.setProperty(prefix+"ospir_ignore_rms", this.ospir_ignore_rms +""); // boolean
properties.setProperty(prefix+"ospir_debug", this.ospir_debug +""); // int properties.setProperty(prefix+"ospir_debug", this.ospir_debug +""); // int
properties.setProperty(prefix+"ospir_augment", this.ospir_augment +""); // boolean
properties.setProperty(prefix+"pwise_zoom", this.pwise_zoom + ""); // int properties.setProperty(prefix+"pwise_zoom", this.pwise_zoom + ""); // int
properties.setProperty(prefix+"pwise_overlap", this.pwise_overlap + ""); // double properties.setProperty(prefix+"pwise_overlap", this.pwise_overlap + ""); // double
...@@ -2499,9 +2520,13 @@ min_str_neib_fpn 0.35 ...@@ -2499,9 +2520,13 @@ min_str_neib_fpn 0.35
properties.setProperty(prefix+"flt_min_rms", this.flt_min_rms + ""); // double properties.setProperty(prefix+"flt_min_rms", this.flt_min_rms + ""); // double
properties.setProperty(prefix+"flt_max_rms", this.flt_max_rms + ""); // double properties.setProperty(prefix+"flt_max_rms", this.flt_max_rms + ""); // double
properties.setProperty(prefix+"flt_nan_rms", this.flt_nan_rms + ""); // boolean properties.setProperty(prefix+"flt_nan_rms", this.flt_nan_rms + ""); // boolean
properties.setProperty(prefix+"flt_filt_zoom", this.flt_filt_zoom + ""); // boolean
properties.setProperty(prefix+"flt_min_zoom", this.flt_min_zoom + ""); // int
properties.setProperty(prefix+"flt_max_zoom", this.flt_max_zoom + ""); // int
properties.setProperty(prefix+"flt_show_names", this.flt_show_names + ""); // boolean properties.setProperty(prefix+"flt_show_names", this.flt_show_names + ""); // boolean
properties.setProperty(prefix+"flt_show_overlaps", this.flt_show_overlaps + ""); // boolean properties.setProperty(prefix+"flt_show_overlaps", this.flt_show_overlaps + ""); // boolean
properties.setProperty(prefix+"flt_show_rms", this.flt_show_rms + ""); // boolean properties.setProperty(prefix+"flt_show_rms", this.flt_show_rms + ""); // boolean
properties.setProperty(prefix+"flt_show_zoom", this.flt_show_zoom + ""); // boolean
properties.setProperty(prefix+"patt_save_top", this.patt_save_top + ""); // String properties.setProperty(prefix+"patt_save_top", this.patt_save_top + ""); // String
properties.setProperty(prefix+"patt_save_subdir", this.patt_save_subdir + ""); // String properties.setProperty(prefix+"patt_save_subdir", this.patt_save_subdir + ""); // String
...@@ -2997,6 +3022,7 @@ min_str_neib_fpn 0.35 ...@@ -2997,6 +3022,7 @@ min_str_neib_fpn 0.35
if (properties.getProperty(prefix+"ospir_rms_iter_1")!=null) this.ospir_rms_iter[1]=Double.parseDouble(properties.getProperty(prefix+ "ospir_rms_iter_1")); if (properties.getProperty(prefix+"ospir_rms_iter_1")!=null) this.ospir_rms_iter[1]=Double.parseDouble(properties.getProperty(prefix+ "ospir_rms_iter_1"));
if (properties.getProperty(prefix+"ospir_ignore_rms")!=null) this.ospir_ignore_rms=Boolean.parseBoolean(properties.getProperty(prefix+"ospir_ignore_rms")); if (properties.getProperty(prefix+"ospir_ignore_rms")!=null) this.ospir_ignore_rms=Boolean.parseBoolean(properties.getProperty(prefix+"ospir_ignore_rms"));
if (properties.getProperty(prefix+"ospir_debug")!=null) this.ospir_debug=Integer.parseInt(properties.getProperty(prefix+ "ospir_debug")); if (properties.getProperty(prefix+"ospir_debug")!=null) this.ospir_debug=Integer.parseInt(properties.getProperty(prefix+ "ospir_debug"));
if (properties.getProperty(prefix+"ospir_augment")!=null) this.ospir_augment=Boolean.parseBoolean(properties.getProperty(prefix+ "ospir_augment"));
if (properties.getProperty(prefix+"pwise_zoom")!=null) this.pwise_zoom=Integer.parseInt(properties.getProperty(prefix+ "pwise_zoom")); if (properties.getProperty(prefix+"pwise_zoom")!=null) this.pwise_zoom=Integer.parseInt(properties.getProperty(prefix+ "pwise_zoom"));
if (properties.getProperty(prefix+"pwise_overlap")!=null) this.pwise_overlap=Double.parseDouble(properties.getProperty(prefix+ "pwise_overlap")); if (properties.getProperty(prefix+"pwise_overlap")!=null) this.pwise_overlap=Double.parseDouble(properties.getProperty(prefix+ "pwise_overlap"));
...@@ -3042,9 +3068,13 @@ min_str_neib_fpn 0.35 ...@@ -3042,9 +3068,13 @@ min_str_neib_fpn 0.35
if (properties.getProperty(prefix+"flt_min_rms_sec")!= null) this.flt_min_rms= Double.parseDouble(properties.getProperty(prefix+ "flt_min_rms")); if (properties.getProperty(prefix+"flt_min_rms_sec")!= null) this.flt_min_rms= Double.parseDouble(properties.getProperty(prefix+ "flt_min_rms"));
if (properties.getProperty(prefix+"flt_max_rms_sec")!= null) this.flt_max_rms= Double.parseDouble(properties.getProperty(prefix+ "flt_max_rms")); if (properties.getProperty(prefix+"flt_max_rms_sec")!= null) this.flt_max_rms= Double.parseDouble(properties.getProperty(prefix+ "flt_max_rms"));
if (properties.getProperty(prefix+"flt_nan_rms")!= null) this.flt_nan_rms= Boolean.parseBoolean(properties.getProperty(prefix+"flt_nan_rms")); if (properties.getProperty(prefix+"flt_nan_rms")!= null) this.flt_nan_rms= Boolean.parseBoolean(properties.getProperty(prefix+"flt_nan_rms"));
if (properties.getProperty(prefix+"flt_filt_zoom")!= null) this.flt_filt_zoom= Boolean.parseBoolean(properties.getProperty(prefix+"flt_filt_zoom"));
if (properties.getProperty(prefix+"flt_min_zoom")!= null) this.flt_min_zoom= Integer.parseInt(properties.getProperty(prefix+ "flt_min_zoom"));
if (properties.getProperty(prefix+"flt_max_zoom")!= null) this.flt_max_zoom= Integer.parseInt(properties.getProperty(prefix+ "flt_max_zoom"));
if (properties.getProperty(prefix+"flt_show_names")!= null) this.flt_show_names= Boolean.parseBoolean(properties.getProperty(prefix+"flt_show_names")); if (properties.getProperty(prefix+"flt_show_names")!= null) this.flt_show_names= Boolean.parseBoolean(properties.getProperty(prefix+"flt_show_names"));
if (properties.getProperty(prefix+"flt_show_overlaps")!=null) this.flt_show_overlaps=Boolean.parseBoolean(properties.getProperty(prefix+"flt_show_overlaps")); if (properties.getProperty(prefix+"flt_show_overlaps")!=null) this.flt_show_overlaps=Boolean.parseBoolean(properties.getProperty(prefix+"flt_show_overlaps"));
if (properties.getProperty(prefix+"flt_show_rms")!= null) this.flt_show_rms= Boolean.parseBoolean(properties.getProperty(prefix+"flt_show_rms")); if (properties.getProperty(prefix+"flt_show_rms")!= null) this.flt_show_rms= Boolean.parseBoolean(properties.getProperty(prefix+"flt_show_rms"));
if (properties.getProperty(prefix+"flt_show_zoom")!= null) this.flt_show_zoom= Boolean.parseBoolean(properties.getProperty(prefix+"flt_show_zoom"));
if (properties.getProperty(prefix+"patt_save_top")!=null) this.patt_save_top=(String) properties.getProperty(prefix+ "patt_save_top"); if (properties.getProperty(prefix+"patt_save_top")!=null) this.patt_save_top=(String) properties.getProperty(prefix+ "patt_save_top");
if (properties.getProperty(prefix+"patt_save_subdir")!=null) this.patt_save_subdir=(String) properties.getProperty(prefix+ "patt_save_subdir"); if (properties.getProperty(prefix+"patt_save_subdir")!=null) this.patt_save_subdir=(String) properties.getProperty(prefix+ "patt_save_subdir");
...@@ -3563,6 +3593,7 @@ min_str_neib_fpn 0.35 ...@@ -3563,6 +3593,7 @@ min_str_neib_fpn 0.35
imp.ospir_ignore_rms = this.ospir_ignore_rms; imp.ospir_ignore_rms = this.ospir_ignore_rms;
imp.ospir_debug = this.ospir_debug; imp.ospir_debug = this.ospir_debug;
imp.ospir_augment = this.ospir_augment;
imp.pwise_zoom = this.pwise_zoom; imp.pwise_zoom = this.pwise_zoom;
imp.pwise_overlap = this.pwise_overlap; imp.pwise_overlap = this.pwise_overlap;
...@@ -3607,10 +3638,13 @@ min_str_neib_fpn 0.35 ...@@ -3607,10 +3638,13 @@ min_str_neib_fpn 0.35
imp.flt_min_rms = this.flt_min_rms; imp.flt_min_rms = this.flt_min_rms;
imp.flt_max_rms = this.flt_max_rms; imp.flt_max_rms = this.flt_max_rms;
imp.flt_nan_rms = this.flt_nan_rms; imp.flt_nan_rms = this.flt_nan_rms;
imp.flt_filt_zoom = this.flt_filt_zoom;
imp.flt_min_zoom = this.flt_min_zoom;
imp.flt_max_zoom = this.flt_max_zoom;
imp.flt_show_names = this.flt_show_names; imp.flt_show_names = this.flt_show_names;
imp.flt_show_overlaps = this.flt_show_overlaps; imp.flt_show_overlaps = this.flt_show_overlaps;
imp.flt_show_rms = this.flt_show_rms; imp.flt_show_rms = this.flt_show_rms;
imp.flt_show_zoom = this.flt_show_zoom;
imp.patt_save_top = this.patt_save_top; imp.patt_save_top = this.patt_save_top;
imp.patt_save_subdir = this.patt_save_subdir; imp.patt_save_subdir = this.patt_save_subdir;
......
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