Although optical filters are often viewed as an afterthought in machine vision applications, their  ability to optimize lighting and the entire vision system makes them so valuable that they should be considered from the initial planning stages of most applications. The value of optical filters arises from their ability to block all unwanted ambient lighting and pass only the output of light needed for inspection while increasing contrast and resolution. To select the right filter for a specific application, first define the imaging objective such as improving contrast, reducing glare, color sorting, and removing barcode interference. Determine the optimal light emitting diode wavelength by testing white light with various bandwidth bandpass filters. Once the appropriate light wavelength has been chosen, the corresponding bandpass filter can be used to control the variables. This article will provide more information on optical filter advantages and selection and provide real-world examples of how optical filters have been used to help solve difficult machine vision challenges.

Basics of Optical Filters

Optical filters are all about increasing or maintaining consistent image quality, which in turn can improve the accuracy and reduce inspection time of most machine vision applications. Filters improve image quality, by blocking interfering light that surrounds the application and only passing light that adds value to the machine vision application, which often results in higher contrast and resolution. Each color focuses at a different point on the imaging plane of a lens which limits the resolution of the resulting image due to an effect known as chromatic aberration. By using a bandpass filter that allows only one color to reach the lens, you can effectively increase the resolution.

Typical monochromatic LEDs have a total light output that spans 60 to 70 nanometers that generally have a ±10nm tolerance. Some machine vision bandpass filters are available that span 80-90 nm and are designed purposefully broad to accommodate the entire output of the LED (and their typical tolerance shifts). A narrow bandpass filter spans 40-50 nm and an acutely narrow filter spans 20 nm. The acute narrow filter, for example, blocks the maximum amount of ambient light; however, it also reduces the intensity of the wavelength of interest. On the other hand, some bandpass filters pass the entire wavelength of interest. Which filter will work best in a specific application depends largely on the degree to which ambient light is interfering with the inspection operation. A narrow bandpass filter (40-50nm) offers a good compromise for the majority of extreme ambient light applications.

Selecting Optical Filters

A good starting point when choosing a filter is to understand what the imaging objective is or what the imaging problem may be in order to help determine what filter is going to work best for the application. What are you trying to do? What do you need to look at? Does the contrast need to be increased? Do you have a lot of ambient light surrounding the area to be inspected? Are there different colors that you’re trying to separate?

Next, utilize white light with bandpass filters to determine the optimal LED wavelength for your application. Each bandpass filter highlights a different wavelength of light similar to the output of its corresponding LED. Viewing the image that is captured with each filter makes it possible to evaluate how different wavelengths (illumination) will affect image quality.

Filter test kits containing an assortment of bandpass filters are usually the fastest way to find the most suitable wavelength to optimize image quality. They can be used to quickly find the light source and bandpass filter that maximizes contrast and reduces interfering light to control the variability of the application.

Another common question to ask in the beginning phase of the application is whether to use a monochrome or color vision system. The first thought in applications where color is present is to use a color sensor but often a monochrome imaging system and filters can provide a more efficient way of optimizing the system. Consider this example (seen in Figure 5) where the cartridge shown on the lower left image fluoresces blue. Using a color camera to look at the blue print would be inefficient because only 25% of the pixels in a color camera are configured to see blue light. Of the rest, 25% are configured to look at red and 50% to look at green. Half the pixels are set up to detect green light because our eyes are more sensitive to green light. On the other hand, a monochrome filter with a blue bandpass filter utilizes 100% of the pixels in the vision system while the bandpass filter passes about 90% of the blue light. The result is that in this application a monochrome light with a blue bandpass filter is 90% efficient compared to 25% efficiency for a color vision system.

Polarizing filters are very useful in applications where glare is a problem. When light that is polarized in a specific direction hits a diffuse surface most of the light becomes randomly polarized and reflects in random directions. Areas where strong reflections exist, however, maintain much of the incident light angle of polarization. By placing another polarizing filter on the camera lens, rotated 90 degrees relative to the light source angle of polarization, the strong reflections of polarized light are absorbed by the camera lens filter. The diffused light from the non-glare area is transmitted to the camera lens and glare is greatly reduced.

Application Examples

The next application (shown in Figure 7) involves reading the date and lot which consists of yellow text on a white background, resulting in a low contrast image. Keeping in mind that blocking a particular color will darken it while passing a color will highlight it, a blue bandpass filter was used to block the yellow portion of the spectrum, causing the yellow text to appear as black. At the same time, the blue bandpass filter passes the blue portion of the white light, so the white text remains white. The result is that the contrast of the application is dramatically increased, improving the read rate and reducing the inspection time.

The objective of this next application is to separate the red from the blue caps with a monochrome vision system. With no filter there’s very little contrast between the red and blue caps. With a blue bandpass filter, the blue caps are highlighted due to the filter passing that specific wavelength and the red caps are darkened due to the filter blocking that specific wavelength. With a red bandpass filter, on the other hand, the red caps are highlighted and the blue caps are darkened. In this application, either filter improves the contrast between the red and blue caps to the point that they can easily be distinguished with image processing tools.

An optical filter that blocks the visible portion of the spectrum can be used to inspect parts using the infrared (IR) spectrum. Since we can’t see IR with our eyes, it’s difficult to predict the effectiveness of IR inspection in advance.

Neutral Density (ND) filters can help to resolve issues caused by oversaturation of light on the part being inspected. ND filters limit the intensity of light seen by the camera equally across the vision spectrum.

In summary, optical filters are often the simplest, fastest and most cost effective way to improve repeatability and stability in machine vision applications. By controlling the quality and quantity of light reaching the vision system, optical filters can block unwanted ambient lighting, pass only the light used for inspection and increase contrast and resolution. To achieve the highest possible machine vision performance, consider optical filters early in the development of machine vision applications. V&S

John Lewis is market development manager for Cognex Corp. For more information, email [email protected] or visit

 Jason Dougherty is managing director of Midwest Optical Systems. For more information, email [email protected] or visit