Welcome | Pre-processing | Processing | Post-processing |



 

About Anaglyphs

 


Welcome.

This site is about turning two stereo images into a single image to be viewed with special red-cyan anaglyph glasses.

 

Overview.

We first have a short look at tools and ways to get the input stereo pictures.
The process to combine these pictures into one anaglyph is split into three page head pulldown menu's: preprocess, process and postprocess (remember to use the Back button or Home key to return to the menu).

What is described is just one method among many to compose anaglyphs.
It does not turn a stereopair into a perfect anaglyph at the click of a button as you may have deduced from the loading time of this page ...
However, if you are interested in some experimenting these pages will give you some ideas.
To keep you happy from the start, only freeware programs will be used.

 

Tools

A calibrated monitor ( I use Quickgamma).

A pair of red-cyan anaglyph glasses (I use nr 1003).

From the list of available anaglyph building software following freeware tools are preferred :

  • StereoPhoto Maker ( version 2.30 was used )
    • Pro: very easy to use
    • Con: does not load color anaglyphs
  • ImageAnalyzer ( version 1.21 was used )
    • Pro: a very, very nice tool
    • Con: poor help file
  • Anabuilder
    • Pro: allround 3d program
    • Con: slow(java), hard to handle
  • The Gimp ( version 2.0.1 was used, for diehards there is also an unofficial Gimpshop )
    • Pro: the swiss knife for image manipulations
    • Con: incomplete colorchannel handling
  • Irfanview ( version 3.95 was used )
    • Pro: a very good picture manager
    • Con: poor editor

 

Photo image aquisition.

We need a set of two images: one as seen by the left eye and another as seen by the right eye, that is, a stereopair.
These images have to be converted to binary image files on your PC.

Just to review a few options:
  1. single picture camera (only for stationary objects)

    Taking one picture, shifting the camera 6,5 cm (interocular distance) and taking the second picture gives you a stereopair. ( using a slidebar gives you more controll ).
    If a digital camera is used the result is transferred to the PC without (?) loss.
    If an analog camera is used a slide or print scan (often combined in one device) is required to transfer the result to the PC. This scanning typically has a negative effect on the quality.

  2. dual picture camera (stationary and moving objects)

    Specially constructed cameras exist that take two views at the same time.
    Some are build by combining existing top range cameras resulting in very expensive sets (2000 euro and up).
    A very elegant and cheap version is the Loreo kit that sells for less than 100 euro.

  3. linked cameras (stationary and moving objects)

    Normal cameras can be linked so that they fire at the same moment resulting in 2 individual pictures.
    Some very elegant and affordable versions (analog as wel as digital) are sold (less than 1000 euro ).

  4. without cameras (no joke!)

    To test your luck witout spending a buck: find stereopairs on the internet.
    For an easy start you can make your choice from this set of nice garden views

    If you are a bit adventurous you can also start from any of your pictures and turn it into a stereopair using methods you find on the web ( or use mine if you are a bit lazy :-)

And remember that for normal stereopairs
- the two pictures are taken from points 6,5 cm apart
- the nearest object should not be closer than 3 steps and
- stereo is at its best between 3 and 15 meter.
 

Anaglyph viewing.

Here we don't talk about print or slide viewers but about screen viewers, in particular anaglyph glasses.
There is a ghosting problems when using this type of glasses.
In what follows three observations are made that proof to be usefull when trying to solve the ghosting problem.

 


With ideal red-cyan glasses you see
only the red ball when looking trough the red part of the glasses and
only the green and blue balls when looking through the cyan part of the glasses.

Probably you also see the dark brown balls that illustrate that there is some crosstalk.


In addition to the known causes ( strong contrast, color blindness) an important cause of this crosstalk is in the way we see colors.

Our vision of red and green seems to be not discontinous but overlapping

Another reason is that we see not only pure (spectral) colors and that a mixture of red with some other color may be seen as green in the eye (brain).

(The illustration on the left is a very rude simplification and is not based on any real data).


This is a white background with a black square which by shifting its cyan color is turned into an anaglyphs as shown in the following picture.
(Please note that only colors black and white are present in this source image).


The crosstalk in this case is called ghosting.
Its effect is a lightening of the dark parts.
It is most visible when a light area meets a dark one (that is, at contrasting borders).
It has nothing to do with color, only with (tonal) contrast (remember the source image).
In short: strong contrast means ghosting.


Reducing the contrast by darkening of the bright parts is not a good idea because it immediately turns a scene into something gloomy and even threatening.


Reducing the contrast in RGB colorspace does not work well: in fact you have to increase the contrast and brightness to get rid of the ghosting.

We can use this to our advantage when we want to adapt contrast and brightness without affecting (or introducing) ghosting.


Reduction of contrast in Lab colorspace does work as expected.

