Structured Light 3D Scanning

PrintPrint PDF FacebookFacebook TwitterTwitter Send this to a friendE-mail
by kylemcdonald
 

introStructured Light 3D Scanning

The same technique used for Thom's face in the Radiohead "House of Cards" video. I'll walk you through setting up your projector and camera, and capturing images that can be decoded into a 3D point cloud using a Processing application.

Point Clouds with Depth of Field from Kyle McDonald on Vimeo.



House of Cards Google Code project

I've included a lot of discussion about how to make this technique work, and the general theory behind it. The basic idea is:

1 Download ThreePhase
2 Rotate a projector clockwise to "portrait"
3 Project the included images in /patterns, taking a picture of each
4 Resize the photos and replace the example images in /img with them
Structured Light 3D Scanning
 
Remove these adsRemove these ads by Signing Up.
 

step 1Theory: Triangulation

If you just want to make a scan and don't care how it works, skip to Step 3! These first two steps are just some discussion of the technique.

Triangulation from Inherent Features
Most 3D scanning is based on triangulation (the exception being time-of-flight systems like Microsoft's "Natal "). Triangulation works on the basic trigonometric principle of taking three measurements of a triangle and using those to recover the remaining measurements.

If we take a picture of a small white ball from two perspectives, we will get two angle measurements (based on the position of the ball in the camera's images). If we also know the distance between the two cameras, we have two angles and a side. This allows us to calculate the distance to the white ball. This is how motion capture works (lots of reflective balls, lots of cameras). It is related to how humans see depth, and is used in disparity -based 3D scanning (for example, Point Grey's Bumblebee ).

Triangulation from Projected Features
Instead of using multiple image sensors, we can replace one with a laser pointer. If we know the angle of the laser pointer, that's one angle. The other comes from the camera again, except we're looking for a laser dot instead of a white ball. The distance between the laser and camera gives us the side, and from this we can calculate the distance to the laser dot.

But cameras aren't limited to one point at a time, we could scan a whole line. This is the foundation of systems like the DAVID 3D Scanner , which sweep a line laser across the scene.

Or, better yet, we could project a bunch of lines and track them all simultaneously. This is called structured light scanning.
Theory: Triangulation
triangulation.gifdavid.jpg
To Download the PDF or View All Steps,   
Become a Pro Member »
107 comments
1-40 of 107next »
Aug 25, 2010. 10:40 PMdavIRE says:
for some reason i cant seem to get the export function to work. im not really sure how its supposed to work or if the program is outputting to someplace weird, but i would have assumed it would show up somewhere in the file system if it wasnt going to ask where to save. im just trying to export an object file from stills. no video involved. also im using macOS but windows is also an option. any help would be great because im at the banging-my-head-against-the-desk-shouting-just-work-dammit stage :P
Aug 29, 2010. 2:58 AMdavIRE says:
sorry i have just one more query. how are you making the renders with depth of field? ive been struggling along with nuke but its not working the best. then again im not the best with nuke
Aug 26, 2010. 8:54 PMdavIRE says:
ah fantastic, just needed a folder called output is that folder supposed to be in the file directory? i had capture and input. should there have been output as well? if not maybe that would be a handy thing to put in there. i mean its just a blank folder. thanks heaps for the rapid response. the instructable is excellent
Jul 22, 2010. 7:46 AMhidx says:
Hi, I tried to capture some pictures to render the 3D model but i couldnt get any depth for the object. Can you guys tell what Im doing wrong? I posted some of the images i used.
8979.jpg8980.jpg8984.jpg
Jul 20, 2010. 3:18 AMJ3nc3k says:
Hi, I'm quite new in 3d reconstruction and I'm trying to use the unwrapping method you've introduced here, but I'm probably still missing something, even if the code's the same(just rewrote in C by me). My results... Wrapped phase(the first image) looks quite good I thinks. But the unwrapped one, it doesn't look like the unwrapped phases I've seen so far. I don't know what's wrong because as I've told I've used your code as a template. Could you give me some advices? One my opinion is, that maybe it's just because I'm displaying the image with different API, so the phase values are just recognized more as more brighter places than on your images(and because of that I can see only the white). In fact phase unwrapping should remove 2pi discontinuities form the image and that's maybe done. So what would you recommend me? Try to reconstruc tthe scene using the data I have right now and I'll see what will happend or these results are bad and I should make it better first? I already viewed some results in 3d, the point cloud, but it doesn't look like it should look. Thanks for replies.
Screenshot.pngScreenshot-1.png
Jul 20, 2010. 7:20 AMJ3nc3k says:
Ok, thanks :) I'll try to fix it and then I'll post here my results.
Jul 20, 2010. 11:20 AMJ3nc3k says:
So I've played with it a little bit and I've found out few things... The first one... the wrapped phase image... now it's ok... the error was caused by bad data type conversion(precision loss when doing some computations with uchar and float). New wrapped phase image attached below(the left one). And about phase unwrapping. The algorithm was ok... I didn't want to believe that it's not because I've checked the flood fill algorithm principle in general and also red some articles about phase unwrapping, and I seemed to be lost, without a clue. But now I understand it all. I was half-right with the reason why the phase unwrapped picture looks like that, why is the unwrapped part all white. It was because in API I'm using(OpenCV) is good to convert the image data into some integral array and modify them by some proper value(to get values between 0 and 255) and then they'll be shown correctly(sure this is not the only way to display them correctly). So all problems were caused by some data types and conversions problems. Thanks a lot for guiding me Kyle :) The right image is the current unwrapped phase image....
Screenshot-3.pngScreenshot-2.png
Jun 23, 2010. 7:17 AMhamzah2096 says:
why do i always get flat point cloud? i tried both vertical and horizontal pattern. both gives me the same result. all the vertices look like on a plane. can someone take a look?
phase1.jpgphase2.jpgphase3.jpgRIMG0019.JPGRIMG0020.JPGRIMG0021.JPG
Jun 24, 2010. 7:23 AMhamzah2096 says:
i still dont get it. i already align them but i didnt get any good result. i even tried others photo (the bag in previous page) and get the same flat vertices. do you think i miss a driver or dll?
Jun 23, 2010. 7:21 AMhamzah2096 says:
i forgot to add, im using the ThreePhase. :'(
Jun 22, 2010. 11:10 PMhamzah2096 says:
(removed by author or community request)
Jun 13, 2010. 9:01 PMToulouse says:
first off, this is awesome. i have a question though, do you think this method would be suitable for creating a video? as in, the three dimensional models move as you fly around them?
Jun 11, 2010. 12:45 PMMig Welder says:
I don't really understand any of this at all, don't have any experience, etc. and will probably never get around to doing this project, but I thought I'd commend you on the level of detail you provided in the 'ible as well as the incredible amount of support you are giving pretty much anyone who asks intelligible questions. Nice job.
May 18, 2010. 12:22 PMhitric says:
 Coool its works!!!! I chose mash in options!!! Grate!!!!
