Color Space Conversion

March 20

Spectrum and Color Perception

In short, color is the perception of light with different wavelength distributions received by the human eye. The human eye has three types of cone cells that respond to different wavelength ranges. According to the stimulation ratio of the three types of cone cells, the feeling of any color can be described, which is called the LMS space.

CIE-XYZ and CIE-RGB

Since the data in the LMS space is difficult to measure, in 1931, Wright and Guild obtained the color matching functions by directly measuring the color perception of subjects to different spectra. The process of obtaining the color matching function is essentially to match the light of any spectrum by superimposing the three spectral lights R, G, and B. That is:

C=rR+gG+bBC = rR + gG + bB

Where C is the light of any spectrum, R, G, and B are three spectra, and r, g, and b are the color values.

However, the color matching functions obtained in this way will have negative values. To solve this problem, CIE proposed the XYZ space. The XYZ space is obtained by linearly transforming the color matching functions, so that all color matching functions are positive to facilitate calculation. The transformation matrix is as follows:

[XYZ]=[0.41245640.35757610.18043750.21267290.71515220.07217500.01933390.11919200.9503041][RGB]\begin{bmatrix}X \\ Y \\ Z\end{bmatrix}=\begin{bmatrix}0.4124564 & 0.3575761 & 0.1804375 \\0.2126729 & 0.7151522 & 0.0721750 \\0.0193339 & 0.1191920 & 0.9503041\end{bmatrix}\begin{bmatrix}R \\ G \\ B\end{bmatrix}

RGB Space

In the field of computer graphics, the RGB color model is the most convenient. On the one hand, it is similar to the principle of the human visual system, on the other hand, it is consistent with the working principle of the display device.

Any additive color space based on the RGB color model belongs to the RGB space. RGB is defined by the chromaticity of the three primary colors red, green, and blue, which can be used to define the corresponding color triangle and generate other colors.

A complete definition of the RGB space also needs to give the chromaticity of the white point and the Gamma correction curve. For more details, please refer to Wikipedia.

sRGB Space

Due to the differences in production processes, the same RGB values may display different colors on different devices. This will make the same digital product present different colors on different display devices, which is not conducive to the standardized production and distribution of digital products.

To solve this problem, device manufacturers have negotiated and formulated some standard color spaces, such as sRGB, Adobe RGB, DCI-P3, etc.

Among them, sRGB is the most widely used standard color space, and its full name is standard RGB.

The white value of the sRGB space is CIE-D65, and its XYZ value is [0.9505,1.0000,1.0890][0.9505, 1.0000, 1.0890]. The Gamma correction curve of the sRGB space is a segmented nonlinear function, as follows:

gamma(C)={12.92C,C0.00313081.055C1/2.40.055,C>0.0031308gamma(C) = \begin{cases}12.92C, & C \leq 0.0031308 \\1.055C^{1/2.4}-0.055, & C > 0.0031308\end{cases}

Other RGB Spaces

Color SpaceWhite PointGammaCoverage
Adobe RGBD652.252.1%
DCI-P3D652.645.5%
ProPhoto RGBD501.8100%

For a more complete table, please refer to Color space eploying the RGB color model.

References

  1. Color space representation and conversion https://zhuanlan.zhihu.com/p/24281841
  2. RGB color space https://zh.wikipedia.org/wiki/RGB%E8%89%B2%E5%BD%A9%E7%A9%BA%E9%96%93
  3. RGB color spaces https://en.wikipedia.org/wiki/RGB_color_spaces

© 2020 - 2026 Ruiyao Luo

26/03/04 15:15

PROD

#764ff88