Kinect Random Dot Autostereograms
Software and Hardware
Written in Processing with OpenNI library
XBox 360 Kinect Cameras
Description
What is a Random Dot Autostereogram?
Random Dot Autostereograms are images that at first glance appear to be just a bunch of random colored dots. However, when your eyes are adjusted correctly to the image, a 3D object appears over the surface of the image. These images were made popular by the "Magic Eye" company. The above image was produced from my program using an Xbox Kinect (3D camera). If you stare at the blue image on the right, the image on the left will eventually "pop out" of the screen in 3D. I added a slider bar between the images to adjust the color of the random dot image.
How do Random Dot Autosterograms Work?
One of the ways the humans come to understand depth is through binocular disparity. We have two eyes that are slightly physically separated. This causes each eye to see a different image. When the brain combines the images, objects that are close will exhibit dramatic differences in the images from the left eye and right eye. Objects that are far away will appear almost exactly the same to each eye. The technical term for these differences is "horizontal parallax".
Random Dot Autostereograms create 3D images in the same manner. The random dots are not completely chaotic. In each row of pixels, there is a repeating pattern of dots. When the left and right eyes try to make sense of the dots, they sometimes get confused and incorrectly merge the repeating pattern. They confuse two consecutive iterations of the pattern as a single iteration. As the brain puts the images together, it understands the distance between the repeating pixels to represent depth. For a more detailed explanation of the process, check out this Wikipedia article: Autostereogram Article
Implementation Details
In order create a random dot autostereogram, 3D information needs to be available. I was able to capture my environment using an Xbox Kinect.
The Xbox Kinect works by projecting infrared dots all around the room. Then, an infrared camera is able to measure the distance between all of the dots. Dots that are close together correspond to objects in the distance, while dots that are far apart are closer to the sensor. I used the OpenNI library to capture this depth information for each pixel in my scene. Then I created a "depth-map" by constraining the distances to be between 0 and 255 inclusive. The gray image above is a visual representation of the depth map.
To create the image, I populated a small image patch with truly random dots. Conceptually, I understood this image to sit just to the left of the random dot autostereogram. I created the random dot autostereogram one column at a time from left to right. At each pixel, I sampled the depth-map. Since objects that are in the distance don't exhibit large amounts of horizontal parallax, I would replicate pixels that were not very far apart. When objects were close to the viewer, I would sample pixels that appeared much further to the left. The specific algorithm that I used can be found here .