software to calculate depth-images from magic-eye-stereogramms (2003)

StereoDecoder 0.1 (ZIP-file, 409 KB, download)
This small tool calculates and visualizes hidden depth-images from stereogramms.
You propably remember all those magic-eye-images or Single-Image-Randomdot-Stereogramms. With this software it's possible to find out what's hiding in the image without getting a headache!

view screenshot

An Example (click images to view larger version):
stereogramm with hidden depth-image:
view screenshot

reconstructed depth-image using StereoDecoder 0.1:
view screenshot

original depth-image, used for stereogramm-creation:
view screenshot


How to use StereoDecoder:
0. Download from above and unzip somewhere.
1. Start StereoDecoder.exe.
2. Click on '...' and load an image containing a stereogramm. (This image gets converted and saved in 24-bit-BMP-format for step 6. )
3. View this image with other software to find out the average horizontal pattern-width.
You can also divide the image-with by the number of patterns, repeated horizontally.
If your image is 640 pixels wide and you see patterns being horizontally repeated eight times, you can start with a pattern-width of 640 / 8 = 80 pixels.
4. Use this pattern-width as 'avg. search-dist' in StereoDecoder.
5. Choose a blocksize for internal comparisions.
Use smaller sizes (2 - 4) until you found a proper search-distance. Higher values (6 - 12) give better results, but take longer time. Much higher values usually make no sense.
6. Click on 'decode image'. Now OpticalFlow.exe will get started and a new window will open, showing you the reconstructed depth-image. First you will see garbage, but after 10 to 20 iterations, the noise should clear up reveiling the hidden depth-image. If not, try a different search-distance.
7. While the new window is activated, you can change the blocksize by pressing '1' - '9'. 'n' starts again with noise.



Quality and known Bugs:
Theres one minor problem. There's often noisy garbage at the contours on the right side of objects.
If the images were scanned badly, scaled to a different size or saved as JPEGs, then don't expect too much from StereoDecoder, cause all this ruins the 3D-effect of those images.




How it works:
I found the algorithm by accident while trying around with stereo-mapping of binocular images.

There you have two corresponding images and you want to find out where pixel P(x,y) is located in the other image. While staring on a stereogramm, the images we perceive from our eyes get shifted against each other by some pixels until they match again and produce this funny depth-effect.
So in both cases we have two corresponding images, where some pixels moved. If we find out how far and where they moved, we can guess about their position in 3D-space.

So I took two shifted copies of a stereogramm and thought about finding the pixel-correlations. Now you can eiter search your ass off trying to find common features in both images or you can go the neuro-biological way and simulate some stupid neurons with a little cooperation.

So each pixel in one image gets one simulated neuron, which only points to another pixel in the other image. Initially they are set to random values, so they just point somewhere. Most of them will produce bad results, but a few will point to the correct area.
Now the software compares all connected pixels (plus some pixels around) and calculates the difference between the connected areas. When all the differences are stored, cooperation can start. Again we step through all our neurons and compare the differences with its four direct neighbours. If one of them got a better result (means a lower difference to the area it points to) it has a higher propability to point to the right area.
So our neuron adjusts its vector to point almost in the same direction as the more successful neighbour. When all the neurons are updated, we start all over again, wait and see.


Yep, that's it, have fun!
 -  Legal Note  -  Contact  -