Machine vision optical filters

Machine vision optical filters

Machine vision optical filters are optical filters used in machine vision applications.

Choosing the correct optical filter for machine vision

Many of those developing machine vision applications know that considerable emphasis has been placed on choosing the correct lighting to achieve maximum contrast. While correct lighting can overcome many imaging problems, the wrong lighting can cause even the most sophisticated system to run too slow, or give an excessive number of false rejects or false accepts. When compared to lighting hardware, little is understood about the use of filters in machine vision applications, and we will attempt to address this important subject in this article.

Relative to most lighting equipment, filters are far less expensive, easier to obtain, and in many cases are capable of producing significantly better results. Unfortunately, knowing which filter to select, which options are readily available, and where to get them can all be a problem. Despite this, a variety of off-the-shelf filters are available from a number of vendors and this low-cost investment can result in very large returns. In many cases, when faced with developing a machine vision system that involves a lighting problem, it makes sense to examine the benefits of optical filters first before ordering lighting hardware.

Testing different colors of LED lighting can be cumbersome, expensive and time consuming. To understand whether a proposed color may be a good choice, placing a filter in front of the camera lens provides a quick way to determine whether a desired effect will occur. Testing can involve the use of a single filter or combination of filters that may serve more than one function. Those who are not sure what effect different colors may have should consider acquiring a machine vision filter kit (such as Midwest Optical Systems’ #FK100), a swatchbook, or a variety of filters to use as a tool. To understand what these filters are doing, it is important that spectral data or transmission curves be supplied along with them.

In many systems a shroud is built to shield the inspection station from the effects of ambient light. Shrouds can be costly, elaborate, and restrictive and have long lead times. The use of band-pass filters should be examined as a simple and inexpensive method of accomplishing the same result. Ordering, receiving and testing filters can normally be completed in as little as a day or two.

Filter types

In color applications, complementary colors form the most dynamic contrasts. The same is true when monochrome cameras are used, except that when using color filters, results are seen in black, white and varying shades of gray. In such cases, the optimum contrast between two subjects provides a very white white and a very black black within the same scene. This is accomplished by maximizing the amount of light transmitted in at least one wavelength range and minimizing the amount transmitted (or attenuated) in another range.

As an example, to brighten or highlight a subject that is predominantly blue, transmission in the blue portion of the spectrum must be maximized, and much of the green, yellow, red and other portions of the spectrum blocked. “Color” filters attenuate light within some portion of the visible spectrum and have an obvious color. Such filters can be categorized as short-pass, long-pass and band-pass filters.

Short-pass filters pass shorter wavelengths of light, while blocking longer wavelengths. Long-pass filters do the opposite, passing longer wavelengths and blocking shorter wavelengths. These filters are usually identified by their 50% points. This point can roughly be thought of as the point where 50% of the light is being transmitted and 50% is being blocked; a halfway point in the transition from blocking to transmitting, or vice versa. So a red 630 nm long-pass filter, for example Midwest Part No. LP630, might be well suited for applications using 660 nm LED or structured laser diode lighting. It blocks lower wavelength light, has a 50% point at 630 nm, and has very high transmission at 660 nm and beyond. For obvious reasons, this LP630 long-pass filter would not be suitable for use with 630 nm LEDs.

Continuing with the 660 nm LED lighting example, in order to achieve maximum contrast, 100% transmission at 660 nm is desirable, while most of the ambient light should be completely blocked, with as sharp of a cut-on and cut-off as possible. While to the human eye the LP630 may appear a good filter choice, most CCD/CMOS cameras have excellent near-infrared (NIR) sensitivity, and considerable near-ultraviolet sensitivity as well. Many of these cameras have sensitivity that peaks in the NIR. When a graphic representation of a typical CCD/CMOS spectral response curve is superimposed on the filter’s transmission curve, it becomes obvious that the LP630 does not block as much of the light to the camera as one might imagine (Figure 1). Perhaps slightly more than half of the extraneous light that the camera is sensitive to is being blocked. For this reason, Midwest Optical Systems recommends the use of a broad band-pass filter for these applications, such as our BP660 filter
(Figure 2).

A band-pass filter is named according to the central or peak wavelength that it transmits, will block longer and shorter wavelengths, resulting in improved contrast and better control over changes that may occur over time in ambient lighting conditions. In the case of band-pass filters, “broad” is necessary in most machine vision applications because this allows for variations in the spectral characteristics of the LEDs or laser diodes. For example, most 660 nm LEDs will have at least a ±10 nm tolerance assigned to their peak wavelength. The filter chosen must perform well over this entire range. A broad pass-band also allows a filter to perform well when wide-angle or shallow-incident angle lighting is used. At Midwest Optical Systems, these filters are available from stock in mounts that fit all machine vision camera lenses, in designs that are compact, rugged and environmentally stable.

Polarizing filters

Light reflected from a non-metallic surface such as glass, lacquer, plastic or liquid results in polarization of the reflected light. This polarized reflected light can be the result of uncontrolled ambient light, but is more often from the light source chosen for illumination. As the angle of incidence of the light and the camera relative to the subject are about the same and approach 55° to normal, a “glare” and loss of contrast becomes more pronounced.

In situations where the subject is partially obscured by this unwanted reflection, using a polarizing filter can reduce or eliminate this problem (Figure 3).

"Figure 3 appears to be missing but the caption is shown here:"

In applications where the subject is partially obscured by unwanted reflection, using a polarizing filter can reduce or eliminate this problem. Polarizing filters can also be used to highlight stress patterns in clear plastic or glass, or determine whether glass has been properly tempered.

Many polarizing filters consist of a plastic film; a very fine, “Venetian blind” grid, laminated between two pieces of glass. This grid is invisible to the eye and the camera’s sensor, is generally gray in color, and allows visible light in only one polarization plane to pass through. By rotating the filter mounted on the lens, it works as an “analyzer” to decrease highly polarized “glare”. Further reduction is possible by polarizing the light source. Polarizing plastic sheet material, which ranges from 0.005 in. to 0.030 in. thick, can be easily cut to desired shapes and sizes to cover the light source.

Neutral Density filters

In conditions where lighting is extremely bright, neutral density filters can be essential. They generally appear gray in color and reduce the amount of light reaching the sensor without effecting color balance or contrast. Such “stock” filters can range from an optical density (OD) of 0.30 (such as Midwest ND030), which transmits about 50% of visible light to OD 1.20 (Midwest ND120), which transmits about 6.25% of visible light. In addition, polarizing filters can also function as neutral density filters with an OD of 0.50 (Midwest PL032), transmitting about 32% of available light.

By standardizing part numbers based on OD, densities are additive when combining two or more filters. In these situations, an “OD” scale is more convenient than using a “% transmission” scale. For example, an ND030 filter (OD = 0.30) used with an ND090 filter (OD = 0.90) would result in a combined OD of 1.20. Similarly, using two ND060 filters together would produce the same result.

In machine vision applications, another common use for neutral density filters is to decrease the depth of field by allowing wider lens apertures to be used. This helps to separate subjects from their foreground and/or background as the subject will appears in focus, while the background will be out of focus. In situations involving very bright ambient light, or when cameras must be directed at high intensity beams, such as automotive headlamps, neutral density filters reduce the amount of light captured by the CCD/CMOS imager.

Infra-red and ultra-violet

Working in the NIR or UV portions of the spectrum offers significant advantages. Contrast in the NIR can be greatly improved depending on the characteristics of the item under inspection. Perhaps 50% of the information captured in NIR images is significantly different when compared to those images captured with white light. This “50% rule” can apply to any given type of subject. Unfortunately, without prior knowledge it is often impossible to tell how an image will appear in the NIR without experimentation. Fortunately, most CCD and CMOS cameras have excellent near-IR sensitivity, so such tests can be performed quickly and easily by slipping a visible-blocking/IR pass filter over camera’s lens. When a difference does appear, such filters can provide the optimum separation between subject and background (Figure 4).

When working in the IR, the camera’s spectral response must be understood and the lighting and filtering properly matched. For example, one would not use 940nm LEDs if the camera’s response were close to zero at 940nm. Today the most commonly used IR LED wavelength is 880nm and for most cameras, spectral response beyond 880nm drops off rapidly. This is true even for those cameras that advertise excellent NIR sensitivity, although their response at 880nm can be 2-3X greater than that of a standard CCD. For this reason, an IR band-pass filter is normally not recommended. A long-pass IR filter for blocking shorter wavelengths, such as an 830nm long-pass filter, should be used. In a sense, the camera itself filters longer wavelengths. Using a band-pass filter would result in increased cost and/or some reduction in peak transmission.

In what are usually referred to as UV applications, 99% of inspections are not performed in the UV. Such applications use UV or shorter wavelength lighting to excite a part or material under inspection. This material then emits light, usually somewhere in the visible portion of the spectrum. Often this fluorescence can be weak and difficult to image. For such applications, a visible band-pass filter that is appropriate for the emission wavelength is recommended. This band-pass filter should provide maximum transmission over the given wavelength range and block as much of the rest of the ambient light as possible - particularly the UV portion of the spectrum being emitted by the light source. With the use of CMOS cameras becoming widespread, a larger number of cameras now seem to have significant UV sensitivity.

As a side note, it is also very important to select UV lighting that matches the luminescent material. Selecting 390nm LED lighting may seem to make economic sense, but if the material’s excitation wavelength is at 365nm, this can be a poor choice. Under even the most optimal conditions, fluorescence can be extremely weak and difficult to detect if the wrong LED lighting is selected.


As can be seen, reducing the effects of extraneous light can significantly improve contrast; speeding up or improving the accuracy of the machine vision inspection. In cases where there may be short- or long-term changes in ambient lighting, optical filters can also provide insurance that the results obtained by the machine vision system will not be affected.

Wikimedia Foundation. 2010.