Opencv | Color Space
Today, we are talking about color space in Opencv. In general, there are so many different colors in the world combining everything that we have seen.But specifically, it seems that only several basic colors become “color space”, which is root of every single color.
The use of color image processing is motivated by two factors:
1.Color is a powerful descriptor that often simplifies object identification and extraction from a scene.
2.Humans can discern thousands of color shapes and intensities, compared to about only two dozens of grayscales.
Color image processing is divided into two major areas
Full-color image processing
Pseudo-color image processing
Some of the gray-scale methods are directly applicable to color images. Others require reformulation to be consistent with the properties of the color spaces.
The light uses additive color system with three primary colors, Red, Green, Blue, will be added together to reproduce other colors.
Pigments uses a subtractive color system that absorbs a primary color and reflect or transmits the other two. The primary colors of pigments are Magenta, Cyan, and Yellow.
The purpose of a color model (or color space or color system) is to facilitate the specification of colors in some standard way.
A color model is a specification of a coordinate system where each color is represented by a single point.
RGB (red, green blue)
CMY or CMYK (cyan, magenta, yellow, black)
HSI (hue, saturation, intensity)
RGB: Additive Color System
Additive color involves the use of colored lights. It starts with darkness and mixes red, green and blue light together to produce other colors.
Combining one of these additive primary colors with another produces the subtractive primary colors, i.e., Yellow, Cyan, and Magenta.
Combining all three primary colors produces white.
CIE: CMY Model
Cyan (blue-green), Magenta (blue-red), and Yellow (red-green) are primary colors of pigments.
Most devices that deposit colored pigment on paper, such as color printer and copiers, require CMY data. Usually, we add black (K) to get CMYK color model.
RGB and CMY color models are ideally suited for hardware implementations, but
They are not well suited for describing colors for human interpretation.
They cannot capture human intuitions about the topology of colors.
When humans view a color object, we describe it by its hue (H), saturation (S), and intensity (I) as follows.
Hue: the color attribute that describes a pure color (the property of a color that varies in passing from red, yellow, green, cyan, blue, magenta, red).
Saturation: the measure of the degree to which a pure color is diluted by white light (purity of color).
Intensity (brightness): the property that varies in pass from black to white.
HSI Color Model
If we divide them into three different levels, including H,S,I, what will happen?
Given an image in RGB color format, the HSI color coordinates can be obtained as follows (not perfect):
In conclusion, it’s not so hard for us to exchange RGB, HSI or CMY in different spaces. As we can see, the array is not so complex. But for a picture, it’s also important to choose color space properly, which will have a good job for your following process, such as color segment and Contrast Stretching.
That’s all, thank you for reading.