How does a computer read an image ?
- Computers do not have any understanding of colors, they only understand numbers.
- A color model converts colors into numbers that a computer can process in turn.
- RGB (Red, Green, Blue) and HSV (Hue, Saturation, Value) are the most commonly used color models.
If you are unaware of what these models are all about and how a computer actually reads an image, this post will make you familiar with those concepts.
When we see the above image we can easily say that it is an image of a car, even a six year old child won't have a doubt saying that it is an image of a car. But, what about computers, can computers actually see this image ? The answer is NO.
Color Model
A color model is an organized system for creating a wide variety of colors from a small variety of primary colors. It is an abstract mathematical model that describes how colors can be represented as numbers, usually as three or four values or color components.(Primary color components like RGB). The two most commonly used color models are RGB (Red, Green, Blue) and HSV (Hue, Saturation, Value) we will understand both the color models in this computer vision series in detail. For now let us understand how the images are read using the RGB (Red, Green, Blue) color model.
The RGB Color Model
The RGB color model is a color model that adds three primary colors Red, Green and Blue in different permutations and combinations to form a broad array of colors. The name of the model is derived from the initials of the three primary color involved.
Until this point we know that -
- Computers know only numbers.
- Color models can convert images into numbers.
- The RGB color model represents all the colored images as a combination of three primary colors, Red, Green and Blue
So, what does computer actually see ?
Computer see a matrix of numbers and, those numbers in the matrix range from 0 to 255. For an instance if an image is red colored, it will be represented as [255,0,0] likewise a green colored image will be represented as [0,255,0] and similarly a blue colored image will be represented as [0,0,255]. I hope now all of you might have got an idea on how color models are used to represent an image.
First and Foremost, for a colored image there will be three channels since in this post we are intended to understand the RGB model, the three channels in every colored image will be the Red channel, the Green channel and the Blue channel.
Secondly, there will be a matrix associated with each of these channels Red, Green and Blue and, each element of that matrix represent the potency of brightness of that pixel. All the three channels have their distinct matrices placed on top of each other forming a 3-dimenssional matrix.
From here we have now got a clear idea that a computer interprets a colored image as a 3D-matrix. Likewise a black and white or a grayscale image there is only one channel.
I found one successful example of this truth through this blog. I am going to use such information now.grayscale image converter
ReplyDelete