August 24, 2009

How stereo vision works, in a few pictures

Filed under: computer vision/machine vision/AI,education,mathematics,updates — Peter Saveliev @ 4:05 pm

Image:Left.gif Image:Right.gif

Taking two images of the same scene from two slightly different locations and then matching the items in them pairwise gives you the distances to these items.

The image matching part is crucial and less trivial. For example on the right the corner of the cube may be a good pixel to choose. The rest of image is mainly featureless. The geometry is trivial, below.
Suppose we established a match between a pixel P in image I and pixel Q in image J. Let’s find the distance to what the pixels depict.

Two images with a red pixel in each image representing the same thing:

Image:stereo_vision_1.jpg

We need only to consider only the horizontal line through P,Q to find the distance to the object with the red dot. View from above; the eyes are the foci of the cameras. Black lines are the images:

Image:stereo_vision_3.jpg

“Triangulation”: the object lies on the line from the focus of the camera and its mark on the image. Here the big red dot is the actual location of the object:

Image:stereo_vision_4.jpg

The geometry:

Image:stereo_vision_5.jpg

D is what we are looking for.

The pink, and the blue, triangles are similar. So, after a bit of algebra we have:

D = f(L/d-1),

where d=x+y is simply the distance the pixel moves as we switch from one image to the other, called the disparity.

More details in the article.

Comments are closed.