Archive | 3D RSS feed for this section

Kinect + Blender 3D Scene Reconstruction

7 Apr

One of my current projects is to find a cheap and accurate way to 3D scan faces for the creation of custom coins and memorabilia;  mostly, I want my face on a 3D printable coin which can then be cast more cheaply in metal.  I had the opportunity to borrow a Microsoft Kinect which has 2 cameras and a structured light infrared laser projector.  One camera captures the infrared laser grid as projected into the room and constructs a depth map in realtime of the entire view.  The other camera captures visible light e.g. normal images and video.  I used the kinect to capture images and depth maps and reconstructed the scene in 3D using blender.  To dump the data, I used libfreenect‘s ‘record’ program, part of the OpenKinect project.

Here’s is a camera panning animation of the result created in blender using a displacement modifier on a heavily subdivided plane:

This is the unedited depth map that I took from the ‘record’ program output:

Kinect depth map produced by libfreenect's record utility

Kinect depth map produced by libfreenect's record utility

I had to scale and move the corresponding image texture to fit the geometry properly.  This is partly due to the slight distance between the cameras.  Here is the slightly altered texture image captured by the kinect:

Kinect image captured using libfreenect's record utility and slightly edited in gimp to align

Kinect image captured using libfreenect's record utility and slightly edited in gimp to align

This is the depth data as determined by blender’s ambient occlusion rendering:

Blender render showing depth via ambient occlusion

Blender render showing depth via ambient occlusion

I will soon compare these results to the free version of DAVID-laserscanner.  I’m currently waiting on the arrival of a very cheap laser line module ($2.50 to be exact) that will be used in conjunction with a high-def camera as input to the DAVID laserscanning software.  Stay tuned.

UPDATE: I’ve attached the .blend file for exploring in blender.  Textures are embedded.  Blender 2.56 Beta or later is recommended.

Stereographic Photos

2 Feb

Today I set out to create 3D anaglyph photos at night (anaglyph is an image that is viewed through red/blue glasses).  To create a 3D stereo image, you must take two shots: one from the left view and one from the right.  Ideally one has a 3D camera or two cameras rigged in parallel.  Since I only have one camera, I simply shifted my camera roughly 2.5 inches (eye width) between shots.  Low light meant taking long exposures and waiting for people to clear the scene since the shots were taken in sequence rather than at the same time.  StereoPhoto Maker is free software that magically aligns your shots to create convincing 3D.

Break out those red/cyan glasses.  Here are the results:

Somerville Theatre in 3D Anaglyph

Somerville Theatre in 3D Anaglyph

Davis Square statue in 3D anaglph

Davis Square Statue in 3D Anaglyph

Rules of thumb for taking stereo photos:

  • Set your camera on a flat surface that you can slide it on
  • Try to keep the foreground subject completely in the frame of the photo
  • Keep high enough off the ground, if you’re too close it can break the 3D effect
  • Keep the camera parallel, don’t angle it in or out;  Slide the camera directly left or right 2.5 inches (or eye width)
  • For close up shots or macro photos (shown below), you will move the camera much less of a distance

I had just fixed my TV-B-Gone:

TV-B-Gone Macro 3D Anaglyph

TV-B-Gone Macro 3D Anaglyph, the Separation Between Shots is Minimal

The completely free StereoPhoto Maker software I used can be downloaded here.  Below is the exact process I followed to generate the images shown here.

To process the left and right shots, simply go to File->Open Left/Right Images, then Adjust->Auto Alignment.  To view in anaglyph or side-by-side cross-eyed, choose your view from the Stereo menu.  The depth in the image at which the red and blue overlap is where objects change from going into the screen to popping out of the screen (look at the snow bank in the first shot).  When viewing the anaglyph image in Stereo Photo Maker, you can change how far into or out of the screen the image protrudes by using the Left and Right Arrow Keys (after auto-alignment).

Save your anaglyph through the File Menu, choose Save Stereo Image when viewing in Dubois (red/cyan) color anaglyph chosen in the Stereo menu.

In this video, learn how to make your own 3D glasses.

You might also want to check out StereoMovie Maker.  Note for linux users:  I always run Stereo Photo Maker using the default installation of wine (sudo apt-get install wine) on Ubuntu.