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
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
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