Depth of Field
What it is
A photographic image is only sharp in the focus plane. The farther an object is located in front of or behind the focus plane, the more it is blurred.
However, this blur is not recognizable if it stays below a certain amount. In classical photography which has a printed image as a goal (no matter whether digital or analog) the perception of the human eye is the limiting factor.
The human eye commonly accepts an edge as sharp, if the angle of view of the blur is smaller than 1 arc minute. Hence a point blurred to that amount has the diameter of 2 arc minutes, which is the same as 1/1700 of the viewing distance.
This is the allowed diameter of the so called Circle of Confusion. The normal viewing distance in classical photography is assumed to be equivalent to the printed image diagonal. The circle of confusion is the basis for most Depth of Field calculators or tables.
Considerations for zoomable panoramas
For computer displayed panorama creation where one can zoom into the image, the limit must be the pixel distance in the viewable panorama - unless you don't allow to zoom in until 100% pixel view.
Since a pixel in an equirectangular panorama corresponds to a certain angle of view in reality, we can directly calculate the allowed angle of confusion in the shot image. It is 360° divided by the pixel width of the equirectangular image.
For a standard angle of confusion of 2 arc minutes this would result in an equirect image with 10800*5400 pixel. If zoomable panoramas are smaller in pixel size, the Depth of Field is far bigger than for classical photography and standard depth of field calculators are of no big use. Read on to see how to circumvent this.
In the increasingly popular gigapixel panoramas, where longer lenses are used, Depth of Field is a serious issue. While stopping down increases DoF, image blur due to diffraction limits the sharpness and the final resolution. Effective resolution can be calculated using the Rayleigh criterion. See the main article on Diffraction for more details.
In most cases a panorama should be sharp from the horizon to the nearest objects. Since the Depth of Field region is partly in front of and partly behind the focus plane, you sacrifice a fair amount of Depth of Field if you focus to infinity - only one part of the depth of field range is used.
However, there is a distance you can focus on, that extends the Depth of Field exactly from infinity to a nearer limit. This is the hyperfocal distance. It can be calculated, if the allowed circle of confusion (see above) on the sensor is known.
Following the above considerations on Depth of Field for zoomable panoramas we can calculate a small table with
- Width - image width in pixels
- AoC - angle of confusion in arc minutes
- CoC - Circle of Confusion on full format DSLR or analog film in mm (diagonal 43.3mm)
- CoC1.6 - Circle of Confusion on crop factor 1.6 DSLR in mm (diagonal 27mm)
Width AoC CoC C0C1.6 16000 1.4 0.017 0.011 12000 1.8 0.023 0.014 10000 2.2 0.027 0.017 8000 2.7 0.034 0.021 6000 3.6 0.045 0.028 4000 5.4 0.068 0.042
The formula for this calculation is
CoC = sin(AoC) * sensor diagonal AoC = 360 / Width
With this values you can go into any depth of field calculator where you can enter the circle of confusion like for example http://www.tawbaware.com/maxlyons/calc.htm and calculate the hyperfocal distance (and the Depth of Field if required).
In any case the near limit of the Depth of Field is half the hyperfocal distance.
Please note, that all these values for fisheye lenses are only approximations, since their focal length changes from the center to the edges as well as the effective aperture changes.
Extending depth of field in software
Rik Littlefield added functionality to the pano12 library to merge multiple exposures with different focal distances into a single image with extended depth of field. This has largely been superceded by new software, notably Zerene Stacker, CombineZ, SAR, Helicon focus and enfuse.
Some Investigations Regarding Depth of Field by Rik Littlefield: 
Erik Krause 16:50, 6 Jun 2005 (EDT)