1Pamsistoaglyph User Manual(0) Pamsistoaglyph User Manual(0)
2
3
4
6 pamsistoaglyph - convert a single-image stereogram to a red/cyan
7 anaglyphic image
8
9
10
12 pamsistoaglyph [--invert] [--sep=number] [--minsep=number] [--gray=num‐
13 ber] [in_netpbmfile
14
15
16 All options can be abbreviated to their shortest unique prefix. You may
17 use either white space or an equals sign between an option name and its
18 value.
19
20
21
23 This program is part of Netpbm(1).
24
25 pamsistoaglyph reads a Netpbm image as input and produces a Netpbm
26 image as output.
27
28 pamsistoaglyph takes a single-image stereogram (SIS) such as those pro‐
29 duced by <a href= "http://netpbm.sourceforge.net/doc/pamstere‐
30 ogram.html">pamstereogram</a> and converts it to a red/cyan anaglyphic
31 image such as those produced by ppm3d(1). Many people have trouble
32 tricking their eyes into focusing beyond the image in front of them and
33 are therefore unable to perceive the 3-D shape hidden within a single-
34 image stereogram. Anaglyphic stereograms are easier to perceive in 3-D
35 but require a pair of red/cyan glasses such as those often used to
36 watch 3-D movies. The goal of pamsistoaglyph is to help people who have
37 trouble viewing single-image stereograms see the intriguing 3-D effect.
38
39 pamsistoaglyph can convert single-image random-dot stereograms (SIRDS),
40 wallpaper stereograms, and even dual-image stereograms to anaglyphic
41 images.
42
43
44
46 For most images, no command-line options need to be specified. The fol‐
47 lowing options are available, however, for unusual circumstances:
48
49
50
51 --invert
52 Swap the left- and right-eye
53 images. pamsistoaglyph assumes that its input
54 represents a wall-eyed stereogram and generates the
55 anaglyphic
56 image accordingly. If the generated image appears to recede
57 into
58 the page where it should pop out of the page (and vice
59 versa),
60 this typically implies that the input image represents a
61 cross-eyed stereogram. Use --invert to correct
62 the image depth.
63
64
65 --sep=number
66 Specify the distance in pixels between the left- and right-eye
67 images. Essentially, this corresponds to the distance
68 between
69 repetitions of the background pattern. The --sep
70 option should rarely be necessary
71 as pamsistoaglyph is fairly good at determining
72 automatically the eye-separation distance.
73
74
75 --minsep=number
76 This option is similar to --sep but
77 constrains pamsistoaglyph only to
78 a minimum eye-separation distance. Any distance larger
79 than number is acceptable. The --minsep
80 option should rarely be necessary
81 as pamsistoaglyph is fairly good at determining
82 automatically the eye-separation distance. The default
83 value for
84 the minimum eye-separation distance is 10% of the image
85 width;
86 this value seems to work well in practice.
87
88
89 --gray=number
90 Limit the number of gray levels to use when searching for the
91 optimal eye-separation
92 distance. Because pamsistoaglyph looks for
93 repeated patterns, it is vulnerable to being confused by
94 slight
95 variations in color. By reducing the input image to
96 grayscale and
97 capping the number of gray levels,
98 pamsistoaglyph ameliorates the effects of
99 unintentional color variations (such as those caused by con‐
100 version
101 from a low-quality JPEG image, for example). The default of
102 63
103 seems to work well so the --gray option should
104 rarely be necessary.
105
106
107
108
110 The registration algorithm used by pamsistoaglyph was developed specif‐
111 ically for this program. As far as the author knows, there are no
112 existing algorithms for converting stereograms to anaglyphs. The algo‐
113 rithm works as follows:
114
115
116
117 · Convert the image to grayscale to increase the ability to iden‐
118 tify
119 matches.
120
121
122 · Count the number of pixels that match N pixels ahead in the
123 image for all N in [1, width/2].
124
125
126 · Maintain a running mean (μ) and standard deviation (σ)
127 of
128 the number of matched pixels.
129
130
131 · Store the N corresponding to each spike in the number of
132 matched pixels. A spike is defined as a tally that exceeds
133 the
134 mean plus one, two, or three standard deviations. Only the
135 first
136 spike of a given standard-deviation multiplier is stored.
137
138
139 · If a tally greater than μ+3σ was encountered, return
140 the
141 corresponding N. If not, then if a tally greater than
142 μ+2σ was encountered, return the
143 corresponding N. If not, then if a tally greater than
144 μ+σ was encountered, return the
145 corresponding N. If not, then return the N that
146 produces the minimum average distance between matched pixels
147 (i.e., #matches divided by #pixels). If no
148 such N exceeds the minimum allowable eye-separation value,
149 return zero to indicate failure.
150
151
152 · If the algorithm returned zero, rerun the algorithm indepen‐
153 dently
154 on each row of the input image and return the median of
155 all N that exceed the minimum allowable eye-separation
156 value. If no such N exists, abort with an error
157 message.
158
159
160
162 Scott Pakin wrote pamsistoaglyph in April 2009. It first appeared in
163 Netpbm in Release 10.47 (June 2009).
164
165
166
168 Copyright (C) 2009 Scott Pakin, scott+pbm@pakin.org.
169
170
171
173 ·
174
175 pamstereogram(1)
176
177 ·
178
179 ppm3d(1),
180
181 ·
182
183 http://en.wikipedia.org/wiki/Stereogram
184 ⟨http://en.wikipedia.org/wiki/Stereogram⟩
185
186
187
188netpbm documentation 5 April 2009 Pamsistoaglyph User Manual(0)