VIEWS: 164 PAGES: 7 CATEGORY: Emerging Technologies POSTED ON: 12/5/2010 Public Domain
(IJCSIS) International Journal of Computer Science and Information Security, Vol. 8, No. 8, November 2010 Hybrid JPEG Compression Using Histogram Based Segmentation M.Mohamed Sathik1 , K.Senthamarai Kannan2 and Y.Jacob Vetha Raj3 1 Department of Computer Science, Sadakathullah Appa College, Tirunelveli, India mmdsadiq@gmail.com 2,3 Department of Statistics, Manonmanium Sundaranar University, Tirunelveli, India senkannan2002@gmail.com jacobvetharaj@gmail.com Abstract-- Image compression is an inevitable solution for lossy compression algorithms obtain high compression image transmission since the channel bandwidth is limited and ratios by exploiting human visual properties. the demand is for faster transmission. Storage limitation is also Vector quantization [4],[5] , wavelet transformation forcing to go for image compression as the color resolution and [1] , [5]-[10] techniques are widely used in addition to spatial resolutions are increasing according to quality various other methods[11]-[17] in image compression. The requirements. JPEG compression is a widely used compression problem in lossless compression is that, the compression technique. JPEG compression method uses linear quantization and threshold values to maintain certain quality in an entire ratio is very less; where as in the lossy compression the image. The proposed method estimates the vitality of the block compression ratio is very high but may loose vital of the image and adapts variable quantization and threshold information of the image. Some of the works carried out in values. This ensures that the vital area of the image is highly hybrid image compression [18]-[19] incorporated different preserved than the other areas of the image. This hybrid compression schemes like PVQ and DCTVQ in a single approach increases the compression ratio and produces a image compression. But the proposed method uses lossy desired high quality output image. compression method with different quality levels based on . the context to compress a single image by avoiding the difficulties of using side information for image Key words-- Image Compression, Edge-Detection, decompression in [20]. Segmentation. Image Transformation, JPEG, The proposed method performs a hybrid Quantization. compression, which makes a balance on compression ratio and image quality by compressing the vital parts of the I. INTRODUCTION image with high quality. In this approach the main subject Every day, an enormous amount of in the image is very important than the background image. information is stored, processed, and transmitted digitally. Considering the importance of image components, and the Companies provide business associates, investors, and effect of smoothness in image compression, this method potential customers with financial data, annual reports, segments the image as main subject and background, then inventory, and product information over the Internet. And the background of the image is subjected to low quality much of the online information is graphical or pictorial in lossy compression and the main subject is compressed with nature; the storage and communications requirements are high quality lossy compression. There are enormous immense. Methods of compressing the data prior to storage amount of work on image compression is carried out both and/or transmission are of significant practical and in lossless [1] [14] [17] and lossy [4] [15] compression. commercial interest. Very few works are carried out for Hybrid Image compression [18]-[20]. Compression techniques fall under two broad In the proposed work, for image compression, the categories such as lossless[1] and lossy[2][3]. The former edge detection, segmentation, smoothing and dilation is particularly useful in image archiving and allows the techniques are used. For edge detection, segmentation image to be compressed and decompressed without losing [21],[22] smoothing and dilation, there are lots of work has any information. And the later, provides higher levels of been carried out [2],[3]. A novel and a time efficient data reduction but result in a less than perfect reproduction method to detect edges and segmentation used in the of the original image. Lossy compression is useful in proposed work are described in section II, section III gives applications such as broadcast television, a detailed description of the proposed method, the results videoconferencing, and facsimile transmission, in which and discussion are given in section IV and the concluding certain amount of error is an acceptable trade-off for remarks are given in section V. increased compression performance. The foremost aim of image compression is to reduce the number of bits needed II. BACKGROUND to represent an image. In lossless image compression algorithms, the reconstructed image is identical to the A. JPEG Compression original image. Lossless algorithms, however, are limited Components of Image Compression System (JPEG). by the low compression ratios they can achieve. Lossy Image compression system consists of three closely compression algorithms, on the other hand, are capable of connected components namely achieving high compression ratios. Though the reconstructed image is not identical to the original image, Source encoder (DCT based) 300 http://sites.google.com/site/ijcsis/ ISSN 1947-5500 (IJCSIS) International Journal of Computer Science and Information Security, Vol. 8, No. 8, November 2010 Quantizer The DCT based encoder can be thought of as essentially Entropy encoder compression of a stream of 8 X 8 blocks of image samples. Figure 2 shows the architecture of the JPEG encoder. Each 8 X 8 block makes its way through each processing Principles behind JPEG Compression. A common step, and yields output in compressed form into the data characteristic of most images is that the neighboring pixels stream. Because adjacent image pixels are highly correlated, are correlated and therefore contain redundant information. the ‘forward’ DCT (FDCT) processing step lays the The foremost task then is to find less correlated foundation for achieving data compression by concentrating representation of the image. Two fundamental components most of the signal in the lower spatial frequencies. For a of compression are redundancy and irrelevancy reduction. typical 8 X 8 sample block from a typical source image, Redundancy reduction aims at removing duplication from most of the spatial frequencies have zero or near-zero the signal source. Irrelevancy reduction omits parts of the amplitude and need not be encoded. In principle, the DCT signal that will not be noticed by the signal receiver, namely introduces no loss to the source image samples; it merely the Human Visual System (HVS). The JPEG compression transforms them to a domain in which they can be more standard (DCT based) employs the use of the discrete cosine efficiently encoded. transform, which is applied to each 8 x 8 block of the After output from the FDCT, each of the 64 DCT partitioned image. Compression is then achieved by coefficients is uniformly quantized in conjunction with a performing quantization of each of those 8 x 8 coefficient carefully designed 64 – element Quantization Table. At the blocks. decoder, the quantized values are multiplied by the Image Transform Coding For JPEG Compression corresponding QT elements to recover the original Algorithm. unquantized values. After quantization, all of the quantized In the image compression algorithm, the input image is coefficients are ordered into the “zig-zag” sequence as divided into 8-by-8 or 16-by-16 non-overlapping blocks, shown in figure 1. This ordering helps to facilitate entropy and the two-dimensional DCT is computed for each block. encoding by placing low-frequency non-zero coefficients The DCT coefficients are then quantized, coded, and before high-frequency coefficients. The DC coefficient, transmitted. The JPEG receiver (or JPEG file reader) which contains a significant fraction of the total image decodes the quantized DCT coefficients, computes the energy, is differentially encoded. inverse two-dimensional DCT of each block, and then puts the blocks back together into a single image. For typical AC01 DCC AC07 images, many of the DCT coefficients have values close to zero; these coefficients can be discarded without seriously affecting the quality of the reconstructed image. A two dimensional DCT of an M by N matrix A is defined as follows M -1 N-1 (2m +1)p (2n +1)q Bpq αpαq Amn cos cos , 0 p M-1 m=0 n=0 2M 2N 0 q N-1 where AC77 αp = 1/2/M ,, 1=p0 M-1 M p Figure 1 Zig-Zag Sequence αq = 1/2/N ,, 1=q0 N-1 N q The JPEG decoder architecture is shown if figure 3 which is the reverse procedure described for compression. The DCT is an invertible transformation and its inverse is given by B. Segmentation M-1 N-1 (2m +1)p (2n +1)q Let D be a matrix of order m x n, represents the Amn αpαq Bpq cos cos , 0 p M-1 m=0 n =0 2M 2N image of width m and height n. The domain for Di,j is 0 q N-1 [0..255] , for any i=1..m, and any j=1.. n. The architecture of segmentation using histogram Where is shown in figure 4. To make the process faster the high resolution input image is down sampled 2 times. When the αp = 1/2/M ,, 1=p0 M-1 M p image is down sampled each time the dimension is reduced by half of the original dimension. So the final down sampled m n image (D) is of the dimension 4 x 4 . The down sampled αq = 1/2/N ,, 1=q0 N-1 N q image is smoothed to get smoothed gray scale image using equation (1). Si,,j = 1/9(Di-1,,j-1 +Di-1,,j +Di-1,,j+1 +Di,,j-1 +Di,,j +Di,,j+1 +Di+1,,j-1 +Di+1,,j +Di+1,,j+1 ) …(1) 301 http://sites.google.com/site/ijcsis/ ISSN 1947-5500 (IJCSIS) International Journal of Computer Science and Information Security, Vol. 8, No. 8, November 2010 8 X 8 blocks FDCT Quantizer Entropy Compressed Encoder image data Quantizer Huffman Source image Table Table Figure 2. JPEG Encoder Block Diagram Compressed Entropy Dequantizer IDCT Image data Decoder Quantizer Huffman Reconstructed Table Table Image Figure 3. JPEG Decoder Block Diagram Bi,j = (Si,j > L) and (Si,j < U) …(5) Down Smooth the Histogram Sample Image Computation 2 Times (D) (S) (H) Up Binary Range Sample Segmentation Calculation 2 Times (B) (L & U) Figure -4 Classifier The histogram(H) is computed for the gray scale image(S). The most frequently present gray scale value (Mh) is determined from the histogram by equation (2) and is shown as indicated by a line in figure 5. Mh = arg{max(H(x))} Figure – 5 …(2) The background value of the images is having the highest frequency in the case of homogenous background. In order After processing the pixel values for background area is 1 in to surmise background textures a range of gray level the binary image B. To avoid the problem of over values are considered for segmentation. The range is segmentation the binary image is subjected to sequence of computed using the equations (3) and (4). morphological operations. The binary image is eroded with L = max( Mh – 30,0) …(3) smaller circular structural element (SE) to remove smaller segments as given in equation (6). U = min( Mh + 30,255) …(4) B BSE …(6) The gray scale image S is segmented to detect the background area of the image using the function given in equation (5) 302 http://sites.google.com/site/ijcsis/ ISSN 1947-5500 (IJCSIS) International Journal of Computer Science and Information Security, Vol. 8, No. 8, November 2010 Then the resultant image is subjected to morphological 10. Quantize the DCT coefficients closing operation with larger circular structural element as 11. Discard lower quantized values based on the given in equation (7). threshold value selected by the selector. B B SE …(7) 12. Compress remaining DCT coefficients by Entropy III. PROPOSED HYBRID JPEG COMPRESSION. Encoder The input image is initially segmented into The architecture of the proposed method is shown in figure background and foreground parts as described in section 6. The Quantization Table is a fixed classical table derived II.B Then the image is divided into 8x8 blocks and DCT from empirical results. The Quantizer quantizes the DCT values are computed for each block. The quantization is coefficients computed by FDCT. The classifier identifies the performed according to the predefined quantization table. class of each pixel by segmenting the given input image. The quantized values are then reordered based on zig-zag The selector and limiter works together to find the discard ordering method described in section II A. The lower values threshold limit. The entropy encoder creates compressed of AC coefficients are discarded from the zig-zag ordered code using the Code Table. The compressed image may be list by comparing the threshold value selected by the stored or transmitted faster than the existing method. selector as per the block’s presences identified by the IV. RESULTS AND DISCUSSION classifier. If the block is present in foreground area then the threshold is set to a higher value by the selector, otherwise a The Hybrid JPEG Compression method is implemented Quantizing Table FDCT Quantizer Input Image Classifier Selector Limiter Code Table Entropy Encoder Compressed Image Figure 6. Hybrid JPEG compression method lower value for threshold is set by the selector. After according to the description in section III and tested with a discarding insignificant coefficients the remaining data are set of test images shown in figure 8. The results obtained compressed by the standard entropy encoder based on the from the implementation of the proposed algorithms are code table. shown in figures 7, 9,10 and table I. Figure 7.a shows the original input image. In Figure 7.b the segmented object Algorithm and background area is discriminated by black and white. 1. Input High Resolution Color image. The compressed bit rates of the twelve test images are computed and tabulated in table 1. The low quality (LQ) and 2. Down sample the input image 2 times. high quality (HQ) JPEG compression is performed and the 3. Convert the down sampled image to gray scale corresponding compression ratios(CR) and PSNR values image (G). are tabulated. The PSNR is higher for HQ and CR is higher for LQ. The Hybrid JPEG compression performs HQ 4. Find histogram (H) of the gray scale image. compression on main subject area and LQ compression on 5. Find the lower (L) and upper (U) gray scale value background area thus the PSNR value at main subject area is of background area. the same for Hybrid JPEG and HQ JPEG. Figure 9 shows the comparison of normalized CRs of Hybrid JPEG and HQ 6. Find Binary segmented image (B) from the gray JPEG, it is observed that almost all of the images are scale image (G) compressed better than classical JPEG compression. Figure 7. Up sample Binary image (B) two times. 10 shows how well the compression ratio is increased than the classical JPEG compression method. 8. Divide the input image into 8x8 blocks 9. Find DCT coefficients for each blocks 303 http://sites.google.com/site/ijcsis/ ISSN 1947-5500 (IJCSIS) International Journal of Computer Science and Information Security, Vol. 8, No. 8, November 2010 a)Input Image b)Segmented Main Subject Area Figure – 7 Input /Output Table -1 Compression Ratio and PSNR values obtained by Hybrid JPEG and JPEG Image LQ Hybrid Hybrid/HQ HQ CR1 PSNR1 CR2 PSNR2 PSNR@ CR3 PSNR3 CR2-CR3 MainSubject 3 26.00 21.52 7.46 27.82 27.84 7.46 27.82 0.0000 5 25.29 22.09 6.80 28.87 28.93 6.80 28.87 0.0004 10 23.83 20.78 5.41 28.09 28.13 5.41 28.09 0.0031 4 24.33 22.08 6.61 31.13 31.20 6.60 31.13 0.0068 11 27.75 25.33 8.62 35.97 36.25 8.61 36.01 0.0198 9 24.92 21.62 6.58 30.45 30.56 6.56 30.51 0.0204 1 27.54 23.03 8.40 29.37 29.40 8.37 29.37 0.0276 7 24.85 17.71 4.01 23.38 23.43 3.92 23.38 0.0911 8 24.63 21.97 6.73 31.05 31.13 6.64 31.10 0.0921 12 29.18 22.73 5.92 28.70 29.07 5.61 28.93 0.3111 6 26.47 20.12 5.54 25.31 25.33 5.19 25.30 0.3449 2 22.84 20.40 7.91 27.93 28.21 7.25 28.06 0.6541 304 http://sites.google.com/site/ijcsis/ ISSN 1947-5500 (IJCSIS) International Journal of Computer Science and Information Security, Vol. 8, No. 8, November 2010 Figure – 8 Test Images (1-12 from Left to Right and Top to Bottom) 1.2 1 Normalized CR 0.8 HyBrid 0.6 HQ Lossy 0.4 0.2 0 1 2 3 4 5 6 7 8 9 10 11 12 Images Figure – 9 Normalized Compression Ratio Obtained for Test Images Increased Compression Ratio by Hybrid JPEG Compression 0.7 0.6 0.5 Compression Ratio 0.4 0.3 0.2 0.1 0 1 2 3 4 5 6 7 8 9 10 11 12 Images Figure – 10 Increased Compression Ratios by Hybrid Compression. V. CONCLUSION the background area is lower in Hybrid JPEG method which is acceptable, since the background area is not vital. The The compression ratio of Hybrid JPEG method is Hybrid JPEG method is suitable for imagery with larger higher than JPEG method in more than 90% of test cases. In trivial background and certain level of loss is permissible. the worst case both Hybrid JPEG and JPEG method gives the same compression ratio. The PSNR value at the main subject area is same for both methods. The PSNR value at 305 http://sites.google.com/site/ijcsis/ ISSN 1947-5500 (IJCSIS) International Journal of Computer Science and Information Security, Vol. 8, No. 8, November 2010 ACKNOWLEDGEMENTS Exploring the Space of Realistic Distortions”, IEEE Transactions on Image Processing, vol. 17, no. 8, pp. 1261–1273, Aug 2008. The authors express their gratitude to University [20] Hong, S. W. Bao, P., “Hybrid image compression model based Grant Commission and Manonmanium Sundaranar on subband coding and edge-preserving regularization”, Vision, Image and Signal Processing, IEE Proceedings, Volume: 147, University for financial assistance under the Faculty Issue: 1, 16-22, Feb 2000 Development Program. [21] Zhe-Ming Lu, Hui Pei ,”Hybrid Image Compression Scheme Based on PVQ and DCTVQ “,IEICE - Transactions on Information and Systems archive, Vol E88-D , Issue 10 ,October REFERENCES 2006 [22] Y.Jacob Vetha Raj, M.Mohamed Sathik and K.Senthamarai [1] Xiwen OwenZhao, Zhihai HenryHe, “Lossless Image Kanna,, “Hybrid Image Compression by Blurring Background Compression Using Super-Spatial Structure Prediction”, IEEE and Non-Edges. The International Journal on Multimedia and its Signal Processing Letters, vol. 17, no. 4, April 2010 383 applications.Vol 2, No.1, February 2010, pp 32-41 [2] Aaron T. Deever and Sheila S. Hemami, “Lossless Image [23] Willian K. Pratt ,”Digital Image Processing” ,John Wiley & Sons, Compression With Projection-Based and Adaptive Reversible Inc, ISBN 9-814-12620-9. Integer Wavelet Transforms”, IEEE Transactions on Image [24] Jundi Ding, Runing Ma, and Songcan Chen,”A Scale-Based Processing, vol. 12, NO. 5, May 2003. Connected Coherence Tree Algorithm for Image Segmentation”, [3] Nikolaos V. Boulgouris, Dimitrios Tzovaras, and Michael IEEE Transactions on Image Processing, vol. 17, NO. 2, Feb Gerassimos Strintzis, “Lossless Image Compression Based on 2008. OptimalPrediction, Adaptive Lifting, and Conditional Arithmetic [25] Kyungsuk (Peter) Pyun, , Johan Lim, Chee Sun Won, and Robert Coding”, IEEE Transactions on Image Processing, vol. 10, NO. M. Gray, “Image Segmentation Using Hidden Markov Gauss 1, Jan 2001 Mixture Models”, ” ,IEEE Transactions on Image Processing, [4] Xin Li, , and Michael T. Orchard “ Edge-Directed Prediction for VOL. 16, NO. 7, JULY 2007 Lossless Compression of Natural Images”, IEEE Transactions on Image Processing, vol. 10, NO. 6, Jun 2001. [5] Jaemoon Kim, Jungsoo Kim and Chong-Min Kyung , “A Lossless Embedded Compression Algorithm for High Definition Video Coding” 978-1-4244-4291 / 09 2009 IEEE. ICME 2009 [6] Rene J. van der Vleuten, Richard P.Kleihorstt ,Christian Hentschel,t “Low-Complexity Scalable DCT Image Compression”, 2000 IEEE. [7] K.Somasundaram, and S.Domnic, “Modified Vector Quantization Method for mage Compression”, ’Transactions On Engineering, Computing And Technology Vol 13 May 2006 [8] Mohamed A. El-Sharkawy, Chstian A. White and Harry ,”Subband Image Compression Using Wavelet Transform And Vector Quantization”, 1997 IEEE. [9] Amir Averbuch, Danny Lazar, and Moshe Israeli ,”Image Compression Using Wavelet Transform and Multiresolution Decomposition”, IEEE Transactions on Image Processing, vol. 5, NO. 1, Jan 1996. [10] Jianyu Lin, Mark J. T. Smith,” New Perspectives and Improvements on the Symmetric Extension Filter Bank for Subband /Wavelet Image Compression”, IEEE Transactions on Image Processing, vol. 17, NO. 2, Feb 2008. [11] Yu Liu, Student Member, and King Ngi Ngan, “Weighted Adaptive Lifting-Based Wavelet Transform for Image Coding “,IEEE Transactions on Image Processing, vol. 17, NO. 4, Apr 2008. [12] Michael B. Martin and Amy E. Bell, “New Image Compression Techniques Using Multiwavelets and Multiwavelet Packets” ,IEEE Transactions on Image Processing, vol. 10, NO. 4, Apr 2001. [13] Roger L. Claypoole, Jr , Geoffrey M. Davis, Wim Sweldens ,“Nonlinear Wavelet Transforms for Image Coding via Lifting” , IEEE Transactions on Image Processing, vol. 12, NO. 12, Dec 2003. [14] David Salomon, “Data Compression , Complete Reference”, Springer-Verlag New York, Inc, ISBN 0-387-40697-2. [15] Eddie Batista de Lima Filho, Eduardo A. B. da Silva Murilo Bresciani de Carvalho, and Frederico Silva Pinagé “Universal Image Compression Using Multiscale Recurrent Patterns With Adaptive Probability Model” , IEEE Transactions on Image Processing, vol. 17, NO. 4, Apr 2008. [16] Ingo Bauermann, and Eckehard Steinbach, “RDTC Optimized Compression of Image-Based Scene Representations (Part I): Modeling and Theoretical Analysis” , IEEE Transactions on Image Processing, vol. 17, NO. 5, May 2008. [17] Roman Kazinnik, Shai Dekel, and Nira Dyn , ”Low Bit-Rate Image Coding Using Adaptive Geometric Piecewise Polynomial Approximation”, IEEE Transactions on Image Processing, vol. 16, NO. 9, Sep 2007. [18] Marta Mrak, Sonja Grgic, and Mislav Grgic ,”Picture Quality Measures in Image Compression Systems”, EUROCON 2003 Ljubljana, Slovenia, 0-7803-7763-W03 2003 IEEE. [19] Alan C. Brooks, Xiaonan Zhao, , Thrasyvoulos N. Pappas., “Structural Similarity Quality Metrics in a Coding Context: 306 http://sites.google.com/site/ijcsis/ ISSN 1947-5500