Commit d152fbaa authored by Andrey Filippov's avatar Andrey Filippov

refactoring

parent 7506079e
......@@ -720,10 +720,12 @@ min_str_neib_fpn 0.35
public Color annotate_color_mono = new Color( 255, 180, 50); // reddish over grey
public boolean annotate_transparent_mono = false; // // black if not transparent
// terrain parameters
// terrain/vegetation parameters
public boolean terr_um_en = true;
public double terr_um_sigma = 1.0;
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 int terr_nan_grow = 20; // grow undefined terrain after detection
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;
......@@ -733,6 +735,10 @@ min_str_neib_fpn 0.35
public boolean terr_continue= false; // start from last/single
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_total_scenes = 2;
public int terr_min_pixels = 10;
public double terr_alpha_dflt = 0.5;
public double terr_alpha_loss = 100.0;
public double terr_alpha_offset = 0.0;
......@@ -750,6 +756,7 @@ min_str_neib_fpn 0.35
// LMA parameters
public double terr_boost_parallax = 3.0; //
public double terr_max_parallax = 10.0; // parallax limit when evaluating boost parallax
public double terr_reg_weights = 0.25; // fraction of the total weight used for regularization
public double terr_lambda = 5.0; //
public double terr_lambda_scale_good = 0.5;
......@@ -765,6 +772,9 @@ min_str_neib_fpn 0.35
public double terr_alpha_min = 0.1; // below - completely transparent vegetation
public double terr_alpha_max = 0.8; // above - completely opaque
public double terr_weight_opaque = 0.02; // render through completely opaque vegetation
public double terr_boost_render = 3.0; // boost parallax during render
public double terr_max_render = 10.0; // maximal parallax during render
public int terr_num_exaggerate = 3; // generate exagerrated rendering
// Experimental reconstruction
......@@ -1944,6 +1954,8 @@ min_str_neib_fpn 0.35
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 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 ("Scan WOI parameters");
gd.addCheckbox ("Tiled WOI", terr_tile_woi, "Process tiled WOI (False - a single one).");
......@@ -1955,6 +1967,9 @@ min_str_neib_fpn 0.35
gd.addMessage ("LMA losses and goals for alpha, terrain and vegetation pixels");
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("Minimum scenes used", terr_min_total_scenes, 0,3,"", "Minimal total number of scenes used (skip segment if less).");
gd.addNumericField("Minimal pixels fitted",terr_min_pixels, 0,3,"", "Minimal number of terrain and vegetation pixels used for fitting in this segment(skip segment if less).");
gd.addNumericField("Defalt alpha", terr_alpha_dflt, 5,7,"", "Default vegetation alpha.");
gd.addNumericField("Alpha loss", terr_alpha_loss, 5,7,"", "Alpha quadratic growing loss for when out of [0,1] range");
gd.addNumericField("Alpha offset", terr_alpha_offset, 5,7,"", "Start alpha losses above 0.0 and below 1.0 by this value.");
......@@ -1972,6 +1987,7 @@ min_str_neib_fpn 0.35
gd.addMessage ("LMA parameters");
gd.addNumericField("Boost parallax", terr_boost_parallax, 5,7,"", "Increase weight of scenes that have high parallax to the reference one.");
gd.addNumericField("Limit parallax", terr_max_parallax, 5,7,"", "Parallax limit when evaluating boost parallax.");
gd.addNumericField("Losses weight", terr_reg_weights, 5,7,"", "Fraction of other losses compared to the RMSE.");
gd.addNumericField("Initial lambda", terr_lambda, 5,7,"", "Initial LMA lambda.");
gd.addNumericField("Lambda scale on good", terr_lambda_scale_good, 5,7,"","Scale lambda if RMSE improved.");
......@@ -1987,6 +2003,8 @@ min_str_neib_fpn 0.35
gd.addNumericField("Transparent alpha", terr_alpha_min, 5,7,"", ".");
gd.addNumericField("Opaque alpha", terr_alpha_max, 5,7,"", ".");
gd.addNumericField("Opaque weight", terr_weight_opaque, 5,7,"", ".");
gd.addNumericField("Boost parallax render",terr_boost_render, 5,7,"", "Increase weight of scenes that have high parallax to the reference one (during render).");
gd.addNumericField("Limit parallax render",terr_max_render, 5,7,"", "Parallax limit when evaluating boost parallax (during render).");
gd.addNumericField("Exagerrate steps", terr_num_exaggerate, 0,3,"", ".");
gd.addMessage ("Experimental");
......@@ -2616,6 +2634,9 @@ min_str_neib_fpn 0.35
terr_um_en = gd.getNextBoolean();// boolean
terr_um_sigma = gd.getNextNumber();// double
terr_um_weight = gd.getNextNumber();// double
terr_nan_tolerance = gd.getNextNumber();// double
terr_nan_grow = (int) gd.getNextNumber();// int
terr_tile_woi = gd.getNextBoolean();// boolean
terr_continue = gd.getNextBoolean();// boolean
......@@ -2625,6 +2646,10 @@ min_str_neib_fpn 0.35
terr_skip_exist = gd.getNextBoolean();// boolean
terr_min_scenes = (int) gd.getNextNumber();// int
terr_min_samples_scene=(int) gd.getNextNumber();// int
terr_min_total_scenes=(int) gd.getNextNumber();// int
terr_min_pixels = (int) gd.getNextNumber();// int
terr_alpha_dflt = gd.getNextNumber();// double
terr_alpha_loss = gd.getNextNumber();// double
terr_alpha_offset = gd.getNextNumber();// double
......@@ -2641,6 +2666,7 @@ min_str_neib_fpn 0.35
terr_veget_pull0 = gd.getNextNumber();// double
terr_boost_parallax = gd.getNextNumber();// double
terr_max_parallax = gd.getNextNumber();// double
terr_reg_weights = gd.getNextNumber();// double
terr_lambda = gd.getNextNumber();// double
terr_lambda_scale_good = gd.getNextNumber();// double
......@@ -2655,6 +2681,8 @@ min_str_neib_fpn 0.35
terr_alpha_min = gd.getNextNumber();// double
terr_alpha_max = gd.getNextNumber();// double
terr_weight_opaque = gd.getNextNumber();// double
terr_boost_render = gd.getNextNumber();// double
terr_max_render = gd.getNextNumber();// double
terr_num_exaggerate = (int)gd.getNextNumber();// int
terr_threshold_terrain = gd.getNextNumber();// double
......@@ -3254,6 +3282,8 @@ min_str_neib_fpn 0.35
properties.setProperty(prefix+"terr_um_en", terr_um_en+""); // boolean
properties.setProperty(prefix+"terr_um_sigma", terr_um_sigma+""); // double
properties.setProperty(prefix+"terr_um_weight", terr_um_weight+""); // 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_tile_woi", terr_tile_woi+""); // boolean
properties.setProperty(prefix+"terr_continue", terr_continue+""); // boolean
......@@ -3263,6 +3293,9 @@ min_str_neib_fpn 0.35
properties.setProperty(prefix+"terr_skip_exist", terr_skip_exist+""); // boolean
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_total_scenes", terr_min_total_scenes+""); // int
properties.setProperty(prefix+"terr_min_pixels", terr_min_pixels+""); // int
properties.setProperty(prefix+"terr_alpha_dflt", terr_alpha_dflt+""); // double
properties.setProperty(prefix+"terr_alpha_loss", terr_alpha_loss+""); // double
properties.setProperty(prefix+"terr_alpha_offset", terr_alpha_offset+""); // double
......@@ -3279,6 +3312,7 @@ min_str_neib_fpn 0.35
properties.setProperty(prefix+"terr_veget_pull0", terr_veget_pull0+""); // double
properties.setProperty(prefix+"terr_boost_parallax", terr_boost_parallax+""); // double
properties.setProperty(prefix+"terr_max_parallax", terr_max_parallax+""); // double
properties.setProperty(prefix+"terr_reg_weights", terr_reg_weights+""); // double
properties.setProperty(prefix+"terr_lambda", terr_lambda+""); // double
properties.setProperty(prefix+"terr_lambda_scale_good", terr_lambda_scale_good+""); // double
......@@ -3293,6 +3327,8 @@ min_str_neib_fpn 0.35
properties.setProperty(prefix+"terr_alpha_min", terr_alpha_min+""); // double
properties.setProperty(prefix+"terr_alpha_max", terr_alpha_max+""); // double
properties.setProperty(prefix+"terr_weight_opaque", terr_weight_opaque+""); // double
properties.setProperty(prefix+"terr_boost_render", terr_boost_render+""); // double
properties.setProperty(prefix+"terr_max_render", terr_max_render+""); // double
properties.setProperty(prefix+"terr_num_exaggerate", terr_num_exaggerate+""); // int
properties.setProperty(prefix+"terr_threshold_terrain", terr_threshold_terrain+""); // double
......@@ -3915,6 +3951,8 @@ min_str_neib_fpn 0.35
if (properties.getProperty(prefix+"terr_um_en")!= null) terr_um_en=Boolean.parseBoolean(properties.getProperty(prefix+"terr_um_en"));
if (properties.getProperty(prefix+"terr_um_sigma")!= null) terr_um_sigma=Double.parseDouble(properties.getProperty(prefix+"terr_um_sigma"));
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_grow")!= null) terr_nan_grow=Integer.parseInt(properties.getProperty(prefix+"terr_nan_grow"));
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"));
......@@ -3924,6 +3962,9 @@ min_str_neib_fpn 0.35
if (properties.getProperty(prefix+"terr_skip_exist")!= null) terr_skip_exist=Boolean.parseBoolean(properties.getProperty(prefix+"terr_skip_exist"));
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_total_scenes")!= null) terr_min_total_scenes=Integer.parseInt(properties.getProperty(prefix+"terr_min_total_scenes"));
if (properties.getProperty(prefix+"terr_min_pixels")!= null) terr_min_pixels=Integer.parseInt(properties.getProperty(prefix+"terr_min_pixels"));
if (properties.getProperty(prefix+"terr_alpha_dflt")!= null) terr_alpha_dflt=Double.parseDouble(properties.getProperty(prefix+"terr_alpha_dflt"));
if (properties.getProperty(prefix+"terr_alpha_loss")!= null) terr_alpha_loss=Double.parseDouble(properties.getProperty(prefix+"terr_alpha_loss"));
if (properties.getProperty(prefix+"terr_alpha_offset")!= null) terr_alpha_offset=Double.parseDouble(properties.getProperty(prefix+"terr_alpha_offset"));
......@@ -3940,6 +3981,7 @@ min_str_neib_fpn 0.35
if (properties.getProperty(prefix+"terr_veget_pull0")!= null) terr_veget_pull0=Double.parseDouble(properties.getProperty(prefix+"terr_veget_pull0"));
if (properties.getProperty(prefix+"terr_boost_parallax")!= null) terr_boost_parallax=Double.parseDouble(properties.getProperty(prefix+"terr_boost_parallax"));
if (properties.getProperty(prefix+"terr_max_parallax")!= null) terr_max_parallax=Double.parseDouble(properties.getProperty(prefix+"terr_max_parallax"));
if (properties.getProperty(prefix+"terr_reg_weights")!= null) terr_reg_weights=Double.parseDouble(properties.getProperty(prefix+"terr_reg_weights"));
if (properties.getProperty(prefix+"terr_lambda")!= null) terr_lambda=Double.parseDouble(properties.getProperty(prefix+"terr_lambda"));
if (properties.getProperty(prefix+"terr_lambda_scale_good")!= null) terr_lambda_scale_good=Double.parseDouble(properties.getProperty(prefix+"terr_lambda_scale_good"));
......@@ -3954,6 +3996,8 @@ min_str_neib_fpn 0.35
if (properties.getProperty(prefix+"terr_alpha_min")!= null) terr_alpha_min=Double.parseDouble(properties.getProperty(prefix+"terr_alpha_min"));
if (properties.getProperty(prefix+"terr_alpha_max")!= null) terr_alpha_max=Double.parseDouble(properties.getProperty(prefix+"terr_alpha_max"));
if (properties.getProperty(prefix+"terr_weight_opaque")!= null) terr_weight_opaque=Double.parseDouble(properties.getProperty(prefix+"terr_weight_opaque"));
if (properties.getProperty(prefix+"terr_boost_render")!= null) terr_boost_render=Double.parseDouble(properties.getProperty(prefix+"terr_boost_render"));
if (properties.getProperty(prefix+"terr_max_render")!= null) terr_max_render=Double.parseDouble(properties.getProperty(prefix+"terr_max_render"));
if (properties.getProperty(prefix+"terr_num_exaggerate")!= null) terr_num_exaggerate=Integer.parseInt(properties.getProperty(prefix+"terr_num_exaggerate"));
if (properties.getProperty(prefix+"terr_threshold_terrain")!= null) terr_threshold_terrain=Double.parseDouble(properties.getProperty(prefix+"terr_threshold_terrain"));
......@@ -4543,6 +4587,8 @@ min_str_neib_fpn 0.35
imp.terr_um_en = this.terr_um_en;
imp.terr_um_sigma = this.terr_um_sigma;
imp.terr_um_weight = this.terr_um_weight;
imp.terr_nan_tolerance = this.terr_nan_tolerance;
imp.terr_nan_grow = this.terr_nan_grow;
imp.terr_tile_woi = this.terr_tile_woi;
imp.terr_continue = this.terr_continue;
......@@ -4552,6 +4598,9 @@ min_str_neib_fpn 0.35
imp.terr_skip_exist = this.terr_skip_exist;
imp.terr_min_scenes = this.terr_min_scenes;
imp.terr_min_samples_scene = this.terr_min_samples_scene;
imp.terr_min_total_scenes = this.terr_min_total_scenes;
imp.terr_min_pixels = this.terr_min_pixels;
imp.terr_alpha_dflt = this.terr_alpha_dflt;
imp.terr_alpha_loss = this.terr_alpha_loss;
imp.terr_alpha_offset = this.terr_alpha_offset;
......@@ -4568,6 +4617,7 @@ min_str_neib_fpn 0.35
imp.terr_veget_pull0 = this.terr_veget_pull0;
imp.terr_boost_parallax = this.terr_boost_parallax;
imp.terr_max_parallax = this.terr_max_parallax;
imp.terr_reg_weights = this.terr_reg_weights;
imp.terr_lambda = this.terr_lambda;
imp.terr_lambda_scale_good = this.terr_lambda_scale_good;
......@@ -4582,6 +4632,8 @@ min_str_neib_fpn 0.35
imp.terr_alpha_min = this.terr_alpha_min;
imp.terr_alpha_max = this.terr_alpha_max;
imp.terr_weight_opaque = this.terr_weight_opaque;
imp.terr_boost_render = this.terr_boost_render;
imp.terr_max_render = this.terr_max_render;
imp.terr_num_exaggerate = this.terr_num_exaggerate;
imp.terr_threshold_terrain = this.terr_threshold_terrain;
......
......@@ -1512,7 +1512,7 @@ public class VegetationLMA {
for (int n = 0; n < 4; n++) {
for (int i = 0; (i < indices[n].length) && (i < par_index[n].length); i++) {
int indx = i;
if (n < 3) {
if (n < TVAO_SCENE_OFFSET) {
int w = i % woi.width;
int h = i / woi.width;
indx = (h + woi.y) * full.width + (w + woi.x);
......@@ -1520,7 +1520,11 @@ public class VegetationLMA {
int pindx = par_index[n][indx];
indices[n][i] = pindx;
if (pindx < 0) {
if (n == TVAO_SCENE_OFFSET) {
data[n][i] = Double.NaN;
} else {
data[n][i] = tvao[n][indx];
}
} else {
data[n][i] = vector[pindx];
}
......@@ -1644,9 +1648,17 @@ public class VegetationLMA {
}
}
// Trim data to actiual
int num_pars_scenes = Integer.parseInt((String) imp_pars.getProperty("NUM_PARS_SCENES"));
double [] scene_offsets = new double [num_pars_scenes];
System.arraycopy(data[3], 0, scene_offsets, 0, num_pars_scenes);
// int num_pars_scenes = Integer.parseInt((String) imp_pars.getProperty("NUM_PARS_SCENES"));
// double [] scene_offsets = new double [num_pars_scenes];
double [] scene_offsets = new double [num_scenes];
System.arraycopy(data[TVAO_SCENE_OFFSET], 0, scene_offsets, 0, scene_offsets.length);
// temporary patch, later they will be NaNs already - Already done !
for (int i = 0; i < scene_offsets.length; i++) {
if (indices[TVAO_SCENE_OFFSET][i] < 0) {
data[TVAO_SCENE_OFFSET][i] = Double.NaN;
}
}
for (int n = 0; n < 3; n++) {
if (woi.width * woi.height < data[n].length ) {
double [] d = new double [woi.width * woi.height];
......@@ -1655,8 +1667,6 @@ public class VegetationLMA {
}
}
data[3] = scene_offsets;
} else {
this.woi = woi;
diff_offsets = Boolean.parseBoolean((String) imp_pars.getProperty("DIFF_OFFSETS"));
......@@ -2030,7 +2040,7 @@ public class VegetationLMA {
woi); // Rectangle file_woi)
segments[n] = new VegetationSegment(
woi, // Rectangle woi,
tvao[3], // datadouble [] scene_offsets,
tvao[TVAO_SCENE_OFFSET], // datadouble [] scene_offsets,
new double [][] {tvao[0],tvao[1],tvao[2]}); // double [][] tva) {} {}
}
// sort in line-scan order
......
......@@ -61,6 +61,8 @@ public class VegetationModel {
public boolean failed = false;
public String model_directory;
public String model_top_directory;
public String reference_scene; // timestamp
public int reference_index; // timestamp
public boolean isFailed() {
return failed;
......@@ -80,7 +82,7 @@ public class VegetationModel {
final Thread[] threads = ImageDtt.newThreadArray(QuadCLT.THREADS_MAX);
final AtomicInteger ai = new AtomicInteger(0);
for (int n = 0; n < num_scenes; n++) {
titles[2 + n] = "terrain_scene_"+n;
titles[2 + n] = scene_names[n]; // timestamp "terrain_scene_"+n;
data [2 + n] = terrain_scenes_render[n];
final int fslice = 2 + num_scenes + 2*n;
titles[fslice + 0] = "vegetation_warp_"+n+"_x";
......@@ -120,6 +122,8 @@ public class VegetationModel {
imp.setProperty("DIFF_MODE", ""+diff_mode);
imp.setProperty("MODEL_DIRECTORY", ""+model_directory);
imp.setProperty("MODEL_TOP_DIRECTORY", ""+model_top_directory);
imp.setProperty("REFERENCE_SCENE", ""+reference_scene);
imp.setProperty("REFERENCE_INDEX", ""+reference_index);
......@@ -163,6 +167,8 @@ public class VegetationModel {
vegetation_warp = new double [num_scenes][full_length][];
if (imp_pars.getProperty("MODEL_DIRECTORY") != null) model_directory = (String) imp_pars.getProperty("MODEL_DIRECTORY");
if (imp_pars.getProperty("MODEL_TOP_DIRECTORY") != null) model_top_directory = (String) imp_pars.getProperty("MODEL_TOP_DIRECTORY");
if (imp_pars.getProperty("REFERENCE_SCENE") != null) reference_scene = (String) imp_pars.getProperty("REFERENCE_SCENE");
if (imp_pars.getProperty("REFERENCE_INDEX") != null) reference_index = Integer.parseInt((String) imp_pars.getProperty("REFERENCE_INDEX"));
scene_names = new String[num_scenes];
for (int n = 0; n < num_scenes; n++) {
......@@ -516,7 +522,12 @@ public class VegetationModel {
vegetation_average_render = averageMono(vegetation_scenes_render);
model_directory = quadCLTs[ref_index].getX3dDirectory(); // getX3dTopDirectory();
model_top_directory = quadCLTs[ref_index].getX3dTopDirectory();
reference_scene = quadCLTs[ref_index].getImageName();
reference_index = ref_index;
scene_names = new String[num_scenes];
for (int nscene = 0; nscene < num_scenes; nscene++) {
scene_names[nscene] =quadCLTs[nscene].getImageName();
}
return;
}
......@@ -1559,84 +1570,97 @@ public class VegetationModel {
boolean run_combine = combine_segments; // true; // if true, run combining instead of LMA
boolean tile_woi = true; // if false - use woi50;
boolean um_en = clt_parameters.imp.terr_um_en; // true;
double um_sigma = clt_parameters.imp.terr_um_sigma; // 1.0;
double um_weight = clt_parameters.imp.terr_um_weight; // 0.8;
double nan_tolerance = clt_parameters.imp.terr_nan_tolerance; // 0.001;
int nan_grow = clt_parameters.imp.terr_nan_grow; // 20;
boolean tile_woi = clt_parameters.imp.terr_um_en; // enable EM filter
Rectangle woi_enclosing = clt_parameters.imp.terr_woi_enclos; // new Rectangle(0, 0, 200, 160); // will be tiled, using width/height from woi_step;
Rectangle woi_step = clt_parameters.imp.terr_woi_step; // new Rectangle(10,10,20,20);
Rectangle woi_last = clt_parameters.imp.terr_woi_last; // new Rectangle(160,310,20,20); // 170
boolean skip_existing_woi = clt_parameters.imp.terr_skip_exist; // skip existing woi/parameters, already saved.
boolean continue_woi = clt_parameters.imp.terr_continue; // false;
int min_scenes = clt_parameters.imp.terr_min_scenes; // 1;
int min_samples_scene = clt_parameters.imp.terr_min_samples_scene; //10;
int min_total_scenes = clt_parameters.imp.terr_min_total_scenes; // 2;
int min_pixels = clt_parameters.imp.terr_min_pixels; //10;
double default_alpha = clt_parameters.imp.terr_alpha_dflt; // 0.5; // 0.8;
double alpha_loss = clt_parameters.imp.terr_alpha_loss; //100.0; // 10.0; /// 100.0; // 10.0; // 10000.0; // 1000.0; // 100.; // 10.0; // quadratic loss when alpha reaches -1.0 or 2.0
double alpha_offset = clt_parameters.imp.terr_alpha_offset; // 0.0; // 0.02; // 0.03; // if >0, start losses above 0.0 and below 1.0;
double alpha_lpf = clt_parameters.imp.terr_alpha_lpf; // 2.5; // 5; /// 2; // 5; /// 10; /// 15; // 10.0; // 5.0; // 10.0; // 3; // 10; // 20; // 6.0; // 3.0; // 2.0; // 1.5; // 5.0; // 0.5; // pull to average of 4 neighbors
boolean alpha_piece_linear =clt_parameters.imp.terr_alpha_piece_linear; // true; // false; // true;
double alpha_scale_avg = clt_parameters.imp.terr_alpha_scale_avg; // 1.0; // 1.1; // 0.9; // 2.0; // 1.5; // scale average alpha (around 0.5) when pulling to it
double alpha_push = clt_parameters.imp.terr_alpha_push; // 12; // 10.0; // 15.0; // push from alpha==0.5
double alpha_push_neutral =clt_parameters.imp.terr_alpha_push_neutral; // 0.5; // 0.6; // 0.8; // alpha point from which push (closer to opaque)
double alpha_push_center = clt_parameters.imp.terr_alpha_weight_center; // 1.5; // weight of center alpha pixel relative to each of the 4 ortho ones
double alpha_mm_hole = clt_parameters.imp.terr_alpha_mm_hole; // 0.1; // NaN to disable. Local "almost minimum" (lower than this fraction between min and max neighbor) is not subject to alpha_lpf
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 terr_pull0 = clt_parameters.imp.terr_terr_pull0; // 0.05; //0.03; ////// 0.05; ///// 0.1; //// 0.01; /// 0.2; /// 0.1; //pull terrain to zero (makes sense with UM
double veget_pull0 = clt_parameters.imp.terr_veget_pull0; // 0.05; //0.1; // 0.03; ////// 0.05; ///// 0.1; //// 0.01; /// 0.1; // pull vegetation to zero (makes sense with UM
// LMA parameters
double boost_parallax = clt_parameters.imp.terr_boost_parallax; // 3.0; /// 1.0; /////// 5.0; /// 1.0; // 5;
double max_parallax = clt_parameters.imp.terr_max_parallax; //10;
double reg_weights = clt_parameters.imp.terr_reg_weights; // 0.25; // fraction of the total weight used for regularization
double lambda = clt_parameters.imp.terr_lambda; // 5.0; // 0.1;
double lambda_scale_good = clt_parameters.imp.terr_lambda_scale_good; // 0.5;
double lambda_scale_bad = clt_parameters.imp.terr_lambda_scale_bad; // 8.0;
double lambda_max = clt_parameters.imp.terr_lambda_max; // 1000;
double rms_diff = clt_parameters.imp.terr_rms_diff; // 1e-8; // 0.0001; virtually forever
int num_iter = clt_parameters.imp.terr_num_iter; //25; // 100;
// 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)
boolean render_no_alpha = clt_parameters.imp.terr_render_no_alpha; // true; // render where no opacity is available
double alpha_min = clt_parameters.imp.terr_alpha_min; // 0.1; // below - completely transparent vegetation
double alpha_max = clt_parameters.imp.terr_alpha_max; // 0.8; // above - completely opaque
double weight_opaque = clt_parameters.imp.terr_weight_opaque; // 0.02; // render through completely opaque vegetation
double boost_parallax_render = clt_parameters.imp.terr_boost_render; // 3; // increase weights of scenes with high parallax relative to the reference one
double max_parallax_render = clt_parameters.imp.terr_max_render; //10; // do not consider maximal parallax above this (consider it a glitch)
int num_exaggerate = clt_parameters.imp.terr_num_exaggerate; // 3;
// Experimental reconstruction
double threshold_terrain = clt_parameters.imp.terr_threshold_terrain; // 0.05;
double min_max_terrain= clt_parameters.imp.terr_min_max_terrain; // 0.1;
double min_terrain = clt_parameters.imp.terr_min_terrain; // 0.001;
double min_vegetation = clt_parameters.imp.terr_min_vegetation; // 0.5;
Rectangle woi_last_done = continue_woi ? woi_last : null; // new Rectangle(150, 270, 20, 20); // null; // to be able to continue
//clt_parameters.imp.; //
boolean restore_mode = false;
boolean save_par_files = true; // false;
boolean diff_mode = true;
// Rectangle woi_enclosing = new Rectangle(130, 270, 150, 110); // will be tiled, using width/height from woi_step;
// Rectangle woi_enclosing = new Rectangle(150, 310, 50, 40); // will be tiled, using width/height from woi_step;
// Rectangle woi_enclosing = new Rectangle(160, 310, 30, 20); // will be tiled, using width/height from woi_step;
// Rectangle woi_enclosing = new Rectangle(80, 210, 210, 230); // will be tiled, using width/height from woi_step;
Rectangle woi_enclosing = new Rectangle(0, 0, 200, 160); // will be tiled, using width/height from woi_step;
Rectangle woi_step = new Rectangle(10,10,20,20);
Rectangle woi50 = new Rectangle(160,310,20,20); // 170
boolean skip_existing_woi = true; // skip existing woi/parameters, already saved.
String segments_dir = "/media/elphel/SSD3-4GB/lwir16-proc/berdich3/debug/vegetation/segments_new/";
int min_scenes = 1; // 10; // for new scenes only, for old ones use 10
double default_alpha = 0.5; // 0.8;
double reg_weights = 0.25; // fraction of the total weight used for regularization
double alpha_loss = 100.0; // 10.0; /// 100.0; // 10.0; // 10000.0; // 1000.0; // 100.; // 10.0; // quadratic loss when alpha reaches -1.0 or 2.0
double alpha_offset = 0.0; // 0.02; // 0.03; // if >0, start losses above 0.0 and below 1.0;
double alpha_lpf = 2.5; // 5; /// 2; // 5; /// 10; /// 15; // 10.0; // 5.0; // 10.0; // 3; // 10; // 20; // 6.0; // 3.0; // 2.0; // 1.5; // 5.0; // 0.5; // pull to average of 4 neighbors
boolean alpha_piece_linear = true; // false; // true;
double alpha_scale_avg = 1.0; // 1.1; // 0.9; // 2.0; // 1.5; // scale average alpha (around 0.5) when pulling to it
double alpha_push = 12; // 10.0; // 15.0; // push from alpha==0.5
double alpha_push_neutral = 0.5; // 0.6; // 0.8; // alpha point from which push (closer to opaque)
double alpha_push_center = 1.5; // weight of center alpha pixel relative to each of the 4 ortho ones
double alpha_mm_hole = 0.1; // NaN to disable. Local "almost minimum" (lower than this fraction between min and max neighbor) is not subject to alpha_lpf
double terr_lpf = 0.1; // 0.15; /// 0.2; /// 0.1; // pull terrain to average of 4 neighbors (very small)
double 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 terr_pull0 = 0.05; //0.03; ////// 0.05; ///// 0.1; //// 0.01; /// 0.2; /// 0.1; //pull terrain to zero (makes sense with UM
double veget_pull0 = 0.05; //0.1; // 0.03; ////// 0.05; ///// 0.1; //// 0.01; /// 0.1; // pull vegetation to zero (makes sense with UM
double boost_parallax = 3.0; /// 1.0; /////// 5.0; /// 1.0; // 5;
double max_parallax = 10;
// boolean next_run = false;
boolean read_pars = false; // true; /// false; /// true; // false; // true;
double threshold_terrain = 0.05;
double min_max_terrain= 0.1;
double min_terrain = 0.001;
double min_vegetation = 0.5;
boolean um_en = true;
double um_sigma = 1.0;
double um_weight = 0.8;
double nan_tolerance = 0.001;
int nan_grow = 20;
double lambda = 5.0; // 0.1;
double lambda_scale_good = 0.5;
double lambda_scale_bad = 8.0;
double lambda_max = 1000;
double rms_diff = 1e-8; // 0.0001; virtually forever
int num_iter = 25; // 100;
// combine parameters
int border_width = 6;
boolean render_open = true; // render open areas (no vegetation offset)
boolean render_no_alpha = true; // render where no opacity is available
double alpha_min = 0.1; // below - completely transparent vegetation
double alpha_max = 0.8; // above - completely opaque
double weight_opaque = 0.02; // render through completely opaque vegetation
double boost_parallax_render = 3; // increase weights of scenes with high parallax relative to the reference one
double max_parallax_render = 10; // do not consider maximal parallax above this (consider it a glitch)
int num_exaggerate = 3;
int min_total_scenes = 2;
int min_samples_scene = 10;
int min_pixels = 10;
String parameters_path = "/media/elphel/SSD3-4GB/lwir16-proc/berdich3/debug/vegetation/essential/parameters_vector_data_x143-y317-w35-h35-al100.0-alo0.0-alp10.0-alin-tl0.2-vl0.01-tp0.01-vp0.01-bp5.0-um1.0_0.8.tiff";
Rectangle woi_last_done = null; // new Rectangle(150, 270, 20, 20); // null; // to be able to continue
boolean last_run = false;
......@@ -1728,7 +1752,7 @@ public class VegetationModel {
woi = nextTileWoi(
woi_enclosing, // Rectangle enclosing,
woi_step, // Rectangle step,
woi50, // Rectangle single,
woi_last, // Rectangle single,
woi, // Rectangle current,
tile_woi); // boolean tile_woi)
if (woi == null) {
......
......@@ -8,7 +8,7 @@ public class VegetationSegment {
public double [][] tva;
public VegetationSegment(
Rectangle woi,
double [] scene_offsets,
double [] scene_offsets, // has NaNs
double [][] tva) {
this.woi = woi;
this.scene_offsets = scene_offsets;
......
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