Here brightness (luminance) can be adapted without affecting color.

In general we will reduce ghosting in Lab colorspace and restore brightness and contrast (without reintroducing ghosting) in RGB space.


In Lab space there are different ways to reduce the contrast by lightening of the dark parts.
To illustrate this we use a more subtile sample image and a histogram: the histogram goes from black (left) to white (right).
The figures width is measure for the maximum contrast: reduce width means reduce contrast.


One way is to reserve more tone levels for dark areas by moving the blackpoint from zero to some negative value ( minus 60 in our example).

As the arrow in the histogram shows, the effect is a shift to right of the dark levels.
Note also that the amplitude remains unchanged, that nothing changes at the right site and that the base gets narrower.


Another tool well suited to lighten up the dark tones is the Gamma correction tool.
In fact its main purpose is just that.

Note again that the amplitude remains unchanged, that nothing changes at the right site and that the base gets narrower.


Finally there is the contrast correction.
It's effect is different from the other two corrections mentioned above in that not only the dark but also the bright levels are affected:
the dark zones become less dark but at the same time the bright levels also become less bright.

To illustrate its possible bad effect the figure at the left shows what happens when it is slightly overdone


This does not mean that the contrast reduction tool can not be used, on the contrary.

As the figure to the left illustrates it can be very effective in combination with the brightness tool the effect of which is to shift the histogram figure back to the right as you certainly know.

Also dont forget that, as mentioned before, once the ghosting has been reduced (or removed) any missing contrast or shadow can be restored in RGB color space.

Real anaglyphs.

If you don't systematically saturate the colors of your landscapes yet or warp your portraits,
there is no reason to NOT create real anaglyphs...


Same monocular view but quite a difference in anaglyph view isn't it ?

To check if an anaglyph is real (faultless):

1. Look only through the cyan part of the glasses for say 20 sec until monocular stereo is established
( read here about monocular stereo and microstereopsis)

2. Now open the left eye and look with both eyes: there should be

  • NO change of depth (meaning correct window placement),
  • NO change in tone (meaning correct tone balancing),
  • NO ghosting,
  • NO loss in sharpness (meaning correct alignment).

Look here ( 1024x768 ,424 kb) for the full anaglyph (lean back for easier viewing, hit F11 for full screen).
Extra strong contrast is used to illustrate the possibilities of the Lab-RGB technique described in previous section.

 

Ghostless viewing (just for the fun of it).

To end this introduction with a positve note following figures illustrate how color balancing can be used to turn any black and white picture into a ghostless colored one.

 


The ultimate black and white drawing :-)

( could be cubism ).


The same drawing with shifted cyan to make it an anaglyph.

Real artist will create a second drawing and generate an anaglyph using StereoPhotomaker or Anabuilder.


If olive green is your favorite color, this is for you !

CMY , cyan -202 , magenta -200, yellow +1


Maybe a pastel blue is more to your liking ?!

RGB , red +202 , green +200, blue +255


Or is it deep blue ?

RGB , red -124 , green -150, blue +142


Or just mysty...

RGB , red +202 , green +200, blue +200



 

Anaglyph Pre-processing

 





The scanned image is opened in the GIMP.

In addition to the usual
geometric adjustments (rotation, cropping) an attempt is done to
restore the dynamic range lost in the aquisition process.
This is followed by the usual retouching, sharpening and white balancing.

The walktrough is made using these left and right images (only size reduced here).

Rotate, crop

 




The rotate function is called by shortcut Shift+R
or by opening the popup menu with a right button click of the mouse followed by selection of the shown menu items.




After finding a horizontal or vertical line in the picture the grid is rotated so that it is parallel to it.

( the grid size is adaptable via the tool options dialog ).




In a similar way the crop tool is invoked via shift+C or the popup menu.




The appearing black squares are dragged to the wanted new corner positions.

Dynamic range restoration

 




The levels dialog is opened by invoking the popup menu window with a click of the right mouse button.




The gray triangle under the input level diagram is shifted to the left to lighten up the sky a bit.




After lightening up the sky we tackle the dark parts of the image.

We make use of an adjustment layer that consists of a inversed grayscale bitmap taken from of the source image.

It's effect is a proportional brightening: dark parts are brightned more than light parts.

It sounds complicated but as following steps illustrate it is quite easy.




Open the layer dialog using the Ctrl+L shortcut.

Now duplicate the background layer by clicking the duplicate-icon as shown.




Right click on the big image and select the Value Invert function.




We inversed the colors and at the same time the tone values.

We will remove the color and keep the tone (grayscale).




Right click on the big image to select the Hue-Saturation dialog window.




Minimize the saturation.

Now increment the lightness and stop before the black starts turning gray.




This is the reversed grayscale bitmap we are going to use to lighten up the dark parts.




