Image Processing 101 Chapter 1.2: Color Models
What is a Color Model?
A color model is an abstract mathematical model that describes how colors can be represented as a set of numbers (e.g., a triple in RGB or a quad in CMYK). Color models can usually be described using a coordinate system, and each color in the system is represented by a single point in the coordinate space.
For a given color model, to interpret a tuple or quad as a color, we can define a set of rules and definitions used to accurately calibrate and generate colors, i.e. a mapping function. A color space identifies a specific combination of color models and mapping functions. Identifying the color space automatically identifies the associated color model. For example, Adobe RGB and sRGB are two different color spaces, both based on the RGB color model.
RGB
RGB color model stores individual values for red, green, and blue. With a color space based on the RGB color model, the three primaries are added together to create colors from completely white to completely black.
The RGB color space is associated with the device. Thus, different scanners get different color image data when scanning the same image; different monitors have different color display results when rendering the same image.
There are many different RGB color spaces derived from this color model, standard RGB (sRGB) is a popular example.
HSV
HSV (hue, saturation, value), also known as HSB (hue, saturation, brightness), is often used by artists because it is often more natural to think about a color in terms of hue and saturation than in terms of additive or subtractive color components.
The system is closer to people’s experience and perception of color than RGB. In painting terms, hue, saturation, and values are expressed in terms of color, shading, and toning.
The HSV model space can be described by an inverted hexagonal pyramid.
- The top surface is a regular hexagon, showing the change in hue in the H direction, from 0 ° to 360 ° is the entire spectrum of visible light. The six corners of the hexagon represent the positions of the six colors of red, yellow, green, cyan, blue, and magenta, each of which is 60 ° apart.
- The saturation S is represented by the S direction from the center to the hexagonal boundary, and the value varies from 0 to 1. The closer to the hexagonal boundary, the higher the color saturation. The color of the hexagonal boundary is the most saturated, ie S = 1; the color saturation at the center of the hexagon is 0, ie S = 0.
- The height of the hexagonal pyramid (also known as the central axis) is denoted by V, which represents a black to white gradation from bottom to top. The bottom of V is black, V = 0; the top of V is white, V = 1.
YUV
The Y′UV model defines a color space in terms of one luma component (Y′) and two chrominance (UV) components. The Y′ channel saves black and white data. If there is only the Y component and there are no U and V components, then the graph represented is grayscale.
The Y component can be calculated with the following equation: Y = 0. 299*R+ 0. 587*G+ 0. 114*B, which is the commonly used grayscale formula. The color difference U and V are compressed by B-Y and R-Y in different proportions.
Compared with RGB, Y’UV does not necessarily store a triple tuple for each pixel. Y′UV images can be sampled in several different ways. For example, with YUV420, it saves one luma component for every point and two chroma values — a Cr (U) value and a Cb (V) value — every 2×2 points. I.E. 6 bytes per 4 pixels.
The scope of the terms Y′UV, YUV, YCbCr, YPbPr, etc., is sometimes ambiguous and overlapping. Historically, the terms YUV and Y′UV were used for a specific analog encoding of color information in television systems, while YCbCr was used for digital encoding of color information suited for video and still-image compression and transmission such as MPEG and JPEG. Today, the term YUV is commonly used in the computer industry to describe file-formats that are encoded using YCbCr.
To learn more about imaging fundamentals, read the first article in the Image Processing 101 Series: What is an Image . Subscribe to our newsletter and learn more about Image Processing.