Stereoscopic Vision
When one observes known objects, one can empirically determine their distance by the viewing angle with which one observes them. In other cases, one can determine their distance by moving one's head slightly, which causes a change of the relative position of their respective image within one's field of vision, which in turn allows one to determine the distance by determining the change of their position. Additionally, distance can also be estimated subconsciously by sensations from the eye's focusing mechanism and particularly by the eyes' muscle movements, whether those are focusing movements or aligning movements.
Excluding eye-muscle adjustment, the above is a lay-man's description for the notion of 'parallax', which is depicted on the following schematics.
Observer views object O from two different positions P1 and P2. O is closer to the observer than the background B, so the change of position from P1 to P2 forces a change of projection of O to the corresponding positions S1 and S2. Because B is much farther away than O, this change of projected positions is larger for O than for B. Accordingly, the observer perceives a visual change of position of O against B:
The parallax p then, is half the angular displacement of O against the fixed background B, relative to the observer. The determination of this displacement p, allows for a direct calculation of O's distance using simple trigonometry. This method is also used for stars as well. In the later case, P1 and P2 are taken as antipodal points on Earth's orbit around the Sun, when two measurements are taken, 6 months apart. The parallax shows on the photographic plate as a direct displacement of stars which are close against stars which are farther away.
In two-eyed vision, the two images that reach the retina are not exactly the same because of parallax, and the relative position of various points allows one empirically to judge which points are farther and which closer. This is called depth of field.
The "sense" of depth of field can additionally be duplicated with flat pairs of images when each member of the pair possesses exactly those differences in parallax which are required when one views similar real images. For example, in the following schematic, one can simply "merge" the two images, by using a certain "cross-eyed" technique. The latter, requires some experience.
When the images are successfully "merged" thus, schematic I will show concave "depth", while schematic II will show convex "depth".
Real Stereoscopic Photographs
Real stereo photographs can be taken using a regular or digital camera, by using a certain displacement between the photographs, against the same field of view. The stereo sensation is ideal when the displacement between the two photographs is equal to the interpupillary distance, that is, the distance between the pupils of an average human.
The technique is simple: Two photographs are taken, one at position P1, the other at position P2, of object O. The distance between P1 and P2 (which is the distance between the camera between the successive shots) is D(P1,P2)=interpupilary distance=~6.5cm. The greater the distance D, the more intense the stereoscopic sensation when viewing the images merged.
Then the photo from position P1 is placed LEFT and the photo from position P2 is placed RIGHT on the screen and they are merged using a suitable method for stereoscopic viewing. And here are some results:
       
       
       
Another example can be seen on the High Pressure Mercury Lamp Page and an artificial example on the Indra's Net of Pearls Page. All the previous examples require some experience to be able to merge the images. The merging happens according to the following figure. Initially each eye views the two images separately. The left eye views image II while the right eye views image I. By "fusing" the images, the brain forces the two eyes to slightly "cross-eye" by increasing the angle between the two optical axes, as a result of which the brain now perceives a new image in stereo mode, provided images I and II have the required differences.
When such a conscious method of "fusing" the two images is not easily achievable, another method is quite popular, that of merging two symmetrical images (around the y-axis) using a mirror.
This technique works as follows: One takes two real pictures of a scene with the proper displacement D. Then, one inverts the right image (or left, depending on which image needs to be mirrored) around the y-axis. Both images are then placed side by side. If a mirror M is placed vertically at the location of the red line and the viewer looks at the images so that the left eye views image II, while the right eye views image I reflected through the mirror, then, with a bit of effort when the images merge, the resulting sensation will be stereoscopic. The pairs below have been adjusted so that the right eye views the right image I through the mirror.
Subjectively the mirror method gives a "truer" stereoscopic sensation, primarily because this method is equivalent to the "parallel viewing" method (see below).
An Example of Distance Estimation Using Parallax
Let's follow an actual example of distance estimation using the parallax between two actual stereo photographs, using Maple:
We will try to estimate the distance of the distant incandescent lamp, next to the door, based on its parallax shown on the photos, above. First, we measure the angle the author's thumb subtends on the photo:
> R:=37;#arm's length in front of camera lens (cm)
> Td:=2.3;#thumb thickness (cm)
> C:=2*Pi*R;#circumference (cm)
> Ta:=2*Pi*Td/C;#Thumb angle
> Tp:=15;#Thumb pixels
> pp:=3;#parallax pixels of lamp
> rad2deg:=r->r*180/Pi;#conversion
> rad2deg(Ta);#degrees of thumb
The author's thumb subtends an angle of Ta radians. Additionally, the author's thumb occupies 15 pixels on the photo above. Now let's measure the parallax the far-away incandescent lamp displays on the above photos. For this, we need a background reference. We choose the little ornament which hangs on the door. The distance between this ornament and the incandescent lamp is 13 pixels on the left photo and 16 pixels on the right photo. Hence, the incandescent lamp displays a parallax pp~3 pixels on the photo-pair, above. This corresponds to an angle pp/Tp times the angle the author's thumb subtends to.
Hence, with a displacement of D = 50 cm, the calculated distance of the incandescent lamp LD is:
> solve(tan(Ta*pp/Tp)=50/LD,LD);
4021.531922
~40.2m. The actual distance is ~ 9.6 m. David Typinski of sci.astro.amateur and Rob Johnson of sci.math observe that the calculation is likely correct, and the distance discrepancy probably stems from the proximity of the background (which itself undergoes angular displacement) in measuring parallax. A far away reference (instead of the door) would give a better approximation.
Various Thoughts
The two above methods for stereo photography, succeed for all but one case: Astrophotography. Even when using binoculars which increase D beyond the common interpupillary distance, the distance of the stars is so great that the difference between the two different photographs taken (and thus the parallax) is not sufficient to generate a stereoscopic sensation. However, when the position of locations P1 and P2 is great enough, such as when photographs are taken at antipodal points of the Earth's orbit around the sun, or when parallax is generated artificially, such a sensation can still be generated.
Pseudo-stereographs can also be created from a single image, by applying an appropriate convolution to the original:
Note that all of the above applies to creating cross-eyed stereo photo pairs. There is an alternate technique for fusing stereo pairs together, by viewing each image with a separate eye (parallel viewing). In this case, the images are swapped. For more information on this method, check Dale Gombert's Stereography Pages[1].