Google+ Badge

Monday, February 8, 2016

How images and videos are seen

We say we see through our eyes. But what our eyes can sense is a particular spectrum of electromagnetic waves that has a wavelength of 4000 to 7000 Angstrom units. This spectrum is known as the visible light.

The colors that we can perceive fall in certain frequency range. Kindly note that frequency and wavelength are inversely proportional to each other. The lesser the frequency the higher is the wavelength and as the wavelength increases the frequency decreases.

 In the visible spectrum at the lower end of the wavelength there is violet color that has a frequency range between 3800 Angstrom units to 4200 Angstrom units. While at the higher end there is red with a wavelength range between 6200 Angstrom units to 7500 Angstrom units. The wavelengths of other colors fall between violet and red.

Now you might have noted that when you mix two different colors a new color is generated. Example is when you mix red and blue in equal proportions you get the color yellow. It happens because of the net effect of particles emitting red and blue color. The resultant frequency that the eye perceives is an average of the wavelength of the two different colors. Now Red, Green and Blue are primary colors. The other colors that we can perceive are generated by combining this three colors in different proportions.

This feature of colors is used in our LCD, LED and CRT displays. The images that we get are divided into tiny units called pixels. You might have heard about the term resolution 320x240 pixels, 640X480 pixels and so on. Each pixel comprises of many dots which are physically designed in the LED screen.

Now for each pixel some color is stored in the memory. Now the question arises : How this information is stored in the memory? Well, each primary color is assigned a byte of memory, so it can have values starting from 0 to 255.

This is better explained in this link, over there you can see that every color is denoted as an RGB(R=red, G= Green, B= Blue). The numbers are denoted in hexadecimal integers. In this link you can combine the colors in different proportions and see the results for yourself. If you are using Fedora Operating System in your computer, open the System Monitor, you have the option to change the color of the graph lines, when you try to change the colors you can see how different colors have different RGB combinations.

There are over 17 million different possible combinations, as you would have seen in the link when R=255, G=255, B=255 or #ffffff, the resultant color would be white or when R=0,G=0,B=0 or #000000, the color is black. This pixels placed one after another showing different colors create an image on the screen.

You would have noticed that the images are stored in your computer or mobile in jpg or png format. You would have also noticed that png format would hog a lot more space than jpg format. It is because of the compression algorithms of the format. When same colored pixels happen to be adjacent to each other they are encoded in a way that would save lot of space. It would just contain information that particular array of pixels have the same color.

If there was no compression then a 640X480 pixel image would hog 900Kilobytes of space. However normally 640X480 image does not take more than 100 kilobytes in jpg format.

Compressing an image is vital since that not only saves memory but also it would be easier to transport the file over slow networks. The video that we see is a set of images shown one after another. When 24 images are shown one after another in one second, it gives the human eye a sense of continuous motion. 

In video files instead of saving one frame after another, changes in the previous frame are saved. This makes videos much lighter. The most commonly used video format these days are mp4 and webm. Other formats are mpeg, flv, 3gp, avi etc. 




No comments:

Post a Comment