Lenses & opticsGuide

Machine vision optical filters: choosing contrast over color

Choose machine vision optical filters by wavelength, glare and mounting fit, then measure contrast gains against signal loss and exposure limits.

LumaSpec Vision11 min read Share on LinkedIn

On this page 10 sections
  1. 01Choose the filter from the unwanted light
  2. 02Match the passband to the complete optical chain
  3. 03Use bandpass filtering to reject out-of-band interference
  4. 04Choose longpass, shortpass or polarization for the right reason
  5. 05Calculate contrast and the exposure penalty
  6. 06Check mounting, clear aperture and field behavior
  7. 07Validate with production variation, not one favorable image
  8. 08Know when a filter is the wrong purchase
  9. 09Before ordering: a short acceptance checklist
  10. 10Questions

A filter earns its place when it makes the inspection feature easier to separate from its background without exceeding the exposure budget. It does not need to produce an attractive image. This guide is for you if glare, ambient light or overlapping material colors make an inspection unreliable. You will learn how to select a filter family, compare contrast against signal loss, and check optical and mechanical compatibility before ordering.

Choose the filter from the unwanted light

Start by naming the feature and the interference separately. An engraved character, a printed mark and a fluorescent deposit can require different optical treatments, even on the same component.

Write a requirement such as: “Keep the printed character distinguishable from the packaging while overhead lighting changes.” That is more useful than asking for a red filter or a darker image.

Then determine what distinguishes useful light from unwanted light:

  • Wavelength: the feature and background reflect or emit different spectral bands.
  • Polarization: surface glare retains a polarization state that differs from useful scattered light.
  • Direction: reflections enter the lens from an unfavorable illumination angle.
  • Timing: ambient light contributes during an exposure intended to capture a controlled source.

Lens-side filters address the first two directly. They cannot reliably replace a better illumination angle or correct synchronization. The guide to choosing LED color for contrast explains the complementary decision at the light source.

Filter family What it transmits Useful starting point Main limitation
Bandpass A bounded wavelength region Isolate a controlled illumination band or a material difference Rejects useful light outside its passband
Longpass Wavelengths above a transition Separate longer-wavelength emission from shorter-wavelength excitation Also admits unwanted longer-wavelength light
Shortpass Wavelengths below a transition Reject longer-wavelength contamination while retaining a shorter band Does not reject interference inside the transmitted region
Linear polarizer A selected linear polarization component Reduce polarized reflections with controlled illumination Loses signal and does not suppress every reflection

These are selection principles, not guarantees about a particular material. Test actual production samples, including acceptable variation and borderline defects.

Match the passband to the complete optical chain

The camera records light that survives several stages: illumination, interaction with the part, lens transmission, filter transmission and sensor response. A filter cannot create a useful signal where the source emits little light or the camera has little sensitivity.

For spectral selection, review these items together:

  1. The source emission curve, including operating variation.
  2. The feature and background response under that source.
  3. The filter transmission curve and blocking regions.
  4. The lens transmission and focus behavior at the selected wavelengths.
  5. The camera spectral response, including any built-in protective or spectral window.

A colored object does not have a universal brightness through a similarly colored filter. Brightness depends on its reflectance within the transmitted band and on the available illumination. Two visibly different materials can look nearly identical in a selected band.

A monochrome camera can measure brightness separation after spectral filtering, but it does not preserve full color information. If several color classes overlap in the selected band, one filtered image may be insufficient. See monochrome sorting under changing ambient light for that classification problem.

Browse area scan cameras or the camera finder only after defining the required spectral response and acquisition behavior. A camera interface or resolution rating does not establish sensitivity at the chosen wavelength.

Use bandpass filtering to reject out-of-band interference

A bandpass filter is often the first candidate when a controlled source provides the inspection light. Match its useful transmission region to the source rather than matching only a nominal wavelength label.

A narrower passband can reject more broadband ambient light, but it also reduces tolerance to source variation and angle-dependent filter behavior. A wider passband may preserve more useful signal while admitting more interference. The correct width follows from the measured overlap and required rejection.

Consider the LS-LXR-0225, an 850 nm band-pass filter with an M30.5 x 0.5 thread. Its catalog identification provides a starting point for spectral and mechanical review, not a complete application qualification.

Lens accessoriesBand-pass filter, 850 nm (near IR), M30.5 x 0.5 thread (LS-LXR-0225)LS-LXR-0225
Type
Filters & polarizers
$119.00View partBuild a system with it