May 18, 2010. 11:53 AMhitric says:
 decode2 dont working(((((
May 18, 2010. 1:33 AMhitric says:
Hi! This program very good! Everything works fine! But I could not open .obj file (((( Help me please! Thenks!
Apr 7, 2010. 6:52 PMJAZ97 says:
pretty beatse dude, nice works
JAZ97
Apr 4, 2010. 12:44 PMxzuma says:
 Thanks for posting this instructable. Could you please outline a way to take it further into realtime land? 


Mar 11, 2010. 2:57 PMiamdiagogue says:
is this peasycam lib working on linux? i couldn't get this working on a ubuntu
Mar 3, 2010. 5:51 PMlinnat says:
Excuse me. For the same object, the results using horizontal and vertical patterns should be the same? Thx a lot.
Mar 3, 2010. 8:24 PMlinnat says:
Ya! I got it. I have succeed this 3D scan system. It's really interesting.

However, i don't underesting how " capture-2.zip" works? Unzip it and then I click "capture.exe", it can find my webcam and also three kinds of patterns so on. But i don't know how to take picture, I click my webcam, it didn't work. Thx a lot.
Mar 2, 2010. 11:46 AMsmithlee says:
The 3D scanning have use triangulation ?
Where can find the three phase scanning theory?
Thanks
Feb 23, 2010. 12:18 AMlinnat says:

I have a question. You say that "We're just projecting three frames, so you could use transparencies and an overhead projector, or even a slide projector, but you're best off with a digital projector you can feed with your computer.' Is there any difference or difficult when I use like slide projector?
Thanks for your help.

1-40 of 107next »