0% found this document useful (0 votes)
34 views18 pages

Technical Note Colour 2024

The document discusses the CIE chromaticity diagram, which is essential in color theory and is used to evaluate the performance of lighting and color reproduction tools in relation to human vision. It covers topics such as the photopic luminosity function, color matching experiments by Wright and Guild, and the CIE XYZ color space. The document aims to provide a practical understanding of color reproduction through the visible spectrum using the CIE chromaticity diagram.

Uploaded by

applemi7825ec
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
34 views18 pages

Technical Note Colour 2024

The document discusses the CIE chromaticity diagram, which is essential in color theory and is used to evaluate the performance of lighting and color reproduction tools in relation to human vision. It covers topics such as the photopic luminosity function, color matching experiments by Wright and Guild, and the CIE XYZ color space. The document aims to provide a practical understanding of color reproduction through the visible spectrum using the CIE chromaticity diagram.

Uploaded by

applemi7825ec
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 18

TECHNICAL NOTE

Human vision and the CIE chromaticity diagram


The CIE chromaticity diagram is instrumental in colour theory. It is widely used to
describe the performances of lightings or colour cameras, and more generally any
tool aimed at faithfully reproducing colours as perceived by human vision. In this
document, we show a practical use of this diagram through colour reproduction of
the visible spectrum.

Document issued by idonus sàrl


Last update: March 2024
www.idonus.com
The CIE chromaticity diagram is instrumental in colour theory. It is widely used to describe
the performances of lightings or colour cameras, and more generally any tool aimed at
faithfully reproducing colours as perceived by human vision. In this document, we show a
practical use of this diagram through colour reproduction of the visible spectrum.

Contents
1. Colour .......................................................................................................................................................................... 2
2. The photopic luminosity function ............................................................................................................................... 2
3. Wright and Guild's colour matching experiments ....................................................................................................... 4
4. CIE XYZ colour space .................................................................................................................................................... 6
5. CIE colour matching functions ..................................................................................................................................... 7
6. sRGB colour space and Planckian locus ....................................................................................................................... 8
7. Rendering of the colour spectrum in the sRGB colour space .................................................................................... 10
8. Summary ................................................................................................................................................................... 12

1. Colour
The word "colour" is associated with the human perception of the visible light spectrum which covers the range of
electromagnetic wavelengths from around 380 nm to about 740 nm. Admittedly, this is a somewhat rather abrupt approach
to the notion of colours. Instead, we can tackle the subject starting from an experience that everyone is familiar with: Colour
is most intuitively associated with the additive combination of the primary colours red, green and blue (RGB model). More
technically, in terms that should sound for those familiar with image editing softwares, colour can be described in terms of
hue, saturation, and lightness (HSL), which is an alternative representation of the RGB model. The hue value is associated
with the dominant wavelength of a colour (e.g., red, orange, yellow, green, cyan, blue, indigo, violet for spectral colours) or
with the complementary wavelength for non-spectral colours (purple colours obtained by the combination of red and blue
primaries). Saturation provides the degree of purity of a colour, i.e. whether it appears pale or deeply saturated. Finally,
lightness quantifies the intensity of a colour in terms of darkness/lightness.

All these notions may seem rather abstract without illustrations. Fortunately, they are admirably brought together in the CIE
chromaticity diagram which we will discuss in this document. Before getting into the heart of the topic, we shall first briefly
introduce the photopic luminosity function (section 2) – the fundamental function of photometry science – because it is
needed for the construction of the CIE chromaticity diagram.

For the sake of brevity, several complex technical concepts will be covered only succinctly in this document.

2. The photopic luminosity function


