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.

Comments

author
sunlight305 (author)2011-08-02

It's a very interesting thing,i want to know more about it,can you send me the source code.Thank you very much.My email:sunlight305@hotmail.com.

author
Dentroman765 (author)sunlight3052011-12-08

Hi! Unfortunately, a recent hard drive failure means I don't have the Matlab code anymore. I'm putting together python code to do the same thing, since more people will be able to use this. Until I get that up, there's a fairly detailed description of how all this works at the link below. https://sites.google.com/site/oursler3dscanner/software
~Will

author
nandoabadi (author)2016-11-29

can i have the source code ?:)

author
pugalmozhi (author)2016-10-18

GOod

author
lauren152 (author)2016-04-12

I have to do a final project in matlab and my code is no where near as amazing as yours is!

author
mehranzaryoun65 (author)2015-04-06

I've made my own turntable for a handmade 3d scanner, and I'm very curious about the software, could you send me the source code of Matlab or any documentation? My email is: mehran.zaryoun65@gmail.com

author
mehranzaryoun65 (author)2015-04-06

I've made my own turntable for a handmade 3d scanner, and I'm very curious about the software, could you send me the source code of Matlab or any documentation? My email is: mehran.zaryoun65@gmail.com

author
mehranzaryoun65 (author)2015-04-06

I've made my own turntable for a handmade 3d scanner, and I'm very curious about the software, could you send me the source code of Matlab or any documentation? My email is: mehran.zaryoun65@gmail.com

author
mehranzaryoun65 (author)2015-04-06

I've made my own turntable for a handmade 3d scanner, and I'm very curious about the software, could you send me the source code of Matlab or any documentation? My email is: mehran.zaryoun65@gmail.com

author
mehranzaryoun65 (author)2015-04-06

I've made my own turntable for a handmade 3d scanner, and I'm very curious about the software, could you send me the source code of Matlab or any documentation? My email is: mehran.zaryoun65@gmail.com

author
mehranzaryoun65 (author)2015-04-06

Hello sir, would it be possible to send me the source code? Thank you in advanced.

author
hawaiilees (author)2015-01-23

Hello!

I would love to take a look into the work you began and see if there is a way to continue it. There are a team of entrepreneurs, myself included that would love to see this expand. My email is rich.mamsf@gmail.com

Thanks and great work!

author
Pustekuchen (author)2014-06-03

I try to build one, but I don't know how to convert the 2-D Points of my line in world coordinates. How can I make this?

Thanks

author
mostafa qandeel (author)2014-02-24

how can i communicate with you?

author
golfclub (author)2013-09-18

Hi.
Great job
May i have the code?
golfclub4u2win@hotmail.com

TKS

author
Yettimania (author)2013-03-15

Did you ever complete this in python and can you post the matlab code? Did you use the Hough Transform here? I'm little confused as to does the transform only return linear lines?

author
birlan00 (author)2013-01-28

Hi,

Could anybody give me the code ?

BRGDS,
birlan

author
pierceRom (author)2012-02-04

Is there any way you could supply me your code please ?? Im doing a research project on this topic and it would be the biggest help if you could ?? My email is pierce jonRomero35@hotmail.com

author
llluis (author)pierceRom2012-05-08

Have you been able to get the code? I am looking for the Processing source! Thanks.

author
poikilotherm (author)2011-12-26

Knex wheels! I love it!

author
hasemar (author)2011-12-13

I've seen this done before using a stationary mount for the laser (casting a vertical line) and rotating the object around using a turret of some sort, (in that case a satellite dish motor. Have you considered this? That way you could get a full 3d model

author
mac user2234 (author)2011-12-08

that is SO COOL!!!!!!!!

author

Thanks!

author

Your welcome Dentroman765. :)

author
sethcim (author)2011-12-10

Good, but needs equations / diagrams / algorithms. You mention it, but never show.

author
Seanny (author)2011-12-08

Hi. Great project !
is it possible to see your notes or to have little diagrams or pseudo code for the triangulation part ? I think there are few people/hobbyists that can buy matlab. All 3d scanners use this and I despair to see a simple implementation.

author
Dentroman765 (author)Seanny2011-12-08

