Spectral filtering is most commonly used to either select or eliminate information from an image based on the wavelength of the information. This filtering is usually effected by passing the light through a glass or plastic window that has been specially treated to transmit or absorb/reflect some wavelengths. Since the light entering a sensor will have a spectral distribution that depends (mainly) on both the illumination source's spectral characteristics and the reflectance of the illuminated scene, using a filter to select image regions with known spectral properties can help extract the desired information.

Some applications that use spectral filtering are:

In the first two applications above, the filters were "band-pass" filters that only allowed light of a specified wavelength to pass through. In the infrared example, the filter used could have been a "band-pass" filter set for visible light, a "band-stop" filter that eliminates all light above the visible wavelengths, or a "band-stop" filter that eliminates only the light at the specific wavelength of the infrared position sensor.

In the discussion above, the concept of allow or eliminate was used a bit too precisely. In reality, it is not possible to allow only a single wavelength; instead, the filter usually allows a range of wavelengths near to the specified wavelength. Part of the skill of creating filters is to control the narrowness of the range of wavelengths, how well the filter transmits at the desired wavelengths, and how little change there is in the relative intensities of the transmitted illumination. For example, the filter used in the laser stripe example below is tuned to a wavelength of 633 nm, with a half width of 10 nm. That means that any light outside the range of 623-643 nm is guaranteed to be reduced by at least 50%. The filter also does not reduce the intensity at 633 nm by more than 5%. Both of these properties are ideal because the laser wavelength is 632.8 nm. Filter manufacturers make filters with the same pass wavelength as common laser sources.

More precisely, if the amount of light transmitted by a filter at wavelength is and the input spectrum intensity at wavelength is , then the intensity of the light transmitted through the filter at wavelength is . This is illustrated pictorially by:

One should be careful to not expect too much from a filter. For example, suppose that you use a "red" filter to look for red objects in a scene. Since red is a range of wavelengths, the filter will have to have a broad pass band. It is thus likely that it would not greatly reject other wavelengths of light. For example, "blue" might be reduced 50%, but that still allows a lot of blue light to pass through the filter. If a blue region were more than twice as reflective as a red region and the amount of illumination both received were equal at all wavelengths, then the blue region observed through the red filter might still be brighter than the red region, only no longer twice as bright. (Note: this example is a little imprecise because the definition of the region and filter colors was not made precise, but the general concept of the argument should be clear.)

A common use of spectral filtering is in range sensors based on triangulation of a structured light pattern (eg. a projected light stripe). The projected light is usually generated using a laser, because this allows use of a spectral filter that effectively transmits only the laser light stripe, irrespective of the other illumination in the scene. While most typical indoor scene illumination is broad-spectrum and thus has energy at the same wavelength as the laser, typically the power at this wavelength is much lower than the laser, and so one can simply look for the brightest stripe in the image. Outdoor scenes are more problematic as solar illumination is much brighter (e.g. 100 times) than typical indoor illumination, which may require use of a laser that is more powerful than those that are safe for use with unprotected eyes.

This image shows a scene observed by a triangulation sensor, where the bright nearly vertical stripe in the center of the image is generated by the laser.

Notice that the stripe is not obviously different from some of the other bright features in the scene. If we add a spectral filter to the camera, the image changes to this:

Now the stripe is clearly distinct and easily extracted from the image. (The image was inverted and slightly contrast enhanced to improve its appearance.) Real range sensors also do consistency checks on the extracted stripes to eliminate other possible sources, such as occasional specular reflections of light sources, which can be much brighter than the diffuse reflected light that is easily eliminated by the spectral filtering.