Stereogramaxo
Self-designed Autostereogram Generator
Install / Use
/learn @mexomagno/StereogramaxoREADME
Stereogramaxo
This started as a weekend project, inspired on boredom and genuine love and curiosity for these beautiful works of art.
It is written in python for the sake of simplicity, and relays on the active PIL fork, Pillow for image processing.
Examples:
The following images were generated by using this tool. In order to understand them, you should know how to see stereograms.

Usage:
The project is built as a python script.
$ python main.py --help
usage: main.py [-h] (--depthmap DEPTHMAP | --text TEXT)
(--dots | --pattern PATTERN) (--wall | --cross)
[--dot-prob DOT_PROB] [--dot-bg-color DOT_BG_COLOR]
[--dot-colors DOT_COLORS] [--blur BLUR]
[--forcedepth FORCEDEPTH] [--output OUTPUT]
Stereogramaxo: An autostereogram generator, by Mexomagno
optional arguments:
-h, --help show this help message and exit
--depthmap DEPTHMAP, -d DEPTHMAP
Path to a depthmap image file
--text TEXT, -t TEXT Generate a depthmap with text
--dots Generate a dot pattern for the background
--pattern PATTERN, -p PATTERN
Path to an image file to use as background pattern
--wall, -w Wall eyed mode
--cross, -c Cross eyed mode
--blur BLUR, -b BLUR Gaussian blur ammount
--forcedepth FORCEDEPTH
Force max depth to use
--output OUTPUT, -o OUTPUT
Directory where to store the results
--dot-prob DOT_PROB Dot apparition probability
--dot-bg-color DOT_BG_COLOR
Background color
--dot-colors DOT_COLORS
Colors of dots
The demo images above were generated by issuing:
# First shark: Dot pattern
$ python main.py --depthmap depthmaps/shark.png --dots --wall --output .
{"text": "output_image_1.png", "code": 200}
# Second shark: Image pattern, cross-eyed
$ python main.py --depthmap depthmaps/shark.png --pattern patterns/jellybeans.png --cross --output .
{"text": "output_image_2.png", "code": 200}
# Third shark: Flatter, smoother:
$ python main.py --depthmap depthmaps/shark.png --pattern patterns/jellybeans4.png --wall --forcedepth 0.4 --blur 10 --output .
{"text": "output_image_3.png", "code": 200}
On success, the resulting image will be stored inside the specified output folder. If no output directory is specified, the generated image is temporarily displayed.
Web GUI
As a convenience feature, I include a simple web gui to interact with the script, as well as a PHP backend script to interface between the python script and the GUI.
First screen

From the GUI you have access to every feature of the cli script. When generated, the resulting image is displayed in a modal over the form.
Editing to create a dot-pattern 3D text stereogram

Installation
CLI tool:
- Clone the project somewhere
- Install the required pip packages specified in the Pipfile
Web GUI:
- Install a web server (I used Nginx)
- Install php (5 or higher should be enough)
- Move files from
WEBfolder to wherever you need to in order to make them accessible from your web instance - Make sure to correctly configure file permissions to be able to use them with your webserver
- Edit the
WEB/run.phpfile and change the value of the$sirds_pathvariable to point to where you cloned the project - Done
Beware of the paths I'm using inside this file: I use an
ENVfolder, as this is where I configured my virtualenv. Change it to match your own environment.
Features
- Support for Random dot and image-based patterns
- Customizable dot pattern colors (background, dots)
- Text depth map generation (as an alternative to external depthmaps)
- Wall-eyed and Cross-eyed modes supported
- Center-to-sides pixel displacement
- Blur filter
- Process done on oversampled copy for smoother results
- "Forced depth" feature, allows to force total depth independent of the actual depthmap grayscale range. Useful if depthmap levels are extreme or too flat.
TODO:
- Maybe some optimizations (multi threading?)
- Host somewhere
- Improve artifacts on sharp edges (specially on autogenerated text depth maps)
What never got to be done
(take a look at animated_sirds.py)
- Animated stereograms by varying depth, smoothness, background patterns
- Animated stereograms using depthmap based videos
