A digital image is represented in different color spaces, the color space refers to a specific way of representing colors in an image. It is a three-dimensional model that describes the range of colors that can be displayed or printed. There are several color spaces used in digital imaging, and each has a different range of colors and is used for specific purposes. Here we will introduce the BGR and HSV color spaces in this post and the next, both are commonly and widely used in image processing.
BGR stands for Blue, Green, and Red. It is a color space used to represent colors on electronic screens, like computer monitors, TVs, and smartphones. In this space, colors are represented by three primary colors: Red, Green, and Blue. Each primary color has a range of 0 to 255, meaning each color can have 256 possible values, which makes a total of 16.7 million ( = 256 × 256 × 256 ) possible colors.
Each primary color is called a channel, a channel has the same size as the original image. Therefore, an image in BGR color space has three channels, blue, green and red. Figure below shows the idea of how the three channels compose a color image.
A single channel does not have any colors, it’s a grayscale image. Because the three primary colors can build up a color, a single channel only has one value, which can only represent a grayscale, not a color.
Therefore, the above Figure explains the concept, but not quite correct, because the blue, green and red channels are all in grayscale without colors. The above red channel is shown in red, looks like it is red, but that is not the case, it should be in grayscale. Similarly, the green and blue channels should be also in grayscale.
Figure shown below is the correct one, the blue, green and red channels are all in grayscale, they are mixed together to produce the color image.
Each channel is represented by an 8-bit value ranging from 0 to 255, the combination of the three primary colors at their maximum intensity (255, 255, 255) results in white, while (0, 0, 0) results in black, anything in between results in different colors. The same value in three channels, such as (125, 125, 125), represents a gray color.
0 comments:
Post a Comment