Skip to content

trackforge / trackers / common / cmc


Module cmc

Camera motion compensation (CMC) shared across trackers.

A CameraMotion is a 2x3 affine transform that maps coordinates from the previous frame into the current frame. Callers estimate it however they like (for example image registration with OpenCV in a demo) and pass it to a tracker's update; the tracker warps its predicted track states so motion association stays valid under a moving camera. Trackers that consume it (Deep OC-SORT today, BoT-SORT and StrongSORT++ in the future) all apply it the same way through [super::KalmanTrack::apply_camera_motion].

Quick Reference

Item Kind Description
CameraMotion struct A 2x3 affine camera-motion transform [[a, b, tx], [c, d, ty]].

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