My favorites | Sign in
Project Logo
                
Search
for
Updated Nov 25, 2007 by fuzzgun
Labels: webcam
HowToMakeAStereoCamera  
Make your own stereo camera

You don't need to use prohibitively expensive dedicated hardware to be able to experiment with stereoscopic vision. Most webcams these days are of a reasonable quality and have a sufficiently high frame rate to be practical on slow moving domestic robots.

Here's how to build a stereo camera in 30 minutes at a cost of under 30 quid (about $60).

Choose your cameras

There are zillions of webcams now on the market, and the models and megapixels are constantly changing. Firstly I should say that both cameras should be of an identical model. This might seem obvious, but I have seen folks in the past try to do stereo using two entirely different cameras and they soon get themselves into trouble. Quite apart from any aesthetic considerations using the same model ensures that the optics of both cameras will be somewhat similar and they will have the same field of view and focal lengths.

If possible try to acquire webcams which use a CCD chip, rather than the CMOS type. CMOS cameras are ok in most situations, but under low illumination conditions such as artificial lighting (especially the low intensity energy saving light bulbs) CCD has superior performance characteristics. Another alternative is to use a camera which has its own LED illumination, although this could be problematic in borderline situations where the LEDs might switch on and off erratically. If you can't find any CCD based cameras, or they're too expensive, just stick with good old CMOS.

In the world of digital photography megapixels rule. However, for a stereo vision system you actually don't need a particularly high resolution. 640x480, or even a mere 320x240 pixels are quite adequate for ranging of distances up to about three metres. When selecting cameras think cheap and nasty rather than top of the range. Any extraneous features or software (other than the driver) are strictly surplus to requirements.

If possible try to use cameras with a wide field of view. The standard field of view for webcams (at the time of writing) is 40 degrees horizontal and 20 degrees vertical. There are a few with a wider view than this. A wide field of view just means that the robot can see more of what's ahead at one time than would otherwise be the case, so things like obstacle avoidance or feature tracking work better.

For this system I'm going to use the Creative Webcam NX Ultra. It's not the smallest webcam you've ever seen, but it has a wide 78 degree field of view and uses a CCD chip. Most important of all, they only cost 13 pounds each on eBay.

Construction

You'll need something to mount the cameras onto as a backplate. For this I used a piece of strip aluminium from a local DIY store. The metal is light, yet thick enough not to bend easily - a very important property for a mobile robot.

Cut off a strip of metal so that you can mount the cameras onto it with a baseline separation of 100mm between the centres of each lens. Why 100mm? Well, there doesn't seem to be any general agreement on an appropriate baseline distance for mobile robot stereo vision. It's just down to personal preference, and 100mm seems like a round number in the right sort of ballpack. In the past I have used 70mm and 140mm spacings.

The Creative webcams which I'm using are conveniently held together with screws which can be easily removed (it's almost as if they designed them to be dissassembled!). Remove the top two screws from each camera, then drill holes in the aluminium strip using an appropriately sized bit, like this:

Final assembly

Now its time to assemble the whole caboodle. The stereo camera singularity is near. Screw the cameras onto the metal backplate, and make sure that they're secure. In my case I found that the screws weren't long enough, and instead used some small screws which came with radio control servos as a substitute. You may also wish to drill a few holes in the centre of the metal strip to allow the system to be securely bolted onto your robot.

And that's all there is to it. The next step is camera calibration, and then the system is ready to be used as a fully operational ranging device.


Comment by m...@erroraccessdenied.com, Nov 05, 2007

Would spacing them farther apart help with identifying "far-off" objects?

Comment by fuzzgun, Nov 25, 2007

Yes, spacing the cameras farther apart would enable you to more easily resolve more distant objects. However, when the camera baseline is larger the maximum possible stereo disparity is also a larger percentage of the image width and so the stereo correspondence algorithm has to work a little harder with a greater chance of false matches.

There doesn't seem to be any general agreement upon how far apart is a good distance for stereo in a typical domestic or office environment, with different researchers choosing different values (but usually somewhere in the 6-12cm range).

Also building robots is always a matter of compromise. The wider the baseline becomes the more unwieldy and prone to damage the head of the robot becomes, so you should also consider the design of the camera system in the context of the overall layout.

Comment by j...@binford3000.de, Jan 03, 2008

I'd like to build a stereo camera based on your guide but I'm wondering what kind of focus the cameras ought to have. Somebody told me that auto-focus isn't desirable, because the cameras might focus on different distances, leading to a lot of false correspondences. I just want to make sure that I buy the right cameras.

Comment by fuzzgun, Jan 20, 2008

I think that was good advice. Having the cameras continually changing their focus could be quite disastrous for stereo matching. For matching you really want the two images to be as similar to each other as possible, apart from the spatial separation. With autofocus enabled the left camera image could be substantially different from the right.

Comment by lylee80, Jun 11, 2008

may i know how do u synchronize the 2 USB webcam? through hardware or software?

Comment by roumenpopov, Aug 01, 2008

I've also found it useful to change the optics of the cams with wider angle, e.g. 100 deg. Standard webcams have pretty poor field-of-view, usually about 30 deg, which gives the robot a view on only a small part of the scene at once. With wider view, spacial relations between objects are more accurate, because no moving parts are involved, when determining the relative angular position of objects.

I've found a relatively easy way to change the optics of Logitech QuickCam? webcams http://www.amazon.co.uk/Logitech-Quickcam-Messenger-camera-colour/dp/B000JK8RWY/ref=sr_1_2?ie=UTF8&s=electronics&qid=1217583567&sr=8-2

Maplin in UK sells a 150 deg optics which is compatible with the socket of Logitech QuickCam? webcams http://www.maplin.co.uk/Module.aspx?ModuleNo=19631&C=Maplin&U=SearchTop&T=lense&doy=1m8

You just need to unscrew the original optics and screw in the wide angle optics. Oh, you also need to take the IR filter from the back of the original optics and glue it to the cam socket. That is all.

Unfortunately, because of the small size of the sensor, the resulting field-of-view is only about 100 deg.

Comment by wheagy, Dec 08, 2008

Hi..how does the two webcam setup work on a PC? Do they simply plug into USB ports and get recognized as two separate cameras? Seems like there would be driver conflicts? Thanks.


Sign in to add a comment
Hosted by Google Code