Introduction
Colors play an important part in our lives. They can express emotions and even affect our mood. We cannot imagine our lives without colors. Computers represent colors by arranging the pixels in arrays, the range of colors that can be represented is called color range. Let us look at some of the popular color spaces.
Colors are an important aspect of our lives
How do humans perceive colors?
When light travels to the back of the eye, it stimulates the different light-sensitive cells that are located in the retina. These cells send the signals to the brain. The brain processes the information and creates the colors that we are seeing. A small number of colors can be added in different concentrations to create an extensive range of colors. This range is called color space.
RGB color space
RGB color space is based on the RGB color model. RGB stands for red, green, blue. It is an additive color model. An additive color model is based on light. It starts with black when there is no light. Red, green, and blue lights are added to it to get different colors, and when all the three colors are added equally, white is produced.
Different shades of all three colors are added to produce all the colors on the digital screens of your mobiles, computers, and televisions.
RGB color space occupies a large part of our visible spectrum and can be used to show almost all the colors on our screen.
White is produced when all the colors are added
NOTE- RGB color model is an additive color model, and the adding of colors should not be confused with the mixing of colors in real life. Instead, the addition of colors is analogous to the addition of light. Just like adding all the colors of a rainbow produces white light.
CMYK color space
RGB color model can be successfully used to show colors on our computer screens. But what about the colors that we see on paper. The actual printing of colors on paper cannot use the RGB model because, unlike our screens, light is not emitted from paper.
For this, a different color space is CYMK is used. CYMK includes cyan, yellow, magenta, and black. CYMK is a subtractive color model. It starts with white and then by adding different shades of CYMK, we get different colors.
In theory, the result is black when all the colors are added. But in reality, when printers mix all these colors together on paper, the result is muddy brown. To get the black color, true black is added.
HSV color space
RGB and CYMK use primary colors to represent all the colors. HSV color model is closer to how we humans perceive colors. HSV stands for hue, saturation, and value.
Hue represents the color of the model. Different softwares use different scales. In OpenCV, Its range is [0-179]. All the shades of a particular color will have the same hue.
Saturation is the amount of gray in color. It’s range is [0,255] in OpenCV. 0 represents gray, and 255 represents full saturation of the color.
Value means the brightness of the color. Its range is also [0,255] in OpenCV. 0 represents pure black.
HSV color model is helpful in color picking and color detection.