Commit 5980d194 authored by Andrey Filippov's avatar Andrey Filippov
Browse files

Before starting elevations fitting

parent 440719d9
Loading
Loading
Loading
Loading
+71 −6
Original line number Original line Diff line number Diff line
@@ -727,8 +727,12 @@ min_str_neib_fpn 0.35
	public boolean   terr_um_en =             true;
	public boolean   terr_um_en =             true;
	public double    terr_um_sigma =           1.0; 
	public double    terr_um_sigma =           1.0; 
	public double    terr_um_weight =          0.8;
	public double    terr_um_weight =          0.8;
	public double    terr_nan_tolerance =      0.001;  // set undefined terrain (out of capture area) to nan, it is almost zero after UM
	public double    terr_nan_tolerance =      0.001;  // set undefined terrain (out of capture area) to nan, it is almost zero after UM. if !terr_um_en will be forced ==0.0
	public int       terr_nan_grow =          20;      // grow undefined terrain after detection 
	public int       terr_nan_grow =          20;      // grow undefined scenes terrain after detection 
    public int       terr_shrink_veget =      20;      // shrink accumulated vegetation for filling terrain
    public int       terr_shrink_terrain=     20;      // shrink accumulated terrain after cutting shrunk vegetation (added to terr_shrink_veget)
	public double    terr_vegetation_over =   35;      // initial vegetation over (hotter) filled terrain
    public int       terr_filter_veget =      10;      // shrink+grow shrunk vegetation to remove small clusters
	
	
	public boolean   terr_tile_woi =          true; // if false - use woi50;
	public boolean   terr_tile_woi =          true; // if false - use woi50;
	public Rectangle terr_woi_enclos =        new Rectangle(80,  210, 210, 230); // will be tiled, using width/height from woi_step;
	public Rectangle terr_woi_enclos =        new Rectangle(80,  210, 210, 230); // will be tiled, using width/height from woi_step;
@@ -737,6 +741,12 @@ min_str_neib_fpn 0.35
	public boolean   terr_skip_exist=         true; // skip existing woi/parameters, already saved.
	public boolean   terr_skip_exist=         true; // skip existing woi/parameters, already saved.
	public boolean   terr_continue=           false; // start from last/single
	public boolean   terr_continue=           false; // start from last/single
	
	
	public boolean   terr_fit_terr =          true;  // adjust terrain pixels
	public boolean   terr_fit_veget =         true;  // adjust vegetation pixels
	public boolean   terr_fit_alpha =         true;  // adjust vegetation alpha pixels
	public boolean   terr_fit_scenes =        true;  // adjust scene offsets (start from 0 always?)
	public boolean   terr_fit_elevations =    false; // adjust elevation pixels (not yet implemented)
	
	public int       terr_min_scenes =         1; // minimal number of scenes (inside woi) vegetation pixel must influence
	public int       terr_min_scenes =         1; // minimal number of scenes (inside woi) vegetation pixel must influence
	public int       terr_min_samples_scene = 10;
	public int       terr_min_samples_scene = 10;
	public int       terr_min_total_scenes =   2;
	public int       terr_min_total_scenes =   2;
