Commit 50987d91 authored by Andrey Filippov's avatar Andrey Filippov

Adding minimal sequence travel

parent 26d4a190
......@@ -365,8 +365,8 @@ public class CuasMotion {
int corr_offset = clt_parameters.imp.cuas_corr_offset;
int precorr_ra = clt_parameters.imp.cuas_precorr_ra;
int corr_ra_step = clt_parameters.imp.cuas_corr_step;
int temporal_um = clt_parameters.imp.cuas_temporal_um;
double tum_threshold = clt_parameters.imp.cuas_tum_threshold;// 0.003; // clt_parameters.imp.rln_sngl_rstr; // FIXME: ADD
// int temporal_um = clt_parameters.imp.cuas_temporal_um;
// double tum_threshold = clt_parameters.imp.cuas_tum_threshold;// 0.003; // clt_parameters.imp.rln_sngl_rstr; // FIXME: ADD
double fat_zero = clt_parameters.imp.cuas_fat_zero;
double cent_radius = clt_parameters.imp.cuas_cent_radius;
......@@ -407,11 +407,11 @@ public class CuasMotion {
double lma_mina = clt_parameters.imp.cuas_lma_mina; // = 1.0; // Minimal A (amplitude)
double lma_maxr = clt_parameters.imp.cuas_lma_maxr; // = 5.0; // Maximal radius (>3.8)
double lma_minr1 = clt_parameters.imp.cuas_lma_minr1; // = 1.0; // Maximal inner radius
// double lma_minr1 = clt_parameters.imp.cuas_lma_minr1; // = 1.0; // Maximal inner radius
double lma_mink = clt_parameters.imp.cuas_lma_mink; // = 0.0; // Minimal K (overshoot) <0.007
double lma_maxk = clt_parameters.imp.cuas_lma_maxk; // = 5.0; // Minimal K (overshoot) > 3.8
double lma_a2a = clt_parameters.imp.cuas_lma_a2a; // = 0.7; // Minimal ratio of the maximal pixel to the amplitude
// double lma_a2a = clt_parameters.imp.cuas_lma_a2a; // = 0.7; // Minimal ratio of the maximal pixel to the amplitude
boolean remove_isolated= clt_parameters.imp.cuas_isolated; // true;
......@@ -433,6 +433,7 @@ public class CuasMotion {
boolean save_mono = clt_parameters.imp.cuas_save_mono; //true;
boolean save_color = clt_parameters.imp.cuas_save_color; //true;
boolean save_video = clt_parameters.imp.cuas_save_video; //true;
boolean clean_video = clt_parameters.imp.cuas_clean_video; //true;// save video without any debug information for targets, output in TIFF files. False - same output for video and TIFFs
for (int i = 0; i < target_frac.length; i++) {
if (clt_parameters.imp.cuas_target_frac[i].length >= 2) {
......@@ -847,6 +848,7 @@ public class CuasMotion {
generateExtractFilterMovingTargets( // move parameters to clt_parameters
clt_parameters, // CLTParameters clt_parameters,
false, // final boolean video_pass, // if clt_parameters.cuas_clean_video=true, video_pass=0 - output TIFFS, but no video. If video_pass==1 - only video with no debug
batch_mode, // final boolean batch_mode,
parentCLT, // QuadCLT parentCLT, //
// three arrays needed
......@@ -3488,6 +3490,7 @@ public class CuasMotion {
final boolean show_true_rng,// show true range (from the flight log)
final boolean show_mismatch,
final boolean show_score,
final boolean show_uas,
final int frame0,
final int frame_step,
final int width_src,
......@@ -3496,7 +3499,7 @@ public class CuasMotion {
final UasLogReader uasLogReader,
final int debugLevel) {
String uas_log_path = null;
boolean annotate_uas = clt_parameters.imp.cuas_annotate_uas && (uasLogReader != null);
boolean annotate_uas = show_uas && (uasLogReader != null);
if (annotate_uas) {
String resource_name = ICON_BLUE;
URL resourceUrl = CuasMotion.class.getClassLoader().getResource("graphics/"+resource_name);
......@@ -3776,8 +3779,8 @@ public class CuasMotion {
}
}
}
} else {
System.out.println("uaslog_rgba == null");
// } else {
// System.out.println("uaslog_rgba == null");
}
double [][] targets = targets60hz[nscene];
......@@ -4125,6 +4128,7 @@ public class CuasMotion {
generateExtractFilterMovingTargets( // move parameters to clt_parameters
clt_parameters, // CLTParameters clt_parameters,
false, // final boolean video_pass, // if clt_parameters.cuas_clean_video=true, video_pass=0 - output TIFFS, but no video. If video_pass==1 - only video with no debug
batch_mode, // final boolean batch_mode,
parentCLT, // QuadCLT parentCLT, //
// three arrays needed
......@@ -5344,6 +5348,7 @@ public class CuasMotion {
public static void generateExtractFilterMovingTargets( // move parameters to clt_parameters
CLTParameters clt_parameters,
final boolean video_pass, // if clt_parameters.cuas_clean_video=true, video_pass=0 - output TIFFS, but no video. If video_pass==1 - only video with no debug
final boolean batch_mode,
QuadCLT parentCLT, //
final float [][] fpixels,
......@@ -5353,7 +5358,8 @@ public class CuasMotion {
String [] scene_titles, // recreate slice_titles from scene titles?
String [] slice_titles,
final int debugLevel) {
String model_prefix = parentCLT.getImageName()+getParametersSuffix(clt_parameters,null);
String model_prefix = parentCLT.getImageName()+getParametersSuffixRslt(clt_parameters,null);
boolean clean_video = clt_parameters.imp.cuas_clean_video; //true;// save video without any debug information for targets, output in TIFF files. False - same output for video and TIFFs
final int corr_offset = clt_parameters.imp.cuas_corr_offset;
final int corr_pairs = clt_parameters.imp.cuas_corr_pairs;
......@@ -5383,10 +5389,23 @@ public class CuasMotion {
boolean save_video = clt_parameters.imp.cuas_save_video; //true;
boolean target_debug = clt_parameters.imp.cuas_target_debug; //true;
boolean show_target_score = clt_parameters.imp.cuas_target_score; // false; // show target score and sequence length ijn the final video
boolean annotate_uas = clt_parameters.imp.cuas_annotate_uas; // false; // show circle around UAS position from the flight log
boolean show_target_color = clt_parameters.imp.cuas_target_color; // false; // show target score and sequence length ijn the final video
boolean show_true_rng = clt_parameters.imp.cuas_show_true_rng; // show true range (from the flight log)
String clean_suffix = "";
if (clean_video) {
if (video_pass) {
annotate_uas = false;
save_mono = false;
save_color = false;
target_debug = false;
show_target_score = false;
show_target_color = false;
clean_suffix = "-CLEAN";
} else {
save_video = false;
}
}
boolean cuas_gaussian_ra = clt_parameters.imp.cuas_gaussian_ra; // use temporal Gaussian instead of running average
boolean center_targ = false; // clt_parameters.imp.cuas_center_targ;
......@@ -5503,10 +5522,11 @@ public class CuasMotion {
show_true_rng, // final boolean show_true_rng,// show true range (from the flight log)
target_debug, // final boolean show_mismatch,
show_target_score, // final boolean show_score,
annotate_uas, // final boolean show_uas,
frame0, // final int frame0,
corr_inc, // final int frame_step,
cuasMotion.gpu_max_width, // final int width,
model_prefix+"-RGB"+ra_bg_suffix, // String title,
model_prefix+"-RGB"+ra_bg_suffix+clean_suffix, // String title,
scene_titles, // String [] titles,
uasLogReader, // UasLogReader uasLogReader,
debugLevel); // final int debugLevel) {
......@@ -6168,6 +6188,53 @@ public class CuasMotion {
return ps;
}
public static String getParametersSuffixRslt(
CLTParameters clt_parameters,
String prefix) {
int corr_offset = clt_parameters.imp.cuas_corr_offset;
int corr_pairs = clt_parameters.imp.cuas_corr_pairs;
int temporal_um = clt_parameters.imp.cuas_temporal_um;
double tum_threshold = clt_parameters.imp.cuas_tum_threshold;// 0.003; // clt_parameters.imp.rln_sngl_rstr; // FIXME: ADD
int precorr_ra = clt_parameters.imp.cuas_precorr_ra;
int corr_ra_step = clt_parameters.imp.cuas_corr_step;
double rstr = clt_parameters.imp.cuas_rstr;// 0.003; // clt_parameters.imp.rln_sngl_rstr; // FIXME: ADD
double lma_rms = clt_parameters.imp.cuas_lma_rms; // = 1.5; // Maximal RMS, regardless of amplitude
double lma_arms = clt_parameters.imp.cuas_lma_arms; // = 0.06; // Maximal absolute RMS, sufficient for any amplitude
double lma_rrms = clt_parameters.imp.cuas_lma_rrms; // = 0.15; // Maximal relative to A rms. OK is when (RMS < cuas_lma_arms) || (RMS < cuas_lma_rrms * A)
double lma_mina = clt_parameters.imp.cuas_lma_mina; // = 1.0; // Minimal A (amplitude)
double fat_zero = clt_parameters.imp.cuas_fat_zero;
double lmax_fraction = clt_parameters.imp.cuas_lmax_fraction; // 0.7; // Check if local maximum is separated from tye surrounding by this fraction of the maximum value
double lmax_hack_ridge= clt_parameters.imp.cuas_lmax_hack_ridge; // 0.45; // Hack for ridges: remove horizontal streaks, where average(abs()) for the line exceeds fraction of abs max 0.32-good, 0.55 - bad
double lmax_flt_neglim= clt_parameters.imp.cuas_lmax_flt_neglim; // -0.3; // limit negative data to reduce ridge influence (make -10 to disable)
double lmax_flt_hsigma= clt_parameters.imp.cuas_lmax_flt_hsigma; // 1.0 // HPF (~UM) subtract GB with this sigma from the data tile
double lmax_flt_lsigma= clt_parameters.imp.cuas_lmax_flt_lsigma; // 1.0 // LPF - GB result of the previous subtraction
double lmax_flt_scale = clt_parameters.imp.cuas_lmax_flt_scale; // 5.0 // scale filtering result
// boolean center_targ = clt_parameters.imp.cuas_center_targ;
double min_score_lma = clt_parameters.imp.cuas_score_lma;
int min_seq= clt_parameters.imp.cuas_min_seq; // 3; // minimal number of consecutive key frames for the same target
int enough_seq= clt_parameters.imp.cuas_enough_seq; // 5; // minimal number of consecutive key frames for the same target
double seq_travel= clt_parameters.imp.cuas_seq_travel; // 3.0; // minimal diagonal of the bounding box that includes sequence to be considered "cuas_enough_seq". Filtering out atmospheric fluctuations
String ps = ((prefix != null)?prefix:"") + "-OFFS"+corr_offset+"-PAIRS"+corr_pairs+"-RSTR"+rstr+"-RMS"+lma_rms+
"-SRMS"+lma_arms+"-RRMS"+lma_rrms+"-AMP"+lma_mina+"-FZ"+fat_zero+"-PCRA"+precorr_ra+"-PS"+corr_ra_step+
"-TUM"+temporal_um+"-TT"+tum_threshold+"-MF"+lmax_fraction+
"-HR"+lmax_hack_ridge+
"-NL"+lmax_flt_neglim+"-FH"+lmax_flt_hsigma+"-FL"+lmax_flt_lsigma+"-FS"+lmax_flt_scale+
"-MS"+min_score_lma+"-ML"+min_seq+"-SL"+enough_seq+"-MT"+seq_travel;
// if (center_targ) {
// ps+="-CENT";
// }
return ps;
}
// =============================== targets_multi ======================================
......@@ -6924,7 +6991,7 @@ public class CuasMotion {
final int [][][][] len_ba = new int [2][num_seq][num_tiles][]; // first index is before/after
final Thread[] threads = ImageDtt.newThreadArray();
final AtomicInteger ai = new AtomicInteger(0);
final int dbg_tile = (32 + 44 * 80);
final int dbg_tile = -(32 + 44 * 80);
if (dbg_tile >=0) {
System.out.println("calcMathingTargetsLengths().0 max_mismatch="+max_mismatch+", max_mismatch2="+max_mismatch2);
}
......@@ -8967,8 +9034,7 @@ public class CuasMotion {
double slow_ra = clt_parameters.imp.cuas_slow_ra;
double slow_score = clt_parameters.imp.cuas_slow_score;
boolean clean_video = clt_parameters.imp.cuas_clean_video; //true;// save video without any debug information for targets, output in TIFF files. False - same output for video and TIFFs
boolean multi_targ = clt_parameters.imp.cuas_multi_targ; // true; // Use multi-target for each tile mode
int seq_length = corr_offset + corr_pairs;
......@@ -9093,6 +9159,21 @@ public class CuasMotion {
}
generateExtractFilterMovingTargets( // move parameters to clt_parameters
clt_parameters, // CLTParameters clt_parameters,
false, // final boolean video_pass, // if clt_parameters.cuas_clean_video=true, video_pass=0 - output TIFFS, but no video. If video_pass==1 - only video with no debug
batch_mode, // final boolean batch_mode,
parentCLT, // QuadCLT parentCLT, //
// three arrays needed
fpixels, // final float [][] fpixels,
targets_nonconflict, // final double [][][] vf_sequence, // center tiles (not extended), null /non-null only
cuasMotion, // final CuasMotion cuasMotion,
uasLogReader, // UasLogReader uasLogReader,
scene_titles, // String [] scene_titles, // recreate slice_titles from scene titles?
slice_titles, // String [] slice_titles,
debugLevel); // final int debugLevel)
if (clean_video) {
generateExtractFilterMovingTargets( // move parameters to clt_parameters
clt_parameters, // CLTParameters clt_parameters,
true, // final boolean video_pass, // if clt_parameters.cuas_clean_video=true, video_pass=0 - output TIFFS, but no video. If video_pass==1 - only video with no debug
batch_mode, // final boolean batch_mode,
parentCLT, // QuadCLT parentCLT, //
// three arrays needed
......@@ -9104,6 +9185,7 @@ public class CuasMotion {
slice_titles, // String [] slice_titles,
debugLevel); // final int debugLevel)
}
}
......@@ -9145,6 +9227,7 @@ public class CuasMotion {
double min_score_lma = clt_parameters.imp.cuas_score_lma;
int min_seq= clt_parameters.imp.cuas_min_seq; // 3; // minimal number of consecutive key frames for the same target
int enough_seq= clt_parameters.imp.cuas_enough_seq; // 5; // minimal number of consecutive key frames for the same target
double seq_travel= clt_parameters.imp.cuas_seq_travel; // 3.0; // minimal diagonal of the bounding box that includes sequence to be considered "cuas_enough_seq". Filtering out atmospheric fluctuations
double factor_lim = clt_parameters.imp.cuas_factor_lim;
double factor_pow = clt_parameters.imp.cuas_factor_pow;
double [] score_coeff = clt_parameters.imp.cuas_score_coeff.clone();
......
......@@ -799,6 +799,7 @@ min_str_neib_fpn 0.35
public boolean cuas_isolated = true; // remove targets that do not have neighbors before/after
public int cuas_min_seq = 3; // minimal number of consecutive key frames for the same target
public int cuas_enough_seq = 5; // number of consecutive key frames considered good regardless of individual scores (maybe add minimal travel in pixels)?
public double cuas_seq_travel = 3.0; // minimal diagonal of the bounding box that includes sequence to be considered "cuas_enough_seq". Filtering out atmospheric fluctuations
public int cuas_min_seq_fl = 2; // minimal number of consecutive key frames for the same target that includes first or last key frame
// public boolean cuas_remove_2seq = true; // Remove 2-long target sequences consisting of 2 consecutive key frames
// public boolean cuas_remove_2seq_all=true; // Remove 2-long first/last target sequences
......@@ -836,6 +837,8 @@ min_str_neib_fpn 0.35
public boolean cuas_save_mono = true; // save 32-bit monochrome target+backgrounds Tiffs (before optional scaling)
public boolean cuas_save_color = true; // save color rendered images (same as videos)
public boolean cuas_save_video = true; // save color rendered images (same as videos)
public boolean cuas_clean_video = true; // save video without any debug information for targets, output in TIFF files. False - same output for video and TIFFs
public boolean cuas_annotate = true; // save color rendered images (same as videos)
public boolean cuas_annotate_uas = true; // indicate uas from log if available
......@@ -2442,6 +2445,9 @@ min_str_neib_fpn 0.35
"Minimal number of consecutive key frames for the target to be detected.");
gd.addNumericField("Sufficient consecutive key frames", this.cuas_enough_seq, 0,3,"key frames",
"Number of consecutive key frames considered good regardless of their scores.");
gd.addNumericField("Minimal sequence travel", this.cuas_seq_travel, 5,8,"pix",
"Minimal diagonal of the bounding box that includes sequence to be considered \"cuas_enough_seq\". Filtering out atmospheric fluctuations.");
gd.addNumericField("Minimal end sequence length", this.cuas_min_seq_fl, 0,3,"key frames",
"Minimal number of consecutive key frames for the target to be detected if the sequence includes first or last key frame.");
......@@ -2508,6 +2514,8 @@ min_str_neib_fpn 0.35
"Save color rendered images (same as videos), optionally scaled.");
gd.addCheckbox ("Save videos", this.cuas_save_video,
"Save video with moving targets.");
gd.addCheckbox ("Clean videos", this.cuas_clean_video,
"Save video without any debug information for targets, output in TIFF files. False - same output for video and TIFFs.");
gd.addMessage("=== Target Annotation ===");
gd.addCheckbox ("Annotate targets", this.cuas_annotate,
......@@ -3590,6 +3598,7 @@ min_str_neib_fpn 0.35
// this.cuas_remove_2seq_all = gd.getNextBoolean();
this.cuas_min_seq= (int) gd.getNextNumber();
this.cuas_enough_seq= (int) gd.getNextNumber();
this.cuas_seq_travel= gd.getNextNumber();
this.cuas_min_seq_fl= (int) gd.getNextNumber();
......@@ -3624,6 +3633,7 @@ min_str_neib_fpn 0.35
this.cuas_save_mono = gd.getNextBoolean();
this.cuas_save_color = gd.getNextBoolean();
this.cuas_save_video = gd.getNextBoolean();
this.cuas_clean_video = gd.getNextBoolean();
this.cuas_annotate = gd.getNextBoolean();
this.cuas_annotate_uas = gd.getNextBoolean();
......@@ -4624,6 +4634,7 @@ min_str_neib_fpn 0.35
// properties.setProperty(prefix+"cuas_remove_2seq_all", this.cuas_remove_2seq_all+"");// boolean
properties.setProperty(prefix+"cuas_min_seq", this.cuas_min_seq+""); // int
properties.setProperty(prefix+"cuas_enough_seq", this.cuas_enough_seq+""); // int
properties.setProperty(prefix+"cuas_seq_travel", this.cuas_seq_travel+""); // double
properties.setProperty(prefix+"cuas_min_seq_fl", this.cuas_min_seq_fl+""); // int
properties.setProperty(prefix+"cuas_max_mismatch", this.cuas_max_mismatch+""); // double
......@@ -4657,6 +4668,7 @@ min_str_neib_fpn 0.35
properties.setProperty(prefix+"cuas_save_mono", this.cuas_save_mono+""); // boolean
properties.setProperty(prefix+"cuas_save_color", this.cuas_save_color+""); // boolean
properties.setProperty(prefix+"cuas_save_video", this.cuas_save_video+""); // boolean
properties.setProperty(prefix+"cuas_clean_video", this.cuas_clean_video+""); // boolean
properties.setProperty(prefix+"cuas_annotate", this.cuas_annotate+""); // boolean
......@@ -5619,6 +5631,7 @@ min_str_neib_fpn 0.35
if (properties.getProperty(prefix+"cuas_isolated")!=null) this.cuas_isolated=Boolean.parseBoolean(properties.getProperty(prefix+"cuas_isolated"));
if (properties.getProperty(prefix+"cuas_min_seq")!=null) this.cuas_min_seq=Integer.parseInt(properties.getProperty(prefix+"cuas_min_seq"));
if (properties.getProperty(prefix+"cuas_enough_seq")!=null) this.cuas_enough_seq=Integer.parseInt(properties.getProperty(prefix+"cuas_enough_seq"));
if (properties.getProperty(prefix+"cuas_seq_travel")!=null) this.cuas_seq_travel=Double.parseDouble(properties.getProperty(prefix+"cuas_seq_travel"));
if (properties.getProperty(prefix+"cuas_min_seq_fl")!=null) this.cuas_min_seq_fl=Integer.parseInt(properties.getProperty(prefix+"cuas_min_seq_fl"));
if (properties.getProperty(prefix+"cuas_max_mismatch")!=null) this.cuas_max_mismatch=Double.parseDouble(properties.getProperty(prefix+"cuas_max_mismatch"));
......@@ -5653,6 +5666,7 @@ min_str_neib_fpn 0.35
if (properties.getProperty(prefix+"cuas_save_mono")!=null) this.cuas_save_mono=Boolean.parseBoolean(properties.getProperty(prefix+"cuas_save_mono"));
if (properties.getProperty(prefix+"cuas_save_color")!=null) this.cuas_save_color=Boolean.parseBoolean(properties.getProperty(prefix+"cuas_save_color"));
if (properties.getProperty(prefix+"cuas_save_video")!=null) this.cuas_save_video=Boolean.parseBoolean(properties.getProperty(prefix+"cuas_save_video"));
if (properties.getProperty(prefix+"cuas_clean_video")!=null) this.cuas_clean_video=Boolean.parseBoolean(properties.getProperty(prefix+"cuas_clean_video"));
if (properties.getProperty(prefix+"cuas_annotate")!=null) this.cuas_annotate=Boolean.parseBoolean(properties.getProperty(prefix+"cuas_annotate"));
if (properties.getProperty(prefix+"cuas_annotate_uas")!=null) this.cuas_annotate_uas=Boolean.parseBoolean(properties.getProperty(prefix+"cuas_annotate_uas"));
......@@ -6617,7 +6631,7 @@ min_str_neib_fpn 0.35
imp.cuas_isolated = this.cuas_isolated;
imp.cuas_min_seq = this.cuas_min_seq;
imp.cuas_enough_seq = this.cuas_enough_seq;
imp.cuas_seq_travel= this.cuas_seq_travel;
imp.cuas_min_seq_fl = this.cuas_min_seq_fl;
imp.cuas_max_mismatch = this.cuas_max_mismatch;
......@@ -6650,6 +6664,7 @@ min_str_neib_fpn 0.35
imp.cuas_save_mono = this.cuas_save_mono;
imp.cuas_save_color = this.cuas_save_color;
imp.cuas_save_video = this.cuas_save_video;
imp.cuas_clean_video = this.cuas_clean_video;
imp.cuas_annotate = this.cuas_annotate;
imp.cuas_annotate_uas = this.cuas_annotate_uas;
......
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