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 \times 256\times 256=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.

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

 

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.