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 {
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
// 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 {
properties.setProperty(prefix+"fom_inf_bonus", this.fom_inf_bonus+"");
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+"debug_filters", this.debug_filters+"");
......@@ -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_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+"debug_filters")!=null) this.debug_filters=Boolean.parseBoolean(properties.getProperty(prefix+"debug_filters"));
......@@ -2788,7 +2809,7 @@ public class CLTParameters {
public boolean showJDialog() {
// 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.addNumericField("Nominal (rectilinear) disparity between side of square cameras (pix)", this.disparity, 3,7,"pix",
"Used when rendering 4 images");
......@@ -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("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);
gd.addTab ("Rig", "Parameters for the wide baseline rig with two quad cameras");
this.rig.dialogQuestions(gd);
......@@ -3164,16 +3185,16 @@ public class CLTParameters {
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");
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)");
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)");
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.");
gd.addMessage ("--- FOM for initial DSI ---");
gd.addMessage ("--- FOM for initial DSI (the combination of parameters that ranges corelation results) ---");
gd.addNumericField("Minimal strength", this.fom_min_strength, 4,6,"",
"Discard all weaker tiles (FOM=NEGATIVE_INFINITY).");
gd.addNumericField("Weight of residual disparity, RGB", this.fom_adisp_rgb, 4,6,"",
......@@ -3188,8 +3209,30 @@ public class CLTParameters {
"Prevent stray FG over sky - add to FOM.");
gd.addNumericField("Infinity bonus disparity range", this.fom_inf_range, 4,6,"pix",
"Infinity range to receive FOM bonus.");
gd.addMessage ("--- 3D reconstruction ---");
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.addTab ("3D", "3D reconstruction");
gd.addCheckbox ("Show generated textures", this.show_textures);
gd.addCheckbox ("show intermediate results of filtering", this.debug_filters);
......@@ -4182,6 +4225,13 @@ public class CLTParameters {
this.fom_inf_bonus= 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.debug_filters= gd.getNextBoolean();
this.min_smth= gd.getNextNumber();
......
This source diff could not be displayed because it is too large. You can view the blob instead.
......@@ -4038,12 +4038,12 @@ public class OpticalFlow {
boolean export_ml_files = clt_parameters.imp.export_ml_files;
//boolean calibrate_photometric = true;
boolean photo_en = clt_parameters.imp.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_refines = clt_parameters.imp.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_max_diff = clt_parameters.imp.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_en = clt_parameters.photo_en; // false; // perform photogrammetric calibration to equalize pixel values
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.photo_num_refines; // 3; // Calibrate, remove outliers, recalibrate, ...
double photo_min_strength = clt_parameters.photo_min_strength; // 0.0; // maybe add to filter out weak tiles
double photo_max_diff = clt_parameters.photo_max_diff; // 40.0; // To filter mismatches. Normal (adjusted) have RMSE ~9
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_images = clt_parameters.imp.show_images && !batch_mode;
......@@ -4132,11 +4132,19 @@ public class OpticalFlow {
final int debugLevelInner=clt_parameters.batch_run? -2: debugLevel; // copied from TQ
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 lma_seed= 2.0; // seed - disparity_lma limit double sky_lim = 15.0; // then expand to product of strength by diff_second below this
int sky_shrink = 6;
int sky_expand_extra = 0; // 1?
double sky_highest_min = clt_parameters.imp.sky_highest_min;
double cold_frac = clt_parameters.imp.cold_frac;
double hot_frac = clt_parameters.imp.hot_frac;
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
......@@ -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_shrink, // int sky_shrink, // = 4;
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_SPREAD_AUX], // double [] spread,
dsi[TwoQuadCLT.DSI_DISPARITY_AUX_LMA], // double [] spread,
......@@ -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_shrink, // int sky_shrink, // = 4;
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_SPREAD_AUX], // double [] spread,
dsi[TwoQuadCLT.DSI_DISPARITY_AUX_LMA], //double [] disp_lma,
......
......@@ -152,7 +152,8 @@ public class QuadCLTCPU {
boolean [][] saturation_imp = null; // (near) saturated pixels or null
boolean is_aux = false;
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
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)
......@@ -442,6 +443,13 @@ public class QuadCLTCPU {
double sky_lim, // = 15.0; // then expand to product of strength by diff_second below this
int sky_shrink, // = 4;
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,
double [] strength,
double [] spread,
......@@ -452,15 +460,16 @@ public class QuadCLTCPU {
return null;
}
double [] temp_scales = null;
/*
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 num_bins = 1000;
*/
boolean failure = false;
if (avg_val != null) {
int num_bins = 1000;
double min_temp = Double.NaN, max_temp=Double.NaN, avg_temp = 0;
int num_def = 0;
for (int i = 0; i < avg_val.length; i++) {
......@@ -513,6 +522,10 @@ public class QuadCLTCPU {
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];
Arrays.fill(temp_scales, Double.NaN);
double kscale = (1.0 - cold_scale)/(temp_hot - temp_cold);
......@@ -607,7 +620,16 @@ public class QuadCLTCPU {
"sky_selection",
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;
}
......@@ -625,6 +647,13 @@ public class QuadCLTCPU {
double sky_lim, // = 15.0; // then expand to product of strength by diff_second below this
int sky_shrink, // = 4;
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 [] spread,
double [] disp_lma,
......@@ -637,6 +666,13 @@ public class QuadCLTCPU {
sky_lim, // = 15.0; // then expand to product of strength by diff_second below this
sky_shrink, // = 4;
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,
strength,
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