Invoke the Layers dialog using the Control+L shortcut.

Now change the Mode from Normal to Overlay.




The effect is most visible in parts that were dark in the source image:
here the trees on the left and right side of the image.

By changing the opacity the effect can be reduced.

To increase the effect the Brightness-Contrast color tool can be applied to the adaption layer.




The result can be compared with the source image by clicking the eye-icon.

Care should be taken not to over do this tone correction because it flattens the image.




Before the image is further processed the two layers are combined using the Flatten Image function.

Retouche

 




In the Gimp the Navigation Dialog window can be used to find unwanted dust particles.




These particles are removed using the Stamp paint tool (shortkey: C).

Pushing the Control key while left clicking defines the source.
After releasing the Control key the unwanted area can be overpainted.

Setting the Aligned button in the Tool options Dialog makes the source area follow the mouse movements. The same dialog lets you choose the brush size and opacity.

Resize & Sharpen.

 


To see the effect of sharpening the image must be looked at in full size (1:1).

Therefore we will first resize and then sharpen.

This sharpening function is a bit slow in the Gimp, therefore Analizer will be used.

In the Gimp use menu Edit > Copy to clipboard.
In Analyzer use menu Edit > Paste (or Control-V) to load the image.




In Analyzer menu Image > Resize (shortkey Ctrl+R) is used to resize the image




In Analyzer menu Filters > Sharpen is used to sharpen the image.




The Original button helps you to evaluate the effect.

Restore white balance

 




Use the Zoom tool to bring a known white or neutral gray colored spot into view.

If such a spot is present you are lucky. If not, you have to trust your color judgement to calibrate the colors.

In case of slide or print input the source image may be very usefull.




Select the Pen tool and click the whitespot while holding the Control key. Release the Control key.

Now right click the pentool to bring up the colorbox and read the RGB value of the picked up color.




Here the values are
R,G,B= 255, 255, 247.

Three identical values would mean that there is a correct balance between colors when presenting shades of gray.
Of course all depends on the usefullness of the whitespot which is often doubtfull.
Just to illustrate the procedure I will make a correction to the blue although my personal taste tells me that it is not required.




Open the Image > Color Balance menu.




Make the correction
R,G,B= 0, 0, 8.



This is a fast and easy way.
For a more sophisticated method see chapter 6.2 Removing color casts in this superb online GIMP book




Save the image in PNG format.

This completes the preprocessing of the first image of the stereopair.
The same action is repeated for the second image.



 

Anaglyph Processing

 





The prepared images are opened in the StereoPhoto Maker (SPM) program.

After an automatic color adjustment the anaglyph is generated in the wanted
color anaglyph type.

Some geometric adjustments may be required to allow comfortable viewing.

Anaglyph building

 




Load the two prepared images into PSM.

These images were prepared individually in the preprocessing phase.

Now that we see them side by side it is clear that there is a brightness difference between them.




The brightness difference is removed by using the Auto Color Adjustment.




Now we are ready to build the anaglyph by choosing the anaglyph type.

Choose half color (red/cyan).




Using the keyboard arrow keys we make the red and cyan overlap for some foreground objects.

We now check to see if for every object its red and cyan are on the same horizontal level.

In our example this seems to be the case.

If this is not the case than an 'easy adjustment' is required that often turns out to be not that easy at all...

Easy adjustment.

 




In order to make the changes visible, which are often minimal,
we use a simplified image.

Lets invoke the easy adjustment panel by selecting the corresponding icon.




To solve rotation errors make the cyan and red overlap somewhere in the center of the image by using the vertical and horizontal scroll bars.




The cyan is above the red on the left side and is below red at the right side of the image.

This means that there is a rotation error.




After making sure that the rotation of cyan and red are unlinked we rotate the cyan counter clockwise to make it overlap with the red
( minus 2 degrees).




A carefull inspection reveals that at the top of the image cyan is below the red while at the bottom the cyan is above the red. This points to a sizing error.



This size error is removed by increasing the size of the cyan
( here by 2 percent).

You may also have noticed that now the cross is also parallel to window (the screen).

Use the vertical scrollbar to bring cyan and red on the same level.
To bring the nearest object (here there is only one) just behind the screen the horizontal scrollbar can be used to shift its cyan just to the left of its red color component.




Mostly the 100% size button is used to switch to full size to work on images that are big and/or have much detail.

Using the rotation, resizing, shifting sequence seems to work in most cases.

Hit the OK button if you are pleased with the adjustement and admire the result in full screen.



 

Anaglyph Post-processing

 




Original
(png 324 kb)











Global deghost
(png 320 kb)









Local deghost
(png 320 kb)

Options.

If you see no ghosting in the input image you can call yourself furtunate because most viewers will see some ghosting on the left side of the tree branches.
The amount of ghosting depends on the monitor settings, type of glasses, your color vision and also on the tonal contrast in your anaglyph.
Reduce tonal contrast to reduce ghosting is what we describe on this page.

