The history of the RGB color model. RGB and CMYK Color Models: An Accessible Guide

Color and its models

Sofya Skrylina, teacher at the Art training center, St. Petersburg

In CompuArt No. 7 "2012, an article was presented on harmonious color combinations and patterns of color influence on human perception, which modern designers undoubtedly take into account in their projects. But when working at a computer and mixing colors on a monitor screen, specific problems arise. The designer must receive color, tone, hue and lightness that are required on the monitor screen or on a hard copy.Colors on the monitor do not always match natural colors.It is very difficult to get the same color on the screen, on a printout of a color printer and on a typographical print. The fact is that colors in nature, on a monitor and on a printed sheet are created in completely different ways.
To unambiguously determine colors in various color environments, there are color models, which we will discuss in this article.

RGB Model

The RGB color model is the most popular way to represent graphics and is suitable for describing the colors seen on a monitor, TV, video projector, and images created when scanning.

The RGB model is used to describe colors obtained by mixing three rays: red (Red), green (Green) and blue (Blue). The name of the model is made up of the first letters of the English names of these colors. The remaining colors are obtained by combining the base ones. Colors of this type are called additive, because when two rays of primary colors are added (mixed), the result becomes lighter. On fig. 1 shows what colors are obtained by adding the primary ones.

In the RGB model, each base color is characterized by brightness, which can take 256 values ​​- from 0 to 255. Therefore, you can mix colors in various proportions, changing the brightness of each component. Thus, you can get 256x256x256 = 16,777,216 colors.

Each color can be assigned a code using the decimal and hexadecimal representation of the code. The decimal representation is a triplet of decimal numbers separated by commas. The first number corresponds to the brightness of the red component, the second to green, and the third to blue. The hexadecimal representation is three two-digit hexadecimal numbers, each corresponding to the brightness of the base color. The first number (first pair of digits) corresponds to the brightness of red, the second number (second pair of digits) to green, and the third (third pair) to blue.

To check this fact, open the color palette in CorelDRAW or Photoshop. In the R field, enter the maximum value for the brightness of red, 255, and in the G and B fields, enter a value of zero. As a result, the sample field will contain red color, the hexadecimal code will be: FF0000 (Fig. 2).

Rice. 2. Representation of red in the RGB model: on the left - in the Photoshop palette window, on the right - CorelDRAW

If red is added to green at maximum brightness by entering 255 in the G field, the result is yellow, whose hexadecimal representation is FFFF00.

The maximum brightness of all three basic components corresponds to white, the minimum to black. Therefore, the white color has the code (255, 255, 255) in decimal representation, and FFFFFF16 in hexadecimal. Black color is coded respectively (0, 0, 0) or 00000016.

All shades of gray are formed by mixing three components of the same brightness. For example, values ​​of R = 200, G = 200, B = 200, or C8C8C816 result in light gray, while values ​​of R = 100, G = 100, B = 100, or 64646416 result in dark gray. The darker shade of gray you want, the smaller the number you need to enter in each text field.

What happens when an image is printed, how are colors transmitted? After all, paper does not emit, but absorbs or reflects color waves! When transferring a color image to paper, a completely different color model is used.

CMYK model

When printing, ink is applied to paper - a material that absorbs and reflects color waves of various wavelengths. Thus, the paint acts as a filter that passes strictly defined rays of the reflected color, subtracting all the rest.

The CMYK color model is used for mixing colors by printing devices - printers and printing presses. The colors of this model are obtained by subtracting the base colors of the RGB model from white. That is why they are called subtractive.

The base colors for CMYK are the following:

  • blue (Cyan) - white minus red (Red);
  • magenta (Magenta) - white minus green (Green);
  • yellow (Yellow) - white minus blue (Blue).

In addition to these, black is also used, which is the key (Key) in the color printing process. The fact is that real paints have impurities, so their color does not exactly match the theoretically calculated cyan, magenta and yellow. Mixing the three primary colors that should have made black produces an indeterminate muddy brown instead. Therefore, black is included in the number of basic printing inks.

On fig. 3 shows a diagram that shows what colors are obtained by mixing the base ones in CMYK.

It should be noted that CMYK colors are not as pure as RGB colors. This explains the slight discrepancy between the base colors. According to the scheme presented in fig. 3, at maximum brightness, the following color combinations should be obtained:

  • mixing magenta (M) and yellow (Y) should produce red (R) (255, 0, 0);
  • mixing yellow (Y) and cyan (C) should produce green (G) (0, 255, 0);
  • mixing magenta (M) and cyan (C) should produce blue (B) (0, 0, 255).

In practice, it turns out a little differently, which we will check further. Open the Color Picker dialog box in Photoshop. In the M and Y text boxes, enter a value of 100%. Instead of the base red color (255, 0, 0), we have a red-orange mixture (Fig. 4).

Now, in the Y and C text boxes, enter a value of 100%. Instead of the base green (0, 255, 0), the result is green with a slight blue tinge. When setting the brightness to 100% in the M and C fields, instead of the blue color (0, 0, 255), we have a blue color with a purple tint. Moreover, not all colors of the RGB model can be represented in the CMYK model. The color gamut of RGB is wider than that of CMYK.

