kalman filter
hi to everyone, currently i am working on project where i have to track some blobs in a video sequence and determine when these blobs approaching each other or even to predict possible crash of the blobs. For the detection of the blobs i am using background subtraction and more specifically the integrated Mixture of Gaussian class (i.e. the BackgroundSubtractorMOG2 method). The results are quite nice, so i do not have any problems related to that part, for now :-p. At the end the final information about each blob is extracted by using the contours functions.
Then i have to track these blobs by taking as a reference point the centroid of each blob, which i am extracting by using the moments from the extracted contours. Searching the web and playing around i managed to implement a data association algorithm in order to extract the trajectories of each blob by just using the centroid point and saving this point through the frames to the correspondent blob id. However, this method is quite weak and hard to provide robust results in case of some occlusion or if for some reason the distance between the current centroid point and the previous one is bigger than the threshold that i have specified in order to map each new centroid to one of the blobs. The latter if it fails has as a result to default the previous vector that holds the centroid history of the blob and create a new blob id and creating everything from the beginning. So for that reason i came up with the kalman filter technique, which from what i am reading it can provide me with a certain safety to this kind of problems and furthermore using the prediction part maybe to provide with some prediction information.
After having a look in the theory and knowing that opencv provides a class related to kalman filter i tried to look around for any example which might help me to clear any doubts related to it. However, there is almost nothing, that describes quite step by step how to do it in opencv and especially using the new C++ API of opencv. The only good examples that i came up with are these:
http://www.morethantechnical.com/2011/06/17/simple-kalman-filter-for-tracking-using-opencv-2-2-w-code/ https://code.ros.org/trac/opencv/browser/trunk/opencv_extra/learning_opencv_v2/ch10_ex10_2.cpp
which are more or less describing the basic idea behind kalman but without getting into further details. So, here are coming my questions:
- Do you have in mind or have you met any example related to kalman filter and the new C++ API of opencv where you can point me to. If it can handle multiple tracking that would be great :-).
- For how far can the kalman filter predict, it is only for the next-time instance or can i get a prediction somehow for two or three time instances after, is there a way to customize this.
- In the links above the people are using as ...
More questions come in a new Question - not in the same thread.