Monday, November 7, 2016

One RGB model, many RGB spaces

The RGB (Red, Green, Blue) color model dates back to 1860 and the Young-Helmholtz trichromatic theory of color vision. In fact, all color models are tied to human color vision. Color models that define a light source, such as RGB, are additive. Color models for paints and objects, such as CMYK, are subtractive. Additive color models combine colors. Subtractive color models define the color refracted when a photon of light strikes a surface.

The RGB color model does not provide a colorimetric definition of red, green, and blue. The model defines colors in reference to the primary colors.

Figure 1 - RGB Color Model
(credit: Wikipedia)
RGB specifies a color by defining its location within a three dimensional matrix. Each index has a value that is between 0 and 255. This provides for a maximum of 16,777,216 possible colors. However, humans with normal color vision can only detect around ten million colors.

Human color perception is based on the response of the three cone types to a photon of light. Each of the cone types have their own frequency response curve for responding to photons, as shown in Figure 2.

Figure 2 - Human cone response

RGB color space

With the specification of the chromaticity of red, green and blue, the color model becomes a color space. Chromaticity defines the quality of a color, without referring to luminescence. The two parameters for chromaticity are hue and chroma (also called saturation, intensity).

To define the boundaries of the RGB color space, we need to know the chromaticity for three points: red (1,0,0), green (0,1,0) and blue (0,0,1). The problem is that the RGB model lacks definitions for chromaticity or luminosity.  For a solution to this problem, we need to look at the color spaces defined in 1931, by the International Commission on Illumination (CIE). The 1931 CIE color spaces define the quantitative link between the wavelength of light and the human perception of color. The CIE 1931 color spaces are foundation on which modern color spaces are built. They are also important to understanding the mechanics behind colorblind simulation. For the purpose of this article, the important CIE color spaces are described below.

CIE XYZ color space

The CIE XYZ color space is a device independent color space that represents all the color sensations experienced by an average person, as shown in Figure 3. It serves as a standard reference for other color spaces.

Figure 3 - CIE XYZ color space (colors displayed are limited to sRGB color space)
(credit: Wikipedia)
Figure 3 is actually a chromaticity diagram that compresses the three dimensional color space for the three different cone types into two dimensions. The enclosed space represents the gamut of human colors. The curved edge of the diagram shows the light frequency in nanometers. The straight edge is known as the line of purples (colors for which there is no single monochromatic source).

CIE RGB color space

Unlike the CIE XYZ color space, the CIE RGB color space defines a the color space resulting from the mixing of three monochromatic light sources. It was the first color space to be based on adding three primary colors. Figure 4 illustrates the gamut for the CIE RGB color space.

Figure 4 - CIE RGB color space
(credit: Wikipedia)
The triangle in Figure 4 defines the gamut for the CIE RGB color space. The circle with the label "E" is the white point. Since computers did not exist in 1931, this color space served as a reference study for color vision research.

CIE L*A*B* (CIELAB) color space

It is important to keep in mind that this entire discussion revolves around human color vision. The Young-Helmholtz trichromatic theory is not the only color vision theory. In the late 19th century, Ewald Hering developed the opponent-process theory of color vision. The opponent-process theory holds that the cone photoreceptors combine to form three opposing color pairs: blue/yellow, red/green/, and black/white. The opponent-process theory explains human color experience, such as why we don't see "bluish yellow" or "reddish green". It all helps explain why individuals who are dichromatic confuse either red and green or blue and yellow. The stages theory of color vision holds that the trichromatic theory functions at the photoreceptor level, while the opponent-process theory functions at the neural level.

In 1976, CIE released the CIE L*A*B* color space, which is based on the opponent-process theory of color vision. The vertical axis represents lightness (L*), with values ranging from 0 (black) to 100 (white). The range of the values for a* and b* are usually from +100 to -100 or +127 to -128. Figure 5 illustrates the CIELAB color space (note: there is a label error in the diagram, as Blue should be -b).

Figure 5 - CIE L*A*B* color space
(credit: Wikipedia)
The CIELAB color space is device independent, and incorporates the entire gamut of human perceivable  colors. The CIELAB gamut does include colors that are outside the human gamut. Since it does incorporate the entire human gamut of colors, CIELAB is often used to convert colors from one color space to another.

Device dependent color spaces

The above color spaces were all device independent. In regards to device dependent color spaces, this article only covers the most popular of the current digital RGB color spaces. Besides the chromaticity of the three primary colors, a color space requires a white point. A white point is that point where the chromaticity coordinates produce the color white. The two most common illuminants used to define a white point are D50 (horizon light) and D65(noon daylight).

Figure 6 - Color space comparisons
(credit: Wikipedia)
 Figure 6 compares the most common color spaces in use. Except for SWOP CMYK (a typical printer color space), the color spaces are all RGB. Every RGB color space shown in Figure 6 uses the same range of values to address colors. For example, the color code red=120, green=154, blue=48 references a different color in each color space. The CIELAB color space acts an intermediary color space for color space conversion.

sRGB color space

Created by Microsoft in 1998, sRGB has the smallest gamut of all the color spaces. sRGB acts as the least common denominator. In Web design, CSS uses sRGB. The common format across all Web browsers is sRGB. As of this writing, Android and iOS only support sRGB (iOS 10 also supports DCI-P3 on the iPad Pro 9.7").

Adobe RGB

With its larger color gamut, Adobe RGB is probably the most popular color space for working with images. For mobile devices and Websites, Adobe RGB images must be converted to sRGB. 
Without conversion to sRGB, Adobe RGB images are darker and muted.

Colormatch RGB

This color space was originally designed for the PressView line of calibrated displays. The gamut for Colormatch  is only slightly larger than sRGB in the blue-green region, but a smaller gamut in the red-blue region.

ProPhoto RGB

Eastman Kodak designed the ProPhoto (ROMM) color space as a RGB color space for editing images. The ProPhoto primaries are not linked to any monitor specification. The large gamut minimizes the loss of color. However, the ProPhoto gamut does have out-of-gamut colors for human vision. ProPhoto uses the D50 white point, and not D65.

Color profiles versus color spaces

A color profile is an implementation of a color space. According to the International Color Consortium (ICC - CIE in French), profiles define the color attributes for a particular device or viewing requirement via a map between the device or color space and a profile connection space (PCS). The PCS is either CIE L*A*B* or CIE XYZ. Mappings can be specified using either tables or a series of transformation parameters.

 When a color profile is embedded in a file, the file is said to be tagged. Color management is the controlled conversion between color spaces. Lacking color management, sRGB is the default color space. Web browsers do not support color management. Thus, sRGB is the default color space.

Android does not support color management. However, Samsung's "Screen mode" performs color management. The options vary depending on the whether the device has an AMOLED screen, and the Android version. For AMOLED devices:

  •  "Basic" or "Standard" is sRGB without modifications.
  •  The "Adaptive display" mode boosts the brightness for viewing screen in daylight, and only applies to a few applications.
  •   The "Photo" or "Professional photo" seems to support Adobe RGB, as it has a much larger gamut.
  • The "Cinema" mode appears to support a gamut similar to DCI-P3.

For reasonable consistency across all devices and Web browsers, the sRGB color space is still the only common denominator. Without color management, an device automatically displays images in all color spaces as if they used the sRGB color space.

Conclusion

Not only is color an illusion, color consistency across all devices is illusive. Even an sRGB image will appear differently on different devices. Not only are there hardware variations, variations in screen brightness and surrounding light change the appearance of colors. The only solution is to color calibrate every display device. Color spectrometers are rather expensive, so the only other choice is to accept that a certain degree of color variation across devices is a reality.