int[][]filter5=filter5Targets(// will ignore failed tiles
int[][]filter5=filter5Targets(// will ignore failed tiles
null,// By Claude on 05/07/2026: use FAIL_PENDING sentinels in target_sequence_multi
// null, // By Claude on 05/07/2026: use FAIL_PENDING sentinels in target_sequence_multi
target_sequence_multi,// final double [][][][] target_sequence_multi,
target_sequence_multi,// final double [][][][] target_sequence_multi,
// if use motion and select_new will only consider tiles (and compare motion scores in motion_sequence) that have nulls in target_sequence_multi[nseq][ntile]
// if use motion and select_new will only consider tiles (and compare motion scores in motion_sequence) that have nulls in target_sequence_multi[nseq][ntile]
// if not use motion and select_new will only consider (and compare scores) tiles that have [RSLT_CENTERED] = 0.0
// if not use motion and select_new will only consider (and compare scores) tiles that have [RSLT_CENTERED] = 0.0
// if not select_new (assumes not use motion) will return best (and good) target indices
// if not select_new (assumes not use motion) will return best (and good) target indices
true,// final boolean use_motion, // true - use motion vectors confidence, false - use target confidence
true,// final boolean use_motion, // true - use motion vectors confidence, false - use target confidence
true,// final boolean select_new, // true - use only untested tiles, false - use good tiles
true,// final boolean select_new, // true - use only untested tiles, false - use good tiles
min_score_mv,// double min_confidence,
// min_score_mv already applied
0,// min_score_mv, // double min_confidence,
target_horizon,// final double lma_horizon, // target below horizon
target_horizon,// final double lma_horizon, // target below horizon
cuasMotion.tilesX,// final int tilesX,
cuasMotion.tilesX,// final int tilesX,
max_range,// final int range, // 1 or 2
max_range,// final int range, // 1 or 2
...
@@ -8001,7 +8191,6 @@ public class CuasMotion {
...
@@ -8001,7 +8191,6 @@ public class CuasMotion {
null);// remain); // final int [] remain)
null);// remain); // final int [] remain)
if(save_filtered_low&&debug_more){
if(save_filtered_low&&debug_more){
// targets_nonoverlap will contain motion vectors used fro the next fpixels_accumulated
// targets_nonoverlap will contain motion vectors used fro the next fpixels_accumulated
keep_failed,// final boolean keep_failed, // keep failed targets
corr_offset,// int corr_offset, // interframe distance for correlation
niter,// final int when, // set if >=0 for failures
save_filtered_high,// boolean save_filtered_high,
false,// final boolean centered,
model_prefix,// String model_prefix,
boost_accum_pairs,// final double boost_exposure,
niter,// int niter,
targets_nonoverlap,// final double [][][] vector_fields, // centers
input_range,// double input_range,
fpixels_accumulated,// final double [][] accum_data, // should be around 0, no low-freq
lmax_fraction,// final double cuas_lmax_fraction, // 0.7; // Check if local maximum is separated from tye surrounding by this fraction of the maximum value
lmax_fraction,// double lmax_fraction,
lmax_flt_neglim,// final double lmax_flt_neglim, // -0.3; // limit negative data to reduce ridge influence (make -10 to disable)
lmax_flt_neglim,// double lmax_flt_neglim,
lmax_flt_hsigma,// final double lmax_flt_hsigma, // 1.0 // HPF (~UM) subtract GB with this sigma from the data tile
lmax_flt_hsigma,// double lmax_flt_hsigma,
lmax_flt_lsigma,// final double lmax_flt_lsigma, // 1.0 // LPF - GB result of the previous subtraction
lmax_flt_lsigma,// double lmax_flt_lsigma,
lmax_flt_scale,// final double lmax_flt_scale, // 5.0 // scale filtering result
lmax_flt_scale,// double lmax_flt_scale,
cuasMotion.sky_mask,// final double sky_mask,
sky_threshold,// double sky_threshold,
sky_threshold,// final double sky_threshold, // 0.9 // minimal value of the sky mask where target is possible
target_horizon,// double target_horizon,
target_horizon+filter_below_horizon,// final double lma_horizon,
lmax_hack_ridge,// final double 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
lmax_hack_ridge,// double lmax_hack_ridge,
lmax_radius,// final int cuas_lmax_radius, // 3; // look inside cuas_lmax_radius* 2 + 1 square for the local maximum isolation
lmax_radius,// double lmax_radius,
centered_radius,// final double centered_radius,
centered_blur,// final double centered_radius_blur,
int[][]filter5=filter5Targets(// will ignore failed tiles
int[][]filter5=filter5Targets(// will ignore failed tiles
null,// motion_sequence, // final double [][][] target_sequence,
// null, // motion_sequence, // final double [][][] target_sequence,
target_sequence_multi,// final double [][][][] target_sequence_multi,non-centered marked as "used"
target_sequence_multi,// final double [][][][] target_sequence_multi,non-centered marked as "used"
// if use motion and select_new will only consider tiles (and compare motion scores in motion_sequence) that have nulls in target_sequence_multi[nseq][ntile]
// if use motion and select_new will only consider tiles (and compare motion scores in motion_sequence) that have nulls in target_sequence_multi[nseq][ntile]
// if not use motion and select_new will only consider (and compare scores) tiles that have [RSLT_CENTERED] = 0.0
// if not use motion and select_new will only consider (and compare scores) tiles that have [RSLT_CENTERED] = 0.0
keep_failed,// final boolean keep_failed, // keep failed targets
keep_failed,// final boolean keep_failed, // keep failed targets
niter,// final int when, // set if >=0 for failures
niter,// final int when, // set if >=0 for failures
true,// final boolean centered,
centered,// final boolean centered,
boost_accum_pairs,// final double boost_exposure,
boost_accum_pairs,// final double boost_exposure,
targets_nonoverlap,// final double [][][] vector_fields, // centers
targets_nonoverlap,// final double [][][] vector_fields, // centers
fpixels_accumulated,// final double [][] accum_data, // should be around 0, no low-freq
fpixels_accumulated,// final double [][] accum_data, // should be around 0, no low-freq
...
@@ -8921,9 +9167,9 @@ public class CuasMotion {
...
@@ -8921,9 +9167,9 @@ public class CuasMotion {
target_horizon+filter_below_horizon,// final double lma_horizon,
target_horizon+filter_below_horizon,// final double lma_horizon,
lmax_hack_ridge,// final double 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
lmax_hack_ridge,// final double 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
lmax_radius,// final int cuas_lmax_radius, // 3; // look inside cuas_lmax_radius* 2 + 1 square for the local maximum isolation
lmax_radius,// final int cuas_lmax_radius, // 3; // look inside cuas_lmax_radius* 2 + 1 square for the local maximum isolation
lmax_radius,// final double centered_radius,
centered_radius,//lmax_radius, // final double centered_radius,
0.5,// final double centered_radius_blur,
centered_radius_blur,// 0.5, // final double centered_radius_blur,
1.0,// final double pix_tolerance, //
duplicate_tolerance,// 1.0, // final double pix_tolerance, //
// lmax_zero, // final boolean cuas_lmax_zero, // true; // zero all data outside this radius from the maximum
// lmax_zero, // final boolean cuas_lmax_zero, // true; // zero all data outside this radius from the maximum
target_radius,// final double centroid_radius,
target_radius,// final double centroid_radius,
n_recenter,// final int n_recenter, // re-center window around new maximum. 0 -no refines (single-pass)
n_recenter,// final int n_recenter, // re-center window around new maximum. 0 -no refines (single-pass)
...
@@ -8946,14 +9192,14 @@ public class CuasMotion {
...
@@ -8946,14 +9192,14 @@ public class CuasMotion {
lambda_max,// final double lambda_max,
lambda_max,// final double lambda_max,
rms_diff,// final double rms_diff,
rms_diff,// final double rms_diff,
num_iter,// final int num_iter,0, // final double pre_min_a, // pre-filter minimal LMA-A (half finbal?)
num_iter,// final int num_iter,0, // final double pre_min_a, // pre-filter minimal LMA-A (half finbal?)
lma_pre_mina*lma_mina,// final double pre_min_a, // 0.5 //scale cuas_lma_mina to filter initial candidates (if there are > one of them)
lma_pre_mina*lma_mina,// final double pre_min_a, // 0.5 //scale cuas_lma_mina to filter initial candidates (if there are > one of them)
min_keep,// final int min_keep, // 2; // keep at least this number of candidates before using cuas_lma_pre_mina filter
min_keep,// final int min_keep, // 2; // keep at least this number of candidates before using cuas_lma_pre_mina filter
accum_debug,// final float [][] accum_debug,
accum_debug,// final float [][] accum_debug,
cuasMotion.parentCLT,// final QuadCLT parentCLT, // debug only, maybe null in other cases
cuasMotion.parentCLT,// final QuadCLT parentCLT, // debug only, maybe null in other cases
public static int [][] filter5Targets( // should work for motion vectors and target coordinates returns index of selected target or -1 for unselected
public static int [][] filter5Targets( // should work for motion vectors and target coordinates returns index of selected target or -1 for unselected
final double [][][] motion_sequence, // may be null
final double [][][] motion_sequence, // may be null
final double [][][][] target_sequence_multi, // not null
final double [][][][] target_sequence_multi, // not null
...
@@ -9397,6 +9642,371 @@ public class CuasMotion {
...
@@ -9397,6 +9642,371 @@ public class CuasMotion {
}
}
return filter5;
return filter5;
}
}
*/
// removing final double [][][] motion_sequence, // AF 05/22/2026
publicstaticint[][]filter5Targets(// should work for motion vectors and target coordinates returns index of selected target or -1 for unselected
finaldouble[][][][]target_sequence_multi,// not null
// if use motion and select_new will only consider tiles (and compare motion scores in motion_sequence) that have nulls in target_sequence_multi[nseq][ntile]
// if not use motion and select_new will only consider (and compare scores) tiles that have [RSLT_CENTERED] = 0.0. After selection will mark those as
// if not select_new (assumes not use motion) will return best (and good) target indices
finalbooleanuse_motion_in,// true - use motion vectors confidence, false - use target confidence
finalbooleanselect_new_in,// true - use only untested tiles, false - use good tiles
// when using good ones - will select first good one (best if correctly ordered)
finaldoublemin_confidence,// 0 OK
finaldoublelma_horizon,// target below horizon
finalinttilesX,
finalintrange,// 1 or 2
finalint[]remain,
finalint[]passes,// debugging - number of passes required
finalintdebugLevel){
finalbooleanuse_motion=use_motion_in;// By Claude on 05/07/2026: decouple from motion_sequence presence
finalbooleanselect_new=select_new_in;// By Claude on 05/07/2026: decouple from motion_sequence
targets_multi,// final double [][][][] target_sequence_multi,
num_all,// int [] num_all_in,
null,// int [] num_motion_undef_in, // if non-null, will use it instead of num_noncentered_in // AF 05/20/2026
// next will be ignored if num_motion_undef_in != null
num_undef,// int [] num_noncentered_in,
num_good,// int [] num_good_in,
num_bad);// int [] num_bad_in)
if(debugLevel>-4)printStats("Resolving, after matching before/after",true,num_all,num_undef,num_good,num_bad);
if(debugLevel>-4)printStats("Resolving, after matching before/after",true,num_all,num_undef,num_good,num_bad);
if(intermed_low&&debug_more){
if(intermed_low&&debug_more){
ImagePlusimp_failures=showTargetSequence(
ImagePlusimp_failures=showTargetSequence(
...
@@ -10140,7 +10758,7 @@ public class CuasMotion {
...
@@ -10140,7 +10758,7 @@ public class CuasMotion {
// no extra recalculations here as was in pre-Multi?
// no extra recalculations here as was in pre-Multi?
// Use here the real threshold to remove weak
// Use here the real threshold to remove weak
int[][]filter5=filter5Targets(// will ignore failed tiles
int[][]filter5=filter5Targets(// will ignore failed tiles
null,// final double [][][] target_sequence,
// null, // final double [][][] target_sequence,
targets_multi,// final double [][][][] target_sequence_multi,
targets_multi,// final double [][][][] target_sequence_multi,
// if use motion and select_new will only consider tiles (and compare motion scores in motion_sequence) that have nulls in target_sequence_multi[nseq][ntile]
// if use motion and select_new will only consider tiles (and compare motion scores in motion_sequence) that have nulls in target_sequence_multi[nseq][ntile]
// if not use motion and select_new will only consider (and compare scores) tiles that have [RSLT_CENTERED] = 0.0
// if not use motion and select_new will only consider (and compare scores) tiles that have [RSLT_CENTERED] = 0.0
...
@@ -10442,6 +11060,8 @@ public class CuasMotion {
...
@@ -10442,6 +11060,8 @@ public class CuasMotion {
targets_good_multi,// double [][][][] targets_good_multi, // all targets, including conflicting
targets_good_multi,// double [][][][] targets_good_multi, // all targets, including conflicting
publicstaticfinalintRSLT_VEL_AWAY=63;// axial velocity (positive - away), range derivative (m/s), calculated from the difference to the previous/next series range
publicstaticfinalintRSLT_VEL_AWAY=63;// axial velocity (positive - away), range derivative (m/s), calculated from the difference to the previous/next series range
publicstaticfinalintRSLT_VEL_RIGHT=64;// lateral velocity, right ( calculated from angular and RSLT_GRANGE
publicstaticfinalintRSLT_VEL_RIGHT=64;// lateral velocity, right ( calculated from angular and RSLT_GRANGE
publicstaticfinalintRSLT_VEL_UP=65;// lateral velocity, up ( calculated from angular and RSLT_GRANGE
publicstaticfinalintRSLT_VEL_UP=65;// lateral velocity, up ( calculated from angular and RSLT_GRANGE
publicstaticfinalintRSLT_RANGE_LIN=66;// range linear interpolated using previous/next series if the same target is present there
publicstaticfinalintRSLT_RANGE_LIN=66;// range linear interpolated using previous/next series if the same target is present there
publicstaticfinalintRSLT_LEN=RSLT_RANGE_LIN+1;
publicstaticfinalintRSLT_PHASE1_INDEX=67;// target index in phase 1 (to trim) - debug feature
publicstaticfinalintRSLT_PHASE1_SCORE=68;// target index in phase 1 (to set minimal score for phase 1) - debug feature
publicstaticfinalintRSLT_PHASE1_AMP=69;// target index in phase 1 (to set minimal score for phase 1) - debug feature
publicstaticfinalintRSLT_PHASE1_MSCORE=70;// target index in phase 1 (to set minimal score for phase 1) - debug feature
publicstaticfinalintRSLT_PHASE1_VSTR=71;// target index in phase 1 (to set minimal score for phase 1) - debug feature