Computer Graphics Color Models

The definitions and some of the text and figures for this page are borrowed from:

CSC 418: Colour Representation
Copyright 1996 by Michiel van de Panne, University of Toronto

Also check out:

The Colour Science Glossary

Properties of Light

We perceive electromagnetic energy having wavelengths in the range 400-700 nm as visible light. The perceived color of visible light is as much psychological as it is physical.

The electromagnetic spectrum

The Eye

In order to understand color perception we first discuss the structure of the eye.

The photosensitive part of the eye is called the retina. The retina is largely composed of two types of cells, called rods and cones, as shown below. Only the cones are responsible for color perception. Cones are most densely packed within a region of the eye called the fovea.

There are three types of cones, referred to either as S, M, and L, which are roughly (very roughly) equivalent to blue, green, and red sensors, respectively. Their peak sensitivities are located at approximately 430nm, 560nm, and 610nm for the "average" observer. Colorblindness results from a deficiency of one cone type.

Color Perception

  • Different spectra can result in perceptually identical sensation called metamers
  • Color perception results from the simultaneous stimulation of the 3 cone types
  • Our perception of color is also affected by surround effects and adaptation

Color Matching

In order to define the perceptual 3D space in a "standard" way, a set of experiments can (and have been) performed. In the experiments observers try to match the color of a given wavelength, l, by mixing three other pure wavelengths, such as R=700nm, G=546nm, and B=436nm in the following example. Note that the phosphors of color TVs and other CRTs do not emit pure red, green, or blue light of a single wavelength, as is the case for this experiment.

The above scheme can tell us what mix of R,G,B is needed to reproduce the perceptual equivalent of any wavelength. A problem exists, however, because sometimes the red light needs to be added to the target before a match can be achieved. This is shown on the graph by having its intensity, R, take on a negative value.

In order to achieve a representation that uses only positive mixing coefficients, the CIE ("Commission Internationale d'Eclairage") defined three new hypothetical light sources, x, y, and z, which yield positive matching curves:

If we are given a spectrum and wish to find the corresponding X, Y, and Z quantities, we can do so by integrating the product of the spectral power and each of the three matching curves over all wavelengths. The weights X,Y,Z form the three-dimensional CIE XYZ space, as shown below.

Often it is convenient to work in a 2D color space. This is commonly done by projecting the 3D color space onto the plane X+Y+Z=1, yielding a CIE chromaticity diagram. The projection is defined as:

Giving the following chromaticity diagram.

A few definitions:

spectroradiometer
A device to measure the spectral energy distribution. It can therefore also provide the CIE xyz tristimulus values.
illuminant C
A standard for white light that approximates sunlight. It is defined by a color temperature of 6774 K.
complementary colors
colors which can be mixed together to yield white light. For example, colors on segment CD are complementary to the colors on segment CB.

dominant wavelength
The spectral color which can be mixed with white light in order to reproduce the desired color. color B in the above figure is the dominant wavelength for color A.
non-spectral colors
colors not having a dominant wavelength. For example, color E in the above figure.
perceptually uniform color space
A color space in which the distance between two colors is always proportional to the perceived distance. The CIE XYZ color space and the CIE chromaticity diagram are not perceptually uniform, as the following figure illustrates. The CIE LUV color space is designed with perceptual uniformity in mind.

Color Gamuts

The chromaticity diagram can be used to compare the "gamuts" of various possible output devices (i.e., monitors and printers). Note that a color printer cannot reproduce all the colors visible on a color monitor.

The RGB color Cube

The additive color model used for computer graphics is represented by the RGB color cube, where R, G, and B represent the colors produced by red, green and blue phosphors, respectively.

The color cube sits within the CIE XYZ color space as follows.

Color Printing

Green paper is green because it reflects green and absorbs other wavelengths. The following table summarizes the properties of the four primary types of printing ink.

dye color

absorbs

reflects

cyan

red

blue and green

magenta

green

blue and red

yellow

blue

red and green

black

all

none

To produce blue, one would mix cyan and magenta inks, as they both reflect blue while each absorbing one of green and red. Unfortunately, inks also interact in non-linear ways. This makes the process of converting a given monitor color to an equivalent printer color a challenging problem.

Black ink is used to ensure that a high quality black can always be printed, and is often referred to as to K. Printers thus use a CMYK color model.

Grassman's Law

Grassman's Law states that color matching is linear. This applies in a few cool ways:
  • Scaling the color to be matched and the three primaries by the same factor preserves the match.
  • To match a color formed by adding two colors, add the primaries of the two colors.
  • There exist 3x3 linear transformations between color spaces (RGB and LMN and monitor).

Color Conversion

Monitors are not all manufactured with identical phosphors. To convert from one color gamut to another is a relatively simple procedure (with the exception of a few complicating factors!). Each phosphor color can be represented by a combination of the CIE XYZ primaries, yielding the following transformation from RGB to CIE XYZ:

The transformation yields the color on monitor 2 that is equivalent to a given color on monitor 1. Quality conversion to-and-from printer gamuts is difficult. A first approximation is as follows: C = 1 - R
M = 1 - G
Y = 1 - B
The fourth color, K, can be used to replace equal amounts of CMY:
K = min(C,M,Y) C' = C - K
M' = M - K
Y' = Y - K

Artistic Color Models

Since artists (and probably most people besides us graphics geeks) tend to think of color in such terms as hue, saturation, and value, a color model has been designed to facilitate communicating the intended color to the computer application more easily. This is the HSV color model. Hue is expressed as an angle around a color wheel. Value (intensity or brightness) is measured along the axis of the cone. At the V=0 end of the axis is black. At the V=1 end of the axis is white, which lies in the center of the color wheel. Thus, the axis represents all shades of gray. Saturation (purity of the color) is measured as the distance from the axis. Note that the hexagonal shape of the HSV space can be formed by looking at the RGB cube along its gray diagonal.

Another color model used for intuitively choosing colors is HLS - Hue, Luminance, Saturation. This model uses a double cone, with pure hues around the rim of the cone. At the L=0 apex of the cone is black, and at L=1 is white. This allows lightness and darkness of the color to be chosen using a single parameter. The third dimension is saturation, which has the same meaning as in HSV.

Other Color Systems

Several other color models also exist. YUV is used for TV in Europe, and for MPEG compression. YCrCb is used in studio digital tape and in JPEG image compression. YIQ is a cruder form of YCrCb, but is used for TV in USA.