Skip to content

trackforge / trackers / common


Module common

Building blocks shared across the trackers.

TrackState is the common confirm/delete lifecycle used by the IoU and appearance trackers, and KalmanTrack wraps the per-track Kalman state with the predict/update mechanics they all repeat. cmc holds the shared camera motion compensation transform.

Quick Reference

Item Kind Description
cmc mod Camera motion compensation (CMC) shared across trackers.
KalmanTrack struct Per-track Kalman state plus the predict/update steps every tracker repeats.
TrackState enum Lifecycle state of a track.

Modules

  • cmc — Camera motion compensation (CMC) shared across trackers.

Types

CameraMotion

struct CameraMotion {
    pub a: f32,
    pub b: f32,
    pub tx: f32,
    pub c: f32,
    pub d: f32,
    pub ty: f32,
}

A 2x3 affine camera-motion transform [[a, b, tx], [c, d, ty]].

Maps a previous-frame point (x, y) to (a*x + b*y + tx, c*x + d*y + ty). The default is the identity (no camera motion).

Fields

Name Type Description
a f32 Row 0 of the linear part.
tx f32 Horizontal translation.
c f32 Row 1 of the linear part.
ty f32 Vertical translation.

Implementations

fn new(a: f32, b: f32, tx: f32, c: f32, d: f32, ty: f32) -> Self

Build a transform from the six affine coefficients.

fn identity() -> Self

The identity transform (no camera motion).

fn is_identity(&self) -> bool

Whether this transform is the identity, so application can be skipped.

fn apply_state(&self, mean: &mut StateVector, covariance: &mut CovarianceMatrix)

Warp a Kalman mean and covariance in place.

fn apply_observation(&self, obs: &mut MeasurementVector)

Warp an XYAH observation [cx, cy, aspect, height] in place.

Trait Implementations

impl Clone for CameraMotion

fn clone(&self) -> CameraMotion

impl Copy for CameraMotion
impl Debug for CameraMotion

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

impl Default for CameraMotion

fn default() -> Self

impl Read<Exclusive, BecauseExclusive> for CameraMotion
impl<R> ReadPrimitive<R> for CameraMotion

fn to_subset(&self) -> Option<SS>

fn is_in_subset(&self) -> bool

fn to_subset_unchecked(&self) -> SS

fn from_subset(element: &SS) -> SP

KalmanTrack

struct KalmanTrack {
    pub mean: crate::utils::kalman::StateVector,
    pub covariance: crate::utils::kalman::CovarianceMatrix,
}

Per-track Kalman state plus the predict/update steps every tracker repeats.

Holds the 8-dimensional mean and covariance and applies the shared KalmanFilter. The owning track keeps its own box, score, and lifecycle fields and delegates the filtering to this type.

Fields

Name Type Description
mean crate::utils::kalman::StateVector Kalman filter state mean ([x, y, a, h, vx, vy, va, vh]).
covariance crate::utils::kalman::CovarianceMatrix Kalman filter state covariance.

Implementations

fn initiate(measurement: &MeasurementVector, kf: &KalmanFilter) -> Self

Initialise the filter from a first measurement in XYAH form.

fn predict(&mut self, kf: &KalmanFilter) -> [f32; 4]

Run one Kalman prediction step and return the refreshed TLWH box.

fn update(&mut self, measurement: &MeasurementVector, kf: &KalmanFilter)

Correct the state with a matched measurement in XYAH form.

fn apply_camera_motion(&mut self, cmc: &CameraMotion) -> [f32; 4]

Warp the Kalman state by a camera motion transform and return the new TLWH box.

Trait Implementations

impl Clone for KalmanTrack

fn clone(&self) -> KalmanTrack

impl Debug for KalmanTrack

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

impl Read<Exclusive, BecauseExclusive> for KalmanTrack

fn to_subset(&self) -> Option<SS>

fn is_in_subset(&self) -> bool

fn to_subset_unchecked(&self) -> SS

fn from_subset(element: &SS) -> SP

TrackState

enum TrackState {
    Tentative,
    Confirmed,
    Deleted,
}

Lifecycle state of a track.

A track starts Tentative, becomes Confirmed once it has accumulated enough matches, and is Deleted when it ages out or fails confirmation.

Variants

  • Tentative

Newly created; not yet confirmed by enough matches.

  • Confirmed

Confirmed active track returned to callers.

  • Deleted

Marked for removal.

Trait Implementations

impl Clone for TrackState

fn clone(&self) -> TrackState

impl Copy for TrackState
impl Debug for TrackState

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

impl Eq for TrackState
impl PartialEq for TrackState

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

impl Read<Exclusive, BecauseExclusive> for TrackState

fn to_subset(&self) -> Option<SS>

fn is_in_subset(&self) -> bool

fn to_subset_unchecked(&self) -> SS

fn from_subset(element: &SS) -> SP