Choosing the correct lens is a fundamental step in designing a reliable machine vision system. A misaligned lens-to-sensor choice can lead to resolution bottlenecks, spatial distortion, or insufficient lighting at the image edges.
This guide walks through the primary geometry and resolution matching equations required to select a lens for an industrial application.
1. Geometric Calculations: Field of View and Focal Length
The relationship between the Field of View ($FoV$), Working Distance ($WD$), Sensor Size ($H$ or $V$), and Focal Length ($f$) is governed by basic thin-lens geometric optics. For most thin-lens approximations at working distances much larger than the focal length ($WD \gg f$), the required focal length can be estimated using:
$$f \approx \frac{Sensor\ Size \times WD}{FoV}$$
Where:
- $Sensor\ Size$: The physical width or height of the camera sensor active area in mm (not the resolution in pixels).
- $WD$: Working Distance, the distance from the front of the lens assembly to the object of interest in mm.
- $FoV$: Field of View, the physical dimension of the inspection area that must be imaged in mm.
Example Calculation (Synthetic Case)
Suppose you need to inspect a rectangular tray with a width ($FoV$) of $120\text{ mm}$. The mechanical envelope allows a working distance ($WD$) of $400\text{ mm}$. You have selected a camera with a $1/\text{1.8”}$ sensor, which has an active width ($Sensor\ Size$) of approximately $7.2\text{ mm}$.
$$f \approx \frac{7.2\text{ mm} \times 400\text{ mm}}{120\text{ mm}} = 24\text{ mm}$$
A standard $24\text{ mm}$ focal length lens would be selected. In practice, you should choose a slightly shorter focal length (e.g., $25\text{ mm}$ is standard, or $16\text{ mm}$ with a safety margin if the working distance can be adjusted) to provide a safety margin around the field of view.
2. Sensor Matching: Image Circle and Vignetting
Lenses project a circular image (the “image circle”) onto the rectangular sensor. To avoid vignetting (shadowing at the corners of your image), the lens’s rated maximum image circle diameter must be greater than or equal to the diagonal of your camera sensor.
- If the sensor diagonal is larger than the lens image circle, the corners of the image will appear dark or completely black.
- If the sensor diagonal is smaller than the image circle, the sensor will only capture the center of the optical projection. This is optically safe, though it crops the lens’s field of view.
Always cross-reference sensor dimensions (e.g., $2/3^{\prime\prime}$, $1/1.8^{\prime\prime}$, $1/2^{\prime\prime}$) against the lens specification sheets.
3. Resolving Limit and Pixel Matching
A common error is matching a high-resolution sensor (e.g., $20\text{ Megapixels}$) with a low-cost, low-resolving lens. This results in blurry, oversampled images where the sensor pixels resolve optical aberrations rather than true object features.
To ensure the lens can resolve the sensor’s pixels:
- Calculate the pixel size: $p = \frac{\text{Sensor Width}}{\text{Horizontal Resolution}}$.
- Calculate the sensor’s Nyquist frequency: $f_N = \frac{1}{2p}$ (in line pairs per mm, $\text{lp/mm}$).
- Ensure the lens’s Modulation Transfer Function (MTF) specification has sufficient contrast (typically $>20%$) at or above this Nyquist frequency.
Assumptions and Limitations
- Thin-Lens Approximation: The calculations above assume a simple single-element thin-lens model. Real double-gauss or telecentric lenses have principal planes that shift the effective working distance. Always consult vendor datasheets for exact mechanical layouts.
- Distortion: High distortion lenses (like wide-angle or fisheye lenses) do not follow linear angular mapping. The spatial resolution will drop off significantly towards the corners.