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
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
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.
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,
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:
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 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.
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.
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:
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.
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.