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

Implemented augmentPairwiseAffines() to add more pairwise matches

after all scenes are matched and have defined affines
parent ef8c6ac2
Loading
Loading
Loading
Loading
+45 −22
Original line number Diff line number Diff line
@@ -164,6 +164,7 @@ public class ComboMatch {
		boolean show_combo =               false; // true;
		boolean create_pairwise_matches =  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 create_map =               false;
		boolean create_equalize =          false;
@@ -240,6 +241,7 @@ public class ComboMatch {
		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 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    ("Create map",                       create_map, "Create combined map from pairwise matches.");
		gd.addCheckbox    ("Equalize intensities",             create_equalize, "Create map intensities equalization from pairwise matches.");
@@ -305,6 +307,7 @@ public class ComboMatch {
		show_combo =                gd.getNextBoolean();
		create_pairwise_matches =   gd.getNextBoolean();
		create_pairwise_affines =   gd.getNextBoolean();
		augment_pairwise_affines =  gd.getNextBoolean();
		equalize_overlaps =         gd.getNextBoolean();
		create_map =                gd.getNextBoolean();
		create_equalize =           gd.getNextBoolean();
@@ -823,17 +826,22 @@ public class ComboMatch {
			return ok; // Just exit, do not try other commands.  if (!ok) return false;
		}
		
		if (create_pairwise_affines) {
//			boolean ok =maps_collection.getIntersectedPairs(
//					clt_parameters, // CLTParameters    clt_parameters,
//					orthoMapsCollection_savepath); // String orthoMapsCollection_path);
		if (augment_pairwise_affines) {
			boolean ok =maps_collection.augmentPairwiseAffines(
					clt_parameters, // CLTParameters    clt_parameters,
					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(
					clt_parameters, // CLTParameters    clt_parameters,
					orthoMapsCollection_savepath); // String orthoMapsCollection_path);
			
			return ok; // Just exit, do not try other commands.  if (!ok) return false;
		}
		
		
		if (equalize_overlaps) {
			boolean ok =maps_collection.equalizeIntersectedPairs(
					clt_parameters, // CLTParameters    clt_parameters,
@@ -876,9 +884,14 @@ public class ComboMatch {
        		double  flt_min_rms =        clt_parameters.imp.flt_min_rms;       //  0.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_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_overlaps =  clt_parameters.imp.flt_show_overlaps; //  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;
        		String  flt_extra_line =    "--- select a single image ---";
				GenericJTabbedDialog gdf = new GenericJTabbedDialog("Select pairs filter/display",800,500);
@@ -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("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    ("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 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 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.showDialog();
				if (gdf.wasCanceled()) return false;
@@ -902,6 +921,10 @@ public class ComboMatch {
				flt_min_rms       = gdf.getNextNumber();
				flt_max_rms       = gdf.getNextNumber();
				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_overlaps = gdf.getNextBoolean();
				flt_show_rms      = gdf.getNextBoolean();
@@ -914,9 +937,13 @@ public class ComboMatch {
					clt_parameters.imp.flt_min_rms =       flt_min_rms;
					clt_parameters.imp.flt_max_rms =       flt_max_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_overlaps = flt_show_overlaps;
					clt_parameters.imp.flt_show_rms =      flt_show_rms;
					clt_parameters.imp.flt_show_zoom =     flt_show_zoom;
				}

				if (flt_list) {
@@ -927,7 +954,10 @@ public class ComboMatch {
							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_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 (
@@ -935,19 +965,9 @@ public class ComboMatch {
						flt_show_names,    // boolean          show_names,
						flt_show_overlaps, // boolean          show_overlap,
						flt_show_rms,      // boolean          show_rms,
						flt_show_zoom,     // boolean          show_zoom,
						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);
				int num_choice_lines = 50;
				gdc.addChoice("Image pair:",
@@ -1220,6 +1240,9 @@ public class ComboMatch {
        }
        return true;
	}
	
	
	
	public static PairwiseOrthoMatch initialPairAdjust(
			CLTParameters       clt_parameters,
			OrthoMapsCollection maps_collection,
+571 −8

File changed.

Preview size limit exceeded, changes collapsed.

+2 −0
Original line number Diff line number Diff line
@@ -355,9 +355,11 @@ public class OrthoMultiLMA {
				max_rms,          // double  max_rmse,
				true,             // boolean max_resolution,
				null);            // int [][] remove_pairs
		
		indices= maps_collection.getScenesFromPairs(
				pairs_defined_abs,// int [][] pairs,
				null);            // int [] indices_in)  // preselected indices or null
		
		int [][] defined_pairs =   maps_collection.condensePairs (pairs_defined_abs,indices);

		
+37 −3
Original line number Diff line number Diff line
@@ -150,6 +150,7 @@ public class IntersceneMatchParameters {
    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 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
	public int      pwise_zoom =         -5;
@@ -197,9 +198,15 @@ public class IntersceneMatchParameters {
    public double   flt_min_rms =         0.0;
    public double   flt_max_rms =         2.0;
    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_overlaps =   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/";
@@ -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.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.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.addNumericField("Zoom level",                  this.pwise_zoom, 0,3,"","Low-res images to determine overlaps.");
@@ -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("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    ("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 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 zoom level",             this.flt_show_zoom, "Show zoom level.");
		
		gd.addMessage  ("Pattern match directories");
		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
        this.ospir_rms_iter[1] =              gd.getNextNumber();
        this.ospir_ignore_rms =               gd.getNextBoolean();
        this.ospir_debug =              (int) gd.getNextNumber();
        this.ospir_augment =                  gd.getNextBoolean();
        
        this.pwise_zoom =               (int) gd.getNextNumber();
        this.pwise_overlap =                  gd.getNextNumber();
@@ -1922,9 +1937,14 @@ min_str_neib_fpn 0.35
        this.flt_min_rms       =              gd.getNextNumber();
        this.flt_max_rms       =              gd.getNextNumber();
        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_overlaps =              gd.getNextBoolean();
        this.flt_show_rms      =              gd.getNextBoolean();        
        this.flt_show_zoom     =              gd.getNextBoolean();
        
        this.patt_save_top=                   gd.getNextString();
        this.patt_save_subdir =               gd.getNextString();
@@ -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_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_overlap",                 this.pwise_overlap + "");               // double
@@ -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_max_rms",                   this.flt_max_rms + "");                 // double
		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_overlaps",             this.flt_show_overlaps + "");           // 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_subdir",              this.patt_save_subdir + "");            // String
@@ -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_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_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_overlap")!=null)      this.pwise_overlap=Double.parseDouble(properties.getProperty(prefix+       "pwise_overlap"));
@@ -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_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_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_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_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_subdir")!=null)    this.patt_save_subdir=(String) properties.getProperty(prefix+                "patt_save_subdir");
@@ -3563,6 +3593,7 @@ min_str_neib_fpn 0.35
        
        imp.ospir_ignore_rms              = this.ospir_ignore_rms;
        imp.ospir_debug                   = this.ospir_debug;
        imp.ospir_augment                 = this.ospir_augment;

        imp.pwise_zoom                    = this.pwise_zoom;
        imp.pwise_overlap                 = this.pwise_overlap;
@@ -3607,10 +3638,13 @@ min_str_neib_fpn 0.35
        imp.flt_min_rms                   = this.flt_min_rms;
        imp.flt_max_rms                   = this.flt_max_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_overlaps             = this.flt_show_overlaps;
        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_subdir              = this.patt_save_subdir;