Introduction: Make Your Own 3d Scanner!
My goals for this project were as follows:
Make scanner which
*could accurately and correctly produce computer models in 3D
*would work for objects under 1' x 1' x 1' in size
*wouldn't cost more than $20 on the project (Materials I have lying around don't count towards the cost, but including these materials, the scanner still costs only about $100.)
The final product works pretty well, and I hope to improve it's usability in the future by further automating it's performance and tweaking the software.
Step 1: The Basic Idea...Overview
In order to locate a point in 3d space, we need to describe one of several things. The simplest would simply be to give three numbers to describe it's position relative to another point in space. This is the format used by most computer models. Another way to describe the point would be to use three planes, or a plane and a line. What you'll see is that it's easiest to describe points in the third way, then convert them to the first to save them to standard format. So the question becomes, how to find the plane and the line? As it turns out, the first question is in the hardware, and the second in the software.
Step 2: The Basic Idea...Hardware
As I'll try to do with the rest of the instructable, I'll first explain the basic idea, and then move on to my implementation. That way, you should be able to find suitable replacments for anything that you don't have.
So, we need to make a plane, then somehow record where that plane so that it can be processed by the computer. Although others in the past have used the edges of shadows to achieve this, I've gone for something a bit more exotic. I have a (very bright) green astronomy laser (a normal laser pointer might work too, astronomy pointers are expensive). I've shot it through a cylindrical lens, which makes it into a fan. This fan of light is what I'm using as a plane. It works fine, but be warned that the size of your scanner will be severely limited by the size of your lens: my lens in about a third of an inch in diameter, and with an approximately 2' cube for the frame, I'm limited to about a 2' by 6" by 6" scanning surface. A smaller lens would be better, but it's not necessary for what I'm doing.
Step 3: The Box
The first step is to build a box to contain the scanner. The floor and back wall of the box are made out of melamine, the sides plywood, and the rest is 1 1/2" stock cut on a table saw. After working with the finished product, I can say that the melamine is unnecessary: pick some flat (and it really does need to be flat) plywood, and paint it white. It'll save you a few bucks. My box is about 1 1/2' to 2' in all dimensions, but that aspect is up to you the only other important part of the box is the rails on top. These should be precise, and fit nicely with a set of wheels. I've used 3/8" metal rod, and knex wheels for mine, but any similar set would do.
Step 4: The Laser Gantry
Next is the laser gantry. I've used an old piece of wood I had around for this. They say a picture it worth a thousand words so I'll put the detailed instructions on the pictures. The gantry is mounted so that it rolls along the rails at the top of the box. There's a hole in it, and the laser/lens unit is mounted so that the plane of light falls perpendicular to both the back and bottom of the box, and about halfway up each. Once the gantry and laser are set up, the physical setup is done. On to the camera setup.
Step 5: Camera Position...
The camera should be set off to the side, and above. This ensures that the laser line will deflect properly.
At this point, you should get a test object. I've used a gnome statue, but anything with a distinctive shape, and good details at all levels should work. Look at the camera, and make sure that the laser visibly deflects over the object. Look at the pictures below to get a sense of what I mean.
Step 6: The Basic Idea...software
The ideas behind the software are also quite simple. There are a series of points, each of which correspond to the same pixel on the camera. In a sense, the image on the camera is a projected space of the real 3 dimensional space it's imaging. The trick is to learn how to transform points between the two spaces. As it turns out, this comes down to a fairly simple equation. If you're interested, I'll add scans of my development notebook for you to look through. Otherwise, I'll provide with my matlab implementation and documentation.
Step 7: Do Some Scans!
Give it a try! Take some scans and see how it works. What you get from this scanner won't be a final model of the object: only the side facing the camera will be mapped, and the resolution is rather coarse. The way to fix this is to do multiple scans, then piece them together. For instructions on how to do this, see this excellent instructable. Happy scanning!
Step 8: New Directions...
There are several directions I'd like to go in from here. Unfortunately, I probably won't get to it in the near future. I'll leave my ideas here for the DIYer more ambitious than I.
1) Automate-There are a couple things that would need to happen here. One is the software. Matlab might not be the best choice for this though, and I'm not quite as ambitious as to attempt it in another language. In addition, there would need to be some wizardry with electronics, some way to activate motors and such on computer command. Finally, the images would need to be taken and loaded realtime, something I'm not sure how to do.
2) Add a turn table. Along with automation, this would allow for multiple scans to be taken at the same time. This would reduce the amount of time needed to make a complete model.
3) Scanning software: Ideally, the software would clean out the noise and mesh the point cloud it creates automatically.