Colour Theory Lecture Notes

Every day terms

Colour is a topic that begs for a whole course, however, in this course we present the basics of colour that are necessary for a understanding of computer graphics

Three terms have often been used to describe colour.

  1. HUE

  2. This describes the colour. Terms such as red, green, and purple are used.
  3. SATURATION

  4. The amount of colour that is present. This is used to differentiate between pink and red. We say that red is more saturated than pink. Think of this as the difference between a colour an a grey colour of the same lightness
  5. LIGHTNESS

  6. This is the measure of the intensity of a colour independent of its HUE and SATURATION. A good way of thinking of this is that LIGHTNESS corresponds to the gray shade that represents the colour in a BW photograph.
These are subjective terms but are commonly used in many different situations.

Eye functions

We know that our eye has two kinds of photo-receptors. These are rods and cones.

Tristimulus theory

Based on the above observations one would wish to approximate the monochromatic colours by a combination of three colours. A number of experiments were conducted in which subjects were asked to generate a monochromatic colour by adding different amounts of red, green, and blue monochromatic colours. The results of these experiments are interesting.

The experiment consisted of a two display booth. In the one booth a monochromatic colour was projected onto the screen. In the other there was a tri-colour projector that the subject could control. The intensity of each of the three colours was controled individually. The subject then had to match the colour that was presented on the monochromatic screen by adding different amounts of red, green, and blue colours. The initial results showed that for the most part this could be done. In the following figure we see the amounts of red, green, and blue colours that are necessary to match different monochromatic colours.

Notice that there is an anomality in the diagram. I have highlighted a region, this indicates a set of monochromatic colours that could not be matched by simply adding different amounts of red, green, and blue. The researchers found, however, that the colour could be matched if some red light was added to the sample. This is represented in the figure by a negative lobe on the red curve. Even though these experiments showed the feasibility of the tri-stimulus theory, it did produce three colours that had possitive matching curves. This was solved by the introduction of three colours X,Y, and Z by the C.I.E in 1931. The matching curves for these colours are presented in the following figure.

Note that these curves are not the spectral distribution of the X,Y,and Z colours, rather they are the amounts of X,Y, and Z colours that are needed to match a particular monochromatic colour.

Full spectrum Light

In general these experiments with monochromatic light are useful for understanding how our eyes work. However, in the natural world the light that reaches our eyes is full spectrum light. That is, a colour is made up of multiple wave lengths. For example a red apple might have the following colour distribution.

Our task now is to determine how these colours can be represented using the tristimulus theory. Well, it turns out that given a particular colour spectra we can approximate the perceived colour using the following scheme. Given a spectral distribution P() we determine three coefficients X,Y,Z as follows Where x(), y(), z() are the matching curves presented above. And k is a constant that depends on the display device. For monitors this is 680 lumens/watt, for reflecting objects k is chosen so that a bright white has a Y value of 100.

CIE Cromaticity diagram.

Consider a colour C represented in the following manner.
C=XX + YY +ZZ
We can define new terms Notice that x+y+z = 1. Because of this we can represent the colours using two of the three coefficients. If x and y are given then we can always recover z = 1-x-y. The visible colours can then be plotted on the xy plane. The outline of this plot is presented here. This plot is known as the CI chromaticity diagram. The wavelengths and positions of the main colours are outlined.

A colour version of this can be seen in the course textbook on plate II.1 The monochromatic lights appear on the curved boundary of the diagram.

 This diagram is used in various ways. Given two colours A, and B their CIE chromaticity coefficients can be found and the positions of the colours plotted on the chromaticity diagram. Once this is done we can deduce what colours can be achieved by combining the two colours. The colours that can be achieved by combinations of A and B are precisely the colours that lie on the line that lies between A and B on the chromaticity diagram.

 If we are given three different colours then we can determine the colours that can be generated with these primaries by plotting their positions on the chromaticity diagram. The colours that can be generated by combinations of these three colours lie within the triangle that is generated by the positions of the three colours.
 
 

Gamut

Given a display such as a cathode ray tube we can plot the chromaticity values of the three phosphors used and thus identify the achievable colours of the monitor. This set of colours is called the device gamut.

Each device has its own gamut. The differences between these gamuts are important if accurate colour reproduction is desired. There may well be colours that are achievable on one device but not on the other. In such situations the designer or programmer must ensure that colours are chosen that can be reproduced on all the relevant devices. There is a good example of this problem presented in plate II.2 in the book.

Just noticeable differences