Before selecting it, obtain the transmission curve, bandwidth definition, peak transmission and out-of-band blocking information. The supplied catalog excerpt does not establish those details. Also confirm the intended source, lens and camera can operate together in the selected band.

Ambient rejection has a boundary: light inside the passband still reaches the camera. If overhead illumination or daylight contributes strongly in that same band, the filter alone may not stabilize brightness. Compare source-on and source-off images at identical camera settings to measure the remaining ambient contribution.

Choose longpass, shortpass or polarization for the right reason

A longpass filter is useful when the desired signal occupies longer wavelengths than the interference. Fluorescence inspection is one example: excitation light must be suppressed while the weaker emission remains measurable.

However, a longpass filter does not automatically isolate fluorescence. Reflected light above its transition can still reach the sensor, and inadequate excitation blocking can overwhelm emission. The guide to fluorescence excitation and filters explains that separation in more detail.

A shortpass filter serves the opposite spectral need. It can retain a shorter-wavelength inspection band while rejecting longer-wavelength contributions. This may help when unwanted near-infrared changes the image, provided the complete transmission and blocking curves support the requirement.

Polarization is a different mechanism. With suitable illumination, a source polarizer and a lens-side analyzer can suppress reflections that retain the source polarization. Rotate the analyzer while observing the actual inspection feature, not just the brightest highlight.

Crossed polarization can reduce useful signal as well as glare. Metallic surfaces, curved geometry and multiple reflections may prevent uniform suppression. Stress in transparent materials can also produce spatial patterns that complicate measurement.

Test the feature at several positions and orientations. If glare disappears at the center but remains over a corner feature, the arrangement is not qualified. Changing illumination geometry may be more effective than adding another filter.

Calculate contrast and the exposure penalty

Compare unfiltered and filtered images using fixed exposure, gain, aperture and illumination. Disable automatic adjustments during this first comparison. Otherwise, automatic compensation can hide how much light the filter removes.

For two positive, offset-corrected mean signals, one useful contrast measure is:

C = |F - B| / (F + B) F = mean feature signal B = mean background signal

This metric describes separation relative to combined brightness. It does not measure noise, edge sharpness or classification reliability. Avoid saturated pixels and apply the same measurement regions to every image.

Suppose a linear image gives a feature mean of 180 and a background mean of 120, in arbitrary signal units:

Unfiltered contrast = (180 - 120) / (180 + 120) = 60 / 300 = 0.20 Filtered contrast = (90 - 30) / (90 + 30) = 60 / 120 = 0.50

The filtered image has higher normalized contrast, but the feature signal has fallen by half. That loss matters when sensor noise, exposure limits or motion determine the inspection margin.

If the filtered feature throughput is a fraction τ of its original value, an approximate exposure compensation is:

t_new ≈ t_old / τ For τ = 0.50: t_new ≈ 0.2 ms / 0.50 = 0.4 ms

This estimate assumes linear response, unchanged illumination and no saturation. It restores the feature mean, not the original spectral balance. In the example, doubling exposure changes the filtered means to approximately 180 and 60; normalized contrast remains 0.50.

Motion may make that compensation unacceptable. At a part speed of 600 mm/s, travel during exposure is:

Travel = speed × exposure 600 mm/s × 0.0002 s = 0.12 mm 600 mm/s × 0.0004 s = 0.24 mm

Whether that travel is acceptable depends on feature size and image sampling. Use the sorting conveyor camera selection guide when exposure and motion must be evaluated together.

Higher contrast is therefore a candidate improvement, not the final acceptance criterion. Compare repeated-image variation and actual inspection decisions at an exposure the machine can sustain.

Check mounting, clear aperture and field behavior

Optical compatibility includes more than the thread fitting. Confirm thread diameter, pitch, engagement depth, clear aperture and clearance throughout the focus adjustment range. Never force a filter that begins to bind.

The LS-FFL-0679 is a 35 mm, 2/3", 6 MP, C-mount machine vision lens. The supplied catalog details do not state its front filter thread, so they do not establish compatibility with the filter discussed above.

Machine vision lenses35 mm, 2/3", 6 MP, C-mount machine vision lens (LS-FFL-0679)LS-FFL-0679
Type
Machine vision fixed
Sensor format
2/3"
Mount
C-mount
Resolution
6-10 MP
$219.00View partBuild a system with it

A camera-side lens mount and a front accessory thread are separate interfaces. C-mount identification alone does not specify which front filter will fit. Review safe checks for lens thread binding before fitting unfamiliar threaded accessories.

Check clear aperture across the entire image. A filter holder or adapter can introduce corner shading even when its thread is correct. Compare uniform-field images before and after installation, using unchanged settings.

