Double Compression Of JPEG Image Using DWT Over RDWT *Pamarthi Naga Basaveswara Swamy, ** Gottipati. Srinivas Babu *P.G Student, Department of ECE, NRI Institute of Technology, pnbswamy1992@gmail.com **Associate Professor, Department of ECE, NRI Institute of Technology, gsrinivasbabu@yahoo.co.in ABSTRACT Reconstruction of the history of an image is a difficult process with visual document analysis. Suppose, if an image undergo double compression, then the compressed image is not the exact bit stream generated by the camera at the time of captured. This is possible by predicting the bits that were not provided by the sensor device. The forensics and for reconstructing the image the following process is applied. Selecting the quantization in a structural way is performed. The selection of only first quantization is because the second quantization produces a low level of pixels when compared to the first level bits. The quantization matrix will help in obtaining the range extension and can reduce the long estimations; this will help in detecting the error when the system is compressed. To improve the results, quantization step estimation is proposed for this a filtration approach has to be applied. The existing technique Discrete Cosine Transformation is improved by implementing the DWT and RDWT. Hence these proposed techniques DWT and RDWT are to be implemented and the experimental results are to be compared in a programmatic way (i.e., MATLAB Software). This shows the effectiveness of the proposed models. Keyword: Predicting, Reconstruction, Double JPEG Compression, Digital Tampering, First Quantization, Discrete Wavelet Transformation, Redundant Discrete Wavelet Transformation, Discrete Cosine Transformation. 1. INTRODUCTION Image compression is very important for efficient transmission and storage of images. Demand for communication of multimedia data through the telecommunications network and accessing the multimedia data through Internet is growing explosively [1]. With the use of digital cameras, requirements for storage, manipulation, and transfer of digital images, has grown explosively. These image files can be very large and can occupy a lot of memory. A gray scale image that is 256 x 256 pixels has 65, 536 elements to store and a typical 640 x 480 color image has nearly a million. Downloading of these files from internet can be very time consuming task. Image data comprise of a significant portion of the multimedia data and they occupy the major portion of the communication bandwidth for multimedia communication. Therefore development of efficient techniques for image compression has become quite necessary. A common characteristic of most images is that the neighboring pixels are highly correlated and therefore contain highly redundant information. 1.1 The Flow of Image Compression Coding What is the so-called image compression coding? Image compression coding is to store the image into bit-stream as compact as possible and to display the decoded image in the monitor as exact as possible. Now consider an encoder and a decoder as shown in Fig.1. When the encoder receives the original image file, the image file will be converted into a series of binary data, which is called the bit-stream [2]. The decoder then receives the encoded bit-stream and decodes it to form the decoded image. If the total data quantity of the bitstream is less than the total data quantity of the original image, then this is called image compression. The full compression flow is as shown in Fig.1. Fig.1The Basic Flow of Image Compression Coding The compression ratio is defined as follows: n1 Cr, (i) n2 where n1 is the data rate of original image and n2 is encoded bit-stream. In order to evaluate the performance of the image compression coding, it is necessary to define a measurement that can estimate the difference between the original image and the decoded image. Two common used measurements are the Mean Square Error (MSE) and the Peak Signal to Noise Ratio (PSNR), which are defined in (ii) and (iii ), respectively. f(x,y) is the pixel value of the original image, and f (x,y)is the pixel value of the decoded image. Most image compression systems are designed to minimize the MSE and maximize the PSNR. www.ijrcct.org Page 1113
M S E P S N R W 1 H 1 x 0 y 0 2 0 l o g f ( x,) y '( f,) x y 1 0 W H 2 5 5 M S E 2. DOUBLE COMPRESSION A double compressed JPEG file is created when a JPEG image is decompressed and then resaved with a different quantization matrix. There are two reasons why forensic experts should be interested in double compressed images and the estimation of the primary (first) quantization table. First, double compressed JPEG images often result from digital manipulation (forgeries) when a portion of the manipulated image is replaced with another portion from another image and resaved. In this case, the pasted portion will likely exhibit traces of only a single compression while the rest of the image will exhibit signs of double compression[3]. This observation could in principle be used to identify manipulated areas in digital images. Second, double compressed images are often produced by steganographic programs for some steganalytic methods it is very important to estimate the primary quantization matrix to facilitate accurate and reliable steganalysis. By double compression repeated JPEG compression of the image with different 1 quantization matrices Q (primary matrix) and Q (secondary matrix). The DCT coefficient D ij is said 1 to be double compressed if and only if Q ij Q ij 2. The general encoding architecture of image compression system is shown is Fig. 2. The fundamental theory and concept of each functional block will be introduced in the following sections. Fig. 2 The General Encoding Flow of Image Compression 2.1 Reduce the Correlation Between Pixels Why an image can be compressed? The reason is that the correlation between one pixel and its neighbor pixels is very high, or we can say that the values of one pixel and its adjacent pixels are very similar. Once the correlation between the pixels is reduced, we can take advantage of the statistical characteristics and the variable length coding theory to reduce the storage quantity. This is the 2 2 (ii) (iii) most important part of the image compression algorithm; there are a lot of relevant processing methods being proposed. The best-known methods are as follows: Predictive Coding: Predictive Coding such as DPCM (Differential Pulse Code Modulation) is a lossless coding method, which means that the decoded image and the original image have the same value for every corresponding element. Orthogonal Transform: Karhunen-Loeve Transform (KLT) and Discrete Cosine Transform (DCT) are the two most well-known orthogonal transforms. The DCT-based image compression standard such as JPEG is a lossy coding method that will result in some loss of details and unrecoverable distortion. Subband Coding: Sub band coding such as Discrete Wavelet Transform (DWT) is also a lossy coding method. The objective of sub band coding is to divide the spectrum of one image into the lowpass and the high pass components. JPEG 2000 is a 2-dimension DWT based image compression standard. 2.2 Quantization The objective of quantization is to reduce the precision and to achieve higher compression ratio. For instance, the original image uses 8 bits to store one element for every pixel; if we use less bits such as 6 bits to save the information of the image, then the storage quantity will be reduced, and the image can be compressed. The shortcoming of quantization is that it is a lossy operation, which will result into loss of precision and unrecoverable distortion. The image compression standards such as JPEG and JPEG 2000 have their own quantization methods, and the details of relevant theory will be introduced in the below chapter. 2.3 Entropy Coding The main objective of entropy coding is to achieve less average length of the image. Entropy coding assigns codewords to the corresponding symbols according to the probability of the symbols. In general, the entropy encoders are used to compress the data by replacing symbols represented by equal-length codes with the codewords whose length is inverse proportional to corresponding probability [4-6]. 3. DCT COMPRESSION JPEG Joint Picture Expert Group Fig. 2 and 3 shows the Encoder and Decoder model of JPEG. We will introduce the operation and fundamental theory of each block in the following sections. www.ijrcct.org Page 1114
Fig. 2 The Encoder Model of JPEG Compression Standard. 3.1 Discrete Cosine Transform As learned, that the energy of nature image are concentrated in low frequency, so DCT transform is used to separate low frequency and high frequency. And then reserve the low frequency component as far as possible, and subtract the high frequency component to achieve reduction of compression rate. The next step after color coordinate conversion is to divide the three color components of the image into many 8 8 blocks. The mathematical definition of the Forward DCT and the Inverse DCT are as follows: Forward DCT N1 N1 2(2 1)(2 1) x u y v F( u,)()()( v C,)cos u C v f xcos y N x0 y0 2N 2N for u0,..., N1 and v0,..., N1 1/ 2 for k 0 where N8 and C() k 1 otherwise (iv) Inverse DCT N1 N1 2(2 1)(2 1) x u y v f( x,)()()( y,)cos C u C v F ucos v N u0 v0 2N 2N for x0,..., N1 and y0,..., N1 where N8 (v) The f(x,y) is the value of each pixel in the selected 8 8 block, and the F(u,v) is the DCT coefficient after transformation. The transformation of the 8 8 block is also a 8 8 block composed of F(u,v). The DCT is closely related to the DFT. Both of them taking a set of points from the spatial domain and transform them into an equivalent representation in the frequency domain. However, why DCT is more appropriate for image compression than DFT The two main reasons are: 1. The DCT can concentrate the energy of the transformed signal in low frequency, whereas the DFT cannot. According to Parseval s theorem, the energy is the same in the spatial domain and in the frequency domain. Because the human eyes are less sensitive to the high frequency component, we can focus on the low frequency component and reduce the Fig. 3 The Decoder Model of JPEG Compression Standard contribution of the high frequency component after taking DCT. 2. For image compression, the DCT can reduce the blocking effect than the DFT. The difference is that while the DFT takes a discrete signal in one spatial dimension and transforms it into a set of points in one frequency dimension and the Discrete Cosine Transform (for an 8x8 block of values) takes a 64-point discrete signal, which can be thought of as a function of two spatial dimensions x and y, and turns them into 64 DCT coefficients which are in terms of the 64 unique orthogonal 2D spectrum shown in below figure Fig.4 Two-dimensional Spatial Frequencies Redundant discrete wavelet transform (RDWT), another variant of wavelet transform, is used to overcome the shift variance problem of DWT. It has been applied in different signal processing applications but it is not well researched in the field of medical image fusion. RDWT can be considered as an approximation to DWT that removes the down-sampling operation from traditional critically sampled DWT, produces an over-complete representation, and provides noise per-sub band relationship.the shift variant characteristic of DWT arises from the use of down-sampling whereas RDWT is shift invariant because the spatial sampling rate is fixed across scale. Similar to DWT, RDWT and Inverse RDWT (IRDWT) of a two dimensional image or three dimensional volume data is obtained by computing each dimension separately where detailed and approximation bands are of the same size as the input image/data [7]. This technique first decomposes an image into coefficients called sub-bands and then the resulting coefficients are compared with a threshold. www.ijrcct.org Page 1115
Coefficients below the threshold are set to zero. Finally, the coefficients above the threshold value are encoded with a loss less compression technique [9-12]. The compression features of a given wavelet basis are primarily linked to the relative scarceness of the wavelet domain representation for the signal. The notion behind compression is based on the concept that the regular signal component can be accurately approximated using the following elements: a small number of approximation coefficients (at a suitably chosen level) and some of the some of the detail coefficients [13]. Fig. 5The Structure of The Wavelet Transform Based Compression. The steps of the proposed compression algorithm based on DWT are described below: I. Decompose Choose a wavelet; choose a level N. Compute the wavelet. Decompose the signals at level N. Fig.6 DWT Two Level Decomposition Tree The DWT is computed by successive low pass and high pass filtering of the discrete time-domain signal as shown in figure. This is called the Mallat algorithm or Mallat-tree decomposition. Its significance is in the manner it connects the continuous-time muti resolution to discrete-time filters. In the figure, the signal is denoted by the sequence x[n], where n is an integer. The low pass filter is denoted by G 0 while the high pass filter is denoted by H 0. At each level, the high pass filter produces detail information; d[n], while the low pass filter associated with scaling function produces coarse approximations, a[n]. At each decomposition level, the half band filters produce signals spanning only half the frequency band. This doubles the frequency resolution as the UN certainty in frequency is reduced by half. In accordance with Nyquist s rule if the original signal has highest frequency of ω, which requires a sampling frequency of 2ω radians, then it now has a highest frequency of ω/2 radians. It can now be sampled at a frequency of ω radians thus discarding half the samples with no loss of information. This decimation by 2 halves the time resolution as the entire signal is now represented by only half the number of samples. Thus, while the half band low pass filtering removes half of the frequencies and thus halves the resolution, the decimation by 2 doubles the scale. With this approach, the time resolution becomes arbitrarily good at high frequencies, while the frequency resolution becomes arbitrarily good at low frequencies. The filtering and decimation process is continued until the desired level is reached. The maximum number of levels depends on the length of the signal. II. Threshold detail coefficients For each level from 1 to N, a threshold is selected and hard thresholding is applied to the detail coefficients. III. Reconstruct Compute wavelet reconstruction using the original approximation coefficients of level N and the modified detail coefficients of levels from 1 to N. Multi-Resolution Analysis using Filter Banks The RDWT is computed by successive low pass and high pass filtering of the discrete time-domain signal as shown in figure. This is called the Mallat algorithm or Mallat-tree decomposition. Its significance is in the manner it connects the continuous-time muti resolution to discrete-time filters. In the figure, the signal is denoted by the sequence x[n], where n is an integer. The low pass filter is denoted by G 0 while the high pass filter is denoted by H 0. At each level, the high pass filter produces detail information; d[n], while the low pass filter associated with scaling function produces coarse approximations, a[n]. Fig. 7 Two Level Wavelet Decomposition Tree. RDWT decomposes an image into four sub bands such that the size of each sub band is equal to the size of original image because RDWT removes the down sampling operation from the critically sampled DWT Compression Steps: 1. Digitize the source image into a signal s, which is a string of numbers. www.ijrcct.org Page 1116
2. Decompose the signal into a sequence of wavelet coefficients w. 3. Use threshold to modify the wavelet coefficients from w to w. 4. Use quantization to convert w to a sequence q. 5. Entropy encoding is applied to convert q into a sequence. RESULT (a) (a) (b) (b) (c) Fig. 9: RDWT (a) Original Image (b) Reconstructed Image (c) Error Image (c) Fig.8: DWT (a) Original Image, (b) Image Reconstruction (c) Image Error www.ijrcct.org Page 1117
Table 1: Comparisons of Compression Techniques CONCLUSION AND FUTURE WORK The DCT-based image compression such as JPEG performs very well at moderate bit rates; however, at higher compression ratio, the quality of the image degrades because of the artifacts resulting from the block-based DCT scheme. Wavelet-based coding such as JPEG 2000 on the other hand provides substantial improvement in picture quality at low bit rates because of overlapping basis functions and better energy compaction property of wavelet transforms. Because of the inherent multi-resolution nature, wavelet-based coders facilitate progressive transmission of images thereby allowing variable bit rates. In this paper, comparing the results of different transform coding techniques is performed i.e. Discrete Cosine Transform (DCT), Discrete Wavelet Transform (DWT) and Redundant Wavelet Transform (RDWT). DWT provides higher compression ratios & avoids blocking artifacts, allows good localization both in spatial & frequency domain. Based on PSNR and MSE values of DCT, DWT and RDWT it is observed that DWT is better than DCT and RDWT with large number of co-efficients and at high compression ratios. The main objectives of this paper are: 1. Reducing the image storage space 2. Easy maintenance and providing security. 3. Data loss cannot effect the image clarity, Lower bandwidth requirements for transmission, Reducing cost. In future when ever need to transfer data it should be a light weighted one. So efficient lossless compression can be used in application like Data hiding which is a main security aspect. REFERENCES [1] R. C. Gonzalea and R. E. Woods, "Digital Image Processing", 2 nd Ed., Prentice Hall, 2004. [2] Liu Chien-Chih, Hang Hsueh-Ming, "Acceleration and Implementation of JPEG 2000 Encoder on TI DSP platform" Image Processing, 2007. ICIP 2007. IEEE International Conference on, Vo1. 3, pp. III- 329-339, 2005. [3] G. K. Wallace, "The JPEG Still Picture Compression Standard", Communications of the ACM, Vol. 34, Issue 4, pp.30-44, 1991. [4] Kamrul Hasan Talukder and Koichi Harada, "Development and Performance Analysis of an Adaptive and Scalable Image Compression Scheme with Wavelets", Published in the Proc. of ICICT, March 2007, BUET, Dhaka, Bangladesh, pp. 250-253, ISBN: 984-32-3394-8. [5] Rao, K.R., Yip, P., Discrete Cosine Transform: Algorithms, Advantages, Applications. Boston: Academic Press, 1990.31 [6] Still Image and video compression with MATLAB, K. S. Thyagarajan, A JOHN WILEY & SONS, INC., PUBLICATION. [7] Subramanya, Image Compression Technique, Potentials IEEE, Vol. 20, Issue 1,pp 19-23, Feb-March 2001. [8] Jackson and Hannah, Comparative Analysis of Image Compression Techniques, System Theory, Proceedings SSST 93, 25th Southeastern Symposium, pp 513-517, 7 9 March 1993. [9] Meyer, Y. Wavelets: their past and their future, Progress in Wavelet Analysis and its Applications. Gif-sur-Yvette, pp 9-18, 1993. [10] Rajesh K. Yadav, S.P. Gangwar & Harsh V. Singh, Study and analysis of wavelet based image compression techniques. International Journal of Engineering, Science and Technology,Vol. 4, No. 1, 2012, pp. 1-7. [11] M. Sifuzzaman & M.R. Islam1 and M.Z. Ali, Application of Wavelet Transform and its Advantages Compared to Fourier Transform Journal of Physical Sciences, Vol. 13, 2009, 121-134. [12] F. Sheng, A. Bilgin, P. J. Sementilli, and M. W. Marcellin, Lossy and lossless image compression using reversible integer wavelet transforms, Image Processing, 1998. ICIP 98. Proceedings. 1998 International Conference on, vol.3, no.4-7, pp.876-880, Oct. 1998. [13] Madhuri A. Joshi, Digital Image Processing, An Algorithmic Approach, PHI, New Delhi, pp. 175-217, 2006. www.ijrcct.org Page 1118