Depth of field and depth of focus

Depth of field is the range of object distances that an optical system images acceptably sharply; depth of focus is the matching range of positions for the image plane or sensor. In a diffraction-limited system both scale as λn/NA²: under half a micrometer for an oil-immersion objective.

Depth of field is the range of object distances that an optical system images acceptably sharply; depth of focus is the matching range of image-plane positions, where a sensor or film can sit and still record a given object sharply. Both shrink as the numerical aperture grows: as 1/NA2 in a diffraction-limited system, and as 1/NA for a camera judged by its circle of confusion. For a diffraction-limited system, the Rayleigh quarter-wave criterion gives a total depth

DOF=λ nNA2

measured on the side the NA refers to, in a medium of index n: about 55 µm for a 0.10 NA objective at 550 nm and about 0.4 µm in the specimen for a 1.40 NA oil-immersion objective. Camera lenses are judged instead by a blur spot on the sensor, the circle of confusion, and a 50 mm lens at f/4 focused at 3 m on a full-frame camera keeps everything from 2.6 m to 3.5 m acceptably sharp.

Depth of field and depth of focus

The two are the same tolerance seen from the two sides of the lens, related by the longitudinal magnification m2n′/n, where m is the transverse magnification and n and n′ are the indices on the object and image sides. The consequences run in opposite directions for cameras and microscopes. A camera focused on a distant scene has a depth of field of meters and a depth of focus at the sensor of tens of micrometers, so the sensor must sit precisely at the image plane. A 100× microscope objective with NA 1.40 in oil has an image-side NA of 0.014, which gives a depth of focus of 2.8 mm at the camera, but a depth of field of 0.4 µm in the specimen: the camera position hardly matters, while the specimen must be held in focus to a fraction of a micrometer.

Diffraction-limited depth

Moving a point source a distance Δz out of focus adds a wavefront error at the edge of the pupil of about Δz NA2/(2n). The Rayleigh criterion allows a quarter wave, which gives Δz=±λn/(2 NA2), a total depth of λn/NA2; within it the peak intensity of the image stays above about 80% of its best-focus value. Values at 550 nm:

Numerical apertureMediumDepth, λn/NA2
0.10Air55 µm
0.25Air8.8 µm
0.40Air3.4 µm
0.65Air1.3 µm
1.40Oil, n=1.5150.43 µm

The formula is paraxial and overestimates the depth at high NA. The exact quarter-wave result is λ/[2n(1−cos⁡θ)] with sin⁡θ=NA/n, which gives 1.15 µm at NA 0.65 and 0.29 µm for the 1.40 oil objective.

Depth of field of a microscope

A microscope image is recorded by a camera or seen by the eye, which cannot resolve arbitrarily small blur. The usual formula for the total depth of field adds a geometric term for the detector to the diffraction term:

d=λnNA2+n eM NA,

where e is the smallest distance the detector resolves in the image plane, such as the pixel size, and M is the total magnification onto it. With 6.5 µm pixels, a 10×/0.25 objective gives 8.8+2.6=11.4 µm, and a 100×/1.40 oil objective gives 0.43+0.07=0.50 µm. With a camera the diffraction term usually dominates; the detector term matters most at low magnification with coarse pixels. A confocal microscope, which rejects out-of-focus light with a pinhole, turns this shallow depth into a thin optical section, and focus stacking combines images taken at several focus positions into one image that is sharp throughout.

Depth of field of a camera lens

For photography and machine vision, the blur allowed at the sensor is the circle of confusion c, often taken as the sensor diagonal divided by 1500:

Sensor formatCircle of confusion
Full frame (36 × 24 mm)0.029 mm
APS-C0.019 mm
Micro Four Thirds0.015 mm
Phone camera (about 6.4 mm diagonal)0.004 to 0.005 mm

Machine vision systems often set c to one or two pixels instead. For a lens of focal length f at f-number N, the hyperfocal distance is

H=f2Nc+f,

and a lens focused at a distance s keeps objects sharp from

Dnear=s (H−f)H+s−2ftoDfar=s (H−f)H−s,

