Color (Basic Computer Graphics) Part 2

Color Models

The range of colors produced by an RGB monitor is called its gamut. There are a number of models for the gamut of an RGB monitor.

The Color Cube or RGB Model. This is the "natural" gamut model that represents the gamut as the unit cube [0,1] x [0,1] x [0,1]. See Figure 8.5.

The CMY Model. This model uses the subtractive primary colors cyan, magenta, and yellow, which are the complements of red, green, and blue, that is,

tmp1516-39_thumb_thumb

 

 

 

The CIE chromaticity diagram.

 

Figure 8.4. The CIE chromaticity diagram.


 The RGB color cube.

Figure 8.5. The RGB color cube.

The colors are called “subtractive” because they tell one what has to be subtracted from white (rather than what has to be added to black) to get the color. The CMY model is used with reflective sources and for devices like ink-jet plotters.

The YIQ Model. This model is defined by the equation

tmp1516-42_thumb_thumb

 

 

 

The HSV hexcone.

Figure 8.6. The HSV hexcone.

We get a new space of primaries called the transmission primaries, which were recommended by the National Television System Committee (NTSC) in 1953 as the basis for generating color television broadcast signals in the United States. The value Y is called the luminance and measures brightness. It is the only signal received by a black and white TV. This is a good basis with respect to properties of RGB phosphors and the “standard” observer. The triangular region in the chromaticity diagram shown in Figure 8.4 is the possible gamut of the 1953 NTSC recommended RGB monitor, although actual monitors have a smaller triangle.

Although the RGB model is very simple mathematically, getting a desired color by varying the R, G, B guns of a monitor is not so simple. Artists especially would find the RGB model very unintuitive. For that reason other models were introduced.

The HSV (Hue-Saturation-Value) “Hexcone” Model. We get this model by looking down at the color cube along its main diagonal (see Figure 8.6) and re-coordinatizing (see Figure 8.7). A color is now specified by three numbers h (hue), s (saturation), and v (value). The hue corresponds to an angle from 0 to 360 degrees, where, for example, red is at 0 degrees and green at 120 degrees. The saturation s, s e [0,1], measures the departure of a hue from white or gray. The value v, v e [0,1], measures the departure of a hue from black, the color of zero energy. See Figure 8.8.

The hexcone model tries to mimic how artists work. Their way of working with color has been described as follows in [AgoG87]:

“Artists choose a pure hue, or pigment, and lighten it to a tint of that hue by adding white or darken it to a shade of that hue by adding black, or in general obtain a tone of that hue by adding a mixture of white and black, that is, gray.”

The HSL (Hue-Saturation-Brightness) Triangle Model. See Figure 8.9. The reason for not using the letter “B” is so as not to cause confusion with “blue.” The hue is again specified as an angle between 0 and 360 degrees about the vertical axis and the saturation and brightness are values between 0 and 1.

The HSL model is good for color gradations found in nature.

The single hexcone HSV color model.

Figure 8.7. The single hexcone HSV color model.

The HSV triangle.

Figure 8.8. The HSV triangle.

The double hexcone HSL color model.

Figure 8.9. The double hexcone HSL color model.

Transforming Between Color Models

Finally, one needs transformations to convert between the various color models. Algorithms 8.6.1 and 8.6.2 describe the conversions between RGB and HSV. Algorithms 8.6.3 and 8.6.4 convert between RGB and HSL. Algorithm 8.6.4, which converts HSL to RGB, is the one described in [Fish90a]. It basically converts HSL to HSV and then uses the steps in the HSV to RGB conversion algorithm. An undefined hue in these algorithms means that the color is achromatic and corresponds to a shade of gray that lies along the central axis of the models. [Roge98] also describes a number of other conversion algorithms such as between RGB and CIE.

Converting RBG to HSV.

Algorithm 8.6.1. Converting RBG to HSV.

Converting HSV to RGB.

Algorithm 8.6.2. Converting HSV to RGB.

 Converting RBG to HSL.

Algorithm 8.6.3. Converting RBG to HSL.

Converting HSL to RGB.

Algorithm 8.6.4. Converting HSL to RGB.

Next post:

Previous post: