# Multi-target Tracking: calculate the association gate from Kalman filter

I'm trying to implement a multi target tracking with Kalman filter. Each object has an instance of Kalman Filter. The true position of the objects $(x,Y)$ are the corrected state out of the KF after the prediction and correction steps. Till now everything is clear.

For associating observations to objects I'm using till now euclidean distance. But I've read here that a more raffinate distance could be used: the mahalanobis distance, that take in account the shape of the association gate. This shape, due to the fact the KF deals with gaussian pdf is an ellipsoid, there the mean is the center and the shape is the covariance.

Now, I'm stucked on where to get this two parameters. I think that for the mean I can take the predicted state out of KF. But what about the covariance matrix?

In particular I'm using the OpenCV implementation of Kalman Filter, and, reading in the source, I have those two matrixes that are updated each prediction step:

Mat errorCovPre;        //!< priori error estimate covariance matrix (P'(k)): P'(k)=A*P(k-1)*At + Q)*/
Mat errorCovPost;       //!< posteriori error estimate covariance matrix (P(k)): P(k)=(I-K(k)*H)*P'(k)


I'm not really into the probabilistic derivation of the Kalman filter so.. what is the right one?

• Sep 11, 2019 at 13:32

• ok, very cool! what about if I want to draw it? I have a function like void ellipse(Point center, Size axes, double angle) and I want to draw the ellipsoidal gate centred in the mean (the predicted state) and as a shape an ellipsoid given from the S matrix? Do I need also a threshold parameter, right? How can I get the axes length and the angle to describe the ellipsoid? Feb 13, 2014 at 22:23