@@ -1970,11 +1980,19 @@ min_str_neib_fpn 0.35
		gd.addStringField ("Model state file", terr_model_state, 50, "Model vegetation source data (w/o extension).");
		gd.addStringField ("Model state file", terr_model_state, 50, "Model vegetation source data (w/o extension).");
		gd.addStringField ("Segments subdir",  terr_segments_dir, 50, "Model vegetation source data (w/o extension).");
		gd.addStringField ("Segments subdir",  terr_segments_dir, 50, "Model vegetation source data (w/o extension).");
		
		
		gd.addMessage     ("Unsharp mask filter of the input data (currently not used as both DC and HF fitting are implemented simultaneously).");
		gd.addCheckbox    ("Enable UM",          terr_um_en,           "Enable unsharp mask filter.");
		gd.addCheckbox    ("Enable UM",          terr_um_en,           "Enable unsharp mask filter.");
		gd.addNumericField("UM sigma",           terr_um_sigma, 5,7,   "pix", "Unsharp mask sigma.");
		gd.addNumericField("UM sigma",           terr_um_sigma, 5,7,   "pix", "Unsharp mask sigma.");
		gd.addNumericField("UM weight",          terr_um_weight, 5,7,  "",    "Unsharp mask weight.");
		gd.addNumericField("UM weight",          terr_um_weight, 5,7,  "",    "Unsharp mask weight.");
		gd.addNumericField("NaN tolerance",      terr_nan_tolerance, 5,7,"", "Replace continuous almost zeros with NaN-s.");

		gd.addNumericField("NaN grow",           terr_nan_grow, 0,3,"pix",   "Grow \"almost\" zero areas after detection (+2 - 8 directions, +1 - only ortho).");
		gd.addMessage     ("Preparaion of the initial LMA approximation");
		gd.addNumericField("NaN tolerance",          terr_nan_tolerance, 5,7,"", "Replace continuous almost zeros with NaN-s (ignored and forced to 0 if no UM filter).");
		gd.addNumericField("NaN grow",               terr_nan_grow, 0,3,"pix",   "Grow zero/\"almost\" zero rendered scene areas (+2 - 8 directions, +1 - only ortho), replace with NaNs.");
		gd.addNumericField("Shrink vegetation",      terr_shrink_veget, 0,3,"pix",   "Shrink detected vegetation areas for terrain separation.");
		gd.addNumericField("Shrink terrain",         terr_shrink_terrain, 0,3,"pix",   "Shrink remaining detected terrain areas before filling with laplacian (terr_shrink_veget is added to start from the original size).");
		gd.addNumericField("Vegetation hotter",      terr_vegetation_over, 5,7,"", "Initially consider to be vegetation if it is this hotter than filled in terrain holes.");
		gd.addNumericField("Vegetation shrink+grow", terr_filter_veget, 0,3,"pix", "Shrink + grow hot enough vegetation to filter from small clusters - needed for initial alpha.");
		
		
		
		gd.addMessage     ("Scan WOI parameters");
		gd.addMessage     ("Scan WOI parameters");
		gd.addCheckbox    ("Tiled WOI",          terr_tile_woi, "Process tiled WOI (False - a single one).");
		gd.addCheckbox    ("Tiled WOI",          terr_tile_woi, "Process tiled WOI (False - a single one).");
@@ -1985,6 +2003,13 @@ min_str_neib_fpn 0.35
        gd.addCheckbox    ("Skip existing WOI",  terr_skip_exist, "Skip already esisting WOIs during scanning.");
        gd.addCheckbox    ("Skip existing WOI",  terr_skip_exist, "Skip already esisting WOIs during scanning.");
        
        
		gd.addMessage     ("LMA losses and goals for alpha, terrain and vegetation pixels");
		gd.addMessage     ("LMA losses and goals for alpha, terrain and vegetation pixels");

		gd.addCheckbox    ("Adjust terrain",       terr_fit_terr,      "Adjust terrain pixels.");
		gd.addCheckbox    ("Adjust vegetation",    terr_fit_veget,     "Adjust vegetation pixels.");
		gd.addCheckbox    ("Adjust alpha",         terr_fit_alpha,     "Adjust vegetation alpha pixels.");
		gd.addCheckbox    ("Adjust scene offsets", terr_fit_scenes,    "Adjust scene offsets (start from 0 always?).");
		gd.addCheckbox    ("Adjust elevation",     terr_fit_elevations,"Adjust elevation pixels (not yet implemented).");
		
		gd.addNumericField("Min influenced scenes",terr_min_scenes, 0,3,  "",   "Minimal number of scenes (inside woi) vegetation pixel must influence.");
		gd.addNumericField("Min influenced scenes",terr_min_scenes, 0,3,  "",   "Minimal number of scenes (inside woi) vegetation pixel must influence.");
		gd.addNumericField("Minimal samples/scene",terr_min_samples_scene, 0,3,"","Minimal samples per scene used for fitting (skip scene if less).");
		gd.addNumericField("Minimal samples/scene",terr_min_samples_scene, 0,3,"","Minimal samples per scene used for fitting (skip scene if less).");
		gd.addNumericField("Minimum scenes used",  terr_min_total_scenes, 0,3,"", "Minimal total number of scenes used (skip segment if less).");
		gd.addNumericField("Minimum scenes used",  terr_min_total_scenes, 0,3,"", "Minimal total number of scenes used (skip segment if less).");
