# Demystifying Colour (ix) : CIE chromaticity diagram

Colour can be divided up into luminosity and chromaticity. The CIE XYZ colour space was designed such that Y is a measure of the luminance of a colour. Consider a 3D plane is described by `X=Y=Z=1`, as shown in Figure 1. A colour point `A=(Xa,Ya,Za)` is then found by intersecting the line SA (S=starting point, `X=Y=Z=0`) with the plane formed within the CIE XYZ colour volume. As it is difficult to perceive 3D spaces, most chromaticity diagrams discard luminance and show the maximum extent of the chromaticity of a particular 2D colour space. This is achieved by dropping the Z component, and projecting back onto the `XY` plane.

This diagram shows all the hues perceivable by the standard observer for various (x, y) pairs, and indicates the spectral wavelengths of the dominant single frequency colours. When `Y` is plotted against `X` for spectrum colours, it forms a horseshoe, or shark-fin, shaped diagram commonly referred to as the CIE chromaticity diagram where any (x,y) point defines the hue and saturation of a particular colour.

The `xy` values along the curved boundary of the horseshoe correspond to the “spectrally pure”, fully saturated colours with wavelengths ranging from 360nm (purple) to 780nm (red). The area within this region contains all the colours that can be generated with respect to the primary colours on the boundary. The closer a colour is to the boundary, the more saturated it is, with saturation reducing towards the “neutral point” in the centre of the diagram. The two extremes, violet (360nm) and red (780nm) are connected with an imaginary line. This represents the purple hues (combinations of red and blue) that do not correspond to primary colours. The “neutral point” at the centre of the horseshoe (x=y=0.33) has zero saturation, and is typically marked as `D65`, and corresponds to a colour temperature of 6500K.

# Demystifying Colour (viii) : CIE colour model

The Commission Internationale de l’Eclairage (French for International Commission on Illumination) , or CIE is an organization formed in 1913 to create international standards related to light and colour. In 1931, CIE introduced CIE1931, or CIEXYZ, a colorimetric colour space created in order to map out all the colours that can be perceived by the human eye. CIEXYZ was based on statistics derived from extensive measurements of human visual perception under controlled conditions.

In the 1920s, colour matching experiments were performed independently by physicists W. David Wright and John Guild, both in England [2]. The experiments were carried out with 7 (Guild) and 10 (Wright) people. Each experiment involved a subject looking through a hole which allowed for a 2° field of view. On one side was a reference colour projected by a light source, while on the other were three adjustable light sources (the primaries were set to R=700.0nm, G=546.1nm, and B=435.8nm.). The observer would then adjust the values of three primary lights until they can produce a colour indistinguishable from a reference light. This was repeated for every visible wavelength. The result of the colour-matching experiments was a table of RGB triplets for each wavelength. These experiments were not about describing colours with qualities like hue and saturation, but rather just attempt to explain how combinations of light appear to be the same colour to most people.

In 1931 CIE amalgamated Wright and Guild’s data and proposed two sets of of colour matching functions: CIE RGB and CIE XYZ. Based on the responses in the experiments, values were plotted to reflect how the average human eye senses the colours in the spectrum, producing three different curves of intensity for each light source to mix all colours of the colour spectrum (Figure 2), i.e. Some of the values for red were negative, and the CIE decided it would be more convenient to work in a colour space where the coefficients were always positive – the XYZ colour matching functions (Figure 3). The new matching functions had certain characteristics: (i) the new functions must always be greater than or equal to zero; (ii) the y function would describe only the luminosity, and (iii) the white-point is where x=y=z=1/3. This produced the CIE XYZ colour space, also known as CIE 1931.

The CIE XYZ colour space defines a quantitative link between distributions of wavelengths in the electromagnetic visible spectrum, and physiologically perceived colours in human colour vision. The space is based on three fictional primary colours, X, Y, and Z, where the Y component corresponds to the luminance (as a measure of perceived brightness) of a colour. All the visible colours reside inside an open cone-shaped region, as shown in Figure 4. CIE XYZ is then a mathematical generalization of the colour portion of the HVS, which allows us to define colours.

The luminance in XYZ space increases along the Y axis, starting at 0, the black point (X=Y=Z=0). The colour hue is independent of the luminance, and hence independent of Y. CIE also defines a means of describing hues and saturation, by defining three normalized coordinates: `x`, `y`, and `z` (where `x+y+z=1`).

```x = X / (X+Y+Z)
y = Y / (X+Y+Z)
z = Z / (X+Y+Z)
z = 1 - x - y```

The `x` and `y` components can then be taken as the chromaticity coordinates, determining colours for a certain luminance. This system is called CIE xyY, because a colour value is defined by the chromaticity coordinates `x` and `y` in addition to the luminance coordinate `Y`. More on this in the next post on chromaticity diagrams.

The RGB colour space is related to XYZ space by a linear coordinate transformation. The RGB colour space is embedded in the XYZ space as a distorted cube (see Figure 5). RGB can be mapped onto XYZ using the following set of equations:

```X = 0.41847R - 0.09169G - 0.0009209B
Y = -0.15866R + 0.25243G - 0.0025498B (luminance)
Z = -0.082835R + 0.015708G + 0.17860B```