Yes! I have simple notes for all of this. My apologies for the poor documentation. I never thought anyone would actually read this. It's in need of a rewrite. Until I get around to it (I'll attach the code in python too.), here's a more detailed step by step I wrote for my Application to college: https://sites.google.com/site/oursler3dscanner/software

I'll try to do a proper write up over the weekend, or barring that after finals. Feel free to comment here or PM if you have any specific points of confusion.

~Dentroman (aka Will)

author
rblee (author)Dentroman7652011-12-09

Have you considered Octave? It's a sort of open alternative to Matlab. http://www.gnu.org/software/octave/

The beers you could buy with the spare Matlab license money would go a long way towards dulling the pain of learning yet another language. In fact you'd probably need to go to rehab... :)

author
Seanny (author)Dentroman7652011-12-08

Many thanks, but your link seems to be broken

author
Dentroman765 (author)Seanny2011-12-08

Whoops. :p Try this.

author
ekaggrat (author)2011-07-11

i created something like this several years ago... got preti good results with only matlab.. but used fastrbf for smoothening the mesh

http://www.ekaggrat.net/explorations/laser-scanner/

author
ronibar02 (author)2011-01-06

Thank you for the great explanation.
I am looking for a scanner that can scan the bottom of the foot, and use that information for carving insoles by a cnc system. Are you interested in making a prototype and develop the software for that? If you are, we can discuss how much it would cost.

author
Algag (author)ronibar022011-06-26

the problem is that those who need inserts need support for the foot not a perfect fit

author
Dentroman765 (author)2010-06-09

Yes it is! I find they are very useful, as the do a wonderful job with tracks once the rubber is removed, and are quite easy to interface with simple screws and bolts.

author
cyberpageman (author)2010-05-06

 Nice Instructable, but I missed something.  How do you mover the laser?  Do you push it along the tracks by hand?  And as it is moved so it illuminates the object in, say, the y axis, then what?  I assume the camera sees the light from the reflection from the entire y axis.  What about scanning the x axis?  How do you do that?  Sorry if I'm dense.

author

 Right now, I'm just pushing it along by hand, and having the software figure out where the laser is in post-processing. I also don't scan the x-axis: the computer is interpolating (a) the position of plane, and (b) points on surface of that object in that plane. It uses this to make a 3-d point cloud.
In a later build, I might add a turntable, and then I could scan multiple axis, but that isn't really necessary to get a scan.

author

 Thanks, Dentroman765.  I think I get part of it--you use the reference points to determine where the laser beam is on the x axis.  But I still don't get how the computer determines the points on the surface of the object, because the reflected intensity of the light must be the sum of all the reflections from the top to the bottom of the object.

author

 I'll see if I can explain that a bit then.
The light from the laser beam forms a plane, at least where the camera is concerned. Try drawing a cross section of an object on a piece of paper, then turning the paper so it's at an angle: the cross section will be distorted, but so long as you know that it is on the plane of the paper, it's fairly easy to work out the shape.
The computer analyses the curve of light it sees to make the points in this same way.
Your observation about reflections is a good one: I quickly discovered that reflective objects do not work well with this method, and that the light must be just right to get good quality scans.

author

 Hi Dentroman765,

     Thank you very much for going to all the trouble of explaining the system to me.  I think I must be getting senile from not seeing it immediately; after all, you repeatedly said that the detector was a camera, but my mind converted it to "photodetector."  I can see that your camera setup would work perfectly.  Thank you for your patience with me.
     For a couple of years, I have been working on an acoustic scanner with a single microphone that I move in the x and y directions to scan an acoustic field.  I got so blinded by that approach that I couldn't see yours.  Very sorry.

Thank you again for your interesting instructable.

author

 No problem at all! Thank you for reading through!

author
franklinonline (author)2010-03-03

 what is your software called or is it david?

author

 I've been using matlab, but all you really need is a way to work with videos. Matlab is overkill.

author
jeff-o (author)2010-01-11

This project has a lot of potential.  If you do go ahead and implement some of the ideas you mention on the last page, I'd very much look forward to seeing the results!

author
Dentroman765 (author)jeff-o2010-01-13

 Thank You! I hope to do everything I mentioned on the last page, but I'll probably have to wait until summer when my schedule clears up a bit.

author
jeff-o (author)Dentroman7652010-01-14

I hear ya!  There just isn't enough time in a day...