Color Image Representations



Grayscale images do not have enough information to handle some inspection tasks like identification, sorting, and process control. In other cases, a solution is possible with the grayscale image, but is greatly simplified by taking into account color information. Below are some examples of inspection and sorting tasks that are facilitated by the use of color analysis:

Color in Machine Vision

  • Color adds another dimension of information to the problem.
  • It is an easy solution to many machine vision inspection problems. In many cases, a monochrome solution will exist, but the color solution requires much less effort.
  • The use of color processing is a relatively recent development in Machine Vision applications, due to the following innovations:
    - The PCI bus and framegrabbers can handle larger amounts of data
    - New solutions for computer-intensive algorithms have been developed
    - Computing power has become more affordable
  • Common applications include identification, sorting, and process control


  • Every person perceives color in a different way. A single model which mimics the response of the human eye can't account for differences in physiology between people.
  • There are many different representations available for color: RGB, HSL, XYZ, YUV...
  • Large amounts of data are involved:
    - NTSC image: 640 x 480 x 4 = ~1.2 MB
    - NTSC image "live" (30 fps) = ~35 MB/s

    - PAL image: 768 x 572 x 4 = ~1.7 MB
    - PAL image "live" (25 fps) = ~42MB/s

    A continuous acquisition streamed to disk would fill up a 6 GB hard drive in a matter of minutes!

  • Understanding Color

    • Visible colors can be obtained as variable combinations of red, green, and blue
    • Color cameras produce the color signal in one of the following ways:
      - Composite video (NTSC, PAL -- 1 wire)
      - S-Video (NTSC, PAL -- 2 wires)
      - RGB (3 wires)

    A prism is commonly used in color cameras to split the light into its component wavelengths. The plot below shows a typical color line profile split into its red, green, and blue components.

    RGB: Red, Green, Blue

    The natural color space used by display monitors matches the way the human eye perceives colors. Cones in the retina of the human eye contain three pigments, each sensitive to either red, green, or blue light. Each color, though, can have a range of appearances based on its richness (saturation). In the figure below, each box contains only one "color" (hue), but illustrates a range of saturation values:

    In the RGB representation, adding white light to the image will change all three of the components. A representation based on hue, however, is independent of lighting conditions--a red object has a red hue whether it is dimly or brightly lit.

    HSL: Hue, Saturation, Luminance

    • HSL is just another "view" of color information; the situation is analogous to that of looking at analog signals in the time domain or freqency domain - in color representation you can use RGB or HSL (as well as many other representations).
    • The characteristics used to distinguish colors in HSL are as follows:
      - Luminance (Luma): represents intensity or grayness
      - Hue: represents the dominant color
      - Saturation: represents the "richness" of the color
    • Hue and Saturation together are called Chroma
    • A color signal can be represented as Luma + Chroma

    HSL: Benefits

  • Each color has a unique hue
  • Hue is insensitive to lighting. It is:
    - Independent of contrast
    - Independent of white light reflections
  • The two images shown below would be difficult to analyze using an RGB representation, but are quite easy to deal with using a thresholding technique based on the hue of the objects.