Commit 4f7e40a1 authored by Andrey Filippov's avatar Andrey Filippov
Browse files

Fixed wrong elevation sign, testing with various parameters

parent 65a99dbc
Loading
Loading
Loading
Loading
+9 −6
Original line number Diff line number Diff line
@@ -771,8 +771,7 @@ min_str_neib_fpn 0.35
	
	public double    terr_difference =        100.0; // vegetation is 100 warmer (target)
	public double    terr_pull_cold =          0.001;  // pull vegetations to warm, terrain to cold
	
	
	public double    terr_elevation_radius =   1.5; // Radius of elevation/vegetation influence 
	public double    terr_alpha_contrast =     1.0; // initial alpha contrast (>=1.0)
	public double    terr_alpha_dflt =         0.5; // now unused
	public double    terr_alpha_loss =       100.0;
@@ -2042,6 +2041,8 @@ min_str_neib_fpn 0.35
		gd.addNumericField("Vegetation warmer",    terr_difference, 5,7,"", 	"Pull vegetation to be this warmer.");
		
		gd.addNumericField("Pull terrain cold",    terr_pull_cold, 5,7,"", 	"Pull vegetations to warm, terrain to cold.");
		gd.addNumericField("Elevation radius",     terr_elevation_radius, 5,7,"pix","Radius of elevation/vegetation influence.");
		
		gd.addNumericField("Alpha initial contrast",terr_alpha_contrast, 5,7,"","Initial alpha contrast (>= 1.0).");
		gd.addNumericField("Defalt alpha",         terr_alpha_dflt, 5,7,"", 	"Default vegetation alpha.");
		gd.addNumericField("Alpha loss",           terr_alpha_loss, 5,7,"", 	"Alpha quadratic growing loss for when out of [0,1] range");
@@ -2073,7 +2074,7 @@ min_str_neib_fpn 0.35
		gd.addNumericField("Lambda scale on good", terr_lambda_scale_good, 5,7,"","Scale lambda if RMSE improved.");
		gd.addNumericField("Lambda scale on bad",  terr_lambda_scale_bad, 5,7,"","Scale lambda if RMSE worsened.");
		gd.addNumericField("Lambda max to fail",   terr_lambda_max, 5,7,"",     "Fail if lambda gets larger than that.");
		gd.addNumericField("RMSE difference",      terr_rms_diff, 8,10,"", 	    "Exit if RMSE improvement is lower.");
		gd.addNumericField("RMSE difference",      terr_rms_diff, 10,12,"",     "Exit if RMSE improvement is lower.");
		gd.addNumericField("(Maximal) iterations", terr_num_iter, 0,3,"", 	    "Maximal number of LMA iterations.");
		
		gd.addMessage     ("Combining LMA results segments");
@@ -2751,6 +2752,7 @@ min_str_neib_fpn 0.35
		terr_min_split_frac =      gd.getNextNumber();// double 
		terr_difference =          gd.getNextNumber();// double
		terr_pull_cold =           gd.getNextNumber();// double 
		terr_elevation_radius =    gd.getNextNumber();// double 
		terr_alpha_contrast =      gd.getNextNumber();// double 
		terr_alpha_dflt =          gd.getNextNumber();// double 
		terr_alpha_loss =          gd.getNextNumber();// double 
@@ -3427,8 +3429,8 @@ min_str_neib_fpn 0.35
		properties.setProperty(prefix+"terr_difference",             terr_difference+"");         // double 
				
		properties.setProperty(prefix+"terr_pull_cold",              terr_pull_cold+"");          // double
		properties.setProperty(prefix+"terr_elevation_radius",       terr_elevation_radius+"");   // double
		properties.setProperty(prefix+"terr_alpha_contrast",         terr_alpha_contrast+"");     // double 
		
		properties.setProperty(prefix+"terr_alpha_dflt",             terr_alpha_dflt+"");         // double 
		properties.setProperty(prefix+"terr_alpha_loss",             terr_alpha_loss+"");         // double 
		properties.setProperty(prefix+"terr_alpha_offset",           terr_alpha_offset+"");       // double 
