publicdoubleterr_nan_tolerance=0.001;// set undefined terrain (out of capture area) to nan, it is almost zero after UM
publicintterr_nan_grow=20;// grow undefined terrain after detection
publicdoubleterr_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
publicintterr_nan_grow=20;// grow undefined scenes terrain after detection
publicintterr_shrink_veget=20;// shrink accumulated vegetation for filling terrain
publicintterr_shrink_terrain=20;// shrink accumulated terrain after cutting shrunk vegetation (added to terr_shrink_veget)
publicdoubleterr_vegetation_over=35;// initial vegetation over (hotter) filled terrain
publicintterr_filter_veget=10;// shrink+grow shrunk vegetation to remove small clusters
publicbooleanterr_tile_woi=true;// if false - use woi50;
publicRectangleterr_woi_enclos=newRectangle(80,210,210,230);// will be tiled, using width/height from woi_step;
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.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.addMessage("LMA losses and goals for alpha, terrain and vegetation pixels");
publicstaticfinalintDATA_SOURCE_CORN_VEGET=1;// [4]/null Z-shape 4 corners vegetation, either >= as parameter index or -1 - (x + image_width*y) of the unmodified full index
// 1: [4]/null Z-shape 4 corners vegetation, either >= as parameter index or -1 - (x + image_width*y) of the unmodified full index
...
...
@@ -95,28 +107,37 @@ public class VegetationLMA {
privatedoubleweight_pure=0;
privatedouble[]weights;// normalized so sum is 1.0 for all - samples and extra regularization
publicbooleanstart_warm_veget=true;// start with vegetation warmer than terrain
publicbooleanstart_warm_veget=true;// start with vegetation warmer than terrain
publicdoubleterrain_warmest=90;// pull vegetations to warm, terrain to cold
publicdoubleinitial_split=0.1;// pull vegetations to warm, terrain to cold
publicdoublemin_split_frac=0.15;// minimal modality fraction to use split by temperature
publicdoubleterr_difference=100;// pull vegetation to be this warmer
publicdoubleterr_pull_cold=0;// pull vegetations to warm, terrain to cold
publicdoubleinitial_split=0.1;// pull vegetations to warm, terrain to cold
publicdoublemin_split_frac=0.15;// minimal modality fraction to use split by temperature
publicdoubleterr_difference=100;// pull vegetation to be this warmer
publicdoubleterr_pull_cold=0;// pull vegetations to warm, terrain to cold
// next two just for saving?
publicdoublehifreq_weight;// 22.5 0 - do not use high-freq. Relative weight of laplacian components
publicdoublereg_weights;// fraction of the total weight used for regularization
publicdoublealpha_loss=0;// not used with cosine alpha
publicdoublealpha_offset=0;// if >0, start losses above 0.0 and below 1.0;
publicdoublealpha_lpf=0;
publicboolean[]fits;
/*
public boolean fit_terr = true;
public boolean fit_veget = true;
public boolean fit_alpha = true;
public boolean fit_scenes = true;
public boolean fit_elevations = false;
*/
publicdoublealpha_loss=0;// not used with cosine alpha
publicdoublealpha_offset=0;// if >0, start losses above 0.0 and below 1.0;
publicdoublealpha_lpf=0;
publicbooleanalpha_piece_linear=true;
publicdoublealpha_scale_avg=1.0;// 1.1; // scale average alpha (around 0.5) when pulling to it
publicdoublealpha_push=12.0;// push from alpha==0.5
publicdoublealpha_scale_avg=1.0;// 1.1; // scale average alpha (around 0.5) when pulling to it
publicdoublealpha_push=12.0;// push from alpha==0.5
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
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
publicbooleanfrom_file=false;
...
...
@@ -126,8 +147,8 @@ public class VegetationLMA {
publicdoubleveget_lpf=0;
// when unsharp mask is applied , pulling to 0 (when alpha is 0 (for vegetation) or 1.0 (for terrain) makes sense
publicdoubleterr_pull0=0;
publicdoubleveget_pull0=0;
publicdoubleterr_pull0=0;// now - pull to filled terrain - terrain_average
publicdoubleveget_pull0=0;// now - pull to vegetation_pull (extended vegetation)
publicdoubleboost_parallax=1;
...
...
@@ -174,14 +195,16 @@ public class VegetationLMA {
System.out.println("Maximal samples in a scene = "+max_samples);
intallowed_less=0;
intneed_samples=max_samples-allowed_less;
intnum_samples=0;
// int dbg_early_sample = 0; // 10;
used_scenes=newboolean[num_scenes];
finalint[]used_scene_indices=newint[num_scenes];
intnum_used_scenes=0;
for(intnscene=0;nscene<num_scenes;nscene++){
intnum_prev=num_samples;
intdefined=scene_samples[nscene];
booleanenough=defined>=need_samples;
if(!enough){
System.out.println("Not enough samples in scene "+nscene+" ("+defined+" < "+need_samples+"), removing it.");
}
used_scene_indices[nscene]=num_used_scenes;
if(defined>=min_samples_scene){
// if ((defined >= min_samples_scene) && (nscene >= dbg_early_sample)) {
if(enough){
used_scenes[nscene]=true;
num_samples+=scene_samples[nscene];
scene_samples[nscene]=num_prev;// start index
num_used_scenes++;
if(nscene!=vegetationModel.reference_index){
num_used_scenes++;
}else{
used_scene_indices[nscene]=-1;
}
}
}
data_source=newint[num_samples][][];
corners_weights=newdouble[num_samples][];
...
...
@@ -2851,8 +3032,11 @@ public class VegetationLMA {
if(data_src[nScene][windx]!=null){
corners_weights[out_indx]=corn_w[nScene][windx];
int[][]dsrc=data_src[nScene][windx];
// dsrc[0][3] = ind_pars_scenes + used_scene_indices[dsrc[0][3]]; // replace scene number with the corresponding parameter index
dsrc[DATA_SOURCE_HEAD][DATA_SOURCE_HEAD_SINDEX]=ind_pars_scenes+used_scene_indices[dsrc[DATA_SOURCE_HEAD][DATA_SOURCE_HEAD_SINDEX]];// replace scene number with the corresponding parameter index
dsrc[DATA_SOURCE_HEAD][DATA_SOURCE_HEAD_SINDEX]=used_index;// ind_pars_scenes + used_scene_indices[dsrc[DATA_SOURCE_HEAD][DATA_SOURCE_HEAD_SINDEX]]; // replace scene number with the corresponding parameter index
doublehifreq_weight=clt_parameters.imp.terr_hifreq_weight;// 22.5; // 0 - do not use high-freq. Relative weight of laplacian components double reg_weights = 0.25; // fraction of the total weight used for regularization