Commit dcec0ae3 authored by Andrey Filippov's avatar Andrey Filippov

Implemented UM, before chenging alpha to cos

parent 3f011b38
...@@ -55,8 +55,12 @@ public class VegetationLMA { ...@@ -55,8 +55,12 @@ public class VegetationLMA {
public double alpha_loss; public double alpha_loss;
public double alpha_offset = 0; // if >0, start losses above 0.0 and below 1.0; public double alpha_offset = 0; // if >0, start losses above 0.0 and below 1.0;
public double alpha_lpf = 0; public double alpha_lpf = 0;
public double terr_lpf = 0; public double terr_lpf = 0;
public double veget_lpf = 0; public double veget_lpf = 0;
public double boost_parallax = 1;
public double um_sigma = 0; // just use in debug image names
public double um_weight = 0;
// data used to calculate lpf pull of the alpha pixel to average of four neighbors. Below similar (weaker pull) for terrain and vegetation // data used to calculate lpf pull of the alpha pixel to average of four neighbors. Below similar (weaker pull) for terrain and vegetation
// to smooth areas where there is no data from available images. // to smooth areas where there is no data from available images.
public int [][] alpha_neibs; // corresponds to parameters for alpha (num_pars_vegetation_alpha), each has 4 ortho neibs, -1 - border, >= 0 public int [][] alpha_neibs; // corresponds to parameters for alpha (num_pars_vegetation_alpha), each has 4 ortho neibs, -1 - border, >= 0
...@@ -69,8 +73,8 @@ public class VegetationLMA { ...@@ -69,8 +73,8 @@ public class VegetationLMA {
public int debug_index; public int debug_index;
public double [][] debug_image; public double [][] debug_image;
public static double [] debug_alpha_scales = {100,150}; public static double [] debug_alpha_scales = {0,50}; // {100,150};
public String debug_path = "/media/elphel/SSD3-4GB/lwir16-proc/berdich3/debug/vegetation/lma/"; public String debug_path = "/media/elphel/SSD3-4GB/lwir16-proc/berdich3/debug/vegetation/lma_um/";
public int [] indices; public int [] indices;
public int [][] cpairs = null; public int [][] cpairs = null;
...@@ -127,14 +131,20 @@ public class VegetationLMA { ...@@ -127,14 +131,20 @@ public class VegetationLMA {
final double terr_lpf, // pull terrain to average of 4 neighbors (very small) final double terr_lpf, // pull terrain to average of 4 neighbors (very small)
final double veget_lpf, // pull vegetation to average of 4 neighbors (very small - maybe not needed) final double veget_lpf, // pull vegetation to average of 4 neighbors (very small - maybe not needed)
final double boost_parallax, // increase weight of scene with maximal parallax relative to the reference scene final double boost_parallax, // increase weight of scene with maximal parallax relative to the reference scene
final double um_sigma, // just use in debug image names
final double um_weight,
final String parameters_read_path, final String parameters_read_path,
final int debugLevel) { final int debugLevel) {
this.woi = woi; this.woi = woi;
this.alpha_loss = alpha_loss; this.alpha_loss = alpha_loss;
this.alpha_offset = alpha_offset; this.alpha_offset = alpha_offset;
this.alpha_lpf = alpha_lpf; this.alpha_lpf = alpha_lpf;
this.terr_lpf = terr_lpf; this.terr_lpf = terr_lpf;
this.veget_lpf = veget_lpf; this.veget_lpf = veget_lpf;
this.boost_parallax = boost_parallax;
this.um_sigma = um_sigma; // just use in debug image names
this.um_weight = um_weight;
final double [] scene_weights = setupSceneWeights( final double [] scene_weights = setupSceneWeights(
boost_parallax); // double boost_parallax) boost_parallax); // double boost_parallax)
int min_scenes_uses = min_scenes; int min_scenes_uses = min_scenes;
...@@ -509,7 +519,10 @@ public class VegetationLMA { ...@@ -509,7 +519,10 @@ public class VegetationLMA {
if (debug_level > -2) { // if (debug_level > -2) { //
String save_dir = debug_path; String save_dir = debug_path;
String debug_title = "parameters_vector-x"+woi.x+"-y"+woi.y+"-w"+woi.width+"-h"+woi.height; String debug_title = "parameters_vector-x"+woi.x+"-y"+woi.y+"-w"+woi.width+"-h"+woi.height;
debug_title +="-al"+alpha_loss+"-alo"+alpha_offset+"-alp"+alpha_lpf+"-tl"+terr_lpf+"-vl"+veget_lpf; debug_title +="-al"+alpha_loss+"-alo"+alpha_offset+"-alp"+alpha_lpf+"-tl"+terr_lpf+"-vl"+veget_lpf+"-bp"+boost_parallax;
if (um_weight > 0) {
debug_title +="-um"+um_sigma+"_"+um_weight;
}
boolean save_all = (debug_image != null); boolean save_all = (debug_image != null);
boolean show_this = debug_level > 3; boolean show_this = debug_level > 3;
boolean show_all = debug_level > 4; boolean show_all = debug_level > 4;
...@@ -683,8 +696,8 @@ public class VegetationLMA { ...@@ -683,8 +696,8 @@ public class VegetationLMA {
double [][] terrain_weights_max = getTerrainWeights( double [][] terrain_weights_max = getTerrainWeights(
threshold_terrain, // final double alpha_threshold, // discard images with too low transparency threshold_terrain, // final double alpha_threshold, // discard images with too low transparency
vector); // final double [] vector) vector); // final double [] vector)
double [] terrain_masked = tvas[0].clone(); double [] terrain_masked = tvas[0].clone();
double [] vegetation_masked = tvas[0].clone(); double [] vegetation_masked = tvas[1].clone();
for (int i = 0; i < terrain_masked.length; i++) { for (int i = 0; i < terrain_masked.length; i++) {
if (!(terrain_weights_max[0][i] >= min_terrain)) terrain_masked[i] = Double.NaN; if (!(terrain_weights_max[0][i] >= min_terrain)) terrain_masked[i] = Double.NaN;
if (!(terrain_weights_max[1][i] >= min_max_terrain)) terrain_masked[i] = Double.NaN; if (!(terrain_weights_max[1][i] >= min_max_terrain)) terrain_masked[i] = Double.NaN;
......
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