License | Documentation | Download | Change log | Contact | Back

Anaglyph conversion plugin for AviSynth

This plugin takes two stereoscopic 3D video streams — one for the left eye and another for the right eye — and composes them into a single anaglyph video stream that you can watch with colored glasses.

License

By downloading and using the Anaglyph plugin for AviSynth you agree to the terms and conditions set forth in this End User License Agreement ("EULA").

The Anaglyph plugin for AviSynth ("Plugin") is freeware. You may use it without time or legal restrictions for either commercial or non-commercial purposes.

The plugin was developed and tested by Gabor Kertai ("Author") to his best knowledge, however Author takes absolutely no responsibility that the Plugin works as expected.

You can use the Plugin at your own risk. This Plugin is provided to you "as is", and Author expressly disclaims all warranties of any kind, either implied or express, including but not limited to warranties of merchantability, fitness for a particular purpose, and non-infringement. Author makes no warranty, either implied or express, that any part of the Plugin will be error-free, virus-free, secure, accurate, reliable, or of any quality.

Some of the code in this Plugin is experimental, and may work incorrectly or crash your operating system / computer. In no event will Author be liable to you for any damages, claims or costs whatsoever arising from your use of the Plugin of any component thereof.

The Plugin and any authorized copies that you make are intellectual property of Author. You agree that all copies of the Plugin reproduced for any reason by you will contain the same copyright and trademark notices as this EULA. The Plugin can be bundled and redistributed as long as it is kept free for the end user.

Installation

Extract the Anaglyph.dll from the ZIP file and place it in a directory of your choice, preferably the plugins folder of your AviSynth installation. You are now ready to write AviSynth scripts that generate anaglyph content.

The plugin requires AviSynth V2.5 or newer.

Documentation

Syntax

Anaglyph( clip left_eye, clip right_eye, string "matrix", string "type", float "convergence" )

Parameters

left_eye, right_eye: The video clips to be composited together. Both clips must be of the same dimensions, frame rate, duration and pixel type.

matrix: Specifies the channel matrix to use when compositing the two images. It can be one of "color", "halfcolor", "grey", "optimized" or "dubois". Defaults to "optimized". See Peter Wimmer's Anaglyph Methods Comparison or Sean Gleeson's entry on swell3D.com for an explanation and examples of these. See also the homepage of Eric Dubois for some insight into his algorithm and its benefits. If you have a suggestion for another matrix, please contact me so that I can include it.

type: Specifies the type of glasses to create the composite for. It can be any one of "red-cyan" (alternatively "rc"), "blue-amber" (alternatively "ba"), or "green-magenta" (alternatively "gm"). Defaults to "red-cyan". Note, that the matrices are designed primarily for red-cyan glasses. Chosing a different anaglyph type simply swaps the output channels, so results may be suboptimal.

convergence: Adjusts the convergence of the left / right images. Positive values push the convergence plane further away from the viewer, while negative values bring it closer. Convergence is adjusted by shifting the source clips to the left / right relative to each other, e.g. a convergence value of 1.0 pushes the left image to the right by half a pixel, and the right image to the left by half a pixel. The source clips are automatically upscaled to compensate for lost information at the screen edges. Either Spline64Resize or Lanczos4Resize is used for this, whichever is available. The smallest possible adjustment is one tenth of a pixel (0.1) and the largest is limited to half the width of the source clips.

Video

The plugin supports the RGB24, RGB32, YUY2 and YV12 colorspaces, and the resulting clip retains the pixel type of the source. Note however that the anaglyph composition is an RGB process, so YUV clips will need slightly more processing time and may produce color distortions. RGB -> YUV conversion is done according to Rec.601 (TV range). For RGB32 sources the alpha channel is discarded.

Audio

Audio from the input clips is not retained in the current version. You can use AviSynth's built-in AudioDub filter to get around this limitation.

Why use this plugin?

The question can also be formulated as "why did I bother to write this plugin", and it's got some validity to it, since most of the anaglyph stuff you could do by combining built-in AniSynth filters. As a matter of fact, that is exactly how I was doing it for a while. Here's the function that I was using before:

  function Anaglyph(clip left, clip right, string "mode") {
    mode = Default(mode, "Optimized")
    left = ConvertToRGB24(left, "PC.601")
    right = ConvertToRGB24(right, "PC.601")
    return \
      mode == "Color" ? MergeRGB(left, right, right) : \
      mode == "Grey" ? MergeRGB(GreyScale(left, "Rec601"), GreyScale(right, "Rec601"), GreyScale(right, "Rec601")) : \
      mode == "Optimized" ? MergeRGB(Merge(left.ShowGreen(), left.ShowBlue(), 0.3), right.ShowGreen(), right.ShowBlue()) : \
      mode == "Halfcolor" ? MergeRGB(GreyScale(left, "Rec601"), right.ShowGreen(), right.ShowBlue()) : \
      MessageClip("Unknown anaglyph mode: " + mode, width = Width(left), height = Height(left))
  }
		

As you can see, it does many of the things one would want in terms of anaglyph creation, but it has some serious weaknesses — which in turn are benefits of using a plugin. Let me highlight a few.

Download

Latest version: AviSynth_Anaglyph_plugin_V0.85.zip (456.7 kilobytes)

Older versions:
AviSynth_Anaglyph_plugin_V0.8.zip (453.9 kilobytes)

Version History

V0.85 (released: 2010-08-29) V0.8 (released: 2010-08-28)

Contact

Should you have any useful feedback, bug report, comment or idea for improvement, you can reach me at my email address.

I reserve the right to ignore any emails with a bad attitude or lack of respect.

Community

Verified XHTML