Skip to main content

TrackOptions

Struct TrackOptions 

Source
#[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
Non-exhaustive structs could have additional fields added in future. Therefore, non-exhaustive structs cannot be constructed in external crates using the traditional 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: TrackKernel

Arithmetic of the 8-bit tracker. Ignored by FloatTrackerContext.

Implementations§

Source§

impl TrackOptions

Source

pub const fn new() -> Self

The default options: all levels in both passes, TrackKernel::Auto.

Source

pub const fn with_start_level(self, level: usize) -> Self

Starts the forward pass at pyramid level level, see start_level.

Source

pub const fn with_fb_levels(self, levels: usize) -> Self

Runs the backward pass over the finest levels levels, see fb_levels.

Source

pub const fn with_kernel(self, kernel: TrackKernel) -> Self

Selects the arithmetic of the 8-bit tracker.

Trait Implementations§

Source§

impl Clone for TrackOptions

Source§

fn clone(&self) -> Self

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Copy for TrackOptions

Source§

impl Debug for TrackOptions

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Default for TrackOptions

Source§

fn default() -> Self

Returns the “default value” for a type. Read more
Source§

impl Eq for TrackOptions

Source§

impl Hash for TrackOptions

Source§

fn hash<__H: Hasher>(&self, state: &mut __H)

Feeds this value into the given Hasher. Read more
1.3.0 · Source§

fn hash_slice<H>(data: &[Self], state: &mut H)
where H: Hasher, Self: Sized,

Feeds a slice of this type into the given Hasher. Read more
Source§

impl PartialEq for TrackOptions

Source§

fn eq(&self, other: &Self) -> bool

Equality operator ==. Read more
1.0.0 (const: unstable) · Source§

fn ne(&self, other: &Rhs) -> bool

Inequality operator !=. Read more
Source§

impl StructuralPartialEq for TrackOptions

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.