@@ -2668,6 +2693,10 @@ min_str_neib_fpn 0.35
		terr_nan_tolerance =       gd.getNextNumber();// double 
		terr_nan_tolerance =       gd.getNextNumber();// double 
		terr_nan_grow =      (int) gd.getNextNumber();// int
		terr_nan_grow =      (int) gd.getNextNumber();// int
		
		
		terr_shrink_veget =  (int) gd.getNextNumber();// int
		terr_shrink_terrain =(int) gd.getNextNumber();// int
		terr_vegetation_over =     gd.getNextNumber();// double
		terr_filter_veget =  (int) gd.getNextNumber();// int


		terr_tile_woi =            gd.getNextBoolean();// boolean
		terr_tile_woi =            gd.getNextBoolean();// boolean
		terr_continue =            gd.getNextBoolean();// boolean
		terr_continue =            gd.getNextBoolean();// boolean
@@ -2676,6 +2705,12 @@ min_str_neib_fpn 0.35
		terr_woi_last =            stringToRectangle(gd.getNextString());// Rectangle
		terr_woi_last =            stringToRectangle(gd.getNextString());// Rectangle
		terr_skip_exist =          gd.getNextBoolean();// boolean
		terr_skip_exist =          gd.getNextBoolean();// boolean
		
		
		terr_fit_terr =            gd.getNextBoolean();// boolean
		terr_fit_veget =           gd.getNextBoolean();// boolean
		terr_fit_alpha =           gd.getNextBoolean();// boolean
		terr_fit_scenes =          gd.getNextBoolean();// boolean
		terr_fit_elevations =      gd.getNextBoolean();// boolean

		terr_min_scenes =    (int) gd.getNextNumber();// int
		terr_min_scenes =    (int) gd.getNextNumber();// int
		terr_min_samples_scene=(int) gd.getNextNumber();// int
		terr_min_samples_scene=(int) gd.getNextNumber();// int
		terr_min_total_scenes=(int) gd.getNextNumber();// int
		terr_min_total_scenes=(int) gd.getNextNumber();// int
@@ -3328,6 +3363,11 @@ min_str_neib_fpn 0.35
		properties.setProperty(prefix+"terr_nan_tolerance",          terr_nan_tolerance+"");      // double 
		properties.setProperty(prefix+"terr_nan_tolerance",          terr_nan_tolerance+"");      // double 
		properties.setProperty(prefix+"terr_nan_grow",               terr_nan_grow+"");           // int
		properties.setProperty(prefix+"terr_nan_grow",               terr_nan_grow+"");           // int
		
		
		properties.setProperty(prefix+"terr_nan_grow",               terr_nan_grow+"");           // int
		properties.setProperty(prefix+"terr_nan_grow",               terr_nan_grow+"");           // int
		properties.setProperty(prefix+"terr_nan_tolerance",          terr_nan_tolerance+"");      // double 
		properties.setProperty(prefix+"terr_nan_grow",               terr_nan_grow+"");           // int

		properties.setProperty(prefix+"terr_tile_woi",               terr_tile_woi+"");           // boolean
		properties.setProperty(prefix+"terr_tile_woi",               terr_tile_woi+"");           // boolean
		properties.setProperty(prefix+"terr_continue",               terr_continue+"");           // boolean
		properties.setProperty(prefix+"terr_continue",               terr_continue+"");           // boolean
		properties.setProperty(prefix+"terr_woi_enclos", rectangleToString(terr_woi_enclos)+"");  // Rectangle
		properties.setProperty(prefix+"terr_woi_enclos", rectangleToString(terr_woi_enclos)+"");  // Rectangle
@@ -3335,6 +3375,12 @@ min_str_neib_fpn 0.35
		properties.setProperty(prefix+"terr_woi_last",   rectangleToString(terr_woi_last)+"");    // Rectangle
		properties.setProperty(prefix+"terr_woi_last",   rectangleToString(terr_woi_last)+"");    // Rectangle
		properties.setProperty(prefix+"terr_skip_exist",             terr_skip_exist+"");         // boolean
		properties.setProperty(prefix+"terr_skip_exist",             terr_skip_exist+"");         // boolean
		
		
		properties.setProperty(prefix+"terr_fit_terr",               terr_fit_terr+"");           // boolean
		properties.setProperty(prefix+"terr_fit_veget",              terr_fit_veget+"");          // boolean
		properties.setProperty(prefix+"terr_fit_alpha",              terr_fit_alpha+"");          // boolean
		properties.setProperty(prefix+"terr_fit_scenes",             terr_fit_scenes+"");         // boolean
		properties.setProperty(prefix+"terr_fit_elevations",         terr_fit_elevations+"");     // boolean

		properties.setProperty(prefix+"terr_min_scenes",             terr_min_scenes+"");         // int
		properties.setProperty(prefix+"terr_min_scenes",             terr_min_scenes+"");         // int
		properties.setProperty(prefix+"terr_min_samples_scene",      terr_min_samples_scene+"");  // int
		properties.setProperty(prefix+"terr_min_samples_scene",      terr_min_samples_scene+"");  // int
		properties.setProperty(prefix+"terr_min_total_scenes",       terr_min_total_scenes+"");   // int
		properties.setProperty(prefix+"terr_min_total_scenes",       terr_min_total_scenes+"");   // int
