publicdoubleterr_alpha_offset=0.1;// alpha offset near alpha ~=1.0
publicdoubleterr_alpha_0offset=0.0;// New - a separate alpha offset nea alpha ~= 0.0
publicdoubleterr_alpha_min_veg=-1;// old version 0.5; // Minimal vegetation alpha. If (alpha-alpha_offset)/(1-2*alpha_offset) < alpha_min_veg, pull down to lpha_offset
publicdoubleterr_alpha_min_veg=-1;// old version 0.5; // Minimal vegetation alpha. If (alpha-alpha_offset)/(1-2*alpha_offset) < alpha_min_veg, pull down to lpha_offset
...
@@ -829,6 +830,22 @@ min_str_neib_fpn 0.35
...
@@ -829,6 +830,22 @@ min_str_neib_fpn 0.35
publicdoubleterr_elev_alpha_pwr=2.0;// raise alpha to this power (when alpha > 0)
publicdoubleterr_elev_alpha_pwr=2.0;// raise alpha to this power (when alpha > 0)
publicdoubleterr_low_veget=2.0;// (pix) Elevation considered low (lower loss for high alpha)
publicdoubleterr_low_veget=2.0;// (pix) Elevation considered low (lower loss for high alpha)
publicdoubleterr_scenes_pull0=1.0;// pull average scene offset to zero
publicdoubleterr_scenes_pull0=1.0;// pull average scene offset to zero
// scaling elevation losses for high elevations (decrease pull and/or lpf for high elevations)
publicdoubleterr_elev_scale_thresh=1.0;// reduce losses for higher (initial) elevations TODO: consider actual elevations
publicbooleanterr_elev_scale_pull=false;// scale elevation pull losses for high elevations
publicbooleanterr_elev_scale_lpf=false;// scale elevation diffusion losses for high elevations
// tree-top removal
publicbooleanterr_ttop_en=false;// remove tree tops from transparency weights
publicdoubleterr_ttop_gb=1.0;// Elevation Gaussian blur sigma to detect tree tops
publicdoubleterr_ttop_min=3.0;// Minimal tree top elevation
publicdoubleterr_ttop_rel_lev=0.9;// Relative (to the top height) sample level
publicdoubleterr_ttop_rel_rad=0.25;// Relative (to the top height) sample ring radius
publicdoubleterr_ttop_frac=0.5;// Minimal fraction of the ring pixels below sample level
publicdoubleterr_ttop_rem_rad=0.25;// Relative (to the top height) remove transparency radius
// LMA parameters
// LMA parameters
publicdoubleterr_boost_parallax=3.0;//
publicdoubleterr_boost_parallax=3.0;//
...
@@ -2134,7 +2151,8 @@ min_str_neib_fpn 0.35
...
@@ -2134,7 +2151,8 @@ min_str_neib_fpn 0.35
gd.addNumericField("Alpha loss",terr_alpha_loss,5,7,"","Alpha quadratic growing loss for when out of [0,1] range");
gd.addNumericField("Alpha loss",terr_alpha_loss,5,7,"","Alpha quadratic growing loss for when out of [0,1] range");
gd.addNumericField("Alpha loss linear",terr_alpha_loss_lin,5,7,"","Alpha linear growing loss for when out of [0,1] range and below minimal vegetation alpha.");
gd.addNumericField("Alpha loss linear",terr_alpha_loss_lin,5,7,"","Alpha linear growing loss for when out of [0,1] range and below minimal vegetation alpha.");
gd.addNumericField("Alpha offset",terr_alpha_offset,5,7,"","Start alpha losses above 0.0 and below 1.0 by this value.");
gd.addNumericField("Alpha offset @1.0",terr_alpha_offset,5,7,"","Start alpha losses below 1.0 by this value.");
gd.addNumericField("Alpha offset @0.0",terr_alpha_0offset,5,7,"","Start alpha losses above 0.0 by this value.");
gd.addNumericField("Minimal vegetation alpha",terr_alpha_min_veg,5,7,"","Minimal vegetation alpha. If (alpha-alpha_offset)/(1-2*alpha_offset) < alpha_min_veg, pull down to lpha_offset.");
gd.addNumericField("Minimal vegetation alpha",terr_alpha_min_veg,5,7,"","Minimal vegetation alpha. If (alpha-alpha_offset)/(1-2*alpha_offset) < alpha_min_veg, pull down to lpha_offset.");
gd.addNumericField("Alpha diffusion",terr_alpha_lpf,5,7,"","Alpha diffusion to 4 ortho neighbors.");
gd.addNumericField("Alpha diffusion",terr_alpha_lpf,5,7,"","Alpha diffusion to 4 ortho neighbors.");
...
@@ -2159,9 +2177,23 @@ min_str_neib_fpn 0.35
...
@@ -2159,9 +2177,23 @@ min_str_neib_fpn 0.35
gd.addNumericField("Low vegetation loss",terr_elev_alpha,5,7,"","Multiply alpha by under-low elevation for loss.");
gd.addNumericField("Low vegetation loss",terr_elev_alpha,5,7,"","Multiply alpha by under-low elevation for loss.");
gd.addNumericField("Low vegetation power",terr_elev_alpha_pwr,5,7,"","Raise alpha to this power for low vegetation loss.");
gd.addNumericField("Low vegetation power",terr_elev_alpha_pwr,5,7,"","Raise alpha to this power for low vegetation loss.");
gd.addNumericField("Low elevation",terr_low_veget,5,7,"pix","Elevation considered low (lower loss for high alpha.");
gd.addNumericField("Low elevation",terr_low_veget,5,7,"pix","Elevation considered low (lower loss for high alpha.");
gd.addNumericField("Pull scene offset",terr_scenes_pull0,5,7,"","Pull average scene offset to zero.");
gd.addNumericField("Pull scene offset",terr_scenes_pull0,5,7,"","Pull average scene offset to zero.");
// scaling elevation losses for high elevations (decrease pull and/or lpf for high elevations)
gd.addNumericField("High elevation",terr_elev_scale_thresh,5,7,"","Reduce losses for higher (initial) elevations threshold.");
gd.addCheckbox("High elevation pull",terr_elev_scale_pull,"Scale elevation pull losses for high elevations.");
gd.addCheckbox("High elevation diffusion",terr_elev_scale_lpf,"Scale elevation diffusion losses for high elevations.");
gd.addMessage("Tree tops detection/filtering - no (stray) transparency around tree tops");
gd.addCheckbox("Filter tree tops",terr_ttop_en,"Filter tree tops transparency.");
gd.addNumericField("Elevation blur sigma",terr_ttop_gb,5,7,"","Elevation Gaussian blur sigma to detect tree tops.");
gd.addNumericField("Minimal tree top elevation",terr_ttop_min,5,7,"","Minimal tree top elevation.");
gd.addNumericField("Relative sample level",terr_ttop_rel_lev,5,7,"","Relative (to the top height) sample level.");
gd.addNumericField("Relative ring radius",terr_ttop_rel_rad,5,7,"","Relative (to the top height) sample ring radius.");
gd.addNumericField("Minimal fraction lower",terr_ttop_frac,5,7,"","Minimal fraction of the ring pixels below sample level.");
gd.addNumericField("Remove transparency radius",terr_ttop_rem_rad,5,7,"","Relative (to the top height) remove transparency radius.");
gd.addMessage("LMA parameters");
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("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("Limit parallax",terr_max_parallax,5,7,"","Parallax limit when evaluating boost parallax.");
@@ -3310,8 +3096,6 @@ public class VegetationLMA {
...
@@ -3310,8 +3096,6 @@ public class VegetationLMA {
}
}
if(samples_pointers[SAMPLES_VEGETATION_PULL][1]>0){// fits[TVAO_VEGETATION] && (veget_lpf >= 0)) { // should be positive for pull0 and terr_pull_cold (difference between vegetation and terrain)
if(samples_pointers[SAMPLES_VEGETATION_PULL][1]>0){// fits[TVAO_VEGETATION] && (veget_lpf >= 0)) { // should be positive for pull0 and terr_pull_cold (difference between vegetation and terrain)
// final int ind_y_veget = samples_pointers[SAMPLES_VEGETATION_PULL][0]; // ind_next;
@@ -3339,54 +3123,6 @@ public class VegetationLMA {
...
@@ -3339,54 +3123,6 @@ public class VegetationLMA {
ImageDtt.startAndJoin(threads);
ImageDtt.startAndJoin(threads);
}
}
/*
if (samples_pointers[SAMPLES_VEGETATION_LPF][1] > 0) { // fits[TVAO_VEGETATION] && (veget_lpf >= 0)) { // should be positive for pull0 and terr_pull_cold (difference between vegetation and terrain)
ai.set(0);
for (int ithread = 0; ithread < threads.length; ithread++) {
threads[ithread] = new Thread() {
public void run() {
for (int n = ai.getAndIncrement(); n < num_pars[TVAO_VEGETATION]; n = ai.getAndIncrement()) {
int np = n + samples_pointers[SAMPLES_VEGETATION_LPF][2];
int nx = n + samples_pointers[SAMPLES_VEGETATION_LPF][0];
double d = 0;
if (veget_lpf > 0) {
double avg = 0;
int nn = 0;
for (int i = 0; i < veget_neibs[n].length; i++) { // now 4, may be increased
int di = veget_neibs[n][i];
d=0;
if (di >= 0) {
d = vector[di]; // d - full parameter index
avg+=d;
nn++;
} else if ((di < -1) && lpf_fixed[TVAO_VEGETATION]) {
// if (imp_pars.getProperty("TERRAIN_OFFSET") != null) terrain_offset = Double.parseDouble((String) imp_pars.getProperty("TERRAIN_OFFSET"));
// if (imp_pars.getProperty("TERRAIN_OFFSET") != null) terrain_offset = Double.parseDouble((String) imp_pars.getProperty("TERRAIN_OFFSET"));
...
@@ -4687,7 +4424,8 @@ public class VegetationLMA {
...
@@ -4687,7 +4424,8 @@ public class VegetationLMA {
getProperty(imp_pars,"REG_WEIGHTS",reg_weights),// final double reg_weights, // fraction of the total weight used for regularization
getProperty(imp_pars,"REG_WEIGHTS",reg_weights),// final double reg_weights, // fraction of the total weight used for regularization
getProperty(imp_pars,"ALPHA_LOSS",alpha_loss),// final double alpha_loss, // alpha quadratic growing loss for when out of [0,1] range
getProperty(imp_pars,"ALPHA_LOSS",alpha_loss),// final double alpha_loss, // alpha quadratic growing loss for when out of [0,1] range
getProperty(imp_pars,"ALPHA_LOSS_LIN",alpha_loss_lin),// final double alpha_loss_lin, // alpha linear growing loss for when out of [0,1] range and below minimal vegetation alpha
getProperty(imp_pars,"ALPHA_LOSS_LIN",alpha_loss_lin),// final double alpha_loss_lin, // alpha linear growing loss for when out of [0,1] range and below minimal vegetation alpha
getProperty(imp_pars,"ALPHA_OFFSET",alpha_offset),// final double alpha_offset, // quadratic loss when alpha reaches -1.0 or 2.0
getProperty(imp_pars,"ALPHA_OFFSET",alpha_offset),// final double alpha_offset, // quadratic loss when alpha > 1 - alpha_offset
getProperty(imp_pars,"ALPHA_0OFFSET",alpha_0offset),// final double alpha_0offset, // quadratic loss when alpha < alpha0_offset
getProperty(imp_pars,"ALPHA_MIN_VEG",alpha_min_veg),// final double alpha_min_veg, // 0.5; // if (alpha-alpha_offset)/(1-2*alpha_offset) < alpha_min_veg, pull down to lpha_offset
getProperty(imp_pars,"ALPHA_MIN_VEG",alpha_min_veg),// final double alpha_min_veg, // 0.5; // if (alpha-alpha_offset)/(1-2*alpha_offset) < alpha_min_veg, pull down to lpha_offset
getProperty(imp_pars,"ALPHA_LPF",alpha_lpf),// final double alpha_lpf, // pull to average of 4 neighbors
getProperty(imp_pars,"ALPHA_LPF",alpha_lpf),// final double alpha_lpf, // pull to average of 4 neighbors
...
@@ -4712,6 +4450,18 @@ public class VegetationLMA {
...
@@ -4712,6 +4450,18 @@ public class VegetationLMA {
getProperty(imp_pars,"ELEV_ALPHA_PWR",elev_alpha_pwr),// final double elev_alpha_pwr, // 2.0; // raise alpha to this power (when alpha > 0)
getProperty(imp_pars,"ELEV_ALPHA_PWR",elev_alpha_pwr),// final double elev_alpha_pwr, // 2.0; // raise alpha to this power (when alpha > 0)
getProperty(imp_pars,"ELEV_LOW_VEGET",low_veget),// final double low_veget, // 2.0; // (pix) Elevation considered low (lower loss for high alpha)
getProperty(imp_pars,"ELEV_LOW_VEGET",low_veget),// final double low_veget, // 2.0; // (pix) Elevation considered low (lower loss for high alpha)
getProperty(imp_pars,"SCENES_PULL0",scenes_pull0),// final double scenes_pull0,
getProperty(imp_pars,"SCENES_PULL0",scenes_pull0),// final double scenes_pull0,
getProperty(imp_pars,"ELEV_SCALE_THRESH",elev_scale_thresh),// final double elev_scale_thresh,
getProperty(imp_pars,"ELEV_SCALE_PULL",elev_scale_pull),// final boolean elev_scale_pull,
getProperty(imp_pars,"ELEV_SCALE_LPF",elev_scale_lpf),// final boolean elev_scale_lpf,
getProperty(imp_pars,"TTOP_EN",ttop_en),// final boolean ttop_en,
getProperty(imp_pars,"TTOP_GB",ttop_gb),// final double ttop_gb,
getProperty(imp_pars,"TTOP_MIN",ttop_min),// final double ttop_min,
getProperty(imp_pars,"TTOP_REL_LEV",ttop_rel_lev),// final double ttop_rel_lev,
getProperty(imp_pars,"TTOP_REL_RAD",ttop_rel_rad),// final double ttop_rel_rad,
getProperty(imp_pars,"TTOP_FRAC",ttop_frac),// final double ttop_frac,
getProperty(imp_pars,"TTOP_REM_RAD",ttop_rem_rad),// final double ttop_rem_rad,
getProperty(imp_pars,"BOOST_PARALLAX",boost_parallax),// final double boost_parallax, // increase weight of scene with maximal parallax relative to the reference scene
getProperty(imp_pars,"BOOST_PARALLAX",boost_parallax),// final double boost_parallax, // increase weight of scene with maximal parallax relative to the reference scene
getProperty(imp_pars,"MAX_PARALLAX",max_parallax),// final double max_parallax, // do not consider maximal parallax above this (consider it a glitch)
getProperty(imp_pars,"MAX_PARALLAX",max_parallax),// final double max_parallax, // do not consider maximal parallax above this (consider it a glitch)
debugLevel,// final int debugLevel);
debugLevel,// final int debugLevel);
...
@@ -4985,14 +4735,23 @@ public class VegetationLMA {
...
@@ -4985,14 +4735,23 @@ public class VegetationLMA {
publicVegetationSegment[]readAllSegments(
publicVegetationSegment[]readAllSegments(
Stringdir_path,
Stringdir_path,
Stringsuffix){
Stringsuffix,
doubletransparency_opaque,
doubletransparency_pedestal,
doubletransparency_frac,
doubletransparency_dist,
doubletransparency_pow,
doubletransparency_gb,
// TODO: See if pass ttop_* parameters, common to all instead of the ones from the parameters files.
intdebugLevel,
Stringdebug_path,
booleandebug_save_improved,// Save debug image after successful LMA step.");
booleandebug_save_worsened){// Save debug image after unsuccessful LMA step.");
FileFilterparFileFilter=newFileFilter()
FileFilterparFileFilter=newFileFilter()
{
{
//Override accept method
//Override accept method
publicbooleanaccept(Filefile){
publicbooleanaccept(Filefile){//if the file extension is .log return true, else false
//if the file extension is .log return true, else false
doublealpha_loss=clt_parameters.imp.terr_alpha_loss;//100.0; // alpha quadratic growing loss for when out of [0,1] range
doublealpha_loss=clt_parameters.imp.terr_alpha_loss;//100.0; // alpha quadratic growing loss for when out of [0,1] range
doublealpha_loss_lin=clt_parameters.imp.terr_alpha_loss_lin;// alpha linear growing loss for when out of [0,1] range and below minimal vegetation alpha
doublealpha_loss_lin=clt_parameters.imp.terr_alpha_loss_lin;// alpha linear growing loss for when out of [0,1] range and below minimal vegetation alpha
doublealpha_offset=clt_parameters.imp.terr_alpha_offset;// 0.0; // 0.02; // 0.03; // if >0, start losses above 0.0 and below 1.0;
doublealpha_0offset=clt_parameters.imp.terr_alpha_0offset;// 0.0; // if >0, start losses above 0.0
doublealpha_min_veg=clt_parameters.imp.terr_alpha_min_veg;// 0.5 // Minimal vegetation alpha. If (alpha-alpha_offset)/(1-2*alpha_offset) < alpha_min_veg, pull down to lpha_offset
doublealpha_min_veg=clt_parameters.imp.terr_alpha_min_veg;// 0.5 // Minimal vegetation alpha. If (alpha-alpha_offset)/(1-2*alpha_offset) < alpha_min_veg, pull down to lpha_offset