# Colors - It's more complicated than you think

How is color space defined and what exactly is “color” from a machine’s point of view.

## CIE XYZ

is closely associated with human eye perception.

The three types of cones S,M and L have different sensitivity curve (function) against wave length. Any perceptual color can be described by the stimilus level of the three cones.

For a light source, described by wavelength-intensity function $\phi(\lambda)$,
the perception can be described by **tristimulus**. A 3-tuple of integration.

“2 lightsource have the same color” != they have the same spectrum. It means that, the tristumulus caused by the 2 lightsource are identical.

The L,M and S functions, are standarlized into “standard observer”, R,G and B, then transformed into X,Y and Z.. This is a little tricky but the important thing in mind, is the concept of tristumulus.

## XY-Chromaticity Diagram

- on the upper curve border is the visible colors(wavelength 380 - 700 mm)
- The colors inside of the curve are produced by mixing the colors on the border. e.g. connect two points on the border to get a line of mixed colors
- Any point inside of the area can be produced by multiple ways of mixing.
- Colors on the curve border can not be produced by mixing therefore unique colors
- Monitors: use (typically) 3 base color, forming a triangle of colors that they can reproduce. Outside of the triangle are the colors that the monitor cannot reproduce.

## Characterize a display:

For a display device with three primaries, say red, green, and blue, we can mea- sure the spectral composition of the emitted light by sending the color vectors (1, 0, 0), (0, 1, 0), and (0, 0, 1). These vectors represent the three cases namely where one of the primaries is full on, and the other two are off. From the measured spectral output, we can then compute the corresponding chromaticity coordinates (xR , yR), (xG , yG ), and (xB , yB ).

The white point of a display is defined as the spectrum emitted when the color
vector (1, 1, 1) is sent to the display. Its corresponding chromaticity coordinate is
(xW , yW ). **The three primaries and the white point characterize the display and
are each required to construct a transformation matrix between the display’s color
space and CIE XYZ**.

## RGB and sRGB

Each device has its own primitives (R,G and B) therefore the RGB specifiction is device dependent.

sRGB is a device independent description, is a smaller subset of XYZ space (and of most device’s RGB space).

## Gamma Correction

Monitors are nonlinear with respect to input: this nonlinearity is characterized by a $\gamma$ value.

$$I_{displayed} = I_{max} \cdot a^{\gamma}$$

in which a is the input pixel value in [0,1].

HOWEVER, WE WANT the desplayed Intensity to be a*MaxIntensity, there fore we need to find the monitors’ gamma and set

$a’ = a^{\frac{1}{\gamma}}$. so that if we feed a’ as input, the displayed color would become a*maxIntensity.

**Ref**

Fundamentals of Computer Graphics 4th Edition.