Colour Spaces

Colour plays a vital part in computer graphics and realistic scenes cannot be generated without a suitable range of colours available. But there are many competing ways to specify colour, each method has its good and bad points.

Tristimulus theory of colour perception

Visible light, ultraviolet light, x-rays, TV and radio waves,  etc are all forms of electromagnetic energy which travels in waves.  The wavelength of these waves is measured in a tiny unit called the Angstrom,  equal to 1 ten billionth of a meter.  Another unit sometimes used to measure wavelength of light waves is  nanometers (nm) which are equal to 1 billionth of a meter.

There is a narrow range of  this electromagnetic energy  from the sun and other light sources which creates energy of wavelengths visible to humans. Each of these wavelengths,  from approximately 4000 Angstroms  to 7000 Angstroms, is associated with a particular color response. For example, the wavelengths near 4000 Angstroms (400 nm)  are violet in color while those near 7000 (700 nm) are red.

The colours we see 'see' at certain wavelengths do not exist in reality, they are created by our brain. Issac Newton said

Issac Newton, Optics, 1730

... the Rays to speak properly are not coloured. In them there is nothing else than a certain Power and Disposition to stir up a Sensation of this or that Colour.

It was discovered long ago by artists, that (almost) any colour can be described interms of a combination of 3 primary colours. This resuts from the way we detect light. The Human retina has cells called "cones" which detect either red, green or blue wavelengths of light.

The RGB Model

This model is the traditional form of colour specification in computer graphics. Colours are defined as a triple of values, each value representing the intensity of the red, green or blue component of the colour. In this system;

Visualize an RGB cube with this application.

The number of discreet colours that can be generated by this system is determined by the number of bits assigned to represent each colour. In a 24-bit system (photorealistic) there are 8 bits for each colour component, giving 256\times256\times256=16 \textrm{million} different colours. This system was first developed as a consequence of the way the human eye works. The eye contains receptors for red, green and blue light respectively, the brain combines these three 'readings' to give the perception of one colour. This however is a simplified view of how the eye actually works. This model also corresponds closely with the way most graphic displays work. Each pixel on a monitor has a red, green and blue component. The colour of a pixel can be controlled by varying the relative brightness of each component.

The 3 components of the RGB system describe a region in colour space called the RGB Cube. Each of the three primary colors form mutually perpendicular axes.

However the system is not perfect.

 

The CYMK (Cyan, Yellow, Magenta, Black) Model

This model is the complement of the RGB model and is used primarily in printing processes. White paper is considered to reflect maximal amounts of Red, Green and Blue, different colours can then be produced by restricting the how much of each primary is reflected. Magenta, for instance reflects Red and Blue and absorbs Green, Cyan reflects Blue and Green and absorbs Red, Yellow absorbs Blue and reflects Red and Green. By adding Yellow, the amount of Blue is reduced and Red and Green are (theoretically) unaffected. When Cyan and Magenta are mixed only Blue is reflected. When all three are mixed, no colour is reflected so black is produced. This is known as a subtractive colour system, each primary removes some component from the reflected white background. However, in practice, the inks used are not perfect, and the black which results is usually a dirty grey, so most processes use black ink in addition to the three primaries.

 

Additive v's Subtractive colours systems

 

The HSV (Hue, Saturation and Value) model.

This model was proposed to facilitate a more intuitive interface for colour selection and control. This has been described as a perceptual model, as colours are specified in a way more like the way we think about colours.

Again a triplet of values is used.

  1. Hue (0 to 360) is the quality by which we distinguish one colour family from another, as red from yellow or green from blue. This value represents an angle about the vertical axis.
  2. Saturation (Chroma) (0 to 1) The difference between strong colour and a weak one. A 'washed out' colour has low saturation. Represented by the distance (radius) from the vertical axis.
  3. Value (0 to 1) The difference between a light colour and a dark one (by adding black to a colour, you reduce its value). Represents as a distance along the vertical axis.

     

The HSV system is usually shown as a hexagonal cone (hexcone).

Help visualize an HSV Cone with this application.

HSV values can easily be converted into RGB values for display. The two systems describe the same set of colours. One problem with this system is that it implies that all maximum intensity colours have the same brightness (value), however looking at blue and yellow show this is obviously not the case in reality. Also this system is perceptually non-linear (similar to RGB), and does not represent all perceivable colours.

 

HLS Model

Similar to the HSV model except the value axis has been replaced with a lightness axis which has been stretched to form a double Hexcone.

Help visualize an HLS HexCone with this application.

Now white and black have the same geometric status. However the saturated hues now occur at L=0.5 which can be a problem for intuitive colour selection.

 

CIE XYZ space

The CIE (Commission Internationale de l'Eclairage) conducted experiments in the 1930's to determine how primary components should be added in order to reproduce colours. The experiments revealed that to produce some colours, it was necessary to subtract a component of light. This is because when two primaries are added the saturation decreases. It was impossible to produce a maximally saturated colour by mixing two others. To create such colours a negative component is required. To avoid the problem of having negative components, the CIE devised three supersaturated (non-realizable) colours X, Y, Z, which, when additively mixed (i.e. without negative co-efficients) can produce all perceivable colours. These primaries are devised from the colour sensitivity distribution of the human eye, this allows the system to represent all human perceivable colours. In this system the $Y$ colour the intensity or luminosity of the light. Applying some affine transformations and choosing an appropriate viewpoint, the CIE colour space can be viewed in 2 dimensions (figure below).

The CIE Chromacity Diagram

This colour model is difficult to use, as X,Y and Z do not correspond to real colours. Also, some CIE colours cannot be displayed on a traditional monitor as these work by adding red, green and blue light. It was not designed as colour selection tool, but as an international standard for accurate colour description, instruments are available which can measure the X,Y & Z components from any give colour sample.

Lab

A somewhat simplified and perceptually linear version of CIEXYZ used today is CIELab.

L= luminosity

a = position on Red-Green opponent channel ( -ive= red, +ive=green)

b = position on Yellow-Blue opponent channel ( -ive= yellow, +ive=blue)

The applets here allow you to play with different colour spaces.

Colour Gamuts

The CIE diagram is useful for specifying colour gamuts, the range of colours which can be produced by a device. As mentioned before, a typical computer monitor can only produce colours which are additive combinations of the RGB primaries, this limits its output to a subset of perceivable colours. The vertices of the monitor gamut represent the primaries used in the phosphor/LCD technology. Any colour falling outside this triangle cannot be produced by a CRT/LCD monitor.

The colour gamut of a printer is also shown, this gamut is not a simple triangle because of the mechanisim in which the inks are placed on the paper. Note that a printer cannot reproduce all the colours of a monitor and there are some printer colours which cannot be shown on a monitor.