Color Image Processing

Last updated on Wednesday, October 11, 1995 at 9:00 AM.


Reading

Gonzalez and Woods, 4.6.

 


Light and Color

As you all know, light is electromagnetic radiation of varying frequencies. Visible light is in the range (approximately) 400-700 nm.

The frequency (or mix of frequencies) of the light determines the color.

The amount of light (sheer quantity of photons) is the intensity. (If you were to ask a physicist instead of an image processor, the intensity of radiation also relates to its energy, which is itself proportional to the wavelength, but for this discussion, we'll use this less precise definition.)

Light that has a dominant frequency or set of frequencies is called chromatic. Light without such dominant frequencies (white light) is called achromatic.

Let's also use a few other terms to describe light:

hue
The apparent color of the light (determined by the dominant wavelengths.
intensity
The total light across all frequencies.
saturation
The purity of the light.

Red, Green, Blue, Yellow, Orange, etc. are different hues. Red and Pink have the same hue, but different saturation. A faint red and a piercing intense red have different intensities.

 


Light and Our Eyes

Our eyes have two different types of receptors: cones and rods. The cones are sensitive to colored light and the rods are sensitive to achromatic light only. That is, our rods can tell that there's light (and are very sensitive to it), but can't tell what color it is. Cones can tell what color the light is, but it turns out that they're not very sensitive to dim light. Light that is bright enough to cause our cones to respond is described as being in the photopic range. Light that is too dark for the cones but bright enough for the rods is called scotopic. Have you ever wondered where the colors go at night under moonlight?

We'll go into neural processing of ligth later in the course (if time permits), but one important way that we treat color is that we separate it from intensity. In a sense, we have an "intensity channel" and a "color channel". It is as if we perceive the shapes of things in the world from intensity and then paste on the colors later. We are far more sensitive to intensity variations in light than we are to changes in hue.

We perceive colors using three different types of cones. It's not quite accurate to say that theyre red, green, and blue receptors (they actually respond in opponent pairs:: red/green and blue/yellow), but it's a reasonable way of looking at it. These three hues: red, green, and blue are called primary colors.

 


The CIE Chromaticity Diagram

Suppose that we describe all light as being some amount each of red (R), green (G), and blue (B). We can compute the total light as R + G + B, and we can normalize the light by this intensity to get the relative hues:


Notice that r + g + b = 1. If we consider the hue as a three-element vector or point: , all of these points lie on the plane passing through , , and .

We can actually get any point on this plane by simply knowing x and y (z = 1 - x - y. If we map the range of visible light on an plane, they form a horseshoe shape ranging from red light to blue. White light is the point in the middle where all three quantities are equal. Pure hues are along the periphery of the horseshoe. As you make a line from the edge hue to the white point, you trace out various levels of saturation.

Notice that if you pick any three points as primary colors, there are colors that cannot be made from them. The range of colors possible from some set of primaries is the gamut of color for those primaries, and it bounded by the lines between the primary points.

 


Color Models

 

RGB

The simplest and most common lighting model is use use the red, green, and components R, G, and B. We use this for color monitors, scanners, image storage, etc.

It is not, however the best or most intuitive model to work with.

 

CMY or CMYK

Red, green, and blue make useful primaries for additive light, but not for subtractive.

What we mean by subtractive color is that light reflected off of a surface is what the surface doesn't absorb. When we mix two colors on a surface, we thus mix what they absorb, not what they don't absorb. Each color subtracts its respective wavelengths from the reflected light instead of adding together.

If you mix red, green, and blue light, you get white. If you mix red, green, and blue paint, you get black (or close to it). For this reason, the subtractive primaries are better selected as cyan (blue-green), yellow (red-green mix of light), and magenta. (red-blue). Notice that each of these is the opposite or complementary color of the additive primaries.



For printing then, you'll often see the CMY model. Since it's very hard to mix these to get a perfect black (no surface really absorbs all of a particular wavelength), people also usually add pure black (K) to the mix and call it the CMYK model. If you look in a color printer, you'll probably see these four colors, not red, green, and blue.

 

YIQ

Another, more intuitive, way to describe color is to separate the intensity from the hue. One such color model that does this is the YIQ model. The Y component is the intensity, and the I and Q components describe the hue. (Don't worry about how they are encoded-that part's not very intuitive.)

Separating out the intensity from the other components has several advantages:\

The YIQ model has the advantage over other methods that separate hue from intensity in that it can be computed as a linear function of the RBG values:  

HSI

As I mentioned before, the I and Q parts of the YIQ model aren't very intuitive for describing the chormatic properties of light. Another, even yet more intuitive, model is the Hue-Saturation-Intensity or HSI model.

Think of this model as a a two-ended hexagonal pyramid. The middle hexagon has corners at the three additive and the three subtractive primaries. The middle is white or achromatic light. Thus, angle around the hexagon is the hue, and distance from the center axis is saturation. As you go up or down the pyramid, you add or subtract form the intensity of the light. When ou get to no intensity, everything fades to black. As you increase the intensity (but bound each primary), everything becomes less saturated and evenetually becomes pure white. These lie at the tips of the double-tipped pyramid.

This is a very intuitive model for color artists working with light.

 

HSV

The Hue-Saturation-Value (HSV) model is similar to the Hue-Saturation-Intensity model, but basically round the hexagon into a circle. Intuitively, it is the same to work with as the HSI model.

While HSI and HSV is intuitive for people, it is more complicated to go back and forth from. For this reason, many interactive systems use HSI or HSV while many image-processing systems use YIQ.

 


Color Image Processing

The real key to color image processing is to first get your data into the right color model for the job. Usually, the models that separate intensity from the chromatic properties of light are more useful for analyzing scenes.

Basically, we can use any of the methods we've talked about so far to process color images-we just have to be careful because we're working with at three pieces of information per pixel, not one. How to separate or combine the three is the trick.

Compression, for example, often uses the YIQ model because you get more redundancy of information: if lighting changes across an orange patch, the red, green, and blue parts all change, but in the YIQ model the I and Q parts stay the same while the Y part varies. (As you'd expect, JPEG and MPEG use YIQ encoding.)

 


Pseudocolor

The term pseudocolor refers to using color to visualize things that aren't inherently colored. For example, if we want to display two variables of information at a time in an image, we may vary the intensity (as one variable) and the hue (as the other variable) independently.

Such use of pseudocolor can be effectively used to label or identify particularly significant sections of the image (as determined by some other image-processing or vision algorithm).

It is not, however, particularly effective for such displays of independent variables as described earlier because of our relative lack of sensitivity to subtle changes in hue. Another drawback is that we don't have the same linear sense of hue as we do intensity. (Quick--which is higher wavelength, green or yellow?) The only color-coding system that seems to work at all (and poorly at that) is a heat-related scale: red, yellow, white, blue.

One also needs to keep in mind when using color that a large portion of the population (estimated 10 If you create isoluminant displays (ones with uniform intensity but varying hues), colorblind people won't see them at all. Even still, normal-sighted people will see them poorly.

When using pseudocolor, be very careful about how you use it--don't just add it to make things "look good". What is aesthetically pleasing isn't always performance-enhancing.


Vocabulary