In this article I'm going to show you how you can make high quality 3D pictures with a Canon DSLR, Magic Lantern and free software. If you have an old pair of cardboard red/blue 3D glasses at hand then put them on to view the image above and that will give you an idea of what you can do with the technique I'll show below. You can click on the image to view a larger version of it.
3D pictures are made from two regular pictures of the same scene taken from two different points of view. Later during post-processing, the two images are combined into one.
To view the image and see the 3D effect the viewer must use a viewing device such as red/cyan colored glasses, or a viewing technique such as crossing the eyes. These have the effect of separating the original two images again and feeding them independently to each eye. The slight differences between the two images help our brain generate the illusion of depth.
Before you grab your camera you have to design your 3D picture carefully. You need to decide which elements of the picture you want to pop out, and which you want to sink into the screen.
Here is how I do this. I position myself in the location from where I will take the picture and then observe the scene, looking for an element in the picture that I can use as a reference. In the final 3D picture this element will be aligned with the depth of the screen. Once I have identified my reference element I know that anything that is closer to me will pop out, and anything that is farther away than this element will sink in.
For example, if I wanted to take a picture where everything pops out of the screen, then I would pick a reference element that is way back.
Taking the pictures
Now comes the fun part. The basic rule to make a good 3D picture is that you need to take two pictures, from each eye position. In practice this means that you will move the camera two to three inches horizontally between the pictures.
It is important that nothing moves significantly between pictures, so this is not a good technique to use in places where people, animals, cars, etc. are moving.
It is also recommended that the camera is set to a manual mode, to prevent settings from changing between pictures. At the very least you should set focus to manual, but if you feel comfortable working with your camera in manual mode you should also set a fixed exposure.
The tricky part is to get the pictures aligned, and for this there is nothing better that Magic Lantern's Ghost Image feature.
The process is as follows:
I start by enabling live mode and taking the first picture. Live mode isn't necessary for the first picture, but since it has an important role later I usually enable it from the start. I'll call this first picture the left side picture.
Then I enable Ghost Image in Magic Lantern's Overlay menu (version 2.3):
Next I preview the left side picture I just took and press the Live View button to put it in the overlay. This brings the camera back into Live Mode, but now I can see a blend of the left side picture and the live view.
I now move the camera a couple of inches to the right and align my reference element, the one that I picked when I planned the picture. This step is very important, anything that is perfectly aligned between the two pictures will appear in the plane of the screen in the final 3D picture, and everything else will find its place relative to that.
When I have the desired alignment in the preview I take my right side picture and then take the two pictures to the computer for processing.
There are several methods for post-processing the images. The one to use depends on how the image will be viewed.
To generate the 3D pictures I will use a small script that I wrote, simply called anaglyph.py. I wrote it in Python using the Python Imaging Library (PIL). The script is open source and available directly from github or as a zip file download.
I will assume that you already have or know how to get
pip installed. My script requires the pillow library (successor of PIL), which can be installed with the following command:
pip install pillow
Using this script you can generate a few different types of 3D images, which I describe below.
This is one of the most known types of 3D image. To view the images you need red/cyan colored glasses, like these:
Cardboard glasses of this type can be obtained online (Amazon, Ebay, etc.) for very cheap.
To generate a red/cyan anaglyph that can be viewed with these glasses you must run the following command:
./anaglyph.py left-image.jpg right-image.jpg final-image.jpg
The script provides a few options that control how the anaglyph is generated:
--trueto generate a true anaglyph
--monoto generate a grayscale anaglyph
--colorto generate a color anaglyph
--halfcolorto generate a half color anaglyph
--optimizedto generate an optimized color anaglyph (the default)
The difference between these options is in how the colors from the two images are mixed. The default method is typically the one that produces the best color images. For details on the algorithms for these options see this page.
The main disadvantage of the red/cyan anaglyphs is that they have a poor rendering of the red color.
You've already seen an example of this type of image above. Here is another one (click to enlarge):
Note how in both images the reds are almost non-existant. This is an unfortunate limitation of this format.
Another way to represent 3D pictures is as stereo pairs. These have excellent color quality and can be viewed without glasses, but the viewing technique is difficult to learn for some people.
There are two types of stereo pairs, crossed and parallel. To generate a crossed stereo pair you must use the following command:
./anaglyph.py -x left-image.jpg right-image.jpg final-image.jpg
And to generate a parallel stereo pair you must use this command:
./anaglyph.py -p left-image.jpg right-image.jpg final-image.jpg
Here are the above 3D pictures rendered as crossed stereo pairs (click to enlarge):
The final method I'm going to show you is the least serious of all. It does not require you to wear glasses and you don't have to do any difficult tricks with your eyes either. The problem is that it isn't really 3D but a fast animation of the two original images.
To generate a Wiggle 3D image use the following command:
./anaglyph.py -w left-image.jpg right-image.jpg final-image.gif
Note that the final image must have a
.gif extension, as this is the only widely supported format for animations.
Here are the images above rendered in this format:
As you see, this isn't really 3D, but for certain images the effect is quite interesting anyway.
How to fix bad alignment
Sometimes no matter how careful you are to align the pictures they don't come out good and the 3D picture looks bad. Maybe the camera was not kept leveled between the two pictures, or the distance between the two pictures was too much or too little. If the resulting 3D image seems to be badly aligned there is something you can try.
Less than great 3D pictures can sometimes be improved in a photo editor like GIMP or Photoshop. To do this you import the two images as layers, set the opacity of the top layer to 50% and then move or rotate the layers to align them better. The resulting layers can be cropped and exported back to disk as individual images that can be processed again with
I hope you find making 3D pictures fun. If you have any questions you are welcome to send them via the comments below.