What Is an Image to a Computer?
- Yanfeng Liu
- Sep 11, 2016
- 2 min read
A human sees a scene through eyes. The light goes through the pupils and stimulates the neuron cells, but what does a computer see? The short answer: a matrix.
A digital camera captures a scene by exposing its light sensor plane for a certain period of time (usually a fraction of a second), and each sensor captures one pixel of the image. This is stored as a matrix in the computer. Depending on whether it's colored image or grayscale image, the matrix can be 3-dimensional or 2-dimensional, its length and width being the resolution of the image (like 1980 by 1080, 1600 by 900, etc.). So if it's a color image, it could be 1980 by 1080 by 3, and if it's a gray image, it could be 1600 by 900 by 1.

Usually an image is presented in RGB colorspace. R = Red, G = Green, B = Blue. Each channel has a value between 0 and 255. It can also be converted into double, which ranges from 0 to 1. Note that a gray scale image can also be presented with three channels, but all three channels would have the same value.
If we fire up MATLAB, make it read an image, and then print out the data structure that stores the image, we can see that it is just a bunch of numbers from 0 to 255, 0 being the lowest intensity and 255 being the brightest.



This also means another thing for us. We cannot make computers to interpret images the way we do it. We have to teach it to deal with numbers instead of the actual image. This opens new things that we could not do with human eyes, like quickly finding a specific set of numbers (an object) in a huge scene with thousands of people.
There are many colorspaces. RGB is just one of them. Another useful one is HSV color space. The advantage of HSV is that it separates the channel for hue, saturation, and value (intensity). RGB, on the other hand, controls color, saturation, and intensity with all three channels, changing the value in one channel changes all three aspects of the color. In future articles we will do some projects that show the advantage of HSV.

Comments