If we were to choose two colours in the CIE chromaticity diagram and measure their difference numericaly we might get some value deltaV. It is possible to find other colours that are a similar distance apart but perceptualy are not the same distance from each other. This problem is caused by our non-linear perception of colour. In certain situations the accurate reproduction of colours and of the distance between colours is important. In these situations CIE LUV space is useful. A non linear device dependent transformation is used to produce a colour space in which the distances between colours roughly correspond to the perceptual distances experienced by a wide set of observers. For more details on this space and the transformation from the CIE space to the CIE LUV space please see section 13.2 in the book.

Colour spaces for Computer Graphics

The theory that we have discussed thus far has concentrated on the human visual system. We now turn our attention to the issue of representing and manipulating colour on computer graphics systems. There are a wide variety of colour spaces that have been developed for computer graphics. In these notes I overview three of these RGB, CMY, and HSV.

RGB

Colour Cathode Ray tubes generate colours by stimulating three different phosphors on the screen. The resulting intensity of each colour can thus be independently controlled. The RGB colour space is designed to enumerate the colours that can be generated on a colour Cathode ray tube. The following diagram illustrates the RGB colour space.

In the diagram the values of R,G, and B range between 0 and 1. In practice the values are integers that correspond to discrete values. Most CRTs that are being used have 256 intensity levels for each gun.
This colour space describes an additive colour space, that is, the colours are obtained by adding different amounts of the primary colours. This model works well for CRTs.

CMY

If we consider the manner in which colours are reproduced on paper we must use a different model. If a white piece of paper is viewed under white light then we are seeing all wavelengths of the light reflected. However if we now colour the paper with red ink we observe only the red portion of the light spectrum. This is because the red ink absorbs all but the red portion of the light. If we now add green ink to the paper we have the red ink absorbing all but the red portion of the light and the green ink absorbing all but the green portion of the light. Clearly the use of the additive colour model does not work here. What we must use then is the subtractive model. If we consider red,green, and blue to be the primary colours then we must use a set of dyes that absorb only one of the primaries. These dyes are precisely Cyan (absorbs red), Magenta (absorbs green), and Yellow (absorbs blue). We can now obtain any of the original primary colours by the combination of the subtractive primaries. For example red is obtained by
Magenta(absorbs green) + Yellow(absorbs blue).
Given a colour definition in RGB (r,g,b) the transformation to CMY space is straight forward.
        c = 1 - r
        m = 1 - g
        y = 1 - b
In theory this subtractive colour space is sufficient for the representation of the same set of colours as the RGB space. However, in practice it is impossible to generate pure pigments. This means that achieving black (cmy = 1 1 1) is difficult. Because of this a black dye is also used in printing. This is known as the CMYK colour space. The transformation from CMY to CMYK is also straight forward.
First we account for the amount of black present in the colour
k = min(c,m,y)
Then we subtract this from each of the colours.
c = c - k
m = m - k
y = y - k
Both of these colour spaces are useful representing the colours that can be generated on a particular device. But how would you

HSV

The lack of intuitive feel of either of the above colour spaces led to the development of a number of more intuitive colour spaces. I will outline one of these here, namely the HSV space. If one is to look at the RBG cube such that the line of sight is parallel to the main line that goes from Black (0,0,0) to white (1,1,1), then one sees a hexagon as follows:

We can think of the colours on the perimeter of this hexagon as being fully saturated. We can also represent the hue by an angle of rotation starting with red = 0. So if we represent the colours in this manner we have a two-dimensional representation for colours where we represent the hue by the rotation and the saturation as the distance from the center of the hexagon.
The claim is that this saturation value is also intuitive since white is at the centre, thus colours with less saturation will be closer to the centre. The third parameter of this colour space can be seen if we flatten the cube so that the three faces of the cube that make up this hexagon now lie in a shared plane. This is the main idea behind the HSV space. Now that the colours on the surface of half of the cube have been represented we must represent in a consistent manner the remaining colours. The following figure shows how this is achieved in the HSV space. The black colour has been pulled down and the resulting colour space is an inverted hexagonal based cone. Black is at the apex of the cone, the gray colours are along the main axis of the cone.

The book contains procedures for converting from RGB to HSV and from HSV to RGB.
This representation more closely resembles our intuitive notion of colour. The textbook contains code for making the transformation from RGB to HSV and vice-versa. There are other colour spaces but these are mostly variations on the device dependent colour spaces, or on the LUV space, or on the intuitive spaces.