Commit 47963228 authored by Andrey Filippov's avatar Andrey Filippov

working terrain-only mode

parent fa638d8f
......@@ -763,7 +763,8 @@ min_str_neib_fpn 0.35
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 boolean terr_fit_terr_elev = false; // adjust terrain elevation (common, maybe add per-pixel later)
public boolean [][] terr_fits_disable = {{false},{false},{false},{true,false,true},{false},{false}};
public boolean terr_fit_terr_elev_pix = false; // adjust terrain elevation (common, maybe add per-pixel later)
public boolean [][] terr_fits_disable = {{false},{false},{false},{true,false,true},{false},{false},{false}};
public double terr_max_warp = 1.8;
public int terr_max_elevation = 22; // maximal offset to consider when looking for vegetation influence
......@@ -822,15 +823,20 @@ min_str_neib_fpn 0.35
public double terr_terr_lpf = 0.1; // pull terrain to average of 4 neighbors
public double terr_veget_lpf = 10.0; // pull vegetation to average of 4 neighbors
public double terr_elev_lpf = 50.0; // pull elevation to average of 4 neighbors
public double terr_terr_elev_lpf = 10.0; // pull terrain elevation to average of 4 neighbors
public double terr_terr_pull0 = 0.1; // pull terrain to initial (pre-adjustment) values
public double terr_terr_pull_up= 0.25; // pull terrain to initial when it is colder
public double terr_terr_pull_avg= 0.1; // Pull terrain to the initial offset by the average offset of all terrain pixels
public double terr_veget_pull0 = 5.0; // pull vegetation initial (pre-adjustment) values
public double terr_veget_pull_low_alpha = 10; // scale (boost) pull0 for low alpha (mostly terrain)
public double terr_elev_pull0 = 1.0; // pull elevation to initial (pre-adjustment) values
public double terr_terr_elev_pull0 = 1.0; // pull terrain elevation to average of all segment terrain elevation
public boolean terr_elev_alpha_en = false;// Enable loss for low vegetation with high opacity
public double terr_elev_alpha = 1.0; // multiply alpha by under-low elevation for loss
public double terr_elev_alpha_pwr = 2.0; // raise alpha to this power (when alpha > 0)
public double terr_low_veget = 2.0; // (pix) Elevation considered low (lower loss for high alpha)
public double terr_scenes_pull0 = 1.0; // pull average scene offset to zero
// scaling elevation losses for high elevations (decrease pull and/or lpf for high elevations)
......@@ -864,6 +870,11 @@ min_str_neib_fpn 0.35
public double terr_rms_diff = 1e-8; // 0.0001; virtually forever
public int terr_last_series = -1; // Last LMA adjustment series (<0 - to the terr_num_iters.length -1)
public int [] terr_num_iters = {30}; //sequence on numbers of iterations
public boolean terr_only_special = true; // special sequences for terrain-only tiles
public boolean terr_only_pix = true; // force per-pixel terrain elevation in terrain-only mode, overwrite fits_disable[TVAO_TERR_ELEV_PIX]
public int terr_only_series = -1; // similar to terr_last_series but for terrain-only mode (<0 - length of terr_only_num_iters)
public int [] terr_only_num_iters = {25}; // number of iterations
// second run
public boolean [] terr_recalc_weights = {false,false,true}; // recalculate weight depending on terrain visibility
......@@ -2122,7 +2133,8 @@ min_str_neib_fpn 0.35
gd.addCheckbox ("Adjust vegetation", terr_fit_veget, "Adjust vegetation pixels.");
gd.addCheckbox ("Adjust alpha", terr_fit_alpha, "Adjust vegetation alpha pixels.");
gd.addCheckbox ("Adjust elevation", terr_fit_elevations,"Adjust elevation pixels.");
gd.addCheckbox ("Adjust terrain elevation",terr_fit_terr_elev,"Adjust terrain elevation common.");
gd.addCheckbox ("Adjust ter elevation common",terr_fit_terr_elev,"Adjust terrain elevation common.");
gd.addCheckbox ("Adjust ter elevation pixel",terr_fit_terr_elev_pix,"Adjust terrain elevation per-pixel.");
gd.addCheckbox ("Adjust scene offsets", terr_fit_scenes, "Adjust scene offsets (start from 0 always?).");
......@@ -2179,6 +2191,7 @@ min_str_neib_fpn 0.35
gd.addNumericField("Terrain diffusion", terr_terr_lpf, 5,7,"", "LPF for terrain pixels (diffusion to 4 neighbors).");
gd.addNumericField("Vegetation diffusion", terr_veget_lpf, 5,7,"", "LPF for vegetation pixels (diffusion to 4 neighbors).");
gd.addNumericField("Elevation diffusion", terr_elev_lpf, 5,7,"", "LPF for elevation pixels (diffusion to 4 neighbors).");
gd.addNumericField("Terrain elevation diffusion", terr_terr_elev_lpf, 5,7,"","LPF for terrain elevation elevation pixels (diffusion to 4 neighbors).");
gd.addNumericField("Terrain pull", terr_terr_pull0, 5,7,"", "Terrain pixels pull to initial (pre-adjustment) values.");
gd.addNumericField("Terrain pull up", terr_terr_pull_up, 5,7,"", "Terrain pixels pull to initial (pre-adjustment) values when it is colder than initial (<0 - sqme as above).");
gd.addNumericField("Terrain pull to average",terr_terr_pull_avg, 5,7,"","Pull terrain to the initial offset by the average offset of all terrain pixels.");
......@@ -2186,6 +2199,7 @@ min_str_neib_fpn 0.35
gd.addNumericField("Boost for low alpha", terr_veget_pull_low_alpha, 5,7,"x", "Scale vegetation pull (terr_veget_pull0) for low alpha (mostly terrain) .");
gd.addNumericField("Elevation pull", terr_elev_pull0, 5,7,"", "Elevation pixels pull to initial (pre-adjustment) values.");
gd.addNumericField("Terrain elevation pull",terr_terr_elev_pull0, 5,7,"","Terrain elevation pixels pull to initial (pre-adjustment) values.");
gd.addCheckbox ("Enable low vegetation",terr_elev_alpha_en, "Enable loss for low vegetation with high opacity.");
gd.addNumericField("Low vegetation loss", terr_elev_alpha, 5,7,"", "Multiply alpha by under-low elevation for loss.");
gd.addNumericField("Low vegetation power", terr_elev_alpha_pwr, 5,7,"", "Raise alpha to this power for low vegetation loss.");
......@@ -2221,13 +2235,18 @@ min_str_neib_fpn 0.35
gd.addNumericField("RMSE difference", terr_rms_diff, 10,12,"", "Exit if RMSE improvement is lower.");
gd.addNumericField("Last LMA series", terr_last_series, 0,3,"","Last LMA series, -1 - to last available in the sequence below.");
gd.addStringField ("Maximal iterations", intsToString(terr_num_iters), 40, "Maximal number of LMA iterations per mode, 1 or multiple values.");
gd.addStringField ("Maximal iterations", intsToString(terr_num_iters), 40, "Maximal number of LMA iterations per series, 1 or several values.");
gd.addMessage ("Terrain-only LMA");
gd.addCheckbox ("Terrain-only mode", terr_only_special, "Treat terrain-only tiles differently (below).");
gd.addCheckbox ("Adjust pixel elevation",terr_only_pix, "Force per-pixel terrain elevation adjustment in terrain-only mode.");
gd.addNumericField("Terrain-only iterations",terr_only_series, 0,3,"", "Last LMA series in terrain-only mode, -1 - to last available in the sequence below.");
gd.addStringField ("Maximal iterations", intsToString(terr_only_num_iters), 40, "Maximal number of LMA iterations per series, 1 or several values.");
gd.addMessage ("Second LMA run");
gd.addStringField ("Recalculate weighths", booleansToString(terr_recalc_weights,2), 40,
"Recalculate weights depending on terrain visibility. Use comma/space separated list of true/false, 1/0 or +/-." );
gd.addNumericField("Opaque alpha", terr_recalc_opaque, 5,7,"", "Alpha above his means opaque.");
gd.addNumericField("Opaque weight", terr_recalc_pedestal, 5,7,"","Relative weight of opaque tiles.");
gd.addNumericField("Transparency fraction",terr_recalc_frac, 5,7,"", "Discard transparency below this fraction of the maximal one.");
......@@ -2919,6 +2938,7 @@ min_str_neib_fpn 0.35
terr_fit_alpha = gd.getNextBoolean();// boolean
terr_fit_elevations = gd.getNextBoolean();// boolean
terr_fit_terr_elev = gd.getNextBoolean();// boolean
terr_fit_terr_elev_pix = gd.getNextBoolean();// boolean
terr_fit_scenes = gd.getNextBoolean();// boolean
for (int i = 0; i < terr_fits_disable.length; i++) {
terr_fits_disable[i] = StringToBooleans(gd.getNextString());// booleans
......@@ -2969,12 +2989,14 @@ min_str_neib_fpn 0.35
terr_terr_lpf = gd.getNextNumber();// double
terr_veget_lpf = gd.getNextNumber();// double
terr_elev_lpf = gd.getNextNumber();// double
terr_terr_elev_lpf = gd.getNextNumber();// double
terr_terr_pull0 = gd.getNextNumber();// double
terr_terr_pull_up = gd.getNextNumber();// double
terr_terr_pull_avg = gd.getNextNumber();// double
terr_veget_pull0 = gd.getNextNumber();// double
terr_veget_pull_low_alpha= gd.getNextNumber();// double
terr_elev_pull0 = gd.getNextNumber();// double
terr_terr_elev_pull0 = gd.getNextNumber();// double
terr_elev_alpha_en = gd.getNextBoolean();// boolean
terr_elev_alpha = gd.getNextNumber();// double
terr_elev_alpha_pwr = gd.getNextNumber();// double
......@@ -3006,6 +3028,12 @@ min_str_neib_fpn 0.35
terr_rms_diff = gd.getNextNumber();// double
terr_last_series = (int) gd.getNextNumber();// int
terr_num_iters = StringToInts(gd.getNextString());
terr_only_special = gd.getNextBoolean();// boolean
terr_only_pix = gd.getNextBoolean();// boolean
terr_only_series = (int) gd.getNextNumber();// int
terr_only_num_iters = StringToInts(gd.getNextString());
terr_recalc_weights = StringToBooleans(gd.getNextString());// booleans
terr_recalc_opaque = gd.getNextNumber(); // double
terr_recalc_pedestal = gd.getNextNumber(); // double
......@@ -3668,6 +3696,7 @@ min_str_neib_fpn 0.35
properties.setProperty(prefix+"terr_fit_alpha", terr_fit_alpha+""); // boolean
properties.setProperty(prefix+"terr_fit_elevations", terr_fit_elevations+""); // boolean
properties.setProperty(prefix+"terr_fit_terr_elev", terr_fit_terr_elev+""); // boolean
properties.setProperty(prefix+"terr_fit_terr_elev_pix", terr_fit_terr_elev_pix+""); // boolean
properties.setProperty(prefix+"terr_fit_scenes", terr_fit_scenes+""); // boolean
for (int i = 0; i < terr_fits_disable.length; i++) {
......@@ -3720,12 +3749,15 @@ min_str_neib_fpn 0.35
properties.setProperty(prefix+"terr_terr_lpf", terr_terr_lpf+""); // double
properties.setProperty(prefix+"terr_veget_lpf", terr_veget_lpf+""); // double
properties.setProperty(prefix+"terr_elev_lpf", terr_elev_lpf+""); // double
properties.setProperty(prefix+"terr_terr_elev_lpf", terr_terr_elev_lpf+""); // double
properties.setProperty(prefix+"terr_terr_pull0", terr_terr_pull0+""); // double
properties.setProperty(prefix+"terr_terr_pull_up", terr_terr_pull_up+""); // double
properties.setProperty(prefix+"terr_terr_pull_avg", terr_terr_pull_avg+""); // double
properties.setProperty(prefix+"terr_veget_pull0", terr_veget_pull0+""); // double
properties.setProperty(prefix+"terr_veget_pull_low_alpha", terr_veget_pull_low_alpha+"");// double
properties.setProperty(prefix+"terr_elev_pull0", terr_elev_pull0+""); // double
properties.setProperty(prefix+"terr_terr_elev_pull0", terr_terr_elev_pull0+""); // double
properties.setProperty(prefix+"terr_elev_alpha_en", terr_elev_alpha_en+""); // boolean
properties.setProperty(prefix+"terr_elev_alpha", terr_elev_alpha+""); // double
properties.setProperty(prefix+"terr_elev_alpha_pwr", terr_elev_alpha_pwr+""); // double
......@@ -3758,6 +3790,12 @@ min_str_neib_fpn 0.35
properties.setProperty(prefix+"terr_rms_diff", terr_rms_diff+""); // double
properties.setProperty(prefix+"terr_last_series", terr_last_series+""); // int
properties.setProperty(prefix+"terr_num_iters", intsToString(terr_num_iters)+""); // int []
properties.setProperty(prefix+"terr_only_special", terr_only_special+""); // boolean
properties.setProperty(prefix+"terr_only_pix", terr_only_pix+""); // boolean
properties.setProperty(prefix+"terr_only_series", terr_only_series+""); // int
properties.setProperty(prefix+"terr_only_num_iters", intsToString(terr_only_num_iters)+""); // int []
properties.setProperty(prefix+"terr_recalc_weights", booleansToString(terr_recalc_weights,2)); // boolean
properties.setProperty(prefix+"terr_recalc_opaque", terr_recalc_opaque+""); // double
properties.setProperty(prefix+"terr_recalc_pedestal", terr_recalc_pedestal+""); // double
......@@ -4437,6 +4475,7 @@ min_str_neib_fpn 0.35
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_elevations")!= null) terr_fit_elevations=Boolean.parseBoolean(properties.getProperty(prefix+"terr_fit_elevations"));
if (properties.getProperty(prefix+"terr_fit_terr_elev")!= null) terr_fit_terr_elev=Boolean.parseBoolean(properties.getProperty(prefix+"terr_fit_terr_elev"));
if (properties.getProperty(prefix+"terr_fit_terr_elev_pix")!= null) terr_fit_terr_elev_pix=Boolean.parseBoolean(properties.getProperty(prefix+"terr_fit_terr_elev_pix"));
if (properties.getProperty(prefix+"terr_fit_scenes")!= null) terr_fit_scenes=Boolean.parseBoolean(properties.getProperty(prefix+"terr_fit_scenes"));
for (int i = 0; i < terr_fits_disable.length; i++) {
String prop_name_old = prefix+"terr_fit_disable_"+VegetationLMA.TVAO_NAMES[i];
......@@ -4489,12 +4528,15 @@ min_str_neib_fpn 0.35
if (properties.getProperty(prefix+"terr_terr_lpf")!= null) terr_terr_lpf=Double.parseDouble(properties.getProperty(prefix+"terr_terr_lpf"));
if (properties.getProperty(prefix+"terr_veget_lpf")!= null) terr_veget_lpf=Double.parseDouble(properties.getProperty(prefix+"terr_veget_lpf"));
if (properties.getProperty(prefix+"terr_elev_lpf")!= null) terr_elev_lpf=Double.parseDouble(properties.getProperty(prefix+"terr_elev_lpf"));
if (properties.getProperty(prefix+"terr_terr_elev_lpf")!= null) terr_terr_elev_lpf=Double.parseDouble(properties.getProperty(prefix+"terr_terr_elev_lpf"));
if (properties.getProperty(prefix+"terr_terr_pull0")!= null) terr_terr_pull0=Double.parseDouble(properties.getProperty(prefix+"terr_terr_pull0"));
if (properties.getProperty(prefix+"terr_terr_pull_up")!= null) terr_terr_pull_up=Double.parseDouble(properties.getProperty(prefix+"terr_terr_pull_up"));
if (properties.getProperty(prefix+"terr_terr_pull_avg")!= null) terr_terr_pull_avg=Double.parseDouble(properties.getProperty(prefix+"terr_terr_pull_avg"));
if (properties.getProperty(prefix+"terr_veget_pull0")!= null) terr_veget_pull0=Double.parseDouble(properties.getProperty(prefix+"terr_veget_pull0"));
if (properties.getProperty(prefix+"terr_veget_pull_low_alpha")!= null)terr_veget_pull_low_alpha=Double.parseDouble(properties.getProperty(prefix+"terr_veget_pull_low_alpha"));
if (properties.getProperty(prefix+"terr_elev_pull0")!= null) terr_elev_pull0=Double.parseDouble(properties.getProperty(prefix+"terr_elev_pull0"));
if (properties.getProperty(prefix+"terr_terr_elev_pull0")!= null) terr_terr_elev_pull0=Double.parseDouble(properties.getProperty(prefix+"terr_terr_elev_pull0"));
if (properties.getProperty(prefix+"terr_elev_alpha_en")!= null) terr_elev_alpha_en=Boolean.parseBoolean(properties.getProperty(prefix+"terr_elev_alpha_en"));
if (properties.getProperty(prefix+"terr_elev_alpha")!= null) terr_elev_alpha=Double.parseDouble(properties.getProperty(prefix+"terr_elev_alpha"));
if (properties.getProperty(prefix+"terr_elev_alpha_pwr")!= null) terr_elev_alpha_pwr=Double.parseDouble(properties.getProperty(prefix+"terr_elev_alpha_pwr"));
......@@ -4527,6 +4569,11 @@ min_str_neib_fpn 0.35
if (properties.getProperty(prefix+"terr_num_iter")!= null) terr_num_iters=new int[] {Integer.parseInt(properties.getProperty(prefix+"terr_num_iter"))};
if (properties.getProperty(prefix+"terr_num_iters")!= null) terr_num_iters=StringToInts((String) properties.getProperty(prefix+"terr_num_iters"));
if (properties.getProperty(prefix+"terr_only_special")!= null) terr_only_special=Boolean.parseBoolean(properties.getProperty(prefix+"terr_only_special"));
if (properties.getProperty(prefix+"terr_only_pix")!= null) terr_only_pix=Boolean.parseBoolean(properties.getProperty(prefix+"terr_only_pix"));
if (properties.getProperty(prefix+"terr_only_series")!= null) terr_only_series=Integer.parseInt(properties.getProperty(prefix+"terr_only_series"));
if (properties.getProperty(prefix+"terr_only_num_iters")!= null) terr_only_num_iters=StringToInts((String) properties.getProperty(prefix+"terr_only_num_iters"));
if (properties.getProperty(prefix+"terr_recalc_weights")!= null) {
terr_recalc_weights= StringToBooleans(properties.getProperty(prefix+"terr_recalc_weights"));// booleans
}
......@@ -5178,6 +5225,7 @@ min_str_neib_fpn 0.35
imp.terr_fit_alpha = this.terr_fit_alpha;
imp.terr_fit_elevations = this.terr_fit_elevations;
imp.terr_fit_terr_elev = this.terr_fit_terr_elev;
imp.terr_fit_terr_elev_pix = this.terr_fit_terr_elev_pix;
imp.terr_fit_scenes = this.terr_fit_scenes;
for (int i = 0; i < terr_fits_disable.length; i++) {
imp.terr_fits_disable[i] = this.terr_fits_disable[i].clone();
......@@ -5226,12 +5274,14 @@ min_str_neib_fpn 0.35
imp.terr_terr_lpf = this.terr_terr_lpf;
imp.terr_veget_lpf = this.terr_veget_lpf;
imp.terr_elev_lpf = this.terr_elev_lpf;
imp.terr_terr_elev_lpf = this.terr_terr_elev_lpf;
imp.terr_terr_pull0 = this.terr_terr_pull0;
imp.terr_terr_pull_up = this.terr_terr_pull_up;
imp.terr_terr_pull_avg = this.terr_terr_pull_avg;
imp.terr_veget_pull0 = this.terr_veget_pull0;
imp.terr_veget_pull_low_alpha = this.terr_veget_pull_low_alpha;
imp.terr_elev_pull0 = this.terr_elev_pull0;
imp.terr_terr_elev_pull0 = this.terr_terr_elev_pull0;
imp.terr_elev_alpha_en = this.terr_elev_alpha_en;
imp.terr_elev_alpha = this.terr_elev_alpha;
imp.terr_elev_alpha_pwr = this.terr_elev_alpha_pwr;
......@@ -5263,6 +5313,11 @@ min_str_neib_fpn 0.35
imp.terr_last_series = this.terr_last_series;
imp.terr_num_iters = this.terr_num_iters.clone();
imp.terr_only_special = this.terr_only_special;
imp.terr_only_pix = this.terr_only_pix;
imp.terr_only_series = this.terr_only_series;
imp.terr_only_num_iters = this.terr_only_num_iters.clone();
imp.terr_recalc_weights = this.terr_recalc_weights.clone();
imp.terr_recalc_opaque = this.terr_recalc_opaque;
imp.terr_recalc_pedestal = this.terr_recalc_pedestal;
......
This source diff could not be displayed because it is too large. You can view the blob instead.
......@@ -1535,6 +1535,7 @@ public class VegetationModel {
double terr_lpf = clt_parameters.imp.terr_terr_lpf; // 0.1; // 0.15; /// 0.2; /// 0.1; // pull terrain to average of 4 neighbors (very small)
double veget_lpf = clt_parameters.imp.terr_veget_lpf; // 0.2; //0.15; /// 0.2; //// 0.01; /// 0.1; // pull vegetation to average of 4 neighbors (very small - maybe not needed)
double elevation_lpf = clt_parameters.imp.terr_elev_lpf;
double terr_elev_lpf = clt_parameters.imp.terr_terr_elev_lpf;
double terr_pull0 = clt_parameters.imp.terr_terr_pull0; // 0.1; //0.03; ////// 0.05; ///// 0.1; //// 0.01; /// 0.2; /// 0.1; //pull terrain to zero (makes sense with UM
double terr_pull_up = clt_parameters.imp.terr_terr_pull_up; // 0.2; // Terrain pixels pull to initial (pre-adjustment) values when it is colder than initial.
double terr_pull_avg = clt_parameters.imp.terr_terr_pull_avg; // 0.1; // Pull terrain to the initial offset by the average offset of all terrain pixels
......@@ -1543,6 +1544,9 @@ public class VegetationModel {
double veget_pull_low_alpha = clt_parameters.imp.terr_veget_pull_low_alpha; //10; // scale pull0 for low alpha (mostly terrain)
double elev_pull0 = clt_parameters.imp.terr_elev_pull0;
double terr_elev_pull0 = clt_parameters.imp.terr_terr_elev_pull0;
boolean elev_alpha_en= clt_parameters.imp.terr_elev_alpha_en; // false;// Enable loss for low vegetation with high opacity
double elev_alpha = clt_parameters.imp.terr_elev_alpha; // 1.0; // multiply alpha by under-low elevation for loss
double elev_alpha_pwr = clt_parameters.imp.terr_elev_alpha_pwr; // 1.0; // multiply alpha by under-low elevation for loss
......@@ -1573,6 +1577,7 @@ public class VegetationModel {
boolean fit_scenes = clt_parameters.imp.terr_fit_scenes; // true; // adjust scene offsets (start from 0 always?)
boolean fit_elevations = clt_parameters.imp.terr_fit_elevations; // false; // adjust elevation pixels (not yet implemented)
boolean fit_terr_elev = clt_parameters.imp.terr_fit_terr_elev; // false; // adjust terrain elevation (common, maybe add per-pixel later)
boolean fit_terr_elev_pix = clt_parameters.imp.terr_fit_terr_elev_pix; // false; // adjust terrain elevation (common, maybe add per-pixel later)
// boolean [] fit_disable = clt_parameters.imp.terr_fit_disable.clone();
boolean [][] fits_disable = new boolean[clt_parameters.imp.terr_fits_disable.length][];
......@@ -1589,6 +1594,13 @@ public class VegetationModel {
int [] num_iters = clt_parameters.imp.terr_num_iters; // {25}; // 100;
int last_series = clt_parameters.imp.terr_last_series; // -1; // 100;
if (last_series < 0) last_series = num_iters.length - 1;
boolean terr_only_special = clt_parameters.imp.terr_only_special; // true; // special sequences for terrain-only tiles
boolean terr_only_pix = clt_parameters.imp.terr_only_pix; // true; // force per-pixel terrain elevation in terrain-only mode, overwrite fits_disable[TVAO_TERR_ELEV_PIX]
int terr_only_series = clt_parameters.imp.terr_only_series; // -1; // similar to terr_last_series but for terrain-only mode (<0 - length of terr_only_num_iters)
int [] terr_only_num_iters=clt_parameters.imp.terr_only_num_iters; // {25}; // number of iterations
if (terr_only_series < 0) terr_only_series = terr_only_num_iters.length - 1;
// Combine parameters
int border_width = clt_parameters.imp.terr_border_width; // 6;
boolean render_open = clt_parameters.imp.terr_render_open; // true; // render open areas (no vegetation offset)
......@@ -2111,6 +2123,7 @@ public class VegetationModel {
fit_scenes, // final boolean adjust_scenes,
fit_elevations, // final boolean adjust_elevations,
fit_terr_elev, // final boolean fit_terr_elev,
fit_terr_elev_pix, // final boolean fit_terr_elev_pix,
thisOrLast(step_restore, fits_disable), // fits_disables[0], // final boolean [] fit_disable,
reg_weights, // final double reg_weights, // fraction of the total weight used for regularization
alpha_loss, // final double alpha_loss, // alpha quadratic growing loss for when out of [0,1] range
......@@ -2133,12 +2146,15 @@ public class VegetationModel {
terr_lpf, // final double terr_lpf, // pull terrain to average of 4 neighbors (very small)
veget_lpf, // final double veget_lpf, // pull vegetation to average of 4 neighbors (very small - maybe not needed)
elevation_lpf, // final double elevation_lpf,
terr_elev_lpf, // final double terr_elev_lpf,
terr_pull0, // final double terr_pull0, // pull terrain to initial (pre-adjustment) values
terr_pull_up, // final double terr_pull_up, // Terrain pixels pull to initial (pre-adjustment) values when it is colder than initial.
terr_pull_avg, // final double terr_pull_avg, // pull terrain to the initial offset by the average offset of all terrain pixels
veget_pull0, // final double veget_pull0, // pull vegetation to initial (pre-adjustment) values
veget_pull_low_alpha, //final double veget_pull_low_alpha, // 10; // ()scale pull0 for low alpha (mostly terrain)
elev_pull0, // final double elev_pull0, // pull elevation to initial (pre-adjustment) values
terr_elev_pull0, // final double terr_elev_pull0, // pull terrain elevation to segment average
elev_alpha_en, // final boolean elev_alpha_en, // false; // Enable loss for low vegetation with high opacity
elev_alpha, // final double elev_alpha, // 1.0; // multiply alpha by under-low elevation for loss
elev_alpha_pwr, // final double elev_alpha_pwr, // 2.0; // raise alpha to this power (when alpha > 0)
......@@ -2155,8 +2171,9 @@ public class VegetationModel {
ttop_rel_rad, // final double ttop_rel_rad, // 0.25; // Relative (to the top height) sample ring radius
ttop_frac, // final double ttop_frac, // 0.5; // Minimal fraction of the ring pixels below sample level
ttop_rem_rad, // final double ttop_rem_rad, // 0.25; // Relative (to the top height) remove transparency radius
boost_parallax,// final double boost_parallax, // increase weight of scene with maximal parallax relative to the reference scene
terr_only_special,// final boolean terr_only_special,//true; // special sequences for terrain-only tiles
terr_only_pix, // final boolean terr_only_pix, //true; // force per-pixel terrain elevation in terrain-only mode, overwrite fits_disable[TVAO_TERR_ELEV_PIX]
boost_parallax, // final double boost_parallax, // increase weight of scene with maximal parallax relative to the reference scene
max_parallax, //final double max_parallax, // do not consider maximal parallax above this (consider it a glitch)
debugLevel, // final int debugLevel);
debug_path, // final String debug_path,
......@@ -2167,6 +2184,12 @@ public class VegetationModel {
System.out.println("Insufficient data in this segment, skipping it.");
continue;
}
/// Handle terrain-only tiles
if ((vegetationLMA.getWoiVeg() == null) && terr_only_special) {
last_series = terr_only_series;
num_iters = terr_only_num_iters;
}
if (save_par_files && skip_existing_woi) { // check that segment already exists
File[] segment_files = vegetationLMA.getSegmentFiles(segments_dir);
......
......@@ -9,7 +9,7 @@ import com.elphel.imagej.tileprocessor.ImageDtt;
import com.elphel.imagej.tileprocessor.QuadCLT;
public class VegetationSegment {
public Rectangle woi_veg;
public Rectangle woi_max;
public Rectangle woi;
public double [] scene_offsets;
public double [][] tva; // woi_veg
......@@ -19,7 +19,7 @@ public class VegetationSegment {
public String path;
public VegetationSegment(
String path,
Rectangle woi_veg,
Rectangle woi_max,
Rectangle woi,
double terrain_offset,
double [] scene_offsets, // has NaNs
......@@ -28,7 +28,7 @@ public class VegetationSegment {
boolean [] overlaid) {
this.path = path;
this.woi = woi;
this.woi_veg = woi_veg;
this.woi_max = woi_max;
this.scene_offsets = scene_offsets;
this.tva = tva;
this.terrain_offset = terrain_offset;
......@@ -43,7 +43,7 @@ public class VegetationSegment {
for (int windx = 0; windx < woi_length; windx++) {
int wx = windx % woi.width;
int wy = windx / woi.height;
int wvindx = (wx + woi.x - woi_veg.x) + (wy + woi.y - woi_veg.y) * woi_veg.width;
int wvindx = (wx + woi.x - woi_max.x) + (wy + woi.y - woi_max.y) * woi_max.width;
if (overlaid[windx]) {
tva[0][wvindx] += terrain_offset;
}
......@@ -56,7 +56,7 @@ public class VegetationSegment {
boolean use_veg) {
Rectangle bounds = null;
for (VegetationSegment segment:segments) {
Rectangle selected_woi = use_veg ?segment.woi_veg : segment.woi;
Rectangle selected_woi = use_veg ?segment.woi_max : segment.woi;
if (bounds == null) {
bounds = new Rectangle(selected_woi);
} else {
......@@ -92,12 +92,12 @@ public class VegetationSegment {
double min_sw = 1e-4;
int out_length = out_woi.width*out_woi.height;
int accum_indx = segments.length;
String [] top_titles = {"terrain","vegetation","alpha","elevation","confidence"};
String [] top_titles = {"terrain","vegetation","alpha","elevation","terrain_elevation","confidence"};
double [][][] preview_data = new double [top_titles.length][accum_indx+1][out_length];
String [] titles = new String[accum_indx+1];
for (int ns = 0; ns < segments.length; ns++) {
Rectangle woi = segments[ns].woi; // for confidence and limits for terrain
Rectangle woi_veg = segments[ns].woi_veg;
Rectangle woi_veg = segments[ns].woi_max;
titles[ns] = woi.toString();
int woi_length = woi.width * woi.height;
int woi_veg_length = woi_veg.width * woi_veg.height;
......@@ -121,7 +121,7 @@ public class VegetationSegment {
break;
case 1: // vegetation
case 2: // alpha
case 3: // vegetation
case 3: // elevation
for (int windx = 0; windx < woi_veg_length; windx++) {
int x = windx % woi_veg.width + woi_veg.x - out_woi.x;
int y = windx / woi_veg.width + woi_veg.y - out_woi.y;
......@@ -129,7 +129,15 @@ public class VegetationSegment {
preview_data[t][ns][indx] = woi_tva[t][windx];
}
break;
case 4: // confidence
case 4: // terrain elevation
for (int windx = 0; windx < woi_veg_length; windx++) {
int x = windx % woi_veg.width + woi_veg.x - out_woi.x;
int y = windx / woi_veg.width + woi_veg.y - out_woi.y;
int indx = x + y * out_woi.width;
preview_data[t][ns][indx] = woi_tva[t][windx]; // skipping terrain elevation average
}
break;
case 5: // confidence
for (int windx = 0; windx < woi_length; windx++) {
int x = windx % woi.width + woi_veg.x - out_woi.x;
int y = windx / woi.width + woi_veg.y - out_woi.y;
......
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