The primary colors of the RGB and CMYK models are dependent on the color wheel diagram (Fig. 5). This scheme is used for color correction of images; examples of its use were discussed in CompuArt No. 12"2011.

The RGB and CMYK models are hardware dependent. For the RGB model, the base color values ​​are determined by the quality of the phosphor for a CRT or the characteristics of the backlights and panel color filters for LCD monitors. If we turn to the CMYK model, then the values ​​of the basic colors are determined by the actual printing inks, the features of the printing process and the media. Thus, the same image may look different on different equipment.

As noted earlier, RGB is the most popular and commonly used model for representing color images. In most cases, images are prepared for display through a monitor or projector and for printing on color desktop printers. In all these cases, the RGB model must be used.

Comment

Even though color printers use CMYK inks, most images that are going to be printed need to be converted to RGB. But the printed image will look slightly darker than on the monitor, so it needs to be lightened before printing. The amount of clarification for each printer is determined empirically.

The CMYK model must be used in one case - if the image is being prepared for printing on a printing press. Moreover, it should be noted that the CMYK model does not contain as many colors as the RGB model, therefore, as a result of the conversion from RGB to CMYK, the image may lose a number of shades that are unlikely to be restored by the reverse conversion. Therefore, try to convert the image to the CMYK model at the final stage of working with it.

HSB model

The HSB model simplifies the work with colors, as it is based on the principle of color perception by the human eye. Any color is defined by its hue (hue) - the color itself, saturation (Saturation) - the percentage of white paint added to the color and brightness (Brightness) - the percentage of black paint added. On fig. 6 shows a graphical representation of the HSB model.

Spectral colors, or color tones, are located along the edge of the color wheel and are characterized by their position on it, which is determined by the angle in the range from 0 to 360 °. These colors have maximum (100%) saturation (S) and brightness (B). Saturation changes along the radius of the circle from 0 (in the center) to 100% (at the edges). At a saturation value of 0%, any color becomes white.

Brightness - a parameter that determines the lightness or darkness. All colors on the color wheel are at their maximum brightness (100%) regardless of hue. Decreasing the brightness of a color means darkening it. To display this process on the model, a new downward coordinate is added, on which brightness values ​​from 100 to 0% are plotted. The result is a cylinder formed from a series of circles with decreasing brightness, the bottom layer being black.

To test this statement, open the Color Picker dialog box in Photoshop. In fields S and B, enter the maximum value of 100%, and in field H, enter the minimum value of 0°. As a result, we get the pure red color of the solar spectrum. The same color corresponds to the red color of the RGB model, its code is (255, 0, 0), which indicates the relationship of these models (Fig. 7).

In the H field, change the angle value in 20° increments. You will get the colors in the order they are in the spectrum: red becomes orange, orange becomes yellow, yellow becomes green, and so on. An angle of 60° gives yellow (255, 255, 0), 255, 0), 180° - blue (255, 0, 255), 240° - blue (0, 0, 255), etc.

To get a pink color, in the language of the HSB model - faded red, you need to enter the value 0 ° in the H field, and lower the saturation (S), for example, to 50%, by setting the maximum brightness value (B).

Gray for the HSB model is hue (H) and saturation (S) reduced to zero with lightness (B) less than 100%. Here are examples of light gray: H=0, S=0, B=80% and dark gray: H=0, S=0, B=40%.

White color is set as follows: H = 0, S = 0, B = 100%, and to get black, it is enough to reduce the brightness value to zero at any values ​​​​of hue and saturation.

In the HSB model, any color is obtained from the spectral by adding a certain percentage of white and black colors. Therefore, HSB is a very easy to understand model used by painters and professional artists. They usually have several basic colors, and all others are obtained by adding black or white to them. However, when mixing paints based on base paints, the color goes beyond the HSB model.

Lab Model

The Lab model is based on the following three parameters: L- brightness (Lightness) and two chromatic components - a and b. Parameter a changes from dark green through gray to purple. Parameter b contains colors from blue through gray to yellow (Fig. 8). Both components change from -128 to 127, and the parameter L- from 0 to 100. The zero value of the color components at a brightness of 50 corresponds to gray. A brightness value of 100 produces white, while 0 produces black.

The concepts of brightness in the Lab and HSB models are not identical. As in RGB, mixing colors from scales a and b allows for brighter colors. You can reduce the brightness of the resulting color using the parameter L.

Open the color picker in Photoshop, in the brightness field L enter a value of 50, for the parameter a enter the smallest value -128 and the parameter b reset. As a result, you will get a blue-green color (Fig. 9). Now try to increase the parameter value a per unit. Please note that in no model the numerical values ​​have changed. Try increasing the value of this parameter to achieve a change in other models. You will most likely be able to do this with a value of 121 (the green component of RGB will decrease by 1). This circumstance confirms the fact that the Lab model has about Larger color gamut compared to RGB, HSB and CMYK models.