@@ -4008,6 +4054,10 @@ min_str_neib_fpn 0.35
		if (properties.getProperty(prefix+"terr_um_weight")!=          null) terr_um_weight=Double.parseDouble(properties.getProperty(prefix+"terr_um_weight"));
		if (properties.getProperty(prefix+"terr_um_weight")!=          null) terr_um_weight=Double.parseDouble(properties.getProperty(prefix+"terr_um_weight"));
		if (properties.getProperty(prefix+"terr_nan_tolerance")!=      null) terr_nan_tolerance=Double.parseDouble(properties.getProperty(prefix+"terr_nan_tolerance"));
		if (properties.getProperty(prefix+"terr_nan_tolerance")!=      null) terr_nan_tolerance=Double.parseDouble(properties.getProperty(prefix+"terr_nan_tolerance"));
		if (properties.getProperty(prefix+"terr_nan_grow")!=           null) terr_nan_grow=Integer.parseInt(properties.getProperty(prefix+"terr_nan_grow"));
		if (properties.getProperty(prefix+"terr_nan_grow")!=           null) terr_nan_grow=Integer.parseInt(properties.getProperty(prefix+"terr_nan_grow"));
		if (properties.getProperty(prefix+"terr_shrink_veget")!=       null) terr_shrink_veget=Integer.parseInt(properties.getProperty(prefix+"terr_shrink_veget"));
		if (properties.getProperty(prefix+"terr_shrink_terrain")!=     null) terr_shrink_terrain=Integer.parseInt(properties.getProperty(prefix+"terr_shrink_terrain"));
		if (properties.getProperty(prefix+"terr_vegetation_over")!=    null) terr_vegetation_over=Double.parseDouble(properties.getProperty(prefix+"terr_vegetation_over"));
		if (properties.getProperty(prefix+"terr_filter_veget")!=       null) terr_filter_veget=Integer.parseInt(properties.getProperty(prefix+"terr_filter_veget"));
		
		
		if (properties.getProperty(prefix+"terr_tile_woi")!=           null) terr_tile_woi=Boolean.parseBoolean(properties.getProperty(prefix+"terr_tile_woi"));
		if (properties.getProperty(prefix+"terr_tile_woi")!=           null) terr_tile_woi=Boolean.parseBoolean(properties.getProperty(prefix+"terr_tile_woi"));
		if (properties.getProperty(prefix+"terr_continue")!=           null) terr_continue=Boolean.parseBoolean(properties.getProperty(prefix+"terr_continue"));
		if (properties.getProperty(prefix+"terr_continue")!=           null) terr_continue=Boolean.parseBoolean(properties.getProperty(prefix+"terr_continue"));
