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?