Hello,
the idea of using a Kalman filter for object tracking is to attenuate the noise associated with the position detection of the object based on estimating the system state. It can also be used to predict the position based on the state transition model when no new measurements are available. The Kalman filter has two phases - the prediction and the correction phase. In order to familiarize yourself with the Kalman filter, I recommend reading the following paper:
"An Introduction to the Kalman Filter" by Greg Welch and Gary Bishop.
There are also numerous other resources regarding the Kalman filter online (for example: http://bilgin.esme.org/BitsBytes/KalmanFilterforDummies.aspx), so I will not dwell on the mathematics behind the algorithm.
In order to use the Kalman filter, the object must be moving with constant velocity or accerelation (depends on the state transition model). The example I am showing here uses a constant velocity model, although you can rebuild the C++ code to consider the constant accerelation model (see the attached C++ code). Remember to modify the parameters of the Kalman object constructor in addition to the state transition model, when alternating between the constant velocity and accerelation models.
Below is the mouse tracking example (see the attachment for the code):
Figure 1. Kalman mouse tracker (red curve - the mouse position, white curve - corrected/estimated state)
Additionally, I've implemented the Kalman filter on meanshift object tracking (see the attachment for the code):
Figure 2. Object tracking using meanshift and Kalman filter (red curve - meanshift algorithm, black curve - corrected/estimated state).
The Kalman filter is the OpenCV's (2.4.9) implementation, called in Labview (2013) as a .dll. I am attaching the C++ source code, the .dll and the two examples shown in the two figures above. There are some additional comments in the code.
Hope this helps someone.
Best regards,
K
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.