String title = model_prefix+"-PRE-SELECT-n"+niter;
String title = model_prefix+"-PRE-SELECT-n"+niter;
ImagePlus imp_pre_select = showTargetSequence(
ImagePlus imp_pre_select = showTargetSequence(
...
@@ -8141,7 +8116,6 @@ public class CuasMotion {
...
@@ -8141,7 +8116,6 @@ public class CuasMotion {
}
}
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
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
cuasMotion.getNoiseNeibs(), // final int [] noise_neibs,
cuasMotion.getNoiseNeibs(), // final int [] noise_neibs,
// cuasMotion.getNoiseMap(), // final double [] noise_map,
// noisemax, // final double noise_max,
target_horizon, // final double lma_horizon, // horizon as maximal pixel Y
target_horizon, // final double lma_horizon, // horizon as maximal pixel Y
cuasMotion.tilesX); // final int tilesX,
cuasMotion.tilesX); // final int tilesX,
getScore(
getScore(
...
@@ -8528,6 +8503,15 @@ public class CuasMotion {
...
@@ -8528,6 +8503,15 @@ public class CuasMotion {
sortMultiTargets(
sortMultiTargets(
target_sequence_multi, // final double [][][][] target_multi,
target_sequence_multi, // final double [][][][] target_multi,
true); // final boolean trim_nulls) { // trim null targets
true); // final boolean trim_nulls) { // trim null targets
int [] num_duplicates = removeWeakerDuplicates( // needs sortMultiTargets and after
target_sequence_multi, // final double [][][][] target_multi,
duplicate_tolerance); // final double pix_tolerance)
if (debugLevel > -4) System.out.println("Removed "+num_duplicates[1]+" good duplicate targets (total with bad - "+num_duplicates[0]+").");
sortMultiTargets(
target_sequence_multi, // final double [][][][] target_multi,
true); // final boolean trim_nulls) { // trim null targets
trimTargets( // limit number of targets per tile
trimTargets( // limit number of targets per tile
target_sequence_multi, // final double [][][][] target_multi,
target_sequence_multi, // final double [][][][] target_multi,
trim_first); // final int max_targets) {
trim_first); // final int max_targets) {
...
@@ -8576,7 +8560,6 @@ public class CuasMotion {
...
@@ -8576,7 +8560,6 @@ public class CuasMotion {
}
}
int [][] filter5 = filter5Targets( // will ignore failed tiles
int [][] filter5 = filter5Targets( // will ignore failed tiles
// 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
...
@@ -8624,9 +8607,6 @@ public class CuasMotion {
...
@@ -8624,9 +8607,6 @@ public class CuasMotion {
break;
break;
}
}
// render and process in centered mode
// render and process in centered mode
// double [][][] targets_nonoverlap = applyFilter( // motion vectors // will have nulls not top try
// motion_sequence, // double [][][] motion_scan,
// filter5); // boolean [][] filter5)
double [][][] targets_nonoverlap = applyFilter( // motion vectors // will have nulls not top try
double [][][] targets_nonoverlap = applyFilter( // motion vectors // will have nulls not top try
// By Claude on 05/05/2026 — re-correlate with spatial mask around known target
// By Claude on 05/05/2026 — re-correlate with spatial mask around known target
if (recalc_mv_num > 0) {
if (recalc_mv_num > 0) {
effective_boost = recalc_mv_boost; // virtual exposure scale used in refineMotionVectors()
effective_boost = recalc_mv_boost; // virtual exposure scale used in refineMotionVectors()
intcorr_offset_scale=(int)Math.round(recalc_mv_boost);// TODO: promote to config or derive from other params
// int corr_offset_scale = (int) Math.round(recalc_mv_boost); // TODO: promote to config or derive from other params
refineMotionVectors(
refineMotionVectors(
clt_parameters, // CLTParameters clt_parameters,
clt_parameters, // CLTParameters clt_parameters,
batch_mode, // boolean batch_mode,
batch_mode, // boolean batch_mode,
...
@@ -8792,8 +8772,6 @@ public class CuasMotion {
...
@@ -8792,8 +8772,6 @@ public class CuasMotion {
slow_score, // double slow_score,
slow_score, // double slow_score,
batch_mode, // boolean batch_mode,
batch_mode, // boolean batch_mode,
debugLevel); // int debugLevel);
debugLevel); // int debugLevel);
//int
num_new += addNewResults(
num_new += addNewResults(
target_sequence_multi, // final double [][][] target_sequence, // will only process non-nulls here
target_sequence_multi, // final double [][][] target_sequence, // will only process non-nulls here
targets_new_multi, // final double [][][] new_sequence,
targets_new_multi, // final double [][][] new_sequence,
...
@@ -8807,7 +8785,6 @@ public class CuasMotion {
...
@@ -8807,7 +8785,6 @@ public class CuasMotion {
}
}
}
}
if (accum_base) {
if (accum_base) {
// int corr_offset_scale = 4; // (int) Math.round(recalc_mv_boost); // TODO: promote to config or derive from other params
// Andrey 05/05/2026 moved here (earlier) so shiftAndRenderAccumulate() will use updated motion vector
// Andrey 05/05/2026 moved here (earlier) so shiftAndRenderAccumulate() will use updated motion vector
// By Claude on 05/05/2026 — re-correlate with spatial mask around known target
// By Claude on 05/05/2026 — re-correlate with spatial mask around known target
if (recalc_mv_num > 0) {
if (recalc_mv_num > 0) {
...
@@ -9220,9 +9197,6 @@ public class CuasMotion {
...
@@ -9220,9 +9197,6 @@ public class CuasMotion {
// new results are sorted by decreasing amplitude, there should be only one - test it. If not still use only the first
// new results are sorted by decreasing amplitude, there should be only one - test it. If not still use only the first
// continue niter for "when"
// continue niter for "when"
// keep only one (best) result for centered getAccumulatedCoordinatesMulti()
// keep only one (best) result for centered getAccumulatedCoordinatesMulti()
if (save_filtered_low && debug_more) {
if (save_filtered_low && debug_more) {
String title = model_prefix+"-NEW-TARGETS"+(centered?"-CENTERED":"")+"-n"+niter;
String title = model_prefix+"-NEW-TARGETS"+(centered?"-CENTERED":"")+"-n"+niter;
if (boost_accum_pairs > 1.0) {
if (boost_accum_pairs > 1.0) {
...
@@ -9301,349 +9275,7 @@ public class CuasMotion {
...
@@ -9301,349 +9275,7 @@ public class CuasMotion {
* @param debugLevel
* @param debugLevel
* @return
* @return
*/
*/
/*
@Deprecated
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 [][][][] 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
final boolean use_motion_in, // true - use motion vectors confidence, false - use target confidence
final boolean select_new_in, // true - use only untested tiles, false - use good tiles
// when using good ones - will select first good one (best if correctly ordered)
final double min_confidence, // 0 OK
final double lma_horizon, // target below horizon
final int tilesX,
final int range, // 1 or 2
final int [] remain,
final int [] passes, // debugging - number of passes required
final int debugLevel){
final boolean use_motion = use_motion_in; // By Claude on 05/07/2026: decouple from motion_sequence presence
final boolean select_new = select_new_in; // By Claude on 05/07/2026: decouple from motion_sequence
boolean debug_now = (debugLevel<5);
final int num_seq = target_sequence_multi.length;
final int num_tiles = target_sequence_multi[0].length;
final int tilesY = num_tiles/ tilesX;
final int [][] filter5 = new int [num_seq][num_tiles];
final Thread[] threads = ImageDtt.newThreadArray();
final AtomicInteger ai = new AtomicInteger(0);
final int dbg_tile = debug_now ?(51+38*80) : -1;
final int dbg_seq0 = debug_now ? 27: -1;
final int dbg_seq1 = debug_now ? 29: -1;
final int ihorizon = (lma_horizon > 0) ?( (int) Math.ceil(lma_horizon/GPUTileProcessor.DTT_SIZE)) : -1; // tiles with tileY >= ihorizon are removed
// removing final double [][][] motion_sequence, // AF 05/22/2026
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 [][][][] target_sequence_multi, // not null
final double [][][][] 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 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]