Nav:  [home][render][stereo] > [anaglyph]
Go:  [Glasses]

Creating anaglyphs from left/right image pairs

This describes how to create anaglyph images from left/right image pairs.

Joining grayscale images

Assume, we have just created a stereoscopic image pair, e.g. using POVRay as described here and we want to make an anaglyph from it.

First of all, it is advisable to start with grascale images because they work best and independent of the image content. What has to be done is really simple:

Convert left and right image to grayscale. Assume we have red-blue glasses, with red being left, then the right image is put into the blue channel and the left image into the red channel of the composed anaglyph image. That's all.

There is an example image at the bottom of the page.

Creating colored anaglyphs

Colored anaglyphs, you may ask, how is that supposed to work?

Actually, colored anaglyphs only work with red/cyan glasses. The reason is that cyan is effectively green and blue and hence, red and cyan together transmit the complete color spectrum. The left eye will only see the red channel while the right one sees the green and blue channel. It turns out that the brain will still get the impression of the colors.

However, this is not always possible. One requirement is that the left and right eye get balanced overall brightness; hence it works best with brown to yellow colors.

See the image below if you have red/cyan glasses at hand.


AnaglyphJoin is a program written by me to atomatically convert a left/right image pair into an anaglyph. It supports any color combination (red/cyan (default), red/green, red/blue) and can create colored as well as grayscale anaglyphs. Grayscale conversion (with tunable weights and optional gamma correction) is done on-the-fly. Actually, all anaglyphs on these pages were joined using AnaglyphJoin.

Anaglyph glasses and visual perception

In order to view anaglyphs, you need special colored anaglyph glasses, usually red/cyan or red/green ones. The simple theory behind the filters is explained on the methods page.

Obviously, the quality of the percepted image depends on the spectral color distribution of the projection device and the quality of the filters. The major visual distortions are "shadows" and right/left brightness imbalance.

One day, I spent hours on experimenting if there is a way to mix colors so that we can prevent the "shadows" caused by the filters in the glasses not being perfect, but without acceptable result. The best way is to use glasses which work well with the screen colors, everything else tends to end up in a waste of time. Later, when measuring the spectra of the filters and looking at screen spectra, I realized that it is not even theoretically much one can do to get rid of the shadows.

So, how good are the glasses and which ones are the best? Well, I measured those I have laying around using a spectrometer. Read more about my goggles.

Sample images

Using a 17inch monitor, I recommend viewing the following anaglyphs fullscreen at 60cm distance through red/cyan glasses (with red being left). Read more about goggles.

normal-spr-color-small.jpg [15kb]
[click to enlarge: 103kb JPG]

Normal traced image

This shows the image as traced by POVRay.
The camera location is actually centered between the left and the right image (and hence a perpendicular camera was used).

(And... what is it? Don't ask: The spherical thingy is a spy robot designed by me in 02/2004 which reminds me a bit of one such object seen in Star Wars. Just let your mind imagine something...)

anaglyph-spr-back-small.jpg [15kb]
[click to enlarge: 600kb PNG]

Grayscale Anaglyph

The above image as grayscale anaglyph with stereoscopic window near the foreground robot.

Another image with different stereoscopic window distance as well as one with visible stereoscopic window can be seen on the creating stereo pairs page.

anaglyph-spr-back-color-small.jpg [15kb]
[click to enlarge: 671kb PNG]

Color Anaglyph

The same image with the same stereoscopic window, but now as as a colored anaglyph.

Especially note all the brown and gray colors in the image which are very well-suited for colored anaglyphs. Also have a look at the yellow position lamp on the robot; it is really "missing" in the grayscale version.

Why are the images so large?
Simply because they are PNGs and hence losslessly compressed. It is really a bad idea to use e.g. JPEG for anaglyph storage because compression artifacts will considerably degrade anaglyph quality. (I tried it: Even at 98% quality you can very well see "shadows".)

[home] [site map] [Impressum] [Datenschutz/privacy policy]
Valid HTML 4.01!
Copyright © 2004-2006 by Wolfgang Wieser
Last modified: 2006-05-21 16:36:22