#[non_exhaustive]pub struct TrackOptions {
pub start_level: Option<usize>,
pub fb_levels: Option<usize>,
pub kernel: TrackKernel,
}Expand description
Options of a tracking call beyond TrackParams, for
TrackerContext::track_with and TrackerContext::track_fb_with and
their FloatTrackerContext counterparts. The default reproduces
track and track_fb.
use optical_flow_lk::TrackOptions;
// Check the round trip on the two finest levels only.
const OPTIONS: TrackOptions = TrackOptions::new().with_fb_levels(2);
assert_eq!(OPTIONS.fb_levels, Some(2));Fields (Non-exhaustive)§
This struct is marked as non-exhaustive
Struct { .. } syntax; cannot be matched against without a wildcard ..; and struct update syntax will not work.start_level: Option<usize>Pyramid level the forward pass starts at, 0 being full resolution.
None starts at the coarsest level; levels above it are clamped to
it. The displacement from predicted (or zero) seeds the start level.
Each level above full resolution doubles the motion the iteration can recover from its seed, about half a window at level 0. Starting lower saves the coarse levels’ work when a prediction (a gyroscope, a constant-velocity model) is already that close, and loses the capture range they give otherwise.
fb_levels: Option<usize>Pyramid levels the backward pass of track_fb_with runs, the finest
ones: Some(k) runs levels k - 1 down to 0, None all of them, as
track_fb does. Must be at least 1; ignored by track_with.
The backward pass tracks the forward results back into the previous frame, seeded at the original points, which a consistent round trip returns to. A correct forward match therefore needs no coarse levels to come back. Fewer levels make the check cheaper and slightly more permissive: a wrong match that the coarse levels would have carried further away can stay within the threshold. On the bundled example pair, see the changelog of 0.6.0 for how many points change status.
kernel: TrackKernelArithmetic of the 8-bit tracker. Ignored by FloatTrackerContext.
Implementations§
Source§impl TrackOptions
impl TrackOptions
Sourcepub const fn new() -> Self
pub const fn new() -> Self
The default options: all levels in both passes, TrackKernel::Auto.
Sourcepub const fn with_start_level(self, level: usize) -> Self
pub const fn with_start_level(self, level: usize) -> Self
Starts the forward pass at pyramid level level, see
start_level.
Sourcepub const fn with_fb_levels(self, levels: usize) -> Self
pub const fn with_fb_levels(self, levels: usize) -> Self
Runs the backward pass over the finest levels levels, see
fb_levels.
Sourcepub const fn with_kernel(self, kernel: TrackKernel) -> Self
pub const fn with_kernel(self, kernel: TrackKernel) -> Self
Selects the arithmetic of the 8-bit tracker.