Color models

    There are several color atlases for assignment of colors. The best known is the Munsell atlas, containing colors sorted according color shades, clearness and brightness. In the decomposition of a color into components (e.g. using a prism) we can recognize clear colors from blue through to red.

We know 6 basic areas of color:

  1. magneta - M
  2. blue - B
  3. cyan - C
  4. green - G
  5. yellow - Y
  6. red - R

    Using these primary colors, we can create the majority of other colors. If we use three primary colors: red, green and blue, then we speak about additive RGB model. If we use cyan, magenta, and yellow, we speak about subtractive CMY model.

RGB model

     The basics of the RGB model is the additive composition of red, green and blue colors. This model is used for color monitors. Other colors are expressed by additive superposition of these primary colors using weighted addition of individual components. The higher the value of these primary colors the brighter the resulting color. The RGB model can be represented by a unit cube located in the origin of the coordinate system. Individual axes of the coordinate system represent amplitudes of relevant color components present in the given resulting color. The origin of the coordinate system represents black color, and the corner (1, 1, 1) represents white color. In practice, the unit cube is split into smaller parts, most often into 256 parts (8 bits), so the intensity of every point of an image point can be described by 24 bits (true color).

$$$APPLET

Applet RGB and CMY Geometric representation

$$$APPLET

Applet Shows sequence color change for one surface of cube.

CMY model

    The primary colors here are: cyan(C), magenta(M) and yellow(Y). This model is based on a painter's blending of color. Through adding values of individual color elements we obtain a darker hue of color, the so-called subtractive blending of colors. Similarly as in the case of the RGB model, also the CMY model can be described using a unit cube located in the coordinate system with the origin (0, 0, 0), representing white; and the point (1, 1, 1) representing black.

    Subtractive blending is suitable for printing purposes, in particular for ink printers where is applied the CMYK model, also with a supplement of black. This is because in printing the colors are not in fact blended, but coated consecutively. However, such a process is not suitably precise and in the course of printing black we instead obtain a dark brown. Therefore, there is some extra black color added here, or it is in a separate toner, and specially printed.

    The conversion from RGB into CMY is as follows:

  [ c ]   [ 1 ] - [ r ]
  [ m ] = [ 1 ] - [ g ].
  [ y ]   [ 1 ] - [ b ]

HSV and HLS models

    These models are most suitable for intuitive perception of colors. The main parameters are: hue of color, saturation of color, brightness value or V-value. Hue represents the prevailing spectral color, saturation represents admixture of other, and brightness corresponds to the amount of white, color-free light. For area projection we use regular hexagonal pyramid with the top in the origin of the coordinate system. In the other corners are located the primary colors: Red, Green, Blue, Cyan, Magenta and Yellow.

$$$APPLET

Applet HSV model

     A shortcoming of this model is its triangle shape with the result that a point with constant brightness v  in the case of changing h is moving on this triangle (in fact the horizontal section of this triangle with the constant value of brightness v).This is removed by the HLS model where the "hexagonal is replaced by a circle". Today, these types of color models are not often used. 


XYZ model

    The primary colors are X, Y, Z.

Conversion from RBG to XYZ and back

    X = 2,7689R + 1,7518G + 1,1302B

    Y = 1,0000R + 4,5907G + 0,0601B

    Z = 0,0000R + 0,0565G + 5,5943B

If we want to normalize colors (to meet: x+y+z=1), we use the following method:
              X                        Y                         Z
    x = ----------        x = ----------         x = ----------
          X+Y+Z                X+Y+Z               X+Y+Z

    CIE diagram (CIE is an abbreviation of international commission for lighting) – A curve representing clear white. White color is obtained through the superposition of all other colors in the center.

$$$APPLET

Applet CIE diagram

    Color ranges are represented by abscissas, while all points of an abscissa are obtained through the additive superposition of such colors (it is a color transit from A color to B color). Similarly, in the case of a CDE triangle, where internal points of this triangle are obtained via combinations of the corner primary color C, D, E. When looking at a CIE diagram, it can be seen that we cannot construct a triangle covering it wholly. From this is implied that it is not possible to find the same 3 primary colors which could determine all colors.

YUV model

    This model is used in transmitting TV signal with PAL standard. Similarly as in the case of US standard YIQ for transmitting TV signals with NTSC and YcbCr, the component of brightness is separated from color component. This separation allows using the brightness signal also for black and white TV sets. The rest two signals comprise information on color components of image. In the case YUV, Y is brightness of the given color and U a V are values of amplitudes of color component.

Conversion of RGB to YUV

YUV can be obtained from RGB in this way:

   [ Y ] = [  0.299  0.587  0.114 ] [ R ]
   [ U ] = [ -0.141 -0.289  0.437 ] [ G ]
   [ V ] = [  0.615 -0.515 -0.100 ] [ B ]

YCbCr model

This color model is defined in accordance with CCIR 601 (256 levels).

Conversion YCbCr

Y, Cb, Cr are converted from RGB in accordance with the determination CCIR Recommendation 601, but are normalized so as to get 256 values of 8-bit binary coding
More precisely as follows :

   Y  = 256 * E'Y
  Cb  = 256 * [ E'Cb ] + 128
  Cr  = 256 * [ E'Cr ] + 128

where E'Y, E'Cb and E'Cb are defined as in CCIR 601. The value E'Y is from the range from 0 to 1.0 and the values E'Cb and E'Cb from the interval –0.5 to +0.5.

Conversion of RGB to YCbCr

YcbCr (256 values) can be directly changed from 8-bit RGB in the following way:

    Y   =     0.299  R + 0.587  G + 0.114  B
    Cb  =   - 0.1687 R - 0.3313 G + 0.5    B + 128
    Cr  =     0.5    R - 0.4187 G - 0.0813 B + 128

Conversion of YCbCr to RGB

RGB can be obtained from YcbCr (256 values) in the following way:

    R = Y                    + 1.402   (Cr-128)
    G = Y - 0.34414 (Cb-128) - 0.71414 (Cr-128)
    B = Y + 1.772   (Cb-128)