Start from the defect
Write down four things before you pick hardware:
- The smallest defect that matters, as a size and a type: a scratch, chip, particle, bubble, stain, or dimensional error.
- The contrast mechanism. Does the defect absorb, scatter, refract, change color, or change height? This decides the lighting more than anything else.
- Throughput: part size, line speed, and the time available per part.
- The cost of each error type. An escape (a missed defect) and a false call (a good part rejected or sent to manual review) usually have very different costs, and the system’s threshold will trade one for the other.
Everything that follows is about getting enough pixels and enough contrast on that defect, in focus, without blur, every time.
The resolution chain: pixels, optics, and contrast
Three things limit how small a defect the system can see: how finely the pixels sample the part, how much fine detail the lens passes, and whether the defect stands out from the noise. The weakest of the three sets the limit.
Sampling. The size of one pixel projected onto the object is \(p_\text{obj} = \text{FOV}/N_\text{pixels}\). A 150 mm field imaged onto 4096 pixels gives 36.6 µm per pixel. The finest pattern the sensor can record has one light and one dark line per two pixels: the Nyquist frequency, \(\nu_N = 1/(2p)\) for a pixel pitch p (the spacing of the pixels on the sensor), or 145 line pairs per millimeter (lp/mm) for 3.45 µm pixels. Finer periodic patterns alias: they show up as false, coarser patterns.
Optics. Even a perfect lens blurs fine detail, because light diffracts at its aperture. The modulation transfer function (MTF) gives the share of a pattern’s contrast that the lens keeps at each spatial frequency. For a diffraction-limited lens with a circular aperture, in incoherent light, it falls to zero at the cutoff frequency
where λ is the wavelength, N is the f-number set on the lens, and \(N_w\) is the working f-number at magnification m (this form assumes equal entrance and exit pupils). The Airy-disk diameter to the first dark ring, \(2.44\,\lambda N_w\), is the smallest blur spot the lens can form.
Contrast is the currency. Resolution charts measure whether a pattern can be resolved, but inspection succeeds or fails on whether the defect’s signal stands clear of noise: sensor noise, surface texture, and part-to-part variation. A defect that changes intensity by 5 gray levels on a background that varies by 10 is not reliably detectable at any resolution. As a starting point, lens makers’ rule of thumb is about 10 % contrast in the image at the defect’s spatial frequency to show the detail at all, and 20 % or more as a safer design target; then engineer the lighting so the defect signal is several times the background noise. To compare cameras’ noise and sensitivity, use the EMVA 1288 figures (quantum efficiency, dark noise, saturation capacity) that many camera makers publish.
Choosing magnification, field of view, and working distance
The sensor size and the field of view fix the magnification, and the magnification and the distance to the part fix the focal length: \(m = \text{sensor width}/\text{FOV}\). With the thin-lens approximation and the working distance WD measured from the lens to the object,
Example. A 12 MP sensor of 4096 × 3000 pixels at 3.45 µm, such as Sony’s IMX304, measures 14.1 × 10.4 mm. Covering a 150 mm field needs m = 0.094. At a 500 mm working distance that calls for f ≈ 43 mm; with a stock 50 mm lens, the working distance becomes about 580 mm. Then check three things:
- The lens’s image circle covers the sensor diagonal: 17.5 mm here, which needs a lens rated for the 1.1″ format (17.6 mm), the practical limit of C-mount.
- The lens is rated for the pixel size. A lens designed for larger pixels may keep little contrast at 145 lp/mm, so read its MTF curve at the sensor’s Nyquist frequency.
- Distortion at the field edge is acceptable for any measurement you intend to make, or you have a calibration plan.
Sensor formats. Inch format names such as 1/2.3″ or 2/3″ are a legacy of television camera tubes, not a dimension: a 2/3″ sensor is about 11 mm across its diagonal. The lens format and mount follow the diagonal: C-mount covers up to about 1.1″ (17.6 mm), TFL (M35) APS-C (27.9 mm), TFL-II (M48) APS-H (about 35 mm), and F-mount, M58, and M72 full frame (43.3 mm). Larger sensors, up to over 120 mm in diagonal in the configurator’s list, need large-format optics.
The machine vision lens calculator runs these numbers, including depth of field and object-space pixel size. The vision system configurator starts from the job instead: give it the field of view, working distance, smallest defect, and part speed, and it picks a standard lens and ranks the sensors that fit.
Depth of field and the f-number trade-off
Stopping the lens down to a larger f-number buys depth of field, but it costs light and, through diffraction, sharpness, so each job has a best f-number. Depth of field is how far the object can move along the optical axis before the blur in the image exceeds an acceptable diameter c on the sensor, usually one or two pixels. When the depth of field is small compared with the working distance, as in most inspection setups (thin lens, equal pupils),
With c = 2 pixels (6.9 µm) and m = 0.1, the depth of field is about 6 mm at f/4, 8.5 mm at f/5.6, and 12 mm at f/8. The extra depth costs two things:
- Light: the light reaching the sensor scales as \(1/N^2\), so each full stop (a factor of √2 in N) halves it. That pushes you toward longer exposures (motion blur) or brighter, more expensive lighting.
- Diffraction: the Airy diameter at f/8 and m = 0.1 is 11.8 µm, about 3.4 pixels. That is already larger than the 2-pixel blur budget, so even the best focus no longer looks sharp.
A useful rule of thumb puts the best f-number where the diffraction blur roughly equals the allowed blur, \(2.44\,\lambda N_w \approx c\). For this example that gives N ≈ 4.7, so f/4–f/5.6 is the sweet spot, with about 7 mm of depth. At that balance the depth of field is \(\text{DOF} \approx b^2/(1.22\,\lambda)\), where \(b = c/m\) is the blur allowed on the part (69 µm here). Only that blur and the wavelength matter, so a different sensor or magnification that keeps the same resolution on the part adds no depth, and stopping down further only trades resolution for depth. If the parts need more depth, tighten the part presentation or refocus for each part. The lens calculator gives the exact near and far limits for your setup.
Telecentric lenses
If the system measures sizes and the part’s height varies, an ordinary lens adds an error, because its magnification changes with distance. A telecentric lens removes that error, at the price of size. With a conventional (entocentric) lens and the focus fixed, \(\Delta m/m \approx -\Delta z/\text{WD}\), with WD measured to the lens’s entrance pupil. At a 300 mm working distance, a ±1 mm height variation changes the magnification by ±0.33 %, which is ±0.33 mm across a 100 mm part. That error is fatal for gauging.
An object-space telecentric lens places its aperture stop at the rear focal point of the optics in front of it, so that the chief rays (the rays through the center of the stop) are parallel to the axis in object space. Magnification is then constant through the depth of field. Telecentricity is specified as the residual chief-ray angle: at 0.1°, a 1 mm height change shifts an edge by only about 1.7 µm. Telecentric lenses also look straight into bores and along vertical walls without perspective, and paired with a telecentric (collimated) backlight they give high-contrast silhouettes for edge measurement.
The cost is size: the front lens must be at least as large as the field of view, so size, weight, and price climb quickly. One commercial telecentric lens for a 230 × 192 mm field has a 322 mm front lens, is 775 mm long, and weighs about 18 kg. Larger parts usually need several cameras, line-scan imaging, or calibrated conventional lenses with tight height control.
Lighting for glass and other specular parts
Lighting decides contrast, and contrast decides detection. For transparent and mirror-like parts such as glass, polished metal, and coated films, the lighting geometry matters more than anything else in the system.
- Bright field (coaxial or on-axis). Light reflects specularly from a flat surface straight back into the lens, and scratches, pits, and stains scatter it away and appear dark. This works best for flat, reflective surfaces. On glass, each uncoated surface reflects about 4 % at normal incidence (\(R = ((n-1)/(n+1))^2\) for n = 1.5), so the rear surface makes a second, offset ghost image that the algorithm must handle.
- Dark field (low-angle ring or line light). Specular reflection misses the lens entirely, and only light scattered by scratches, particles, chips, and edges reaches the camera. The background is dark and defects are bright. Dark field can detect features much smaller than a pixel, because a sub-pixel scratch still scatters enough light to brighten a pixel. It cannot size them: the brightness depends on how strongly the feature scatters, not only on its size.
- Backlight (transmission). For silhouettes, edges, and chips, and for bubbles, stones, and inclusions inside transparent material. A collimated backlight with a telecentric lens gives the most accurate edges.
- Polarization. A polarizer on the light and an analyzer on the lens suppress glare, at a cost in light. Crossed polarizers on transparent parts reveal stress birefringence (photoelasticity), which shows residual stress in glass; ASTM F218 describes the quantitative measurement.
- Structured light and deflectometry. Deflectometry views the reflection of a known pattern, such as fringes on a screen, in a specular surface. A reflected ray turns by twice the surface tilt, so small slope errors (waviness, distortion, dents) become large, measurable pattern distortions.
- Wavelength and color. For particles much smaller than the wavelength, scattering rises as \(1/\lambda^4\) (Rayleigh scattering), so blue or UV light can improve sensitivity to fine particles and haze, and a shorter wavelength also gives a smaller diffraction blur. On a monochrome camera, light of the same color as a feature makes it bright and the opposite color makes it dark, which turns color differences into contrast. Monochromatic light plus a matching bandpass filter also rejects ambient light.
On continuous sheets, line-scan cameras with line lights are standard. Several lighting channels, such as bright field and dark field, can be captured at once with separate cameras, or by alternating strobes on successive lines.
Sizing the smallest detectable defect
These rules of thumb are starting points; contrast, noise, and the algorithm move them either way:
- Detection: about 3–5 pixels across the defect when contrast is good. Two pixels is the sampling minimum: marginal, and sensitive to where the defect falls on the pixel grid.
- Classification (telling a scratch from a particle from a bubble): 5–10 pixels across.
- Measurement: 10 or more pixels across the feature, and a measurement resolution of about one tenth of the tolerance (the “rule of ten” of measurement systems analysis). Sub-pixel edge methods can locate a well-resolved, high-contrast edge to roughly 0.1–0.3 pixel, but verify that with a gauge study rather than assuming it.
Example: 100 µm chips on a 150 mm field with 36.6 µm pixels are only 2.7 pixels across, below the 3–5 pixel detection range. Halve the field per camera, move to an 8k line-scan sensor, or use dark field, where the chip’s scattered light makes it far more detectable than its pixel count suggests. The vision system configurator runs this check for every sensor in its list.
Motion blur, exposure, and strobing
A moving part smears during the exposure. Keep the smear to a fraction of a pixel by shortening the exposure or by flashing the light. A part moving at speed v blurs across
during an exposure \(t_\text{exp}\). For a conveyor at 0.5 m/s with 36.6 µm object pixels and a blur budget of half a pixel (the strict end of the usual half-pixel to one-pixel budgets), the exposure must be 36.6 µs or shorter. That is well within reach of strobed LED lighting, which supplies short, intense pulses so the lens can stay at its best aperture.
The shutter type matters too. A global shutter, like an interline CCD, exposes every pixel at once. A rolling shutter starts and ends the rows one after another, so a moving part comes out skewed unless a short strobe in a shielded station sets the exposure. Full-frame CCDs have no electronic shutter at all and need a mechanical shutter or a strobe in the dark. More than half of the sensors in the configurator’s list have global shutters.
Line-scan cameras avoid the problem differently: the line rate is synchronized to motion, here \(v/p_\text{obj} \approx 13.7\) kHz for square pixels. Driving the line trigger from an encoder on the conveyor keeps the pixels square when line speed varies. The motion blur calculator covers both cases.
Validating an inspection system
An inspection system is a gauge, and it needs the same scrutiny as any other gauge.
- Build a defect library. Collect real and seeded defects spanning the size range around the specification limit, for every defect type and on the full range of good-part appearance: color, coating, and texture variation.
- Measure probability of detection (POD) versus size. Plot POD as a function of defect size rather than quoting one number: the question is not the smallest defect the system can find but the largest it can miss. The US Department of Defense handbook MIL-HDBK-1823A suggests at least 60 defect sites for hit-or-miss results, and at least three times as many defect-free sites to estimate the false-call rate. A classical shortcut, demonstrating 90 % POD with 95 % confidence at a single size, takes 29 detections in 29 trials, because 0.9²⁹ ≈ 0.047 < 0.05.
- Quantify false calls on a large set of good parts. A 0.5 % false-call rate means 5 manual reviews for every 1000 good parts, and reviewers who learn to ignore the system.
- Run attribute agreement analysis (AIAG MSA) for pass/fail decisions against expert judgment. Run a standard gauge R&R for any dimensional measurement the system reports.
- Verify continuously. Check golden and limit samples at the start of each shift, monitor light intensity, check focus, and archive images of rejects for traceability and retraining.
Escapes and false calls trade against each other through the decision threshold. Choose the operating point deliberately, using the costs you wrote down at the start, and re-check it whenever lighting, optics, or the product changes. Inspection data also belongs on control charts. A rising false-call rate is often the first sign of a dirty lens, an aging light, or an upstream process drift. See SPC and process capability.
References
Primary sources and standards
- 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.1.4–2.1.5 (choosing the light’s spectrum; bright-field, dark-field, back-light, and telecentric back-light illumination), 2.2.3–2.2.4 (depth of field; object-side telecentric lenses), 2.3.2 (rolling and global shutters), and 3.7.4 (accuracy and precision of sub-pixel edges).
- B. Jähne, Digital Image Processing and Image Acquisition, 7th ed., Springer (2026), doi:10.1007/978-3-032-04806-6, secs. 3.4.4 (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 (thin-lens imaging, f-number and working f-number, depth of field).
- 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), 2.1–2.2 (pixel sampling, the Nyquist frequency, and aliasing), and 3.1 (the MTF of image motion).
- E. Hecht, Optics, 5th ed., Pearson (2017), ch. 4 (Fresnel reflection, about 4 % per uncoated glass surface), ch. 8 (polarization and photoelasticity), and ch. 10 (diffraction and the Airy disk).
- W. J. Smith, Modern Optical Engineering, 4th ed., McGraw-Hill (2008) (stops and pupils, telecentric systems, and lens performance).
- C. F. Bohren and D. R. Huffman, Absorption and Scattering of Light by Small Particles, Wiley (1983; reissued 1998), doi:10.1002/9783527618156, ch. 5, “Particles small compared with the wavelength” (Rayleigh scattering and its 1/λ⁴ dependence).
- M. C. Knauer, J. Kaminski, and G. Häusler, “Phase measuring deflectometry: a new approach to measure specular free-form surfaces,” Proc. SPIE 5457, 366 (2004), doi:10.1117/12.545704 (fringe patterns reflected in a specular surface reveal its slope variations).
- ASTM F218-13(2020), Standard Test Method for Measuring Optical Retardation and Analyzing Stress in Glass, ASTM International, store.astm.org (stress in glass measured with a polarimeter).
- European Machine Vision Association, EMVA Standard 1288: Standard for Characterization of Image Sensors and Cameras, Release 4.0 Linear (16 June 2021), emva.org (quantum efficiency, dark noise, saturation capacity, and signal-to-noise ratio, measured the same way for every camera); free.
- Edmund Optics, “TFL Lens: Maximum Optical Performance beyond 1.1″ Sensors,” white paper (2020), PDF, and “Lens Mounts,” edmundoptics.com (1.1″, 17.6 mm, as the practical limit of C-mount; TFL for APS-C, 27.9 mm; TFL-II for APS-H, 35 mm).
- Sensor data: the makers’ datasheets, flyers, and product pages compiled and linked sensor by sensor in the vision system configurator (checked October 2026) (the range of sensor sizes, pixel pitches, and shutter types, and the IMX304 example).
- Opto Engineering, TC23240 bi-telecentric lens, product page, opto-e.com (229.7 × 191.6 mm field with a 2/3″ sensor, 322 mm front diameter, 775 mm length, 18.2 kg; checked October 2026).
- M. Henkart, “Spatial Resolution in Machine Vision,” Commonlands Optics (updated May 2026), commonlands.com (2 pixels as the sampling floor, 3–5 to detect, 5–10 to classify, 10 or more to measure, and sub-pixel edges to about 0.1–0.3 pixel, all as starting heuristics).
- Texas Instruments, “Light That Freezes Motion – Insight into a LED Lighting Control Design for Machine Vision,” technical article SSZT704 (May 2018), ti.com (the exposure that keeps motion blur within a pixel, and short LED strobe pulses).
- U.S. Department of Defense, MIL-HDBK-1823A, Nondestructive Evaluation System Reliability Assessment (7 April 2009; validated by Notice 2, 13 November 2018), everyspec.com, secs. 4.5.1 and 4.5.2.2 (POD versus size, the largest defect the system can miss, at least 60 hit-or-miss sites, and three times as many defect-free sites for the false-call rate).
- AIAG, Measurement Systems Analysis (MSA), 4th ed. (2010), aiag.org (gauge R&R, attribute agreement studies, and the rule that a gauge should resolve a tenth of the tolerance).
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 (numerical aperture, stops and pupils, f-number light collection, and the diffraction-limited MTF).
- H. H. Telle and A. González Ureña, Laser Spectroscopy and Laser Imaging: An Introduction, CRC Press (2018), secs. 2.3.2–2.3.3, pp. 18–22 and sec. 17.2.2, pp. 480–482 (Rayleigh and Mie scattering, with the 1/λ⁴ scaling; reflection and refraction; sampling and the Nyquist pixel criterion).
- W. M. Steen and J. Mazumder, Laser Material Processing, 4th ed., Springer (2010), sec. 2.8.1, pp. 102–104 (focused spot size: Table 2.5 thin-lens relations and the 2.44 fλ/D Airy diameter, eq. 2.11).
Free introductions
- Edmund Optics, “The Airy Disk and Diffraction Limit,” edmundoptics.com (the Airy disk, 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).
- 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).
- D. Martin, “A Practical Guide to Machine Vision Lighting,” Advanced Illumination (February 2013), PDF (bright-field, dark-field, and back lighting, light color for contrast, and polarizer pairs for glare and stress).
- NI, “Calculating Camera Sensor Resolution and Lens Focal Length” (updated 7 October 2020), ni.com (from field of view and smallest feature to sensor resolution and focal length, step by step).