trackforge / utils / kalman
Module kalman
Quick Reference
| Item | Kind | Description |
|---|---|---|
KalmanFilter |
struct | A standard Kalman Filter implementation for bounding box tracking. |
CovarianceMatrix |
type | 8×8 state covariance matrix. |
MeasurementMatrix |
type | 4×8 observation matrix mapping state space to measurement space. |
MeasurementVector |
type | 4-D measurement vector [x, y, a, h] (centre-x, centre-y, aspect ratio, height). |
StateVector |
type | 8-D Kalman state vector [x, y, a, h, vx, vy, va, vh]. |
Types
KalmanFilter
A standard Kalman Filter implementation for bounding box tracking.
Ref: "Simple Online and Realtime Tracking with a Deep Association Metric" (DeepSORT)
Implementations
Create a new Kalman Filter instance.
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 each measurement.
Projects the track state into measurement space and computes the squared
Mahalanobis distance using the full [x, y, a, h] measurement vector.
# Arguments
| Argument | Description |
|---|---|
mean |
The current state mean. |
covariance |
The current state covariance. |
measurements |
Measurements to compare against. |
# Returns
A vector of squared Mahalanobis distances, one per measurement.
Trait Implementations
impl<R> ReadPrimitive<R> for KalmanFilter
CovarianceMatrix
8×8 state covariance matrix.
MeasurementMatrix
4×8 observation matrix mapping state space to measurement space.
MeasurementVector
4-D measurement vector [x, y, a, h] (centre-x, centre-y, aspect ratio, height).
StateVector
8-D Kalman state vector [x, y, a, h, vx, vy, va, vh].