1 | initial version |
What you intend to use is a prediction/correction approach. Fortunately, OpenCV has one built-in: the Kalman filter. Have a look at the documentation and the sample in cpp/kalman.cpp. I also suggest you have a look at the Wikipedia page (as referenced in the documentation) to be sure you understand how it works).
Basically, the Kalman filter will make a prediction of where the next position should be, that you will correct with the measurement you retrieve (you robot next move probably in this case). You need also to model the noise of the observation. The "Learning OpenCV" book has a section about this prediction/correction process (not sure about the upcoming release, but it should have it also).