How to build a 3D scanner with a webcam and a hand-held laser

We used some thick plastic for constructing our enclosure, but wood or glass would work equally well. Set your engineer's square down on a flat surface and place the two sides of your enclosure so that they stand with the inside corners touching.

Tape a pair of hinges onto the back of the enclosure using strong adhesive tape. We used gaffer tape, but normal sticky tape or even packing tape would be fine. Take your time and make sure that the two sides of the enclosure are properly aligned. When you're satisfied that they are standing straight, plug in your glue gun and let it heat up until the glue flows freely when you pull the trigger.

Carefully put a long trail of hot glue into the crevice at the back of the enclosure, making sure that the glue is applied right into the corner. Be careful not to nudge the enclosure, or put any pressure on it with the tip of the glue gun. Keeping the engineer's square pressed up against the bottom of the enclosure, you should make constant checks to ensure that it's still at 90 degrees.

When you're satisfied that the two halves are glued together and the glue has cooled, you can carefully move the enclosure about without a base. Remember that hot glue doesn't make a particularly strong bond and the sides will snap apart easily if you're not careful. Whenever you move your enclosure, use the engineer's square to check that it's still at 90 degrees. There should be a few degrees of flex in the joint so that you can easily fix any distortions.

If you somehow end up with a distortion that you can't easily bend back into shape, warm the hot glue with a hair drier to soften it and bend the enclosure gently back into shape. Finally, attach the calibration image to the inside of the enclosure and you're ready to start using DAVID.

Calibrating DAVID

When your enclosure is finished, you need to set up your camera for calibration. Make sure the enclosure is pointing directly at the camera, and that calibration image is taking up as much room on the screen as possible.

The calibration phase is easily the most frustrating thing about DAVID. The key is to shine as much light on the enclosure as you possibly can. For our calibration, we found that pointing three or more lamps at it helped immeasurably.

Start DAVID and click the 'Settings' button on the calibration pane. Turn off any automatic control. You need to adjust your brightness and contrast settings so that the image of the calibration markers is totally black and white. When you see that result, click 'Calibrate Camera' in the box.

If it doesn't work, go to the Eraser tab and add a mask to the image. Use the left mouse button to apply masking to areas that are being detected and try again. Repeat the masking process until the calibration is successful.

If you find that the software is telling you that calibration is successful but that the points it produces seem random (not in the centre of each calibration marker, for example), make sure that your calibration paper is not distorted. If in doubt, shine even more light at it.

When the calibration phase has been completed successfully, you can move on to scanning.

Scanning the model

Scanning is more art than science. You need to work in a darkened room and calibrate the camera so that it only picks out the line of the laser. You should also set the camera to black and white mode.