Function best_match

Source
pub fn best_match(
    f: &Frame,
    tpl: &[f32],
    hw: i32,
    hh: i32,
    cx: i32,
    cy: i32,
    search: i32,
) -> Option<(i32, i32, f32)>
Expand description

Best zero-mean NCC match for tpl (a patch of the same half-sizes) within search px of (cx, cy): the matched centre and its score in -1..=1. None when the template or every candidate window is flat — there is nothing to lock onto, and the caller keeps the previous position.

ponytail: brute-force scan, O(search² · patch) per frame — fine at the sizes the pane offers. Go to a coarse-to-fine image pyramid if a 4K search radius ever needs to be interactive.