SPONSORED LINKS
 
 
Google
 
IMAGE COMPRESSION (JPEG)

JPEG is an acronym for the Joint Photographic Experts Group. It is a group formed as a cooperative effort by the ISO ITU and IEC. The compression standard, commonly known as JPEG Compression, is used to compress both gray scale and photographic­ quality color images. JPEG is lossy: The image obtained after decompression may not be the same as the original. In JPEG, a grace scale picture is divided into blocks of 8 x 8 pixels. JPEG compression consists of three phases, as shown in Figure.
JPEG compression


On the compression side, the image is fed through these three phases, one 8 x 8 block at a time. The first phase applies the discrete cosine transform (DCT) to the block. If you think of the image as a signal in the spatial domain, then DCT transforms this signal into an equivalent signal in the spatial frequency domain. This is a lossless operation but a necessary precursor to the next, lossy step. After the DCT, the second phase applies a quantization to the resulting signal and, in so doing, losses the least significant information contained in that signal. The third phase encodes the final result, but, in so doing, adds an element of lossless compression to the lossy compression achieved by the first two phases. Decompression follows the same three phases, but in reverse order.


4.2.1 Discrete Cosine Transform Phase
Discrete Cosine Transform (DCT) is a transformation closely related to the fast fourier transform (FFT). It takes an 8 x 8 matrix of pixel values as input and output an 8 x 8 matrix of frequency coefficients. You can think of the input matrix as a 64-points signal that is defined in two spatial dimentions (x and y); DCT breaks this signal into 64 spatial frequencies. We show the results of the transformation for the following cases:
Case I: We have a block of uniform gray, and the value of each pixel is 20. Case II: We have block with two different uniform gray scale sections. Case III: We have a block that changes gradually.In the first case, when we do the transformations, we get a non-zero value fort first element (upper left corner); the rest of the pixels have a value of O. The value of T(0,0) is the average (multiplied by constant) of the P(x, y) values and is called t dc value (direct current, borrowed from electrical engineering). The rest of the value called ac values in T(m, n), represent changes in the pixel values. But because the are no changes, the rest of the values are 0's. Uniform gray scale has been shown Figure.
Uniform gray scale.


In the second case, there is a sharp change in the values of the pixels (from to 50). When we do the transformations, we get a dc value as well as non-zero values. However, there are only a few non-zero values clustered around the dc value Most of the values are 0. Block with two different uniform gray scales has been show in Figure.
Two different uniform gray scales

In the third case, there is no sharp change between the values of neighbors: pixels. When we do the transformations, we get a dc value, with many non-zero values also. Block that changes gradually has been shown in Figure.
We can state the following based on Figures. The transformation creates table T from Table P. 2. The dc value is the average value (multiplied by a constant) of the pixels. 3. The ac values are the changes. 4. Lack of changes in neighboring pixels creates 0's.


Gradient gray scale

Quantization Phase
The second phase of JPEG is where the compression becomes lossy. DCT does not itself lose information; it just transforms the image into a form that makes it easier to know what information to remove. Quantization is easy to understand-it's simply a matter of dropping the insignificant bits of the frequency coefficients.
To see how the quantization phase works, imagine that you want to compress some whole numbers less than 100, for example, 45, 98, 23, 66, and 7. If you decided that knowing these numbers truncated to the nearest multiple of 10 is sufficient for your purposes, then you could divide each number by the quantum 10 using integer arithmetic, yielding 4, 9, 2, 6 and 0. These numbers can each be encoded in 4 bits rather than the 7 bits needed to encode the original numbers. After the T-table is created, the values are quantized to reduce the number of bits needed for encoding. Previously, in quantization, we dropped the fraction from each value and kept the integer part. Here we divide the number by a constant and then drop the fraction. This reduces the required number of bits even more. In most implementations, a quantizing table (8 by 8) difines how to quantize each value. The divisor depends on the position of the value in the T-table. This is done to optimize the number of bits and the number of O's for each particular application. Note that the only phase in the process that is not reversible in the quantizing phase. We lose some information here that is not recoverable. As a matter of fact, the only reason why JPEG is called lossy compression is this quantization phase.


Encoding Phase
The final phase of JPEG encodes the quantized frequency coefficients in a compact form. This results in additional compression, but this compression is lossless. Starting with the dc value in position (0, 0), the values are processed in a zigzag sequence.
After quantization, the values are read from the table, and the redundant 0, are removed. However, to cluster the 0's together, the table is read diagonally in a zigzag fashion rather than row by row or column by column. The reason is that if the picture changes smoothly, the bottom right corner of the T-table is all o's Figure illustrates the process.


Process (Reading the table).

BACK

SPONSORED LINKS