Color is one of the most important visual cues that humans have for inspecting objects. Yet, color is a subjective value that depends on an object’s illumination and viewing environment as well as its spectral properties. To automate color-based inspection, a machine vision system must model after the behavior of human eyesight.
The color of objects and surrounding light affects one’s mood and his overall opinion of the things he sees every day. A package that is mis-colored in comparison to the surrounding packages, for example, may cause customers to think that an item is old or defective. Machine vision systems can leverage the strength of such color cues to help determine whether products will sell and whether or not the end customer will be satisfied.
Use the Right LightingVisual color matching systems must judge color in the same way that humans do. One way to make this judgment is to use the “golden reference” strategy. Start by choosing an ideal, or “golden” unit, one that is as close to perfect as possible, from the pilot production runs. If the ideal color is a certain red, the golden reference unit should be as close to that red as possible. The inspection system will then use relative color analysis to measure visual color differences between each unit under test (UUT) and the golden reference unit. This provides the information needed to ensure that every production unit will visually match the reference.
Because human perceptions depend on the lighting conditions, the test conditions must model the final viewing conditions. Lighting and how it interacts with UUTs should be the first consideration. Light source intensity stability, spectral characteristics and geometry all affect color-difference measurements. To provide consistent results, then, test conditions such as light sources, object characteristics, color models, detecting devices and environmental conditions must not vary between tests.
The source’s flicker rate can affect measurement stability as well. A fluorescent lamp’s output, for example, changes in time with AC power cycles. The AC frequency must therefore be higher than the machine vision system’s sampling rate, or the intensity will vary from one color measurement to the next. Too low a power line frequency can play havoc with tests using fast acquisition times on an assembly line.
Measurement precision depends on the source’s spectral characteristics. If a UUT is blue and the light source does not have sufficient blue emission, realistic measurement results are impossible to obtain. Using continuous-spectrum “white” lights in color testing systems avoids such problems. The light source needs to include adequate emission at every wavelength within the visible range-380 to 720 nanometers.
The spectral characteristics of the light source also are important in avoiding metamerism, where two UUTs look the same under one light source but look different under another light source. Metamerism occurs because human visual systems cannot distinguish detailed wavelength information, only broad ranges. Thus, two UUTs can have different spectral curves but still look the same under the right lighting conditions. Many cameras also do not detect detailed spectral information, so they will be affected by metamerism in the same manner as humans.
Metamerism commonly occurs when the light sources include line spectra, that is, sharp intensity peaks at specific wavelengths. Many common light sources, including fluorescent and metal halide lamps, emit line spectra in addition to or instead of continuous emission. Two objects that have different spectral curves may appear to match in color under one light source because the light’s line spectra have masked the differences. When illuminated by a different light source, the spectral differences between the objects may be emphasized, causing their differences to be noticeable by a human.
White balancing requires the use of a white reflectance standard, which has a known amount of reflection at each wavelength across the visible spectrum, to measure the characteristics of the lighting system so that they can be subtracted out of the measurements on the UUT. White reflective standards can be made from Spectrolan, which is a durable, washable and often NIST-traceable material, but fairly expensive. A less expensive alternative is Kodak’s 90% white reflectance test card. Acceptable results also can be obtained with high quality white copy paper, but the results are not NIST traceable. Note that while white balancing can improve the results from a good, stable white source, it will not help a light with stability problems or solve metamerism.
Geometry is the final lighting factor to consider. Geometry describes the alignment between the source, the UUT and the detector. The optimum geometry will depend on the UUT’s physical characteristics, which affect the reflection, transmission, scattering, absorption and emission of light.
Lighting geometry is important. Take, for example, a highly glossy surface that has high reflectivity and produces mirror-like specular reflections. A high illumination source can thus generate glare that compromises the vision system. Placing the source at a low angle to the surface and adding a diffuser to reduce specular reflections will help in the detection of small visual differences on such surfaces. Another option for inspecting such a flat, shiny material would be to use an integrating sphere. Color difference measurements will vary whether specular reflections are included or excluded from the system.
Deeply textured products require a different lighting approach. Texture differences can affect color appearance, so for these surfaces the lighting must be even and sufficiently diffuse to provide consistent measurements. Other surfaces may require other approaches, so knowing the UUT’s surface qualities is essential in developing a color vision inspection system. The International Commission on Illumination (CIE) provides recommended lighting geometries for a variety of surfaces through their Web site atwww.cie.co.at/cie.
Choose Appropriate Color StandardsWhen color matching is used solely for pass-fail inspections, the way in which the system quantifies the color is unimportant. If the system is to quantify mismatches for the purposes of correcting the production process, however, the choice of color description schemes becomes important. Some standard color spaces, such as the RGB (red-green-blue) description, are great for specifying how a camera should detect a color, but provide no insight into how a person will perceive it.
The XYZ color space is another color scheme, designed to describe a color based on a standard human observer. While comparing XYZ values can quickly tell how closely one UUT matches the golden reference unit, however, if the values differ they provide no information on how the colors differ or whether the difference will be visually noticeable.
In order to provide color feedback, then, the vision system needs to use a color space that can be use to evaluate colors in a manner similar to human perception. The CIElab color standard is one such color space. This standard uses opponent theory, which relies on the fact that in human perception an object cannot look red and green at the same time, nor can it look yellow and blue at the same time.
The CIElab color space is perceptually uniform, that is, equal differences in the color space represent equal human-perceived color differences. This representation simplifies the correction of color errors. If a product looks too bluish, fixing the problem becomes very easy.
A more intuitive color space is the HCL-Hue, Chroma and Lightness-standard. In this representation, a given color appears as a point located in a 3-D color space defined by the HCL axes. Hue describes how red, green, blue or yellow the color appears. Chroma represents the color’s departure from gray, which humans perceive as saturation or vividness. Lightness describes how dark or light an object is. The Lightness scale runs from black to white with gray in the middle.
These two color standards map onto one another. CIElab values translate uniquely to the HCL color space. Hue and Chroma can be calculated from a* and b* values. Lightness is the same in either scale. Thus, a system that can work in one representation can work in both, providing information that will help evaluate and correct color errors.
Measuring ColorIn order to evaluate a color using these standards, the system must first quantify the color by making a colorimetric measurement. Spectrometers provide the most complete colorimetric measurements, quantifying the UUT’s relative spectral properties in sufficient detail to predict metamerism. Most off-the-shelf spectrometers look only at a small area on the UUT, however. Such spot-checking of color is ideal for some applications, but others require the use of integrated measurements over a larger area. Custom lighting and optical systems may need to be designed to illuminate and measure large areas on UUTs with a spectrometer.
Colorimeters are another measuring tool, determining color directly as a set of XYZ color space measurements that can then be used to calculate CIElab values. Colorimeters are faster than spectrometers, reducing the data collection and calculation times required to make a measurement. Colorimeter measurements require the same attention to lighting and observation area as spectrometers, however.
Color cameras also can make colorimetric measurements, working directly in the RGB color space. Computerized systems can then estimate CIElab values from the RGB measurements. What cameras provide that the other instruments cannot, however, is spatial information. Cameras can measure colors on many parts of the UUT simultaneously. They have the added benefit of being able to perform additional tasks-such as optical character recognition, particle analysis and gaging-while collecting colorimetric information.
One problem with color cameras is that they are not as precise as spectrometers or colorimeters. Two cameras from the same manufacturer may differ in spectral response by up to 10%. Nonetheless, when the cameras are correctly calibrated and white balanced, color difference measurements can be remarkably consistent.
System ConsiderationsWhen creating a vision-based color-measuring system, it is important to test the system in an environment similar to that in which it will be used. One key reason is that detectors tend to change sensitivity and noise levels with shifts in ambient temperature. Whether the detector is a spectrometer, colorimeter or camera, each has its own relation to noise and changes in temperature. Some manufacturers of three-chip cameras, for instance, recommend operating the instruments at below 40 C to reduce noise. This temperature sensitivity can create problems if the system’s environment is not stable requiring frequent recalibration of the system or even the installation of a thermoelectric cooler for the detector to prevent inconsistent measurements.
The entire system also should be tested to ensure that it is sensitive enough to detect the smallest color differences of interest. One way to perform this test is to have a batch of visually acceptable UUTs and a batch of visually unacceptable ones to compare to the reference unit. If the system can reliably distinguish between the good and bad test UUTs, it should also work well in production.
A final consideration when using color measurement systems is establishing what kinds of color errors are acceptable. Using too narrow a definition will limit manufacturing productivity. Too broad a definition will fail to achieve consistency.
Determining the tolerances, however, brings color back to a subjective evaluation. A CIElab system can do an impressive job of predicting color differences, but whether or not those differences are significant can only be evaluated by a human. Thus, calculated color measurements need to be validated by real field experience. Most engineers set their measurement tolerance levels empirically, correlating real-world observations to the test data to determine tolerance bands.
With appropriate color tolerance bands, machine vision systems can automate color inspection with great reliability. To get the system running, however, developers should spend time up front getting to know the target UUT, so that they can choose the best lighting for that target. The system should work in a color space that mimics human perception so that measurements can be meaningful and correlate with customer perceptions. After all, machines just detect spectral information. Only humans see color.