@@ -4016,6 +4066,11 @@ min_str_neib_fpn 0.35
		if (properties.getProperty(prefix+"terr_woi_last")!=           null) terr_woi_last=stringToRectangle((String) properties.getProperty(prefix+"terr_woi_last"));
		if (properties.getProperty(prefix+"terr_woi_last")!=           null) terr_woi_last=stringToRectangle((String) properties.getProperty(prefix+"terr_woi_last"));
		if (properties.getProperty(prefix+"terr_skip_exist")!=         null) terr_skip_exist=Boolean.parseBoolean(properties.getProperty(prefix+"terr_skip_exist"));
		if (properties.getProperty(prefix+"terr_skip_exist")!=         null) terr_skip_exist=Boolean.parseBoolean(properties.getProperty(prefix+"terr_skip_exist"));
		
		
		if (properties.getProperty(prefix+"terr_fit_terr")!=           null) terr_fit_terr=Boolean.parseBoolean(properties.getProperty(prefix+"terr_fit_terr"));
		if (properties.getProperty(prefix+"terr_fit_veget")!=          null) terr_fit_veget=Boolean.parseBoolean(properties.getProperty(prefix+"terr_fit_veget"));
		if (properties.getProperty(prefix+"terr_fit_alpha")!=          null) terr_fit_alpha=Boolean.parseBoolean(properties.getProperty(prefix+"terr_fit_alpha"));
		if (properties.getProperty(prefix+"terr_fit_scenes")!=         null) terr_fit_scenes=Boolean.parseBoolean(properties.getProperty(prefix+"terr_fit_scenes"));
		if (properties.getProperty(prefix+"terr_fit_elevations")!=     null) terr_fit_elevations=Boolean.parseBoolean(properties.getProperty(prefix+"terr_fit_elevations"));
		if (properties.getProperty(prefix+"terr_min_scenes")!=         null) terr_min_scenes=Integer.parseInt(properties.getProperty(prefix+"terr_min_scenes"));
		if (properties.getProperty(prefix+"terr_min_scenes")!=         null) terr_min_scenes=Integer.parseInt(properties.getProperty(prefix+"terr_min_scenes"));
		if (properties.getProperty(prefix+"terr_min_samples_scene")!=  null) terr_min_samples_scene=Integer.parseInt(properties.getProperty(prefix+"terr_min_samples_scene"));
		if (properties.getProperty(prefix+"terr_min_samples_scene")!=  null) terr_min_samples_scene=Integer.parseInt(properties.getProperty(prefix+"terr_min_samples_scene"));
		if (properties.getProperty(prefix+"terr_min_total_scenes")!=   null) terr_min_total_scenes=Integer.parseInt(properties.getProperty(prefix+"terr_min_total_scenes"));
		if (properties.getProperty(prefix+"terr_min_total_scenes")!=   null) terr_min_total_scenes=Integer.parseInt(properties.getProperty(prefix+"terr_min_total_scenes"));
@@ -4658,6 +4713,10 @@ min_str_neib_fpn 0.35
		imp.terr_um_weight =                     this.terr_um_weight;
		imp.terr_um_weight =                     this.terr_um_weight;
		imp.terr_nan_tolerance =                 this.terr_nan_tolerance;
		imp.terr_nan_tolerance =                 this.terr_nan_tolerance;
		imp.terr_nan_grow =                      this.terr_nan_grow;
		imp.terr_nan_grow =                      this.terr_nan_grow;
		imp.terr_shrink_veget =                  this.terr_shrink_veget;
		imp.terr_shrink_terrain =                this.terr_shrink_terrain;
		imp.terr_vegetation_over =               this.terr_vegetation_over;
		imp.terr_filter_veget =                  this.terr_filter_veget;


		imp.terr_tile_woi =                      this.terr_tile_woi;                           
		imp.terr_tile_woi =                      this.terr_tile_woi;                           
		imp.terr_continue =                      this.terr_continue;                           
		imp.terr_continue =                      this.terr_continue;                           
@@ -4666,6 +4725,12 @@ min_str_neib_fpn 0.35
		imp.terr_woi_last =                      new Rectangle(this.terr_woi_last);                           
		imp.terr_woi_last =                      new Rectangle(this.terr_woi_last);                           
		imp.terr_skip_exist =                    this.terr_skip_exist;                           
		imp.terr_skip_exist =                    this.terr_skip_exist;                           


		imp.terr_fit_terr =                      this.terr_fit_terr;                           
		imp.terr_fit_veget =                     this.terr_fit_veget;                           
		imp.terr_fit_alpha =                     this.terr_fit_alpha;                           
		imp.terr_fit_scenes =                    this.terr_fit_scenes;                           
		imp.terr_fit_elevations =                this.terr_fit_elevations;                           
		
		imp.terr_min_scenes =                    this.terr_min_scenes;
		imp.terr_min_scenes =                    this.terr_min_scenes;
		imp.terr_min_samples_scene =             this.terr_min_samples_scene;
		imp.terr_min_samples_scene =             this.terr_min_samples_scene;
		imp.terr_min_total_scenes =              this.terr_min_total_scenes;
		imp.terr_min_total_scenes =              this.terr_min_total_scenes;