publicdoubleterr_alpha_push=12;// push from alpha==0.5
publicdoubleterr_alpha_push_neutral=0.5;// alpha point from which push (closer to opaque)
publicdoubleterr_alpha_weight_center=1.5;// weight of center alpha pixel relative to each of the 4 ortho ones
publicbooleanterr_en_holes=true;// enable small holes // maybe second pass after good fit with vegetation and search for correct offset?
publicdoubleterr_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
publicdoubleterr_terr_lpf=0.1;// pull terrain to average of 4 neighbors (very small)
publicdoubleterr_veget_lpf=0.2;// pull vegetation to average of 4 neighbors (very small - maybe not needed)
gd.addNumericField("Push alpha",terr_alpha_push,5,7,"","Quadratic loss for middle alpha (push to 0.0 or 1.0.");
gd.addNumericField("Neutral alpha",terr_alpha_push_neutral,5,7,"","Alpha point from which to push (default 0.5).");
gd.addNumericField("Alpha center weight",terr_alpha_weight_center,5,7,"","Weight of center alpha pixel relative to each of the 4 ortho ones.");
gd.addCheckbox("Hole search enable",terr_en_holes,"Search for small semi-transparent holes, disable diffusion of local alpha minimums.");
gd.addNumericField("Alpha MM fraction",terr_alpha_mm_hole,5,7,"","Disable diffusion for local \"almost minimum\" (lower than this fraction between min and max neighbors).");
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).");
public String [] scene_names = null; // TODO: Implement!
public String model_directory;
public String model_top_directory;
public String reference_scene; // timestamp
public int reference_index; // timestamp
*/
//[2][image_length] - alpha, [3][num_scenes] - per-scene offset (mostly for vignetting. MAYBE add per-scene pair of tilts
publicint[][]par_index;// indices - [0..3][full_pixel] - same as for tvao, value - parameter index
publicint[][]par_rindex;// parameter -> pair of type (0..3) and full window pixel index
...
...
@@ -75,6 +89,7 @@ public class VegetationLMA {
publicdoublealpha_push_neutral=0.8;// alpha point from which push (closer to opaque)
publicdoublealpha_push_center=1.5;// weight of center alpha pixel relative to each of the 4 ortho ones
publicdoublealpha_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
publicbooleanalpha_en_holes=true;// Search for small semi-transparent holes, disable diffusion of local alpha minimums
publicdoublealpha_diff_hole=0.01;// minimal alpha difference between min and max neighbor to be considered a hole
...
...
@@ -157,6 +172,8 @@ public class VegetationLMA {
tvao[TVAO_VEGETATION_ALPHA]=newdouble[image_length];// 0 - use terrain
tvao[TVAO_SCENE_OFFSET]=newdouble[num_scenes];
diff_offsets=vegetationModel.diff_mode;
this.vegetationModel=vegetationModel;// to access scene names, directories, reference index
return;
}
...
...
@@ -177,6 +194,7 @@ public class VegetationLMA {
finaldoublealpha_push,// 5.0; // push from alpha==0.5
finaldoublealpha_push_neutral,// = 0.8; // alpha point from which push (closer to opaque)
finaldoublealpha_push_center,// 1.5; // weight of center alpha pixel relative to each of the 4 ortho ones
finalbooleanalpha_en_holes,// Search for small semi-transparent holes, disable diffusion of local alpha minimums
finaldoublealpha_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
finaldoubleterr_lpf,// pull terrain to average of 4 neighbors (very small)
finaldoubleveget_lpf,// pull vegetation to average of 4 neighbors (very small - maybe not needed)
...
...
@@ -197,6 +215,7 @@ public class VegetationLMA {
this.alpha_push=alpha_push;// 5.0; // push from alpha==0.5
this.alpha_push_neutral=alpha_push_neutral;// 0.8; // alpha point from which push (closer to opaque)
this.alpha_push_center=alpha_push_center;// 1.5; // weight of center alpha pixel relative to each of the 4 ortho ones
@@ -1090,6 +1112,7 @@ public class VegetationModel {
return;
}
// old version below
finalintdx_slice=1;
finalintdy_slice=2;
...
...
@@ -1278,6 +1301,7 @@ public class VegetationModel {
doublealpha_push=12;// 10.0; // 15.0; // push from alpha==0.5
doublealpha_push_neutral=0.5;// 0.6; // 0.8; // alpha point from which push (closer to opaque)
doublealpha_push_center=1.5;// weight of center alpha pixel relative to each of the 4 ortho ones
booleanalpha_en_holes=true;
doublealpha_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
doubleterr_lpf=0.1;// 0.15; /// 0.2; /// 0.1; // pull terrain to average of 4 neighbors (very small)
...
...
@@ -1399,6 +1423,7 @@ public class VegetationModel {
true,
"terrain_vegetation_averages.tiff",
newString[]{"terrain","vegetation"});
}
VegetationLMAvegetationLMA=newVegetationLMA(
width,// int width,
...
...
@@ -1463,8 +1488,8 @@ public class VegetationModel {
alpha_push,// final double alpha_push, // 5.0; // push from alpha==0.5
alpha_push_neutral,// double alpha_push_neutral = 0.8; // alpha point from which push (closer to opaque)
alpha_push_center,// final double alpha_push_center,// 1.5; // weight of center alpha pixel relative to each of the 4 ortho ones
alpha_en_holes,// final boolean alpha_en_holes, // Search for small semi-transparent holes, disable diffusion of local alpha minimums
alpha_mm_hole,// 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
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)
terr_pull0,// final double terr_pull0, // pull terrain to zero (makes sense with UM
...
...
@@ -1570,14 +1595,17 @@ public class VegetationModel {
booleanrun_combine=combine_segments;// true; // if true, run combining instead of LMA
// String model_path = clt_parameters.imp.terr_model_path; // Model directory path with version.
// String model_state = clt_parameters.imp.terr_model_state; // Model vegetation source data (w/o extension).
doublealpha_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
doubleterr_lpf=clt_parameters.imp.terr_terr_lpf;// 0.1; // 0.15; /// 0.2; /// 0.1; // pull terrain to average of 4 neighbors (very small)
doubleveget_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)
...
...
@@ -1641,11 +1670,10 @@ public class VegetationModel {
System.out.println("===== Will process a single WOI ("+woi.x+", "+woi.y+", "+woi.width+", "+woi.height+").");
}
intnum_samples=vegetationLMA.prepareLMA(
false,// final boolean keep_parameters,
woi,// final Rectangle woi,
...
...
@@ -1781,8 +1853,8 @@ public class VegetationModel {
alpha_push,// final double alpha_push, // 5.0; // push from alpha==0.5
alpha_push_neutral,// double alpha_push_neutral = 0.8; // alpha point from which push (closer to opaque)
alpha_push_center,// final double alpha_push_center,// 1.5; // weight of center alpha pixel relative to each of the 4 ortho ones
alpha_en_holes,// final boolean alpha_en_holes, // Search for small semi-transparent holes, disable diffusion of local alpha minimums
alpha_mm_hole,// 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
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)
terr_pull0,// final double terr_pull0, // pull terrain to zero (makes sense with UM