The photopic luminosity function, V(λ), quantifies the diurnal vision of the average human eye. It was adopted in 1924 by the
International Commission on Illumination (CIE, French acronym for Commission Internationale de l'Eclairage) as the standard
to define the typical spectral response of the human eye to various wavelengths of light under well-lit conditions. This
function is empirical since it is based on a physiological assessment. Nevertheless, it is central in photometry as it establishes
the conversion from radiometric to photometric quantities. For instance, V(λ) is used to convert radiant flux e (measured in
watts, W) into luminous flux v (measured in lumens, lm). v is calculated using the following equation:
𝜆=740 𝑛𝑚
𝜕Φ𝑒
Φ𝑣 = 𝐾𝑐𝑑 ∫ 𝑉(𝜆)𝑑𝜆 = 𝐾𝑐𝑑 ∫ Φ𝑒,𝜆 𝑉(𝜆)𝑑𝜆
𝜕𝜆
𝜆 𝜆=380 𝑛𝑚

In this equation, e, is the spectral flux, or radiant flux per unit wavelength. The constant K cd is defined in the SI standard
(International System of Units) as follows: The luminous efficacy of monochromatic radiation of frequency 540 × 1012 Hz, Kcd,
is 683 lm/W. This frequency corresponds to the wavelength 555.17 nm (peak of sensitivity of the eye in day vision), as

2/18 CHROMATICITY DIAGRAM www.idonus.com


creative engineering and manufacturing

0.8

0.6
V (λ)

0.4

0.2

0
380 420 460 500 540 580 620 660 700 740 780
Wavelength, λ (nm)
Figure 1: The 2° standard observer spectral luminous efficiency function for photopic vision, CIE 1924 V(λ) function.

λ (nm) V(λ) λ (nm) V(λ) λ (nm) V(λ) λ (nm) V(λ)


380 0.00003900 480 0.13902000 580 0.87000000 680 0.01700000
385 0.00006400 485 0.16930000 585 0.81630000 685 0.01192000
390 0.00012000 490 0.20802000 590 0.75700000 690 0.00821000
395 0.00021700 495 0.25860000 595 0.69490000 695 0.00572300
400 0.00039600 500 0.32300000 600 0.63100000 700 0.00410200
405 0.00064000 505 0.40730000 605 0.56680000 705 0.00292900
410 0.00121000 510 0.50300000 610 0.50300000 710 0.00209100
415 0.00218000 515 0.60820000 615 0.44120000 715 0.00148400
420 0.00400000 520 0.71000000 620 0.38100000 720 0.00104700
425 0.00730000 525 0.79320000 625 0.32100000 725 0.00074000
430 0.01160000 530 0.86200000 630 0.26500000 730 0.00052000
435 0.01684000 535 0.91485010 635 0.21700000 735 0.00036110
440 0.02300000 540 0.95400000 640 0.17500000 740 0.00024920
445 0.02980000 545 0.98030000 645 0.13820000 745 0.00017190
450 0.03800000 550 0.99495010 650 0.10700000 750 0.00012000
455 0.04800000 555 1.00000000 655 0.08160000 755 0.00008480
460 0.06000000 560 0.99500000 660 0.06100000 760 0.00006000
465 0.07390000 565 0.97860000 665 0.04458000 765 0.00004240
470 0.09098000 570 0.95200000 670 0.03200000 770 0.00003000
475 0.11260000 575 0.91540000 675 0.02320000 775 0.00002120
480 0.13902000 580 0.87000000 680 0.01700000 780 0.00001499
Table 1: The 2° standard observer spectral luminous efficiency function for photopic vision, CIE 1924 V(λ) function.

calculated from the speed of light in vacuum, c = 299 792 458 m/s. It is noteworthy that the integration is only carried out
over the wavelengths for which V(λ)  0. Since V(λ) is given by a table of empirical values (see Figure 1 and Table 1), it is best
to complete the integration numerically. The typical range for this calculation is 380 nm  λ  740 nm.
This short incursion into photometry highlights the fundamental role played by V(λ). We will not discuss photometry further
as it falls outside the scope of this technical note. The interested readers can find details on this topic in the Technical Guide
"A general guide to high-efficiency LED exposure systems" released by idonus in 2019 (DOI: 10.13140/RG.2.2.29958.32323).
We also temporarily leave the photopic function V(λ), to which we will return in section 5.

CHROMATICITY DIAGRAM 3/18


3. Wright and Guild's colour matching experiments
In the late 1920's, William David Wright (Imperial College, London) and John Guild (National Physical Laboratory, Teddington)
conducted a series of experiments aimed at consolidating the emerging theory of colorimetry. Both lived in the UK, and the
studies they carried out were similar in many aspects, but they completed their work independently from each other. This is
an important point because it was the concordance between their respective findings that motivated the CIE to define a
standardised colour space based on their results.

In short, observers were asked to match monochromatic lights by mixing three primary-colour lights. Using the data collected
from only 17 observers (10 for Wright and 7 for Guild), Wright and Guild could quantitatively measure how the
monochromatic colours of the spectrum can be reproduced when beams of red, green, and blue light are added. The
combination of their data, gathered by Guild in 1931, forms the basis of the CIE colour matching functions that are still in use
in today's colorimetry science. Below, we describe the basic parts of Guild's experimental setup. The main difference from
Wright's experiments lied in the wavelengths chosen for the primaries.

• Monochromator – The source of light (reference white) was a 40-watt automobile headlight lamp, the filament of
which was focused by means of an achromatic lens and a prism on the slit of a constant deviation monochromator.

• Primaries – The 3 primaries were obtained by passing the light from an opal-bulb gas-filled lamp through red, green,
and blue gelatine filters. The wavelength chosen for these primaries were 700 nm (red), 546.1 nm (green), and
435.8 nm (blue). The choice of very specific wavelengths for green and blue lied in the availability of filters specially
designed to isolate these spectral lines prominent in mercury. As for the red stimulus, because the hue was found
to be constant for wavelengths higher than about 670 nm, a convenient procedure was to use a very deep red filter.

• Trichromatic colorimeter – The observer was facing a square field of view divided into two rectangular portions by
a horizontal line. The size of the aperture was such that the square subtended an angle of approximately 2° at the
observer's eye (hence, the name "2-degree standard observer"). The test field contained the monochromatic colour
to be matched. The other, the matching field, contained a blend of the primaries which could be adjusted by means
of three control handles, their amounts being measured on graduations attached to the shutters. If a test colour
couldn't be matched, the observer could instead introduce one of the primaries into the test field (i.e., subtracted).

With this system, any monochromatic colour (Cλ) could be uniquely represented by a colour equation of the form:

𝐶𝜆 = 𝑟𝑅 + 𝑔𝐺 + 𝑏𝐵, 𝑟 + 𝑔 + 𝑏 = 1,

where r, g, and b are the trichromatic coefficients, positive or negative, representing certain proportions of the red (R), green
(G), and blue (B) primaries, respectively1. In Figure 2, we show a graph of the trichromatic coefficients plotted from the values
adopted by the CIE Committee on Colorimetry in 1931. Since these coefficients are normalized, the CIE rg chromaticity space
can also be represented in the form of the rg chromaticity diagram shown in Figure 3, the b coordinate being directly deduced
from the r and g coordinates. The curved line is the spectral locus. The red (1,0,0), green (0,1,0), and blue (0,0,0) points on
that curve correspond to the 3 primary colours. The white point (E) is the Equal Energy point where r = g = b. Notice that the
spectral locus is completely enclosed in a triangle (dashed lines) formed by the virtual points Cr, Cg and Cb. The Equal Energy
point and the vertices of the dashed triangle are located at the following coordinates:

E Cr Cg Cb
r 1/3 1.27496 -1.73930 -0.74310
g 1/3 -0.27777 2.76726 0.14091
b 1/3 0.00281 -0.02795 1.60219
Table 2: Coordinates of the equal energy point and three primary colours in the CIE RGB colour space.

To draw the dashed triangle in Figure 3, the vertices were chosen arbitrarily but conscientiously. The line that passes through
Cb and Cr is known as the alychne, a word coined by Erwin Schrödinger, meaning "no light" in Ancient Greek: it is

1 In CIE's convention, lower case letters represent the chromaticity coordinates in a colour space of the same name written in upper case
letters (e.g., r, g, and b coordinates in the CIE RGB colour space).

4/18 CHROMATICITY DIAGRAM www.idonus.com


creative engineering and manufacturing

2.0

1.5
Trichromatic coefficients: r,g,b

435.8 nm 546.1 nm 700 nm

1.0

0.5

0.0

-0.5 r
g
-1.0 b

-1.5
380 420 460 500 540 580 620 660 700 740 780
Wavelength, λ (nm)

Figure 2: Trichromatic coefficients r,g, and b of the CIE 1931 standard observer.

3.0
Cg
2.5

2.0

1.5
g

1.0

0.5
E
Cb
0.0
Cr
-2.0 -1.0 0.0 1.0 2.0

-0.5
r

Figure 3: CIE 1931 rg chromaticity diagram.

the line of zero luminance in the colour space. The line that passes through Cg and Cr is located just above the green and red
primaries. As for the line that passes through Cg and Cb, it was chosen so as to keep the size of the triangle small. On the
spectral locus, the closest point is approximately that of the 504 nm wavelength.

CHROMATICITY DIAGRAM 5/18


1.0

0.9

0.8

0.7

0.6

0.5
y

0.4

E
0.3

0.2

0.1

0.0
0.0 0.1 0.2 0.3 0.4 0.5 0.6 0.7 0.8 0.9 1.0
x
Figure 4: CIE 1931 xy chromaticity diagram. The triangle defined by the red, green, and blue points is the
gamut of the original RGB space.

4. CIE XYZ colour space


The closed area formed by the spectral locus curve and the alychne line encompasses all the colours visible for the average
human eye. In Figure 3, the right-angled triangle formed by the red, green, and blue points only contains the colours that
can be synthesized with this particular choice of trichromatic primaries (i.e., 435.8 nm, 546.1, and 700 nm colour stimuli). To
get free from a particular choice of the primary colours, the CIE opted for a virtual XYZ colour space built from the virtual
primaries Cr, Cg and Cb. These primaries have the following coordinates in the CIE XYZ colour space: Cr (1,0,0), Cg (0,1,0), Cb
(0,0,1). For anyone familiar with linear algebra, an immediate matrix transformation that comes to mind is that obtained
from the trichromatic coordinates given in Table 1:

1.27496 −1.73930 −0.74310 −1 0.90878 0.57494 0.37093


𝑀0 = [−0.27777 2.76726 0.14091 ] = [0.09122 0.41876 0.00548]
0.00281 −0.02795 1.60219 0.00000 0.00630 0.62359
However, this transformation would translate the Equal Energy point to the following xyz coordinates:

𝐸0,𝑥 0.61822
𝐸0 = [𝐸0,𝑦 ] [0.17182]
𝐸0,𝑧 0.20996

6/18 CHROMATICITY DIAGRAM www.idonus.com


creative engineering and manufacturing

The CIE wanted the coordinate of the Equal Energy point to remain unchanged through the transformation RGB → XYZ. The
xyz coordinates being normalized, one can see that the appropriate matrix transformation, M, is of the form:

1/𝐸0,𝑥 0 0 0.49000 0.31000 0.20000


1
𝑀 = 𝑀𝑅𝐺𝐵→𝑋𝑌𝑍 =𝑘∙ [ 0 1/𝐸0,𝑦 0 ] 𝑀0 = 𝑘 [0.17697 0.81240 0.01063]
3
0 0 1/𝐸0,𝑧 0.00000 0.01000 0.99000

2.768892 1.751748 1.130160


𝑀 =[ 1 4.5907 0.0601 ]
0 0.056508 5.594292
where k is a scaling factor that doesn't affect the xyz coordinates (k = 5.6508, see section 5 for explanations). In this equation,
the 1/3 factor is a simple rewriting of the coordinates of the point of Equal Energy. The result of this transformation is shown
in Figure 4. In this CIE XYZ chromaticity diagram, we have added colours to represent all the colours that can be seen by the
human eye. As stated above, only the colours that are inside the triangle formed by the red, green, and blue can be
synthesized with this choice of trichromatic primaries. This triangle represents the gamut of this colour space: the subset of
colours which can be accurately represented with these primaries. Since most monitors and printers are designed to fulfil
the standardized sRGB colour space, which has a smaller gamut than the CIE RGB colour space, part of the colours inside the
triangle cannot be reproduced accurately. This remark is even more true for the colours outside the gamut triangle: they can
simply not be reproduced. For this reason, the blue-cyan-green colours shown in the upper part of the graph are simply an
extension of the colours calculated on the edge of the triangle.

5. CIE colour matching functions


So far, we have only dealt with normalized coefficients (rgb and xyz) that provide the chromaticity coordinates in a colour
space. In its effort to standardize the XYZ colour space, the CIE introduced absolute colour matching functions from which all
the normalized coefficients are calculated. They are written with an overbar: x̅ (λ), y̅ (λ), z̅ (λ) for the XYZ space and r̄(λ), ḡ(λ),
b̄(λ) for the RGB space. Owing to the fundamental role played by the photopic function, the CIE imposed that y̅ (λ) be the
photopic function V(λ) introduced in section 2:

𝑦̅(𝜆) = 𝑉(𝜆)

It can be straightforwardly shown that the other colour matching function must satisfy the following relations:
x V(𝜆)
x̅(𝜆) = V(𝜆), z̅(𝜆) = (1 − x − y)
y y

As for the r̄(λ), ḡ(λ), and b̄(λ) colour matching functions, because they have a physical significance, an appropriate scaling
factor needed to be used for XYZ→RGB transformation. Indeed, the r̄(λ), ḡ(λ), and b̄(λ) functions were normalized so that:

r̅(𝜆) + 4.5907 𝑔̅ (𝜆) + 0.0601 𝑏̅(𝜆) = V(𝜆)

The ratios 1 : 4.5907 : 0.0601 correspond to the relative luminances of the trichromatic stimuli. Hence, the parameter
k = 5.6508 that was used above without further explanation (1 + 4.5907 + 0.0601 = 5.6508).

The colour matching functions r̄(λ), ḡ(λ), b̄(λ) can be obtained through the matrix transformation:

2.768892 1.751748 1.130160 −1 0.418456 −0.158657 −0.082833


−1
𝑀𝑋𝑌𝑍→𝑅𝐺𝐵 = 𝑀 =[ 1 4.5907 0.0601 ] ≈ [−0.091167 0.252426 0.015707 ]
0 0.056508 5.594292 0.000921 −0.002550 0.178595
The colour matching functions for the XYZ and RGB spaces are shown in Figure 5 and Figure 6, respectively.

CHROMATICITY DIAGRAM 7/18


2.0
1.8 x̅ (λ)
y̅ (λ)
1.6
z̅ (λ)
1.4
1.2
1.0
0.8
0.6
0.4
0.2
0.0
360 400 440 480 520 560 600 640 680 720 760 800
Wavelength, λ (nm)

Figure 5: CIE XYZ colour matching functions.

0.4
r̄(λ)
ḡ(λ)
0.3
b̄(λ)

0.2

0.1

0.0

-0.1
360 400 440 480 520 560 600 640 680 720 760 800
Wavelength, λ (nm)
Figure 6: CIE RGB colour matching functions

6. sRGB colour space and Planckian locus


We have mentioned above the sRGB colour space which is widely used for consumer electronic devices (displays, digital
cameras, printers), and which is also the standard for the Internet. Conversion from CIE XYZ to sRGB requires a scaling so that
the white point is D65. The illuminant D65 is a CIE standard that is intended to represent average daylight. It was calculated
from the average spectral power distribution of the Sun and has a correlated colour temperature of approximately 6500 K.

8/18 CHROMATICITY DIAGRAM www.idonus.com


creative engineering and manufacturing

0.9
520

0.8 530

510 540

0.7 550

560
0.6
570
500
0.5 580
y

590
0.4
600

0.3 620
490 D65
750

0.2

480
0.1
470
460
0.0
0.0 0.1 0.2 0.3 0.4 0.5 0.6 0.7 0.8
x
Figure 7: CIE 1931 chromaticity diagram and sRGB colour gamut. The curve passing through
the white point D65 is the Planckian locus. The points highlighted on the spectral locus
correspond to monochromatic lights emitted at the indicated wavelengths (in nm).

The coordinates of D65 in the CIE XYZ colour space can be approximated using the theoretical spectral radiant exitance of a
black body heated at T = 6503.15 K:

2𝜋ℎ𝑐 2 ℎ𝑐 −1
𝑀𝑒,𝜆 = 5
(𝑒 𝑘𝑇 − 1)
𝜆
where h is the Planck constant, c is the speed of light in vacuum, k is the Boltzmann constant, T is the temperature in Kelvin,
λ is the wavelength. In practice, this equation is used to draw the Planckian locus curve. In Figure 7, we have drawn the CIE
1931 XYZ chromaticity diagram and included the Planckian locus curve. The dashed triangle shows the gamut of the sRGB
colour space. The colours were calculated using the XYZ→sRGB transformation matrix from the official sRGB documentation:

3.2406255 −1.537208 −0.4986286


𝑀𝑋𝑌𝑍→𝑠𝑅𝐺𝐵 = [−0.9689307 1.8757561 0.0415175 ]
0.0557101 −0.2040211 1.0569959
The GNU Octave script prepared to generate the CIE diagram of Figure 7 is provided at the end of this technical note (3 pages,
grey background)2.

2 GNU Octave, scientific programming language. Version used: GNU Octave 6.2.0.
[ https://octave.org/ ]

CHROMATICITY DIAGRAM 9/18


0.9

0.8

0.7

G
0.6
λ = 570 nm
0.5
y

0.4

R
0.3 D65

0.2

0.1
B
0.0
0.0 0.1 0.2 0.3 0.4 0.5 0.6 0.7 0.8
x
Figure 8: Calculating saturated colour coordinates for sRGB colour space. The line that joins point
D65 and a specific point on the spectral locus (e.g., 570 nm monochromatic wavelength) crosses
the triangle gamut at a specific coordinate (e.g., x = 0.4166; y = 0.5074).

7. Rendering of the colour spectrum in the sRGB colour space


In Figure 7, the points on the spectral locus curve represent pure monochromatic colours visible to the average human eye.
However, only the points inside the dashed triangle can be represented in the sRGB colour space. Taking this limitation into
account, the best way to perform optimum rendering of the colour spectrum is to use the corresponding saturated values
that are found on the edges of the gamut triangle. An example is shown in Figure 8 for 570 nm monochromatic colour
(yellow). The calculation must be made using the reference white colour (for sRGB colour space, the white point is D65). The
saturated colour is found straightforwardly using the line that passes through the white point and a given point on the
spectral locus: It crosses the gamut triangle at a well-defined coordinate near the spectral locus. These calculated coordinates
are plotted in Figure 9. Using the XYZ→sRGB transformation matrix introduced in section 6, one can easily obtain the curve
plotted in Figure 10. Notice that the procedure followed is identical to the one described in section 5: x̅ (λ), y̅ (λ), z̅ (λ) must
be calculated prior to completing the transformation.

These linear RGB values are not the final result. Gamma correction must be applied to obtain the final non-linear sRGB values.
The following formula transforms the linear values into sRGB:
12.92 𝐶𝑙𝑖𝑛𝑒𝑎𝑟 , 𝐶𝑙𝑖𝑛𝑒𝑎𝑟 ≤ 0.0031308
𝐶𝑠𝑅𝐺𝐵 = { 1/2.4
1.055𝐶𝑙𝑖𝑛𝑒𝑎𝑟 − 0.055, 𝐶𝑙𝑖𝑛𝑒𝑎𝑟 ≤ 0.0031308

10/18 CHROMATICITY DIAGRAM www.idonus.com


creative engineering and manufacturing

0.9
x
0.8
y
0.7 z

0.6
Coordinates

0.5

0.4

0.3

0.2

0.1

0
380 420 460 500 540 580 620 660 700
Wavelength, λ (nm)

Figure 9: Saturated colour coordinates in sRGB colour space and corresponding monochromatic
wavelengths. For example, for 570 nm (yellow), the corresponding coordinates are: x = 0.4166; y = 0.5074;
z = 0.076.

3.5

3.0


2.5

2.0

1.5

1.0

0.5

0.0
380 420 460 500 540 580 620 660 700 740 780 820
Wavelength, λ (nm)

Figure 10: linear RGB values and corresponding wavelengths for colour coordinates shown in Figure 8.

where C is either R, G, or B. These gamma-corrected values are usually clipped to the 0 to 1 range. For 24-bit RGB, 8 bits (256
levels) are used for each colour channel. This is done by multiplying 𝐶𝑠𝑅𝐺𝐵 by 255 and rounding the result to an integer.

CHROMATICITY DIAGRAM 11/18


The clipping creates discontinuities that would result in sharp transition points in the colour spectrum. To smoothen the
resulting colour spectrum, it is advisable to perform a 2D convolution of the data (e.g., conv2 function in Matlab or Octave).
The final result is shown in Figure 11 and the GNU Octave script prepared to generate this graph is provided at the end of
this technical note (1 page, blue background). Considering the limited gamut of the sRGB colour space, the spectral colour
plot obtained with this method is globally satisfying.3

8. Summary
Colour spectrum representation was chosen as an example to illustrate the usefulness of the CIE 1931 chromaticity diagram.
As you could expect, the use of the CIE 1931 XY colour space extends far beyond this simple case. To take but only few
applications, colour LEDs data sheets are always provided with their bin specification in terms of xy coordinates in the CIE XY
colour space; lightings are specified with a colour rendering index (CRI) calculated in the CIE colour space by comparing the
colour rendering of a test source with an ideal source with a given correlated colour temperature (CCT); comparison of colour
cameras passes through gamut analysis that is best displayed using the CIE chromaticity diagram.

3 Useful reading in relation with section 7: "Making Color Spectrum Plots – Part 2," Steve Eddins, July 20, 2020.
[ https://blogs.mathworks.com/steve/2020/07/20/making-color-spectrum-plots-part-2/ ]

12/18 CHROMATICITY DIAGRAM www.idonus.com


creative engineering and manufacturing

Figure 11: Rendering of the solar spectrum with consideration of the sRGB gamut limitations.
Plotted with GNU Octave v. 6.2.0 using the script 'RGB_to_spectrum.m' provided in this technical note.

CHROMATICITY DIAGRAM 13/18


% Colour representation of the CIE 1931 chromaticity diagram
% Save the file as, e.g., 'CIE_1931_chromaticity_diagram.m'. Run this script in GNU Octave (v. 5.2.0).
% Prepared by: Christophe Yamahata, idonus Sàrl, June 2022 | Adapted from:
% https://ch.mathworks.com/matlabcentral/fileexchange/40640-computational-colour-science-using-matlab-2e
clear;
% Chromaticity coordinates of spectrum locus + line of purples
CIE_x = [ 0.17411 0.17380 0.17141 0.16888 0.16441 0.16111 0.15664 0.15099 0.14396 0.13550 0.12412 ...
0.10960 0.09129 0.06871 0.04539 0.04076 0.03620 0.03176 0.02749 0.02346 0.01970 0.01627 ...
0.01318 0.01048 0.00817 0.00628 0.00487 0.00398 0.00364 0.00386 0.00464 0.00601 0.00799 ...
0.01060 0.01387 0.01777 0.02224 0.02727 0.03282 0.03885 0.04533 0.05218 0.05932 0.06672 ...
0.07430 0.08205 0.08994 0.09794 0.10602 0.11416 0.12235 0.13055 0.13870 0.14677 0.15472 ...
0.16253 0.17024 0.17785 0.18539 0.19288 0.20031 0.20769 0.21503 0.22234 0.22962 0.23689 ...
0.24413 0.25136 0.25858 0.26578 0.27296 0.28013 0.28729 0.29445 0.30160 0.30876 0.31592 ...
0.32306 0.33021 0.33736 0.34451 0.35167 0.35881 0.36596 0.37310 0.38024 0.38738 0.39451 ...
0.40163 0.40873 0.41583 0.42292 0.42999 0.43704 0.44406 0.45106 0.45804 0.46499 0.47190 ...
0.47878 0.48561 0.49241 0.49915 0.50585 0.51249 0.51907 0.52560 0.53207 0.53846 0.54479 ...
0.55103 0.55719 0.56327 0.56926 0.57515 0.58094 0.58665 0.59222 0.59766 0.60293 0.60803 ...
0.61298 0.61778 0.62246 0.62704 0.64823 0.66576 0.68008 0.69151 0.70792 0.71903 0.72599 ...
0.73342 0.73469 0.67858 0.62248 0.56639 0.51030 0.45421 0.39811 0.34202 0.28593 0.22984 0.17411 ]';
CIE_y = [ 0.00496 0.00492 0.00510 0.00690 0.01086 0.01379 0.01771 0.02274 0.02970 0.03988 0.05780 ...
0.08684 0.13270 0.20072 0.29498 0.31698 0.33990 0.36360 0.38792 0.41270 0.43776 0.46295 ...
0.48821 0.51340 0.53842 0.56307 0.58712 0.61045 0.63301 0.65482 0.67590 0.69612 0.71534 ...
0.73341 0.75019 0.76561 0.77963 0.79211 0.80293 0.81202 0.81939 0.82516 0.82943 0.83227 ...
0.83380 0.83409 0.83329 0.83159 0.82918 0.82621 0.82277 0.81893 0.81478 0.81040 0.80586 ...
0.80124 0.79652 0.79169 0.78673 0.78163 0.77640 0.77105 0.76559 0.76002 0.75433 0.74852 ...
0.74262 0.73661 0.73051 0.72432 0.71806 0.71172 0.70532 0.69884 0.69231 0.68571 0.67906 ...
0.67237 0.66563 0.65885 0.65203 0.64517 0.63829 0.63138 0.62445 0.61750 0.61054 0.60357 ...
0.59659 0.58961 0.58262 0.57563 0.56865 0.56167 0.55472 0.54777 0.54084 0.53393 0.52705 ...
0.52020 0.51339 0.50661 0.49989 0.49321 0.48659 0.48003 0.47353 0.46709 0.46073 0.45443 ...
0.44823 0.44210 0.43606 0.43010 0.42423 0.41846 0.41276 0.40719 0.40176 0.39650 0.39141 ...
0.38648 0.38171 0.37705 0.37249 0.35140 0.33401 0.31975 0.30834 0.29203 0.28094 0.27401 ...
0.26658 0.26531 0.23948 0.21363 0.18778 0.16192 0.13607 0.11022 0.08437 0.05852 0.03266 0.00496 ]';

% CIE standard illuminant D65. For sRGB, the white point has chromaticity coordinates (0.3127, 0.3290).
% This white point is also known as D65, which is an estimation of the white colour produced by mid-day sunlight.
D65 = [0.31271 0.32902];

% Planckian locus: black body locus


planckian_locus_x = [ 0.7347 0.7214 0.7092 0.6956 0.6813 0.6670 0.6528 0.6388 0.6250 0.6116 ...
0.5985 0.5857 0.5732 0.5650 0.5611 0.5496 0.5269 0.5054 0.4857 0.4677 0.4514 0.4366 0.4053 ...
0.3805 0.3605 0.3439 0.3083 0.2997 0.2854 0.2651 0.2513 0.2413 0.2338 0.2279 0.2232 0.2146 ]';
planckian_locus_y = [ 0.2653 0.2786 0.2907 0.3041 0.3179 0.3315 0.3445 0.3565 0.3675 0.3772 ...
0.3858 0.3931 0.3993 0.4027 0.4043 0.4081 0.4133 0.4152 0.4147 0.4123 0.4087 0.4042 0.3909 ...
0.3767 0.3633 0.3507 0.3186 0.3096 0.2938 0.2690 0.2506 0.2365 0.2253 0.2163 0.2089 0.1950 ]';

% sRGB gamut (colour triangle defined by the RGB primaries)


% XYZ to sRGB transformation matrix
M = [ 3.2406255 -1.537208 -0.4986286;
-0.9689307 1.8757561 0.0415175;
0.0557101 -0.2040211 1.0569959 ];

%%% End of Part 1/3

14/18 CHROMATICITY DIAGRAM www.idonus.com


creative engineering and manufacturing

% Gamut: colour triangle defined by the RGB primaries


Gamut =[inv(M)(:,1)/sum(inv(M)(:,1)) inv(M)(:,2)/sum(inv(M)(:,2)) inv(M)(:,3)/sum(inv(M)(:,3))];
gamut_x = [Gamut(1,:) Gamut(1,1)];
gamut_y = [Gamut(2,:) Gamut(2,1)];

function [rgb] = xy2srgb(xy, M)


xyz = [xy(:,1) xy(:,2) 1-xy(:,1)-xy(:,2)];
rgb = xyz*M';

% Get brighter spectral colours, including a good yellow, scale up the linear RGB values,
% allowing them to get higher than 1.0. Then, for each colour, scale all components back down,
% if necessary, so that the maximum component value is 1.0.
rgb = rgb / max(rgb(:));
rgb = rgb*2.5;
S = max(rgb,[],2);
S = max(S,1);
rgb = rgb ./ S;
rgb = min(max(rgb,0),1);

% Convert to nonlinear RGB values for the final result


if(rgb <= 0.0031308)
rgb = 12.92*rgb;
else
rgb = 1.055*rgb.^(1/2.4)-0.055;
endif
end

N = length(CIE_x); i = 1; e = D65;
White_point = e;
sectors_mono = 8; % The larger these values, the better the graph quality
sectors_purple = 7; % (e.g., > 5 sectors gives good results).
sectors = sectors_mono;
xy4rgb = zeros(N*sectors*4,5,'double');
for w = 1:N % equiv. wavelength
w2 = mod(w,N)+1;
a1 = atan2(CIE_y(w) -e(2),CIE_x(w) -e(1)); % start angle
a2 = atan2(CIE_y(w2) -e(2),CIE_x(w2) -e(1)); % end angle
r1 = ((CIE_x(w) - e(1))^2 + (CIE_y(w) - e(2))^2)^0.5; % start radius
r2 = ((CIE_x(w2) - e(1))^2 + (CIE_y(w2) - e(2))^2)^0.5; % end radius
if(w >= N-10 || w <=10)
sectors = sectors_purple;
else
sectors = sectors_mono;
endif

for c = 1:sectors % colourfulness (saturation)


% patch polygon
xy(1,1) = e(1)+r1*cos(a1)*c/sectors;
xy(1,2) = e(2)+r1*sin(a1)*c/sectors;
xy(2,1) = e(1)+r1*cos(a1)*(c-1)/sectors;

%%% End of Part 2/3

CHROMATICITY DIAGRAM 15/18


xy(2,2) = e(2)+r1*sin(a1)*(c-1)/sectors;
xy(3,1) = e(1)+r2*cos(a2)*(c-1)/sectors;
xy(3,2) = e(2)+r2*sin(a2)*(c-1)/sectors;
xy(4,1) = e(1)+r2*cos(a2)*c/sectors;
xy(4,2) = e(2)+r2*sin(a2)*c/sectors;

% Compute RGB for vertices


rgb = xy2srgb(xy, M);
% Store the results
xy4rgb(i:i+3,1:2) = xy(:,1:2);
xy4rgb(i:i+3,3:5) = rgb;
i = i + 4;
end
end

% Draw the CIE chromaticity diagram


min_x = 0; min_y = 0; max_x = 0.8; max_y = 0.9;
title_graph = 'CIE 1931 Chromaticity Diagram';

figure('Name', title_graph,'NumberTitle','off', 'ToolBar', 'none', 'Position', [600 50 750 900]);


plot( [min_x; max_x], [0; 0], 'k-', 'LineWidth', 1.2, ...
[0; 0], [min_y; max_y], 'k-', 'LineWidth', 1.2, [0; 0.8], [1; 0.2], 'k--', 'LineWidth', 1);

% Will disappear progressively. We will plot it again at the end.


hold on
plot( White_point(1),White_point(2), 'o', 'MarkerFaceColor', 'black', 'MarkerSize',12, CIE_x, CIE_y,'k-', 'LineWidth', 3);

text(0.1,-0.17,'To interrupt this script, open the Command Window tab in {\itOctave} and type {\bfCTRL + C}', 'Color',
[0.5 0.5 0.5],'FontSize',12);

set(gca,'FontSize',18); set(gca,'TickDir','out'); set(gca, 'XMinorTick', 'on', 'YMinorTick', 'on');


axis equal; axis([min_x max_x min_y max_y]);
xticks(0:0.1:max_x); yticks(0:0.1:max_y);
xlabel('x','FontSize',26); ylabel('y','FontSize',26);
title(title_graph,'FontSize',28);
[rows cols] = size(xy4rgb);
f = [1 2 3 4]; v = zeros(4,3,'double');
for i = 1:4:rows
v(:,1:2) = xy4rgb(i:i+3,1:2);
patch('Vertices',v, 'Faces',f, 'EdgeColor','none', 'FaceVertexCData',xy4rgb(i:i+3,3:5),'FaceColor','interp');
refreshdata; drawnow;
end

% Last layer: graphs on top of the coloured area


hold on
plot( planckian_locus_x, planckian_locus_y, 'Color', 0.6*[1 1 1],'LineWidth',2, ...
White_point(1),White_point(2), 'o', 'MarkerFaceColor', 'black', 'MarkerSize',12, ...
White_point(1),White_point(2), 'o', 'MarkerFaceColor', 'white', 'MarkerSize',8, ...
gamut_x, gamut_y, 'k-', 'LineWidth', 1, CIE_x, CIE_y,'k-', 'LineWidth', 3);

%%% End of Part 3/3

16/18 CHROMATICITY DIAGRAM www.idonus.com


creative engineering and manufacturing

%% This GNU Octave (v. 6.2.0) script was prepared by Christophe Yamahata, idonus Sàrl.
%% Copy the script and save the file as, e.g., 'RGB_to_spectrum.m'

clear;
lambda = [ 380:1:730]'; % Wavelength range: 380 nm - 730 nm (1 nm increment)
R = [ 1 1 1 2 2 2 2 2 3 3 3 4 5 7 8 9 10 11 13 14 15 17 18 20 21 23 25 26 28 29 31 33 35 37 39 41 43 45 47 49 51 52 ...
53 54 55 56 57 58 59 60 61 63 64 66 67 69 70 72 73 75 76 77 77 78 78 79 79 80 80 81 81 79 78 76 75 73 71 70 68 67 ...
65 59 52 46 39 33 26 20 13 7 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 ...
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 5 11 16 22 27 32 38 43 49 54 67 80 93 106 119 132 145 158 171 ...
184 191 197 204 211 218 224 231 238 244 251 251 252 252 253 253 253 254 254 255 255 255 255 255 255 255 255 ...
255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 ...
255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 251 247 243 239 235 230 226 222 218 214 ...
209 205 200 196 191 186 182 177 173 168 164 160 157 153 149 145 141 138 134 130 127 123 120 117 114 110 107 ...
104 100 97 94 92 99 86 84 81 78 75 73 70 68 65 63 60 58 55 53 50 48 45 44 42 41 39 38 37 35 34 32 31 30 29 28 27 ...
26 24 23 22 21 20 19 18 17 16 15 14 13 12 11 10 10 9 9 8 8 7 7 6 6 5 ]';
G = [ 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 ...
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 8 16 24 32 40 48 56 64 72 80 84 88 92 96 100 103 107 111 115 119 122 124 127 ...
129 132 135 137 140 142 145 149 152 156 159 163 167 170 174 177 181 185 189 193 197 201 205 209 213 217 221 ...
224 228 231 235 238 241 245 248 252 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 ...
255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 ...
255 255 255 255 255 255 252 248 245 242 239 235 232 229 225 222 217 212 207 202 197 192 187 182 177 172 167 ...
161 156 150 145 140 134 129 123 118 110 101 93 84 76 68 59 51 42 34 31 27 24 20 17 14 10 7 3 0 0 0 0 0 0 0 0 0 0 0 ...
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 ...
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 ]';
B = [ 3 4 5 6 7 8 8 9 10 11 12 15 17 20 23 26 28 31 34 36 39 42 45 49 52 55 58 61 65 68 71 75 79 82 86 90 94 98 101 ...
105 109 111 114 116 118 121 123 125 127 130 132 136 140 144 148 152 155 159 163 167 171 175 178 182 185 189 ...
193 196 200 203 207 212 217 221 226 231 236 241 245 250 255 253 250 248 245 243 241 238 236 233 231 227 222 ...
218 213 209 205 200 196 191 187 185 183 180 178 176 174 172 169 167 165 165 165 165 165 166 166 166 166 166 ...
166 167 168 169 170 172 173 174 175 176 177 178 178 179 180 181 181 182 183 183 184 184 183 183 183 183 182 ...
182 182 181 181 178 175 172 169 166 162 159 156 153 150 135 120 105 90 75 60 45 30 15 0 0 0 0 0 0 0 0 0 0 0 0 0 0 ...
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 7 15 22 29 37 44 51 58 66 73 73 ...
74 74 74 75 75 75 75 76 76 75 75 74 73 73 72 71 70 70 69 67 66 64 63 61 60 58 57 55 54 53 51 50 49 48 46 45 44 42 ...
41 40 39 37 36 35 34 33 31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 15 14 13 12 11 10 9 9 8 8 7 7 6 6 5 5 4 4 4 3 ...
3 3 3 3 2 2 2 2 2 2 2 2 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 ]';
RGB = [ R G B];

% First, perform a convolution to smoothen the data


RGB = conv2(RGB, ones(31,1)/31,'same');

% Draw the graph


figure('NumberTitle','off', 'Name', "Rendering of the solar spectrum with consideration of the sRGB gamut limitations",
'ToolBar', 'none', 'MenuBar', 'none', 'Position', [100 200 1000 800]);
plot(lambda(:),RGB(:,1), 'r', lambda(:),RGB(:,2), 'g',lambda(:),RGB(:,3), 'b');
set(gca,'FontSize',16,'TickDir','out', 'XMinorTick', 'on', 'YMinorTick', 'on');
title ({'RGB values \rm{calculated from the}';
'\rm{\it{CIE 1931 chromaticity diagram}} \rm{and D65 standard illuminant}'});
legend('R','G','B', 'location', 'northwest', 'box','off');
axis([380 730 0 255]); xticks(400:50:720); yticks(0:50:250); xlabel('Wavelength (nm)','FontSize',22);

% Draw the spectrum


intensity_R=RGB(:,1)/255; intensity_G=RGB(:,2)/255; intensity_B=RGB(:,3)/255;
colormap ([intensity_R,intensity_G,intensity_B]); caxis([380 730]);
h = colorbar ("southoutside"); set(h,'fontsize',16);

CHROMATICITY DIAGRAM 17/18


Creative engineering and manufacturing • Our engineering team is accustomed to developing products according
to client's needs. In-house machining and assembling facilities shorten the time from concept to finished products.

Visit our website to have an insight into our other products


and activities. Contact us for further technical information and
to obtain a quotation.

Customized UV-LED exposure system installed on a Double image microscope A model of wafer chuck
roll-to-roll machine

C
re
at
iv
e
e
n
gi
n
About
e idonus
er
in
Founded in 2004, idonus is a Swiss company that
g
develops and manufactures special equipment for the
a
MEMS and watchmaking industries. Our product
n
portfolio includes UV-LED exposure systems for
d
photolithography, IR microscope for wafer inspection,
m
vapor phase chemical etcher for silicon-based devices.
a
Since 2016, we also provide ion implantation services
n
and machines for the surface treatment of materials.
uf
ac
tu
ri
n
Contact
g
us for
more
• details:
O
ur
Christian SPOERL idonus sàrl T: +41 32 724 44 40
e
Managing Director Rouges-Terres 61 info@idonus.com
n
sales@idonus.com CH – 2068 Hauterive www.idonus.com
gi
n
e
er
in
© 2022 idonus sàrl. All rights reserved.
g
te
View publication stats

You might also like