User:Joger/Color Management: Difference between revisions

From Qt Wiki
Jump to navigation Jump to search
No edit summary
No edit summary
Line 1: Line 1:
This document contains personal draft notes on color management topics, and can not be considered a reference on the topic.
This document contains personal draft notes on color management topics, and can not be considered a reference on the topic.


== Definitions ==
== The CIE 1931 XYZ color space ==
[[File:CIE 1931 chromaticity diagram.png|thumb|CIE 1931 chromaticity diagram]]
The CIE XYZ 1931 color space lays the foundation for understanding  color management concepts such as color spaces, gamut, white point, and transfer functions. Specifically, the CIE color space defines a generic color coordinate system that is used do define other color spaces. This coordinate system consists of three axes, with coordinates x, y, and z. Usually, the z axis is projected onto the x-y plane and looks like the characteristic shark fin. At around its locus we find the colors that corresponds to a monochromatic light source when it is swept from 400 nm to 700 nm.
 
== Derivation of the XYZ coordinate system ==
The idea behind the CIE 1931 XYZ color space is that to be able to reproduce colors, a camera needs 3 different sensors, each responding to different wavelengths of light. Since light exists across a spectrum of frequencies, such sensors needs to respond to a wide range of wavelengths, although its sensitivity is highest at a specific frequency, and falls off for higher and lower frequencies. The CIE 1931 ''matching functions'' X(λ), Y(λ) and Z(λ) defines the response of a 3 sensor camera that is able to capture all visible colors, and these matching functions defines the CIE color space. We find the response of a single sensor as an integral over the spectrum of the light source and its corresponding matching function. For example, if a source emits light in a spectrum between 560 and 660 nm, a sensor with the characteristics of the X(λ) or Y(λ) matching functions will get a response, whereas the sensor following the Z(λ) matching function will have almost no response.
 
 
 
 
[[File:CIE_1931_color-matching_functions.png|thumb|400x400px]]
'''''Luminance''','' denoted ''Y,'' unit cd·m<sup>-2</sup> (nits) is a linear light quantity, where physical intensity is weighted by the sensitivity of human vision. Luminance is an integral over a spectral power distribution (e.g. light from a light source) weighted by the CIE color matching function Y(λ). Mid-range green values will contribute more to the response than red and blue, but all visible colors contribute.  
'''''Luminance''','' denoted ''Y,'' unit cd·m<sup>-2</sup> (nits) is a linear light quantity, where physical intensity is weighted by the sensitivity of human vision. Luminance is an integral over a spectral power distribution (e.g. light from a light source) weighted by the CIE color matching function Y(λ). Mid-range green values will contribute more to the response than red and blue, but all visible colors contribute.  
[[File:CIE 1931 color-matching functions.png|thumb|The CIE XYZ standard observer color matching functions]]
Because of the way the eye works, it can also be calculated as a weighted sum of linear-light red, green, and blue tristimulus components<ref name="DV">Charles Poynton, Digital Video and HDTV Algorithms and Interfaces, 2003, ISBN 1558607927</ref>, and takes human brightness sensitivity to different wavelengths into account. For example, if we have three light sources, red, green, and blue, and they each emit the same power, the green light source will appear the brightest, while the blue light source will appear the darket. This means that formulas that calculates luminance from R, G, and B values, will put more weight on green colors than the other primaries, as shown in the Rec. ITU-R BT.709 which standardizes some classes of displays:<blockquote><sup>709</sup>''Y'' = 0.2126 ''R'' + 0.7152 ''G'' + 0.0722 ''B''</blockquote>Here, luminance gets 21% of its power from red, 72% of its power from green, and 7% of its power from blue<ref name="DV" />. Note that luminance is typically not used in video processing, because we rarely intend to reproduce the absolute luminance of the actual scene<ref name="DV" />.
Because of the way the eye works, it can also be calculated as a weighted sum of linear-light red, green, and blue tristimulus components<ref name="DV">Charles Poynton, Digital Video and HDTV Algorithms and Interfaces, 2003, ISBN 1558607927</ref>, and takes human brightness sensitivity to different wavelengths into account. For example, if we have three light sources, red, green, and blue, and they each emit the same power, the green light source will appear the brightest, while the blue light source will appear the darkest. This means that formulas that calculates luminance from R, G, and B values, will put more weight on green colors than the other primaries, as shown in the Rec. ITU-R BT.709 which standardizes some classes of displays:<blockquote><sup>709</sup>''Y'' = 0.2126 ''R'' + 0.7152 ''G'' + 0.0722 ''B''</blockquote>Here, luminance gets 21% of its power from red, 72% of its power from green, and 7% of its power from blue<ref name="DV" />. Note that luminance is typically not used in video processing, because we rarely intend to reproduce the absolute luminance of the actual scene<ref name="DV" />.


'''''CIE XYZ tristimulus and x, y chromaticity''''' values builds on the definition of ''luminance Y'', by adding two new values, ''X'' and ''Z''. These are calculated in the same way as ''Y'', but by integrating under the ''X(λ'') and ''Z(λ)'' color matching functions respectively. A blue source will give a higher response with the X matching function, while a red source will give a higher response with the Z matching function. CIE defines three cromaticity  values by its relative contribution compared to the total response across all three color matching functions. We now have three measurements of the power emitted by a source at different wave lengths, Luminance, and its contribution to the X and Z matching functions.<blockquote>
'''''CIE XYZ tristimulus and x, y chromaticity''''' values builds on the definition of ''luminance Y'', by adding two new values, ''X'' and ''Z''. These are calculated in the same way as ''Y'', but by integrating under the ''X(λ'') and ''Z(λ)'' color matching functions respectively. A blue source will give a higher response with the X matching function, while a red source will give a higher response with the Z matching function. CIE defines three cromaticity  values by its relative contribution compared to the total response across all three color matching functions. We now have three measurements of the power emitted by a source at different wave lengths, Luminance, and its contribution to the X and Z matching functions.<blockquote>
Line 24: Line 33:




