Using optical filters to enhance image contrast

April 3, 2014
Obtaining the highest image contrast is probably the most important factor in designing any machine vision system.
Choosing the correct optical filter can improve the contrast of captured images and reduce the processing time needed to extract relevant image data.

Nicholas Sischka, Optical Engineer, Edmund Optics (Barrington, NJ, USA; www.edmundoptics.com)

Obtaining the highest image contrast is probably the most important factor in designing any machine vision system. The choice of illumination level, aperture size, and lens quality can all increase image contrast and improve system performance. While designers who need to increase system performance can be tempted to upgrade their lighting or lenses, such options can add significant cost to a machine vision system. However, if designers evaluate the spectral characteristics of the objects to be imaged, they may find that filters can improve imaging performance with minimal impact on other design elements — at a very attractive cost.

Designers have a range of filter types at their disposal, and they are often defined by the structure of their transmission curves. Longpass filters are designed to block short wavelengths and pass long wavelengths. Shortpass filters are the opposite, passing shorter wavelengths and blocking longer wavelengths. (Figure 1a) Bandpass filters transmit a central wavelength band while blocking longer and shorter wavelengths. Notch filters are the inverse of bandpass filters, blocking a band of wavelengths and passing the longer and shorter (Figure 1b). Within these groups, the types of each filter that are available are dependent upon the technology used to create them; for example, colored glass filters are not available in the "notch" variety.

Figure 1: Designers have a broad range of filter types at their disposal. (a) Typical shortpass and longpass transmission curves. (b) Typical bandpass and notch transmission curves.

Colored glass filters offer an inexpensive solution for improving contrast in some applications, but are limited to applications where objects can be distinguished on the basis of broad spectral characteristics such as separating orange objects from purple ones.

Interference filters also transmit specific ranges of wavelengths but are much more precise than colored glass filters. Interference filters provide nanometer-level control over which wavelengths are transmitted and which are not, where the control with colored glass is not nearly as precise. Neutral density and polarization filters can also improve performance for specific imaging scenarios. To properly incorporate filters into a system, designers must understand the advantages and limitations of each type of filter.

Colored glass filters

The spectral discrimination of colored glass filters is due to the selection of dopants added to glass material. Transmission wavelengths and the attenuation of a given filter are determined by the selection of dopants and their concentration. After the doped material is produced, the remainder of the manufacturing process is nearly identical to standard optical glass manufacturing.

Colored glass filters are the most cost-effective solution for applications with relatively broad spectral requirements and their performance is angle-independent - their optical transmission does not shift, even when used with wide angle lenses or when tilted with respect to the optical axis of the system. However, colored glass filters typically feature slow transitions between blocking and transmission wavebands, with transmission curves that are not as steep as coated interference filters, and do not transmit as much light in their passbands as interference filters (Figure 2).

Figure 2: Colored glass filters typically feature slow transitions between blocking and transmission wavebands, with transmission curves that are not as steep as coated interference filters.

Although colored glass bandpass filters are relatively simple in concept and design, they can drastically improve image quality. They efficiently narrow the waveband that is visible by the vision system, and are often less expensive than comparable interference filters. Colored glass filters work best when used to block out colors on the opposite side of the color wheel (Figure 3).

Figure 3: Colored glass filters work best when used to block out colors on the opposite side of the color wheel.

There are a many other types of colored glass filters. For instance, daylight blue filters can be used for color balancing when polychromatic light sources and color sensors are used, and ultraviolet filters can selectively transmit the 254nm and 365nm mercury lines.

Infrared (IR) cutoff filters are useful for both monochrome and color cameras in machine vision applications. Silicon image sensors in most machine vision cameras respond to near-IR wavelengths — up to about 1 µm. Near IR wavelengths are commonly produced by overhead fluorescent lights or other unwanted sources, and can create sensor inaccuracies.

In color cameras, IR light can create a false color on the sensor and degrade overall image reproduction. This is why many color imaging cameras are supplied with IR-cut filters over the sensor. With monochrome cameras, the presence of IR light will degrade the contrast of the overall image.

Interference filters

If your task is as simple as distinguishing a yellow tablet from a purple one, a colored glass filter will perform well. However, if, for example, very small shifts in the color of a part under inspection have to be identified, the spectral discrimination offered by interference filters will be required since such filters have sharp transitions between the wavelengths that they transmit and block.

