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

gaussian processkalman filternormal distribution

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?

Best Answer

It is actually neither of these covariance matrices. The covariance "S" in the Mahalanobis distance is the covariance of the residual vector (difference between the predicted Kalman measurement "z_hat" and the measurement "z" you are attempting to associate). Thus, S = errorCovPre + R where R is the measurement covariance matrix, which is often specified as a diagonal matrix containing the variance of each measurement dimension contained in the measurement vector "z". It is also important to remember that z_hat = H * x_predicted where x_predicted is the predicted state of the Kalman filter and "H" is the observation matrix that maps the state space into the measurement space.

Related Question