In the Lab model, brightness is completely separated from the image, so in some cases this model is useful for recoloring fragments and saturating the image, affecting only the color components. a and b. It is also possible to adjust the contrast, sharpness and other tonal characteristics of the image by changing the brightness parameter. L. Examples of image correction in the Lab model were given in CompuArt No. 3 "2012.

The color gamut of the Lab model is wider than that of RGB, so each repeated conversion from one model to another is practically safe. Moreover, you can put the image in Lab mode, perform correction in it, and then painlessly transfer the result back to the RGB model.

The Lab model is hardware independent, serves as the core of the color management system in the Photoshop graphics editor and is used in a hidden form during each conversion of color models as an intermediate one. Its color range covers the RGB and CMYK ranges.

Indexed Colors

To publish an image on the Internet, not the entire color palette, consisting of 16 million colors, as in RGB mode, is used, but only 256 colors. This mode is called Indexed Color. A number of restrictions are imposed on working with such images. Filters cannot be applied to them, some tone and color correction commands, all operations with layers are unavailable.

With an image downloaded from the Internet (usually in GIF format), the following situation very often occurs. You can draw something in it only with a color different from the selected one. This is because the selected color is out of the indexed image's color palette, meaning that the color is not in the file. As a result, the selected color in the palette is replaced with the closest similar color from the color table. Therefore, before editing such an image, it is necessary to convert it to the RGB model.

The article was prepared based on the book by Sofia Skrylina “Photoshop CS6. The Essentials”: ​​http://www.bhv.ru/books/book.php?id=190413.

  • Translation

I'm going to take a tour of the history of the science of human perception that led to the creation of today's video standards. I will also try to explain commonly used terminology. In addition, I will briefly explain why the typical process of creating a game over time will more and more resemble the process used in the film industry.

Pioneers of Color Perception Research

Today we know that the human retina contains three different types of photoreceptor cells called cones. Each of the three types of cones contains a protein from the opsin protein family that absorbs light in different parts of the spectrum:

Light absorption by opsins

Cones correspond to the red, green, and blue portions of the spectrum and are often referred to as long (L), medium (M), and short (S) according to the wavelengths to which they are most sensitive.

One of the first scientific works on the interaction of light and the retina was Isaac Newton's Hypothesis Concerning Light and Colors, written between 1670-1675. Newton had a theory that light of different wavelengths would resonate the retina at the same frequencies; these vibrations were then transmitted through the optic nerve to the "sensorium".


“Rays of light, falling on the bottom of the eye, excite vibrations in the retina, which propagate along the fibers of the optic nerves to the brain, creating a sense of vision. Different types of rays create vibrations of different strengths, which, according to their strength, excite sensations of different colors ... "

More than a hundred years later, Thomas Young came to the conclusion that since the resonance frequency is a property dependent on the system, in order to absorb light of all frequencies, there must be an infinite number of different resonance systems in the retina. Jung considered this unlikely, and reasoned that the number was limited to one system for red, yellow, and blue. These colors have traditionally been used in subtractive paint mixing. In his own words:

Since, for reasons given by Newton, it is possible that the movement of the retina is of an oscillatory rather than a wave nature, the frequency of the oscillations must depend on the structure of its matter. Since it is almost impossible to believe that each sensitive point of the retina contains an infinite number of particles, each of which is capable of vibrating in perfect harmony with any possible wave, it becomes necessary to assume that the number is limited, for example, to three primary colors: red, yellow and blue ...
Jung's assumption about the retina was wrong, but he correctly concluded that there are a finite number of cell types in the eye.

In 1850, Hermann Helmholtz was the first to obtain experimental proof of Jung's theory. Helmholtz asked the subject to match the colors of various light source samples by adjusting the brightness of several monochrome light sources. He came to the conclusion that to compare all the samples, three light sources are necessary and sufficient: in the red, green and blue parts of the spectrum.

The birth of modern colorimetry

Fast forward to the early 1930s. By that time, the scientific community had a pretty good idea of ​​the inner workings of the eye. (Although it took another 20 years for George Wald to be able to experimentally confirm the presence and function of rhodopsins in retinal cones. This discovery led him to the Nobel Prize in Medicine in 1967.) Commission Internationale de L "Eclairage (International Commission on Illumination), CIE, set out to develop a comprehensive quantification of human color perception based on experimental data collected by William David Wright and John Guild at parameters similar to those first chosen by Hermann Helmholtz Baseline settings were chosen at 435.8 nm for blue, 546, 1 nm for green and 700 nm for red.


Experimental setup by John Guild, three knobs adjust primary colors

Due to the significant overlap in the sensitivity of the M and L cones, it was not possible to match some wavelengths with the blue-green part of the spectrum. To "match" these colors as a reference point, it was necessary to add a bit of the main red color:

If we imagine for a moment that all primary colors contribute negatively, then the equation can be rewritten as:

The result of the experiments was a table of RGB triads for each wavelength, which was displayed on the graph as follows:


