| < Day Day Up > |
|
To transmit an image, the image is divided into grids called pixels (or picture elements). The higher the number of grids, the higher the resolution. Grid sizes such as 768 × 1024 and 400 × 600 are generally used in computer graphics. For black-and-white pictures, each pixel is given a certain grayscale value. If there are 256 grayscale levels, each pixel is represented by 8 bits. So, to represent a picture with a grid size of 400 × 600 pixels with each pixel of 8 bits, 240kbytes of storage is required. To represent color, the levels of the three fundamental colors—red, blue, and green—are combined together. The shades of the colors will be higher if more levels of each color are used.
In image coding, the image is divided into small grids called pixels, and each pixel is quantized. The higher the number of pixels, the higher will be the quality of the reconstructed image.
For example, if an image is coded with a resolution of 352 × 240 pixels, and each pixel is represented by 24 bits, the size of the image is 352 × 240 × 24/8 = 247.5 kilobytes.
To store the images as well as to send them through a communication medium, the image needs to be compressed. A compressed image occupies less storage space if stored on a medium such as hard disk or CD-ROM. If the image is sent through a communication medium, the compressed image can be transmitted fast.
One of the most widely used image coding formats is JPEG format. Joint Photograph Experts Group (JPEG) proposed this standard for coding of images. The block diagram of JPEG image compression is shown in Figure 4.5.
Figure 4.5: JPEG compression.
For compressing the image using the JPEG compression technique, the image is divided into blocks of 8 by 8 pixels and each block is processed using the following steps:
Apply discrete cosine transform (DCT), which takes the 8 × 8 matrix and produces an 8 × 8 matrix that contains the frequency coefficients. This is similar to the Fast Fourier Transform (FFT) used in Digital Signal Processing. The output matrix represents the image in spatial frequency domain.
Quantize the frequency coefficients obtained in Step 1. This is just rounding off the values to the nearest quantization level. As a result, the quality of the image will slightly degrade.
Convert the quantization levels into bits. Since there will be little change in the consecutive frequency coefficients, the differences in the frequency coefficients are encoded instead of directly encoding the coefficients.
JPEG compression of an image is done in three steps: (a) division of the image into 8 × 8 matrix and applying discrete cosine transform (DCT) on each matrix, (b) quantization of the frequency coefficients obtained in step (a), and (c) conversion of the quantization levels into bits. Compression ratios of 30:1 can be achieved using this technique.
Compression ratios of 30:1 can be achieved using JPEG compression. In other words, a 300kB image can be reduced to about 10kB.
Note | JPEG image compression is used extensively in Web page development. As compared to the bit mapped files (which have a .bmp extension), the JPEG images (which have a .jpg extension) occupy less space and hence can be downloaded fast when we access a Web site. |
| < Day Day Up > |
|