Commit ad8191c2 authored by Andrey Filippov's avatar Andrey Filippov

Reorganized some parameters, before quadratic photometric equalization

parent 45f2bf7b
...@@ -365,6 +365,13 @@ public class CLTParameters { ...@@ -365,6 +365,13 @@ public class CLTParameters {
public double fom_inf_bonus = 0.2; // add this to infinity FOM (if it is closer than fom_inf_range) public double fom_inf_bonus = 0.2; // add this to infinity FOM (if it is closer than fom_inf_range)
public double fom_inf_range = 0.8; // 0.5 public double fom_inf_range = 0.8; // 0.5
// Photometric calibration (move elsewhere)?
public boolean photo_en = false; // perform photogrammetric calibration to equalize pixel values
public int photo_num_full = 3; // Number of full recalibrations with re-processing of the images
public int photo_num_refines = 3; // Calibrate, remove outliers, recalibrate, ...
public double photo_min_strength = 0.0; // maybe add to filter out weak tiles
public double photo_max_diff = 40.0; // To filter mismatches. Normal (adjusted) have RMSE ~9
public boolean photo_debug = false; // Generate images and text
...@@ -1347,6 +1354,13 @@ public class CLTParameters { ...@@ -1347,6 +1354,13 @@ public class CLTParameters {
properties.setProperty(prefix+"fom_inf_bonus", this.fom_inf_bonus+""); properties.setProperty(prefix+"fom_inf_bonus", this.fom_inf_bonus+"");
properties.setProperty(prefix+"fom_inf_range", this.fom_inf_range+""); properties.setProperty(prefix+"fom_inf_range", this.fom_inf_range+"");
properties.setProperty(prefix+"photo_en", this.photo_en+""); // boolean
properties.setProperty(prefix+"photo_num_full", this.photo_num_full+""); // int
properties.setProperty(prefix+"photo_num_refines", this.photo_num_refines+""); // int
properties.setProperty(prefix+"photo_min_strength", this.photo_min_strength+""); // double
properties.setProperty(prefix+"photo_max_diff", this.photo_max_diff+""); // double
properties.setProperty(prefix+"photo_debug", this.photo_debug+""); // boolean
properties.setProperty(prefix+"show_textures", this.show_textures+""); properties.setProperty(prefix+"show_textures", this.show_textures+"");
properties.setProperty(prefix+"debug_filters", this.debug_filters+""); properties.setProperty(prefix+"debug_filters", this.debug_filters+"");
...@@ -2204,6 +2218,13 @@ public class CLTParameters { ...@@ -2204,6 +2218,13 @@ public class CLTParameters {
if (properties.getProperty(prefix+"fom_inf_bonus")!=null) this.fom_inf_bonus=Double.parseDouble(properties.getProperty(prefix+"fom_inf_bonus")); if (properties.getProperty(prefix+"fom_inf_bonus")!=null) this.fom_inf_bonus=Double.parseDouble(properties.getProperty(prefix+"fom_inf_bonus"));
if (properties.getProperty(prefix+"fom_inf_range")!=null) this.fom_inf_range=Double.parseDouble(properties.getProperty(prefix+"fom_inf_range")); if (properties.getProperty(prefix+"fom_inf_range")!=null) this.fom_inf_range=Double.parseDouble(properties.getProperty(prefix+"fom_inf_range"));
if (properties.getProperty(prefix+"photo_en")!=null) this.photo_en=Boolean.parseBoolean(properties.getProperty(prefix+"photo_en"));
if (properties.getProperty(prefix+"photo_num_full")!=null) this.photo_num_full=Integer.parseInt(properties.getProperty(prefix+"photo_num_full"));
if (properties.getProperty(prefix+"photo_num_refines")!=null) this.photo_num_refines=Integer.parseInt(properties.getProperty(prefix+"photo_num_refines"));
if (properties.getProperty(prefix+"photo_min_strength")!=null) this.photo_min_strength=Double.parseDouble(properties.getProperty(prefix+"photo_min_strength"));
if (properties.getProperty(prefix+"photo_max_diff")!=null) this.photo_max_diff=Double.parseDouble(properties.getProperty(prefix+"photo_max_diff"));
if (properties.getProperty(prefix+"photo_debug")!=null) this.photo_debug=Boolean.parseBoolean(properties.getProperty(prefix+"photo_debug"));
if (properties.getProperty(prefix+"show_textures")!=null) this.show_textures=Boolean.parseBoolean(properties.getProperty(prefix+"show_textures")); if (properties.getProperty(prefix+"show_textures")!=null) this.show_textures=Boolean.parseBoolean(properties.getProperty(prefix+"show_textures"));
if (properties.getProperty(prefix+"debug_filters")!=null) this.debug_filters=Boolean.parseBoolean(properties.getProperty(prefix+"debug_filters")); if (properties.getProperty(prefix+"debug_filters")!=null) this.debug_filters=Boolean.parseBoolean(properties.getProperty(prefix+"debug_filters"));
...@@ -2788,7 +2809,7 @@ public class CLTParameters { ...@@ -2788,7 +2809,7 @@ public class CLTParameters {
public boolean showJDialog() { public boolean showJDialog() {
// GenericDialog gd = new GenericDialog("Set CLT parameters"); // GenericDialog gd = new GenericDialog("Set CLT parameters");
GenericJTabbedDialog gd = new GenericJTabbedDialog("Set CLT parameters",800,900); GenericJTabbedDialog gd = new GenericJTabbedDialog("Set CLT parameters",1090,900);
gd.addTab ("General", "General parameters"); gd.addTab ("General", "General parameters");
gd.addNumericField("Nominal (rectilinear) disparity between side of square cameras (pix)", this.disparity, 3,7,"pix", gd.addNumericField("Nominal (rectilinear) disparity between side of square cameras (pix)", this.disparity, 3,7,"pix",
"Used when rendering 4 images"); "Used when rendering 4 images");
...@@ -2855,7 +2876,7 @@ public class CLTParameters { ...@@ -2855,7 +2876,7 @@ public class CLTParameters {
gd.addNumericField("Calculated from correlation offset vs. actual one (not yet understood)", this.corr_magic_scale, 3,6,"", "CM and poly"); gd.addNumericField("Calculated from correlation offset vs. actual one (not yet understood)", this.corr_magic_scale, 3,6,"", "CM and poly");
gd.addNumericField("Select all-pair correlation type to use 0 - CM, 1 - poly", this.corr_select, 0); gd.addNumericField("Select all-pair correlation type to use 0 - CM, 1 - poly", this.corr_select, 0);
gd.addTab ("imageDtt", "Setup extra ImageDtt parameters - eventually all will be set that way"); // gd.addTab ("imageDtt", "Setup extra ImageDtt parameters - eventually all will be set that way");
this.img_dtt.dialogQuestions(gd); this.img_dtt.dialogQuestions(gd);
gd.addTab ("Rig", "Parameters for the wide baseline rig with two quad cameras"); gd.addTab ("Rig", "Parameters for the wide baseline rig with two quad cameras");
this.rig.dialogQuestions(gd); this.rig.dialogQuestions(gd);
...@@ -3164,16 +3185,16 @@ public class CLTParameters { ...@@ -3164,16 +3185,16 @@ public class CLTParameters {
gd.addNumericField("Minimal number of infinity tiles", this.lyms_min_num_inf, 0,3,"", gd.addNumericField("Minimal number of infinity tiles", this.lyms_min_num_inf, 0,3,"",
"Minimal number of tiles (in all scenes total) in an infinity cluster"); "Minimal number of tiles (in all scenes total) in an infinity cluster");
gd.addTab ("3D", "3D reconstruction");
gd.addNumericField("Maximal channel mismatchatch for RGB cameras", this.mismatch_rgb, 4,6,"counts", gd.addTab ("Initial DSI", "Building initial (single-scene) DSI");
gd.addMessage ("--- Filter tiles by inter-channel mismatch (requires photometic equalization) ---");
gd.addNumericField("Maximal channel mismatch for RGB cameras", this.mismatch_rgb, 4,6,"counts",
"Discard correlation results during disparity sweep if channels differ more (RGB)"); "Discard correlation results during disparity sweep if channels differ more (RGB)");
gd.addNumericField("Maximal channel mismatchatch for LWIR cameras", this.mismatch_lwir, 4,6,"counts", gd.addNumericField("Maximal channel mismatch for LWIR cameras", this.mismatch_lwir, 4,6,"counts",
"Discard correlation results during disparity sweep if channels differ more (LWIR)"); "Discard correlation results during disparity sweep if channels differ more (LWIR)");
gd.addNumericField("Minimal correlation strength to override mismatch filter", this.mismatch_override, 4,6,"", gd.addNumericField("Minimal correlation strength to override mismatch filter", this.mismatch_override, 4,6,"",
"Allow tiles with the really strong correlation to have large mismatch."); "Allow tiles with the really strong correlation to have large mismatch.");
gd.addMessage ("--- FOM for initial DSI (the combination of parameters that ranges corelation results) ---");
gd.addMessage ("--- FOM for initial DSI ---");
gd.addNumericField("Minimal strength", this.fom_min_strength, 4,6,"", gd.addNumericField("Minimal strength", this.fom_min_strength, 4,6,"",
"Discard all weaker tiles (FOM=NEGATIVE_INFINITY)."); "Discard all weaker tiles (FOM=NEGATIVE_INFINITY).");
gd.addNumericField("Weight of residual disparity, RGB", this.fom_adisp_rgb, 4,6,"", gd.addNumericField("Weight of residual disparity, RGB", this.fom_adisp_rgb, 4,6,"",
...@@ -3188,8 +3209,30 @@ public class CLTParameters { ...@@ -3188,8 +3209,30 @@ public class CLTParameters {
"Prevent stray FG over sky - add to FOM."); "Prevent stray FG over sky - add to FOM.");
gd.addNumericField("Infinity bonus disparity range", this.fom_inf_range, 4,6,"pix", gd.addNumericField("Infinity bonus disparity range", this.fom_inf_range, 4,6,"pix",
"Infinity range to receive FOM bonus."); "Infinity range to receive FOM bonus.");
gd.addMessage ("See \"Corr LMA\" tab under \"LMA (single) results filtering\" for LMA parameters");
gd.addMessage ("that influence the results on the last stages of the DSI building.");
gd.addMessage ("\"Sky\" tab parameters define featureless sky area detection that supplement initial DSI.");
gd.addTab ("Photometric","Photometric equalization - can be performed after DSI is available)");
gd.addMessage ("Photometric calibration is saved with the current scene (and saved with the \"Save\" command and with the reference scene.");
gd.addMessage ("It is applied when the source files are read.");
gd.addCheckbox ("Enable photometric calibration", this.photo_en,
"Equalize per- sensor gains and offsets. Requires disparity map. Save to reference scene and with current scene (to .corr-zml).");
gd.addNumericField("Full photometric (re)calibrations", this.photo_num_full, 0,3,"pix",
"Full recalibratrions include re-importing raw images with updated offsets/gains");
gd.addNumericField("Refines", this.photo_num_refines, 0,3,"pix",
"Calculate calibration, remove outliers (e.g. FG/BG) and repeat");
gd.addNumericField("Minimal DSI strength", this.photo_min_strength, 5,7,"",
"Do not use weak tiles.");
gd.addNumericField("Maximal channel mismatch", this.photo_max_diff, 5,7,"",
"Detect (and remove outliers). Adjusted images have RMSE ~9 counts.");
gd.addCheckbox ("Debug pphotometric calibration", this.photo_debug,
"Generate debug images an text output.");
gd.addMessage ("--- 3D reconstruction ---");
gd.addTab ("3D", "3D reconstruction");
gd.addCheckbox ("Show generated textures", this.show_textures); gd.addCheckbox ("Show generated textures", this.show_textures);
gd.addCheckbox ("show intermediate results of filtering", this.debug_filters); gd.addCheckbox ("show intermediate results of filtering", this.debug_filters);
...@@ -4182,6 +4225,13 @@ public class CLTParameters { ...@@ -4182,6 +4225,13 @@ public class CLTParameters {
this.fom_inf_bonus= gd.getNextNumber(); this.fom_inf_bonus= gd.getNextNumber();
this.fom_inf_range= gd.getNextNumber(); this.fom_inf_range= gd.getNextNumber();
this.photo_en = gd.getNextBoolean();
this.photo_num_full = (int) gd.getNextNumber();
this.photo_num_refines = (int) gd.getNextNumber();
this.photo_min_strength = gd.getNextNumber();
this.photo_max_diff = gd.getNextNumber();
this.photo_debug = gd.getNextBoolean();
this.show_textures= gd.getNextBoolean(); this.show_textures= gd.getNextBoolean();
this.debug_filters= gd.getNextBoolean(); this.debug_filters= gd.getNextBoolean();
this.min_smth= gd.getNextNumber(); this.min_smth= gd.getNextNumber();
......
...@@ -28,6 +28,7 @@ import java.util.Properties; ...@@ -28,6 +28,7 @@ import java.util.Properties;
import com.elphel.imagej.common.GenericJTabbedDialog; import com.elphel.imagej.common.GenericJTabbedDialog;
public class ImageDttParameters { public class ImageDttParameters {
// "ImageDtt" tab followed by others
public boolean gpu_mode_debug = true; public boolean gpu_mode_debug = true;
public boolean gpu_verify = false; // verify tasks/ input data public boolean gpu_verify = false; // verify tasks/ input data
public boolean corr_mode_debug = true; public boolean corr_mode_debug = true;
...@@ -398,6 +399,7 @@ public class ImageDttParameters { ...@@ -398,6 +399,7 @@ public class ImageDttParameters {
public void dialogQuestions(GenericJTabbedDialog gd) { public void dialogQuestions(GenericJTabbedDialog gd) {
gd.addTab ("imageDtt", "Setup extra ImageDtt parameters - eventually all will be set that way");
gd.addCheckbox ("Debug CPU->GPU matching", this.gpu_mode_debug, gd.addCheckbox ("Debug CPU->GPU matching", this.gpu_mode_debug,
"output clt_corr_partial"); "output clt_corr_partial");
gd.addCheckbox ("Verify GPU input", this.gpu_verify, gd.addCheckbox ("Verify GPU input", this.gpu_verify,
...@@ -710,8 +712,8 @@ public class ImageDttParameters { ...@@ -710,8 +712,8 @@ public class ImageDttParameters {
gd.addMessage("Single-tile (no lazy eye) only parameters (some are common"); gd.addMessage("Single-tile (no lazy eye) only parameters (some are common");
gd.addNumericField("Cluster disparity range", this.lma_disp_range, 3, 6, "pix", gd.addNumericField("Cluster disparity range", this.lma_disp_range, 3, 6, "pix",
"Disparity range to combine in one cluster (to mitigate ERS"); "Disparity range to combine in one cluster (to mitigate ERS");
// gd.addCheckbox ("Correlation maximum as gaussian", this.lmas_gaussian, // gd.addCheckbox ("Correlation maximum as gaussian", this.lmas_gaussian,
// "Model correlation maximum as a Gaussian exp(-r^2) (false - as a parabola - 1-r^2)"); // "Model correlation maximum as a Gaussian exp(-r^2) (false - as a parabola - 1-r^2)");
gd.addNumericField ("Correlation maximum function type", this.lmas_gaussian, 0, 3, "", gd.addNumericField ("Correlation maximum function type", this.lmas_gaussian, 0, 3, "",
"0 - parabola - 1-r^2, 1 - exp(-r^2), 2 - limited parabola (>=0), 3 - limited squared parabola (1-r^2)^2"); "0 - parabola - 1-r^2, 1 - exp(-r^2), 2 - limited parabola (>=0), 3 - limited squared parabola (1-r^2)^2");
...@@ -765,8 +767,8 @@ public class ImageDttParameters { ...@@ -765,8 +767,8 @@ public class ImageDttParameters {
gd.addCheckbox ("Re-run LMA after removing weak/failed tiles", this.lma_second, gd.addCheckbox ("Re-run LMA after removing weak/failed tiles", this.lma_second,
"Re-run LMA with filtered tiles (see Correlation strength calculation section below)"); "Re-run LMA with filtered tiles (see Correlation strength calculation section below)");
// gd.addCheckbox ("Gaussian mode during LMA re-run", this.lma_second_gaussian, // gd.addCheckbox ("Gaussian mode during LMA re-run", this.lma_second_gaussian,
// "Parabola is more stable when using with un-filtered tiles, so it makes sense to use Gaussina only on filtered tiles"); // "Parabola is more stable when using with un-filtered tiles, so it makes sense to use Gaussina only on filtered tiles");
gd.addNumericField ("Correlation maximum function typedurinf re-run", this.lma_second_gaussian, 0, 3, "", gd.addNumericField ("Correlation maximum function typedurinf re-run", this.lma_second_gaussian, 0, 3, "",
"0 - parabola - 1-r^2, 1 - exp(-r^2), 2 - limited parabola (>=0), 3 - limited squared parabola (1-r^2)^2."+ "0 - parabola - 1-r^2, 1 - exp(-r^2), 2 - limited parabola (>=0), 3 - limited squared parabola (1-r^2)^2."+
" Parabola is more stable when using with un-filtered tiles, so it makes sense to use Gaussina only on filtered tiles"); " Parabola is more stable when using with un-filtered tiles, so it makes sense to use Gaussina only on filtered tiles");
...@@ -1049,7 +1051,7 @@ public class ImageDttParameters { ...@@ -1049,7 +1051,7 @@ public class ImageDttParameters {
this.tilt_damp_tilt = gd.getNextNumber(); this.tilt_damp_tilt = gd.getNextNumber();
this.tilt_clust_extra= (int) gd.getNextNumber(); this.tilt_clust_extra= (int) gd.getNextNumber();
//LMA tab //LMA tab
this.lma_disp_range = gd.getNextNumber(); this.lma_disp_range = gd.getNextNumber();
this.lmas_gaussian= (int) gd.getNextNumber(); this.lmas_gaussian= (int) gd.getNextNumber();
this.lmas_adjust_wm= gd.getNextBoolean(); this.lmas_adjust_wm= gd.getNextBoolean();
...@@ -1133,6 +1135,7 @@ public class ImageDttParameters { ...@@ -1133,6 +1135,7 @@ public class ImageDttParameters {
public void setProperties(String prefix,Properties properties){ public void setProperties(String prefix,Properties properties){
properties.setProperty(prefix+"gpu_mode_debug", this.gpu_mode_debug+""); properties.setProperty(prefix+"gpu_mode_debug", this.gpu_mode_debug+"");
properties.setProperty(prefix+"gpu_verify", this.gpu_verify+""); properties.setProperty(prefix+"gpu_verify", this.gpu_verify+"");
properties.setProperty(prefix+"corr_mode_debug", this.corr_mode_debug+""); properties.setProperty(prefix+"corr_mode_debug", this.corr_mode_debug+"");
......
...@@ -193,16 +193,6 @@ public class IntersceneMatchParameters { ...@@ -193,16 +193,6 @@ public class IntersceneMatchParameters {
public double half_disparity = 5.0; // Reduce weight twice for this disparity public double half_disparity = 5.0; // Reduce weight twice for this disparity
public double half_avg_diff = 0.2; // when L2 of x,y difference from average of neibs - reduce twice public double half_avg_diff = 0.2; // when L2 of x,y difference from average of neibs - reduce twice
// Photometric calibration (move elsewhere)?
public boolean photo_en = false; // perform photogrammetric calibration to equalize pixel values
public int photo_num_full = 1; // Number of full recalibrations with re-processing of the images
public int photo_num_refines = 3; // Calibrate, remove outliers, recalibrate, ...
public double photo_min_strength = 0.0; // maybe add to filter out weak tiles
public double photo_max_diff = 40.0; // To filter mismatches. Normal (adjusted) have RMSE ~9
public boolean photo_debug = false; // Generate images and text
// Detect initial match // Detect initial match
public double min_ref_str = 0.22; // For orientations: use only tiles of the reference scene DSI_MAIN is stronger public double min_ref_str = 0.22; // For orientations: use only tiles of the reference scene DSI_MAIN is stronger
public int pix_step = 4; // Azimuth/tilt search step in pixels public int pix_step = 4; // Azimuth/tilt search step in pixels
...@@ -258,12 +248,24 @@ public class IntersceneMatchParameters { ...@@ -258,12 +248,24 @@ public class IntersceneMatchParameters {
private boolean show_motion_vectors = true; // show calculated motion vectors private boolean show_motion_vectors = true; // show calculated motion vectors
public int debug_level = -1; // all renders are disable for debug_level < 0, scene "renders" for for debug_level < 1 public int debug_level = -1; // all renders are disable for debug_level < 0, scene "renders" for for debug_level < 1
// Pairwise ERS testing // Pairwise ERS testing
public boolean test_ers = false; public boolean test_ers = false;
public int test_ers0 = -1; // try adjusting a pair of scenes with ERS. Reference scene index public int test_ers0 = -1; // try adjusting a pair of scenes with ERS. Reference scene index
public int test_ers1 = -1; // try adjusting a pair of scenes with ERS. Other scene index public int test_ers1 = -1; // try adjusting a pair of scenes with ERS. Other scene index
// SKy detection/filtering
public double sky_highest_min = -50; // lowest absolute value should not be higher (requires photometric)
public double cold_frac = 0.005; // this and lower will scale fom by cold_scale
public double hot_frac = 0.9; // this and above will scale fom by 1.0
public double cold_scale = 0.2; // <=1.0. 1.0 - disables temperature dependence
public double sky_seed = 5.0; // start with product of strength by diff_second below this
public double lma_seed = 2.0; // seed - disparity_lma limit double sky_lim = 15.0; // then expand to product of strength by diff_second below this
public int sky_shrink = 3;
public int seed_rows = 5; // sky should appear in this top rows
public double sky_lim = 15.0; // then expand to product of strength by diff_second below this
public int sky_expand_extra = 0; // 1?
public double min_strength = 0.08;
public int lowest_sky_row = 50;// appears that low - invalid, remove completely
public boolean renderRef() {return renderRef (debug_level);} public boolean renderRef() {return renderRef (debug_level);}
public boolean renderScene() {return renderScene (debug_level);} public boolean renderScene() {return renderScene (debug_level);}
...@@ -635,21 +637,6 @@ public class IntersceneMatchParameters { ...@@ -635,21 +637,6 @@ public class IntersceneMatchParameters {
gd.addNumericField("Difference from neighbors average ", this.half_avg_diff, 5,7,"", gd.addNumericField("Difference from neighbors average ", this.half_avg_diff, 5,7,"",
"Reduce twice for high difference from neighbors average."); "Reduce twice for high difference from neighbors average.");
gd.addMessage ("Photometric calibration (move elsewhere?)");
gd.addCheckbox ("Enable photometric calibration", this.photo_en,
"Equalize per- sensor gains and offsets. Requires disparity map. Save to reference scene and with current scene (to .corr-zml).");
gd.addNumericField("Full photometric (re)calibrations", this.photo_num_full, 0,3,"pix",
"Full recalibratrions include re-importing raw images with updated offsets/gains");
gd.addNumericField("Refines", this.photo_num_refines, 0,3,"pix",
"Calculate calibration, remove outliers (e.g. FG/BG) and repeat");
gd.addNumericField("Minimal DSI strength", this.photo_min_strength, 5,7,"",
"Do not use weak tiles.");
gd.addNumericField("Maximal channel mismatch", this.photo_max_diff, 5,7,"",
"Detect (and remove outliers). Adjusted images have RMSE ~9 counts.");
gd.addCheckbox ("Debug pphotometric calibration", this.photo_debug,
"Generate debug images an text output.");
gd.addMessage ("Initial search for the inter-scene match"); gd.addMessage ("Initial search for the inter-scene match");
gd.addNumericField("DSI_MAIN minimal strength", this.min_ref_str, 5,7,"", gd.addNumericField("DSI_MAIN minimal strength", this.min_ref_str, 5,7,"",
"Match only tiles where DSI_MAIN is stronger than that (and has LMA)."); "Match only tiles where DSI_MAIN is stronger than that (and has LMA).");
...@@ -764,6 +751,35 @@ public class IntersceneMatchParameters { ...@@ -764,6 +751,35 @@ public class IntersceneMatchParameters {
"Other scene index in a scene sequence (should have a very different angular/linear velocity component)"); "Other scene index in a scene sequence (should have a very different angular/linear velocity component)");
gd.addTab("Sky","Featureless sky areas detection and filtering (LWIR only)");
gd.addMessage ("Temperature-related filtering (requires photometric calibration)");
gd.addNumericField("High limit of the scene coldest tile", this.sky_highest_min, 5,7,"",
"Sky is normally cold. If the (globally offset) minimal scene absolutre pixel value is above - no sky in the scene (debug images still show it)");
gd.addNumericField("Cold level fraction", this.cold_frac, 5,7,"",
"All tiles below this percentile are considered \"cold\".");
gd.addNumericField("Hot level fraction", this.hot_frac, 5,7,"",
"All tiles above this percentile are considered \"hot\".");
gd.addNumericField("Cold FOM scale", this.cold_scale, 5,7,"",
"Multiply (strength*spread) by this value (reduce), and linearly scale up to 1.0 for hot ones.");
gd.addMessage ("Generate seed tiles for the potential sky area");
gd.addNumericField("Seed FOM level", this.sky_seed, 5,7,"",
"Maximal FOM (strength*spread*temp_scale) level to seed sky area, temp_scale is generated from average pixel value "+
"at infinity and 3 above parameters");
gd.addNumericField("Seed maximal disparity", this.lma_seed, 5,7,"pix",
"Seed tiles should not have LMA-found disparity above this");
gd.addNumericField("Shrink sky seed", this.sky_shrink, 0,3,"",
"Shrink sky seed tiles to eliminate too small (false) clusters. One shrinks in hor/vert, 2 - with diagonals, ...");
gd.addNumericField("Seed rows", this.seed_rows, 0,3,"",
"Sky is above and normally should appear in the top image rows. Applies after shrinking.");
gd.addMessage ("Expand seed tiles");
gd.addNumericField("Expand FOM limit", this.sky_lim, 5,7,"",
"Expand while FOM is below this value (usually to a high-contrast skyline).");
gd.addNumericField("Expand extra", this.sky_expand_extra, 0,3,"",
"Additionally expand sky area after reaching threshold in the previous step.");
gd.addNumericField("Modify strength to be at least this", this.min_strength, 5,7,"",
"Input strength has some with zero values resulting in zero FOM. Make them at least this.");
gd.addNumericField("Lowest sky row", this.lowest_sky_row, 0,3,"",
"Last defense - if the detected sky area reaches near-bottom of the page - it is invalid, remove it (but keep in debug images)");
} }
public void dialogAnswers(GenericJTabbedDialog gd) { public void dialogAnswers(GenericJTabbedDialog gd) {
...@@ -975,13 +991,6 @@ public class IntersceneMatchParameters { ...@@ -975,13 +991,6 @@ public class IntersceneMatchParameters {
this.half_disparity = gd.getNextNumber(); this.half_disparity = gd.getNextNumber();
this.half_avg_diff = gd.getNextNumber(); this.half_avg_diff = gd.getNextNumber();
this.photo_en = gd.getNextBoolean();
this.photo_num_full = (int) gd.getNextNumber();
this.photo_num_refines = (int) gd.getNextNumber();
this.photo_min_strength = gd.getNextNumber();
this.photo_max_diff = gd.getNextNumber();
this.photo_debug = gd.getNextBoolean();
this.min_ref_str = gd.getNextNumber(); this.min_ref_str = gd.getNextNumber();
this.pix_step = (int) gd.getNextNumber(); this.pix_step = (int) gd.getNextNumber();
this.search_rad = (int) gd.getNextNumber(); this.search_rad = (int) gd.getNextNumber();
...@@ -1035,6 +1044,21 @@ public class IntersceneMatchParameters { ...@@ -1035,6 +1044,21 @@ public class IntersceneMatchParameters {
this.test_ers0 = (int) gd.getNextNumber(); this.test_ers0 = (int) gd.getNextNumber();
this.test_ers1 = (int) gd.getNextNumber(); this.test_ers1 = (int) gd.getNextNumber();
this.sky_highest_min = gd.getNextNumber();
this.cold_frac = gd.getNextNumber();
this.hot_frac = gd.getNextNumber();
this.cold_scale = gd.getNextNumber();
this.sky_seed = gd.getNextNumber();
this.lma_seed = gd.getNextNumber();
this.sky_shrink = (int) gd.getNextNumber();
this.seed_rows = (int) gd.getNextNumber();
this.sky_lim = gd.getNextNumber();
this.sky_expand_extra = (int) gd.getNextNumber();
this.min_strength = gd.getNextNumber();
this.lowest_sky_row = (int) gd.getNextNumber();
if (this.weight_zero_neibs > 1.0) this.weight_zero_neibs = 1.0; if (this.weight_zero_neibs > 1.0) this.weight_zero_neibs = 1.0;
} }
...@@ -1195,13 +1219,6 @@ public class IntersceneMatchParameters { ...@@ -1195,13 +1219,6 @@ public class IntersceneMatchParameters {
properties.setProperty(prefix+"half_disparity", this.half_disparity+""); // double properties.setProperty(prefix+"half_disparity", this.half_disparity+""); // double
properties.setProperty(prefix+"half_avg_diff", this.half_avg_diff+""); // double properties.setProperty(prefix+"half_avg_diff", this.half_avg_diff+""); // double
properties.setProperty(prefix+"photo_en", this.photo_en+""); // boolean
properties.setProperty(prefix+"photo_num_full", this.photo_num_full+""); // int
properties.setProperty(prefix+"photo_num_refines", this.photo_num_refines+""); // int
properties.setProperty(prefix+"photo_min_strength", this.photo_min_strength+""); // double
properties.setProperty(prefix+"photo_max_diff", this.photo_max_diff+""); // double
properties.setProperty(prefix+"photo_debug", this.photo_debug+""); // boolean
properties.setProperty(prefix+"pix_step", this.pix_step+""); // int properties.setProperty(prefix+"pix_step", this.pix_step+""); // int
properties.setProperty(prefix+"search_rad", this.search_rad+""); // int properties.setProperty(prefix+"search_rad", this.search_rad+""); // int
properties.setProperty(prefix+"maybe_sum", this.maybe_sum+""); // double properties.setProperty(prefix+"maybe_sum", this.maybe_sum+""); // double
...@@ -1253,6 +1270,21 @@ public class IntersceneMatchParameters { ...@@ -1253,6 +1270,21 @@ public class IntersceneMatchParameters {
properties.setProperty(prefix+"test_ers0", this.test_ers0+""); // int properties.setProperty(prefix+"test_ers0", this.test_ers0+""); // int
properties.setProperty(prefix+"test_ers1", this.test_ers1+""); // int properties.setProperty(prefix+"test_ers1", this.test_ers1+""); // int
properties.setProperty(prefix+"sky_highest_min", this.sky_highest_min+""); // double
properties.setProperty(prefix+"cold_frac", this.cold_frac+""); // double
properties.setProperty(prefix+"hot_frac", this.hot_frac+""); // double
properties.setProperty(prefix+"cold_scale", this.cold_scale+""); // double
properties.setProperty(prefix+"sky_seed", this.sky_seed+""); // double
properties.setProperty(prefix+"lma_seed", this.lma_seed+""); // double
properties.setProperty(prefix+"sky_shrink", this.sky_shrink+""); // int
properties.setProperty(prefix+"seed_rows", this.seed_rows+""); // int
properties.setProperty(prefix+"sky_lim", this.sky_lim+""); // double
properties.setProperty(prefix+"sky_expand_extra", this.sky_expand_extra+""); // int
properties.setProperty(prefix+"min_strength", this.min_strength+""); // double
properties.setProperty(prefix+"lowest_sky_row", this.lowest_sky_row+""); // int
} }
public void getProperties(String prefix,Properties properties){ public void getProperties(String prefix,Properties properties){
...@@ -1440,13 +1472,6 @@ public class IntersceneMatchParameters { ...@@ -1440,13 +1472,6 @@ public class IntersceneMatchParameters {
if (properties.getProperty(prefix+"half_disparity")!=null) this.half_disparity=Double.parseDouble(properties.getProperty(prefix+"half_disparity")); if (properties.getProperty(prefix+"half_disparity")!=null) this.half_disparity=Double.parseDouble(properties.getProperty(prefix+"half_disparity"));
if (properties.getProperty(prefix+"half_avg_diff")!=null) this.half_avg_diff=Double.parseDouble(properties.getProperty(prefix+"half_avg_diff")); if (properties.getProperty(prefix+"half_avg_diff")!=null) this.half_avg_diff=Double.parseDouble(properties.getProperty(prefix+"half_avg_diff"));
if (properties.getProperty(prefix+"photo_en")!=null) this.photo_en=Boolean.parseBoolean(properties.getProperty(prefix+"photo_en"));
if (properties.getProperty(prefix+"photo_num_full")!=null) this.photo_num_full=Integer.parseInt(properties.getProperty(prefix+"photo_num_full"));
if (properties.getProperty(prefix+"photo_num_refines")!=null) this.photo_num_refines=Integer.parseInt(properties.getProperty(prefix+"photo_num_refines"));
if (properties.getProperty(prefix+"photo_min_strength")!=null) this.photo_min_strength=Double.parseDouble(properties.getProperty(prefix+"photo_min_strength"));
if (properties.getProperty(prefix+"photo_max_diff")!=null) this.photo_max_diff=Double.parseDouble(properties.getProperty(prefix+"photo_max_diff"));
if (properties.getProperty(prefix+"photo_debug")!=null) this.photo_debug=Boolean.parseBoolean(properties.getProperty(prefix+"photo_debug"));
if (properties.getProperty(prefix+"pix_step")!=null) this.pix_step=Integer.parseInt(properties.getProperty(prefix+"pix_step")); if (properties.getProperty(prefix+"pix_step")!=null) this.pix_step=Integer.parseInt(properties.getProperty(prefix+"pix_step"));
if (properties.getProperty(prefix+"search_rad")!=null) this.search_rad=Integer.parseInt(properties.getProperty(prefix+"search_rad")); if (properties.getProperty(prefix+"search_rad")!=null) this.search_rad=Integer.parseInt(properties.getProperty(prefix+"search_rad"));
if (properties.getProperty(prefix+"maybe_sum")!=null) this.maybe_sum=Double.parseDouble(properties.getProperty(prefix+"maybe_sum")); if (properties.getProperty(prefix+"maybe_sum")!=null) this.maybe_sum=Double.parseDouble(properties.getProperty(prefix+"maybe_sum"));
...@@ -1458,8 +1483,6 @@ public class IntersceneMatchParameters { ...@@ -1458,8 +1483,6 @@ public class IntersceneMatchParameters {
if (properties.getProperty(prefix+"maybe_fom")!=null) this.maybe_fom=Double.parseDouble(properties.getProperty(prefix+"maybe_fom")); if (properties.getProperty(prefix+"maybe_fom")!=null) this.maybe_fom=Double.parseDouble(properties.getProperty(prefix+"maybe_fom"));
if (properties.getProperty(prefix+"sure_fom")!=null) this.sure_fom=Double.parseDouble(properties.getProperty(prefix+"sure_fom")); if (properties.getProperty(prefix+"sure_fom")!=null) this.sure_fom=Double.parseDouble(properties.getProperty(prefix+"sure_fom"));
if (properties.getProperty(prefix+"use_combo_dsi")!=null) this.use_combo_dsi=Boolean.parseBoolean(properties.getProperty(prefix+"use_combo_dsi")); if (properties.getProperty(prefix+"use_combo_dsi")!=null) this.use_combo_dsi=Boolean.parseBoolean(properties.getProperty(prefix+"use_combo_dsi"));
if (properties.getProperty(prefix+"use_lma_dsi")!=null) this.use_lma_dsi=Boolean.parseBoolean(properties.getProperty(prefix+"use_lma_dsi")); if (properties.getProperty(prefix+"use_lma_dsi")!=null) this.use_lma_dsi=Boolean.parseBoolean(properties.getProperty(prefix+"use_lma_dsi"));
...@@ -1499,6 +1522,19 @@ public class IntersceneMatchParameters { ...@@ -1499,6 +1522,19 @@ public class IntersceneMatchParameters {
if (properties.getProperty(prefix+"test_ers")!=null) this.test_ers=Boolean.parseBoolean(properties.getProperty(prefix+"test_ers")); if (properties.getProperty(prefix+"test_ers")!=null) this.test_ers=Boolean.parseBoolean(properties.getProperty(prefix+"test_ers"));
if (properties.getProperty(prefix+"test_ers0")!=null) this.test_ers0=Integer.parseInt(properties.getProperty(prefix+"test_ers0")); if (properties.getProperty(prefix+"test_ers0")!=null) this.test_ers0=Integer.parseInt(properties.getProperty(prefix+"test_ers0"));
if (properties.getProperty(prefix+"test_ers1")!=null) this.test_ers1=Integer.parseInt(properties.getProperty(prefix+"test_ers1")); if (properties.getProperty(prefix+"test_ers1")!=null) this.test_ers1=Integer.parseInt(properties.getProperty(prefix+"test_ers1"));
if (properties.getProperty(prefix+"sky_highest_min")!=null) this.sky_highest_min=Double.parseDouble(properties.getProperty(prefix+"sky_highest_min"));
if (properties.getProperty(prefix+"cold_frac")!=null) this.cold_frac=Double.parseDouble(properties.getProperty(prefix+"cold_frac"));
if (properties.getProperty(prefix+"hot_frac")!=null) this.hot_frac=Double.parseDouble(properties.getProperty(prefix+"hot_frac"));
if (properties.getProperty(prefix+"cold_scale")!=null) this.cold_scale=Double.parseDouble(properties.getProperty(prefix+"cold_scale"));
if (properties.getProperty(prefix+"sky_seed")!=null) this.sky_seed=Double.parseDouble(properties.getProperty(prefix+"sky_seed"));
if (properties.getProperty(prefix+"lma_seed")!=null) this.lma_seed=Double.parseDouble(properties.getProperty(prefix+"lma_seed"));
if (properties.getProperty(prefix+"sky_shrink")!=null) this.sky_shrink=Integer.parseInt(properties.getProperty(prefix+"sky_shrink"));
if (properties.getProperty(prefix+"seed_rows")!=null) this.seed_rows=Integer.parseInt(properties.getProperty(prefix+"seed_rows"));
if (properties.getProperty(prefix+"sky_lim")!=null) this.sky_lim=Double.parseDouble(properties.getProperty(prefix+"sky_lim"));
if (properties.getProperty(prefix+"sky_expand_extra")!=null) this.sky_expand_extra=Integer.parseInt(properties.getProperty(prefix+"sky_expand_extra"));
if (properties.getProperty(prefix+"min_strength")!=null) this.min_strength=Double.parseDouble(properties.getProperty(prefix+"min_strength"));
if (properties.getProperty(prefix+"lowest_sky_row")!=null) this.lowest_sky_row=Integer.parseInt(properties.getProperty(prefix+"lowest_sky_row"));
} }
@Override @Override
...@@ -1644,13 +1680,6 @@ public class IntersceneMatchParameters { ...@@ -1644,13 +1680,6 @@ public class IntersceneMatchParameters {
imp.half_disparity = this.half_disparity; imp.half_disparity = this.half_disparity;
imp.half_avg_diff = this.half_avg_diff; imp.half_avg_diff = this.half_avg_diff;
imp.photo_en = this.photo_en;
imp.photo_num_full = this.photo_num_full;
imp.photo_num_refines = this.photo_num_refines;
imp.photo_min_strength = this.photo_min_strength;
imp.photo_max_diff = this.photo_max_diff;
imp.photo_debug = this.photo_debug;
imp.pix_step = this.pix_step; imp.pix_step = this.pix_step;
imp.search_rad = this.search_rad; imp.search_rad = this.search_rad;
imp.maybe_sum = this.maybe_sum; imp.maybe_sum = this.maybe_sum;
...@@ -1698,6 +1727,23 @@ public class IntersceneMatchParameters { ...@@ -1698,6 +1727,23 @@ public class IntersceneMatchParameters {
imp.show_2d_correlations = this.show_2d_correlations; imp.show_2d_correlations = this.show_2d_correlations;
imp.show_motion_vectors = this.show_motion_vectors ; imp.show_motion_vectors = this.show_motion_vectors ;
imp.debug_level = this.debug_level; imp.debug_level = this.debug_level;
imp.test_ers = this.test_ers;
imp.test_ers0 = this.test_ers0;
imp.test_ers1 = this.test_ers1;
imp.sky_highest_min = this.sky_highest_min;
imp.cold_frac = this.cold_frac;
imp.hot_frac = this.hot_frac;
imp.cold_scale = this.cold_scale;
imp.sky_seed = this.sky_seed;
imp.lma_seed = this.lma_seed;
imp.sky_shrink = this.sky_shrink;
imp.seed_rows = this.seed_rows;
imp.sky_lim = this.sky_lim;
imp.sky_expand_extra = this.sky_expand_extra;
imp.min_strength = this.min_strength;
imp.lowest_sky_row = this.lowest_sky_row;
return imp; return imp;
} }
public static long getLongColor(Color color) { public static long getLongColor(Color color) {
...@@ -1714,56 +1760,6 @@ public class IntersceneMatchParameters { ...@@ -1714,56 +1760,6 @@ public class IntersceneMatchParameters {
} }
} }
/*
public void orderStereo(){
boolean ordered;
do {
ordered=true;
for (int i = 0; i < (stereo_bases.length - 1); i++) {
if (stereo_bases[i+1]<stereo_bases[i]) {
boolean en = generate_stereo_var[i+1];
generate_stereo_var[i+1] = generate_stereo_var[i];
generate_stereo_var[i] = en;
double base = stereo_bases[i+1];
stereo_bases[i+1] = stereo_bases[i];
stereo_bases[i] = base;
ordered = false;
}
}
} while (!ordered);
}
public void addStereo(double base, boolean en) {
double [] bases = new double [stereo_bases.length + 1];
boolean [] ens = new boolean [stereo_bases.length + 1];
bases[0] = base;
ens[0] = en;
System.arraycopy(stereo_bases, 0, bases, 1, stereo_bases.length);
System.arraycopy(generate_stereo_var, 0, ens, 1, stereo_bases.length);
stereo_bases = bases;
generate_stereo_var = ens;
orderStereo();
}
public void removeStereo(int indx) {
if ((indx >=0) && (indx <stereo_bases.length)) {
double [] bases = new double [stereo_bases.length - 1];
boolean [] ens = new boolean [stereo_bases.length - 1];
if (indx > 0) {
System.arraycopy(stereo_bases, 0, bases, 0, indx);
System.arraycopy(generate_stereo_var, 0, ens, 0, indx);
}
if (indx < (stereo_bases.length - 1)) {
System.arraycopy(stereo_bases, indx+1, bases, indx, stereo_bases.length - indx - 1);
System.arraycopy(generate_stereo_var, indx+1, ens, indx, stereo_bases.length - indx - 1);
}
stereo_bases = bases;
generate_stereo_var = ens;
}
}
*/
public void orderStereoViews(){ public void orderStereoViews(){
boolean ordered; boolean ordered;
do { do {
......
...@@ -4038,12 +4038,12 @@ public class OpticalFlow { ...@@ -4038,12 +4038,12 @@ public class OpticalFlow {
boolean export_ml_files = clt_parameters.imp.export_ml_files; boolean export_ml_files = clt_parameters.imp.export_ml_files;
//boolean calibrate_photometric = true; //boolean calibrate_photometric = true;
boolean photo_en = clt_parameters.imp.photo_en; // false; // perform photogrammetric calibration to equalize pixel values boolean photo_en = clt_parameters.photo_en; // false; // perform photogrammetric calibration to equalize pixel values
int photo_num_full = clt_parameters.imp.photo_num_full; // 1; // Number of full recalibrations with re-processing of the images int photo_num_full = clt_parameters.photo_num_full; // 1; // Number of full recalibrations with re-processing of the images
int photo_num_refines = clt_parameters.imp.photo_num_refines; // 3; // Calibrate, remove outliers, recalibrate, ... int photo_num_refines = clt_parameters.photo_num_refines; // 3; // Calibrate, remove outliers, recalibrate, ...
double photo_min_strength = clt_parameters.imp.photo_min_strength; // 0.0; // maybe add to filter out weak tiles double photo_min_strength = clt_parameters.photo_min_strength; // 0.0; // maybe add to filter out weak tiles
double photo_max_diff = clt_parameters.imp.photo_max_diff; // 40.0; // To filter mismatches. Normal (adjusted) have RMSE ~9 double photo_max_diff = clt_parameters.photo_max_diff; // 40.0; // To filter mismatches. Normal (adjusted) have RMSE ~9
boolean photo_debug = clt_parameters.imp.photo_debug; // false; // Generate images and text boolean photo_debug = clt_parameters.photo_debug; // false; // Generate images and text
boolean show_dsi_image = clt_parameters.imp.show_ranges && !batch_mode; boolean show_dsi_image = clt_parameters.imp.show_ranges && !batch_mode;
boolean show_images = clt_parameters.imp.show_images && !batch_mode; boolean show_images = clt_parameters.imp.show_images && !batch_mode;
...@@ -4132,11 +4132,19 @@ public class OpticalFlow { ...@@ -4132,11 +4132,19 @@ public class OpticalFlow {
final int debugLevelInner=clt_parameters.batch_run? -2: debugLevel; // copied from TQ final int debugLevelInner=clt_parameters.batch_run? -2: debugLevel; // copied from TQ
double min_ref_str = clt_parameters.imp.min_ref_str; double min_ref_str = clt_parameters.imp.min_ref_str;
double sky_seed = 7.0; // start with product of strength by diff_second below this
double sky_lim = 15.0; // then expand to product of strength by diff_second below this double sky_highest_min = clt_parameters.imp.sky_highest_min;
double lma_seed= 2.0; // seed - disparity_lma limit double sky_lim = 15.0; // then expand to product of strength by diff_second below this double cold_frac = clt_parameters.imp.cold_frac;
int sky_shrink = 6; double hot_frac = clt_parameters.imp.hot_frac;
int sky_expand_extra = 0; // 1? double cold_scale = clt_parameters.imp.cold_scale;
double sky_seed = clt_parameters.imp.sky_seed;
double lma_seed = clt_parameters.imp.lma_seed;
int sky_shrink = clt_parameters.imp.sky_shrink;
int seed_rows = clt_parameters.imp.seed_rows;
double sky_lim = clt_parameters.imp.sky_lim;
int sky_expand_extra = clt_parameters.imp.sky_expand_extra;
double min_strength = clt_parameters.imp.min_strength;
int lowest_sky_row = clt_parameters.imp.lowest_sky_row;
boolean [] ref_blue_sky = null; // turn off "lma" in the ML output boolean [] ref_blue_sky = null; // turn off "lma" in the ML output
...@@ -4267,6 +4275,13 @@ public class OpticalFlow { ...@@ -4267,6 +4275,13 @@ public class OpticalFlow {
sky_lim, // double sky_lim, // = 15.0; // then expand to product of strength by diff_second below this sky_lim, // double sky_lim, // = 15.0; // then expand to product of strength by diff_second below this
sky_shrink, // int sky_shrink, // = 4; sky_shrink, // int sky_shrink, // = 4;
sky_expand_extra, // int sky_expand_extra, // = 100; // 1? sky_expand_extra, // int sky_expand_extra, // = 100; // 1?
cold_scale, // = 0.2; // <=1.0. 1.0 - disables temperature dependence
cold_frac, // = 0.005; // this and lower will scale fom by cold_scale
hot_frac, // = 0.9; // this and above will scale fom by 1.0
min_strength, // = 0.08;
seed_rows, // = 5; // sky should appear in this top rows
lowest_sky_row, // = 50;// appears that low - invalid, remove completely
sky_highest_min, // = 100; // lowest absolute value should not be higher (requires photometric)
dsi[TwoQuadCLT.DSI_STRENGTH_AUX], // double [] strength, dsi[TwoQuadCLT.DSI_STRENGTH_AUX], // double [] strength,
dsi[TwoQuadCLT.DSI_SPREAD_AUX], // double [] spread, dsi[TwoQuadCLT.DSI_SPREAD_AUX], // double [] spread,
dsi[TwoQuadCLT.DSI_DISPARITY_AUX_LMA], // double [] spread, dsi[TwoQuadCLT.DSI_DISPARITY_AUX_LMA], // double [] spread,
...@@ -4311,6 +4326,13 @@ public class OpticalFlow { ...@@ -4311,6 +4326,13 @@ public class OpticalFlow {
sky_lim, // double sky_lim, // = 15.0; // then expand to product of strength by diff_second below this sky_lim, // double sky_lim, // = 15.0; // then expand to product of strength by diff_second below this
sky_shrink, // int sky_shrink, // = 4; sky_shrink, // int sky_shrink, // = 4;
sky_expand_extra, // int sky_expand_extra, // = 100; // 1? sky_expand_extra, // int sky_expand_extra, // = 100; // 1?
cold_scale, // = 0.2; // <=1.0. 1.0 - disables temperature dependence
cold_frac, // = 0.005; // this and lower will scale fom by cold_scale
hot_frac, // = 0.9; // this and above will scale fom by 1.0
min_strength, // = 0.08;
seed_rows, // = 5; // sky should appear in this top rows
lowest_sky_row, // = 50;// appears that low - invalid, remove completely
sky_highest_min, // = 100; // lowest absolute value should not be higher (requires photometric)
dsi[TwoQuadCLT.DSI_STRENGTH_AUX], // double [] strength, dsi[TwoQuadCLT.DSI_STRENGTH_AUX], // double [] strength,
dsi[TwoQuadCLT.DSI_SPREAD_AUX], // double [] spread, dsi[TwoQuadCLT.DSI_SPREAD_AUX], // double [] spread,
dsi[TwoQuadCLT.DSI_DISPARITY_AUX_LMA], //double [] disp_lma, dsi[TwoQuadCLT.DSI_DISPARITY_AUX_LMA], //double [] disp_lma,
......
...@@ -153,6 +153,7 @@ public class QuadCLTCPU { ...@@ -153,6 +153,7 @@ public class QuadCLTCPU {
boolean is_aux = false; boolean is_aux = false;
double [] lwir_offsets = null; // per image subtracted values double [] lwir_offsets = null; // per image subtracted values
double [] lwir_scales = null; // per image scales double [] lwir_scales = null; // per image scales
//double [] lwir_scales2 = null; // per image quadratic scales
@Deprecated @Deprecated
double lwir_offset = Double.NaN; // average of lwir_offsets[] double lwir_offset = Double.NaN; // average of lwir_offsets[]
// hot and cold are calculated during autoranging (when generating 4 images for restored (added lwir_offset) // hot and cold are calculated during autoranging (when generating 4 images for restored (added lwir_offset)
...@@ -442,6 +443,13 @@ public class QuadCLTCPU { ...@@ -442,6 +443,13 @@ public class QuadCLTCPU {
double sky_lim, // = 15.0; // then expand to product of strength by diff_second below this double sky_lim, // = 15.0; // then expand to product of strength by diff_second below this
int sky_shrink, // = 4; int sky_shrink, // = 4;
int sky_expand_extra, // = 100; // 1? int sky_expand_extra, // = 100; // 1?
double cold_scale, // = 0.2; // <=1.0. 1.0 - disables temperature dependence
double cold_frac, // = 0.005; // this and lower will scale fom by cold_scale
double hot_frac, // = 0.9; // this and above will scale fom by 1.0
double min_strength, // = 0.08;
int seed_rows, // = 5; // sky should appear in this top rows
int lowest_sky_row, // = 50;// appears that low - invalid, remove completely
double sky_highest_min, // = -50; // 100; // lowest absolute value should not be higher (requires photometric)
int width, int width,
double [] strength, double [] strength,
double [] spread, double [] spread,
...@@ -452,15 +460,16 @@ public class QuadCLTCPU { ...@@ -452,15 +460,16 @@ public class QuadCLTCPU {
return null; return null;
} }
double [] temp_scales = null; double [] temp_scales = null;
/*
double cold_scale = 0.2; // <=1.0. 1.0 - disables temperature dependence double cold_scale = 0.2; // <=1.0. 1.0 - disables temperature dependence
double cold_frac = 0.005; // this and lower will scale fom by cold_scale double cold_frac = 0.005; // this and lower will scale fom by cold_scale
double hot_frac = 0.9; // this and above will scale fom by 1.0 double hot_frac = 0.9; // this and above will scale fom by 1.0
double min_strength = 0.08; double min_strength = 0.08;
int seed_rows = 5; // sky should appear in this top rows int seed_rows = 5; // sky should appear in this top rows
*/
boolean failure = false;
int num_bins = 1000;
if (avg_val != null) { if (avg_val != null) {
int num_bins = 1000;
double min_temp = Double.NaN, max_temp=Double.NaN, avg_temp = 0; double min_temp = Double.NaN, max_temp=Double.NaN, avg_temp = 0;
int num_def = 0; int num_def = 0;
for (int i = 0; i < avg_val.length; i++) { for (int i = 0; i < avg_val.length; i++) {
...@@ -513,6 +522,10 @@ public class QuadCLTCPU { ...@@ -513,6 +522,10 @@ public class QuadCLTCPU {
break; break;
} }
} }
if (temp_cold > sky_highest_min) {
System.out.println("getBlueSky(): Coldest offset value "+temp_cold+" > "+sky_highest_min+" - invalid sky" );
failure = true;
}
temp_scales = new double[avg_val.length]; temp_scales = new double[avg_val.length];
Arrays.fill(temp_scales, Double.NaN); Arrays.fill(temp_scales, Double.NaN);
double kscale = (1.0 - cold_scale)/(temp_hot - temp_cold); double kscale = (1.0 - cold_scale)/(temp_hot - temp_cold);
...@@ -607,7 +620,16 @@ public class QuadCLTCPU { ...@@ -607,7 +620,16 @@ public class QuadCLTCPU {
"sky_selection", "sky_selection",
dbg_titles); // dsrbg_titles); dbg_titles); // dsrbg_titles);
} }
for (int i = lowest_sky_row*width; i < sky_tiles.length; i++) {
if (sky_tiles[i]) {
System.out.println("getBlueSky(): sky area appeared too low - at row "+(i/width)+" >= "+lowest_sky_row+" removing blue sky");
failure = true;
break;
}
}
if (failure) { // Will still show in debug images !!!
Arrays.fill(sky_tiles, false);
}
return sky_tiles; return sky_tiles;
} }
...@@ -625,6 +647,13 @@ public class QuadCLTCPU { ...@@ -625,6 +647,13 @@ public class QuadCLTCPU {
double sky_lim, // = 15.0; // then expand to product of strength by diff_second below this double sky_lim, // = 15.0; // then expand to product of strength by diff_second below this
int sky_shrink, // = 4; int sky_shrink, // = 4;
int sky_expand_extra, // = 100; // 1? int sky_expand_extra, // = 100; // 1?
double cold_scale, // = 0.2; // <=1.0. 1.0 - disables temperature dependence
double cold_frac, // = 0.005; // this and lower will scale fom by cold_scale
double hot_frac, // = 0.9; // this and above will scale fom by 1.0
double min_strength, // = 0.08;
int seed_rows, // = 5; // sky should appear in this top rows
int lowest_sky_row, // = 50;// appears that low - invalid, remove completely
double sky_highest_max, // = 100; // lowest absolute value should not be higher (requires photometric)
double [] strength, double [] strength,
double [] spread, double [] spread,
double [] disp_lma, double [] disp_lma,
...@@ -637,6 +666,13 @@ public class QuadCLTCPU { ...@@ -637,6 +666,13 @@ public class QuadCLTCPU {
sky_lim, // = 15.0; // then expand to product of strength by diff_second below this sky_lim, // = 15.0; // then expand to product of strength by diff_second below this
sky_shrink, // = 4; sky_shrink, // = 4;
sky_expand_extra, // = 100; // 1? sky_expand_extra, // = 100; // 1?
cold_scale, // = 0.2; // <=1.0. 1.0 - disables temperature dependence
cold_frac, // = 0.005; // this and lower will scale fom by cold_scale
hot_frac, // = 0.9; // this and above will scale fom by 1.0
min_strength, // = 0.08;
seed_rows, // = 5; // sky should appear in this top rows
lowest_sky_row, // = 50;// appears that low - invalid, remove completely
sky_highest_max, // = 100; // lowest absolute value should not be higher (requires photometric)
width, width,
strength, strength,
spread, spread,
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment