Commit cfa9c56d authored by Andrey Filippov's avatar Andrey Filippov

Improved sky, movements

parent 7ac2edeb
......@@ -1546,7 +1546,6 @@ public class EyesisCorrectionParameters {
}
Path base_path = seq_path.getParent();
// first - scan all file and set sourceDirectory, x3dDirectory, linkedModels,videoDirectory,resultsDirectory
// String [] dir_paths = new String[KEY_DIRS.length];
HashMap<String,String> dir_map = new HashMap<String,String>();
for (String line:lines){
String[] tokens = line.split("#")[0].trim().split("[\\s,;=]+");
......
......@@ -147,7 +147,10 @@ public class IntersceneMatchParameters {
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 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
// 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
......@@ -201,11 +204,12 @@ public class IntersceneMatchParameters {
public boolean mov_en = true; // enable detection/removal of the moving objects during pose matching
public double mov_sigma = 1.5; // pix - weighted-blur offsets before detection
// next two to prevent motion detection while errors are too big
public double mov_max_std = 0.5; // pix
public double mov_max_std = 1.2; // pix
public double mov_thresh_rel = 3.5; // .0; // exceed average error
public double mov_thresh_abs= 0.5; // sqrt(dx^2+dy^2) in moving areas
public double mov_clust_max = 1.5; // cluster maximum should exceed threshold this times
public int mov_grow = 4; // grow detected moving area
public int mov_max_len = 0; // (0 - no limit) do not remove moving objects if they do not fit into the square
public boolean mov_show = true; // show debug images for movement detection
public int mov_debug_level = 1; // >0 verbose
//LMA parameters
......@@ -529,7 +533,11 @@ public class IntersceneMatchParameters {
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)");
"Last defense - if the detected sky area reaches near-bottom of the page - it is invalid, remove it (but keep in debug images).");
gd.addNumericField("Hottest sky tile to override lowest row",this.sky_bottom_override, 5,7,"",
"If the detected sky is all cold enough, bypass lowest row test, allow to raise camera.");
gd.addNumericField("Shrink before finding hottest sky", this.sky_override_shrink, 0,3,"",
"Shrink detected sky before looking for the hottest skyt tile (blurred skyline in wet atmosphere).");
gd.addTab ("Inter-Match", "Parameters for full-resolution scene matching");
// gd.addTab("Interscene Equalization","Equalization of the interscene correlation confidence to improve camera X,Y,Z matching");
......@@ -634,7 +642,10 @@ public class IntersceneMatchParameters {
gd.addNumericField("Cluster max over threshold", this.mov_clust_max, 6,7,"",
"Moving cluster should contain tile with this exceed over thresholds");
gd.addNumericField("Moving cluster grow", this.mov_grow, 0,3,"",
"Standard grow values - 1 - ortho, 2 - diagonal, 3 - twice orto, 4 - twice diagonal");
"Standard grow values - 1 - ortho, 2 - diagonal, 3 - twice orto, 4 - twice diagonal.");
gd.addNumericField("Maximal movement size", this.mov_max_len, 0,3,"tiles",
"Do not remove moving objects if they do not fit into the square with this side.");
gd.addCheckbox ("Show movement debug images", this.mov_show,
"Disabled if 'Debug Level for interscene match' < 1");
gd.addNumericField("Debug level for movement detection (0/1)", this.mov_debug_level, 0,3,"",
......@@ -901,6 +912,8 @@ public class IntersceneMatchParameters {
this.sky_expand_extra = (int) gd.getNextNumber();
this.min_strength = gd.getNextNumber();
this.lowest_sky_row = (int) gd.getNextNumber();
this.sky_bottom_override = gd.getNextNumber();
this.sky_override_shrink =(int) gd.getNextNumber();
this.margin = (int) gd.getNextNumber();
this.sensor_mask_inter= (int) gd.getNextNumber();
......@@ -942,6 +955,8 @@ public class IntersceneMatchParameters {
this.mov_thresh_abs = gd.getNextNumber();
this.mov_clust_max = gd.getNextNumber();
this.mov_grow = (int) gd.getNextNumber();
this.mov_max_len = (int) gd.getNextNumber();
this.mov_show = gd.getNextBoolean();
this.mov_debug_level = (int) gd.getNextNumber();
this.adjust_atr[0] = gd.getNextBoolean();
......@@ -1169,7 +1184,8 @@ public class IntersceneMatchParameters {
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
properties.setProperty(prefix+"sky_bottom_override", this.sky_bottom_override+""); // double
properties.setProperty(prefix+"sky_override_shrink", this.sky_override_shrink+""); // int
properties.setProperty(prefix+"margin", this.margin+""); // int
properties.setProperty(prefix+"sensor_mask_inter", this.sensor_mask_inter+""); // int
......@@ -1211,6 +1227,8 @@ public class IntersceneMatchParameters {
properties.setProperty(prefix+"mov_thresh_abs", this.mov_thresh_abs+""); // double
properties.setProperty(prefix+"mov_clust_max", this.mov_clust_max+""); // double
properties.setProperty(prefix+"mov_grow", this.mov_grow+""); // int
properties.setProperty(prefix+"mov_max_len", this.mov_max_len+""); // int
properties.setProperty(prefix+"mov_show", this.mov_show+""); // boolean
properties.setProperty(prefix+"mov_debug_level", this.mov_debug_level+""); // int
properties.setProperty(prefix+"adjust_atr_0", this.adjust_atr[0]+""); // boolean
......@@ -1389,7 +1407,8 @@ public class IntersceneMatchParameters {
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"));
if (properties.getProperty(prefix+"sky_bottom_override")!=null) this.sky_bottom_override=Double.parseDouble(properties.getProperty(prefix+"sky_bottom_override"));
if (properties.getProperty(prefix+"sky_override_shrink")!=null) this.sky_override_shrink=Integer.parseInt(properties.getProperty(prefix+"sky_override_shrink"));
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"));
......@@ -1431,6 +1450,8 @@ public class IntersceneMatchParameters {
if (properties.getProperty(prefix+"mov_thresh_abs")!=null) this.mov_thresh_abs=Double.parseDouble(properties.getProperty(prefix+"mov_thresh_abs"));
if (properties.getProperty(prefix+"mov_clust_max")!=null) this.mov_clust_max=Double.parseDouble(properties.getProperty(prefix+"mov_clust_max"));
if (properties.getProperty(prefix+"mov_grow")!=null) this.mov_grow=Integer.parseInt(properties.getProperty(prefix+"mov_grow"));
if (properties.getProperty(prefix+"mov_max_len")!=null) this.mov_max_len=Integer.parseInt(properties.getProperty(prefix+"mov_max_len"));
if (properties.getProperty(prefix+"mov_show")!=null) this.mov_show=Boolean.parseBoolean(properties.getProperty(prefix+"mov_show"));
if (properties.getProperty(prefix+"mov_debug_level")!=null) this.mov_debug_level=Integer.parseInt(properties.getProperty(prefix+"mov_debug_level"));
if (properties.getProperty(prefix+"adjust_atr_0")!=null) this.adjust_atr[0]=Boolean.parseBoolean(properties.getProperty(prefix+"adjust_atr_0"));
......@@ -1626,6 +1647,8 @@ public class IntersceneMatchParameters {
imp.sky_expand_extra = this.sky_expand_extra;
imp.min_strength = this.min_strength;
imp.lowest_sky_row = this.lowest_sky_row;
imp.sky_bottom_override = this.sky_bottom_override;
imp.sky_override_shrink = this.sky_override_shrink;
imp.margin = this.margin;
imp.sensor_mask_inter = this.sensor_mask_inter;
......@@ -1667,6 +1690,7 @@ public class IntersceneMatchParameters {
imp.mov_thresh_abs = this.mov_thresh_abs;
imp.mov_clust_max = this.mov_clust_max;
imp.mov_grow = this.mov_grow;
imp.mov_max_len = this.mov_max_len;
imp.mov_show = this.mov_show;
imp.mov_debug_level = this.mov_debug_level;
imp.adjust_atr[0] = this.adjust_atr[0];
......
......@@ -4047,8 +4047,6 @@ public class OpticalFlow {
boolean show_dsi_image = clt_parameters.imp.show_ranges && !batch_mode;
boolean show_images = clt_parameters.imp.show_images && !batch_mode;
// boolean show_color_nan = clt_parameters.imp.show_color_nan;
// boolean show_mono_nan = clt_parameters.imp.show_mono_nan;
int min_num_scenes = clt_parameters.imp.min_num_scenes; // abandon series if there are less than this number of scenes in it
boolean show_images_bgfg = clt_parameters.imp.show_images_bgfg && !batch_mode;
......@@ -4060,8 +4058,6 @@ public class OpticalFlow {
boolean [] save_mapped_mono_color = {clt_parameters.imp.save_mapped_mono, clt_parameters.imp.save_mapped_color};
boolean [] gen_avi_mono_color = {clt_parameters.imp.gen_avi_mono, clt_parameters.imp.gen_avi_color};
// boolean show_mapped_color = clt_parameters.imp.show_mapped_color && !batch_mode;
// boolean show_mapped_mono = clt_parameters.imp.show_mapped_mono && !batch_mode;
boolean [] show_mono_color = {
clt_parameters.imp.show_mapped_mono && !batch_mode,
clt_parameters.imp.show_mapped_color && !batch_mode};
......@@ -4084,7 +4080,6 @@ public class OpticalFlow {
clt_parameters.imp.generate_bg};
boolean generate_stereo = clt_parameters.imp.generate_stereo;
// double [] stereo_bases = clt_parameters.imp.stereo_bases; // {0.0, 200.0, 500.0, 1000.0};
double [][] stereo_views = clt_parameters.imp.stereo_views; // {0.0, 200.0, 500.0, 1000.0};
boolean [] generate_stereo_var = clt_parameters.imp.generate_stereo_var;
......@@ -4094,8 +4089,6 @@ public class OpticalFlow {
final Color anaglyph_right = clt_parameters.imp.anaglyph_right;
int stereo_gap = clt_parameters.imp.stereo_gap;
// double stereo_intereye = clt_parameters.imp.stereo_intereye;
// double stereo_phone_width = clt_parameters.imp.stereo_phone_width;
int extra_hor_tile = clt_parameters.imp.extra_hor_tile;
int extra_vert_tile = clt_parameters.imp.extra_vert_tile;
......@@ -4108,7 +4101,6 @@ public class OpticalFlow {
boolean run_ffmpeg = clt_parameters.imp.run_ffmpeg;
String video_ext = clt_parameters.imp.video_ext;
String video_codec = clt_parameters.imp.video_codec.toLowerCase();
// String video_extra = clt_parameters.imp.video_extra;
int video_crf = clt_parameters.imp.video_crf;
boolean remove_avi = clt_parameters.imp.remove_avi;
boolean um_mono = clt_parameters.imp.um_mono;
......@@ -4124,7 +4116,6 @@ public class OpticalFlow {
final Color annotate_color_color = clt_parameters.imp.annotate_color_color;
final Color annotate_color_mono = clt_parameters.imp.annotate_color_mono;
// boolean readjust_orient = clt_parameters.imp.readjust_orient;
boolean test_ers = clt_parameters.imp.test_ers && !batch_mode;
int test_ers0 = clt_parameters.imp.test_ers0; // try adjusting a pair of scenes with ERS. Reference scene index
int test_ers1 = clt_parameters.imp.test_ers1; // try adjusting a pair of scenes with ERS. Other scene index
......@@ -4145,6 +4136,8 @@ public class OpticalFlow {
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;
double sky_bottom_override = clt_parameters.imp.sky_bottom_override;
int sky_override_shrink = clt_parameters.imp.sky_override_shrink;
boolean [] ref_blue_sky = null; // turn off "lma" in the ML output
......@@ -4281,6 +4274,8 @@ public class OpticalFlow {
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_bottom_override, // double sky_temp_override, // really cold average seed - ignore lowest_sky_row filter
sky_override_shrink, // int shrink_for_temp, // shrink before finding hottest sky
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,
......@@ -4332,6 +4327,8 @@ public class OpticalFlow {
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_bottom_override, // double sky_temp_override, // really cold average seed - ignore lowest_sky_row filter
sky_override_shrink, // int shrink_for_temp, // shrink before finding hottest sky
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,
......@@ -12823,7 +12820,7 @@ public double[][] correlateIntersceneDebug( // only uses GPU and quad
{
boolean show_debug_images = (debug_image_name != null);
String [] mvTitles = {"dx", "dy", "conf", "blur", "blurX","blurY","clust","mask"};
String [] mvTitles = {"dx", "dy", "conf", "blur", "blurX","blurY","clust","filtclust","re-clust","mask"};
boolean mov_en = clt_parameters.imp.mov_en; // true; // enable detection/removal of the moving objects during pose matching
if (!mov_en) {
return null;
......@@ -12835,6 +12832,9 @@ public double[][] correlateIntersceneDebug( // only uses GPU and quad
double mov_thresh_abs= clt_parameters.imp.mov_thresh_abs; // 1.0; // sqrt(dx^2+dy^2) in moving areas
double mov_clust_max = clt_parameters.imp.mov_clust_max; // 1.5; // cluster maximum should exceed threshold this times
int mov_grow = clt_parameters.imp.mov_grow; // 4; // grow detected moving area
int mov_max_len = clt_parameters.imp.mov_max_len; // 0 - no limit
double frac_clust = 0.25;// cluster tiles compared to cluster max
double mov_max_std2 = mov_max_std * mov_max_std;
double mov_thresh_rel2 = mov_thresh_rel* mov_thresh_rel;
double mov_thresh_abs2 = mov_thresh_abs * mov_thresh_abs;
......@@ -12875,6 +12875,8 @@ public double[][] correlateIntersceneDebug( // only uses GPU and quad
}
}
boolean [] move_mask = null;
double [] clust_max = null;
int [][] minx_maxx_miny_maxy = null;
process_movements:
{
if (sl2 > mov_max_std2) {
......@@ -12935,7 +12937,7 @@ public double[][] correlateIntersceneDebug( // only uses GPU and quad
for (int nTile=0; nTile < clusters.length;nTile++) if (clusters[nTile] > max_clust_num) {
max_clust_num = clusters[nTile];
}
double [] clust_max = new double [max_clust_num];
clust_max = new double [max_clust_num];
for (int nTile=0; nTile < clusters.length;nTile++) if (clusters[nTile] > 0) {
int i = clusters[nTile]-1;
if (mov_obj[1][nTile] > clust_max[i]) {
......@@ -12954,11 +12956,26 @@ public double[][] correlateIntersceneDebug( // only uses GPU and quad
System.out.println("getMovementMask(): Cluster "+i+(good_clusters[i]?"*":" ")+", max = "+clust_max[i]);
}
}
if(show_debug_images) {
for (int nTile = 0; nTile < motion.length; nTile++) if (clusters[nTile] > 0){
dbg_img[6][nTile] = clusters[nTile];
}
}
// remove tiles much lower than cluster max
for (int nTile=0; nTile < clusters.length;nTile++) if (clusters[nTile] > 0) {
int iclust = clusters[nTile] - 1;
double threshold = clust_max[iclust] * frac_clust;
if (!good_clusters[iclust] || (mov_obj[1][nTile] < threshold)) {
clusters[nTile] = 0;
}
}
if(show_debug_images) {
for (int nTile = 0; nTile < motion.length; nTile++) if (clusters[nTile] > 0){
dbg_img[7][nTile] = clusters[nTile];
}
}
if (num_good_clusters == 0) {
if (debug_level>0) {
......@@ -12966,17 +12983,99 @@ public double[][] correlateIntersceneDebug( // only uses GPU and quad
}
break process_movements;
}
move_mask = new boolean [clusters.length];
for (int nTile=0; nTile < clusters.length; nTile++) if (clusters[nTile] > 0) {
move_mask[nTile] = good_clusters[clusters[nTile] -1];
}
tn.growSelection(
mov_grow, // int grow, // grow tile selection by 1 over non-background tiles 1: 4 directions, 2 - 8 directions, 3 - 8 by 1, 4 by 1 more
move_mask, // boolean [] tiles,
null); // boolean [] prohibit);
// Re-clusterize
clusters = tn.enumerateClusters(
move_mask, // boolean [] tiles,
false); // boolean ordered)
if(show_debug_images) {
for (int nTile = 0; nTile < motion.length; nTile++) if (clusters[nTile] > 0){
dbg_img[8][nTile] = clusters[nTile];
}
}
// Measure cluster sizes and remove too big ones
if (mov_max_len > 0) {
max_clust_num = 0;
for (int nTile=0; nTile < clusters.length;nTile++) if (clusters[nTile] > max_clust_num) {
max_clust_num = clusters[nTile];
}
minx_maxx_miny_maxy = new int [max_clust_num][];
for (int nTile = 0; nTile < motion.length; nTile++) if (clusters[nTile] > 0){
int x = nTile % tilesX;
int y = nTile / tilesX;
int iclust = clusters[nTile] - 1;
if (minx_maxx_miny_maxy[iclust] == null) {
minx_maxx_miny_maxy[iclust] = new int[] {x,x,y,y};
}
if (x < minx_maxx_miny_maxy[iclust][0]) minx_maxx_miny_maxy[iclust][0] = x;
if (x > minx_maxx_miny_maxy[iclust][1]) minx_maxx_miny_maxy[iclust][1] = x;
if (y < minx_maxx_miny_maxy[iclust][2]) minx_maxx_miny_maxy[iclust][2] = y;
if (y > minx_maxx_miny_maxy[iclust][3]) minx_maxx_miny_maxy[iclust][3] = y;
}
num_good_clusters = 0;
good_clusters = new boolean[max_clust_num];
for (int iclust = 0; iclust < max_clust_num; iclust++) {
if ( (minx_maxx_miny_maxy[iclust] != null) &&
((minx_maxx_miny_maxy[iclust][1] - minx_maxx_miny_maxy[iclust][0]) <= mov_max_len) &&
((minx_maxx_miny_maxy[iclust][3] - minx_maxx_miny_maxy[iclust][2]) <= mov_max_len)) {
good_clusters[iclust] = true;
num_good_clusters ++;
} else {
minx_maxx_miny_maxy[iclust] = null;
}
}
if (num_good_clusters == 0) {
if (debug_level>0) {
System.out.println("getMovementMask(): No small enough moving clusters (of total "+clust_max.length+"), aborting movement processing");
}
break process_movements;
}
if (debug_level>0) { // -1) {
System.out.println("getMovementMask(): Got "+max_clust_num+" clusters, of them good - "+num_good_clusters );
for (int i = 0; i < minx_maxx_miny_maxy.length; i++) {
int sizex = minx_maxx_miny_maxy[i][1] - minx_maxx_miny_maxy[i][0];
int sizey = minx_maxx_miny_maxy[i][3] - minx_maxx_miny_maxy[i][2];
int max_size = (sizex>sizey)? sizex:sizey;
System.out.println("getMovementMask(): Cluster "+i+(good_clusters[i]?"*":" ")+
", max_size="+max_size+" ("+sizex+", "+sizey+")"+
", xmin = "+minx_maxx_miny_maxy[i][0]+
", xmax = "+minx_maxx_miny_maxy[i][1]+
", ymin = "+minx_maxx_miny_maxy[i][2]+
", ymax = "+minx_maxx_miny_maxy[i][3]);
}
}
// remove too large clusters
if (mov_max_len > 0) {
for (int nTile=0; nTile < clusters.length; nTile++) if (clusters[nTile] > 0) {
int iclust = clusters[nTile] - 1;
if (!good_clusters[iclust]) {
clusters[nTile] = 0;
}
}
}
move_mask = new boolean [clusters.length];
for (int nTile=0; nTile < clusters.length; nTile++) if (clusters[nTile] > 0) {
move_mask[nTile] = good_clusters[clusters[nTile] -1];
}
}
if(show_debug_images) {
for (int nTile = 0; nTile < motion.length; nTile++) if (move_mask[nTile]){
dbg_img[7][nTile] = 1.0;
dbg_img[9][nTile] = 1.0;
}
}
......@@ -12996,7 +13095,16 @@ public double[][] correlateIntersceneDebug( // only uses GPU and quad
for (int nTile=0; nTile<move_mask.length;nTile++) if (move_mask[nTile]) {
num_mov++;
}
System.out.println("getMovementMask(): Created moving objects mask of "+num_mov+" tiles.");
System.out.print("getMovementMask(): Created moving objects mask of "+num_mov+" tiles. Sizes:");
if (minx_maxx_miny_maxy != null) {
for (int iclust = 0; iclust < minx_maxx_miny_maxy.length; iclust++) if (minx_maxx_miny_maxy[iclust] != null){
int sizex = minx_maxx_miny_maxy[iclust][1] - minx_maxx_miny_maxy[iclust][0];
int sizey = minx_maxx_miny_maxy[iclust][3] - minx_maxx_miny_maxy[iclust][2];
int max_size = (sizex>sizey)? sizex:sizey;
System.out.print(" "+max_size);
}
}
System.out.println();
} else {
System.out.println("getMovementMask(): No moving objects mask is created.");
......
......@@ -453,18 +453,25 @@ public class QuadCLTCPU {
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_temp_override, // really cold average seed - ignore lowest_sky_row filter
int shrink_for_temp, // shrink before finding hottest sky
double sky_highest_min, // = -50; // 100; // lowest absolute value should not be higher (requires photometric)
int width,
double [] strength,
double [] spread,
double [] disparity,
double [] avg_val,
int debugLevel) {
int debugLevel) { // >0 to show
if ((strength == null) || (spread==null)) {
return null;
}
// int shrink_for_temp = 10;
// double sky_temp_override = -300; // really cold average seed - ignore lowest_sky_row filter
double [] temp_scales = null;
boolean failure = false;
double temp_cold = Double.NaN;
double temp_hot = Double.NaN;
if (avg_val != null) {
int num_bins = 1000;
double min_temp = Double.NaN, max_temp=Double.NaN, avg_temp = 0;
......@@ -499,8 +506,8 @@ public class QuadCLTCPU {
for (int i = 1; i < num_bins; i++) { // make cumulative, last is 1.0;
hist[i] += hist[i-1];
}
double temp_cold = min_temp;
double temp_hot = max_temp;
temp_cold = min_temp;
temp_hot = max_temp;
for (int i = 0; i < num_bins; i++) {
if (hist[i] > cold_frac) {
double d = hist[i];
......@@ -543,7 +550,7 @@ public class QuadCLTCPU {
String [] dbg_in_titles = {"fom", "strength", "spread", "disparity", "avg_val", "tscale"};
String [] dbg_titles = {"sky", "seed", "max", "shrank"};
String [] dbg_titles = {"sky", "seed", "max", "shrank","full_shrank"};
if (debugLevel>0) {
double [] fom = new double[strength.length];
......@@ -593,6 +600,8 @@ public class QuadCLTCPU {
dbg_img[3][i] = sky_tiles[i]? 1 : 0;
}
}
// Calculate average seed "temperature"
tn.growSelection(
2*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,
......@@ -603,12 +612,30 @@ public class QuadCLTCPU {
sky_tiles, // boolean [] tiles,
null); // boolean [] prohibit)
}
double sky_max_temp = Double.NaN;
if (avg_val != null) {
boolean [] shrank_sky = sky_tiles.clone();
tn.shrinkSelection(
shrink_for_temp, // 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
shrank_sky, // boolean [] tiles,
null); // boolean [] prohibit)
for (int i = 0; i < sky_tiles.length; i++) if (shrank_sky[i]){
if (!(sky_max_temp >= avg_val[i])) {
sky_max_temp = avg_val[i];
}
}
if (dbg_img != null) {
for (int i = 0; i < sky_tiles.length; i++) {
dbg_img[0][i] = sky_tiles[i]? 1 : 0;
dbg_img[4][i] = shrank_sky[i]? 1 : 0;
}
}
}
if (dbg_img != null) {
for (int i = 0; i < sky_tiles.length; i++) {
dbg_img[0][i] = sky_tiles[i]? 1 : 0;
}
(new ShowDoubleFloatArrays()).showArrays(
dbg_img,
width,
......@@ -617,10 +644,17 @@ 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");
if (sky_max_temp < sky_temp_override) {
System.out.println("But detected sky is cold enough ("+sky_max_temp+" < "+sky_temp_override+
"), so this test is bypassed");
} else {
failure = true;
}
break;
}
}
......@@ -650,6 +684,8 @@ public class QuadCLTCPU {
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_temp_override, // really cold average seed - ignore lowest_sky_row filter
int shrink_for_temp, // shrink before finding hottest sky
double sky_highest_max, // = 100; // lowest absolute value should not be higher (requires photometric)
double [] strength,
double [] spread,
......@@ -669,6 +705,8 @@ public class QuadCLTCPU {
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_temp_override, // double sky_temp_override, // really cold average seed - ignore lowest_sky_row filter
shrink_for_temp, // int shrink_for_temp, // shrink before finding hottest sky
sky_highest_max, // = 100; // lowest absolute value should not be higher (requires photometric)
width,
strength,
......
......@@ -8617,7 +8617,7 @@ if (debugLevel > -100) return true; // temporarily !
class VideoSet {
String [] video_paths;
int [] stereo_widths;
int earliest_scene, reference_scene;
int earliest_scene, reference_scene; // , movement_size;
VideoSet(
String [] paths,
int [] stereo_widths,
......@@ -8684,6 +8684,7 @@ if (debugLevel > -100) return true; // temporarily !
widths_list[0], // int [] stereo_widths,
start_ref_pointers[0], // int earliest_scene,
start_ref_pointers[1])); // int reference_scene);
String series_action = (start_ref_pointers[0] < (min_num_scenes-1))?"is FINISHED ":("will continue down from scene "+(start_ref_pointers[0]));
System.out.println("PROCESSING SCENE SEQUENCE "+nseq+" (last is "+(num_seq-1)+") "+series_action+" in "+
IJ.d2s(0.000000001*(System.nanoTime()-start_time_seq),3)+" sec ("+
......
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