CIE 1931 RGB Color Matching Functions

Of course, colors with a negative red component cannot be displayed using CIE primaries.

We can now find the trichromic coefficients for the light spectral intensity distribution S as the following inner product:

It may seem obvious that the sensitivity to different wavelengths can be integrated in this way, but in fact it depends on the physical sensitivity of the eye, which is linear with respect to the sensitivity to wavelengths. This was empirically confirmed in 1853 by Hermann Grassmann, and the integrals presented above in their modern formulation are known to us as Grassmann's law.

The term "color space" arose because the primary colors (red, green, and blue) can be thought of as the basis of a vector space. In this space, the various colors perceived by a person are represented by rays emanating from a source. The modern definition of a vector space was introduced in 1888 by Giuseppe Peano, but over 30 years earlier, James Clerk Maxwell had already used only nascent theories of what later became linear algebra to formally describe the trichromatic color system.

CIE decided that to simplify calculations it would be more convenient to work with a color space in which the primary color coefficients are always positive. The three new primaries were expressed in RGB color space coordinates as follows:

This new set of primary colors is impossible to implement in the physical world. It's just a mathematical tool that makes it easier to work with color space. In addition, to ensure that the primary color coefficients are always positive, the new space is arranged in such a way that the Y color coefficient corresponds to the perceived brightness. This component is known as CIE brightness(You can read more about it in Charles Poynton's excellent Color FAQ article).

To make it easier to visualize the resulting color space, we will perform a final transformation. By dividing each component by the sum of the components, we get a dimensionless color value that does not depend on its brightness:

The x and y coordinates are known as chromaticity coordinates, and together with the Y CIE luminance, they make up the xyY CIE color space. If we place the chromaticity coordinates of all colors with a given brightness on the graph, we will get the following diagram, which you are probably familiar with:


xyY diagram CIE 1931

And the last thing to know is what counts as white in the color space. In such a display system, white is the x and y coordinates of the color that results when all RGB primary color coefficients are equal.

Over time, several new color spaces have emerged that have improved the CIE 1931 spaces in various ways. Despite this, the CIE xyY system remains the most popular color space for describing display device properties.

Transfer functions

Before considering video standards, two more concepts need to be introduced and explained.

Opto-electronic transfer function

The optical-electronic transfer function (OETF) defines how the linear light captured by the device (camera) should be encoded in the signal, i.e. this is the form function:

V used to be an analog signal, but now, of course, it is digitally encoded. Typically, game developers rarely encounter OETF. One example where the feature will be important is the need for a game to combine video footage with CG. In this case, it is necessary to know with which OETF the video was recorded in order to restore the linear light and blend it correctly with the computer image.

Electro-optical transfer function

Electron-optical transfer function (EOTF) performs the opposite task of OETF, i.e. it determines how the signal will be converted to linear light:

This feature is more important for game developers because it determines how the content they create will be displayed on TV screens and user monitors.

Relationship between EOTF and OETF

The concepts of EOTF and OETF, although related, serve different purposes. OETF is needed to represent the captured scene, from which we can then reconstruct the original linear lighting (this representation is conceptually the HDR (High Dynamic Range) framebuffer of a regular game). What happens during the production stages of a regular film:
  • Capturing scene data
  • Inverting OETF to Restore Linear Illumination Values
  • Color correction
  • Mastering for various target formats (DCI-P3, Rec. 709, HDR10, Dolby Vision, etc.):
    • Reducing the dynamic range of the material to match the dynamic range of the target format (tone mapping)
    • Convert to target format color space
    • Invert EOTF for the material (when using EOTF in the display device, the image is restored as needed).
A detailed discussion of this workflow will not be included in our article, but I recommend studying a detailed formalized description of the ACES (Academy Color Encoding System) workflow.

Until now, the standard technical process of the game was as follows:

  • rendering
  • HDR framebuffer
  • tone correction
  • Invert EOTF for intended display device (usually sRGB)
  • Color correction
Most game engines use a color grading method popularized by Naty Hoffman's "Color Enhancement for Videogames" presentation from Siggraph 2010. This method was practical when only a target SDR (Standard Dynamic Range) was used, and it allowed the use of color grading software, already installed on the computers of most artists, such as Adobe Photoshop.


Standard SDR color grading workflow (Image credit: Jonathan Blow)

After the introduction of HDR, most games began to move towards a process similar to that used in film production. Even in the absence of HDR, the cinematic-like manufacturing process made it possible to optimize performance. Doing color grading in HDR means you have the whole dynamic range of the scene. In addition, some effects that were previously unavailable become possible.

We are now ready to look at the various standards currently used to describe TV formats.

Video standards

Rec. 709

Most of the standards related to video broadcasting are issued by the International Telecommunication Union (ITU), a United Nations body primarily concerned with information technology.

Recommendation ITU-R BT.709, more commonly referred to as Rec. 709 is a standard that describes the properties of HDTV. The first version of the standard was released in 1990, the latest in June 2015. The standard describes parameters such as aspect ratios, resolutions, frame rates. These characteristics are familiar to most people, so I will not discuss them and will focus on the sections of the standard regarding color reproduction and brightness.

