Random-dot stereogram

Both images below are nothing but random dots, and neither shows a shape. Yet part of the dots are shifted between them, and matching the two images reveals a square floating in front of the background. Stereo needs no recognizable objects, only correspondences.

The stereo pair to see it in depth, look through the screen (left | right) or cross your eyes (right | left) until the two images fuse
Comparison at one disparity 1−∣IL(x,y)−IR(x−d,y)∣1 - |I_L(x, y) - I_R(x - d, y)|: white where the dots agree
Disparity map bright = near

Depth without objects

One might think that stereo works by first recognizing objects in both images and then comparing where they are. Random-dot stereograms show that it does not have to: each image is a uniform field of random dots, without edges, shapes or any other cue. Only the correspondence between the two images contains the shape.

To build one, take two surfaces covered with random dots, a background and a shape in front of it, and render them as two cameras of a rectified stereo pair would see them. The dots of the shape appear shifted by its disparity, those of the background by a smaller one. Where the shape hides different parts of the background in the two images, a strip of background is visible in one image only, filled with new dots.

Finding the shape

Comparing the left image with the right one moved by a disparity dd makes all surfaces with that disparity agree everywhere, and everything else agree only by chance, for about half of the dots. Sweeping dd shows the background at its disparity and the shape at its own. Window matching does this for every pixel and picks the best dd: with random dots, every window is distinctive, so the disparity map comes out almost perfectly, except at the edges of the shape and in the strips seen by only one camera.

Human vision does the same. Bela Julesz used random-dot stereograms to show that the brain can match the images of the two eyes before recognizing anything, and the same principle is behind single-image stereograms such as the Magic Eye pictures.

Try this