Commit 673cd8a6 authored by Andrey Filippov's avatar Andrey Filippov

more debugging

parent 50987d91
......@@ -60,7 +60,8 @@ public class CuasMotion {
public static final int TARGET_MISMATCH_AFTER = 6;
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_TRAVEL = 9;
final static public int TARGET_NTILE = 10;
final static public int TARGET_LENGTH = TARGET_NTILE+1;
final static public int IMPORTANCE_A = 0;
......@@ -69,7 +70,8 @@ public class CuasMotion {
final static public int IMPORTANCE_CENTER = 3;
final static public int IMPORTANCE_MISMATCH = 4;
final static public int IMPORTANCE_MATCH_LEN= 5;
final static public int IMPORTANCE_LENGTH = IMPORTANCE_MATCH_LEN + 1;
final static public int IMPORTANCE_TRAVEL= 6;
final static public int IMPORTANCE_LENGTH = IMPORTANCE_TRAVEL + 1;
final static public int TOTALS_ALL = 0;
final static public int TOTALS_UNDEFINED = 1;
......@@ -2950,6 +2952,7 @@ public class CuasMotion {
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];
targets_data[nTarget][TARGET_TRAVEL] = target[CuasMotionLMA.RSLT_SEQ_TRAVEL];
int pxl = (int) Math.round(targets_data[nTarget][TARGET_X]) - offs;
int pyt = (int) Math.round(targets_data[nTarget][TARGET_Y]) - offs;
......@@ -3851,8 +3854,8 @@ public class CuasMotion {
targets[ntarget][TARGET_MISMATCH_BEFORE],targets[ntarget][TARGET_MISMATCH_AFTER]);
}
if (show_score) {
txt += String.format("\nSEQ-%3.1f\n%5.3f",
targets[ntarget][TARGET_SEQLEN],targets[ntarget][TARGET_SCORE]);
txt += String.format("\nSEQ-%3.1f\nTRV-%4.1f\n%5.3f",
targets[ntarget][TARGET_SEQLEN],targets[ntarget][TARGET_TRAVEL], targets[ntarget][TARGET_SCORE]);
}
boolean sel_target = (ntarget == matching_target) && change_color;
ip.setColor(sel_target ? selected_color: text_color);
......@@ -3872,7 +3875,6 @@ public class CuasMotion {
};
}
ImageDtt.startAndJoin(threads);
// imp.show();
return imp;
}
......@@ -4880,6 +4882,7 @@ public class CuasMotion {
double lma_a2a = clt_parameters.imp.cuas_lma_a2a; // = 0.7; // Minimal ratio of the maximal pixel to the amplitude
double max_mismatch = clt_parameters.imp.cuas_max_mismatch; // 2;
double good_mismatch = clt_parameters.imp.cuas_good_mismatch; // 0.4;
double slow_fast_mismatch = clt_parameters.imp.cuas_slow_fast_mismatch; // 1.5; allow larger mismatch between slow and fast
// double match_len_pwr = clt_parameters.imp.cuas_match_len_pwr; // raise matching length to this power for calculating score
boolean fail_mismatch = clt_parameters.imp.cuas_fail_mismatch; // Fail on high mismatch early (when calculating scores);
double target_horizon= clt_parameters.imp.cuas_horizon;
......@@ -5128,6 +5131,8 @@ public class CuasMotion {
int min_seq_fl= clt_parameters.imp.cuas_min_seq_fl; // 2; // minimal number of consecutive key frames for the same target that includes first or last key frame
double max_mismatch = clt_parameters.imp.cuas_max_mismatch; // 2;
double good_mismatch = clt_parameters.imp.cuas_good_mismatch; // 0.4;
double slow_fast_mismatch = clt_parameters.imp.cuas_slow_fast_mismatch; // 1.5; allow larger mismatch between slow and fast
boolean intermed_low = clt_parameters.imp.cuas_intermed_low; //true;
// for getEffectiveStrengthLMA(), may be moved out of this method to resolveTargetsConflicts()
double target_strength = clt_parameters.imp.cuas_target_strength;
......@@ -6755,6 +6760,7 @@ public class CuasMotion {
final double minimal_score,
final int min_seq, // minimal sequence length
final int enough_seq, // good regardless of scores
final double seq_travel,
final int [] remain){
final int num_seq = target_multi.length;
final int num_tiles = target_multi[0].length;
......@@ -6774,7 +6780,7 @@ public class CuasMotion {
double [][] targets = target_multi[nSeq][ntile];
if ((targets != null) && (targets.length > 0)) {
if (targets[0][CuasMotionLMA.RSLT_FAIL] == CuasMotionLMA.FAIL_NONE) {
if (targets[0][CuasMotionLMA.RSLT_MATCH_LENGTH] >=(enough_seq-1)) {
if ((targets[0][CuasMotionLMA.RSLT_MATCH_LENGTH] >=(enough_seq-1)) && targets[0][CuasMotionLMA.RSLT_SEQ_TRAVEL] >= seq_travel) {
target_sequence[nSeq][ntile] = targets[0];
remain[nSeq]++;
} else if ((targets[0][CuasMotionLMA.RSLT_QSCORE] >= minimal_score) && (targets[0][CuasMotionLMA.RSLT_MATCH_LENGTH] >= (min_seq-1))) {
......@@ -6983,8 +6989,10 @@ public class CuasMotion {
public static void calcMathingTargetsLengths( // calculate number of consecutive keyframes connected to each target
final double [][][][] targets_multi,
final double max_mismatch, // if <=0, do not calculate mismatch_ba and filter
final double slow_fast_mismatch,
final int tilesX) {
final double max_mismatch2 = max_mismatch * max_mismatch;
final double slow_fast_mismatch2 = slow_fast_mismatch * slow_fast_mismatch;
// Will only consider not-failed targets
final int num_seq = targets_multi.length;
final int num_tiles = targets_multi[0].length;
......@@ -6995,6 +7003,8 @@ public class CuasMotion {
if (dbg_tile >=0) {
System.out.println("calcMathingTargetsLengths().0 max_mismatch="+max_mismatch+", max_mismatch2="+max_mismatch2);
}
final double [][][][][] bbox_ba = new double [2][num_seq][num_tiles][][]; // minx, miny, maxx, maxy
for (int aba = 0; aba <=1; aba++) {// first pass - calculating connected keyframes before each current keyframe tile/target alternative
final int ba = aba;
for (int nseq = 0; nseq < num_seq; nseq++) {
......@@ -7012,13 +7022,24 @@ public class CuasMotion {
if (nTile==dbg_tile) {
System.out.println("calcMathingTargetsLengths().1 ba="+ba+", fnseq="+fnseq+", targets.length="+targets.length);
}
bbox_ba[ba][fnseq][nTile] = new double [targets.length][];
for (int ntarg = 0; ntarg < targets.length; ntarg++) {
double [] target = targets[ntarg];
if ((target != null) && (target[CuasMotionLMA.RSLT_FAIL]==CuasMotionLMA.FAIL_NONE)){
double cent_x = 0.5*(target[CuasMotionLMA.RSLT_BX]+target[CuasMotionLMA.RSLT_AX]);
double cent_y = 0.5*(target[CuasMotionLMA.RSLT_BY]+target[CuasMotionLMA.RSLT_AY]);
bbox_ba[ba][fnseq][nTile][ntarg] = new double[] {cent_x, cent_y, cent_x, cent_y};
}
}
if (!first) {
for (int ntarg = 0; ntarg < targets.length; ntarg++) {
double [] target = targets[ntarg];
if ((target != null) && (target[CuasMotionLMA.RSLT_FAIL]==CuasMotionLMA.FAIL_NONE)){
double this_x = target[CuasMotionLMA.RSLT_BX + 2 * ba]; // this target's "before" (when ba=0) or "after" (when ba=1) absolute X
double this_y = target[CuasMotionLMA.RSLT_BY + 2 * ba]; // this target's absolute Y
// double cent_x = 0.5*(target[CuasMotionLMA.RSLT_BX]+target[CuasMotionLMA.RSLT_AX]);
// double cent_y = 0.5*(target[CuasMotionLMA.RSLT_BY]+target[CuasMotionLMA.RSLT_AY]);
boolean this_slow = target[CuasMotionLMA.RSLT_SLOW] > 0;
// compare with every previous (/next) neighbor tiles/targets
for (int dy = -1; dy <= 1; dy++) {
for (int dx = -1; dx <= 1; dx++) {
......@@ -7032,16 +7053,28 @@ public class CuasMotion {
if (len_ba[ba][fnseq_other][ntile_other][ntarg_other] > (lengths[ntarg] -1)) { // can potentially improve
double other_x = target_other[CuasMotionLMA.RSLT_BX + 2 * (1 - ba)]; // opposite direction
double other_y = target_other[CuasMotionLMA.RSLT_BY + 2 * (1 - ba)]; // opposite direction
boolean other_slow = target_other[CuasMotionLMA.RSLT_SLOW] > 0;
double mm2 = (this_slow != other_slow) ? slow_fast_mismatch2 : max_mismatch2;
double mismatch_x = other_x - this_x;
double mismatch_y = other_y - this_y;
double mismatch2 = mismatch_x * mismatch_x + mismatch_y * mismatch_y;
if (mismatch2 <= max_mismatch2) {
if (mismatch2 <= mm2) { // max_mismatch2) {
lengths[ntarg] = len_ba[ba][fnseq_other][ntile_other][ntarg_other] + 1;
// targets are ordered, starting with strongest.
// combine bbox-es
bbox_ba[ba][fnseq][nTile][ntarg] = getBbox(
bbox_ba[ba][fnseq_other][ntile_other][ntarg_other], // double [] bbox1,
bbox_ba[ba][fnseq] [nTile] [ntarg]); //double [] bbox2);
if (nTile==dbg_tile) {
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]);
", lengths["+ntarg+"]="+lengths[ntarg]+
", bbox={"+bbox_ba[ba][fnseq][nTile][ntarg][0]+","+
bbox_ba[ba][fnseq][nTile][ntarg][1]+","+
bbox_ba[ba][fnseq][nTile][ntarg][2]+","+
bbox_ba[ba][fnseq][nTile][ntarg][3]+"}");
}
} else {
if (nTile==dbg_tile) {
......@@ -7108,11 +7141,15 @@ public class CuasMotion {
}
target[CuasMotionLMA.RSLT_BEFORE_LENGTH] = len_ba[0][nSeq][ntile][ntarg];
target[CuasMotionLMA.RSLT_AFTER_LENGTH] = len_ba[1][nSeq][ntile][ntarg];
double [] bbox = getBbox(
bbox_ba[0][nSeq][ntile][ntarg], // double [] bbox1,
bbox_ba[1][nSeq][ntile][ntarg]); //double [] bbox2);
target[CuasMotionLMA.RSLT_SEQ_TRAVEL] = Math.sqrt(getDiagonal2(bbox));
if (ntile == dbg_tile) {
System.out.println("calcMathingTargetsLengths().4 nSeq = "+nSeq+", targets["+ntarg+"][CuasMotionLMA.RSLT_MATCH_LENGTH]="+
target[CuasMotionLMA.RSLT_MATCH_LENGTH]);
target[CuasMotionLMA.RSLT_MATCH_LENGTH]+", travel="+target[CuasMotionLMA.RSLT_SEQ_TRAVEL]);
}
}
}
}
......@@ -7124,6 +7161,43 @@ public class CuasMotion {
ImageDtt.startAndJoin(threads);
return;
}
/*
private static double getDiagonal2 (
double x,
double y,
double [] bbox) {
double min_x = Math.min(bbox[0], x);
double min_y = Math.min(bbox[1], y);
double max_x = Math.max(bbox[2], x);
double max_y = Math.max(bbox[3], y);
double w = max_x - min_x;
double h = max_y - min_y;
return w*w + h*h;
}
private static double [] getBbox (
double x,
double y,
double [] bbox) {
return new double[] {Math.min(bbox[0], x),Math.min(bbox[1], y),Math.max(bbox[2], x),Math.max(bbox[3], y)};
}
*/
private static double getDiagonal2 (
double [] bbox) {
double w = bbox[2] - bbox[0];
double h = bbox[3] - bbox[1];
return w*w + h*h;
}
private static double [] getBbox (
double [] bbox1,
double [] bbox2) {
return new double[] {Math.min(bbox1[0], bbox2[0]),Math.min(bbox1[1], bbox2[1]),Math.max(bbox1[2], bbox2[2]),Math.max(bbox1[3], bbox2[3])};
}
public static ImagePlus showTargetSequence(
final double [][][][] targets_multi, //
......@@ -7614,7 +7688,10 @@ public class CuasMotion {
double lma_a2a = clt_parameters.imp.cuas_lma_a2a; // = 0.7; // Minimal ratio of the maximal pixel to the amplitude
// double max_mismatch = clt_parameters.imp.cuas_max_mismatch; // 2;
double good_mismatch = clt_parameters.imp.cuas_good_mismatch; // 0.4;
double slow_fast_mismatch = clt_parameters.imp.cuas_slow_fast_mismatch; // 1.5; allow larger mismatch between slow and fast
double match_len_pwr = clt_parameters.imp.cuas_match_len_pwr; // raise matching length to this power for calculating score
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
boolean fail_mismatch = clt_parameters. imp.cuas_fail_mismatch; // Fail on high mismatch early (when calculating scores);
double target_horizon= clt_parameters.imp.cuas_horizon;
......@@ -7906,7 +7983,9 @@ public class CuasMotion {
lma_a2a, // final double lma_a2a,
0, // max_mismatch, // final double max_mismatch, apply only during final, when mismatch scores are calculated
good_mismatch, // final double good_mismatch, //do not add to score if worse
slow_fast_mismatch, // final double slow_fast_mismatch, // // 1.5; allow larger mismatch between slow and fast
match_len_pwr, // final double match_len_pwr, // 0.5; // raise matching length to this power for calculating score
seq_travel, // final double seq_travel,
fail_mismatch, // final boolean fail_mismatch,
target_horizon, // final double lma_horizon, // horizon as maximal pixel Y
cuasMotion.tilesX); // final int tilesX,
......@@ -7967,7 +8046,7 @@ public class CuasMotion {
ImagePlus imp_new_scores = showTargetSequence(
target_sequence_multi, // double [][][] vector_fields_sequence,
slice_titles, // String [] titles, // all slices*frames titles or just slice titles or null
model_prefix+"-ROUNDE_ONE",// String title,
model_prefix+"-ROUND_ONE",// String title,
false, // good_only, // final boolean good_only,
false, // show_empty, // final boolean show_empty, // show scenes with no (valid) targets
!batch_mode, // boolean show,
......@@ -8213,7 +8292,9 @@ public class CuasMotion {
lma_a2a, // final double lma_a2a,
0, // max_mismatch, // final double max_mismatch, apply only during final, when mismatch scores are calculated
good_mismatch, // final double good_mismatch, //do not add to score if worse
slow_fast_mismatch, // final double slow_fast_mismatch, // // 1.5; allow larger mismatch between slow and fast
match_len_pwr, // final double match_len_pwr, // 0.5; // raise matching length to this power for calculating score
seq_travel, // final double seq_travel,
fail_mismatch, // final boolean fail_mismatch,
target_horizon, // final double lma_horizon, // horizon as maximal pixel Y
cuasMotion.tilesX); // final int tilesX,
......@@ -8570,7 +8651,9 @@ public class CuasMotion {
final double lma_a2a,
final double max_mismatch,
final double good_mismatch, // 0.4; // do not add to score if worse
final double slow_fast_mismatch,
final double match_len_pwr, // 0.5; // raise matching length to this power for calculating score
final double seq_travel,
final boolean fail_mismatch,
final double lma_horizon, // horizon as maximal pixel Y
final int tilesX ) {
......@@ -8715,6 +8798,9 @@ public class CuasMotion {
}
quality_factors[IMPORTANCE_MATCH_LEN] = Math.pow(lma_rslts[CuasMotionLMA.RSLT_MATCH_LENGTH], match_len_pwr);// 1.0 if in every scene
quality_factors[IMPORTANCE_CENTER] = cxy*cxy;
quality_factors[IMPORTANCE_TRAVEL] = Math.max((lma_rslts[CuasMotionLMA.RSLT_SEQ_TRAVEL] - seq_travel)/seq_travel, 0);
// final double seq_travel,
}
// save quality factors
lma_rslts[CuasMotionLMA.RSLT_QA] = quality_factors[IMPORTANCE_A];
......@@ -8723,6 +8809,7 @@ public class CuasMotion {
lma_rslts[CuasMotionLMA.RSLT_QMATCH] = quality_factors[IMPORTANCE_MISMATCH];
lma_rslts[CuasMotionLMA.RSLT_QCENTER] = quality_factors[IMPORTANCE_CENTER];
lma_rslts[CuasMotionLMA.RSLT_QMATCH_LEN] = quality_factors[IMPORTANCE_MATCH_LEN];
lma_rslts[CuasMotionLMA.RSLT_QTRAVEL] = quality_factors[IMPORTANCE_TRAVEL];
}
}
}
......@@ -8779,6 +8866,8 @@ public class CuasMotion {
quality_factors[IMPORTANCE_MISMATCH] = lma_rslts[CuasMotionLMA.RSLT_QMATCH];
quality_factors[IMPORTANCE_CENTER] = lma_rslts[CuasMotionLMA.RSLT_QCENTER];
quality_factors[IMPORTANCE_MATCH_LEN]= lma_rslts[CuasMotionLMA.RSLT_QMATCH_LEN];
quality_factors[IMPORTANCE_TRAVEL]= lma_rslts[CuasMotionLMA.RSLT_QTRAVEL];
for (int i = 0; i < importance.length; i++) {
if (Double.isNaN(quality_factors[i])) {
quality_factors[i] = 0.0;
......@@ -9219,6 +9308,8 @@ public class CuasMotion {
double lma_a2a = clt_parameters.imp.cuas_lma_a2a; // = 0.7; // Minimal ratio of the maximal pixel to the amplitude
double max_mismatch = clt_parameters.imp.cuas_max_mismatch; // 2;
double good_mismatch = clt_parameters.imp.cuas_good_mismatch; // 0.4;
double slow_fast_mismatch = clt_parameters.imp.cuas_slow_fast_mismatch; // 1.5; allow larger mismatch between slow and fast
double match_len_pwr = clt_parameters.imp.cuas_match_len_pwr; // raise matching length to this power for calculating score
boolean fail_mismatch = clt_parameters.imp.cuas_fail_mismatch; // Fail on high mismatch early (when calculating scores);
double target_horizon= clt_parameters.imp.cuas_horizon;
......@@ -9320,6 +9411,7 @@ public class CuasMotion {
targets_multi, // final double [][][][] targets_multi,
// which is better here?
good_mismatch, // max_mismatch, // final double max_mismatch, // if <=0, do not calculate mismatch_ba and filter
slow_fast_mismatch, // final double slow_fast_mismatch,
cuasMotion.tilesX); //final int tilesX)
if (intermed_low && debug_more) {
ImagePlus imp_lengths = showTargetSequence(
......@@ -9349,7 +9441,9 @@ public class CuasMotion {
lma_a2a, // final double lma_a2a,
max_mismatch, // final double max_mismatch,
good_mismatch, // final double good_mismatch, //do not add to score if worse
slow_fast_mismatch, // final double slow_fast_mismatch, // // 1.5; allow larger mismatch between slow and fast
match_len_pwr, // final double match_len_pwr, // 0.5; // raise matching length to this power for calculating score
seq_travel, // final double seq_travel,
fail_mismatch, // final boolean fail_mismatch,
target_horizon, // final double lma_horizon, // target below horizon
cuasMotion.tilesX); // final int tilesX,
......@@ -9454,8 +9548,55 @@ public class CuasMotion {
min_score_lma, //final double minimal_score) {
min_seq, // final int min_seq) { // minimal sequence length
enough_seq, // final int enough_seq, // good regardless of scores
seq_travel, // final double seq_travel,
num_good); // final int [] remain){
if (debugLevel > -4) printStatsLine("converted to single targets per tile", true, num_good);
if (intermed_low) { // save always
ImagePlus imp_failures = showTargetSequence(
target_single, // double [][][] vector_fields_sequence,
slice_titles, // String [] titles, // all slices*frames titles or just slice titles or null
model_prefix+"-TARGETS_SINGLE-FIRST",// String title,
!batch_mode, // boolean show,
cuasMotion.tilesX); // int tilesX) {
parentCLT.saveImagePlusInModelDirectory(imp_failures);
}
// Convert back to multi, recalculate lengths, re-run convertFromMultiTarget() to remove short sequences
double [][][][] targets_multi2 = convertToMultiTarget(
target_single); // final double [][][] target_sequence) {
/*
calculateMismatchBeforeAfter(
targets_multi, // final double [][][][] targets_multi,
true, // final boolean good_only,
cuasMotion.tilesX); // int tilesX) {
*/
calcMathingTargetsLengths( // calculate number of consecutive keyframes connected to each target
targets_multi2, // final double [][][][] targets_multi,
// which is better here?
good_mismatch, // max_mismatch, // final double max_mismatch, // if <=0, do not calculate mismatch_ba and filter
slow_fast_mismatch, // final double slow_fast_mismatch,
cuasMotion.tilesX); //final int tilesX)
if (intermed_low) { // && debug_more) {
ImagePlus imp_lengths = showTargetSequence(
targets_multi2, // double [][][] vector_fields_sequence,
slice_titles, // String [] titles, // all slices*frames titles or just slice titles or null
model_prefix+"-MATCHING_LENGTHS2",// String title,
good_only, // final boolean good_only,
show_empty, // final boolean show_empty, // show scenes with no (valid) targets
!batch_mode, // boolean show,
cuasMotion.tilesX); // int tilesX) {
parentCLT.saveImagePlusInModelDirectory(imp_lengths);
}
target_single = convertFromMultiTarget(// single target per tile
targets_multi2, // final double [][][][] target_multi) {
min_score_lma, //final double minimal_score) {
min_seq, // final int min_seq) { // minimal sequence length
enough_seq, // final int enough_seq, // good regardless of scores
seq_travel, // final double seq_travel,
num_good); // final int [] remain){
if (debugLevel > -4) printStatsLine("Final section of single targets per tile", true, num_good);
if (debugLevel > -4) printStatsLine("converted to single targets per tile after removing shorts", true, num_good);
if (intermed_low) { // save always
ImagePlus imp_failures = showTargetSequence(
......
......@@ -69,21 +69,23 @@ public class CuasMotionLMA {
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
public static final int RSLT_SEQ_TRAVEL= 30;
// [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_MSCORE = 31;
public static final int RSLT_QA = 32;
public static final int RSLT_QRMS = 33;
public static final int RSLT_QRMS_A = 34;
public static final int RSLT_QCENTER = 35;
public static final int RSLT_QMATCH = 36;
public static final int RSLT_QMATCH_LEN=37;
public static final int RSLT_QTRAVEL= 38;
public static final int RSLT_QSCORE = 39;
public static final int RSLT_STRONGER =40; // index of stronger neighbor (may be more)
public static final int RSLT_SLOW = 41; // 1 - slow, 0 - fast
public static final int RSLT_WHEN = 42;
public static final int RSLT_FAIL = 43;
public static final int RSLT_LEN = RSLT_FAIL+1;
......@@ -96,8 +98,9 @@ public class CuasMotionLMA {
"ERR-BEFORE", "ERR-AFTER", "BA-DIRS", // before dir + 16*after dir
"Match-length",
"Length-before","Length-after", // just for debug, may be removed later
"TRAVEL",
"*MOTION-SCORE",
"*Q-AMPL","*Q-RMSE","*Q-RMSE/A","*Q-CENTER","*Q-MATCH","*Q-LENGTH","*Q-SCORE",
"*Q-AMPL","*Q-RMSE","*Q-RMSE/A","*Q-CENTER","*Q-MATCH","*Q-LENGTH","*QTRAVEL","*Q-SCORE",
"Stronger","Slow",
"WHEN", "FAILURE"};
......
......@@ -789,7 +789,7 @@ min_str_neib_fpn 0.35
public double cuas_score_lma = 0.0; // minimal score for the target LMA
public double cuas_factor_lim = 5.0; // limit each individual score factor
public double cuas_factor_pow = 1.0; // raise score factor to this power before combining
public double [] cuas_score_coeff = {1.0, 0.2, 1.0, 1.0, 1.0, 1.0}; //weights of amplitude, RMSE and RMSE/amplitude, center, mismatch, match_length
public double [] cuas_score_coeff = {1.0, 0.05, 0.7, 1.5, 2.0, 1.0, 1.0}; //weights of amplitude, RMSE and RMSE/amplitude, center, mismatch, match_length, travel
public boolean cuas_center_targ = true; // re-run target extraction with targets centered to their tiles
public boolean cuas_multi_targ = true; // Use multi-target for each tile mode
......@@ -805,6 +805,7 @@ min_str_neib_fpn 0.35
// public boolean cuas_remove_2seq_all=true; // Remove 2-long first/last target sequences
public double cuas_max_mismatch = 2.0; // maximal position error between consecutive scene sequences
public double cuas_good_mismatch = 0.4; // maximal position error between consecutive scene sequences that adds to the score
public double cuas_slow_fast_mismatch = 1.5; // allow larger mismatch between slow and fast
public double cuas_match_len_pwr = 0.5; // raise matching length to this power for calculating score
public boolean cuas_fail_mismatch = false; // fail high mismatch early
......@@ -2430,7 +2431,7 @@ min_str_neib_fpn 0.35
gd.addNumericField("Raise score factor to this power", this.cuas_factor_pow, 5,8,"",
"Raise each score factor to this power before combining them.");
gd.addStringField ("Score factors weights", IntersceneMatchParameters.doublesToString(cuas_score_coeff), 80,
"Relative importance of LMA amplitude, RMSE and RMSE/ampitude, center, before/after match, sqrt(match length).");
"Relative importance of LMA amplitude, RMSE and RMSE/ampitude, center, before/after match, sqrt(match length), travel.");
gd.addCheckbox ("Center targets in their tiles", this.cuas_center_targ,
"Re-run target extraction placing the targets at the center of their tiles.");
gd.addCheckbox ("Multi-target mode", this.cuas_multi_targ,
......@@ -2455,6 +2456,8 @@ min_str_neib_fpn 0.35
"Maximal position error between consecutive scene sequences.");
gd.addNumericField("Good mismatch", this.cuas_good_mismatch, 5,8,"pix",
"Maximal position error between consecutive scene sequences to add to the score.");
gd.addNumericField("Good mismatch between slow and fast", this.cuas_slow_fast_mismatch, 5,8,"pix",
"Allow larger mismatch between slow and fast.");
gd.addNumericField("Matching length power", this.cuas_match_len_pwr, 5,8,"",
"Raise matching length to this power for calculating score.");
......@@ -3604,6 +3607,7 @@ min_str_neib_fpn 0.35
this.cuas_max_mismatch= gd.getNextNumber();
this.cuas_good_mismatch = gd.getNextNumber();
this.cuas_slow_fast_mismatch = gd.getNextNumber();
this.cuas_match_len_pwr = gd.getNextNumber();
this.cuas_fail_mismatch = gd.getNextBoolean();
......@@ -4639,6 +4643,7 @@ min_str_neib_fpn 0.35
properties.setProperty(prefix+"cuas_max_mismatch", this.cuas_max_mismatch+""); // double
properties.setProperty(prefix+"cuas_good_mismatch", this.cuas_good_mismatch+""); // double
properties.setProperty(prefix+"cuas_slow_fast_mismatch",this.cuas_slow_fast_mismatch+"");// double
properties.setProperty(prefix+"cuas_match_len_pwr", this.cuas_match_len_pwr+""); // double
properties.setProperty(prefix+"cuas_fail_mismatch", this.cuas_fail_mismatch+""); // boolean
......@@ -5636,6 +5641,7 @@ min_str_neib_fpn 0.35
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"));
if (properties.getProperty(prefix+"cuas_good_mismatch")!=null) this.cuas_good_mismatch=Double.parseDouble(properties.getProperty(prefix+"cuas_good_mismatch"));
if (properties.getProperty(prefix+"cuas_slow_fast_mismatch")!=null)this.cuas_slow_fast_mismatch=Double.parseDouble(properties.getProperty(prefix+"cuas_slow_fast_mismatch"));
if (properties.getProperty(prefix+"cuas_match_len_pwr")!=null) this.cuas_match_len_pwr=Double.parseDouble(properties.getProperty(prefix+"cuas_match_len_pwr"));
if (properties.getProperty(prefix+"cuas_fail_mismatch")!=null) this.cuas_fail_mismatch=Boolean.parseBoolean(properties.getProperty(prefix+"cuas_fail_mismatch"));
......@@ -6636,6 +6642,7 @@ min_str_neib_fpn 0.35
imp.cuas_max_mismatch = this.cuas_max_mismatch;
imp.cuas_good_mismatch = this.cuas_good_mismatch;
imp.cuas_slow_fast_mismatch = this.cuas_slow_fast_mismatch;
imp.cuas_match_len_pwr = this.cuas_match_len_pwr;
imp.cuas_fail_mismatch = this.cuas_fail_mismatch;
......
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