As explained on the welcome page it is a matter of lightning up dark parts in Lab color space.
This can be done via Blackpoint, Gamma or Contrast corrections.

When these corrections are applied globally an overall reduction of contrast (and hence sharpness) sometimes makes the result less easy to view (although no detail is lost).
In this case a local correction can be used instead that leaves the rest of the image untouched.

After describing global deghosting we illustrate a method that starts with a global deghosting that is applied locally.
Finally there is a method that does a recoloring of the ghosting parts.

 

Global deghosting.

Global deghosting is done by reducing the contrast.
Because of its size it is moved to a separate page which is here

 

Local deghosting.

A global deghosting is done and parts of it are copied to areas of the anaglyph that show ghosting.
Because of its size it is moved to a separate page which is here

 

Global tone balance.

The first step is always to establishing a global balance that corresponds with your glasses.
This is done by adjusting the brightness of the red and/or cyan color channels so that the overall light impression as seen through the glasses is the same for both eyes. This solves 90% of the problem.
The remaining 10% is caused by the presence of strong primary colors red, green or blue.
To solve this, the offending color(s) have to be replaced by non-offending onces.
For man-made colors ( hair, dyed or painted materials...) this passes unnoticed.
It is a lot more difficult if natural materials are involved (fruits, skin...).

The most problematic color by far is 'red' followed by 'green' as can be verified in next example:




This tonal imbalance (one eye sees bright where the other eye sees dark) can be repaired by altering the offending colors: the red can be replaced by brown and the green by olive green for example.
This is easily done in SPM by choosing the 'Optimised anaglyph' type with following settings:



Some reasoning behind my choices that may be helpfull to create your own:

  • by making the rows add up to 1000, white and grays are not affected.
  • to make the left and right eye see the same tone for red, half of it is taken from green.
    (green because red plus green gives yellow which turns to brown in low brightness)
  • the same reasoning is followed for green, but because some green is already leaking through the red glasses and because here green should be dominant, the 50/50 proportion is changed to 40/60.
  • finally instead of 100% blue (which works well) only 80% is used to darken mostly overexposed skies a bit.
    The remaining 20% is taken from red (green would lighten up the left eye's vue of blue parts).
Of course, this global color change is affecting the 'natural' look of the anaglyph, but less so than the generally used half-color method which darkens the reds even more (as shown below), taking all life out of human skin :-)



As a final remark, don't use this method for all your anaglyphs if you don't want them to look all the same ( la Dubois).
Instead local recoloring can be used whenever possible.

 

Local recoloring.

When deghosting does not work, for example because the dark parts are not dark colors but real black (=no color) or when there is a local tone imbalance, recoloring can be used.

Coloring figures in anaglyphs is not like usual coloring:


The original figure (on the left) can be colored completely (middle) or without outstanding red-cyan components (right) but both will destroy the depth.

To color correctly the figure's red and cyan components have to be made overlapping before coloring and after changing the color they have to be shifted back into their original positions:


So far for the good news ( look here for a small example ).

In fact, if the figure has some visible depth there is more to it than just shifting (middle): you have to warp it (right)!

The sequence now looks like this: warp, recolor, warp :

The bad news is that things get a lot more complicated when other objects are in front of the main object:


Coloring only the distant object.


Coloring also shifted parts of the near object.

The solution seems to be to recolor the left and right images seperately before composing the anaglyph.
( look here for a small example )

 

The rest....

Maybe you were looking for much more than what you found here like f.e. a universal (one-click) solution for anaglyph defects...

The appreciation of anaglyphs is rather personal: what I consider as good may look dull or even bad to you depending on your personal sight and taste. To find this out the ideal place to visit is an exhibition of anaglyphs that the contributors consider as representing their personal taste.
One such place is the Dabiri Awards Gallery that can be found here and (slower and with banners) here.
Dr Dabiri had the vision to invite all these homebrewing anaglyph makers to his galary and reward them with prizes, even in natura. The result is a nice sample of what people are using anaglyphs for. Definitely a place to visit !

 

Thanks.

To conclude, I hope you found something that gives you ideas to create your own anaglyphs.
There are many ways to build anaglyphs, this is just one of them.
If this examples inspires you to document your own method I feel rewarded for my effort !
Any constructive comments are welcome at

Special thanks and greetings to
Etienne, Imre, Shahrokh.

 
Top of page.
Last updated 2005-08-21




Stereo 3D Ring This RingSurf Stereoscopic 3D Web Ring Net Ring
owned by Anaglyph workshop 2.
[ Previous 5 Sites | Skip Previous | Previous | Next ]
[ Skip Next | Next 5 Sites | Random Site | List Sites ]