Anaglyphs

Background:

An anaglyph is a special type of image that allows you to see in three dimensions when the image is viewed through special glasses. These glasses come in different styles, but in this demonstration, you will need red-cyan glasses. Red-cyan glasses have a piece of red, transparent gel for the left lens, and a piece of cyan (bluish-green), transparent gel for the right lens. Many perception textbooks come with such a pair of glasses. You can also purchase them (along with an anaglyph / 3D book) at most bookstores or online.

Anaglyphs rely on the depth cue of stereopsis -- the difference between what the left eye and the right eye see. Thus, anaglyphs need to be able to present one image to the left eye and a different image to the right eye. The two images must be taken from the vantage point of each of the two eyes.

To construct an anaglyph, one must start with two images of the same scene. The two images need to be taken from vantage points about six centimeters apart -- the same distance as between the centers of an average person's eyes. Thus, one of the images is taken from the vantage point of the left eye while the other image is taken from the vantage point of the right eye.

Digital pictures consist of (usually) millions of dots called pixels. Each pixel can display any color that the monitor can show. Because monitors use additive mixtures of light to create colors, each pixel consists of three separate colors -- red, green and blue -- of various intensities.

One of the images, say the image from the left eye's vantage point, is changed so that all of the green and blue in the image is removed. That is, for each pixel in the image, the intensity of green and the intensity of blue are set to zero. When viewed with red-cyan glasses, the left eye (the one with the red gel) will see this image -- the red gel is red because it absorbs the short (blue) and medium (green) wavelengths while allowing the longer (red) wavelengths to pass through. The right eye (the one with the cyan gel) will not see this image -- the cyan gel is cyan because it absorbs the long (red) wavelengths while allowing the shorter (blue) and medium (green) wavelengths to pass through. Because all of the blue and green have been removed from this image, there is nothing left once the longer (red) wavelengths have been absorbed by the cyan gel.

The other image, say the image from the right eye's vantage point, is changed so that all of the red in the image is removed. That is, for each pixel in the image, the intensity of red is set to zero. When viewed with red-cyan glasses, the right eye (the one with the cyan gel) will see this image -- the cyan gel is cyan because it absorbs the long (red) wavelengths while allowing the short (blue) and medium (green) wavelengths to pass through. The left eye (the one with the red gel) will not see this image -- the red gel is red because it absorbs the shorter (blue) and medium (green) wavelengths while allowing the long (red) wavelengths to pass through. Because all of the red has been removed from this image, there is nothing left once the short (blue) and medium (green) wavelengths have been absorbed by the red gel.

Finally, the red and the cyan images are combined to create the anaglyph. For each pixel the intensity of red from the processed image from the left eye's vantage point is mixed with the intensities of green and blue from the processed image from the right eye's vantage point.

When viewed through the red-cyan glasses, the anaglyph provides each eye with its own view. The binocular cells in the visual system can then detect differences between what the left eye is seeing and what the right eye is seeing. This is the stereopic information that the visual system uses (along with many other depth cues) to re-create the third dimension.

The Activity:

To perform the activity, you will need a digital camera and a pair of red-cyan glasses. To create an anaglyph, do the following:

  1. Since the pictures taken by many digital cameras are much larger (in terms of the number of pixels) than many monitors, if possible, adjust the image quality / number of pixels of your camera to a lower value -- something that is approximately the same number of pixels as your monitor. If that is too complex, then don't worry about it. You can resize the web page to get the image to fit on screen (Control + enlarges the web page while Control - will shrink the web page in most browsers.) Holding down the control key while spinning the wheel on a mouse will also resize the web page.
  2. Stand with your feet close together but not quite touching. Shift your weight to your left leg (or lean slightly to your left.) With your digital camera, take a picture. This picture will be the left eye's image.
  3. Without moving your feet, shift your weight to your right leg (or lean slightly to your right.) With your digital camera, take a picture of the same scene. This picture will be the right eye's image.
  4. An alternative to the previous two steps that will produce better anaglyphs is to position your camera on the edge of a table and take the picture for the left eye's view. Slide the camera six centimeters to the right and take the picture for the right eye's view. This procedure will minimize slight differences in the height or angle of the camera that are likely to occur using the other method. Such differences will make it harder for the visual system to fuse the two images into a single image. If the visual system cannot fuse the images, stereopsis will not occur.
  5. If necessary, transfer the pictures to the computer that you are viewing this web page.
  6. Click on the first "Choose File" button below and find the image that corresponds to the left eye's vantage point. Select that file. Click on the Load Left Eye's Image button.
  7. Click on the second "Choose File" button below and find the image that corresponds to the right eye's vantage point. Select that file. Click on the Load Right Eye's Image button.
  8. Click on the Make Anaglyph button. The left and right eye images will be replaced (only on the web page -- not the original files on your computer) by the processed left eye (in red) and the processed right eye (in cyan) images. The anaglyph, the combination of these two images, is displayed below them.
  9. If the anaglyph is too big to fit on your monitor, resize the web page (press and hold the control key while you press the minus key (to shrink) or plus key (to expand).)
  10. Put on your red-cyan glasses (red should be in front of your left eye) and look at the anaglyph. If you were careful in how you took the pictures, the anaglyph should appear three dimensional when viewed through the red-cyan glasses.
  11. You can save the anaglyph by right clicking on it and selecting save image.

Note: The loaded images do not leave your computer -- they are not uploaded to a server. Any image that is displayed is already on your computer and did not originate from the server that this page resides on. If this page is showing something inappropriate, it is because you put it there.








Right click and select "Save as" (or something similar) to save the anaglyph.