Tuesday, February 17, 2015

Why Compression Needed ??

A gray scale image(Black and white) that is 256 x 256 pixels has 65,536 elements to store whereas a typical 640 x 480 colour image has nearly a million such elements to store. For instance if we represent each element by 8 bits then the total memory space required for a grayscale image will be (65536 x 8 = 512Kb) and for color image it would be in Mbs. Now to store or transmit these images would require huge memory and bandwidth which is not always possible.

Consider the following image :-



in this image there is lots of white component then one red block and one yellow block. This very small image has 1.4KB of size. Its clearly visible that the above image has lots of redundancy in terms of the pixels.
If we can represent the image  like x*(white) + y*(red) + z*(yellow)+ p*(black)then it would reduce the memory/bandwidth requirements and we can generate the original image at the destination or while viewing.

similarly, Natural images has lots of redundancy which can be removed to compress the image before transmission or storing. Videos generally are 30 frames per second and these frames are generally very similar in nature which gives the feeling of continuation in videos. Since these frames are very similar or identical most of the time, they can be compressed as well.

This compression is required to reduce the BW and memory requirements to store and transmit the images and videos.


Saturday, February 14, 2015

What is an Image?

Images are something which we see from our day to day life. They are present in every aspect of our life. Weather its a picture of our closed ones or our favorite actor/actress or its our DP on any social networking site, Its always the collection of pixels.


So what is the pixel now?
Pixel is the sub unit of an Image. It is basically a combination of color information in the image/picture.Generally pixel is formed of three components RGB. R stands for Red, G stands for Green and B stands for Blue. If each component is represented by 8 bits(0's and 1's). One pixel would take 24bits(3 bytes) to represent itself. Following image is the zoom-in version of the above image. In the following image one block represents the one pixel.


consider an example of a HD image which is stated as 1080p which essentially means 1080*1080 pixels. i.e 1080 pixels in X direction and 1080 pixels in Y direction. So in 1080p image there are 1080*1080=1166400 pixels. Wow  That's the huge number. Now if we calculate the number of bits to store this one image in our memory it will take 1166400*24=27993600bits or ~26MB of memory.