== References ==
==References==
<references />
<references />

Revision as of 19:09, 18 February 2024

This document contains personal draft notes on color management topics, and can not be considered a reference on the topic.

The CIE 1931 XYZ color space

CIE 1931 chromaticity diagram

The CIE XYZ 1931 color space lays the foundation for understanding color management concepts such as color spaces, gamut, white point, and transfer functions. Specifically, the CIE color space defines a generic color coordinate system that is used do define other color spaces. This coordinate system consists of three axes, with coordinates x, y, and z. Usually, the z axis is projected onto the x-y plane and looks like the characteristic shark fin. At around its locus we find the colors that corresponds to a monochromatic light source when it is swept from 400 nm to 700 nm.

Derivation of the XYZ coordinate system

The idea behind the CIE 1931 XYZ color space is that to be able to reproduce colors, a camera needs 3 different sensors, each responding to different wavelengths of light. Since light exists across a spectrum of frequencies, such sensors needs to respond to a wide range of wavelengths, although its sensitivity is highest at a specific frequency, and falls off for higher and lower frequencies. The CIE 1931 matching functions X(λ), Y(λ) and Z(λ) defines the response of a 3 sensor camera that is able to capture all visible colors, and these matching functions defines the CIE color space. We find the response of a single sensor as an integral over the spectrum of the light source and its corresponding matching function. For example, if a source emits light in a spectrum between 560 and 660 nm, a sensor with the characteristics of the X(λ) or Y(λ) matching functions will get a response, whereas the sensor following the Z(λ) matching function will have almost no response.



CIE 1931 color-matching functions.png

Luminance, denoted Y, unit cd·m-2 (nits) is a linear light quantity, where physical intensity is weighted by the sensitivity of human vision. Luminance is an integral over a spectral power distribution (e.g. light from a light source) weighted by the CIE color matching function Y(λ). Mid-range green values will contribute more to the response than red and blue, but all visible colors contribute.

Because of the way the eye works, it can also be calculated as a weighted sum of linear-light red, green, and blue tristimulus components[1], and takes human brightness sensitivity to different wavelengths into account. For example, if we have three light sources, red, green, and blue, and they each emit the same power, the green light source will appear the brightest, while the blue light source will appear the darket. This means that formulas that calculates luminance from R, G, and B values, will put more weight on green colors than the other primaries, as shown in the Rec. ITU-R BT.709 which standardizes some classes of displays:

709Y = 0.2126 R + 0.7152 G + 0.0722 B

Here, luminance gets 21% of its power from red, 72% of its power from green, and 7% of its power from blue[1]. Note that luminance is typically not used in video processing, because we rarely intend to reproduce the absolute luminance of the actual scene[1]. CIE XYZ tristimulus and x, y chromaticity values builds on the definition of luminance Y, by adding two new values, X and Z. These are calculated in the same way as Y, but by integrating under the X(λ) and Z(λ) color matching functions respectively. A blue source will give a higher response with the X matching function, while a red source will give a higher response with the Z matching function. CIE defines three cromaticity values by its relative contribution compared to the total response across all three color matching functions. We now have three measurements of the power emitted by a source at different wave lengths, Luminance, and its contribution to the X and Z matching functions.

x = X / (X + Y + Z) y = Y / (X + Y + Z) z = Z / (X + Y + Z)

In practice z is redundant because x + y + z = 1. Note that the x, y, and z chromaticity coordinates are abstract values, and have no direct physical interpretation[1]. Colors can now be represented by its chromaticity and luminance in the form of an xyY triple.

Relative luminance, is a unitless quantity, and is proportional to the scene luminance up to the maximum luminance of the screen/device. Relative luminance is calculated by normalizing the scene luminance to 1 or 100 units, relative to a reference white[1] which is assumed to appear white to the observer in the ambient environment.

Luma, denoted Y' , is calculated as a weighted sum of gamma corrected R', G', and B' components[1]. Luma is therefore not a linear quantity.

Color primaries, or primaries, are the primary colors (typically red, green, blue for digital video and image processing). These are not absolutes, but are selected from the visible spectrum based on constraints of the capturing or display device. These primaries define a triangle of colors that can be represented[2]. Other colors are expressed as a weighted sum of primaries[3]. Primary colors are defined by their (x,y) coordinates in a CIE diagram.

White point is a set of tristimulus values that is used to define 'white' on a display device[4]. The white point is engineered such that equal amounts of R, G, and B primaries will appear white for a reference observer in a reference environment[3]. The white point is defined by its (x, y) coordinates in the CIE diagram.

Gamut is the set of all possible colors that can be captured or reproduced by a device. The gamut is a volume of colors spanning the three primary colors R, G, and B, and the white point[3]. This means that a device can not capture or reproduce colors that for example are greener than its green primary, or whiter than its white point.

Transfer functions map numerical coordinates to and from a color space. The transfer functions can be linear, or non-linear. Typical examples of non-linear transfer functions are Gamma 2.2 and the non-linear transfer function defined by sRGB [3].



References

  1. 1.0 1.1 1.2 1.3 1.4 1.5 Charles Poynton, Digital Video and HDTV Algorithms and Interfaces, 2003, ISBN 1558607927
  2. Chapter 1: Color Management - Chris Brejon
  3. 3.0 3.1 3.2 3.3 Color management – three.js docs (threejs.org)
  4. White point - Wikipedia