IJSRD - International Journal for Scientific Research & Development Vol. 2, Issue 06, 2014 ISSN (online): 2321-0613 2D Image Compression using DCT + DWT Transform and Comparison with Other Transforms Mr. Rohit Kumar 1 Sukhwinder Singh 2 1 P.G Student 2 P.G Supervisor 1 Department of Electronics engineering 2 Eletrical & Electronic Communication 1,2 PEC University Of Technology, Chandigarh, India Abstract Image compression is a process to remove the redundant information from the image so that only essential information can be stored to reduce the storage size, transmission bandwidth and transmission time. The essential information is extracted such that it can be reconstructed without losing quality and information of the image. In this paper, image compression has been done by the method using DCT and DWT transforms. The comparison of the this combined DCT + DWT method has been done with the previous techniques available i.e. DCT and DWT and it was found that the results of the proposed algorithm are much better than alone DCT and DWT algorithms in terms of peak signal to noise ratio (PSNR), mean square error (MSE) and compression ratio (CR). Key words: CR, DCT, DWT, MSE, PSNR I. INTRODUCTION The increasing demand for multimedia content such as digital images and video has led to great interest in research into compression techniques. The development of higher quality and less expensive image acquisition devices has produced steady increases in both image size and resolution, and a greater consequent for the design of efficient compression systems [1]. Although storage capacity and transfer bandwidth has grown accordingly in recent years, but many applications still require compression. In general, this paper investigates still image compression in the transform domain. Multidimensional, multispectral and volumetric digital images are the main topics for analysis. The main objective is to design a compression system suitable for processing, storage and transmission, as well as providing acceptable computational complexity suitable for practical implementation. The basic rule of compression is to reduce the numbers of bits needed to represent an image. In this paper we will discuss algorithm for DCT, DWT and the combined DCT+DWT. A. Data Compression Model: A data compression system mainly consists of three major Fig 1: Data compression model steps and that are removal or reduction in data redundancy, reduction in entropy, and entropy encoding. A typical data compression system can be labeled using the block diagram shown in Figure 1 It is performed in steps such as image transformation, quantization and entropy coding. JPEG is one of the most used image compression standard which uses discrete cosine transform (DCT) to transform the image from spatial to frequency domain [2]. B. Transform-based Image Compression: Transform refers to changing the coordinate basis of the original signal, such that a new signal has the whole information in few transformed coefficients. The processing of the signals in the transform domain is more efficient as the transformed coefficients are not correlated [3]. A popular image compression framework is the transform based image compression as shown in below Figure 2 (a) Encoder (b)decoder Figure 2 Block diagram of transform based image coder (a) Compression or Encoder (b)decompression or Decoder The first step in the encoder is to apply a linear transform to remove redundancy in the data, followed by quantizing the transform coefficients, and finally entropy coding then we get the quantized outputs. After the encoded input image is transmitted over the channel, the decoder reverse all the operations that are applied in the encoder side and tries to reconstruct a decoded image as close as to the original image [4]. C. Linear Transform: In the encoder side, the first step is to transform the image from the spatial domain to the transformed domain (where the image information is represented in a more compact form) using some known transforms like Discrete Fourier Transform(DFT), Discrete Cosine Transform(DCT), Discrete Wavelet Transform(DWT), and many more. Compression of the original image is not easy, as the energy can be concentrated in the low frequency part of the transform domain. For conservation of energy from the spatial domain to the transformed domain, it is necessary for All rights reserved by www.ijsrd.com 150
the transform to be orthogonal. An ideal image transform should retain the following two properties. These are: (1) Maximum energy compaction (2) Less computational complexity D. Discrete Cosine Transform: DCT is an orthogonal transform, the Discrete Cosine Transform (DCT) attempts to decorrelate the image data. After decorrelation each transform coefficient can be encoded independently without losing compression efficiency. The DCT transforms a signal from a spatial representation into a frequency representation. The DCT represent an image as a sum of sinusoids of varying magnitudes and frequencies. DCT has the property that, for a typical image most of the visually significant information about an image is concentrated in just few coefficients of DCT. After the computation of DCT coefficients, they are normalized according to a quantization table with different scales provided by the JPEG standard computed by psycho visual evidence. Selection of quantization table affects the entropy and compression ratio. The value of quantization is inversely proportional to quality of reconstructed image, better mean square error and better compression ratio [5]. In a lossy compression technique, during a step called Quantization, the less important frequencies are discarded, and then the most important frequencies that remain are used to retrieve the image in decomposition process. After quantization, quantized coefficients are rearranged in a zigzag order for further compressed by an efficient lossy coding algorithm. DCT has many advantages: (1) It has the ability to pack most information in fewest coefficients. (2) It minimizes the block like appearance called blocking artifact that results when boundaries between sub-images become visible [6]. An image is represented as a two dimensional matrix, 2-D DCT is used to compute the DCT Coefficients of an image. The 2-D DCT for an NXN input sequence can be defined as follows D(i,j) = C(i)C(j) x cos ( ) cos ( ) Where, P(x, y) is an input matrix image NxN, (x, y) are the coordinate of matrix elements and (i, j) are the coordinate of coefficients, and C (u) = if u = 0 1 if u > 0 The reconstructed image is computed by using the inverse DCT (IDCT) according to P(x,y)= x cos ( ) cos ( ) The pixels of black and white image are ranged from 0 to 255, where 0 corresponds to a pure black and 255 corresponds to a pure white. As DCT is designed to work on pixel values ranging from -128 to 127, the original block is leveled off by 128 from every entry. Step by step procedure of getting compressed image using DCT and getting reconstructed image from compressed image is explained in the next sections E. Discrete Wavelet Transform (DWT): Wavelets are a mathematical tool for changing the coordinate system in which we represent the signal to another domain that is best suited for compression. Wavelet based coding is more robust under transmission and decoding errors. Due to their inherent multiresolution nature, they are suitable for applications where scalability and tolerable degradation are important. Wavelets are tool for decomposing signals such as images, into a hierarchy of increasing resolutions. The more resolution layers, the more detailed features of the image are shown. They are localized waves that drop to zero. They come from iteration of filters together with rescaling. Wavelet produces a natural multi resolution of every image, including the all-important edges. The output from the low pass channel is useful compression. Wavelet has an unconditional basis as a result the size of the wavelet coefficients drop off rapidly. The wavelet expansion coefficients represent a local component thereby making it easier to interpret. Wavelets are adjustable and hence can be designed to suit the individual applications. Its generation and calculation of DWT is well suited to the digital computer [3]. They are only multiplications and additions in the calculations of wavelets, which are basic to a digital computer. II. PROPOSED ALGORITHM For compression procedure, we require the following steps. The input image is first converted to gray image from colour image, after this whole image is divided into size of 32x32 pixels blocks. Then 2D-DWT applied on each block of 32x32 blocks, by applying 2 D-DWT, four details are produced. Out of four sub band details, approximation detail/sub band is further transformed again by 2D-DWT which gives another four sub-band of 16x16 blocks. Above step is followed to decompose the 16x16 block of approximated detail to get new set of four sub band/ details of size 8x8. The level of decomposition is depend on size processing block obtained initially, i.e. here we are dividing image initially into size of 32x32, hence the level of decomposition is 2. After getting four blocks of size 8x8, we use the approximated details for computation of discrete cosine transform coefficients. These coefficients are then quantize and send for coding. The complete coding scheme for compression is explained in Figure 3. Fig. 3: Compression method using proposed technique All rights reserved by www.ijsrd.com 151
For decompression procedure, we require the following steps. Firstly at the receiver side, we decode the quantized DCT coefficients Then compute the inverse two dimensional DCT (IDCT) of each block. Then block is dequantized. Further we take inverse wavelet transform of the dequantized block. Since the level of decomposition while compressing was two, we take inverse wavelet transform two times to get the same block size i.e. 32x32. This procedure followed for each block received. When all received blocks are converted to 32x32 by this decompression procedure, explained above. We arrange all blocks to get reconstructed image. The complete decoding procedure is explained in Figure 4. Fig. 4: Decompression method using proposed technique The proposed algorithm has better performance as compared to stand alone DWT and DCT in terms of Peak Signal to Noise Ratio (PSNR) and Compression Ratio (CR). III. OBJECTIVE EVALUATION PARAMETERS AND RESULTS A. Mean Square Error (MSE): The MSE is the cumulative squared error between the compressed and the original image. A lower value of MSE means lesser error, and it has the inverse relation with PSNR. Mean square error is a criterion for an estimator: the choice is the one that minimizes the sum of squared errors due to bias and due to variance. In general, it is the average of the square of the difference between the desired response and the actual system output. As a loss function MSE is also called squared error loss [3]. MSE measures the average of the square of the error. The MSE is the second moment of the error, and thus incorporates both the variance of the estimator and its bias. For an unbiased estimator, the MSE is the variance. In an analogy to standard deviation, taking the square root of MSE yields the root mean squared error or RMSE [8]. For an unbiased estimator, the RMSE is the square root of the variance, known as the standard error. 2 MSE = Where, I(x, y) is the original image and I (x, y) is the reconstructed image and m, n are the dimensions of the image. Lower the value of MSE, the lower the error and better picture quality [9]. B. Peak Signal to Noise Ratio (PSNR): PSNR is a measure of the peak error. Many signals have very wide dynamic range, because of that reason PSNR is usually expressed in terms of the logarithmic decibel scale in (db). Normally, a higher value of PSNR is good because it means that the ratio of signal to noise is higher [1]. Here, a signal represents original image and noise represents the error in reconstruction. It is the ratio between the maximum possible power of a signal and the power of the corrupting noise [4]. PSNR decreases as the compression ratio increases for an image. The PSNR is defined as: PSNR = 10*log 10 = 20*log 10 { } PSNR is computed by measuring the pixel difference between the original image and compressed image [10]. Values for PSNR range between infinity for identical images, to 0 for images that have no commonality. C. Compression ratio (CR): Compression ratio (CR) is a measure of the reduction of the detailed coefficient of the data. In the process of image compression, it is important to know how much detailed (important) coefficient one can discard from the input data in order to sanctuary critical information of the original data. Compression ratio can be expressed C R = The CR can be varied to get different image quality. The more the details coefficients are discarded, the higher the CR can be achieved. Higher compression ratio means lower reconstruction quality of the image. D. Subjective evaluation parameter: The visual perception of the reconstructed image is essential. In some cases the objective quality assessment does not give proper information about the quality of the reconstructed image. In such scenarios, it is important to analyze the reconstructed image using subjective analysis that means by human perceptual system [3]. When the subjective measure is considered, viewers focus on the difference between reconstructed and original image and correlates the differences. IV. SIMULATION RESULTS The results of proposed technique are tabulated in table 1. The results are obtained for images of sizes 768 kb and 732 kb. Original and reconstructed images are also shown in fig 5. As we can see in figures given below that there is not much difference between the quality of the Original Image and the Compressed Image, but there is vast difference in the size of both images. In figure 5 (a) the original image of size 768 kb is converted into 30.7 kb size and in figure 5 (b) the original image of size 732 kb is converted into 35.3 kb size, this shows that the proposed technique has very high compression ratio without much loss of the information. All rights reserved by www.ijsrd.com 152
V. COMPARATIVE ANALYSIS Original image (768 kb) Compressed Image (30.7 kb) (a) Original Image (732 kb) Compressed Image (35.3 kb) (b) Figure 5(a) and (b) Results of the proposed technique Table1: Experimental Results of the proposed technique The above table shows the results of the proposed technique in parameters like CR, MSE and PSNR. From the proposed technique we have got compression ratio of 96 % and 95.17 % for different images. The mean square error of these images is 9.32 and 19.09 respectively and The Peak Signal to Noise Ratio is 45.17 and 39.42 respectively. Table2: Comparison between Proposed Technique,DCT and DWT The above table shows the comparative analysis between our proposed technique, DCT and DWT. As we can see that compression ratio of the proposed technique is far better than other methods, In case of MSE the proposed technique results are quiet close to DCT but far better than DWT and the PSNR value of the proposed technique is higher than both DCT and DWT. VI. CONCLUSION This proposed method also gives us very less mean square error (MSE) and high peak signal to noise ratio (PSNR) at higher compression rates. The visual quality of image reconstructed by this method is also very good as compare to other compression methods. The proposed algorithm overcomes the limitation of DCT like blocking artifacts and false contouring. The compression ratio of proposed method is 96%, mean square error is 9.3285 and peak signal to noise ratio is 45.1749 db. It is also suitable for medical images as it is having a good compression ratio along with preserving most of the information. By using proposed technique, the requirement of less memory storage and efficient transmission can be fulfilled. REFERENCES [1] Jain, A. 1989. Fundamentals of Digital Image Processing. Prentice-Hall. [2] Rao, K. and Hwang, J., 1996. Techniques and Standards for Image Video and Audio Coding. Prentice-Hall. [3] Gonzalez, R. and Eugene, R. 2008. Digital image processing. Prentice hall. [4] Mallat, S., April, 1991. A theory for multiresolution signal decomposition. The wavelet Representation, IEEE Trans. Pattern Anal. Machine Intell. vol. 11 pp. 674-693. [5] Thyagarajan, S.K., 2007. Still image and video compression with Matlab. [6] Salomon, D., 2004. Data Compression. The Complete Reference third edn. [7] Topiwala, P. N., 1998 Wavelet image and video compression. Kluwer Academic. [8] Jacquin, A.E., August, 1989. A Fractal Theory of Iterated Markov Operators with Applications to Digital Image Coding. Ph.D. thesis, Georgia Institute of Technology. All rights reserved by www.ijsrd.com 153
[9] Liu, Z., Z. Xiong, Wu, Q., Wang, Y.P. and Castleman, K. 2002. Cascaded differential and wavelet compression of chromosome images. IEEE T. Biomed. Eng., 49(4),pp: 372-383. [10] Sriram. B, Thiyagarajans. S, 31st July 2012. Hybrid Transformation technique for image compression. Journal of theoretical and applied information technology., Vol. 41 No.2. 2D Image Compression using DCT + DWT Transform and Comparison with Other Transforms All rights reserved by www.ijsrd.com 154