The standard describes in detail the chromaticity limited by the xyY CIE color space. The red, green, and blue light sources of a conforming display standard shall be selected so that their individual chromaticity coordinates are as follows:

Their relative intensity must be adjusted in such a way that the white point has a chromaticity.

(This white point is also known as CIE Standard Illuminant D65 and is analogous to capturing the chromaticity coordinates of the spectral intensity distribution of normal daylight.)

Chroma properties can be visually represented as follows:


Coverage Rec. 709

The area of ​​the color scheme, bounded by a triangle created by the primary colors of a given display system, is called gamut.

We now move on to the brightness part of the standard, and this is where things get a little more complicated. The standard states that "General optical-electronic transfer characteristic in the source" is equal to:

There are two problems here:

  1. There is no specification for what physical brightness corresponds to L=1
  2. Although it is a video broadcast standard, it does not specify EOTF.
This happened historically, because it was believed that the display device, i.e. consumer TV and eat EOTF. In practice, this was done by adjusting the captured brightness range in the above OETF to make the image look good on a reference monitor with the following EOTF:

Where L = 1 corresponds to a brightness of approximately 100 cd / m² (the unit cd / m² is called "nit" in this industry). This is confirmed by the ITU in the latest versions of the standard with the following comment:

In standard manufacturing practice, the image source encoding function is adjusted so that the final image has the desired appearance, corresponding to what is seen on the reference monitor. The decoding function from Recommendation ITU-R BT.1886 is taken as the reference. The reference viewing environment is specified in Recommendation ITU-R BT.2035.
Rec. 1886 is the result of work on the documentation of the characteristics of CRT monitors (the standard was published in 2011), i.e. is a formalization of existing practice.


Elephant Cemetery CRT

The non-linearity of brightness as a function of applied voltage has led to the way CRT monitors are physically constructed. By pure chance, this non-linearity is (very) approximately the inverted non-linearity of human perception of brightness. When we switched to digital representation of signals, this led to the fortunate effect of evenly distributing the sampling error over the entire brightness range.

Rec. 709 is designed to use either 8-bit or 10-bit encoding. Most content uses 8-bit encoding. For him, the standard states that the distribution of the signal luminance range should be distributed in codes 16-235.

HDR10

When it comes to HDR video, it has two main competitors: Dolby Vision and HDR10. In this article, I'll focus on HDR10 because it's an open standard that's quickly become popular. This standard is selected for Xbox One S and PS4.

We start again by looking at the chrominance part of the color space used in HDR10, as defined in Recommendation ITU-R BT.2020 (UHDTV). It contains the following chromaticity coordinates of the primary colors:

Again, D65 is used as the white point. When visualized on the xy Rec. 2020 looks like this:


Coverage Rec. 2020

It is obvious that the coverage of this color space is much larger than that of Rec. 709.

Now we're moving on to the luminance section of the standard, and this is where things get more interesting again. In his 1999 Ph.D. thesis “Contrast sensitivity of the human eye and its effect on image quality”(“Contrast Sensitivity of the Human Eye and Its Effect on Image Quality”) Peter Barten presented a slightly intimidating equation:

(Many of the variables in this equation are themselves complex equations, such as brightness hiding inside the equations that compute E and M.)

The equation determines how sensitive the eye is to changes in contrast at different brightness, and different parameters determine the viewing conditions and some properties of the observer. "Minimum Recognizable Difference"(Just Noticeable Difference, JND) is the inverse of Barten's equation, so to discretize EOTF to get rid of binding to viewing conditions, the following must be true:

The Society of Motion Picture and Television Engineers (SMPTE) decided that the Barten equation would be a good basis for a new EOTF. The result was what we now call the SMPTE ST 2084, or Perceptual Quantizer (PQ).

PQ was created by choosing conservative values ​​for the parameters of the Barten equation, i.e. expected typical consumer viewing conditions. PQ was later defined as the discretization that, for a given range of brightness and number of samples, most closely matches the Barten equation with the chosen parameters.

Discretized EOTF values ​​can be found using the following recursive finding formula k< 1 . The last sampling value will be the required maximum brightness:

For a maximum brightness of 10,000 nits using 12-bit sampling (as used in Dolby Vision), the result looks like this:


EOTF PQ

As you can see, sampling does not cover the entire brightness range.

The HDR10 standard also uses EOTF PQ, but with 10-bit sampling. This is not enough to stay below the Barten Threshold in the 10,000 nit brightness range, but the standard allows metadata to be embedded in the signal to dynamically adjust the peak brightness. Here's what 10-bit PQ sampling looks like for different brightness ranges:


Various EOTF HDR10

But even so, the brightness is slightly above the Barten threshold. However, the situation is not as bad as it may seem from the graph, because:

  1. The curve is logarithmic, so the relative error is actually not that big
  2. Do not forget that the parameters taken to create the Barten threshold are chosen conservatively.
