Did you know that you can make an accurate 3D scanner without whizzing robot arms, expensive lasers, highly priced software and a doctorate in several arcane sciences?
As it turns out, if you simply outsource that last bit to the scientists; everything else is relatively cheap and easy to obtain.
That's how the DAVID Laser Scanner came into existence. It's the result of work carried out by some academics who decided that there must be a way to grab depth and contour information with a single camera and some simple references.
The software only needs a pair of these references to copy a real object into a computer representation. A 90-degree scanning enclosure and a line laser do the hard work at your end. Both are known quantities, which means that by shining the laser at the enclosure, we see a bright 'V' of light that precisely describes the plane of the laser.
If we place an object in the scanning enclosure and point the same laser at it, we will still have the same references for the plane of the laser – but now the laser will also describe a contour of the object. Then, by taking the known references, you can interpolate that contour into a set of points – or vertices – in 3D space.
The concept is simple, but it relies entirely on the accuracy of the enclosure and the proper calibration of the camera image.
First, download the free version of DAVID. There's no installer required to activate the package – you just unzip it to a folder on your computer. You'll also need to make sure that your PC is updated to at least version 2.0 of .NET. This should already be present if you use automatic updates, but you can install it from Windows Update manually or download the distributable version for your edition of Windows directly from microsoft.com if required.
To run DAVID, you need to open the folder that you extracted the application from and run 'Start_David.bat' or 'David- Laserscanner.exe'. The batch file checks that you have .NET 2.0 installed, so if you know what you're doing you can run the executable directly.
You can have a play with the software if you grab the 'AngelScan.zip' file from the Downloads section on the DAVID site. Unzip the file and drop the enclosed AVI files onto your computer. Open DAVID and work your way through to the Calibration page. Select 'Video Grabber' in section one and then find the 'angel_calib_wmv.avi' file in the Open dialog that pops up. This opens up the calibration video. Click 'Calibrate Camera' and then click 'Next'.
Now click the 'Camera' button in section one and open the 'angel_scan-wmv.avi' file to load the scanning video. The example video should start playing. Click the 'Start' button in section one and DAVID will start building the 3D model. You'll notice that the gradients between the colours in the sample model are well defined, with relatively little graphical noise or holes.
Next, take a look at the speed that the laser is scanning at and observe how the full data is collected in just a couple of passes. Click 'Show 3D' in section three and you'll see the scan in 3D. That's the kind of quality you should be looking for when you start scanning your own objects. But before you can do that, you need to build your own enclosure.
Building the enclosure
The accuracy of your enclosure is the most important part of the scanning system. The sides need to be free of distortion, and set at exactly 90 degrees. If you aren't able to get the correct angle, then the calibration will be incorrect and the scanned model distorted.
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.
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.
The most accurate results are gained by using a true black and white camera. When you're satisfied with the settings, click the 'Start' button in the DAVID scanner and slowly pan the laser line over your subject.
The software needs to be able to locate a definite 'V' on the enclosure, so you will need to keep the laser up quite high. It may be tempting, but it's counter-productive, to keep scanning the laser up and down multiple times, as this will generate a lot of noise.
Do one scan from one side of the subject, and then do another from the other side. This goes a long way towards filling unwanted holes in the scan. Try to move the laser as slowly and steadily as possible. You'll get much better results if you are able to attach the laser to a tripod with a pivot mechanism.
If you want to apply a texture to the scanned model, you will need to turn the lights back on and then reset the camera's settings. All you have to do then is click the 'Grab Texture' button and the texture will be automatically applied. Be very careful to use the same lighting conditions and camera settings each time you grab the texture or your finished model will be a patchwork of different colours. Try to light the subject evenly, and avoid shadows wherever possible.
To finish up, you can smooth your model with judicious use of the 'Interpolation' and 'Filtering' buttons. The instinct is to go overboard with the filters, but try not to overdo it or you'll lose most of the fine data. Check that you're satisfied with the produced 3D model and save it.
You'll need to rotate the model and repeat the scanning procedure several times to grab the full subject. Try to have a bit of overlap between each scan, as this will make stitching a lot easier.
Stitching the model
Saving stitched models isn't possible in the free version of DAVID, but you can download MeshLab if you want to go any further for free.
Open MeshLab, then open the first scan and next open the subsequent scans inside the first one. To start stitching, click the big 'A' on the toolbar, select the first entry in the list and click 'Glue Mesh Here'. Now you need to start gluing the other meshes to the first one. Select the second entry and then click on 'Point- Based Gluing'.
A new window will open, showing the two objects you selected for stitching. You need to select four points on the first scan that correspond to points on the second scan. Try and spread the points out as much as you possibly can to give the application a lot of 3D data to work with. If you don't, then MeshLab will do a poor job of meshing the two scans together.
If it's wrong, just unglue the second scan and try again. When you're finished, quit the Stitching tool and either flatten the layers and save as an OBJ file or keep the layers and save as an AIN file.
You can now take your finished 3D scan and import it into almost any 3D-modelling application, from Google Sketchup to Maya. The object will appear in these programs just as you made it, and to the correct scale.
First published in PC Plus, Issue 278
Sign up for the free weekly TechRadar newsletter
Get tech news delivered straight to your inbox. Register for the free TechRadar newsletter and stay on top of the week's biggest stories and product releases. Sign up at http://www.techradar.com/register