Depth of Field & Digital SLRs
Depth of Field & Digital SLRs
I've wondered in the past about how hyperfocal distance was calculated and in particular what level of blur is allowed for the nearest and farthest points in the "in focus" region. Being curious and somewhat masochistic, I decided to do the calculation myself. I'll post the calculation here as I think it illustrates some interesting points.

First, let's go over what the hyperfocal distance is. It is the distance (for a given lens at a given aperture) at which one should focus such that two other points of interest (one near and one far) are both in focus along with everything in between. By "in focus", I mean that the blur circle is less than some given size which we will choose later (see Fig. 1 below). For this calculation, I am going to assume that the farthest point which is in focus is infinity.
For this calculation, I will use two basic equations. The first is the thin lens equation:
1/f = 1/o + 1/i
Where f is the focal length of the lens, i is the distance from the lens to the image, and o is the distance from the lens to the object.
The second is simply the geometric equation which gives the size of blur circle (neglecting diffraction and aberrations):
S = A*e/B
Where S is the diameter of the blur circle, A is the diameter of the aperture of the lens, B is the distance behind the lens at which those rays come to focus, and e is the distance from the point of focus of those rays to the CCD plane.

Fig. 2: Schematic defining some quantities which I will be using in the calculation below.
To start, we will calculate the hyperfocal distance d at which rays from infinity will have a blur circle of diameter less than S. Using the definitions given in Fig. 2, the lens equation gives us:
1/f = 1/d + 1/(f+df)
And the blur circle diameter is given by:
S = A*df/(f+df)
To begin, we'll solve the lens equation for df:
df = f2/(d-f)
Plug that into the equation for S:
S = A*(f2/(d-f))/(f+f2/(d-f)) = A*f2/(f(d-f)+f2) = A*f/d
Using the relation that the f-ratio, F = f/A to eliminate A in favor of F, solve for d:
d = f2/(F*S)
Thus, if we define some blur size S below which an image is in focus, then we can calculate the hyperfocal distance d for a lens of focal length f at a given f-ratio F.
Now the question becomes what shall we plug in for S? There are several reasonable values we could use here. Typically one treats the resolution of film as about 20-25 microns. This leads to values for the hyperfocal distance which I've seen in several published books (e.g. Photographing the Landscape: The Art of Seeing by John Fielder, page 112).
A value of 20-25 microns might make sense for film, but does it make sense for a DSLR? Well, for example, the Canon 10D 6 megapixel 1.6x reduced frame DSLR has individual pixels about 7.4 microns square. A 20-25 micron blur size is about 3 pixels across for the 10D. This is actually a quite reasonable resolution criterion from the prospective of collecting information. Shanon's sampling theorem roughly says that to collect all the information in a signal, one must have at least two sampling sites (pixels) across the smallest feature (which in this case is the blur circle). We have three pixels across the blur circle, but some might argue that the diagonal size of the pixel is what matters, in this case the diagonal is 10.5 microns, giving us about 2 pixels across the blur circle. Other's might argue, however, that the 7.4 micron side of the pixel is what matters since we get 7.4 microns in two orthogonal dimensions. This would make the appropriate S value 2 pixels or about 15 microns.
Just to make thing even more complex, the above argument is based on maximizing the information content of the image. That's great if you're doing critical measurements, but perhaps your goal is to make an aesthetically pleasing image, you might have a different set of criteria. One might argue that to make something appear sharp, the best case if for the blur circle to be totally unresolved by the pixels. For example, one could make the blur circle 7.5 microns (or about 1 pixel). Then, even when the image is zoomed in enough to show pixelation, there will be no visible blurring.
There is one more possible criteria: we want to keep the geometric blur size S smaller than the blur size due to diffraction at that lens aperture. The diffraction pattern of an aperture is a complex shape called an Airy disk (see the image at left). The Airy disk is roughly Gaussian near the peak, but drops to zero and then has smaller peaks at larger radii. The full width at half max (FWHM) of the airy disk is given by:
theta = 1.02*lambda/A
Where theta is the FWHM in angular units (radians) and lambda is the wavelength of the light in question.
Now we need to convert the angular resolution theta into a linear size on the detector. This is simply a factor of multiplying by the focal length (because theta in the above equation is expressed in radians and because theta is small, so we can use the small angle approximation).
S = 1.02*lambda/A*f = 1.02*lambda*F
We'll use the longest wavelength recordable by the detector as lambda (this is the color which has the largest diffraction blur size). For most digital cameras this is about 6500 angstroms or 0.65 microns.
S = 0.66*F (in microns) = 0.00066*F (in mm)
Thus, the hyperfocal distance d as a function of the f-ratio is:
d = 1515mm*f2/F2
This is a stronger constraint on the blur circle for large apertures (less than about f/22), but is a loser constraint at apertures of f/32 and smaller:
S (@ f/11) = 7.3 microns
S (@ f/16) = 10.6 microns
S (@ f/22) = 14.5 microns
S (@ f/32) = 21.1 microns

What about the nearest distance that is in focus? Using the definitions in Fig. 4, we can calculate that as well:
1/f = 1/d + 1/B
1/f = 1/n + 1/(B+dB)
S = A*dB/(B+dB)
Solve for B in the first equation and dB in the second:
B = f*d/(d-f)
B + dB = f*n/(n-f)
dB = f2(d-n)/(d-f)/(n-f)
Now plug those into the equation for S and solve for d/n:
d/n = S*F/f*(d/f-1)+1
Plug in our result for d from above:
d/n = 2 - S*F/f
Thus the rule of thumb that the nearest distance in focus n is half of the hyperfocal distance d is true, but only when S*F/f is small, which will be true in all cases except when the focal length of the lens is very short (some sort of extreme wide angle lens) and the f-ratio is very large. Even an 8mm lens at f/32 will have a d/n of 1.9 for the 25 micron spot size.
To summarize, we can now generate a new hyperfocal distance chart using each of these criteria: