

Common color models:
① RGB color model: commonly used in monitors such as TVs and cameras, following the additive color rule (the three primary colors of light are mixed together, the whiter they are); the disadvantage is that the color space is not uniform enough, making it difficult to evaluate color differences; it is not directly related to the intuitive hue, saturation, and brightness, and does not conform to human cognitive psychology
② CMYK model: used for color printing, corresponding to cyan, magenta, yellow, and black, following the subtractive color rule (the three primary colors of pigments, the more they are mixed, the darker they become), which can meet the printing requirements ④
③ YCbCr model: It is a compressed and offset version of YUV, which separates brightness (Y) and chroma (U, V). Cb and Cr refer to blue chroma and red chroma. Pictures (JPEG), videos (MPEG), DVDs, cameras, and digital TVs all use this format. Note that the corresponding RGB2YUV conversion matrix must be used under different color gamuts (such as BT.601, BT.709).
④ CIEXYZ color model: It is the color response value of an object actually perceived by the human eye. It is a device-independent color system that can be quantified by reflectivity, CIE XYZ human eye color matching function, and light source SPD (Spectral Power Distribution). It is a non-uniform color space. Each color space is independent, but can be transformed to other color spaces through XYZ as a medium
⑤ CIELAB color model: It is a device-independent color system based on the theory that a color cannot be both blue and yellow at the same time. The colors in the same ellipse are the same when observed by the human eye. It can be seen that the size and shape of CIELAB's ellipse are better than CIELUV, and it is a relatively uniform color space.

⑥ CIELCH color model: uses the same color space as CIELAB, but it uses L to represent the brightness value, C to represent the saturation and H to represent the cylindrical coordinates of the hue angle value
⑦ HSL color model (Hue, Saturation, Lightness): Similar to how the human eye perceives color. HSL represents the points in the RGB color model in the cylindrical coordinate system. H-Hue, such as red, yellow, etc.; S-Saturation, taken as 0-100%; L-Brightness, taken as 0-100%.

⑧ HSV color model (Hue, Saturation, Value): It is also similar to the way the human eye perceives color. HSV is often conceptualized as an inverted cone of color, representing that the number of distinguishable levels of saturation and hue decreases as lightness approaches black. In practical applications, the HSV color wheel is often chosen. Hue is represented by a circle, and triangles represent saturation and lightness. The definition of saturation is obviously different from HSL.

Common color gamuts:
① CIE 1931 XYZ color space: It is the maximum color range that the human eye can perceive. After quantifying the three stimulus values of the human eye, take the x and y plane diagrams. The black line is the Planck curve, and the range from right to left is 1000K-20000K

② sRGB: It is a standard color space developed by HP and Microsoft in the United States in 1997
③ Adobe RGB: It is a color space developed by Adobe Systems in 1998. It roughly includes 50% of the visible colors in the Lab color space. It is mainly improved in the cyan system and can include more colors in the RGB color mode of computer monitors and other equipment in CMYK color printing.
④ DCI-P3: A wide color gamut standard introduced by the American film industry. It is one of the current color standards for digital movie playback equipment. It is 25% larger than sRGB and has a wider range of green and red; Apple, Sony, Samsung and other companies are gradually using DCI-P3 as a wide color gamut standard; 90% of the DCI-P3 color gamut represents the basic color requirements of HDR specification monitors
⑤ BT. 2020: Traditional TVs use BT.601 and BT.709 color gamut. Most HD TVs and computers will use BT.709 or DCI/P3. Ultra-HD TVs will use a wider color gamut space, such as BT.2020, which contains 57.3% of visible colors.

Color space conversion includes:
1,RGB2XYZ / XYZ2RGB
sRGB:
P3:

2,XYZ2LAB / LAB2XYZ
Convert reference colors Xr, Yr, Zr using D65 light source. Among them, L∈(0, 100), a∈(-128, 127), represents red and green, b∈(-128, 127), represents yellow and blue. In OpenCV, LAB data alignment is quantified so that it is in the range of 0~255.

Based on LAB space, the color difference ΔE can be calculated
Δab can also be calculated
3,LAB2LCH

Based on the LCH color space, ΔHue can be calculated
ΔChroma can also be calculated
4,RGB2HSL / HSL2RGB



5,RGB2HSV / HSV2RGB
For RGB2HSV, the definition of hue H is the same, but the other components S, V are different
For HSV2RGB, if the saturation S and brightness V change between 0 and 1, then RGB can be expressed as

6,RGB2YUV / YUV2RGB (Origin / Full Range / Limit Range)
Idea: Comes from Kr, Kg, Kb, represents the overall R, G, B brightness ratio 
BT.601

BT.709

BT.709

Adobe RGB
Display P3

Theater P3

BT.2020

7,RGB2LAB
That is, do RGB2XYZ first, and then do XYZ2LAB