Some interference filters change spectral transmission with incidence angle. This can matter with wide-angle imaging, tilted filters or rays near the field edge. Request angle-dependent data where relevant, then test contrast at the center and corners rather than assuming uniform behavior.

Filter thickness and placement can also affect the optical path. Recheck focus and measurement calibration after installation. For specialized arrangements, consult filter placement with telecentric lenses, the closest companion to this selection guide.

Use the machine vision lens finder to review optical requirements, and lens accessories for the filter and mounting components. Do not treat an adapter as evidence that the optical combination is suitable.

Validate with production variation, not one favorable image

Build a small test matrix that separates spectral improvement from automatic compensation. Include acceptable samples, actual defects and borderline cases. Keep raw or minimally processed images so display adjustments cannot conceal differences.

A practical sequence is:

  1. Record an unfiltered baseline at fixed exposure and gain.
  2. Install the candidate filter without changing other settings.
  3. Measure feature and background signals, clipping and repeated-image variation.
  4. Adjust exposure or illumination within the permitted operating limits.
  5. Repeat across part positions, orientations and expected ambient conditions.
  6. Run the intended inspection algorithm and compare decision margins.

For an initial repeatability screen, capture 30 stationary frames per condition. Record the mean and standard deviation of the measurement used by the inspection. This is a useful screening exercise, not proof of a production failure rate.

Then test moving parts at operating speed. Include the least reflective acceptable material, the most reflective background and samples near the rejection threshold. Repeat after refocusing or changing a filter position, because those changes can alter the apparent improvement.

The lens and lighting test plan provides a broader framework when several optical variables need comparison.

Know when a filter is the wrong purchase

A spectral filter cannot separate two materials whose responses overlap throughout the transmitted band. If several independent spectral measurements are required, review when hyperspectral imaging beats RGB and filters before narrowing the system to one band.

A polarizer is also the wrong first response when glare can be moved away from the feature through illumination geometry. Removing the offending reflection at its source may preserve more signal.

Filtering will not repair defocus, inadequate sampling or vibration blur. Nor will it create fluorescence where the material does not emit under the selected excitation. Diagnose the physical source of poor separation before adding an optical component.

Finally, avoid a single narrow band when the inspection must report true color across several classes. Improving one pair of materials may erase the distinction between another pair.

Before ordering: a short acceptance checklist

  • Feature defined: document what must remain distinguishable and which variation is acceptable.
  • Spectral evidence available: obtain source, filter and camera response information rather than relying on wavelength labels.
  • Exposure margin measured: verify useful signal at the permitted motion blur and acquisition timing.
  • Mechanical fit confirmed: check the actual accessory thread, engagement, aperture and clearance.
  • Full field tested: inspect center and corner contrast, shading and focus after installation.
  • Production variation covered: include material batches, orientations and ambient conditions that could change the decision.
  • Algorithm margin recorded: retain images and measurements showing improvement beyond one favorable sample.

Use the accessory finder to shortlist filter and mounting options, then add the required components through the accessories configurator. If transmission data or mounting compatibility remains uncertain, send the inspection requirements through technical support before selecting the final combination.

Questions

How do I match a bandpass filter to an inspection light?

Match the filter transmission region to the illumination emission curve, then check the camera response and lens transmission. A shared nominal wavelength is not enough. Bandwidth, blocking, source variation and incidence angle can determine whether the combination preserves useful light while rejecting interference.

Does higher image contrast always improve inspection?

Not necessarily. A filter can improve brightness separation while leaving too little signal for repeatable measurement. Evaluate noise, saturation, edge quality and the permitted exposure alongside contrast. The final comparison should use production samples and the inspection algorithm at operating speed.

Can a polarizing filter remove glare by itself?

A lens-side polarizer can reduce some reflections, but consistent glare suppression often requires polarized illumination as well. Performance depends on surface material, viewing geometry and how the reflected light changes polarization. Test useful feature visibility across the entire part rather than judging only highlight reduction.

Does a C-mount lens accept any threaded optical filter?

No. The camera-side lens mount does not define the front filter interface. Confirm accessory thread diameter, pitch, engagement depth and clear aperture separately. Also check focus adjustment clearance and obtain compatibility confirmation when the lens documentation does not specify a suitable filter interface.

Will a bandpass filter eliminate changing ambient light?

A filter rejects ambient wavelengths outside its transmission region, but ambient light within that region still reaches the sensor. Measure the remaining contribution with the controlled source switched off at unchanged camera settings. Additional control of illumination geometry or acquisition timing may still be necessary.