Skip to content

trackforge / utils / kalman


Module kalman

Quick Reference

Item Kind Description
KalmanFilter struct A standard Kalman Filter implementation for bounding box tracking.
CovarianceMatrix type
MeasurementMatrix type
MeasurementVector type
StateVector type

Types

KalmanFilter

struct KalmanFilter {
    // [REDACTED: Private Fields]
}

A standard Kalman Filter implementation for bounding box tracking.

Ref: "Simple Online and Realtime Tracking with a Deep Association Metric" (DeepSORT)

Implementations

fn new(std_weight_position: f32, std_weight_velocity: f32) -> Self

Create a new Kalman Filter instance.

fn initiate(&self, measurement: &MeasurementVector) -> (StateVector, CovarianceMatrix)

Initiate the Kalman Filter state from a measurement.

# Arguments

Argument Description
measurement The initial measurement vector [x, y, a, h].

# Returns

A tuple containing the initial Mean vector and Covariance matrix.

fn predict(&self, mean: &StateVector, covariance: &CovarianceMatrix) -> (StateVector, CovarianceMatrix)

Predict the next state of the Kalman Filter.

# Arguments

Argument Description
mean The current state mean vector.
covariance The current state covariance matrix.

# Returns

A tuple containing the predicted Mean vector and Covariance matrix.

fn update(&self, mean: &StateVector, covariance: &CovarianceMatrix, measurement: &MeasurementVector) -> (StateVector, CovarianceMatrix)

Update the Kalman Filter state with a new measurement.

# Arguments

Argument Description
mean The predicted state mean vector.
covariance The predicted state covariance matrix.
measurement The new measurement vector [x, y, a, h].

# Returns

A tuple containing the updated Mean vector and Covariance matrix.

fn gating_distance(&self, mean: &StateVector, covariance: &CovarianceMatrix, measurements: &[MeasurementVector]) -> Vec<f32>

Calculate the Mahalanobis distance between the track state and measurements.

# Arguments

Argument Description
mean The current state mean.
covariance The current state covariance.
measurements A list of measurements to compare against.
only_position If true, only use the position (x, y) components (not implemented). For this implementation, we use the full measurement vector [x, y, a, h].

# Returns

A vector of distances, one for each measurement.

Trait Implementations

impl Clone for KalmanFilter

fn clone(&self) -> KalmanFilter

impl Debug for KalmanFilter

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

impl Default for KalmanFilter

fn default() -> Self

impl<R> ReadPrimitive<R> for KalmanFilter

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

fn is_in_subset(&self) -> bool

fn to_subset_unchecked(&self) -> SS

fn from_subset(element: &SS) -> SP

CovarianceMatrix

type CovarianceMatrix = nalgebra::SMatrix<f32, 8, 8>;

MeasurementMatrix

type MeasurementMatrix = nalgebra::SMatrix<f32, 4, 8>;

MeasurementVector

type MeasurementVector = nalgebra::SVector<f32, 4>;

StateVector

type StateVector = nalgebra::SVector<f32, 8>;