19# * http://www.doxygen.org/ to generate the documentation.
20#
21#
22# \page page_usage Usage
23# The plugin is visible in the menu "Filters/Goto 40/Create Anaglyph From Layers".
24#
25# ### Parameters and simple layer usage
26# The plugin has the following parameters:
27# * "min disparity, percent width (near)":
28# * minimum disparity (shift between left and right, generates depth perception)
29# * 0 = no depth (screen)
30# * <0 = between user and screen
31# * >0 = behind screen
32# * "max disparity, percent width (far)":
33# * like min. disparity (should be > min. disparity)
34# * "luminance correction left (0.0..1.0)":
35# * 1.0 = no correction; <1.0 darkens left image
36# * "luminance correction right (0.0..1.0)":
37# * 1.0 = no correction; <1.0 darkens right image
38# * "swap left/right":
39# * normally "no"
40# * "yes" swaps left and right image (you swap the left and right side of your glasses)
41#
42# Image and layer properties:
43# * Only gray level images with and alpha channel can be used.
44# * All layers must have the full image size.
45# * All layers must have no layer mask (apply before use).
46# * The order of layers is used as depth (most visible layer is nearest).
47#
48# ### Special layer properties
49# * Layers named "depthmap <name> <float> to <float>" are ignored. They define depth maps with a given value range, which can be used as depth info for other layers.
50# * The name of the layer can overwrite the depth deduced from the layer order:
51# * "background" : a layer without disparity (typically colored in one color).
52# * "depth=<float>" : fixed depth of this layer (0.0=nearest layer, 1.0=farthest layer).
53# * "reldepthmap <name>" : use depth map (is scaled such that the range 0.0 to 1.0 fits the space between two layers).
54# * "fixdepthmap <name>" : use depth map with fixed depths.
55#
56# Important note when using depthmaps:
57# * Depth is stimulated through an artifical disparity (a shift between left and right image).
58# * The depthmaps specify this shift for every pixel.
59# * However, the depthmaps are used to determine where a pixel comes from and not where it goes to. Thus, a depth map region must be wider than the object is is meant for. Also it may yield strange effects when it as abrupt changes (discontinuities). Best, is to use smooth depth maps, ideally representing a vertical gradient (constant from left to right).
60#
61# \image html depthmaps500.png images generated with depthmaps (you need red/cyan glasses)
62# \image html depthmaps500_expl.png left: gimp screenshot demonstrating the usage of depth maps; right: example depthmap
63#
64# ### Observations / open points
65# * JPG compression seems to destroy the stereoscopic effect in some cases (artifacts or color corruption?).
66# * On my screen, with my glasses, with my eyes it is helpful to darken the cyan image.
67#
68# \page page_installation Installation
69# You need numpy to execute the plugin (e.g., apt-get install numpy).
70# You need to put the plugin code in the gimp plugin search path (e.g. see "Edit/Preferences/Folders/Plug-Ins").
71#
72# \page page_architecture Architecture
73# This page describes the architecture of the software. It helps modifying and maintaining the software. It also demonstrates how to combine numpy (or scipy) with gimp (gimpfu_numpy_converter.py).
74#
75# ### Goal
76# Create a tool to generate anaglyphs from (scanned) flat images arranged in depth.
77#
78# ### Constraints
79# The selected solution has the following constraints: Plugins must be written in python or scheme.
80#
81# ### Context
82# The context of the plugin is gimp (who owns/calls the plugin)
83# and additional required libraries for signal/image processing.
84#
85# ### Solution
86# * Real 3D renderer (blender, povray) were considered to be too complex to use for this task.
87# * A gimp plugin seemed to be a possible solution.
88# * It allows easy composition of scanned images.
89# * It also allows to scan and pre process the images.
90#
91# ### Building Block View
92# The context of the plugin is gimp (who owns/calls the plugin)
93# and additional required libraries.
94# The plugin itself is organized as follows:
95# * Module create_anaglyph_plugin.py (component "Plugin"): The main plugin code (control code)
96# * Module anaglyph_algorithm.py (component "anaglyph_algorithm", class anaglyph_algorithm.Anaglyph): the core algorithm
97# * Module depth_algorithm.py (component "depth_algorithm", class depth_algorithm.DepthAlgo): functions to determine a layers depth
98# * Module gimpfu_numpy_converter.py (component "gimpfu_numpy_converter"): functions to convert from/to gimpfu data structures to/from numpy arrays.