CS184 Lecture 27 summary

RGB Color Bases

The CIE chromaticity diagram provides a standard reference for comparing other color systems. Many color systems use "RGB" meaning a red, green and blue component. But the choice of red, green and blue and be quite different. They typically correspond to ideal display device colors. We can compare these bases using the CIE coordinates of their colors. e.g.

NTSC RGB color coordinates

The color coordinates for the red, green and blue colors for NTSC (US color TV) are given below. Note that only the X and Y coordinates are given. They correspond to the X, Y coordinates of the particular colors in the CIE chromaticity diagram. Since the diagram implicitly has X+Y+Z=1, there is no need to include all 3 coordinates. You can derive Z by subtracting X+Y from 1.

   X Y
Red 0.67 0.33
Green 0.21 0.71
Blue 0.14 0.08

you can think of this relationship in matrix form

[ R ] [ X ]
[ G ] = MNTSC [ Y ]
[ B ] [ Z ]

CIE RGB color coordinates

The CIE defined a rather different RGB basis for color. Its color coordinates are given below. Once again we give only the X, Y components. You can derive Z from them.

   X Y
Red 0.735 0.265
Green 0.274 0.717
Blue 0.167 0.009

Which we could write as

[ R' ] [ X ]
[ G' ] = MCIE [ Y ]
[ B' ] [ Z ]

Change of Color Basis

From the matrix derivation above, it should be clear that we can convert from one color basis to another quite easily. e.g to go from the NTSC RGB basis to the CIE RGB basis, we would compute:

[ R' ] [ R ]
[ G' ] = MCIE MNTSC-1 [ G ]
[ B' ] [ B ]

The RGB Color Cube

On a display with 3 color phosphors/lamps/LEDs, the possible magnitudes of each color vary from 0 to 1. Thus the space of possible colors in R, G, B space is a unit cube. It is called the RGB color cube. The magnitudes of R, G, B should be chosen so that they give an acceptable white/gray when they have the same magnitude R=G=B. That is, the diagonal of the color cube is gray-scale colors. Note that the main vertices of the color cube are the primary colors, while the other vertices (except (1,1,1) which is white) are complementary colors. That is, the vertices have color values as follows:

(0, 0, 0)   Black

(1, 0, 0)   Red
(0, 1, 0)   Green
(0, 0, 1)   Blue

(1, 1, 0)   Yellow = White - Blue
(1, 0, 1)   Magenta = White - Green
(0, 1, 1)   Cyan = White - Red

(1, 1, 1)   White

Subtractive Models

The color models considered so far are most naturally thought of as additive. That is, you produce colors by adding primaries. In pigment-based systems, such as paints or color printers, mixing colors means adding the colors which are absorbed. This is equivalent to subtracting all the colors in the primaries. e.g. if you mix yellow and magenta inks, the result would absorb blue and green light, and would appear red.

The standard subtractive color basis is CMY or Cyan-Magenta-Yellow. It is derived from an RGB basis using the expression:

[ C ] [ 1 ] [ R ]
[ M ] = [ 1 ] - [ G ]
[ Y ] [ 1 ] [ B ]

To obtain more contrast, CMY systems often include a black pigment. This encodes the gray level and is given the coordinate K. Such systems are called CMYK. This is a redundant system, but the use of K means that only two of C, M, Y need to be used. This also tends to save cost by using cheaper black ink rather than several color inks.

HSV color basis

The last important color mode is HSV for Hue-Saturation-Value. The HSV system is very intuitive for people. Any mix of colors has a "dominant wavelength", or dominant pure color. You can find the dominant wavelength from the CIE chromaticity diagram. You plot the actual color as a point, and then draw a line from the white point to this point, extending the line out to the boundary of the CIE curve. The color where the line hits the boundary is the dominant color. You could obtain the actual color by mixing the dominant color with white. The saturation is a measure of the fraction of distance (from the white point) to the actual color relative to the dominant color. So saturation = 0 is white or gray light, while saturation = 1 is a pure color. The value is simply the intensity of the light.

The standard HSV color basis is obtained from the RGB cube. First, view the cube from a viewpoint such that the origin and the white point (1, 1, 1) line up. The boundary of the cube will look like a regular hexagon from this view. This view makes the V parameter invisible, because it collapse black and white.

For any color plotted on this planar hexagon, its H and S values are computed like this: Draw the line from the center to the desired color and extend it to the boundary of the hexagon. The saturation is the relative length to the actual color compared to the boundary color. The Hue is the angle of the line in degrees, measured from red. The other Hue angles are

red = 0o, yellow = 60o, green = 120o, cyan = 180o, blue = 240o, magenta = 300o

Notice that complementary colors are exact opposites, i.e. they are 180o apart.