In the previous blogs, we represented the color image using the RGB components but this is not the only way available. There are different color models ( A color model is simply a way to define the color) available, each having their own pros and cons.
There are two types of color models available: Additive and Subtractive. Additive uses light (transmitted) to display color while subtractive models use printing inks. These models are fitted into different shapes to obtain new models (See HSI model below).
In this blog, we’ll discuss the three that are most commonly used in the context of digital image processing: RGB, CMY, and HSI
The RGB Color Model
In this, we construct a color cube whose 3 axes denote R, G, and B respectively as shown below
Normalized RGB Color Cube; Source: Researchgate
This is an additive model, i.e. the colors present in the light add to form new colors. For example, Yellow has coordinate of (1,1,0) which means Yellow = Red + Green. Similarly, for other colors like cyan = Blue + Green and magenta = Red +Blue.
R, G, and B are added together in varying proportions to produce an extensive range of colors. Mixing equal proportions of R, G, and B falls on the grayscale line.
Use: color monitors and most video cameras.
The CMYK Color Model
CMY stands for cyan, magenta, and yellow also known as secondary colors of light. K refers to black. An equal proportion of C, M, and Y produce muddly black and not pure black. That’s why we use CMYK instead of CMY model.
This is a subtractive model i.e colors are perceived as a result of reflected light. e.g. when light falls on a cyan coated surface, red is absorbed (or subtracted) while Green and Blue are reflected and thus G + B = Cyan. Similarly for magenta and yellow.
Thus, CMY can be obtained from RGB by subtracting RGB from the max intensity.
Use: Printing like books, magazines etc.
The HSI Color Model
HSI stands for Hue, Saturation, and Intensity. This model is similar to how humans perceive color. Let’s understand HSI terms
Hue: Color attribute that describes the pure color or dominant wavelength.
Saturation: Purity of Color or how much a pure color is diluted by white light.
Intensity: Amount of light
H and S tell us about the chromaticity (color information) of the light while I carries the greyscale information.
HSI model can be obtained by rotating the RGB cube such that Black is at the bottom and white at the top.
H varies from 0 to 120 degrees for Red, 120 – 240 for Green, and 240 -360 for Blue. Saturation can take value from 0 to 100%. Intensity value varies according to the bit size of an image.
Pros: Easier to represent the color than the RGB model.
Note: We can also use these color models for object tracking (See here).
In the next blog, we will see how different colors can be generated from these color models with the help of OpenCV. Hope you enjoy reading.
If you have any doubt/suggestion please feel free to ask and I will do my best to help or improve myself. Good-bye until next time.