I'm working on a project right now in which we are developing an autonomous robot. I have to basically find out the distance travelled by the robot between any 2 intervals. I'm using OpenCV, and using the Optical Flow functions of OpenCV, I'm able to find out the velocity/distance of each pixel in 2 different images. Using this information, I want to be able to find out the distance travelled by the robot in the interval between those 2 images.
I thought of a way in which we could develop an input output mapping between the distance travelled by pixels and the distance travelled by the bot (using some tests). In this way, using neural networks, we would be able to find the relationship. However, the optical flow would depend on the distance of the camera from the pixel, which would cause problems.
Is there any way to solve this problem?
I hope you do end up accepting answers you received in the past. Anyway, I had posted the solution to this problem on SO (in OpenCV) a while back, so here it is:
How can I determine distance from an object in a video?
have you considered doing odometry? You can use encoders as well as accelerometers to calculate distance. Is way more cheaper.
What about finding distance with help of no of rotation a wheel rotated in particular distance.
Distance=no of rotation* circumference of wheel
The answer offered by Jacob is the right path to pursue, but you are likely to find that the resulting distance-traveled information is fairly noisy. You may want to consider using Kalman filters to improve your localization estimates over time.
There is a very large body of literature on Kalman filters, but I've listed one relevant paper below.
Larry H. Matthies, Richard Szeliski, and Takeo Kanade (1989). "Kalman Filter-based Algorithms for Estimating Depth from Image Sequences
", International Journal of Computer Vision, Vol 3, No. 3, September, pp 209–236.