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 measurement parameters the current centroid point each time. Somewhere i read, i cannot recall now the link, that i can use more measurement parameters if i want, which are not related the centroid point of the blob but with some other information of the blob like, the area, bounding box points, height, width, etc. and by doing this i will get some more accurate results to my estimation and prediction. My question is, is that true, and if yes how it is explained.
- Probably except the centroid point, i will need to get the bounding boxes of each blob, should i add this information to the initialization phase of the kalman filter by using more dynamic parameters or it would be better to create different kalman filter for each feature that i want to estimate/predict.
- To be honest i quite confused, for example in the examples above why the do not use the extracted velocity as an addition measurement parameter. If the answer is that i do not have this information in the beginning so i can not use something that i do not have, then i case that i have the velocity from another method could be possible to pass it to the kalman filter not as an unknown.
i do know as i said i am quite confused, and newbie in the subject and i would appreciate if someone could provide me with some further knowledge.
thanks in advace