semmixcolor and perception

The CIE XYZ model

CIE XYZ is the foundation of colorimetry. Set by the International Commission on Illumination (CIE) in 1931, it describes every color an average person can see with three numbers that do not depend on any device. All other color spaces, from sRGB to CIELAB, are defined relative to XYZ.

Where XYZ came from

In the late 1920s William David Wright and John Guild independently ran color matching experiments. An observer looked at a 2° field split in half: a spectral color on one side, a mixture of three primary lights on the other, whose proportions they adjusted until both halves looked the same.

The result had one awkward property: some spectral colors could not be matched without a "negative" amount of one light, that is, adding it to the test color on the other side. The CIE therefore transformed the data to three imaginary primaries X, Y, Z. They cannot be seen or produced, but they have three advantages:

Color matching functions

The experiments yield three functions x̄(λ), ȳ(λ), z̄(λ): how much of each primary is needed to match light of wavelength λ. For light with spectral distribution S(λ):

X = k · ∫ S(λ) · x̄(λ) dλ Y = k · ∫ S(λ) · ȳ(λ) dλ Z = k · ∫ S(λ) · z̄(λ) dλ (usually integrated over 380-780 nm, k chosen so that Y of the reference white is 100)

The ȳ(λ) function is exactly the eye's daylight brightness sensitivity curve V(λ), peaking at 555 nm. That is why Y is luminance.

The 1931 data apply to a 2° field, matching the sharpest part of the retina. In 1964 the CIE added a 10° observer for larger fields of view. The paint and textile industries mostly use 10°; graphics and displays use 2°.

xy chromaticity

XYZ combines information about the color and the amount of light. To separate the color alone, the components are normalized to sum to 1:

x = X / (X + Y + Z) y = Y / (X + Y + Z) z = 1 - x - y (redundant, follows from x and y) back from xyY: X = x · Y / y Z = (1 - x - y) · Y / y

xyY (two chromaticity coordinates plus luminance) is the most common way to state primaries and white points; for example D65 white is x = 0.3127, y = 0.3290.

The chromaticity diagram

Plotting every spectral color on the xy plane gives a horseshoe-shaped curve. Its ends are joined by the line of purples, mixtures of red and violet that do not occur in the spectrum. All visible colors lie inside this region.

Example

RGB (200, 80, 40), #c85028, in sRGB. The conversion to XYZ is on the CIE XYZ and RGB page:

X = 27.07 Y = 18.17 Z = 4.09 (0..100 scale) X + Y + Z = 49.33 x = 27.07 / 49.33 = 0.5488 y = 18.17 / 49.33 = 0.3684 xyY = (0.5488, 0.3684, 18.17)

Y = 18.17 means the color reflects about 18% of the light compared to white. The point (0.549, 0.368) lies in the orange region of the diagram, between D65 white and the red edge.

XYZ is linear in light, which makes it ideal for computation: mixing, chromatic adaptation, converting between RGB spaces. It is not perceptually uniform, though: the same distance in XYZ means a different visible difference in different places. For comparing colors, use CIELAB and CIELUV.