views:

123

answers:

3

Hi, 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?

+1  A: 

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:

http://stackoverflow.com/questions/2135116/how-can-i-determine-distance-from-an-object-in-a-video/2152097#2152097

Jacob
Is there a way I can find the distance travelled by the robot without trying to find out its distance from objects, by just using Optical Flow?
@user280454 - No, you cannot calculate the distance the robot has traveled from information in a camera frame without knowing the distance of the robot to that camera frame. However, Jacob's answer above describes how to obtain the distance using optical flow information. It may be complicated, but that's just the nature of doing *anything* in computer vision.
Joel Hoff
A: 

have you considered doing odometry? You can use encoders as well as accelerometers to calculate distance. Is way more cheaper.

dnul
Yes, we've considered that, but we decided it would cause too many errors due to slipping , etc
A: 

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.

Joel Hoff