Commit e686150e authored by Andrey Filippov's avatar Andrey Filippov

debugging

parent 1b90adae
......@@ -58,7 +58,9 @@ public class CuasMotion {
final static public int TARGET_STRENGTH = 4;
public static final int TARGET_MISMATCH_BEFORE = 5;
public static final int TARGET_MISMATCH_AFTER = 6;
final static public int TARGET_NTILE = 7;
final static public int TARGET_SCORE = 7;
final static public int TARGET_SEQLEN = 8;
final static public int TARGET_NTILE = 9;
final static public int TARGET_LENGTH = TARGET_NTILE+1;
final static public int IMPORTANCE_A = 0;
......@@ -2944,6 +2946,8 @@ public class CuasMotion {
targets_data[nTarget][TARGET_NTILE] = ntile;
targets_data[nTarget][TARGET_MISMATCH_BEFORE] = target[CuasMotionLMA.RSLT_MISMATCH_BEFORE];
targets_data[nTarget][TARGET_MISMATCH_AFTER] = target[CuasMotionLMA.RSLT_MISMATCH_AFTER];
targets_data[nTarget][TARGET_SCORE] = target[CuasMotionLMA.RSLT_QSCORE];
targets_data[nTarget][TARGET_SEQLEN] = target[CuasMotionLMA.RSLT_MATCH_LENGTH];
int pxl = (int) Math.round(targets_data[nTarget][TARGET_X]) - offs;
int pyt = (int) Math.round(targets_data[nTarget][TARGET_Y]) - offs;
......@@ -3480,8 +3484,10 @@ public class CuasMotion {
final double known_err, // 20; // Maximal distance between the detected target and UAS log position (in raw image pixels);
final float [][] fpixels,
final double [][][] targets60hz,
final boolean change_color,
final boolean show_true_rng,// show true range (from the flight log)
final boolean show_mismatch,
final boolean show_score,
final int frame0,
final int frame_step,
final int width_src,
......@@ -3574,6 +3580,7 @@ public class CuasMotion {
final boolean annotate = clt_parameters.imp.cuas_annotate;
final Color text_color = clt_parameters.imp.cuas_text_color;
final Color selected_color = clt_parameters.imp.cuas_selected_color;
final String font_name = clt_parameters.imp.cuas_font_name;
final int font_size = clt_parameters.imp.cuas_font_size;
final int font_type = clt_parameters.imp.cuas_font_type;
......@@ -3840,7 +3847,12 @@ public class CuasMotion {
txt += String.format("\nErr-%3.1f\nErr-%3.1f",
targets[ntarget][TARGET_MISMATCH_BEFORE],targets[ntarget][TARGET_MISMATCH_AFTER]);
}
ip.setColor(text_color);
if (show_score) {
txt += String.format("\nSEQ-%3.1f\n%5.3f",
targets[ntarget][TARGET_SEQLEN],targets[ntarget][TARGET_SCORE]);
}
boolean sel_target = (ntarget == matching_target) && change_color;
ip.setColor(sel_target ? selected_color: text_color);
ip.setFont(font_target);
if (target_text_transparent) {
ip.drawString(txt, text_left, text_top); // transparent.
......@@ -4247,7 +4259,7 @@ public class CuasMotion {
int [] num_bad = new int [num_corr_samples];
int [] totals = null;
int [] passes = new int [num_corr_samples]; // debugging filter5
String model_prefix = parentCLT.getImageName()+getParametersSuffix(clt_parameters,null)+(cuasMotion.slow_targets? "-SLOW":"-FAST");
String model_prefix = parentCLT.getImageName()+getParametersSuffix(clt_parameters,null);
for (int niter=0; niter < num_cycles; niter++) {
boolean save_filtered_low = intermed_low && (niter < iter_show);
boolean save_filtered_high = intermed_high && (niter < iter_show);
......@@ -4886,7 +4898,7 @@ public class CuasMotion {
System.out.println("testCuasScanMotion(): wrong format for a pair of strength, fraction values.");
}
}
String model_prefix = parentCLT.getImageName()+getParametersSuffix(clt_parameters,null)+(cuasMotion.slow_targets? "-SLOW":"-FAST");
String model_prefix = parentCLT.getImageName()+getParametersSuffix(clt_parameters,null);
int start_frame = 0;
int num_scenes = fpixels.length; // .getStack().getSize()- first_corr; // includes average
int seq_length = corr_offset + corr_pairs;
......@@ -5102,7 +5114,7 @@ public class CuasMotion {
CuasMotion cuasMotion,
String [] slice_titles,
final int debugLevel) {
String model_prefix = parentCLT.getImageName()+getParametersSuffix(clt_parameters,null)+(cuasMotion.slow_targets? "-SLOW":"-FAST");
String model_prefix = parentCLT.getImageName()+getParametersSuffix(clt_parameters,null);
final int corr_offset = clt_parameters.imp.cuas_corr_offset;
......@@ -5341,7 +5353,7 @@ 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)+(cuasMotion.slow_targets? "-SLOW":"-FAST");
String model_prefix = parentCLT.getImageName()+getParametersSuffix(clt_parameters,null);
final int corr_offset = clt_parameters.imp.cuas_corr_offset;
final int corr_pairs = clt_parameters.imp.cuas_corr_pairs;
......@@ -5370,6 +5382,9 @@ public class CuasMotion {
boolean save_color = clt_parameters.imp.cuas_save_color; //true;
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 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)
boolean cuas_gaussian_ra = clt_parameters.imp.cuas_gaussian_ra; // use temporal Gaussian instead of running average
......@@ -5484,8 +5499,10 @@ public class CuasMotion {
known_err, // final double known_err, // 20; // Maximal distance between the detected target and UAS log position (in raw image pixels);
replaced_targets, // final float [][] fpixels,
targets60hz, // final double [][][] targets60hz,
show_target_color, // final boolean change_color,
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,
frame0, // final int frame0,
corr_inc, // final int frame_step,
cuasMotion.gpu_max_width, // final int width,
......@@ -6906,7 +6923,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 = -(38 + 45 * 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);
}
......@@ -6936,7 +6953,7 @@ public class CuasMotion {
double this_y = target[CuasMotionLMA.RSLT_BY + 2 * ba]; // this target's absolute Y
// compare with every previous (/next) neighbor tiles/targets
for (int dy = -1; dy <= 1; dy++) {
for (int dx = 0; dx <=1; dx++) {
for (int dx = -1; dx <= 1; dx++) {
int ntile_other = tn.getNeibIndex(nTile, dx, dy);
if (ntile_other >= 0) {
double [][] targets_other = targets_multi[fnseq_other][ntile_other];
......@@ -6953,12 +6970,40 @@ public class CuasMotion {
if (mismatch2 <= max_mismatch2) {
lengths[ntarg] = len_ba[ba][fnseq_other][ntile_other][ntarg_other] + 1;
if (nTile==dbg_tile) {
System.out.println("calcMathingTargetsLengths().2 ba="+ba+", fnseq = "+fnseq+", lengths["+ntarg+"]="+lengths[ntarg]);
System.out.println("calcMathingTargetsLengths().2 ba="+ba+", fnseq = "+fnseq+", nTile="+nTile+", ntarg="+ntarg+
", fnseq_other="+fnseq_other+", ntile_other="+ntile_other+", ntarg_other="+ntarg_other+
", mismatch2="+mismatch2+
", lengths["+ntarg+"]="+lengths[ntarg]);
}
} else {
if (nTile==dbg_tile) {
System.out.println("calcMathingTargetsLengths().3 ba="+ba+", fnseq = "+fnseq+", nTile="+nTile+", ntarg="+ntarg+
", fnseq_other="+fnseq_other+", ntile_other="+ntile_other+", ntarg_other="+ntarg_other+
", mismatch2="+mismatch2+
", lengths["+ntarg+"]="+lengths[ntarg]+
", len_ba["+ba+"]["+fnseq_other+"]["+ntile_other+"]["+ntarg_other+"]=" + len_ba[ba][fnseq_other][ntile_other][ntarg_other]);
}
}
} else {
if (nTile==dbg_tile) {
System.out.println("calcMathingTargetsLengths().3b ba="+ba+", fnseq = "+fnseq+", nTile="+nTile+", ntarg="+ntarg+
", fnseq_other="+fnseq_other+", ntile_other="+ntile_other+", ntarg_other="+ntarg_other+
", lengths["+ntarg+"]="+lengths[ntarg]+" FAILED");
}
}
} else {
if (nTile==dbg_tile) {
System.out.println("calcMathingTargetsLengths().3a ba="+ba+", fnseq = "+fnseq+", nTile="+nTile+", ntarg="+ntarg+
", fnseq_other="+fnseq_other+", ntile_other="+ntile_other+", ntarg_other="+ntarg_other+
((target_other != null)? (", target_other[CuasMotionLMA.RSLT_FAIL]="+ target_other[CuasMotionLMA.RSLT_FAIL]) :", target_other == null")+
", len_ba["+ba+"]["+fnseq_other+"]["+ntile_other+"]["+ntarg_other+"]=" + len_ba[ba][fnseq_other][ntile_other][ntarg_other]+
", lengths["+ntarg+"]="+lengths[ntarg]);
}
}
} // for (int ntarg_other = 0; ntarg_other < targets_other.length; ntarg_other++) {
}
}
}
......@@ -6993,8 +7038,10 @@ public class CuasMotion {
target[CuasMotionLMA.RSLT_MATCH_LENGTH]+= len_ba[ba][nSeq][ntile][ntarg];
}
}
target[CuasMotionLMA.RSLT_BEFORE_LENGTH] = len_ba[0][nSeq][ntile][ntarg];
target[CuasMotionLMA.RSLT_AFTER_LENGTH] = len_ba[1][nSeq][ntile][ntarg];
if (ntile == dbg_tile) {
System.out.println("calcMathingTargetsLengths().3 nSeq = "+nSeq+", targets["+ntarg+"][CuasMotionLMA.RSLT_MATCH_LENGTH]="+
System.out.println("calcMathingTargetsLengths().4 nSeq = "+nSeq+", targets["+ntarg+"][CuasMotionLMA.RSLT_MATCH_LENGTH]="+
target[CuasMotionLMA.RSLT_MATCH_LENGTH]);
}
......@@ -9111,7 +9158,7 @@ public class CuasMotion {
System.out.println("testCuasScanMotion(): wrong format for a pair of strength, fraction values.");
}
}
String model_prefix = parentCLT.getImageName()+getParametersSuffix(clt_parameters,null)+(cuasMotion.slow_targets? "-SLOW":"-FAST");
String model_prefix = parentCLT.getImageName()+getParametersSuffix(clt_parameters,null);
int start_frame = 0;
int num_scenes = fpixels.length; // .getStack().getSize()- first_corr; // includes average
int seq_length = corr_offset + corr_pairs;
......
......@@ -66,20 +66,24 @@ public class CuasMotionLMA {
public static final int RSLT_MISMATCH_BEFORE = 24;
public static final int RSLT_MISMATCH_AFTER = 25; // RSLT_MISMATCH_BEFORE+1;
public static final int RSLT_MISMATCH_DIRS= 26;
public static final int RSLT_MATCH_LENGTH= 27; // [RSLT_MATCH_LENGTH] is one less than the total length (0 - isolated)
public static final int RSLT_MSCORE = 28;
public static final int RSLT_QA = 29;
public static final int RSLT_QRMS = 30;
public static final int RSLT_QRMS_A = 31;
public static final int RSLT_QCENTER = 32;
public static final int RSLT_QMATCH = 33;
public static final int RSLT_QMATCH_LEN=34;
public static final int RSLT_QSCORE = 35;
public static final int RSLT_STRONGER =36; // index of stronger neighbor (may be more)
public static final int RSLT_SLOW = 37; // 1 - slow, 0 - fast
public static final int RSLT_WHEN = 38;
public static final int RSLT_FAIL = 39;
public static final int RSLT_MATCH_LENGTH= 27;
public static final int RSLT_BEFORE_LENGTH= 28; // just for debug
public static final int RSLT_AFTER_LENGTH= 29; // just for debug
// [RSLT_MATCH_LENGTH] is one less than the total length (0 - isolated)
public static final int RSLT_MSCORE = 30;
public static final int RSLT_QA = 31;
public static final int RSLT_QRMS = 32;
public static final int RSLT_QRMS_A = 33;
public static final int RSLT_QCENTER = 34;
public static final int RSLT_QMATCH = 35;
public static final int RSLT_QMATCH_LEN=36;
public static final int RSLT_QSCORE = 37;
public static final int RSLT_STRONGER =38; // index of stronger neighbor (may be more)
public static final int RSLT_SLOW = 39; // 1 - slow, 0 - fast
public static final int RSLT_WHEN = 40;
public static final int RSLT_FAIL = 41;
public static final int RSLT_LEN = RSLT_FAIL+1;
......@@ -89,10 +93,12 @@ public class CuasMotionLMA {
"Centr-X","Centr-Y","Centr-max","Centr-frac",
"Vx", "Vy", "V-conf","V-frac", // from motion vectors
"X-before", "Y-before","X-after","Y-after", // from getHalfBeforeAfterPixXY()
"ERR-BEFORE", "ERR-AFTER", "BA-DIRS", "Match-length", // before dir + 16*after dir
"ERR-BEFORE", "ERR-AFTER", "BA-DIRS", // before dir + 16*after dir
"Match-length",
"Length-before","Length-after", // just for debug, may be removed later
"*MOTION-SCORE",
"*Q-AMPL","*Q-RMSE","*Q-RMSE/A","*Q-CENTER","*Q-MATCH","*Q-LENGTH","*Q-SCORE",
"Stronger",
"Stronger","Slow",
"WHEN", "FAILURE"};
public static final int FAIL_NONE = 0;
......
......@@ -840,6 +840,7 @@ min_str_neib_fpn 0.35
public boolean cuas_annotate = true; // save color rendered images (same as videos)
public boolean cuas_annotate_uas = true; // indicate uas from log if available
public Color cuas_text_color = new Color (0, 255, 255);// 220);
public Color cuas_selected_color = new Color (127, 0, 255);// 220);
public String cuas_font_name = "Monospaced";
public int cuas_font_size = 7; // before scaling
public int cuas_font_type = 1; // 0 - PLAIN, 1 - BOLD, 2 - ITALIC
......@@ -855,6 +856,9 @@ min_str_neib_fpn 0.35
public boolean cuas_step_debug = true; // save debug images during per-step cuas recalculation (and show them if not in batch mode)
public boolean cuas_save_stats = true; // Save target statistics data to find out which test failed and when (or when tile was found good)
public boolean cuas_target_debug = false; // save debug images during per-step cuas recalculation (and show them if not in batch mode)
public boolean cuas_target_score = true ; // show target score and sequence length ijn the final video
public boolean cuas_target_color = true ; // annotate known target with different color
public boolean cuas_overwrite = false; // overwrite num_orient and num_accum
public int cuas_num_orient = 2; // initial value for num_orient
public int cuas_num_accum = 1; // initial value for num_accum
......@@ -2512,7 +2516,11 @@ min_str_neib_fpn 0.35
"Indicate UAS position from the UAS flight log, if available.");
{
String scolor = String.format("%08x", getLongColor(this.cuas_text_color));
gd.addStringField ("Tast color",scolor, 8, "Any invalid hex number disables annotation");
gd.addStringField ("Target annotations color",scolor, 8, "Any invalid hex number disables annotation");
}
{
String scolor = String.format("%08x", getLongColor(this.cuas_selected_color));
gd.addStringField ("Selected target annotations color",scolor, 8, "Any invalid hex number disables annotation");
}
gd.addStringField ("Font name", this.cuas_font_name, 20,
"Font name, currently \"Monospaced\".");
......@@ -2542,6 +2550,10 @@ min_str_neib_fpn 0.35
" Save target statistics data to find out which test failed and when (or when tile was found good).");
gd.addCheckbox ("Add debug to the target text", this.cuas_target_debug,
"Add additional debug text to the .");
gd.addCheckbox ("Show target score", this.cuas_target_score,
"Show target score and sequence length in the final video.");
gd.addCheckbox ("Use known target color", this.cuas_target_color,
"Annotate known target with different color.");
gd.addCheckbox ("Overwrite number of performed adjustments", this.cuas_overwrite,
"Debug feature: overwrite actual number of performed orientation and disparity refinements to re-run them.");
......@@ -3625,6 +3637,16 @@ min_str_neib_fpn 0.35
this.cuas_text_color = setLongColor(0xCCFF00);
}
}
{
String scolor = gd.getNextString();
long lcolor = -1;
try {
lcolor = Long.parseLong(scolor,16);
this.cuas_selected_color = setLongColor(lcolor);
} catch(NumberFormatException e){
this.cuas_selected_color = setLongColor(0xFF0088);
}
}
this.cuas_font_name = gd.getNextString();
this.cuas_font_size = (int) gd.getNextNumber();
this.cuas_font_type = (int) gd.getNextNumber();
......@@ -3639,6 +3661,8 @@ min_str_neib_fpn 0.35
this.cuas_step_debug = gd.getNextBoolean();
this.cuas_save_stats = gd.getNextBoolean();
this.cuas_target_debug = gd.getNextBoolean();
this.cuas_target_score = gd.getNextBoolean();
this.cuas_target_color = gd.getNextBoolean();
this.cuas_overwrite = gd.getNextBoolean();
this.cuas_num_orient = (int) gd.getNextNumber();
......@@ -4641,6 +4665,10 @@ min_str_neib_fpn 0.35
long lcolor_annotate = (cuas_text_color == null) ? 0xCCFF00 : getLongColor(this.cuas_text_color);
properties.setProperty(prefix+"cuas_text_color", lcolor_annotate+"");
}
{
long lcolor_annotate = (cuas_selected_color == null) ? 0xFF0088 : getLongColor(this.cuas_selected_color);
properties.setProperty(prefix+"cuas_selected_color", lcolor_annotate+"");
}
properties.setProperty(prefix+"cuas_font_name", this.cuas_font_name+""); // String
properties.setProperty(prefix+"cuas_font_size", this.cuas_font_size+""); // int
properties.setProperty(prefix+"cuas_font_type", this.cuas_font_type+""); // int
......@@ -4655,6 +4683,8 @@ min_str_neib_fpn 0.35
properties.setProperty(prefix+"cuas_step_debug", this.cuas_step_debug+""); // boolean
properties.setProperty(prefix+"cuas_save_stats", this.cuas_save_stats+""); // boolean
properties.setProperty(prefix+"cuas_target_debug", this.cuas_target_debug+""); // boolean
properties.setProperty(prefix+"cuas_target_score", this.cuas_target_score+""); // boolean
properties.setProperty(prefix+"cuas_target_color", this.cuas_target_color+""); // boolean
properties.setProperty(prefix+"cuas_overwrite", this.cuas_overwrite+""); // boolean
properties.setProperty(prefix+"cuas_num_orient", this.cuas_num_orient+""); // int
......@@ -5631,6 +5661,11 @@ min_str_neib_fpn 0.35
if (lcolor_annotate < 0) this.cuas_text_color = setLongColor(0xCCFF00);
else this.cuas_text_color = setLongColor(lcolor_annotate);
}
if (properties.getProperty(prefix+"cuas_selected_color")!=null) {
long lcolor_annotate = Long.parseLong(properties.getProperty(prefix+"cuas_selected_color"));
if (lcolor_annotate < 0) this.cuas_selected_color = setLongColor(0xFF0088);
else this.cuas_selected_color = setLongColor(lcolor_annotate);
}
if (properties.getProperty(prefix+"cuas_font_name")!= null) cuas_font_name=(String) properties.getProperty(prefix+"cuas_font_name");
if (properties.getProperty(prefix+"cuas_font_size")!=null) this.cuas_font_size=Integer.parseInt(properties.getProperty(prefix+"cuas_font_size"));
if (properties.getProperty(prefix+"cuas_font_type")!=null) this.cuas_font_type=Integer.parseInt(properties.getProperty(prefix+"cuas_font_type"));
......@@ -5645,6 +5680,8 @@ min_str_neib_fpn 0.35
if (properties.getProperty(prefix+"cuas_step_debug")!=null) this.cuas_step_debug=Boolean.parseBoolean(properties.getProperty(prefix+"cuas_step_debug"));
if (properties.getProperty(prefix+"cuas_save_stats")!=null) this.cuas_save_stats=Boolean.parseBoolean(properties.getProperty(prefix+"cuas_save_stats"));
if (properties.getProperty(prefix+"cuas_target_debug")!=null) this.cuas_target_debug=Boolean.parseBoolean(properties.getProperty(prefix+"cuas_target_debug"));
if (properties.getProperty(prefix+"cuas_target_score")!=null) this.cuas_target_score=Boolean.parseBoolean(properties.getProperty(prefix+"cuas_target_score"));
if (properties.getProperty(prefix+"cuas_target_color")!=null) this.cuas_target_color=Boolean.parseBoolean(properties.getProperty(prefix+"cuas_target_color"));
if (properties.getProperty(prefix+"cuas_overwrite")!=null) this.cuas_overwrite=Boolean.parseBoolean(properties.getProperty(prefix+"cuas_overwrite"));
if (properties.getProperty(prefix+"cuas_num_orient")!=null) this.cuas_num_orient=Integer.parseInt(properties.getProperty(prefix+"cuas_num_orient"));
......@@ -6617,6 +6654,7 @@ min_str_neib_fpn 0.35
imp.cuas_annotate = this.cuas_annotate;
imp.cuas_annotate_uas = this.cuas_annotate_uas;
imp.cuas_text_color= this.cuas_text_color;
imp.cuas_selected_color= this.cuas_selected_color;
imp.cuas_font_name = this.cuas_font_name;
imp.cuas_font_size = this.cuas_font_size;
......@@ -6632,6 +6670,8 @@ min_str_neib_fpn 0.35
imp.cuas_step_debug = this.cuas_step_debug;
imp.cuas_save_stats = this.cuas_save_stats;
imp.cuas_target_debug = this.cuas_target_debug;
imp.cuas_target_score = this.cuas_target_score;
imp.cuas_target_color = this.cuas_target_color;
imp.cuas_overwrite = this.cuas_overwrite;
imp.cuas_num_orient = this.cuas_num_orient;
......
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