At the time of writing, HDR10 TVs on the market typically have a peak brightness of 1000-1500 nits, and 10 bits is enough for them. It's also worth noting that TV manufacturers are free to decide what to do with brightnesses above the range they can display. Some take a hard pruning approach, others a softer pruning approach.

Here is an example of what an 8-bit Rec. 709 with 100 nits peak brightness:


EOTF Rec. 709(16-235)

As you can see, we are well above Barten's threshold, and importantly, even the most promiscuous customers will tune their TVs to significantly higher 100 nits peak brightness (typically 250-400 nits), which will raise the Rec. 709 is even higher.

Finally

One of the biggest differences between Rec. 709 and HDR in that the brightness of the latter is indicated in absolute terms. In theory, this means that content destined for HDR will look the same on all compatible TVs. At least up to their peak brightness.

There is a popular misconception that HDR content will be brighter overall, but this is generally not the case. HDR movies will most often be produced in such a way that the average image brightness level is the same as for Rec. 709, but so that the brightest parts of the image are brighter and more detailed, which means that the midtones and shadows will be darker. Combined with absolute HDR brightness values, this means that optimal HDR viewing conditions require good conditions: in bright light, the pupil constricts, which means that details in the dark areas of the image will be harder to see.

Tags:

Add tags

RGB and CMY (CMYK) color models

RGB (for displays) and CMYK (for printing) are the most common color representation systems.

The main model of subtractive color synthesis is the CMYK printing system (blue-green / cyan, magenta, yellow, key / black).

The most common version of additive mixing, which involves the summation of multi-colored streams into a single resulting stream, is the RGB (red, green, blue) model.

If the subtractive scheme is used in printing (with a white zero - the absence of ink on paper), then the additive scheme (having a larger color gamut) is used in TVs, monitors, etc., where the screen turned off looks black.

Since RGB and CMY complement each other, there is a certain relationship between them. If you show this information as a single color wheel, then the RGB and CMY colors will alternate in it. If you mix two RGB colors, you get a CMY color; if, on the contrary, you mix two CMY colors, then this time you get an RGB color. For example, in the CMY model, red is described as a mixture of magenta and yellow. And in the RGB model, magenta is described as a mixture of red and blue.

In addition, compared to RGB, CMYK has a smaller color gamut. The laws of physics do not allow RGB colors to be printed. To print an RGB image, you must convert its additive colors to CMY colors, i.e. convert them to subtractive colors.

RGB color rendering system

RGB (English) Red, Green, Blue - red, green, blue) - additive color model (eng. Additive Primary Model) , describing the method of color synthesis for color reproduction. The additive model is called because the colors are obtained by adding (Eng. addition ) to black. The choice of primary colors in RGB is due to the physiology of color perception by the retina of the human eye.

The RGB model is used to reproduce the visible light spectrum and represents anything that transmits, filters, or senses light waves (such as a monitor, scanner, or eye) (Figure 7.5). Different levels of primary colors (red, green, and blue) are added to create different colors. Black is the absence of any light.

Rice. 7.5.

The image in this color model consists of three channels. When mixing primary colors such as blue ( AT ) and red (/?), we get additional magenta (eng. M - magenta ), when mixing green ( G ) and red ( R ) - additional yellow (eng. Y-yellow ), when mixing green ( G ) and blue ( AT ) additional cyan C - cyan ). When all three color components are mixed, we get white. TVs and monitors use three electron guns (LEDs, light filters) for the red, green and blue channels.

RGB numeric display

Each of the RGB coordinates is represented as a single byte, the values ​​of which are denoted by integers from 0 to 255 inclusive, where 0 is the minimum and 255 is the maximum intensity.

COLORREF is the standard type for representing colors in the Win32 operating system. Used to define a color in RGB form. Size - 4 bytes.

You can define a variable of type COLORREF like this:

COLORREFC=RGB( r, g, b ),

where g, g and b- intensity (in the range from 0 to 255) respectively of the red, green and blue components of the determined color FROM.

Therefore, bright blue can be defined as (0.0.255), red as (255.0.0), bright purple as (255.0.255), black as (0.0.0), and white as (255,255,255).

AT HTML#RrGgBb notation is used, also called hexadecimal notation: each coordinate is written as two hexadecimal digits, no spaces (see HTML colors below). For example, #RrGgBb - white color entry - #FFFFFF.

For reference

RGB color space standards. The RGB color model is device dependent. Since monitors vary between models and manufacturers, several color space standards have been proposed for this model.

The most common color space, sRGB, is the standard for displaying images on a monitor (default profile for computer graphics). The sRGB space used with the RGB color model has a wider color gamut in many tones of color (can represent more saturated colors) than the typical color gamut of CMYK color spaces, so sometimes images that look good in RGB are significantly dimmed and faded in CMYK.

