Computer color science---CIE chromaticity diagram and saturation processing

foreword

Understanding color-related theory and imaging knowledge is very important for in-depth understanding of vision-related algorithms and ISP algorithms. Understanding color theory is inseparable from the CIE chromaticity diagram;

CIE 1931 chromaticity diagram related knowledge

insert image description here
CIE 1931 Yxy Chromaticity Diagram. The shape looks like a horseshoe, so it is also called "horseshoe diagram";
in the chromaticity diagram, x and y are the horizontal and vertical coordinates, and the definition of the horizontal coordinate is:
x = XX + Y + Z x=\frac{X}{X +Y+Z}x=X+Y+ZX
X, Y, and Z represent the R, G, and B values, so x represents the proportional value, the larger the value, the redder the color; y = YX + Y + Z y=\frac{Y}{X+
Y +Z}y=X+Y+ZY
x represents the proportional value, the larger the value, the greener the color; the
white point is R=G=B, and the corresponding chromaticity coordinates are (0.33,0.33);

The outer curve is the "monochromatic light locus diagram", the wavelength range is from 380nm to 780nm, and the inner straight line connecting the two ends of 380nm to 780nm is the "purple line"; the purple line has no band, so the color of this edge is also called "external color". ";
insert image description here

The boundary contour line of the chromaticity diagram (monochromatic light trajectory line + purple-red line) is the maximum saturation of visible light color, including all hues that humans can perceive: red, orange, yellow, yellow-green, green, cyan, cyan, blue-cyan, Blue, purple, magenta, fuchsia.
insert image description here
insert image description here
The entire chromaticity diagram is divided into 21 specific color areas, and the colors in each color area are basically the same (hue and saturation are basically the same);
insert image description here

The middle area is white, the closer to the middle white area, the lower the color saturation, and the closer to the outer contour of the boundary, the higher the color saturation;
insert image description here

In color representation, there is a formula:
color appearance = hue + saturation + brightness;
insert image description here

Chromaticity = Hue + Saturation;
in the CIE 1931 Yxy chromaticity diagram, it does not fully reflect the color appearance information of the color, but only reflects the chromaticity information, not the brightness information;
insert image description here
if the hidden parameter brightness Y is reflected, the chromaticity diagram It is no longer a two-dimensional plan; changing the brightness Y, its chromaticity coordinates (x, y) will not change;
insert image description here
in the chromaticity diagram, there is a curve that crosses the white area and bends downward, called It is the black body locus, or Planck locus, which is formed by converting the light color corresponding to each temperature when the black body burns into chromaticity coordinates, and marking it on the chromaticity diagram. Each color on the black body locus The corresponding temperature is called the color temperature of the light source;
insert image description here

The color temperature represents a unit of measurement of the color components contained in the light. The unit is Kelvin "K", and 0~700K is black. It is outside the chromaticity diagram, which also shows that within this temperature range, black bodies will not radiate externally. Visible light can only radiate infrared rays to the outside; the human body temperature is 37 degrees Celsius, and the corresponding Kelvin temperature is 310.15K, which can only radiate infrared rays to the outside, which is also outside the chromaticity diagram; 700K
insert image description here
to 1500K is dark red; D50, correlated color temperature 5003K, is A light source with a slightly warmer color; D55, correlated color temperature 5503K, simulating early morning sunlight;
insert image description here
on the chromaticity diagram, randomly select two color points, such as color point R and color point G, and mix R and G All the mixed colors are on the connecting line between them;
insert image description here

Randomly select three color points to form a triangle, and all the colors in this triangle can be mixed through these three color points; when the three points are three primary colors, many colors can be formed, and the triangle formed by these three points is the constant Said color gamut (Gamut); color gamut refers to the "color sum" composed of a technical system and the ability to reproduce the "color range"; the larger the color gamut coverage area, the wider the range of colors that can be represented;
insert image description here
common Color gamut standards include sRGB, DCI-P3, etc.;

insert image description here
The white point is generally the center point of the color gamut space, the so-called white balance point, and the white point of different color gamut spaces is also different; the
insert image description here
insert image description here
RGB coordinates and white point defined by Adobe RGB and sRGB are attached;

Saturation related calculation formula

It is very difficult to process colors in RGB format, so RGB is often converted into YUV format. Y represents brightness, U and V represent chroma, and the method of improving color saturation in YUV format: UV is also called CR and CB to represent chroma
bias Red and purple, to change the saturation, you need to increase and decrease U and V in the same proportion; to
increase the saturation: Gain ∗ U , Gain ∗ V Gain*U, Gain*VGainUGainV
changes the saturation of the image through YUV. The range of Gain here is (0, 5). If it is 1, it means that the image data will not be changed; note: here
U~(-128-128), V~(-128-128 ) If your UV range is 0-255 or 16-240, then you need to subtract 128 first.

Chroma adjustment in YUV space

C b ′ = C b ∗ cos ( θ ) + C r ∗ cos ( θ ) Cb^{'} =Cb*cos(\theta)+Cr*cos(\theta) .Cb=Cbcos ( θ )+Crcos ( θ )
C r ′ = C r ∗ cos ( θ ) + C b ∗ cos ( θ ) Cr^{'} =Cr*cos(\theta)+Cb*cos(\theta) .Cr=Crcos ( θ )+Cbcos ( θ )
where θ changes from -180 to 180; when θ changes from 0 to positive 180 degrees, the color gradually changes from green to yellow, red, and finally purple; when θ changes from 0 to negative 180 degrees, the color Gradually from green to cyan, blue, and finally purple; the typical chromaticity adjustment range is minus 30 degrees to plus 30 degrees.

reference link

Why is the color space so empty when adjusting the hue and saturation of the image through the YUV space ?

Guess you like

Origin blog.csdn.net/qq_43376782/article/details/129432764