How it is calculated
The lens is modeled as a thin lens. For an object at distance \(s\) from the front principal plane of a lens of focal length \(f\), the magnification (image size over object size) and the field of view are
where \(p\) is the pixel pitch. To resolve a defect reliably it should span several pixels (typically 3–5), so the smallest detectable defect is that many object-side pixels.
Depth of field
The depth of field is the range of object distances over which the geometric blur at the sensor stays under the acceptable circle of confusion \(c\) (a diameter, set here as a number of pixels). This is not the laser “depth of focus” of the beam calculators, which is the distance over which a focused spot grows by a set fraction. For a thin lens with the aperture stop at the lens, the near and far limits follow exactly from the hyperfocal distance \(H = f^2/(Nc) + f\):
For close-up work (\(s \ll H\)) this reduces to the familiar approximation
A common mistake. The expression \(2Nc(1+m)\) is the image-side depth of focus: how far the sensor can move. Object-side depth of field carries the extra factor \(1/m^2\). At m = 0.14 the two differ by a factor of about 50. Using the wrong one makes a lens look far less forgiving than it is.
Closing the aperture (larger N) increases the depth of field in proportion to N in this approximation, but it also enlarges the diffraction spot in proportion to N and cuts the light on the sensor in proportion to \(1/N^2\): each full stop (N × √2) halves it. That trade-off is the central compromise in machine vision optics.
Diffraction vs. pixel size
At the sensor, light from a point forms an Airy disk whose diameter to the first dark ring is \(2.44\,\lambda N_w\), where \(N_w = N(1+m)\) is the working f-number (for a lens with equal entrance and exit pupils). In incoherent light, a diffraction-limited lens with a circular aperture transmits no detail finer than the cutoff frequency \(1/(\lambda N_w)\), in cycles per millimeter when \(\lambda\) is in millimeters. The sensor can only represent detail up to its Nyquist frequency \(1/(2p)\), one cycle per two pixels.
The ratio alone is not the whole story. An ideal lens’s MTF falls continuously to zero at the cutoff,
so a ratio of exactly 1 still means zero contrast at Nyquist. A ratio of 1.2 gives about 8 %, and 1.5 gives about 22 %.
- Cutoff ÷ Nyquist ≥ 2: sensor-limited. The optics keep useful contrast (39 % or more) at the pixel Nyquist frequency. Smaller pixels or more magnification would help, and fine periodic patterns can alias.
- Between 1 and 2: balanced. Both the optics and the pixels limit resolution. Contrast at Nyquist is low, so small defects lose contrast before they lose pixels.
- Below 1: diffraction-limited. The pixels oversample the blur. Opening the aperture (smaller N), if depth of field allows, adds real resolution. Adding pixels does not.
Real lenses fall short of the diffraction limit, most of all at wide apertures, where aberrations dominate, so these MTF values are upper bounds. Check the lens maker’s MTF curve at your sensor’s Nyquist frequency.
Worked example
A 2/3″ IMX250 camera (3.45 µm pixels, 2448 × 2048) with a 25 mm lens at f/2.8, 200 mm from the part:
- m = 25/175 = 0.1429, so the 8.446 × 7.066 mm sensor sees a 59.12 × 49.46 mm field. Each pixel covers 24.15 µm, so a 3-pixel defect is 72.5 µm.
- With c = 2 px (6.9 µm), H = 32.37 m and the part stays in focus from 198.9 to 201.1 mm: a depth of field of 2.16 mm. The image-side formula would wrongly give 0.044 mm.
- Nw = 3.2, so the Airy disk at 550 nm is 4.29 µm, 1.24 pixels. The cutoff-to-Nyquist ratio is 3.92 (ideal-lens MTF at Nyquist 68 %), so this setup is sensor-limited. To find smaller defects, increase magnification or use smaller pixels. Do not stop down.
For a 100 mm field at 300 mm with the same sensor, the lower panel gives f = 23.4 mm. A standard 16 mm lens gives a 150 mm field. A 25 mm lens needs the part about 321 mm away.
Assumptions and limits
- Thin-lens, paraxial model with a pupil magnification of 1. Real multi-element lenses have separated principal planes and asymmetric pupils, so treat distances as approximate and confirm with the lens vendor’s calculator or a test image.
- Every lens has a minimum object distance, listed in its datasheet. Closer work needs a spacer ring (extension tube) or a macro lens. The “extension” result is the extra lens-to-sensor distance needed beyond infinity focus.
- Telecentric lenses do not follow \(m = f/(s-f)\). Their magnification is fixed and their depth of field is set by the object-side NA.
- Depth of field is geometric and ignores diffraction. When the Airy disk is comparable to \(c\) or larger, the usable depth is smaller than shown.
- Pixel figures assume a monochrome sensor. In a color camera’s Bayer filter, green covers every other pixel and red and blue each cover every second row and column, so fine color detail is sampled at about half the monochrome pixel density in each direction. Allow up to about twice as many pixels across a defect, or use a monochrome camera.
- Detectability also depends on contrast, lighting, noise, and the algorithm. The pixel-count rule is a starting point, not a guarantee.
References
Primary sources and standards
- B. Jähne, Digital Image Processing and Image Acquisition, 7th ed., Springer (2026), doi:10.1007/978-3-032-04806-6, secs. 3.4.2 and 3.4.4 (image scale, the imaging equation, depth of focus and depth of field), 3.5.2–3.5.3 (the MTF of diffraction-limited optics), and 5.2.3 (the sampling theorem).
- J. E. Greivenkamp, Field Guide to Geometrical Optics, SPIE Press (2004), doi:10.1117/3.547461 (f-number, depth of focus and depth of field, hyperfocal distance).
- J. E. Greivenkamp, “Camera Systems,” sec. 17 of the course notes for OPTI 201/202, Geometrical and Instrumental Optics, University of Arizona (2018), PDF (depth of focus, and the near and far limits and hyperfocal distance in the small-blur approximation, for a thin lens with the stop at the lens; free).
- G. D. Boreman, Modulation Transfer Function in Optical and Electro-Optical Systems, SPIE Press (2001), doi:10.1117/3.419857, secs. 1.5 (the diffraction MTF of a circular aperture and its cutoff) and 2.1–2.2 (pixel footprint, sampling, the Nyquist frequency, and aliasing).
- C. E. Shannon, “Communication in the presence of noise,” Proc. IRE 37, 10–21 (1949), doi:10.1109/JRPROC.1949.232969 (the sampling theorem behind the Nyquist frequency 1/(2p)).
- C. Steger, M. Ulrich, and C. Wiedemann, Machine Vision Algorithms and Applications, 2nd ed., Wiley-VCH (2018), ISBN 978-3-527-41365-2, secs. 2.2.2–2.2.4 (lens model, pupils, depth of field, telecentric lenses) and 2.3.3 (color cameras and the Bayer filter).
- B. E. Bayer, “Color imaging array,” U.S. Patent 3,971,065 (1976), patents.google.com/patent/US3971065A (the color filter layout: green on every other pixel, red and blue on alternate rows).
- E. Hecht, Optics, 5th ed., Pearson (2017), ch. 5–6 (geometrical optics) and ch. 10 (diffraction).
Textbooks
- J. H. Moore, C. C. Davis, M. A. Coplan, and S. C. Greer, Building Scientific Apparatus, 4th ed., Cambridge University Press (2009), secs. 4.2.4–4.2.5, pp. 162–174 (imaging systems: numerical aperture, f-number, stops and pupils, light collection scaling as 1/N²; the modulation transfer function with the closed-form diffraction-limited MTF, eqs. 4.78–4.80).
- W. M. Steen and J. Mazumder, Laser Material Processing, 4th ed., Springer (2010), sec. 2.8.1, pp. 102–104 (focused spot size: the thin-lens relations of Table 2.5 and the 2.44 fλ/D Airy diameter, eq. 2.11).
- H. H. Telle and A. González Ureña, Laser Spectroscopy and Laser Imaging: An Introduction, CRC Press (2018), sec. 17.2.2, pp. 480–482 (sampling and its relation to spatial resolution: the Nyquist pixel criterion, illustrated by pixels across a feature).
Free introductions
- Edmund Optics, “Depth of Field and Depth of Focus,” edmundoptics.com (how the f-number and the working distance change the depth of field, shown with real lens data, and the image-side depth of focus 2 × working f-number × pixel size).
- J. Conrad, “Depth of Field in Depth,” Large Format Page (2006), PDF, eqs. (6), (7), (11), (24), and (25) (the exact near and far limits, the hyperfocal distance f²/(Nc) + f, and the close-up approximation 2Nc(1+m)/m²; free).
- Edmund Optics, “The Airy Disk and Diffraction Limit,” edmundoptics.com (the 2.44 λ f/# spot, the cutoff frequency, and the 10 % and 20 % contrast guidance).
- H. H. Nasse, “How to Read MTF Curves,” Carl Zeiss Camera Lens Division (2008), PDF, p. 9 (resolving power read where the MTF falls below a low threshold such as 10 %, and why that limit is imprecise).
- Imatest, “Sharpness,” imatest.com (the visual resolution limit corresponds to an MTF of roughly 10 to 20 %; MTF10, MTF20, and MTF50).
- R. Paschotta, “F-number,” RP Photonics Encyclopedia, doi:10.61835/bx3 (stops, light throughput, and the working f-number).