Feb 25, 2007 - Stereoscopic Images

In my UWB Computer Vision class we had an assignment to write a computer program to calculate 3D depth from a pair of stereoscopic images. The provided images were taken by the first Mars rover. Nothing too special - just a field of Martian rocks.

If you relax your eyes as if you were staring off into space, you may be able to merge them into one image with 3D depth of field. Sort of like the children's ViewMaster toy, or the "Magic Eye" posters. Our assignment task was to make a new image representing the distance of the objects in the image.

left left

The way this was done was by overlapping the images and finding out which parts matched best. Some parts matched best when the images were directly on top of each other (the far parts). Other parts matched best when the images were slid over each other (the close parts - like when you cross your eyes to look at something very close).

The first image from the program sort of looks like a topographical map. Each color represents a difference in best match of one image pixel. (It was slid over by one pixel.) The light colors are nearest. That rock face in the middle right has an almost constant distance, so the light colors go up there.


The next image estimates distance between pixels, so the distances calculate out smoothly.


The program had to be written in the C++ language for the class. However, I am much more experienced with LabVIEW, so that is what I wrote it in first. Then I translated it into C++. The graphical nature of LabVIEW made it easier to get everything working first.

When I converted to C++, there were very few issues. On the last section I spent something over an hour typing stuff in. After I fixed a couple of punctuation issues, the program ran perfectly! YESSS! It should always be this smooth (but so rarely is).

The programming assignment is due on Thursday, so for the first time I done well before the due date. That just means I can work on a second homework task for the class! Got to keep working.