# pamsistoaglyph - convert a single-image stereogram to a red/cyan anagly... - man(1) - [phpMan]


*Source: tldr-pages*

---

_Pamsistoaglyph_ _User_ [_Manual_(1)](https://www.chedong.com/phpMan.php/man/Manual/1/markdown)          General Commands Manual         _Pamsistoaglyph_ _User_ [_Manual_(1)](https://www.chedong.com/phpMan.php/man/Manual/1/markdown)

## NAME
       pamsistoaglyph - convert a single-image stereogram to a red/cyan anaglyphic image



## SYNOPSIS
       **pamsistoaglyph **[--**invert**] [--**sep**=_number_] [--**minsep**=_number_] [--**gray**=_number_] [_in_netpbmfile_

       All  options  can  be  abbreviated  to their shortest unique prefix. You may use either white
       space or an equals sign between an option name and its value.



## DESCRIPTION
       This program is part of [**Netpbm**(1)](https://www.chedong.com/phpMan.php/man/Netpbm/1/markdown).

       **pamsistoaglyph **reads a Netpbm image as input and produces a Netpbm image as output.

       **pamsistoaglyph **takes a single-image stereogram (SIS) such  as  those  produced  by  **pamstere‐**
       [**ogram**(1)](https://www.chedong.com/phpMan.php/man/ogram/1/markdown)  and  converts it to a red/cyan anaglyphic image such as those produced by [**ppm3d**(1)](https://www.chedong.com/phpMan.php/man/ppm3d/1/markdown).
       Many people have trouble tricking their eyes into focusing beyond the image in front of  them
       and  are  therefore unable to perceive the 3-D shape hidden within a single-image stereogram.
       Anaglyphic stereograms are easier to perceive in 3-D but require a pair of  red/cyan  glasses
       such  as  those  often used to watch 3-D movies. The goal of **pamsistoaglyph **is to help people
       who have trouble viewing single-image stereograms see the intriguing 3-D effect.

       **pamsistoaglyph **can convert single-image  random-dot  stereograms  (SIRDS),  wallpaper  stere‐
       ograms, and even dual-image stereograms to anaglyphic images.



## OPTIONS
       In  addition  to  the options common to all programs based on libnetpbm (most notably **-quiet**,
       see [ Common Options](index.html#commonoptions) ), **pamsistoaglyph **recognizes the following command line options:

       For most images, no command-line options need to be specified.   The  following  options  are
       available, however, for unusual circumstances.



### --invert
              Swap the left- and right-eye
                  images. **pamsistoaglyph **assumes that its input
                  represents a wall-eyed stereogram and generates the anaglyphic
                  image accordingly. If the generated image appears to recede into
                  the page where it should pop out of the page (and vice versa),
                  this typically implies that the input image represents a
                  cross-eyed stereogram. Use **--invert **to correct
                  the image depth.


       **--sep**=_number_
              Specify the distance in pixels between the left- and right-eye
                  images. Essentially, this corresponds to the distance between
                  repetitions of the background pattern.  The **--sep**
                  option should rarely be necessary
                  as **pamsistoaglyph **is fairly good at determining
                  automatically the eye-separation distance.


       **--minsep**=_number_
              This option is similar to **--sep **but
                  constrains **pamsistoaglyph **only to
                  a _minimum_ eye-separation distance. Any distance larger
                  than _number_ is acceptable.  The **--minsep**
                  option should rarely be necessary
                  as **pamsistoaglyph **is fairly good at determining
                  automatically the eye-separation distance.  The default value for
                  the minimum eye-separation distance is 10% of the image width;
                  this value seems to work well in practice.


       **--gray**=_number_
              Limit the number of gray levels to use when searching for the
                  optimal eye-separation
                  distance.  Because **pamsistoaglyph **looks for
                  repeated patterns, it is vulnerable to being confused by slight
                  variations in color.  By reducing the input image to grayscale and
                  capping the number of gray levels,
                  **pamsistoaglyph **ameliorates the effects of
                  unintentional color variations (such as those caused by conversion
                  from a low-quality JPEG image, for example). The default of 63
                  seems to work well so the **--gray **option should
                  rarely be necessary.




## NOTES
       The  registration  algorithm  used by **pamsistoaglyph **was developed specifically for this pro‐
       gram. As far as the author knows, there are no existing algorithms for converting stereograms
       to anaglyphs.  The algorithm works as follows:



       •      Convert the image to grayscale to increase the ability to identify
                  matches.


       •      Count the number of pixels that match _N_ pixels ahead in the
                  image for all _N_ in [1, _width_/2].


       •      Maintain a running mean (mu) and standard deviation (sigma) of
                  the number of matched pixels.


       •      Store the _N_ corresponding to each spike in the number of
                  matched pixels. A spike is defined as a tally that exceeds the
                  mean plus one, two, or three standard deviations. Only the first
                  spike of a given standard-deviation multiplier is stored.


       •      If a tally greater than mu+3sigma was encountered, return the
                  corresponding _N_. If not, then if a tally greater than
                  mu+2sigma was encountered, return the
                  corresponding _N_. If not, then if a tally greater than
                  mu+sigma was encountered, return the
                  corresponding _N_. If not, then return the _N_ that
                  produces the minimum average distance between matched pixels
                  (i.e., _#matches_ divided by _#pixels_). If no
                  such _N_ exceeds the minimum allowable eye-separation value,
                  return zero to indicate failure.


       •      If the algorithm returned zero, rerun the algorithm independently
                  on each row of the input image and return the median of
                  all _N_ that exceed the minimum allowable eye-separation
                  value. If no such _N_ exists, abort with an error
                  message.



## HISTORY
       Scott Pakin wrote **pamsistoaglyph **in April 2009.  It first appeared in Netpbm in Release 10.47
       (June 2009).



## AUTHOR
       Copyright (C) 2009 Scott Pakin, _scott+<pbm@pakin.org_>



## SEE ALSO
       •

              [**pamstereogram**(1)](https://www.chedong.com/phpMan.php/man/pamstereogram/1/markdown)

       •

              [**ppm3d**(1)](https://www.chedong.com/phpMan.php/man/ppm3d/1/markdown),

       •

              [<http://en.wikipedia.org/wiki/Stereogram>](<http://en.wikipedia.org/wiki/Stereogram>)

## DOCUMENT SOURCE
       This manual page was generated by the Netpbm tool 'makeman' from  HTML  source.   The  master
       documentation is at

              **<http://netpbm.sourceforge.net/doc/pamsistoaglyph.html>**

netpbm documentation                        05 April 2009              _Pamsistoaglyph_ _User_ [_Manual_(1)](https://www.chedong.com/phpMan.php/man/Manual/1/markdown)