Wavelength-selective interference filters consist of alternating dielectric layers of high and low indices of refraction deposited on a specific substrate. The substrate surface quality and uniformity establishes the baseline optical quality for the filter, as well as defining wavelength limits based on the transmission characteristics of the substrate. The dielectric layers produce the detailed spectral characteristics of the filter by creating destructive interference between wavelengths of light incident upon the filter that are not in the transmission band, blocking these wavelengths from transmitting through the filter.

Interference filters are often fabricated with high Optical Density (OD), namely blocking efficiency, at blocked wavelengths. Although high optical density can make a system more robust, many machine vision applications do not require this level of precision. Typically, any filter with an optical density of 4 or greater is more precise than required and adds unnecessary cost.

Filter limitations

The interference effects responsible for the high performance of hard-coated filters are also responsible for their primary limitation. The characteristics of interference depend upon the relationship between light of a given wavelength and the length a wave of light travels through a medium. When a light wave travels through an interference coating at an angle other than the one for which it was designed, the path length through each layer changes, modifying the wavelength selectivity of the filter (Figure 4a).

Figure 4: Interference filters function based on the distance that the light incident upon the filter travels. (a) At the correct angle of incidence, the light waves incident on the filter destructively interfere, disallowing them from making it through the filter. At a different angle, the destructive interference is not as effective, changing the way the filter will behave. (b) An example of blue shift, shown with a bandpass filter used at a 15 degree angle of incidence. Note not only the shift toward a lower center wavelength, but that the slope is not as steep. The dashed curve is ideal, when the filter is used at a 0 degree angle of incidence.

All interference filters are designed for a specific Angle Of Incidence (AOI) that is generally 0° unless defined otherwise. When a filter is placed in front of a lens, the acceptance angle is defined by the angular field of view of the lens. In the case of short focal length (large angular field of view) lenses, light that is transmitted through the filter will often display an unwanted effect where the passband shifts down in wavelength and the slope decreases. This effect is known as blue shift (Figure 4b). For example, a wide-angle 4.5mm focal length lens will have a much larger blue shift than a narrow-angle 50mm focal length lens.

At different field points in the image, the filter will behave differently by transmitting different wavelength ranges: the farther out in the field, the more pronounced the blue shift. In most cases, interference filters can still provide better filtering control over colored glass filters, but be aware of the potential pitfalls when using an interference filter with a wide-angle lens.

Color filters

Consider the example shown in Figure 5a, where red and green gel capsules are being inspected under a white light backlight. This is a sorting application where the pills need to be separated by color. The monochrome image without any filtering (Figure 5b) has a contrast between the green and red capsules of only 8.7%, which is below the minimum advisable contrast of 20%.

Figure 5: Colored glass filters can greatly increase contrast between different objects under inspection. (a) Red and green capsules inspected under a white backlight. (b) A monochrome image without any filtering exhibits a contrast between the green and red capsules of only 8.7%, below the minimum advisable contrast of 20%. (c) The same capsules imaged with a monochromatic camera and green colored glass filter increases the contrast to 86.5%.

In a perfect world, without fluctuations of noise throughout the system, 8.7% contrast could be sufficient. However, minor fluctuations in ambient light levels or temperature fluctuations within the lens or sensor can decrease the already low contrast value of 8.7% enough that the system is no longer capable of operating properly. The situation could be solved with an expensive light baffle or by reworking the entire lighting scheme; but the simplest and most cost effective solution is to use a green colored glass filter to improve the contrast between the two different colored capsules. As shown in Figure 5c, the contrast improves from 8.7% to 86.5%: an increase of nearly a factor of 10.

Neutral density

Neutral density filters give you control over image brightness without changing the f/# or exposure time. Both the absorbing and reflecting types of neutral density filters uniformly lower the light transmitted onto the sensor. For applications such as welding where the imager can be saturated regardless of the exposure time, neutral density filters decrease the light throughput without needing to change the f/# (which can impact the resolution of the system). Apodizing filters are specialty filters fabricated with an optical density that decreases with radial distance from the center. They help handle hotspots in the center of an image caused by a harsh reflection from an object.

Imaging and machine vision applications continue to become more sophisticated. Designers have many options for making their systems more reliable and repeatable, and optical filters exist to manipulate the contrast of an image to help increase the accuracy of the imaging system. Whether it is simple color filtering or polarization filtering, each filter exists to solve a unique problem; it is important to pick filters that match your specific applications.

More Vision Systems Issue Articles
Vision Systems Articles Archives

Voice Your Opinion

To join the conversation, and become an exclusive member of Vision Systems Design, create an account today!