CIEXYZ is non-uniform with respect to human visual perception, i.e. a particular fixed distance in XYZ is not perceived as a uniform colour change throughout the entire colour space. CIE XYZ is often used as an intermediary space in determining a perceptually uniform space such as CIE Lab (or Lab), or CIE LUV (or Luv).

• CIE 1976 CIEL*u*v*, or CIELuv, is an easy to calculate transformation of CIE XYZ which is more perceptually uniform. Luv was created to correct the CIEXYZ distortion by distributing colours approximately proportional to their perceived colour difference.
• CIE 1976 CIEL*a*b*, or CIELab, is a perceptually uniform colour differences and L* lightness parameter has a better correlation to perceived brightness. Lab remaps the visible colours so that they extend equally on two axes. The two colour components a* and b* specify the colour hue and saturation along the green-red and blue-yellow axes respectively.

In 1964 another set of experiments were done allowing for a 10° field of view, and are known as the CIE 1964 supplementary standard colorimetric observer. CIE XYZ is still the most commonly used reference colour space, although it is slowly being pushed to the wayside by CIE1976. There is a lot of information on CIE XYZ and its derivative spaces. The reader interested in how CIE1931 came about in referred to [1,4]. CIELab is the most commonly used CIE colour space for imaging, and the printing industry.

1. Fairman, H.S., Brill, M.H., Hemmendinger, H., “How the CIE 1931 color-matching functions were derived from Wright-Guild data”, Color Research and Application, 22(1), pp.11-23, 259 (1997)
2. Service, P., The Wright – Guild Experiments and the Development of the CIE 1931 RGB and XYZ Color Spaces (2016)
3. Abraham, C., A Beginners Guide to (CIE) Colorimetry
4. Zhu, Y., “How the CIE 1931 RGB Color Matching Functions Were Developed from the Initial Color Matching Experiments”.
5. Sharma, G. (ed.), Digital Color Imaging Handbook, CRC Press (2003)

# Demystifying Colour (v) : colour gamuts

Terms used to describe colours are often confusing. If a colour space is a subset of a colour model, then what is a colour gamut? Is it the same as a colour space? How does it differ from a colour profile? In reality there is often very little difference between the terms. For example, depending on where you read it sRGB can be used to describe a colour space, a colour gamut, or a colour profile. Confused? Probably.

#### Colour gamuts

A gamut is a range or spectrum of some entity, for example “the complete gamut of human emotions“. A colour gamut describes a subset of colours within the entire spectrum of colours that are identifiable by the human eye, i.e. the visible colour spectrum. More specifically a gamut is the range of colours a colour space can represent.

While the range of colour imaging devices is very broad, e.g. digital cameras, scanners, monitors, printers, the range of colours they produce can vary considerably. Colour gamuts are designed to reconcile colours that can be used in common between devices. The term colour gamut is usually used in association with electronic devices, i.e. the devices range of reproducible colours, or the range of different colours that can be interpreted by a colour model. A colour gamut can therefore be used to express the difference between various colour spaces, and to illustrate the extent of coverage of a colour space.

The colour gamut of a device is sometimes visualized as a volume of colours, typically in CIELab or CIELuv colour spaces, or as a project in the CIEXYZ colour space producing a 2D xy chromaticity diagram (CD). particularly the luminance of the primary colours. Typically a colour space specifies three (x,y) coordinates to define the three primary colours it uses. The triangle formed by the three coordinates encloses the gamut of colours that the device can reproduce. The table below shows the RGB coordinates for various colour spaces in the CIE chromaticity diagram, shown on the 2D diagram in Figure 1.

Note that colour gamuts are 3D which is more informative than the 2D CD – it captures the nuances of the colour space, particularly the luminance of the primary colours. However the problem with 3D is that it is not easy to plot, and hence the reason a 2D representation is often used (the missing dimension is brightness).

Two of the most common gamuts in the visual industry are sRGB, and Adobe RGB (which are also colour spaces). Each of these gamuts references a different range of colours, suited to particular applications and devices. sRGB is perhaps the most common gamut used in modern electronic devices. It is gamut that covers a good range of colours for average viewing needs, so much so that it is the default standard for the web, and most images taken using digital cameras. The largest RGB working space, ProPhoto is an RGB color space developed by Kodak, and encompasses 90% of the possible colours in the CIE XYZ chromaticity diagram.

Gamut mapping is the conversion of one devices colour space to another. For example the case where an image stored as sRGB is to be reproduced on a print medium with a CMYK colour space. The objective of a gamut mapping algorithm is to translate colours in the input space to achievable colours in the output space. The gamut of an output device depends on its technology. For example, colour monitors are not always capable of displaying all colours associated with sRGB.

#### Colour profiles

On many systems the colour gamut is described as a colour profile, and more specifically is associated with an ICC Color Profile, which is a standardized system put in place by the international colour consortium. Such profiles help convert the colours in the designated colour space associated with an image to the device. For example the standard profile on Apple laptops is “Color LCD”.Some of the most common RGB ICC profiles are sRGB (sRGB IEC61966-2.1).