Adobe RGB and ProPhoto RGB are also common. The ProPhoto RGB color space, also known as ROMM RGB (from the English. reference Output Medium Metric is an RGB color space designed for photo processing and output oriented. The standard was developed by the company kodak, it offers a particularly wide coverage designed for photographic images.

RGB is the most used color space and has both strengths and weaknesses. On the one hand, the RGB model is optimal for high-resolution image editing. It displays a wide range of values ​​and RGB images can be processed with almost all tools and functions. graphic editors .

On the other hand, RGB is device dependent. Whatever the numerical definition of color, the way it is displayed on the screen depends entirely on the display hardware.

  • Graphics editor- a program (or software package) designed to create and process graphic files.

The RGB model describes the emitted colors. It is based on three primary (basic) colors: red (Red), green (Green) and blue (Blue). The RGB model can be called "native" for the display. The remaining colors are obtained by combining the base ones. Colors of this type are called additive.

The figure shows that the combination of green and red gives yellow, the combination of green and blue - blue, and the combination of all three colors - white. From this we can conclude that the colors in RGB add up subtractively.

Primary colors are taken from human biology. That is, these colors are based on the physiological response of the human eye to light. The human eye has photoreceptor cells that respond most to green (M), yellow-green (L) and blue-violet (S) light (maximum wavelengths of 534 nm, 564 nm and 420 nm respectively). The human brain can easily distinguish a wide range of different colors based on the differences in the signals received from the three waves.

The RGB color model is most widely used in LCD or plasma displays such as a TV or computer monitor. Each pixel on a display can be represented in a hardware interface (such as graphics cards) as red, green, and blue values. RGB values ​​vary in intensity, which are used for visual purposes. Cameras and scanners also work in the same order, they capture color with sensors that register a different RGB intensity per pixel.

In 16 bits per pixel mode, also known as Highcolor, there is either 5 bits per color (often referred to as 555 mode) or with an extra bit for green (known as 565 mode). Green is complemented due to the fact that the human eye has the ability to detect more shades of green than any other color.

RGB values ​​represented in 24 bits per pixel (bpp) mode, also known as Truecolor, are typically allocated three integer values ​​between 0 and 255. Each of these three numbers represents the intensity of red, green, and blue, respectively.

RGB has three channels: red, blue and green, i.e. RGB is a three-channel color model. Each channel can take values ​​from 0 to 255 in decimal or, closer to reality, from 0 to FF in hexadecimal. This is explained by the fact that the byte that encodes the channel, and indeed any byte, consists of eight bits, and a bit can take 2 values ​​0 or 1, for a total of 28=256. In RGB, for example, red can take on 256 levels, from pure red (FF) to black (00). Thus, it is easy to calculate that the RGB model contains only 2563 or 16777216 colors.

RGB has three channels, and each is encoded with 8 bits. The maximum, FF (or 255) value gives a pure color. White color is obtained by combining all colors, more precisely, their limiting gradations. White color code = FF(red) + FF(green) + FF(blue). Accordingly, black code = 000000. Yellow code = FFFF00, magenta = FF00FF, cyan = 00FFFF.

There are also 32 and 48 bit color display modes.

RGB is not used for printing on paper, there is a CMYK color space instead.

CMYK is the color model used in color printing. A color model is a mathematical model for describing colors as integers. The CMYK model is based on cyan, magenta, yellow and black.

RGB color model(from the English. Red, Green, Blue - red, green, blue) - an additive color model that describes the method of color synthesis for color reproduction. In Russian tradition, it is sometimes referred to as KZS.

Story
In 1861, the English physicist James Clark Maxwell proposed using a method for obtaining a color image, which is known as additive color fusion. The additive (summing) color rendering system means that the colors in this model are added to the black (Black) color. Additive color shifting can be interpreted as the process of combining light streams of different colors before they reach the eye.
Additive color models (from the English add - add) are color models in which a luminous flux with a spectral distribution that is visually perceived as the desired color is created based on the operation of proportional mixing of light emitted by three sources. Mixing schemes may be different, one of them is presented on
The additive color model assumes that each of the light sources has its own constant spectral distribution, and its intensity is adjustable.
There are two flavors of the additive color model: device dependent and perceptual. In the hardware-dependent model, the color space depends on the characteristics of the image output device (monitor, projector). Because of this, the same image presented on the basis of such a model, when played on different devices, will be perceived visually a little differently.
The perceptual model is built taking into account the peculiarities of the observer's vision, and not the technical characteristics of the device.
In 1931, the International Commission on Illumination (CIE) standardized the color system and also completed work that made it possible to create a mathematical model of human vision. The CIE 1931 XYZ color space was adopted, which is the base model to this day.

Color formation mechanism
When a person perceives colors, they are directly perceived by the eye. The remaining colors are a mixture of three basic colors in different ratios. The color model is shown on . R+G=Y (Yellow); G+B=C (Cyan - blue); B + R = M (Magenta - magenta). The sum of all three primary colors in equal proportions gives white (White) color R + G + B = W (White - white). For example, on the screen of a monitor with a cathode ray tube, as well as a similar TV, the image is built by illuminating the phosphor with an electron beam. With this exposure, the phosphor begins to emit light. Depending on the composition of the phosphor, this light has one color or another.
Intermediate shades are obtained due to the fact that multi-colored grains are located close to each other. At the same time, their images in the eye merge, and the colors form a certain mixed shade. If the grains of one color are illuminated differently than the others, then the mixed color will not be a shade of gray, but will acquire a color. This method of color formation is reminiscent of lighting a white screen in complete darkness with multi-colored spotlights. If we encode the color of one point of the image with three bits, each of which will be a sign of the presence (1) or absence (0) of the corresponding system component, RGB 1 bit for each RGB component, then we will get all eight different colors . In practice, to store information about the color of each point of a color image in the RGB model, 3 bytes (i.e. 24 bits) are usually allocated 1 byte (i.e. 8 bits) for the color value of each component. Thus, each RGB component can take a value in the range from 0 to 255 (total 2 to the 8th power = 256 values). Therefore, it is possible to mix colors in various proportions, changing the brightness of each component. Thus, you can get 256 x 256 x 256 = 16,777,216 colors. The RGB coordinates varying in the range from 0 to 255 form a color cube. . Any color is located inside this cube and is described by its own set of coordinates, showing in what proportions the red, green and blue components are mixed in it. The ability to display at least 16.7 million shades of these full color image types are sometimes referred to as True Color (true or truthful colors). because the human eye is still unable to distinguish a greater variety. The maximum brightness of all three basic components corresponds to white color, the minimum - to black color. Therefore, the white color has the code (255,255,255) in decimal representation, and FFFFFF in hexadecimal. Black color encodes respectively (0,0,0) or 000000. All shades of gray are formed by mixing three components of the same brightness. For example, values ​​(200,200,200) or C8C8C8 result in light gray, while values ​​(100,100,100) or 646464 result in dark gray. The darker the shade of gray you want, the smaller the number you need to enter in each text box. Black color is formed when the intensity of all three components is equal to zero, and white - when their intensity is maximum.

Restrictions
The RGB color model has three fundamental drawbacks: The first is the lack of color gamut. Regardless of the size of the color space of an RGB color model, it is impossible to reproduce many of the colors perceptible to the eye (for example, spectrally pure blues and oranges). Such colors in the RGB color formula have negative base color intensities, and it is very difficult to implement not addition, but subtraction of base colors in the technical implementation of the additive model. This shortcoming is eliminated in the perceptual additive model.
The second drawback of the RGB color model is the impossibility of uniform color reproduction on different devices (hardware dependence) due to the fact that the base colors of this model depend on the technical parameters of the image output devices. Therefore, strictly speaking, there is no single RGB color space, the areas of reproducible colors are different for each output device. Moreover, even comparing these spaces numerically is possible only with the help of other color models. The third disadvantage is the correlation of color channels (as the brightness of one channel increases, the others reduce it).

Advantages
A lot of computer equipment works using the RGB model, in addition, this model is very simple, its "genetic" relationship with the equipment (scanner and monitor), wide color gamut (the ability to display a variety of colors close to the capabilities of human vision), this explains its wide distribution. .
The main advantages of the RGB color model are its simplicity, clarity, and the fact that any point in its color space corresponds to a visually perceived color.
Due to the simplicity of this model, it is easily implemented in hardware. In particular, microscopic phosphor particles of three types serve as controllable light sources in monitors with different spectral distributions. They are clearly visible through a magnifying glass, but when viewing the monitor with the naked eye, due to the phenomenon of visual closing, a continuous image is visible.
The intensity of light emission in monitors based on cathode ray tubes is controlled by three electron guns that excite the glow of phosphors. The availability of many image processing procedures (filters) in raster graphics programs, a small (compared to the CMYK model) amount occupied by the image in the computer's RAM and on disk.

Application
The RGB color model is widely used in computer graphics for the reason that the main information output device (monitor) works in this system. The image on the monitor is formed from separate luminous dots of red, green and blue colors. Looking at the screen of a working monitor through a magnifying glass, you can see individual colored dots - and it is even easier to see it on a TV screen, since its dots are much larger.
It is widely used in the development of electronic (multimedia) and printing publications.
Illustrations made with raster graphics are rarely created manually using computer programs. More often, scanned illustrations prepared by the artist on paper or photographs are used for this purpose.
Recently, digital photo and video cameras have been widely used to enter raster images into a computer. Accordingly, most graphic editors designed to work with raster illustrations are focused not so much on creating images as on processing them. On the Internet, raster illustrations are used in cases where it is necessary to convey the full gamut of the hue of a color image.

Sources used
1. Domasev M. V. Color, color management, color calculations and measurements. St. Petersburg: Peter 2009
2. Petrov M. N. Computer graphics. Textbook for high schools. St. Petersburg: Peter 2002
3. ru.wikipedia.org/wiki/Color model.
4. darkroomphoto.ru
5. bourabai.kz/graphics/0104.htm
6. litpedia.ru
7. youtube.com/watch?v=sA9s8HL-7ZM