What is color? There are technical responses to the question as well as more practical answers. Technically, one could define a specific color as a wavelength (or combined wavelengths) of energy in the electromagnetic spectrum generally visible to the human eye. But is that really “color”? In effect, it is not. The term has little meaning technically except in the context of perception. Certainly, reflected or transmitted or absorbed light can be analyzed as to spectral content. Practically though, the color of something is simply what we perceive it to be and the name we attribute to that visual perception.
Identification or Differentiation
From the human perspective, we are terribly inconsistent in reporting color. In fact, color perception has not only physiological but also psychological implications. Consider this: no one can ever know how another person actually experiences, for example, the color “blue.” Compounding this issue are the effects of external influences, in particular the content and intensity of the light illuminating the object and even variation in size and shape of the object. (Ever wonder why the paint looks like a different color on that big wall as opposed to on the small sample card?) Human vision though is pretty efficient at matching or differentiating even very similar colors when observing objects all at once. Therefore, in many cases it is sufficient for the analysis of color in automated inspection and quality control to achieve this human ability to differentiate closely related colors.
Applications in color analysis with matching face certain critical implementation challenges.
The consistency of lighting intensity and the color content play important roles.
Just as with our own vision, the perception of a color changes with the amount of light reflected from the object.
Can one discretely measure the exact spectral response of the item for greatest accuracy instead of just differentiating color? There are many devices—spectrophotometers, colorimeters, and other analyzers—capable of accurately reporting the spectral wavelengths absorbed or reflected by an object. Functionally though, these devices usually are designed either for off-line or laboratory use in specific applications, may require precision setup and part presentation, or may be too costly and otherwise impractical for plant-floor use. Furthermore, in many applications for color inspection, the acceptable variation is relatively broad to the extent that precise spectral measurement is not necessary on-line. A realistic approach then is to use machine vision technology, components, and software to achieve reliable and usable color analysis by matching to a known sample. The remainder of this discussion relates to this type of processing, which comprises the majority of on-line color applications. Let’s continue by reviewing how a color image is produced.
Machine vision color imaging
Fortunately, color imaging and analysis using machine vision is widely available with minimal, if any, component cost impact. The most commonly used machine vision cameras that acquire a color image are virtually identical to monochrome cameras with one exception being the addition of a special array of color filters over the sensor pixels called a “Bayer Filter,” designating the arrangement and color of the filters. (There are other filter arrangements but they are rarely used for machine vision cameras).
This type of color camera produces three images in a single acquisition, one each with red, green, and blue content for the respective filtered pixels. Note that each individual pixel does not have full color content. To create a full image, the camera must examine the content of neighboring pixels (per their filtered color content) in a process called “demosaicing” which reconstructs the three sub-sampled images to cover the full resolution of the camera. It’s important to know that this process results in a color image with less real spatial resolution than would be found in a corresponding monochrome image (up to 30%), a fact that may be important in certain applications.
Alphabet soup of color representation
Some technical articles go into great detail about how machine vision might process and analyze a color image. A wide variety of acronyms exist for many different color space representations: CIE (XYZ, LUV, UVW), RGB, YIQ, YPbPr, HSI, CMYK, and several more. There even is some disagreement between experts as to the best representation of color for analysis in a machine vision system.
We won’t join that discussion in this article. In general, expect that the machine vision products offered for color analysis by matching perform well for many typical applications regardless of the choice of color space representation.
Typical application execution
Depending upon the machine vision product, one (or more) of these color representations will be used to tune a target color and/or to configure the degrees to which an observed color will be allowed to deviate from the original color. Two common ways to process a color image are color extraction and color modeling (the names and actual implementations of these types of tools vary by manufacturer). The task of color extraction is to create a grayscale image from a color image where each pixel only contains content with a specific color response. Color modeling (or matching) is a task that matches colors in an image with a pre-trained color model, within, as before, a specified range of color deviation. In both cases, the allowable color deviation will be configured using parameters related to the color space representation (RGB, HIS, etc.) depending on the product.
The subsequent result processing varies from product to product, but often the result of color processing is a grayscale image that contains only the portion of the captured image that has objects with the correct color. Using that image, further analysis of the feature can be done using standard grayscale tools.
While color matching can be a highly reliable process there are some common contributors to performance inconsistency that should be considered when matching colors.
Applications in color analysis with matching face certain critical implementation challenges. As suggested earlier, the consistency of lighting intensity, and the color content play important roles. Just as with our own vision, the perception of a color changes with the amount of light reflected from the object. If the intensity is consistent, for color matching this may not be an issue. If it is inconsistent, the color differentiation could be highly unreliable, and more so for some color space representations than others. Illumination color content can impact color analysis in the same way if it varies, but in this case the problem is in the real color of the source.
What is the actual color of an illumination source? If it is monochromatic, the color might be well specified. Unfortunately, single color illumination (like red, green, or blue light) has minimal use in the analysis and matching of colors in a production environment. Normally, a white light is required. However, white is not a “color;” it is a combination of many colors: a perfect white light would have all visible color wavelengths combined in equal intensity. Unfortunately, general-purpose machine vision illumination sources are far from perfect white. Fortunately, though, it’s not a problem for most applications in color matching where cameras can be color-balanced for closer to consistent responses. But, the content must remain constant, just like the intensity, for a robust application.
There are several other implementation challenges, but in conclusion let’s discuss perhaps the most challenging: that of part-to-part variation. In an actual production environment there are many applications that adhere to very tight specifications for color content. Take for example, printing processes. Printed labels, containers, and commercial packaging, to name a few, all require very tightly-maintained color content in production. Other applications have similar specifications. In these cases, the target color(s) and the limitations of the acceptable deviation from that target are very well defined. As a result, well-designed color imaging and configuration should be successful in capturing localized features or colors that deviate from the expected target. In other applications, however, objects to be inspected are not so consistent. Applications in fabric, plastics molding, and similar products are known to often have widely varying color content. What is “brown” one week may be a slightly different “brown” the next week. Humans are well equipped to do this kind of comparative inspection, but the configuration of machine vision tools to accommodate these changes can be very challenging. In some cases, one acceptable color can overlap the extents of a similar acceptable color, making discrete differentiation of the two nearly impossible. In such cases, a protocol of re-training target colors or other process mechanisms might be required.
In closing, color processing using machine vision can be a valuable, if arguably currently somewhat under-utilized, tool on the plant floor. Ultimately, color analysis tools may evolve to the point that all inspection, guidance, and on-line analysis is done completely in color—like human vision. A lofty but perhaps achievable goal.