Commit b36a0561 authored by Andrey Filippov's avatar Andrey Filippov

Cleaning up, debugging blue sky

parent 02a4440e
......@@ -385,6 +385,7 @@ public class CLTParameters {
public double photo_offs = 21946; // weighted average offset target value, if photo_offs_set (and not photo_offs_balance)
public boolean photo_debug = false;// Generate images and text
public boolean photo_each_debug = false;// Debug after Blue Sky
public double tex_disp_adiffo = 0.10; // 0.35; // 0.3; disparity absolute tolerance to connect in ortho directions
public double tex_disp_rdiffo = 0.08; // 0.12; // 0.1; disparity relative tolerance to connect in ortho directions
......@@ -448,6 +449,8 @@ public class CLTParameters {
public double maxZ = 20000; // maximal distance to far object
public boolean limitZ = true; // limit Z, if false - remove triangle
public double infinityDistance = 10000; // Distance to generate backdrop (0 - use regular backdrop)
public double min_from_inf = 500; // farthest non-infinity closer than infinity
public int min_bgnd_tiles = 10; // Minimal number of background tiles to generate background
public boolean gltf_emissive = false; // true; // Use emissive textures
......@@ -1487,6 +1490,7 @@ public class CLTParameters {
properties.setProperty(prefix+"photo_offs_set", this.photo_offs_set+""); // int
properties.setProperty(prefix+"photo_offs", this.photo_offs+""); // double
properties.setProperty(prefix+"photo_debug", this.photo_debug+""); // boolean
properties.setProperty(prefix+"photo_each_debug", this.photo_each_debug+""); // boolean
properties.setProperty(prefix+"tex_disp_adiffo", this.tex_disp_adiffo+""); // double
properties.setProperty(prefix+"tex_disp_rdiffo", this.tex_disp_rdiffo+""); // double
......@@ -1551,6 +1555,7 @@ public class CLTParameters {
properties.setProperty(prefix+"limitZ", this.limitZ+"");
properties.setProperty(prefix+"infinityDistance", this.infinityDistance +"");
properties.setProperty(prefix+"min_from_inf", this.min_from_inf +"");
properties.setProperty(prefix+"min_bgnd_tiles", this.min_bgnd_tiles+"");
properties.setProperty(prefix+"gltf_emissive", this.gltf_emissive+"");
......@@ -2467,6 +2472,7 @@ public class CLTParameters {
if (properties.getProperty(prefix+"photo_offs_set")!=null) this.photo_offs_set=Integer.parseInt(properties.getProperty(prefix+"photo_offs_set"));
if (properties.getProperty(prefix+"photo_offs")!=null) this.photo_offs=Double.parseDouble(properties.getProperty(prefix+"photo_offs"));
if (properties.getProperty(prefix+"photo_debug")!=null) this.photo_debug=Boolean.parseBoolean(properties.getProperty(prefix+"photo_debug"));
if (properties.getProperty(prefix+"photo_each_debug")!=null) this.photo_each_debug=Boolean.parseBoolean(properties.getProperty(prefix+"photo_each_debug"));
if (properties.getProperty(prefix+"tex_disp_adiffo")!=null) this.tex_disp_adiffo=Double.parseDouble(properties.getProperty(prefix+"tex_disp_adiffo"));
if (properties.getProperty(prefix+"tex_disp_rdiffo")!=null) this.tex_disp_rdiffo=Double.parseDouble(properties.getProperty(prefix+"tex_disp_rdiffo"));
......@@ -2530,6 +2536,7 @@ public class CLTParameters {
if (properties.getProperty(prefix+"limitZ")!=null) this.limitZ=Boolean.parseBoolean(properties.getProperty(prefix+"limitZ"));
if (properties.getProperty(prefix+"infinityDistance")!=null) this.infinityDistance=Double.parseDouble(properties.getProperty(prefix+"infinityDistance"));
if (properties.getProperty(prefix+"min_from_inf")!=null) this.min_from_inf=Double.parseDouble(properties.getProperty(prefix+"min_from_inf"));
if (properties.getProperty(prefix+"min_bgnd_tiles")!=null) this.min_bgnd_tiles=Integer.parseInt(properties.getProperty(prefix+"min_bgnd_tiles"));
if (properties.getProperty(prefix+"gltf_emissive")!=null) this.gltf_emissive=Boolean.parseBoolean(properties.getProperty(prefix+"gltf_emissive"));
......@@ -3600,7 +3607,9 @@ public class CLTParameters {
"Target weighted (by scales) average offset.");
gd.addCheckbox ("Debug photometric calibration", this.photo_debug,
"Generate debug images an text output.");
gd.addCheckbox ("Debug photometric calibration 'each'", this.photo_each_debug,
"Generate debug images after Blue Sky.");
//
gd.addTab ("3D", "3D reconstruction");
gd.addMessage ("Meshes clustering for texture generation");
gd.addNumericField("Ortho tolerance absolute", this.tex_disp_adiffo, 5,7,"pix",
......@@ -3726,6 +3735,8 @@ public class CLTParameters {
gd.addNumericField("Distance to a backdrop", this.infinityDistance,8,8,"m",
"Distance to generate backdrop (0 - use regular backdrop).");
gd.addNumericField("Minimal distance from backdrop", this.min_from_inf,8,8,"m",
"Minimal distance of the fartest object from backdrop to be resolved.");
gd.addNumericField("Minimal background tiles", this.min_bgnd_tiles, 0,4,"",
"Minimal number of background tiles to generate background.");
......@@ -4827,6 +4838,7 @@ public class CLTParameters {
this.photo_offs_set = (int) gd.getNextNumber();
this.photo_offs = gd.getNextNumber();
this.photo_debug = gd.getNextBoolean();
this.photo_each_debug = gd.getNextBoolean();
this.tex_disp_adiffo = gd.getNextNumber();
this.tex_disp_rdiffo = gd.getNextNumber();
......@@ -4891,6 +4903,7 @@ public class CLTParameters {
this.limitZ= gd.getNextBoolean();
this.infinityDistance= gd.getNextNumber();
this.min_from_inf= gd.getNextNumber();
this.min_bgnd_tiles= (int) gd.getNextNumber();
this.gltf_emissive= gd.getNextBoolean();
......
......@@ -136,28 +136,37 @@ public class IntersceneMatchParameters {
//------------
// Sky detection/filtering
public boolean sky_recalc = false; // force blue sky recalculation even if it exists
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 sky_seed = 5.0; // 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 double seed_temp = 0.5; // seed colder that this point between min and max temp
public int sky_shrink = 2;
public int seed_rows = 5; // sky should appear in this top rows
public double max_disparity = 0.3; // maximal strong sky disparity
public double max_disparity_strength = 0.2; // maximal strength of high disparity sky
public double sky_lim = 15.0; // then expand to product of strength by diff_second below this
public double lim_temp = 0.5; // sky colder that this point between min and max temp
public int sky_expand_extra = 0; // 1?
public int sky_bottleneck = 5;
public int sky_reexpand_extra = 9;// re-expand after bottleneck in addition to how it was shrank
public double min_strength = 0.08;
public int lowest_sky_row = 50; // appears that low - invalid, remove completely
public double sky_bottom_override = -300; // maximal average sky value to override lowest_sky_row test
public int sky_override_shrink = 10; // shrink detected sky before finding hottest tile there
public int sky_override_shrink = 6; // shrink detected sky before finding hottest tile there
// Increase fom if there are enough LMA-defined similar tiles around
public double disp_boost_min = 0.5;
public double disp_boost_diff = 0.35;
public int disp_boost_neibs = 2;
public double disp_boost_amount = 2.0;
public double scale_combo_strength = 0.4; // reduce strength when it comes from combo, not DSI-MAIN
public boolean save_debug_images = true; // Save blue sky debug images in model directory
// Some "AGC" to adjust how much to discard
public int margin = 1; // do not use tiles if their centers are closer to the image edge
......@@ -519,6 +528,8 @@ public class IntersceneMatchParameters {
gd.addTab("Sky","Featureless sky areas detection and filtering (LWIR only)");
gd.addMessage ("Temperature-related filtering (requires photometric calibration)");
gd.addCheckbox ("Force blue sky recalculation", this.sky_recalc,
"Recalculate blue sky even if it already exists.");
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,"",
......@@ -533,17 +544,27 @@ public class IntersceneMatchParameters {
"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("Seed maximal relative temperature", this.seed_temp, 5,7,"",
"Seed tiles should be colder than this point between min and max scene temperature.");
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("Maximal strong sky disparity", this.max_disparity, 5,7,"",
"Maximal disparity of the sky tiles if they are strong enough.");
gd.addNumericField("Strength of the high disparity sky", this.max_disparity_strength, 5,7,"",
"Required tile strenghth to be considered strong to test against maximal disparity.");
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("Sky maximal relative temperature", this.lim_temp, 5,7,"",
"Sky tiles should be colder than this point between min and max scene temperature.");
gd.addNumericField("Expand extra", this.sky_expand_extra, 0,3,"",
"Additionally expand sky area after reaching threshold in the previous step.");
gd.addNumericField("Bottleneck width", this.sky_bottleneck, 0,3,"",
"Shrink/reexpand from the seed detected sky to prevent \"leaks\" through narrow gaps in the high-contrast sky limit.");
gd.addNumericField("Re-expand extra after bottleneck", this.sky_reexpand_extra, 0,3,"",
"Additionally expand sky area after bottleneck shrink in excess of re-expanding by the same amount as shrank.");
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,"",
......@@ -562,9 +583,12 @@ public class IntersceneMatchParameters {
"Number of neighbors (of 8) to have small disparity difference to boost FOM.");
gd.addNumericField("Boost amount", this.disp_boost_amount, 5,7,"x",
"Multiply FOM by this value if number of neighbors is exactly minimal. Scale proportional to the total number of neighbors.");
gd.addNumericField("Scale if strength is combo, not main", this.scale_combo_strength, 5,7,"x",
"Reduce strength when it comes from combo, not DSI-MAIN.");
gd.addCheckbox ("Save debug images", this.save_debug_images,
"Save debug images for Blue Sky generation in model directory.");
gd.addTab ("Inter-Match", "Parameters for full-resolution scene matching");
gd.addMessage ("Interscene match parameters");
gd.addNumericField("Image margin", this.margin, 0,5,"pix",
"Do not use tiles if their centers are closer to the virtual image edge");
......@@ -924,17 +948,23 @@ public class IntersceneMatchParameters {
this.strong_strength = gd.getNextNumber();
this.weak_strength = gd.getNextNumber();
this.sky_recalc = gd.getNextBoolean();
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.lma_seed = gd.getNextNumber();
this.seed_temp = gd.getNextNumber();
this.sky_shrink = (int) gd.getNextNumber();
this.seed_rows = (int) gd.getNextNumber();
this.sky_lim = gd.getNextNumber();
this.seed_rows = (int) gd.getNextNumber();
this.max_disparity = gd.getNextNumber();
this.max_disparity_strength = gd.getNextNumber();
this.sky_lim = gd.getNextNumber();
this.lim_temp = gd.getNextNumber();
this.sky_expand_extra = (int) gd.getNextNumber();
this.sky_bottleneck = (int) gd.getNextNumber();
this.sky_reexpand_extra = (int) gd.getNextNumber();
this.min_strength = gd.getNextNumber();
this.lowest_sky_row = (int) gd.getNextNumber();
this.sky_bottom_override = gd.getNextNumber();
......@@ -944,6 +974,8 @@ public class IntersceneMatchParameters {
this.disp_boost_diff = gd.getNextNumber();
this.disp_boost_neibs = (int) gd.getNextNumber();
this.disp_boost_amount = gd.getNextNumber();
this.scale_combo_strength = gd.getNextNumber();
this.save_debug_images = gd.getNextBoolean();
this.margin = (int) gd.getNextNumber();
this.sensor_mask_inter= (int) gd.getNextNumber();
......@@ -1206,17 +1238,23 @@ public class IntersceneMatchParameters {
properties.setProperty(prefix+"strong_strength", this.strong_strength+""); // double
properties.setProperty(prefix+"weak_strength", this.weak_strength+""); // double
properties.setProperty(prefix+"sky_recalc", this.sky_recalc+""); // boolean
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+"seed_temp", this.seed_temp+""); // double
properties.setProperty(prefix+"sky_shrink", this.sky_shrink+""); // int
properties.setProperty(prefix+"seed_rows", this.seed_rows+""); // int
properties.setProperty(prefix+"max_disparity", this.max_disparity+""); // double
properties.setProperty(prefix+"max_disparity_strength",this.max_disparity_strength+"");// double
properties.setProperty(prefix+"sky_lim", this.sky_lim+""); // double
properties.setProperty(prefix+"lim_temp", this.lim_temp+""); // double
properties.setProperty(prefix+"sky_expand_extra", this.sky_expand_extra+""); // int
properties.setProperty(prefix+"sky_bottleneck", this.sky_bottleneck+""); // int
properties.setProperty(prefix+"sky_reexpand_extra", this.sky_reexpand_extra+""); // int
properties.setProperty(prefix+"min_strength", this.min_strength+""); // double
properties.setProperty(prefix+"lowest_sky_row", this.lowest_sky_row+""); // int
properties.setProperty(prefix+"sky_bottom_override", this.sky_bottom_override+""); // double
......@@ -1226,6 +1264,8 @@ public class IntersceneMatchParameters {
properties.setProperty(prefix+"disp_boost_diff", this.disp_boost_diff+""); // int
properties.setProperty(prefix+"disp_boost_neibs", this.disp_boost_neibs+""); // double
properties.setProperty(prefix+"disp_boost_amount", this.disp_boost_amount+""); // double
properties.setProperty(prefix+"scale_combo_strength", this.scale_combo_strength+""); // double
properties.setProperty(prefix+"save_debug_images", this.save_debug_images+""); // boolean
properties.setProperty(prefix+"margin", this.margin+""); // int
properties.setProperty(prefix+"sensor_mask_inter", this.sensor_mask_inter+""); // int
......@@ -1441,17 +1481,25 @@ public class IntersceneMatchParameters {
if (properties.getProperty(prefix+"strong_strength")!=null) this.strong_strength=Double.parseDouble(properties.getProperty(prefix+"strong_strength"));
if (properties.getProperty(prefix+"weak_strength")!=null) this.weak_strength=Double.parseDouble(properties.getProperty(prefix+"weak_strength"));
if (properties.getProperty(prefix+"sky_recalc")!=null) this.sky_recalc=Boolean.parseBoolean(properties.getProperty(prefix+"sky_recalc"));
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+"seed_temp")!=null) this.seed_temp=Double.parseDouble(properties.getProperty(prefix+"seed_temp"));
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+"max_disparity")!=null) this.max_disparity=Double.parseDouble(properties.getProperty(prefix+"max_disparity"));
if (properties.getProperty(prefix+"max_disparity_strength")!=null)this.max_disparity_strength=Double.parseDouble(properties.getProperty(prefix+"max_disparity_strength"));
if (properties.getProperty(prefix+"sky_lim")!=null) this.sky_lim=Double.parseDouble(properties.getProperty(prefix+"sky_lim"));
if (properties.getProperty(prefix+"lim_temp")!=null) this.lim_temp=Double.parseDouble(properties.getProperty(prefix+"lim_temp"));
if (properties.getProperty(prefix+"sky_expand_extra")!=null) this.sky_expand_extra=Integer.parseInt(properties.getProperty(prefix+"sky_expand_extra"));
if (properties.getProperty(prefix+"sky_bottleneck")!=null) this.sky_bottleneck=Integer.parseInt(properties.getProperty(prefix+"sky_bottleneck"));
if (properties.getProperty(prefix+"sky_reexpand_extra")!=null) this.sky_reexpand_extra=Integer.parseInt(properties.getProperty(prefix+"sky_reexpand_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"));
if (properties.getProperty(prefix+"sky_bottom_override")!=null) this.sky_bottom_override=Double.parseDouble(properties.getProperty(prefix+"sky_bottom_override"));
......@@ -1461,6 +1509,8 @@ public class IntersceneMatchParameters {
if (properties.getProperty(prefix+"disp_boost_diff")!=null) this.disp_boost_diff=Double.parseDouble(properties.getProperty(prefix+"disp_boost_diff"));
if (properties.getProperty(prefix+"disp_boost_neibs")!=null) this.disp_boost_neibs=Integer.parseInt(properties.getProperty(prefix+"disp_boost_neibs"));
if (properties.getProperty(prefix+"disp_boost_amount")!=null) this.disp_boost_amount=Double.parseDouble(properties.getProperty(prefix+"disp_boost_amount"));
if (properties.getProperty(prefix+"scale_combo_strength")!=null) this.scale_combo_strength=Double.parseDouble(properties.getProperty(prefix+"scale_combo_strength"));
if (properties.getProperty(prefix+"save_debug_images")!=null) this.save_debug_images=Boolean.parseBoolean(properties.getProperty(prefix+"save_debug_images"));
if (properties.getProperty(prefix+"margin")!=null) this.margin=Integer.parseInt(properties.getProperty(prefix+"margin"));
if (properties.getProperty(prefix+"sensor_mask_inter")!=null) this.sensor_mask_inter=Integer.parseInt(properties.getProperty(prefix+"sensor_mask_inter"));
......@@ -1694,17 +1744,23 @@ public class IntersceneMatchParameters {
imp.strong_strength = this.strong_strength;
imp.weak_strength = this.weak_strength;
imp.sky_recalc = this.sky_recalc;
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.seed_temp = this.seed_temp;
imp.sky_shrink = this.sky_shrink;
imp.seed_rows = this.seed_rows;
imp.max_disparity = this.max_disparity;
imp.max_disparity_strength= this.max_disparity_strength;
imp.sky_lim = this.sky_lim;
imp.lim_temp = this.lim_temp;
imp.sky_expand_extra = this.sky_expand_extra;
imp.sky_bottleneck = this.sky_bottleneck;
imp.sky_reexpand_extra = this.sky_reexpand_extra;
imp.min_strength = this.min_strength;
imp.lowest_sky_row = this.lowest_sky_row;
imp.sky_bottom_override = this.sky_bottom_override;
......@@ -1714,6 +1770,8 @@ public class IntersceneMatchParameters {
imp.disp_boost_diff = this.disp_boost_diff;
imp.disp_boost_neibs = this.disp_boost_neibs;
imp.disp_boost_amount = this.disp_boost_amount;
imp.scale_combo_strength = this.scale_combo_strength;
imp.save_debug_images = this.save_debug_images;
imp.margin = this.margin;
imp.sensor_mask_inter = this.sensor_mask_inter;
......
......@@ -3751,8 +3751,8 @@ public class OpticalFlow {
ds_photo[OpticalFlow.COMBO_DSN_INDX_STRENGTH] = dsi[TwoQuadCLT.DSI_STRENGTH_AUX];
ds_photo[OpticalFlow.COMBO_DSN_INDX_BLUE_SKY] = dsi[TwoQuadCLT.DSI_BLUE_SKY_AUX];
boolean photo_each_debug = !batch_mode; // false; // true; // false;
boolean photo_each_debug2 = !batch_mode; // false; // true; // false;
boolean photo_each_debug = !batch_mode && clt_parameters.photo_each_debug; // false; // true; // false;
boolean photo_each_debug2 = !batch_mode && clt_parameters.photo_each_debug; // false; // true; // false;
for (int nrecalib = 0; nrecalib < photo_num_full; nrecalib++) { // maybe need to correct just offsets?
int poly_order = photo_order;
......@@ -3899,10 +3899,15 @@ public class OpticalFlow {
double cold_scale = clt_parameters.imp.cold_scale;
double sky_seed = clt_parameters.imp.sky_seed;
double lma_seed = clt_parameters.imp.lma_seed;
double seed_temp = clt_parameters.imp.seed_temp;
int sky_shrink = clt_parameters.imp.sky_shrink;
int sky_bottleneck = clt_parameters.imp.sky_bottleneck;
int sky_reexpand_extra = clt_parameters.imp.sky_reexpand_extra;
int seed_rows = clt_parameters.imp.seed_rows;
double max_disparity = clt_parameters.imp.max_disparity;
double max_disparity_strength=clt_parameters.imp.max_disparity_strength;
double sky_lim = clt_parameters.imp.sky_lim;
double lim_temp = clt_parameters.imp.lim_temp;
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;
......@@ -3912,6 +3917,8 @@ public class OpticalFlow {
double disp_boost_diff = clt_parameters.imp.disp_boost_diff; // 0.35;
int disp_boost_neibs = clt_parameters.imp.disp_boost_neibs; // 2;
double disp_boost_amount = clt_parameters.imp.disp_boost_amount; // 2.0;
QuadCLT dbg_scene = clt_parameters.imp.save_debug_images? quadCLT_ref: null; // use to save debug images if not null
boolean [] ref_blue_sky = null; // turn off "lma" in the ML output
quadCLT_ref.preExpandCLTQuad3d( // returns ImagePlus, but it already should be saved/shown
clt_parameters,
......@@ -3980,13 +3987,18 @@ public class OpticalFlow {
System.out.println("(Re)using photometric calibration from this sequence reference "+quadCLT_ref.getPhotometricScene());
quadCLT_ref.setQuadClt(); // just in case ?
}
quadCLT_ref.setBlueSky (
quadCLT_ref.setBlueSky ( // initial BS from single scene
max_disparity,
max_disparity_strength,
sky_seed, // double sky_seed, // = 7.0; // start with product of strength by diff_second below this
lma_seed,
seed_temp, //double seed_temp, // 0.5; // seed colder that this point between min and max temp
sky_lim, // double sky_lim, // = 15.0; // then expand to product of strength by diff_second below this
lim_temp, // double lim_temp, // 0.5; // sky colder that this point between min and max temp
sky_shrink, // int sky_shrink, // = 4;
sky_expand_extra, // int sky_expand_extra, // = 100; // 1?
sky_bottleneck, //int sky_bottleneck, //
sky_reexpand_extra, //int sky_reexpand_extra, // 9; re-expand after bottleneck in addition to how it was shrank
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
......@@ -4004,6 +4016,7 @@ public class OpticalFlow {
dsi[TwoQuadCLT.DSI_SPREAD_AUX], // double [] spread,
dsi[TwoQuadCLT.DSI_DISPARITY_AUX_LMA], // double [] spread,
dsi[TwoQuadCLT.DSI_AVGVAL_AUX],// double [] avg_val,
dbg_scene, // QuadCLT dbg_scene, // use to save debug images if not null
batch_mode? -1: 1); /// debugLevel); // int debugLevel)
if (ran_photo_each) {
// quadCLT_ref.setBlueSky(null); // Reset blue sky - is it needed?
......@@ -4067,16 +4080,23 @@ public class OpticalFlow {
final int debugLevel) {
boolean photo_each = clt_parameters.photo_each; // true; // perform photogrammetric calibration to equalize pixel values
boolean photo_to_main= clt_parameters.photo_to_main; // maybe it will not be needed, it will apply this calibration to the next scene sequence
boolean sky_recalc = clt_parameters.imp.sky_recalc; // force blue sky recalculation even if it exists
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;
double seed_temp = clt_parameters.imp.seed_temp;
int sky_shrink = clt_parameters.imp.sky_shrink;
int sky_bottleneck = clt_parameters.imp.sky_bottleneck;
int sky_reexpand_extra = clt_parameters.imp.sky_reexpand_extra;
int seed_rows = clt_parameters.imp.seed_rows;
double max_disparity = clt_parameters.imp.max_disparity;
double max_disparity_strength=clt_parameters.imp.max_disparity_strength;
double sky_lim = clt_parameters.imp.sky_lim;
double lim_temp = clt_parameters.imp.lim_temp;
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;
......@@ -4086,7 +4106,8 @@ public class OpticalFlow {
double disp_boost_diff = clt_parameters.imp.disp_boost_diff; // 0.35;
int disp_boost_neibs = clt_parameters.imp.disp_boost_neibs; // 2;
double disp_boost_amount = clt_parameters.imp.disp_boost_amount; // 2.0;
double scale_combo_strength =clt_parameters.imp.scale_combo_strength; //0.4; // reduce strength when it comes from combo, not DSI-MAIN
QuadCLT dbg_scene = clt_parameters.imp.save_debug_images? quadCLT_ref: null; // use to save debug images if not null
// if (build_ref_dsi) {
// need to read photometric from reference scene -INTERFRAME.corr-xml, and if it exists - set and propagate to main?
if (photo_each && !quadCLT_ref.isPhotometricThis()) {
......@@ -4108,22 +4129,55 @@ public class OpticalFlow {
// read DSI_MAIN
double [][] dsi = quadCLT_ref.readDsiMain();
quadCLT_ref.setDSI(dsi); // was not here! (11/26/2022)
double [][] combo_dsi = null;
if (dsi[TwoQuadCLT.DSI_SPREAD_AUX] == null) {
System.out.println("DSI_MAIN file has old format and does not have spread data, will recalculate.");
} else {
// boolean [] ref_blue_sky = quadCLT_ref.getBlueSky();
// boolean used_combo = false;
if ((dsi[TwoQuadCLT.DSI_BLUE_SKY_AUX] == null) || sky_recalc) { //
// Sets quadCLT_ref.dsi and blue sky (if exists)
combo_dsi = quadCLT_ref.restoreComboDSI(true); // result is full length, missing slices are null
if (combo_dsi != null) {
dsi[TwoQuadCLT.DSI_STRENGTH_AUX] = combo_dsi[COMBO_DSN_INDX_STRENGTH]; // double [] strength,
dsi[TwoQuadCLT.DSI_DISPARITY_AUX_LMA]= combo_dsi[COMBO_DSN_INDX_LMA]; //double [] disp_lma,
dsi[TwoQuadCLT.DSI_BLUE_SKY_AUX] = combo_dsi[COMBO_DSN_INDX_BLUE_SKY]; // if exist, already set to quadCLT_ref.dsi
// used_combo = true;
}
/*
if (quadCLT_ref.restoreInterDSI(true) > 0) {
double [][] combo_dsi = quadCLT_ref.dsi;
dsi[TwoQuadCLT.DSI_STRENGTH_AUX] = combo_dsi[COMBO_DSN_INDX_STRENGTH]; // double [] strength,
dsi[TwoQuadCLT.DSI_DISPARITY_AUX_LMA]= combo_dsi[COMBO_DSN_INDX_LMA]; //double [] disp_lma,
dsi[TwoQuadCLT.DSI_BLUE_SKY_AUX] = combo_dsi[COMBO_DSN_INDX_BLUE_SKY];
used_combo = true;
}
*/
}
double [] ref_blue_sky = dsi[TwoQuadCLT.DSI_BLUE_SKY_AUX];
if (ref_blue_sky == null) {
if ((ref_blue_sky == null) || sky_recalc) {
if (debugLevel > -3) {
System.out.println("Blue Sky does not exist calculating and updating photometrics");
System.out.println("Blue Sky does not exist or recalculation is forced. Calculating and updating photometrics");
}
double [] bs_strength = dsi[TwoQuadCLT.DSI_STRENGTH_AUX].clone();
// try getting combo dsi
if ((combo_dsi != null) && (scale_combo_strength != 1.0) && dsi[TwoQuadCLT.DSI_STRENGTH_AUX]!= null) {
for (int i = 0; i < dsi[TwoQuadCLT.DSI_STRENGTH_AUX].length; i++) {
bs_strength[i] *= scale_combo_strength;
}
//scale_combo_strength
}
quadCLT_ref.setBlueSky (
max_disparity,
max_disparity_strength,
sky_seed, // double sky_seed, // = 7.0; // start with product of strength by diff_second below this
lma_seed, // 2.0; // seed - disparity_lma limit
seed_temp, //double seed_temp, // 0.5; // seed colder that this point between min and max temp
sky_lim, // double sky_lim, // = 15.0; // then expand to product of strength by diff_second below this
lim_temp, // double lim_temp, // 0.5; // sky colder that this point between min and max temp
sky_shrink, // int sky_shrink, // = 4;
sky_expand_extra, // int sky_expand_extra, // = 100; // 1?
sky_bottleneck, //int sky_bottleneck, //
sky_reexpand_extra, //int sky_reexpand_extra, // 9; re-expand after bottleneck in addition to how it was shrank
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
......@@ -4137,24 +4191,33 @@ public class OpticalFlow {
disp_boost_diff, //double disp_boost_diff, // = 0.35;
disp_boost_neibs, //int disp_boost_neibs, // = 2;
disp_boost_amount, //double disp_boost_amount, // = 2.0;
dsi[TwoQuadCLT.DSI_STRENGTH_AUX], // double [] strength,
bs_strength, // dsi[TwoQuadCLT.DSI_STRENGTH_AUX], // double [] strength,
dsi[TwoQuadCLT.DSI_SPREAD_AUX], // double [] spread,
dsi[TwoQuadCLT.DSI_DISPARITY_AUX_LMA], //double [] disp_lma,
dsi[TwoQuadCLT.DSI_AVGVAL_AUX],// double [] avg_val,
dbg_scene, // QuadCLT dbg_scene, // use to save debug images if not null
debugLevel); // int debugLevel)
if (debugLevel > -3) {
System.out.println("Calculated missing Blue Sky in "+quadCLT_ref.getImageName()+
", re-running photoEach()");
}
/*
boolean [] blue_sky = quadCLT_ref.getBlueSky();
if (dsi[TwoQuadCLT.DSI_BLUE_SKY_AUX] == null) {
dsi[TwoQuadCLT.DSI_BLUE_SKY_AUX] = new double [blue_sky.length];
}
for (int i = 0; i < blue_sky.length; i++) {
dsi[TwoQuadCLT.DSI_BLUE_SKY_AUX][i] = blue_sky[i]? 1.0:0.0;
}
*/
// save inter-lma if available
if (combo_dsi != null) {
if (debugLevel > -3) {
System.out.println("Updating Blue Sky for scene "+quadCLT_ref.getImageName());
}
String rslt_suffix = QuadCLTCPU.DSI_SUFFIXES[clt_parameters.correlate_lma?
QuadCLTCPU.INDEX_INTER_LMA:QuadCLTCPU.INDEX_INTER];
// combo_dsi read from file always has all slices, missing are null
combo_dsi[COMBO_DSN_INDX_BLUE_SKY] = quadCLT_ref.dsi[TwoQuadCLT.DSI_BLUE_SKY_AUX];
quadCLT_ref.saveDoubleArrayInModelDirectory(
rslt_suffix, // String suffix,
OpticalFlow.COMBO_DSN_TITLES, // null, // String [] labels, // or null
combo_dsi, // dbg_data, // double [][] data,
quadCLT_ref.tp.getTilesX(), // tilesX, // int width,
quadCLT_ref.tp.getTilesY()); // int height)
}
photoEach(
clt_parameters, // CLTParameters clt_parameters,
colorProcParameters, // ColorProcParameters colorProcParameters,
......@@ -4167,11 +4230,12 @@ public class OpticalFlow {
threadsMax, // final int threadsMax, // int threadsMax,
updateStatus, // final boolean updateStatus,
debugLevel); // final int debugLevel)
} else {
if (debugLevel > -3) {
System.out.println("Blue Sky is available, reusing it, no need for updating photometrics");
}
} else {
if (debugLevel > -3) {
System.out.println("Blue Sky is available, reusing it, no need for updating photometrics");
}
quadCLT_ref.setBlueSky(ref_blue_sky); // fixing old case where DSI-MAIN did not have bs while combo - did
}
}
}
......@@ -4820,10 +4884,11 @@ public class OpticalFlow {
System.out.println("**** Running photometric equalization *****");
}
if (combo_dsn_final == null) { // always re-read?
combo_dsn_final =quadCLTs[ref_index].readDoubleArrayFromModelDirectory( // always re-read?
"-INTER-INTRA-LMA", // String suffix,
0, // int num_slices, // (0 - all)
null); // int [] wh);
/// combo_dsn_final =quadCLTs[ref_index].readDoubleArrayFromModelDirectory( // always re-read?
/// "-INTER-INTRA-LMA", // String suffix,
/// 0, // int num_slices, // (0 - all)
/// null); // int [] wh);
combo_dsn_final =quadCLTs[ref_index].restoreComboDSI(true); // also sets quadCLTs[ref_index].dsi and blue sky
}
double [][] combo_dsn_final_filtered =
......@@ -4890,10 +4955,12 @@ public class OpticalFlow {
disparity_raw = new double [tilesX * tilesY];
Arrays.fill(disparity_raw,clt_parameters.disparity);
if (combo_dsn_final == null) {
combo_dsn_final = quadCLTs[ref_index].readDoubleArrayFromModelDirectory(
"-INTER-INTRA-LMA", // String suffix,
0, // int num_slices, // (0 - all)
null); // int [] wh);
/// combo_dsn_final = quadCLTs[ref_index].readDoubleArrayFromModelDirectory(
/// "-INTER-INTRA-LMA", // String suffix,
/// 0, // int num_slices, // (0 - all)
/// null); // int [] wh);
combo_dsn_final =quadCLTs[ref_index].restoreComboDSI(true); // also sets quadCLTs[ref_index].dsi and blue sky
}
double [][] dls = {
combo_dsn_final[COMBO_DSN_INDX_DISP],
......@@ -5346,10 +5413,12 @@ public class OpticalFlow {
if (export_images) {
if (combo_dsn_final == null) {
combo_dsn_final = quadCLTs[ref_index].readDoubleArrayFromModelDirectory(
"-INTER-INTRA-LMA", // String suffix,
0, // int num_slices, // (0 - all)
null); // int [] wh);
/// combo_dsn_final = quadCLTs[ref_index].readDoubleArrayFromModelDirectory(
/// "-INTER-INTRA-LMA", // String suffix,
/// 0, // int num_slices, // (0 - all)
/// null); // int [] wh);
combo_dsn_final =quadCLTs[ref_index].restoreComboDSI(true); // also sets quadCLTs[ref_index].dsi and blue sky
}
double [][] dls = {
combo_dsn_final[COMBO_DSN_INDX_DISP],
......@@ -5586,10 +5655,12 @@ public class OpticalFlow {
if (export_dsi_image || show_dsi_image) {
if (combo_dsn_final == null) {
combo_dsn_final =quadCLTs[ref_index].readDoubleArrayFromModelDirectory(
"-INTER-INTRA-LMA", // String suffix,
0, // int num_slices, // (0 - all)
null); // int [] wh);
/// combo_dsn_final =quadCLTs[ref_index].readDoubleArrayFromModelDirectory(
/// "-INTER-INTRA-LMA", // String suffix,
/// 0, // int num_slices, // (0 - all)
/// null); // int [] wh);
combo_dsn_final =quadCLTs[ref_index].restoreComboDSI(true); // also sets quadCLTs[ref_index].dsi and blue sky
}
// re-load , should create quadCLTs[ref_index].dsi
......@@ -5636,10 +5707,12 @@ public class OpticalFlow {
if (export_ml_files) {
if (combo_dsn_final == null) { // always re-read?
combo_dsn_final =quadCLTs[ref_index].readDoubleArrayFromModelDirectory( // always re-read?
"-INTER-INTRA-LMA", // String suffix,
0, // int num_slices, // (0 - all)
null); // int [] wh);
/// combo_dsn_final =quadCLTs[ref_index].readDoubleArrayFromModelDirectory( // always re-read?
/// "-INTER-INTRA-LMA", // String suffix,
/// 0, // int num_slices, // (0 - all)
/// null); // int [] wh);
combo_dsn_final =quadCLTs[ref_index].restoreComboDSI(true); // also sets quadCLTs[ref_index].dsi and blue sky
}
double [][] combo_dsn_final_filtered =
conditionComboDsnFinal(
......@@ -5694,10 +5767,12 @@ public class OpticalFlow {
int tilesY = quadCLTs[ref_index].getTileProcessor().getTilesY();
double [] disparity_raw = new double [tilesX * tilesY];
Arrays.fill(disparity_raw,clt_parameters.disparity);
double [][] combo_dsn_final = quadCLTs[ref_index].readDoubleArrayFromModelDirectory(
"-INTER-INTRA-LMA", // String suffix,
0, // int num_slices, // (0 - all)
null); // int [] wh);
/// double [][] combo_dsn_final = quadCLTs[ref_index].readDoubleArrayFromModelDirectory(
/// "-INTER-INTRA-LMA", // String suffix,
/// 0, // int num_slices, // (0 - all)
/// null); // int [] wh);
double [][] combo_dsn_final =quadCLTs[ref_index].restoreComboDSI(true); // also sets quadCLTs[ref_index].dsi and blue sky
double [][] dls = {
combo_dsn_final[COMBO_DSN_INDX_DISP],
combo_dsn_final[COMBO_DSN_INDX_LMA],
......@@ -7342,6 +7417,10 @@ public class OpticalFlow {
"-DSI_INTER",
true // silent
) >=0 ) {
/// if (ref_scene.restoreInterDSI( // if there is already calculated with interscene - us it
/// true // silent
/// ) >=0 ) {
System.out.println("IntersceneAccumulate(): Using previously calculated interscene DSI (*-DSI_INTER) as initial DSI");
combo_dsn[0] = ref_scene.dsi[ref_scene.is_aux?TwoQuadCLT.DSI_DISPARITY_AUX:TwoQuadCLT.DSI_DISPARITY_MAIN];
combo_dsn[1] = ref_scene.dsi[ref_scene.is_aux?TwoQuadCLT.DSI_STRENGTH_AUX:TwoQuadCLT.DSI_STRENGTH_MAIN];
......@@ -7720,10 +7799,13 @@ public class OpticalFlow {
double [][] combo_dsn = null;
// USE reference scene if no individual DSI are available double [][] dsrbg = scene.getDSRBG(); Probably null for non-reference
// make sure to use already integrated if available
double [][] combo_dsn0 = scenes[indx_ref].readDoubleArrayFromModelDirectory(
"-INTER-INTRA-LMA", // String suffix,
0, // int num_slices, // (0 - all)
null); // int [] wh);
/// double [][] combo_dsn0 = scenes[indx_ref].readDoubleArrayFromModelDirectory(
/// "-INTER-INTRA-LMA", // String suffix,
/// 0, // int num_slices, // (0 - all)
/// null); // int [] wh);
double [][] combo_dsn0 =scenes[indx_ref].readComboDSI(true); // scenes[indx_ref].dsi and blue sky are NOT updated
if (combo_dsn0 == null) {
combo_dsn0 = prepareInitialComboDS( // 3
clt_parameters, // final CLTParameters clt_parameters,
......@@ -7731,6 +7813,13 @@ public class OpticalFlow {
indx_ref, // final int indx_ref,
debug_level-2); // final int debug_level);
} else {
// set blue sky from read from file ONLY if no BS was calculated for this instance
if ((combo_dsn0[COMBO_DSN_INDX_BLUE_SKY] != null) && !scenes[indx_ref].hasBlueSky()) {
if (debug_level > -2) {
System.out.println("There was no calculated Blue Sky, but a file had it. Will use the loaded one");
scenes[indx_ref].setBlueSky(combo_dsn0[COMBO_DSN_INDX_BLUE_SKY]);
}
}
combo_dsn0 = conditionComboDsnFinal(
true, // boolean use_conf, // use configuration parameters, false - use following
clt_parameters, // CLTParameters clt_parameters,
......@@ -12256,10 +12345,12 @@ public class OpticalFlow {
int tilesY = quadCLTs[ref_index].getTileProcessor().getTilesY();
double [] disparity_raw = new double [tilesX * tilesY];
Arrays.fill(disparity_raw,clt_parameters.disparity);
double [][] combo_dsn_final = quadCLTs[ref_index].readDoubleArrayFromModelDirectory(
"-INTER-INTRA-LMA", // String suffix,
0, // int num_slices, // (0 - all)
null); // int [] wh);
/// double [][] combo_dsn_final = quadCLTs[ref_index].readDoubleArrayFromModelDirectory(
/// "-INTER-INTRA-LMA", // String suffix,
/// 0, // int num_slices, // (0 - all)
/// null); // int [] wh);
double [][] combo_dsn_final = quadCLTs[ref_index].restoreComboDSI(true); // also sets quadCLTs[ref_index].dsi and blue sky
double [][] dls = {
combo_dsn_final[COMBO_DSN_INDX_DISP],
combo_dsn_final[COMBO_DSN_INDX_LMA],
......
......@@ -86,8 +86,8 @@ import loci.formats.FormatException;
public class QuadCLTCPU {
public static final String [] DSI_SUFFIXES = {"-INTER-INTRA-LMA","-INTER-INTRA","-DSI_MAIN"};
public static int INDEX_INTER = 0;
public static int INDEX_INTER_LMA = 1;
public static int INDEX_INTER_LMA = 0;
public static int INDEX_INTER = 1;
public static int INDEX_DSI_MAIN = 2;
public static final String [] FGBG_TITLES_ADJ = {"disparity","strength"};
// public static final String [] FGBG_TITLES = {"disparity","strength", "rms","rms-split","fg-disp","fg-str","bg-disp","bg-str"};
......@@ -424,6 +424,8 @@ public class QuadCLTCPU {
* Expansion by 1 is horizontal/vertical only, by 2 includes diagonals,
* and so on.
*
* @param max_disparity maximal disparity for the sky area
* @param max_disparity_strength maximal strength of the too high disparity to count
* @param sky_seed minimal value of strength*spread to seed sky areas
* @param disparity_seed maximal disparity to seed sky areas (not needed for expand)
* @param sky_lim maximal value of strength*spread over which sky area will
......@@ -441,12 +443,17 @@ public class QuadCLTCPU {
* @return boolean 1d array of the pixels belonging to the blue sky.
*/
public static boolean [] getBlueSky (
double max_disparity,
double max_disparity_strength,
double sky_seed, // = 7.0; // start with product of strength by diff_second below this
double disparity_seed, // 2.0; // seed - disparity_lma limit
double seed_temp, // 0.5; // seed colder that this point between min and max temp
double sky_lim, // = 15.0; // then expand to product of strength by diff_second below this
double lim_temp, // 0.5; // sky colder that this point between min and max temp
int sky_shrink, // = 4;
int sky_expand_extra, // = 100; // 1?
int sky_bottleneck, //
int sky_reexpand_extra, // 9; re-expand after bottleneck in addition to how it was shrank
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
......@@ -467,7 +474,7 @@ public class QuadCLTCPU {
double [] spread,
double [] disparity,
double [] avg_val,
QuadCLT scene, // use to save debug images if not null
int debugLevel) { // >0 to show
if ((strength == null) || (spread==null)) {
return null;
......@@ -559,9 +566,9 @@ public class QuadCLTCPU {
String [] dbg_in_titles = {"fom", "strength", "spread", "disparity", "avg_val", "tscale"};
String [] dbg_titles = {"sky", "seed", "max", "shrank","full_shrank","neck_shrank","reexpand"};
String [] dbg_titles = {"sky", "seed", "max", "expanded", "shrank","temp_shrank","neck_shrank","reexpand"};
double [][] dbg_img = (debugLevel>0) ? new double [dbg_titles.length][strength.length]:null;
double [][] dbg_img = ((debugLevel>0) || (scene != null))? new double [dbg_titles.length][strength.length]:null;
TileNeibs tn = new TileNeibs(width,strength.length/width);
boolean [] sky_tiles = new boolean [strength.length];
......@@ -600,14 +607,27 @@ public class QuadCLTCPU {
dbg_in_titles); // dsrbg_titles);
}
if (scene != null) {
scene.saveDoubleArrayInModelDirectory(
scene.getImageName() + "-sky_input",
dbg_in_titles, // String [] labels, // or null
new double[][] {fom, strength, spread, disparity, avg_val, temp_scales}, // double [][] data,
width, // int width,
fom.length/width); // int height)
}
double max_temp_seed = temp_cold * (1.0 - seed_temp) + temp_hot * seed_temp;
double max_temp_lim = temp_cold * (1.0 - lim_temp) + temp_hot * lim_temp;
for (int i = 0; i < sky_tiles.length; i++) {
prohibit_tiles[i] = (fom[i] >= sky_lim);
sky_tiles[i] = (fom[i] < sky_seed) && !(disparity[i] > disparity_seed);
prohibit_tiles[i] = (fom[i] >= sky_lim) ||
((strength[i] >= max_disparity_strength) && (disparity[i] >= max_disparity)) ||
(avg_val[i] >= max_temp_lim);
sky_tiles[i] = (fom[i] < sky_seed) &&
!(disparity[i] > disparity_seed) &&
!prohibit_tiles[i] &&
(avg_val[i] < max_temp_seed);
}
//seed_rows
if (dbg_img != null) {
for (int i = 0; i < sky_tiles.length; i++) {
......@@ -616,7 +636,7 @@ public class QuadCLTCPU {
}
}
tn.shrinkSelection(
sky_shrink, // int shrink, // grow tile selection by 1 over non-background tiles 1: 4 directions, 2 - 8 directions, 3 - 8 by 1, 4 by 1 more
sky_shrink, // int shrink,
sky_tiles, // boolean [] tiles,
null); // boolean [] prohibit)
if (seed_rows > 0) {
......@@ -625,7 +645,7 @@ public class QuadCLTCPU {
boolean [] seed_sky = sky_tiles.clone();
if (dbg_img != null) {
for (int i = 0; i < sky_tiles.length; i++) {
dbg_img[3][i] = sky_tiles[i]? 1 : 0;
dbg_img[4][i] = sky_tiles[i]? 1 : 0;
}
}
......@@ -641,6 +661,12 @@ public class QuadCLTCPU {
sky_tiles, // boolean [] tiles,
null); // boolean [] prohibit)
}
if (dbg_img != null) {
for (int i = 0; i < sky_tiles.length; i++) {
dbg_img[3][i] = sky_tiles[i]? 1 : 0;
}
}
//shrink_neck
// Remove leaks through small holes
if (sky_bottleneck > 0) {
......@@ -654,17 +680,17 @@ public class QuadCLTCPU {
}
sky_tiles = seed_sky.clone();
tn.growSelection(
4*width , // int shrink, // grow tile selection by 1 over non-background tiles 1: 4 directions, 2 - 8 directions, 3 - 8 by 1, 4 by 1 more
sky_tiles, // boolean [] tiles,
prohibit_neck); // boolean [] prohibit)
4*width , // int shrink,
sky_tiles, // boolean [] tiles,
prohibit_neck); // boolean [] prohibit)
tn.growSelection(
sky_bottleneck , // int shrink, // grow tile selection by 1 over non-background tiles 1: 4 directions, 2 - 8 directions, 3 - 8 by 1, 4 by 1 more
sky_tiles, // boolean [] tiles,
sky_bottleneck + sky_reexpand_extra , // int shrink,
sky_tiles, // boolean [] tiles,
prohibit_tiles); // boolean [] prohibit)
if (dbg_img != null) {
for (int i = 0; i < sky_tiles.length; i++) {
dbg_img[5][i] = prohibit_neck[i]? 0 : 1;
dbg_img[6][i] = sky_tiles[i]? 1 : 0;
dbg_img[6][i] = prohibit_neck[i]? 0 : 1;
dbg_img[7][i] = sky_tiles[i]? 1 : 0;
}
}
......@@ -686,7 +712,7 @@ public class QuadCLTCPU {
}
if (dbg_img != null) {
for (int i = 0; i < sky_tiles.length; i++) {
dbg_img[4][i] = shrank_sky[i]? 1 : 0;
dbg_img[5][i] = shrank_sky[i]? 1 : 0;
}
}
}
......@@ -695,13 +721,23 @@ public class QuadCLTCPU {
for (int i = 0; i < sky_tiles.length; i++) {
dbg_img[0][i] = sky_tiles[i]? 1 : 0;
}
ShowDoubleFloatArrays.showArrays(
dbg_img,
width,
sky_tiles.length/width,
true,
"sky_selection",
dbg_titles); // dsrbg_titles);
if (debugLevel>0) {
ShowDoubleFloatArrays.showArrays(
dbg_img,
width,
sky_tiles.length/width,
true,
"sky_selection",
dbg_titles); // dsrbg_titles);
}
if (scene != null) {
scene.saveDoubleArrayInModelDirectory(
scene.getImageName() + "-sky_selection",
dbg_titles, // String [] labels, // or null
dbg_img, // double [][] data,
width, // int width,
fom.length/width); // int height)
}
}
......@@ -722,10 +758,7 @@ public class QuadCLTCPU {
}
return sky_tiles;
}
// @Deprecated
// public boolean [] getBlueSky () {
// return this.blue_sky;
// }
public double [] getDoubleBlueSky() {
if (this.dsi == null) {
return null;
......@@ -770,12 +803,17 @@ public class QuadCLTCPU {
public void setBlueSky (
double max_disparity,
double max_disparity_strength,
double sky_seed, // = 7.0; // start with 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
double seed_temp, // 0.5; // seed colder that this point between min and max temp
double sky_lim, // = 15.0; // then expand to product of strength by diff_second below this
double lim_temp, // 0.5; // sky colder that this point between min and max temp
int sky_shrink, // = 4;
int sky_expand_extra, // = 100; // 1?
int sky_bottleneck, //
int sky_bottleneck,
int sky_reexpand_extra, // 9; re-expand after bottleneck in addition to how it was shrank
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
......@@ -793,16 +831,22 @@ public class QuadCLTCPU {
double [] spread,
double [] disp_lma,
double [] avg_val,
QuadCLT dbg_scene, // use to save debug images if not null
int debugLevel) {
int width = tp.getTilesX();
// this.blue_sky = getBlueSky (
setBlueSky(getBlueSky (
sky_seed, // = 7.0; // start with product of strength by diff_second below this
lma_seed, // 2.0; // seed - disparity_lma limit
sky_lim, // = 15.0; // then expand to product of strength by diff_second below this
max_disparity,
max_disparity_strength,
sky_seed, // = 7.0; // start with product of strength by diff_second below this
lma_seed, // 2.0; // seed - disparity_lma limit
seed_temp, //double seed_temp, // 0.5; // seed colder that this point between min and max temp
sky_lim, // = 15.0; // then expand to product of strength by diff_second below this
lim_temp, //double lim_temp, // 0.5; // sky colder that this point between min and max temp
sky_shrink, // = 4;
sky_expand_extra, // = 100; // 1?
sky_bottleneck, //
sky_reexpand_extra, // int sky_reexpand_extra, // 9; re-expand after bottleneck in addition to how it was shrank
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
......@@ -821,12 +865,17 @@ public class QuadCLTCPU {
spread,
disp_lma,
avg_val,
dbg_scene, // use to save debug images if not null
debugLevel));
}
public void setDSI( double [][] dsi) {
this.dsi = dsi; // make sure available blue sky is not erased
}
/**
* Sets dsi from combo_dsi. Does not reset blue sky if it does not exist
* @param combo_dsi
*/
public void setDSIFromCombo(
double [][] combo_dsi) {
this.dsi = new double [TwoQuadCLT.DSI_SLICES.length][]; // will not have DSI_SPREAD_AUX
......@@ -836,8 +885,10 @@ public class QuadCLTCPU {
combo_dsi[OpticalFlow.COMBO_DSN_INDX_STRENGTH];
this.dsi[is_aux?TwoQuadCLT.DSI_DISPARITY_AUX_LMA:TwoQuadCLT.DSI_DISPARITY_MAIN_LMA] =
combo_dsi[OpticalFlow.COMBO_DSN_INDX_LMA];
this.dsi[is_aux?TwoQuadCLT.DSI_BLUE_SKY_AUX:TwoQuadCLT.DSI_BLUE_SKY_MAIN] =
combo_dsi[OpticalFlow.COMBO_DSN_INDX_BLUE_SKY];
if ((combo_dsi.length > OpticalFlow.COMBO_DSN_INDX_BLUE_SKY) && (combo_dsi[OpticalFlow.COMBO_DSN_INDX_BLUE_SKY] != null)) {
this.dsi[is_aux?TwoQuadCLT.DSI_BLUE_SKY_AUX:TwoQuadCLT.DSI_BLUE_SKY_MAIN] =
combo_dsi[OpticalFlow.COMBO_DSN_INDX_BLUE_SKY];
}
}
......@@ -864,6 +915,67 @@ public class QuadCLTCPU {
return num_slices >= 0;
}
@Deprecated
public int restoreInterDSI(boolean silent) {
for (int indx: new int[]{INDEX_INTER_LMA, INDEX_INTER}) {
int num_slices = restoreDSI(
DSI_SUFFIXES[indx], // String suffix, // "-DSI_COMBO", "-DSI_MAIN" (DSI_COMBO_SUFFIX, DSI_MAIN_SUFFIX)
null, // double [][] dsi, // if null - just check file exists
true); // boolean silent);
if (num_slices >= 0) {
this.dsi = new double [TwoQuadCLT.DSI_SLICES.length][];
return restoreDSI(
DSI_SUFFIXES[indx], // String suffix, // "-DSI_COMBO", "-DSI_MAIN" (DSI_COMBO_SUFFIX, DSI_MAIN_SUFFIX)
dsi, // double [][] dsi, // if null - just check file exists
silent); // boolean silent);
}
}
return 0;
}
/**
* Tries to read combo DSI, if successful - sets this.dsi and blue sky
* @param silent
* @return combo DSI if read, null if failed to read. Result has full lenghth
* (OpticalFlow.COMBO_DSN_TITLES.length), missing slices are null
*/
public double [][] restoreComboDSI (boolean silent) {
double [][] combo_dsi = new double [OpticalFlow.COMBO_DSN_TITLES.length][];
for (int indx: new int[]{INDEX_INTER_LMA, INDEX_INTER}) {
int num_slices = restoreDSI(
DSI_SUFFIXES[indx], // String suffix, // "-DSI_COMBO", "-DSI_MAIN" (DSI_COMBO_SUFFIX, DSI_MAIN_SUFFIX)
combo_dsi, // double [][] dsi, // if null - just check file exists
silent); // boolean silent);
if (num_slices >= 0) {
System.out.println ("restoreComboDSI(): used "+getX3dDirectory()+ Prefs.getFileSeparator() + image_name + DSI_SUFFIXES[indx] + ".tiff");
setDSIFromCombo(combo_dsi); // reformat
return combo_dsi;
}
}
return null;
}
public double [][] readComboDSI (boolean silent) {
double [][] combo_dsi = new double [OpticalFlow.COMBO_DSN_TITLES.length][];
for (int indx: new int[]{INDEX_INTER_LMA, INDEX_INTER}) {
int num_slices = restoreDSI(
DSI_SUFFIXES[indx], // String suffix, // "-DSI_COMBO", "-DSI_MAIN" (DSI_COMBO_SUFFIX, DSI_MAIN_SUFFIX)
combo_dsi, // double [][] dsi, // if null - just check file exists
silent); // boolean silent);
if (num_slices >= 0) {
System.out.println ("readComboDSI(): used "+getX3dDirectory()+ Prefs.getFileSeparator() +
image_name + DSI_SUFFIXES[indx] + ".tiff, instance.dsi and blue sky are not updated!");
setDSIFromCombo(combo_dsi); // reformat
return combo_dsi;
}
}
return null;
}
public int restoreDSI(
String suffix,
boolean silent) // "-DSI_COMBO", "-DSI_MAIN" (DSI_COMBO_SUFFIX, DSI_MAIN_SUFFIX)
......@@ -933,7 +1045,11 @@ public class QuadCLTCPU {
}
return -1;
}
System.out.println("restoreDSI(): got "+imp.getStackSize()+" slices from file: "+file_path);
if (dsi == null) {
System.out.println("restoreDSI(): has "+imp.getStackSize()+" slices in file: "+file_path);
} else {
System.out.println("restoreDSI(): got "+imp.getStackSize()+" slices from file: "+file_path);
}
if (imp.getStackSize() < 2) {
if (!silent) {
System.out.println ("Failed to read "+file_path);
......@@ -1249,6 +1365,7 @@ public class QuadCLTCPU {
return rgba;
}
public QuadCLTCPU restoreFromModel( // restores dsi
CLTParameters clt_parameters,
ColorProcParameters colorProcParameters,
......@@ -1715,13 +1832,10 @@ public class QuadCLTCPU {
}
public double [][] readDoubleArrayFromModelDirectory(
String suffix,
int num_slices, // (0 - all)
int [] wh
)
int [] wh)
{
// final int [] image_wh = geometryCorrection.getSensorWH();
String x3d_path = getX3dDirectory();
......
......@@ -572,6 +572,10 @@ public class TexturedModel {
final int tilesX,
int debugLevel_in)
{
if ((debugLevel_in > -2) && is_sky_cluster) {
System.out.println("buildTileCluster(): processing sky clusterm cluster_list.size()="+cluster_list.size());
}
final int dbg_tile = -2410; // 858; // -3868; // 28+48*80;
// final int num_layers = disparity_layers.length;
final int tiles = source_disparity.length;
......@@ -1417,6 +1421,9 @@ public class TexturedModel {
}
// next_seed_tile_layer is now {tile, layer}
final boolean is_sky_cluster = (next_seed_tile_layer[1] == blue_sky_layer) && blue_sky[next_seed_tile_layer[0]];
if ((debugLevel > -2) && is_sky_cluster) {
System.out.println("clusterizeFgBg(): processing sky clusterm cluster_list.size()="+cluster_list.size());
}
double [] cluster_initial_disparity = buildInitialCluster(
disparity_layers, // final double [][] disparity_layers, // should not have same tile disparity on multiple layers
seams_layers, // final int [][] seams_layers,
......@@ -1655,7 +1662,7 @@ public class TexturedModel {
final boolean showTri = !batch_mode && (debugLevel > -1) && (clt_parameters.show_triangles);
final boolean disp_hires_tri = !batch_mode && clt_parameters.tex_disp_hires_tri;
final int dbg_scale_mesh = clt_parameters.tex_dbg_scale_mesh; // 4; // <=0 - do not show
/// final double min_non_inf = 0.01; // relative to infinity disparity
final int sky_layer = 0; // source disparity layer that contains "blue sky"
......@@ -1668,6 +1675,7 @@ public class TexturedModel {
return false; // not used in lwir
}
double infinity_disparity = ref_scene.getGeometryCorrection().getDisparityFromZ(clt_parameters.infinityDistance);
double min_obj_disparity = ref_scene.getGeometryCorrection().getDisparityFromZ(clt_parameters.infinityDistance-clt_parameters.min_from_inf);
X3dOutput x3dOutput = null;
WavefrontExport wfOutput = null;
ArrayList<TriMesh> tri_meshes = null;
......@@ -1683,17 +1691,17 @@ public class TexturedModel {
System.out.println("As there was a problem with (wrong?) blue sky setting strength to 0.0001");
combo_dsn_final = null;
}
if (combo_dsn_final == null) {
combo_dsn_final =scenes[ref_index].readDoubleArrayFromModelDirectory(
"-INTER-INTRA-LMA", // String suffix,
0, // int num_slices, // (0 - all)
null); // int [] wh);
if (combo_dsn_final == null) { // does not set scene.dsi from file !!!
combo_dsn_final =scenes[ref_index].restoreComboDSI(true); // also sets quadCLTs[ref_index].dsi and blue sky
}
boolean [] sky_tiles = new boolean[combo_dsn_final[OpticalFlow.COMBO_DSN_INDX_BLUE_SKY].length];
boolean [] sky_invert = new boolean[combo_dsn_final[OpticalFlow.COMBO_DSN_INDX_BLUE_SKY].length];
int num_sky_tiles = 0;
for (int i = 0; i < sky_tiles.length; i++) {
sky_tiles[i] = combo_dsn_final[OpticalFlow.COMBO_DSN_INDX_BLUE_SKY][i] > 0.0;
sky_invert[i] = !sky_tiles[i]; // not used
num_sky_tiles += sky_tiles[i]? 1: 0;
}
if (debugLevel > -2) {
System.out.println("output3d(): num_sky_tiles="+num_sky_tiles);
}
// re-load , should create quadCLTs[ref_index].dsi
double [][] dls_fg = {
......@@ -1703,18 +1711,19 @@ public class TexturedModel {
};
// currently conditionInitialDS() zeroes disparity for blue_sky. TODO: allow some FG over blue_sky?
// gets Blue Sky from scene.dsi , not from the file!
double [][] ds_fg = OpticalFlow.conditionInitialDS(
true, // boolean use_conf, // use configuration parameters, false - use following
true, // boolean use_conf, // use configuration parameters, false - use following
clt_parameters, // CLTParameters clt_parameters,
dls_fg, // double [][] dls
scenes[ref_index], // QuadCLT scene,
dls_fg, // double [][] dls
scenes[ref_index], // QuadCLT scene,
debugLevel); // int debug_level)
double [][] dls_bg = {
combo_dsn_final[OpticalFlow.COMBO_DSN_INDX_DISP_BG].clone(),
combo_dsn_final[OpticalFlow.COMBO_DSN_INDX_LMA_BG].clone(),
combo_dsn_final[OpticalFlow.COMBO_DSN_INDX_STRENGTH_BG].clone()
};
for (int i = 0; i < sky_tiles.length; i++) if (Double.isNaN(dls_bg[0][i])){
for (int i = 0; i < dls_bg[0].length; i++) if (Double.isNaN(dls_bg[0][i])){
dls_bg[0][i] = dls_fg[0][i];
dls_bg[1][i] = dls_fg[1][i];
dls_bg[2][i] = dls_fg[2][i];
......@@ -1726,11 +1735,37 @@ public class TexturedModel {
scenes[ref_index], // QuadCLT scene,
debugLevel); // int debug_level)
double[][] ds_fg_bg = {ds_fg[0], ds_bg[0].clone()};
for (int i = 0; i < sky_tiles.length; i++) {
for (int i = 0; i < dls_bg[0].length; i++) {
if (Math.abs(ds_fg_bg[1][i]-ds_fg_bg[0][i]) < tex_fg_bg) {
ds_fg_bg[1][i] = Double.NaN;
}
}
if (debugLevel > -2) {
System.out.println("Limiting non-infinity objects' disparity to "+min_obj_disparity+
", infinity_disparity = "+infinity_disparity);
}
for (int nl = 0; nl < ds_fg_bg.length; nl++) {
for (int i = 0; i < dls_bg[nl].length; i++) {
if ((nl != sky_layer) || !sky_tiles[i]) {
if (ds_fg_bg[nl][i] < min_obj_disparity) {
ds_fg_bg[nl][i] = min_obj_disparity;
}
}
}
}
if (debugLevel > -2) { // was > 0
String [] dbg_titles = {"FG","BG","BS"};
double [][] dbg_img = {ds_fg_bg[0], ds_fg_bg[1],combo_dsn_final[OpticalFlow.COMBO_DSN_INDX_BLUE_SKY]};
ShowDoubleFloatArrays.showArrays(
dbg_img,
tilesX,
dbg_img[0].length/tilesX,
true,
ref_scene.getImageName()+"-disparity_layers",
dbg_titles);
}
// Create data for consolidated textures (multiple texture segments combined in same "passes"
TileCluster [] tileClusters = clusterizeFgBg( // wrong result type, not decided
tilesX, // final int tilesX,
......@@ -1951,7 +1986,9 @@ public class TexturedModel {
boolean [] scan_selected = tileClusters[nslice].getSubSelected(sub_i); // limited to cluster bounds
int [] scan_border_int = tileClusters[nslice].getSubBorderInt(sub_i); // limited to cluster bounds
int max_border = tileClusters[nslice].getBorderIntMax();
boolean is_sky = tileClusters[nslice].isSky();
double min_disparity = is_sky? infinity_disparity : min_obj_disparity;
// skipping averaging disparity for a whole cluster (needs strength and does not seem to be useful)
try {
if (alpha == null) {
......@@ -2008,7 +2045,7 @@ public class TexturedModel {
((dbg_mesh_imgs != null) ? dbg_mesh_imgs[nslice]:null), // double [] tri_img, //
dbg_scaled_width, // int tri_img_width,
// FIXME: make a separate parameter:
infinity_disparity, // 0.25 * clt_parameters.bgnd_range, // 0.3
infinity_disparity, //min_disparity, // infinity_disparity, // 0.25 * clt_parameters.bgnd_range, // 0.3
clt_parameters.grow_disp_max, // other_range, // 2.0 'other_range - difference from the specified (*_CM)
clt_parameters.maxDispTriangle,
clt_parameters.maxZtoXY, // double maxZtoXY, // 10.0. <=0 - do not use
......@@ -3663,7 +3700,8 @@ public class TexturedModel {
sky_pixels, // final double [] data,
null, // final boolean [] prohibit,
sky_pixels_bounds.width, // int width,
3 * Math.min(sky_pixels_bounds.width,sky_pixels_bounds.height) / 2, // 16, // final int grow,
// 3 * Math.min(sky_pixels_bounds.width,sky_pixels_bounds.height) / 2, // 16, // final int grow,
2 * Math.max(sky_pixels_bounds.width,sky_pixels_bounds.height), // 16, // final int grow,
0.7, // double diagonal_weight, // relative to ortho
100, // int num_passes,
0.01, // final double max_rchange, // = 0.01
......
......@@ -8687,6 +8687,9 @@ ImageDtt.startAndJoin(threads);
Arrays.fill(all_nan, Double.NaN);
return all_nan;
}
if (davg2 == 0) {
davg2 = 1; // for sky with disparity ==0
}
final double fdavg = davg;
final double max_change = Math.abs(davg2 * max_rchange);
......
......@@ -209,10 +209,15 @@ public class LwirWorld {
double cold_scale = clt_parameters.imp.cold_scale;
double sky_seed = clt_parameters.imp.sky_seed;
double lma_seed = clt_parameters.imp.lma_seed;
double seed_temp = clt_parameters.imp.seed_temp;
int sky_shrink = clt_parameters.imp.sky_shrink;
int sky_bottleneck = clt_parameters.imp.sky_bottleneck;
int sky_reexpand_extra = clt_parameters.imp.sky_reexpand_extra;
int seed_rows = clt_parameters.imp.seed_rows;
double max_disparity = clt_parameters.imp.max_disparity;
double max_disparity_strength=clt_parameters.imp.max_disparity_strength;
double sky_lim = clt_parameters.imp.sky_lim;
double lim_temp = clt_parameters.imp.lim_temp;
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;
......@@ -366,13 +371,19 @@ public class LwirWorld {
System.out.println("(Re)using photometric calibration from this sequence reference "+quadCLTs[ref_index].getPhotometricScene());
quadCLTs[ref_index].setQuadClt(); // just in case ?
}
QuadCLT dbg_scene = clt_parameters.imp.save_debug_images? quadCLTs[ref_index]: null; // use to save debug images if not null
quadCLTs[ref_index].setBlueSky (
max_disparity,
max_disparity_strength,
sky_seed, // double sky_seed, // = 7.0; // start with product of strength by diff_second below this
lma_seed,
seed_temp, //double seed_temp, // 0.5; // seed colder that this point between min and max temp
sky_lim, // double sky_lim, // = 15.0; // then expand to product of strength by diff_second below this
lim_temp, // double lim_temp, // 0.5; // sky colder that this point between min and max temp
sky_shrink, // int sky_shrink, // = 4;
sky_expand_extra, // int sky_expand_extra, // = 100; // 1?
sky_bottleneck, //int sky_bottleneck, //
sky_bottleneck, //int sky_bottleneck, //
sky_reexpand_extra, //int sky_reexpand_extra, // 9; re-expand after bottleneck in addition to how it was shrank
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
......@@ -390,6 +401,7 @@ public class LwirWorld {
dsi[TwoQuadCLT.DSI_SPREAD_AUX], // double [] spread,
dsi[TwoQuadCLT.DSI_DISPARITY_AUX_LMA], // double [] spread,
dsi[TwoQuadCLT.DSI_AVGVAL_AUX],// double [] avg_val,
dbg_scene, // QuadCLT dbg_scene, // use to save debug images if not null
batch_mode? -1: 1); /// debugLevel); // int debugLevel)
if (ran_photo_each) {
double [] blue_sky = quadCLTs[ref_index].getDoubleBlueSky();
......@@ -464,13 +476,19 @@ public class LwirWorld {
if (dsi[TwoQuadCLT.DSI_SPREAD_AUX] == null) {
System.out.println("DSI_MAIN file has old format and does not have spread data, will recalculate.");
} else {
QuadCLT dbg_scene = clt_parameters.imp.save_debug_images? quadCLTs[ref_index]: null; // use to save debug images if not null
quadCLTs[ref_index].setBlueSky (
max_disparity,
max_disparity_strength,
sky_seed, // double sky_seed, // = 7.0; // start with product of strength by diff_second below this
lma_seed, // 2.0; // seed - disparity_lma limit
sky_lim, // double sky_lim, // = 15.0; // then expand to product of strength by diff_second below this
seed_temp, //double seed_temp, // 0.5; // seed colder that this point between min and max temp
sky_lim, // double sky_lim, // = 15.0; // then expand to product of strength by diff_second below this
lim_temp, // double lim_temp, // 0.5; // sky colder that this point between min and max temp
sky_shrink, // int sky_shrink, // = 4;
sky_expand_extra, // int sky_expand_extra, // = 100; // 1?
sky_bottleneck, //int sky_bottleneck, //
sky_reexpand_extra, //int sky_reexpand_extra, // 9; re-expand after bottleneck in addition to how it was shrank
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
......@@ -488,12 +506,12 @@ public class LwirWorld {
dsi[TwoQuadCLT.DSI_SPREAD_AUX], // double [] spread,
dsi[TwoQuadCLT.DSI_DISPARITY_AUX_LMA], //double [] disp_lma,
dsi[TwoQuadCLT.DSI_AVGVAL_AUX],// double [] avg_val,
dbg_scene, // QuadCLT dbg_scene, // use to save debug images if not null
debugLevel); // int debugLevel)
}
}
} // while (blue_sky == null)
/* */
return null;
}
}
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