with the far limit at infinity once s≥H; for s much larger than f these become sH/(H+s) and sH/(H−s). For s much smaller than H, the total depth of field is about 2Ncs2/f2. A 50 mm lens at f/4 on a full-frame camera has H=21.6 m:

Focus distanceSharp fromto
10 m6.8 m18.6 m
3 m2.6 m3.5 m
0.5 m0.490 m0.511 m

The Depth of Field Calculator evaluates these limits and the hyperfocal distance for any lens and focus distance, and the microscope formula above for any objective and camera.

At the sensor, the depth of focus for a distant subject is ±Nc: ±0.058 mm at f/2 and ±0.23 mm at f/8 with c=0.029 mm.

Stopping down increases the depth of field in proportion to N, but the Airy disk grows as 2.44λN: 21.5 µm at f/16 and 29.5 µm at f/22 for 550 nm light, which at f/22 equals the full-frame circle of confusion. Beyond that point diffraction softens the whole image.

Lithography

Projection lithography prints at the highest NA available, and its depth of focus shrinks accordingly. With the scaling λ/NA2:

GenerationNAλλ/NA2
KrF0.60248 nm0.69 µm
ArF0.90193 nm0.24 µm
ArF immersion1.35193 nm0.11 µm
EUV0.3313.5 nm0.12 µm
High-NA EUV0.5513.5 nm0.045 µm

The immersion row leaves out the index of the water in which the image forms, n=1.44; with it, λn/NA2 gives 0.15 µm, and the exact quarter-wave depth, without the paraxial approximation, is about 0.10 µm. Production processes quote k2λ/NA2 with a process factor k2 of order one. Wafer flatness, focus control and resist thickness all have to fit within that budget.

Laser beams

For a focused Gaussian beam the natural depth is set by the Rayleigh range,

zR=πw02λ=λπ θ2,

where w0 is the waist radius and θ=λ/(πw0) the far-field half-angle. Over ±zR the beam radius stays within 2 of its waist: a 10 µm waist radius at 1064 nm gives zR=295 µm, a depth of 0.59 mm. Laser machining often uses a tighter tolerance, such as a 5% growth in spot size, which shortens the usable depth. The trade between spot size and depth of focus when choosing a focusing lens is tabulated in Focusing a Laser Beam.

Extending the depth of field

Stopping down trades resolution for depth, as described above. Focus stacking records several images at different focus positions and merges the sharp parts. Wavefront coding places a cubic phase plate in the pupil so that the blur becomes nearly independent of focus, then removes it by deconvolution. Light-field cameras record the direction of the incoming rays with a microlens array, which lets focus be chosen after capture at a cost in resolution, and electrically tunable lenses sweep the focus quickly enough to scan a volume.

Common questions

What is the difference between depth of field and depth of focus?

Depth of field is measured in object space: how far the subject can move and stay sharp. Depth of focus is measured in image space: how far the sensor can move. They describe the same tolerance and are related by the longitudinal magnification, the square of the transverse magnification (times the index ratio).

How does aperture affect depth of field?

Closing the aperture raises the f-number and lowers the NA, and the depth grows: in proportion to N for a camera lens, and as 1/NA2 for a diffraction-limited system. Closing one stop, a factor of 2 in f-number, increases a camera's depth of field by about 2.

Does focal length change the depth of field?

At the same subject distance and f-number, the depth of field falls as 1/f2. At the same framing, where a longer lens is used from farther away to keep the subject the same size, the depth of field is nearly the same for any focal length.

Why is the depth of field of a microscope so small?

Because the depth scales as λn/NA2, and microscope objectives have the largest NAs in imaging: at NA 1.40 it is below half a micrometer.

References: M. Born and E. Wolf, Principles of Optics, 7th ed. (Cambridge University Press, 1999). E. Hecht, Optics, 5th ed. (Pearson, 2017). S. F. Ray, Applied Photographic Optics, 3rd ed. (Focal Press, 2002). E. R. Dowski and W. T. Cathey, "Extended depth of field through wave-front coding," Applied Optics 34, 1859 (1995). B. E. A. Saleh and M. C. Teich, Fundamentals of Photonics, 3rd ed. (Wiley, 2019).

New entries, monthly

The glossary grows every month. One short email lists what’s new, nothing else.