page_title: Autostereogram
section_title: Random-dot
hierarchical_section_title: Autostereogram / How they work / Random-dot
context_page_description: An autostereogram is a single-image stereogram, designed to create the visual illusion of a three-dimensional scene from a two-dimensional image. In order to perceive 3D shapes in these autostereograms, one must overcome the normally automatic coordination between accommodation and horizontal vergence. The illusion is one of depth perception and involves stereopsis: depth perception arising from the different perspective each eye has of a three-dimensional scene, called binocular parallax.
  The simplest type of autostereogram consists of horizontally repeating patterns and is known as a wallpaper autostereogram. When viewed with proper convergence, the repeating patterns appear to float above or below the background. The well-known Magic Eye books feature another type of autostereogram called a random dot autostereogram. One such autostereogram is illustrated above right. In this type of autostereogram, every pixel in the image is computed from a pattern strip and a depth map. A hidden 3D scene emerges when the image is viewed with the correct convergence.
  Autostereograms are similar to normal stereograms except they are viewed without a stereoscope.
context_section_description: A computer program can take a depth map and an accompanying pattern image to produce an autostereogram. The program tiles the pattern image horizontally to cover an area whose size is identical to the depth map. Conceptually, at every pixel in the output image, the program looks up the grayscale value of the equivalent pixel in the depth map image, and uses this value to determine the amount of horizontal shift required for the pixel.
  One way to accomplish this is to make the program scan every line in the output image pixel-by-pixel from left to right. It seeds the first series of pixels in a row from the pattern image. Then it consults the depth map to retrieve appropriate shift values for subsequent pixels. For every pixel, it subtracts the shift from the width of the pattern image to arrive at a repeat interval. It uses this repeat interval to look up the color of the counterpart pixel to the left and uses its color as the new pixel's own color.
  Unlike the simple depth planes created by simple wallpaper autostereograms, subtle changes in spacing specified by the depth map can create the illusion of smooth gradients in distance. This is possible because the grayscale depth map allows individual pixels to be placed on one of 2ⁿ depth planes, where n is the number of bits used by each pixel in the depth map. In practice, the total number of depth planes is determined by the number of pixels used for the width of the pattern image. Each grayscale value must be translated into pixel space in order to shift pixels in the final autostereogram. As a result, the number of depth planes must be smaller than the pattern width.
  The fine-tuned gradient requires a pattern image more complex than standard repeating-pattern wallpaper, so typically a pattern consisting of repeated random dots is used. When the autostereogram is viewed with proper viewing technique, a hidden 3D scene emerges. Autostereograms of this form are known as Random Dot Autostereograms.
  Smooth gradients can also be achieved with an intelligible pattern, assuming that the pattern is complex enough and does not have big, horizontal, monotonic patches. A big area painted with monotonic color without change in hue and brightness does not lend itself to pixel shifting, as the result of the horizontal shift is identical to the original patch. The following depth map of a shark with smooth gradient produces a perfectly readable autostereogram, even though the 2D image contains small monotonic areas; the brain is able to recognize these small gaps and fill in the blanks (illusory contours). While intelligible, repeated patterns are used instead of random dots, this type of autostereogram is still known by many as a Random Dot Autostereogram, because it is created using the same process.
caption: Every pixel in an autostereogram obeys the distance interval specified by the depth map.
exif: {}