@@ -4125,8 +4127,8 @@ min_str_neib_fpn 0.35
		
		if (properties.getProperty(prefix+"terr_difference")!=         null) terr_difference=Double.parseDouble(properties.getProperty(prefix+"terr_difference"));
		if (properties.getProperty(prefix+"terr_pull_cold")!=          null) terr_pull_cold=Double.parseDouble(properties.getProperty(prefix+"terr_pull_cold"));
		if (properties.getProperty(prefix+"terr_elevation_radius")!=   null) terr_elevation_radius=Double.parseDouble(properties.getProperty(prefix+"terr_elevation_radius"));
		if (properties.getProperty(prefix+"terr_alpha_contrast")!=     null) terr_alpha_contrast=Double.parseDouble(properties.getProperty(prefix+"terr_alpha_contrast"));
		
		if (properties.getProperty(prefix+"terr_alpha_dflt")!=         null) terr_alpha_dflt=Double.parseDouble(properties.getProperty(prefix+"terr_alpha_dflt"));
		if (properties.getProperty(prefix+"terr_alpha_loss")!=         null) terr_alpha_loss=Double.parseDouble(properties.getProperty(prefix+"terr_alpha_loss"));
		if (properties.getProperty(prefix+"terr_alpha_offset")!=       null) terr_alpha_offset=Double.parseDouble(properties.getProperty(prefix+"terr_alpha_offset"));
@@ -4791,6 +4793,7 @@ min_str_neib_fpn 0.35
		imp.terr_min_split_frac =                this.terr_min_split_frac;
		imp.terr_difference =                    this.terr_difference;		
		imp.terr_pull_cold =                     this.terr_pull_cold; 
		imp.terr_elevation_radius =              this.terr_elevation_radius;
		imp.terr_alpha_contrast =                this.terr_alpha_contrast; 
		imp.terr_alpha_dflt =                    this.terr_alpha_dflt;                           
		imp.terr_alpha_loss =                    this.terr_alpha_loss;                           
+391 −174

File changed.

Preview size limit exceeded, changes collapsed.

+10 −1
Original line number Diff line number Diff line
@@ -2,7 +2,9 @@ package com.elphel.imagej.vegetation;

import java.awt.Rectangle;
import java.io.File;
import java.text.SimpleDateFormat;
import java.util.Arrays;
import java.util.Calendar;
import java.util.concurrent.atomic.AtomicInteger;

import org.apache.commons.math3.analysis.interpolation.PiecewiseBicubicSplineInterpolatingFunction;
@@ -1394,7 +1396,7 @@ public class VegetationModel {
//		double    min_split_frac =    clt_parameters.imp.terr_min_split_frac;// 0.15;
		double    terr_difference =   clt_parameters.imp.terr_difference;          // Pull vegetation to be this warmer
		double    terr_pull_cold =    clt_parameters.imp.terr_pull_cold;           // pull vegetations to warm, terrain to cold
		
		double    elevation_radius =  clt_parameters.imp.terr_elevation_radius;    // Radius of elevation/vegetation influence 
		double    alpha_initial_contrast = clt_parameters.imp.terr_alpha_contrast; // initial alpha contrast (>=1.0)
		double    default_alpha =     clt_parameters.imp.terr_alpha_dflt;          //  0.5; //  0.8;
		double    alpha_loss =        clt_parameters.imp.terr_alpha_loss;          //100.0; // 10.0; /// 100.0; // 10.0;  // 10000.0; // 1000.0; // 100.; // 10.0;         // quadratic loss when alpha reaches -1.0 or 2.0 
@@ -1933,6 +1935,7 @@ public class VegetationModel {
//					min_split_frac,   // final double             min_frac,         // minimal modality fraction to use split by temperature
					terr_difference,  // final double             terr_difference,  // pull vegetation to be this warmer				
					terr_pull_cold,   // final double             terr_pull_cold,   // pull vegetations to warm, terrain to cold
					elevation_radius, // final double             elevation_radius, // Radius of elevation/vegetation influence.
					default_alpha, // final double      default_alpha,
					hifreq_weight, //final double             hifreq_weight,  // 22.5 0 - do not use high-freq. Relative weight of laplacian components
					fit_terr,       // final boolean            adjust_terr,
@@ -2031,6 +2034,12 @@ public class VegetationModel {
					last_run,         // boolean last_run,
					null,             // String dbg_prefix,
					debugLevel);      // int    debug_level)
	  		if (debugLevel > -2) { // 1) {
				System.out.println((new SimpleDateFormat("yyyy/MM/dd HH:mm:ss").format(Calendar.getInstance().getTime()))+
						" LMA finished");
			}
			
			
// save results
			if (save_par_files) {
				String  restore_dir =    segments_dir; // vegetationLMA.debug_path;