A camera can record plenty of pixels across a feature while reproducing too little contrast to inspect it reliably. This matters when you are selecting optics for fine scratches, printed lines, small gaps or dimensional edges. The useful question is not simply whether a lens resolves the feature, but how much contrast survives at its spacing. Start by defining that spacing, translate it into the lens image plane, then evaluate measured contrast and relevant modulation transfer function data.
Define resolution together with contrast
Lens contrast and resolution describe related properties, not interchangeable specifications. Resolution concerns the spacing of distinguishable details. Contrast describes the intensity difference that makes those details distinguishable.
A coarse pattern may retain deep dark bands and bright light bands. As the bands become narrower, optical blur mixes their intensities. Eventually, the camera records nearly uniform gray even though the image contains several pixels across each original band.
A useful inspection requirement therefore includes:
- The smallest relevant feature width and its spacing.
- The contrast required by the inspection algorithm.
- The field of view and allowed part-height variation.
- The image locations where the requirement must hold.
- The illumination wavelength, aperture and exposure conditions.
For example, requiring at least 20% measured contrast at a specified line-pair frequency is more informative than asking for a lens that produces a sharp image. That percentage is an example requirement, not a universal acceptance threshold. Establish your threshold using representative parts, noise levels and inspection errors.
The distinction also explains why camera pixel count alone does not establish usable resolution. Pixels sample the optical image; they cannot restore contrast that the optics failed to transmit.
Translate feature spacing into spatial frequency
Spatial frequency expresses how often a pattern repeats over a distance. For alternating equal-width dark and light bars, one dark bar plus one light bar forms a line pair.
If each bar is 0.10 mm wide, the pair occupies 0.20 mm. The object frequency is therefore 5 line pairs per millimeter, commonly written as 5 lp/mm. Do not confuse individual bars with complete pairs.
Magnification determines how large the pattern becomes on the sensor. At 0.20× magnification, an object frequency of 5 lp/mm becomes an image frequency of 25 lp/mm. Lower magnification makes the same object detail smaller in the image, increasing the frequency the lens must reproduce.
For a flat object approximately perpendicular to the optical axis, magnification can also be calculated from active sensor width divided by horizontal field of view.
Use the same horizontal or vertical dimension throughout the calculation. Nominal sensor format is not a substitute for the active dimension in millimeters.
The relationship between magnification and sampling is covered in calculating object-space pixel size. Here, the additional step is translating the feature spacing into the frequency used on a lens performance chart.
Measure Michelson contrast from a line-pair image
Michelson contrast is useful for repeating bright and dark patterns. It compares their intensity difference with their combined intensity.
Here, Imax and Imin are representative bright and dark intensities. For a camera test, use linear image data with a documented black-level reference. A displayed image that has undergone gamma correction or local contrast enhancement is unsuitable for a straightforward optical contrast measurement.
Use this measurement sequence:
- Place a known line-pair target at the inspection plane and required image position.
- Set the intended aperture, illumination and magnification, then focus using a repeatable method.
- Disable sharpening, gamma and other nonlinear processing where the acquisition system permits.
- Confirm that neither bright nor dark regions are clipped.
- Average several profiles perpendicular to the bars, without mixing profiles whose patterns are misaligned.
- Estimate representative peak and trough levels from repeated cycles rather than isolated noisy pixels.
- Apply the appropriate black-level correction and calculate contrast.
If the file already has a corrected black level, do not subtract it again. If background light reaches the sensor during normal operation, retain its effect in the operational contrast measurement. Subtracting that illumination afterward would conceal an actual inspection limitation.
Averaging repeated cycles reduces the influence of random noise, but changing sampling phase can still change the measured modulation. Keep the region away from target borders, labels and damaged areas.
Work through a sampling and contrast example
Consider a hypothetical system with a 60 mm horizontal field of view, a 12 mm active sensor width and 3000 horizontal pixels. These are application assumptions, not specifications for the products shown later.
The inspection must distinguish alternating bars that are each 0.10 mm wide.
This gives 10 pixels per line pair. Sampling is comfortably above the two-sample theoretical boundary, but that does not establish adequate image contrast.
The camera resolution calculator is not needed for the arithmetic shown here; use the calculator below to explore how changing field of view or required feature sampling changes the pixel requirement.
Now assume the acquisition data has an additive black offset of 20 digital counts. At the required frequency, representative recorded bright and dark levels are 140 and 120 counts. Their corrected levels are 120 and 100 counts.
A coarse reference pattern in the same setup produces corrected levels of 180 and 60 counts:
| Test condition | Measured contrast | Decision against an illustrative 20% requirement |
|---|---|---|
| Coarse reference pattern | 50% | Passes, but does not establish fine-detail performance |
| Required feature frequency | 9.1% | Fails despite adequate pixel coverage |
The next investigation concerns focus, lens performance, aperture, target quality and illumination—not automatically a camera with more pixels. The small-pixel camera selection guide explains why denser sampling may not improve usable detail.
Understand what lens MTF does and does not show
The modulation transfer function, or MTF, describes how an imaging system transfers sinusoidal contrast at different spatial frequencies. A lens MTF chart helps you ask how much modulation the lens preserves at your required image-space frequency.
Read a curve only after checking its conditions:
- Frequency units: object space, image space or another explicitly defined convention.
- Aperture: the actual f-number used for the curve.
- Conjugates: the working distance or magnification for which performance was evaluated.
- Wavelength: monochromatic or broadband conditions relevant to your illumination.
- Field position: center, intermediate field and edge coverage.
- Orientation: sagittal and tangential curves can differ away from the image center.
- Evidence type: calculated performance and measured performance are different forms of evidence.
A square-bar target contains harmonics as well as its fundamental frequency. Its measured Michelson contrast is therefore not directly the sinusoidal MTF value at that frequency. A line-pair image remains useful for practical acceptance testing, but do not label its raw contrast measurement as lens MTF.
Under approximately linear, shift-invariant conditions, component MTFs can be multiplied to estimate system transfer. This is a planning approximation, not a replacement for a complete-system test.
For example, an object modulation of 0.40 and a required image modulation of 0.12 imply a system transfer of at least 0.12 / 0.40 = 0.30. The lens alone cannot consume that entire budget if sensor sampling and motion also reduce contrast.
Lens MTF also excludes several practical problems. Noise affects measurement reliability, while stray light can add intensity without useful pattern information. If coarse and fine features both appear washed out, investigate stray-light causes of low image contrast before blaming optical resolution.
Choose aperture through the actual inspection task
Stopping down can improve performance when aberrations limit the image. It also increases diffraction blur, while reducing the light reaching the sensor. The aperture that gives the most useful contrast therefore depends on frequency, field position and the object depth range.
Do not assume that the smallest aperture produces the sharpest inspection image. A larger depth range may improve coverage of tilted parts while reducing contrast in fine details at the best-focus plane.
For an initial experiment, compare three aperture settings around the proposed operating point. Keep illumination geometry fixed and adjust exposure to obtain comparable, unclipped brightness on a stationary target. Record contrast at the center and at the most demanding inspection location.
Then repeat under production motion. Longer exposure can smear a feature even if the stationary image improves. If the intended application cannot tolerate the needed exposure, lighting and aperture must be selected together.
Color sampling introduces additional considerations. For colored features or demosaiced images, consult the explanation of color-camera spatial resolution rather than treating every output pixel as an independent monochrome sample.
Shortlist parts without inventing contrast performance
Use the machine vision lenses category to identify suitable coverage and mount options. The lens finder helps narrow the selection, but a focal length or megapixel description is not an MTF guarantee.
The LS-FFL-0679 lists a 35 mm focal length, C-mount and a 2/3" sensor format. It is a candidate for geometric screening; its catalog description alone does not establish contrast at your required frequency.
- Type
- Machine vision fixed
- Sensor format
- 2/3"
- Mount
- C-mount
- Resolution
- 6-10 MP
The LS-FFL-0567 lists a 16 mm focal length, C-mount and a 1.1" sensor format. Evaluate its field coverage and working geometry before requesting performance evidence under your intended conditions.
- Type
- Machine vision fixed
- Sensor format
- 1.1"
- Mount
- C-mount
- Resolution
- 16-25 MP
These lenses are not interchangeable recommendations for the example. Different focal lengths change the working geometry needed to obtain a chosen field of view. Request relevant MTF information or arrange an application image test before making a contrast-based selection.
For acquisition, browse area scan cameras and the camera finder. Check active sensor dimensions, pixel pitch, mount and shutter behavior against the inspection conditions.
The LS-CMR-0053 is a GigE area scan camera with a rolling shutter. A stationary target can support contrast evaluation, but moving-part behavior requires separate validation.
- Sensor format
- 1/1.7"
- Lens mount
- C-mount
- Interface
- GigE
- Resolution
- 12 MP
The listed parts are screening examples, not a validated matched system. Confirm mechanical fit, optical coverage and acquisition requirements for the combination you intend to build.
Know when line-pair contrast is the wrong acceptance test
A line-pair target answers a specific question about repeating detail. It does not fully describe the visibility of an isolated scratch, the localization of an edge or the reliability of a barcode decoder.
An isolated feature may be detectable even when closely spaced repeating features merge. Conversely, a high-contrast test target may be easy to inspect while a low-contrast production defect remains unreliable. Edge measurement also depends on noise, illumination geometry, calibration and the estimator used.
Use line-pair contrast to compare optical setups and diagnose frequency-dependent losses. Use representative parts to decide whether the inspection task passes.
Before ordering, check that you have:
- Defined feature width and pitch separately, avoiding a bar-versus-pair error.
- Converted the requirement into the frequency convention used by the lens data.
- Confirmed sampling without treating it as proof of optical performance.
- Recorded aperture, wavelength, magnification and relevant field positions.
- Measured linear, unclipped data with a documented black-level treatment.
- Tested representative good parts and difficult defects under operating conditions.
Start with the lens configuration step once the geometry is defined. If contrast evidence is missing, send the required frequency, magnification, aperture, wavelength and example images through applications support before committing to an optical combination.
Questions
How do you calculate contrast from a line-pair image?
Michelson contrast is appropriate for repeating bright and dark patterns. Subtract the representative dark intensity from the bright intensity, then divide by their sum. Use linear, unclipped image data and a documented black-level correction. Average repeated measurements rather than selecting isolated noisy maximum and minimum pixels.
Will more camera pixels fix low fine-detail contrast?
Not necessarily. Additional pixels improve sampling only if the optical image contains useful detail. Low lens transfer, defocus, motion or unwanted background light can leave a well-sampled feature with insufficient contrast. Establish contrast at the required spacing before deciding that a higher-resolution camera is the appropriate change.
How do you convert object frequency to image frequency?
Divide object-space frequency by the absolute optical magnification. A reduced image contains more line pairs per millimeter than the original object. Confirm the chart's frequency convention first, because some lens data already uses object-space units and should not receive this conversion.
Is measured line-pair contrast the same as lens MTF?
No. Square bars include harmonics, so their measured modulation differs from the response to a sinusoidal pattern. The image also includes sensor, illumination, sampling and processing effects. Treat a line-pair contrast measurement as a system test unless an appropriate method separates those contributions and converts the response.
What minimum contrast should an inspection require?
There is no universal minimum that guarantees a reliable inspection. Establish the threshold using representative defect contrast, noise, part variation and acceptable error rates. Document the target frequency and test conditions alongside it, then verify that the complete system meets the requirement across relevant image positions.


