Home
Explore
Search
You
slideshare
Upload
Login
Signup
Home
Leadership
Technology
Education
More Topics
Creator's Hub
Collect Leads
Get Started
Tips & Tricks
Tools
For Business
Image compression by ezw combining huffman and arithmetic encoder
Upcoming SlideShare
Loading in...
5
×
1
1
of
11
Like this document? Why not share!
Share
Email
Nota math discrete tree
by Anas Assayuti
1092 views
Lecture 5 trees
by Victor Palmar
372 views
9 trees iv
by ShanKar BishNoi
75 views
Huffman Encoding Pr
by anithabalaprabhu
2000 views
Huffman data compression-decompression
by dipugovind
926 views
Huffman codes
by sonabir
305 views
Share SlideShare
Facebook
Twitter
LinkedIn
Google+
Email
Email sent successfully!
Embed
Size (px)
Start on
Show related SlideShares at end
WordPress Shortcode
Link
Image compression by ezw combining huffman and arithmetic encoder
566
Share
Like
Download
iaeme
Follow
0
0
0
0
Published on
Jun 27, 2013
Published in:
Technology
,
Art & Photos
0 Comments
0 Likes
Statistics
Notes
Full Name
Comment goes here.
12 hours ago
Delete
Reply
Spam
Block
Are you sure you want to
Yes
No
Your message goes here
Post
Be the first to comment
Be the first to like this
No Downloads
Views
Total Views
566
On Slideshare
0
From Embeds
0
Number of Embeds
0
Actions
Shares
0
Downloads
41
Comments
0
Likes
0
Embeds
0
No embeds
No notes for slide
Transcript of "Image compression by ezw combining huffman and arithmetic encoder"
1. International Journal of Computer Engineering and Technology (IJCET), ISSN 0976- 6367(Print), ISSN 0976 – 6375(Online) Volume 4, Issue 3, May – June (2013), © IAEME 297 IMAGE COMPRESSION BY EZW COMBINING HUFFMAN AND ARITHMETIC ENCODER K.P.Paradeshi Associate Professor, Department of Electronics Engineering, PVPIT, Budhgaon,State-Maharashtra ABSTRACT The objective of an image compression algorithm is to exploit the redundancy in an image such that a smaller number of bits can be used to represent the image while maintaining an “acceptable” visual quality for the decompressed image. The embedded zero tree wavelet algorithms (EZW) is a simple, yet remarkably effective, image compression algorithm, having the property that the bits in the bit stream are generated in order of importance, yielding a fully embedded code. EZW is computationally very fast and among the best image compression algorithm known today. This paper proposes a technique for image compression which uses the Wavelet-based Image Coding in combination with Huffman and Arithmetic encoder for further compression. Implementation of Huffman coding followed by arithmetic compression gives another 15% extra compression ratio. Key Words: Image Compression, DWT, Embedded Zero tree Wavelet (EZW), Huffman Encoder, Arithmetic Encoder. I. INTRODUCTION A. Introduction Image compression can improve the performance of the digital systems by reducing time and cost in image storage and transmission without significant reduction of the image quality. Image compression is very important in many applications, especially for progressive transmission, image browsing and multimedia applications. The whole aim is to obtain the best image quality and yet occupy less space. Embedded zero tree wavelet compression (EZW) is a kind of image compression that can realize this goal. EZW algorithm is fairly general and performs remarkably well with most types of images. Also, it is applicable to INTERNATIONAL JOURNAL OF COMPUTER ENGINEERING & TECHNOLOGY (IJCET) ISSN 0976 – 6367(Print) ISSN 0976 – 6375(Online) Volume 4, Issue 3, May-June (2013), pp. 297-307 © IAEME: www.iaeme.com/ijcet.asp Journal Impact Factor (2013): 6.1302 (Calculated by GISI) www.jifactor.com IJCET © I A E M E
2.
International Journal of Computer Engineering and Technology (IJCET), ISSN 0976- 6367(Print), ISSN 0976 – 6375(Online) Volume 4, Issue 3, May – June (2013), © IAEME 298 transmission over a noisy channel. Discrete wavelet transform (DWT) become a cutting edge technology in image data compression. Image compression is typically comprised of three basic steps. Firstly, the image is transformed into wavelet coefficients which are then quantized in a quantizer and finally threshold which makes the coefficient smaller than a chosen threshold value (zero) obtained from the quantizer. As a result, some bits are reduced producing an output bit stream [2]. The main contribution of EZW encoding with Huffman and Arithmetic Encoder is that it visually improves the compression of an image by increasing the decomposition level 8 as compared to the paper Shapiro, J. M. R. B., 1993, “Embedded Image Coding Using Zerotrees of Wavelet Coefficients”[1]. decoder “where” the few non-zeros are!!! Significance map (SM): binary array indicating location of Zero/non zero Coefficients. Typically requires a large fraction of bit budget to specify the SM.Wavelets provide a structure (zerotrees) to the SM that yields efficient coding B. WAVELET TRANSFORMATION OF IMAGES Wavelets [7] are mathematical functions that decompose data into different frequency components, and then study each component with a resolution matched to its scale. They have advantages over traditional Fourier methods [4] in analyzing physical situations where the signal contains discontinuities and sharp spikes. Wavelets were developed independently in the fields of mathematics, quantum physics, electrical engineering, and seismic geology. Interchanges between these fields during the last ten years have led to many new wavelet applications such as image compression, turbulence, human vision, radar, and earthquake prediction. The wavelet transformation [7] is a mathematical tool for decomposition. The wavelet transform is identical to a hierarchical sub band filtering system [3], where the sub bands are logarithmically spaced in frequency. The basic idea of the DWT for a two-dimensional image is described as follows. An image is first decomposed into four parts based on frequency sub bands, by critically sub sampling horizontal and vertical channels using sub band filters and named as Low-Low (LL), Low-High (LH), High- Low (HL), and High- High (HH) sub bands as shown in figure 1. Figure 1: Wavelet Transform Each level has various bands information such as low–low, low–high, high–low, and high–high frequency bands. Furthermore, from these DWT coefficients, the original image can be reconstructed. This reconstruction process is called the inverse DWT (IDWT). If C [m, n] represents an image, the DWT and IDWT on each dimension and separately
3.
International Journal of Computer Engineering and Technology (IJCET), ISSN 0976- 6367(Print), ISSN 0976 – 6375(Online) Volume 4, Issue 3, May – June (2013), © IAEME 299 C. Why Wavelets? Traditional DCT & sub band coding: trends “obscure” anomalies that carry information. E.g., edges get spread, yielding many non-zero coefficients to be coded. Wavelets are better at localizing edges and other anomalies Yields a few non-zero coefficients & many zero coefficients Difficulty: telling the decoder “where” the few non- zeros are!!! Significance map (SM): binary array indicating location of Zero/non zero Coefficients. Typically requires a large fraction of bit budget to specify the SM.Wavelets provide a structure (zero trees) to the SM that yields efficient coding D. EZW ENCODING EZW encoder was originally designed to operate on images (2D-signals) but it can also be used on other dimensional signals. It is based on progressive encoding to compress an image into a bit stream with increasing accuracy. This means that when more bits are added to the stream, the decoded image will contain more detail, a property similar to JPEG encoded images. Using an embedded coding algorithm, an encoder can terminate the encoding at any point thereby allowing a target rate or target accuracy to be met exactly [5, 6]. The EZW algorithm is based on four key concepts: 1) a discrete wavelet transform or hierarchical sub band decomposition, 2) prediction of the absence of significant formation across scales by exploiting the self-similarity inherent in images, 3) entropy-coded successive approximation quantization, and 4) universal lossless data compression which is achieved via adaptive Huffman encoding [8]. The EZW encoder is based on two important observations 1. Natural images in general have a low pass spectrum. When an image is wavelet transformed the energy in the sub bands decreases as the scale decreases (low scale means high resolution), so the wavelet coefficients will, on average, be smaller in the higher sub bands than in the lower sub bands. This shows that progressive encoding is a very natural choice for compressing wavelet transformed images, since the higher sub bands only add detail [8]. 2. Large wavelet coefficients are more important than small wavelet coefficients. These two observations are exploited by encoding the wavelet coefficients in decreasing order, in several passes. For every pass a threshold is chosen against which all the wavelet coefficients are measured. If a wavelet coefficient is larger than the threshold it is encoded and removed from the image, if it is smaller it is left for the next pass. When all the wavelet coefficients have been visited the threshold is lowered and the image is scanned again to add more detail to the already encoded image. This process is repeated until all the wavelet coefficients have been encoded [7]. E. Concept of Zerotree A wavelet transform transforms a signal from the time domain to the joint time-scale domain. i.e. the wavelet coefficients are two-dimensional. To compress the transformed signal not only the coefficient values, but also their position in time has to be coded. When the signal is an image then the position in time is better expressed as the position in space. After wavelet transforming an image it can be represented using trees because of the sub sampling that is performed in the transform. A coefficient in a lower sub band can be thought
4.
International Journal of Computer Engineering and Technology (IJCET), ISSN 0976- 6367(Print), ISSN 0976 – 6375(Online) Volume 4, Issue 3, May – June (2013), © IAEME 300 of as having four descendants in the next higher sub band as shown in Figure 2 the four descendants each also have four descendants in the next higher sub band, which gives a quad tree, with every root having four leafs [9]. A zero tree is defined as a quad-tree of which all nodes are equal to or smaller than the root and the root is smaller than the threshold against which the wavelet coefficients are currently being measured. The tree is coded with a single symbol and reconstructed by the decoder as a quad-tree filled with zeroes [10]. The EZW encoder codes the zero tree based on the observation that wavelet coefficients decrease with scale. In a zero tree all the coefficients in a quad tree are smaller than the threshold if the root is smaller than this threshold. Under this case the whole tree can be coded with a single zero tree (T) symbol [11]. Figure 2: The relation between wavelet coefficients in sub bands as quad tree Raster Scan Morton Scan Figure 3: Different scanning patterns for scanning wavelet coefficients A scanning of the coefficient is performed in such a way that no child node is scanned before its parent. For an N scale transform, the scan begins at the lowest frequency sub band, denoted as LLN, and scans sub bands HLN, LHN, and HHN, at which point it moves on to scale N-1 etc.[12] The two such scanning patterns for a three-scale pyramid can be seen in Figure 2. Note that each coefficient within a given sub band is scanned before any coefficient in the next sub band Given a threshold level T to determine whether a coefficient is significant, a coefficient x is said to be an element of a zero tree for threshold T if itself and all of its descendents are insignificant with respect to T. An element of a zero tree for threshold T is a zero tree root if it is not the descendents of a previously found zero tree root for threshold T, i.e., it is not predictably insignificant from the discovery of a zero tree root at
5.
International Journal of Computer Engineering and Technology (IJCET), ISSN 0976- 6367(Print), ISSN 0976 – 6375(Online) Volume 4, Issue 3, May – June (2013), © IAEME 301 a coarser scale at the same threshold[13]. A zero tree root is encoded with a special symbol indicating that the insignificance of the coefficient at finer scales is completely predictable. The significance map can be efficiently represented as a string of symbols from a 3-symbol alphabet which is then entropy encoded [14]. F. HUFFMAN CODING Huffman coding is an entropy encoding algorithm used for lossless data compression. The term refers to the use of a variable-length code table for encoding a source symbol (such as a character in a file) where the variable length code table has been derived in a particular way based on the estimated probability of occurrence for each possible value of the source symbol. It uses a specific method for choosing the representation for each symbol, resulting in a prefix code that expresses the most common source symbols using shorter strings of bits than are used for less common source symbols. The Huffman algorithm is based on statistical coding, which means that the probability of a symbol has a direct bearing on the length of its representation. The more probable the occurrence of a symbol is, the shorter will be its bit-size representation. In any file, certain characters are used more than others. Using binary representation, the number of bits required to represent each character depends upon the number of characters that have to be represented. Using one bit we can represent two characters, i.e., 0 represents the first character and 1 represents the second character. Using two bits we can represent four characters, and so on[10]. Unlike ASCII code, which is a fixed-length code using seven bits per character, Huffman compression is a variable-length coding system that assigns smaller codes for more frequently used characters and larger codes for less frequently used characters in order to reduce the size of files being compressed and transferred[15]. G. ARITHMATIC CODING Arithmetic coding bypasses the idea of replacing an input symbol with a specific code. It replaces a stream of input symbols with a single floating-point output number. More bits are needed in the output number for longer, complex messages. This concept has been known for some time, but only recently were practical methods found to implement arithmetic coding on computers with fixed-sized registers. The output from an arithmetic coding process is a single number less than 1 and greater than or equal to 0. This single number can be uniquely decoded to create the exact stream of symbols that went into its construction [16]. I.IMPLEMENTATION A. wavelet basis choosing Many issues relating to the choice of filter bank for image compression remain unresolved. Constraints on filter bank include perfect reconstruction, finite-length, and the regularity requirement that the iterated low pass filters involved converge to continuous functions. According to [17], it shows that the bi orthogonal wavelet filter banks have a very good performance for wavelet image compression. They have good localization properties as well as their symmetry allows for simple edge treatments. They also produce good results empirically since the original paper on EZW is using this wavelet basis. Moreover, using
6.
International Journal of Computer Engineering and Technology (IJCET), ISSN 0976- 6367(Print), ISSN 0976 – 6375(Online) Volume 4, Issue 3, May – June (2013), © IAEME 302 properly scaled coefficients, the transformation matrix for a discrete wavelet transforms obtained using these filters is so close to unitary that it can be treated as unitary for the purpose of lossy compression. B. EZW coding algorithm Coding the wavelet coefficients is performed by determining two lists of coefficients: 1. The dominant list D contains information concerning significance of coefficients, which will be coded using Huffman encoding followed by arithmetic coding for further compression 2. The significant list S contains the amplitude values of the significant coefficients, which will undergo uniform scalar quantization followed by Huffman arithmetic coding. Figure 4: Example of decomposition to three resolutions for an 8*8 matrix Significance test The wavelet transform coefficients are scanned for the path as shown in the fig below. In our implemented method, we used Mortan scan as show in Figure 5, which is more accurate and produces standard results Figure 5: Mortan scanning scheme in EZW algorithm Each coefficient is assigned a significance symbols (P, N, Z, T), by comparing with the actual threshold.
7.
International Journal of Computer Engineering and Technology (IJCET), ISSN 0976- 6367(Print), ISSN 0976 – 6375(Online) Volume 4, Issue 3, May – June (2013), © IAEME 303 1. P (significance and positive): if the absolute value of the coefficient is higher than the threshold T and is positive. 2. N (significance and positive): if the absolute value of the coefficient is higher than the threshold T and is negative. 3. T (zerotree): if the value of the coefficient is lower than the threshold T and has only insignificant descendants4. Z (isolated zero): if the absolute value of the coefficient is lower than the threshold T and has one or more significant descendents. The insignificant coefficients of the last sub bands, which do not accept descendents and are not themselves descendents of a zerotree, are also considered to be zero tree.The significance symbols are then placed in a list D which is subjected to Huffman encoding followed by Arithmetic encoding.The dominant list and the significance list are shown below: The dominant list and the significance list are shown below: D1: P N Z T P T T T T Z T T T T T T T P T T S1: 1 0 1 0 D2: Z T N P T T T T T S2: 1 0 0 1 1 0 C. Huffman coding algorithm The steps involved in encoding dominant list D is as follows: 5. In the dominant list since the probability of occurrence of the symbol T is more when compared to others, this symbol should be coded with the less number of bits. 6. The other symbols probability of occurrence are less when compared to the symbol T, they should be coded with more number of bits. 7. After encoding all the symbols with binary digits, a separator is appended to the end of the encoded bit stream to indicate the end of the stream. For e.g.: In the said algorithm to encode the symbols P, N, Z and T we used the binary bits as follows: P is encoded as 1110 N is encoded as 110 Z is encoded as 10 Since the probability of occurrence is less when compared to T. T is encoded as 0 (since the probability of occurrence is more when compared to other bits) Then we insert a separator bits i.e. a stream of 1 s .Here We used 11111 to indicate the end of the bit stream
8.
International Journal of Computer Engineering and Technology (IJCET), ISSN 0976- 6367(Print), ISSN 0976 – 6375(Online) Volume 4, Issue 3, May – June (2013), © IAEME 304 8. After getting bit stream, it converts into decimal number and then converts decimal number into character to get resultant byte stream For e.g. 65 coded as A D. Arithmetic coding algorithm 9. The system model, T, keeps record of the symbols that have been encoded. Based on this table the probability of each symbol is estimated. Probability for symbol m is: (T (m+1)-T (m+2))/T 10. Once character probabilities are known, individual symbols need to be assigned a range along a “probability line,” nominally 0 to 1. It doesn’t matter which characters are assigned which segment of the range, as long as it is done in the same manner by both the encoder and the decoder. Each character is assigned the portion of the 0 to 1 range that corresponds to its probability of appearance. For e.g. Character Probability Range A 1/10 0.10 II. EXPERIMENTS AND RESULTS A. performance of EZW algorithm Firstly, original image is applied to the compression program, EZW encoded image is obtain, which is further compressed by combining Huffman and Arithmetic. To reconstruct compressed image, compressed image is applied to decompression program, by which EZW decoded image is obtained. Compression Ratio (CR) and Peak-Signal-to-Noise Ratio (PSNR) are obtained for the original and reconstructed images. In the experiment the original image “Lena.bmp” having size 256 x 256 (65,536) Bytes). The different statistical values of the image Lena.jpg for Various Thresholds are summarized in the table. Image: Lena.bmp Image Size: 256x256 Parameter TH=5 TH=10 TH=20 TH=30 TH=60 Original File Size(byte) 66614 66614 66614 66614 66614 Compressed File Size(byte) 17852 10075 5181 5181 2328 Compression Ratio(CR) 3.4 5.9 11.5 11.5 25.9 Compression Ratio 3.7 6.6 12.9 12.9 28.6 Bits Per Pixel(Bpp) 2.40 1.37 0.71 0.71 0.31 Peak-Signal-to–noise Ratio (PSNR)(db) 27.79 27.85 27.65 26.61 26.21 Encoding Time (sec) 127.8 87.82 60.19 52.91 27.72 Decoding Time (sec) 334.1 293.5 152.15 140.7 90.63 Total Time(sec) 462.3 353.6 212.34 193.6 118.3
9.
International Journal of Computer Engineering and Technology (IJCET), ISSN 0976- 6367(Print), ISSN 0976 – 6375(Online) Volume 4, Issue 3, May – June (2013), © IAEME 305 Discussion: As mentioned previously, one of the advantages of EZW is that it encodes the image from lossy to lossless in one algorithm. People at the receiver can choose the quality of the image by control the bit budget. As the bit rate increases, you will get more detailed information and of course the image quality becomes better and better. Figure 6 shows this procedure. You can clearly observe some block effect at the lower bit budget; this is due to our implementation in MATLAB which is very slow doing large number of for loop. Figure 7 shows the threshold vs. CR (compression ratio) curve. Figure.6 Decoded image given different bit budget. Left top: highest bit rate (bpp), Right bottom: lowest bit rate (bpp) Figure 7 Thresholds vs. CR 0 5 10 15 20 25 30 35 5 10 20 30 60 C R Threshold Threshold Vs CR Huffman encoder Combine Huffman and Arithmatic encoder
10.
International Journal of Computer Engineering and Technology (IJCET), ISSN 0976- 6367(Print), ISSN 0976 – 6375(Online) Volume 4, Issue 3, May – June (2013), © IAEME 306 The curves of Threshold Verses CR have been calculated and depicted in the figure.7. In which Image encoded using EZW algorithm for 8 level decomposition and compressed using combining Huffman and Arithmetic gives better BPP and PSNR values than Image Compressed directly using Huffman Encoder. III. CONCLUSION A technique for image compression which uses the Wavelet based Image Coding in combining Huffman and Arithmetic encoding is proposed here. This approach utilizes zero tree structure of wavelet coefficients at decomposition level 8 with combining Huffman and Arithmetic encoder is very effectively, which results in higher compression ratio . The algorithm is tested on different images , and it is seen that the results obtained by Image encoded using EZW algorithm and compressed using combining Huffman and Arithmetic are consistently better than these obtained by Image Compressed directly using Huffman Encoder. It is also observed that the results are better than these reported Earlier. Furthermore, since no training of any kind is required, the algorithm is fairly general and performs remarkably well with most types of images. REFERENCES [1] Still Image Compression by Combining EZW Encoding with Huffman Encoder ,Janaki. R Dr.Tamilarasi Assistant Professor ,N.K.R. Govt. Arts College for Women, Namakkal- 637 001. Dr.Tamilarasi.A, Professor & Head Department of MCA, Kongu Engineering College, Perundurai - 638 052. [2] K.P.Soman,K.I.Ramachandran “Insight into Wavelets from theory to practice”. Prentice- Hall of India Private Limited. [3] K.Sayood, “Introduction to Data Compression”, 2nd edition, Academic Press, Morgan Kaufman Publishers, 2000. [4] Rafael C. Gonzalez and Richard E. Woods. Digital Image Processing. Pearson Education, Englewood Cliffs,2002 . [5] Creusere, C.D., A New Method of Robust Image Compression Based on the Embedded Zerotree Wavelet Algorithm, IEEE Transactions on Image Processing, 6, No. 10 (1997), p. 1436-1442. [6] Shapiro, J. M., Embedded Image Coding Using Zerotrees of Wavelet Cefficients, IEEE Transactions on Signal Processing, 41, No. 12 (1993), p. 3445-3462. [7] David Salomon, Data Compression- The Complete Reference, Springer,2004, 3rd edition. [8] S. D. Servetto, K. Ramchandran, and M. T. Orchard, “Image coding based on a morphological representation of wavelet data”, IEEE Trans.Image Processing, vol. 8, pp. 1161-1174, Sept. 1999. [9] Vinay U. Kale & Nikkoo N. Khalsa,International Journal of Computer Science & Communication “Performance Evaluation of Various Wavelets for Image Compression of Natural and Artificia Images”,Vol. 1, No. 1, January-June 2010, pp. 179-184, [10] Tripatjot Singh, Sanjeev Chopra, Harmanpreet Kaur, Amandeep Kaur,Image Compression Using Wavelet and Wavelet Packet Transformation, IJCST Vol.1, Issue 1, September 2010. [11] Kharate G.K., Ghatol A. A. and Rege P. P., “ Image Compression Using Wavelet Packet Tree,” ICGSTGVIP
11.
International Journal of Computer Engineering and Technology (IJCET), ISSN 0976- 6367(Print), ISSN 0976 – 6375(Online) Volume 4, Issue 3, May – June (2013), © IAEME 307 [12] Uytterhoeven G., “Wavelets: Software and Applications”, U. Leuven Celestijnenlaan, Department of Computer Science, Belgium, 1999. [13] Jerome M. Shapiro,” Embedded Image Coding Using Zerotrees of Wavelet Coefficients,” IEE Transactions on Signal Processing, December 1993. [14] Lotfi A. A., Hazrati M. M., Sharei M., Saeb Azhang, “ Wavelet Lossy Image Compression on Primitive FPGA”, IEEE, pp. 445-448, 2005. [15] Kharate G. K., Patil V. H., “Color Image Compression Based On Wavelet Packet Best Tree,” IJCSI International Journal of Computer Science Issues, Vol. 7, Issue 2, No 3, March 2010. [16] chapter 5 of "The Data Compression Book" by Mark Nelson. [17] John D. Villasenor, Benjamin Belzer, and Judy Liao, Wavelet filter Evaluation for Image Compression, IEEE Transaction on Image Processing, Vol 4, NO 8, August 1995. pp1053-1060. [18] B.K.N.Srinivasa Rao and P.Sowmya, “Architectural Implementation of Video Compression Through Wavelet Transform Coding and EZW Coding”, International Journal of Electronics and Communication Engineering & Technology (IJECET), Volume 3, Issue 3, 2012, pp. 202 - 210, ISSN Print: 0976- 6464, ISSN Online: 0976 –6472. [19] Pardeep Singh, Nivedita and Sugandha Sharma, “A Comparative Study: Block Truncation Coding, Wavelet, Embedded Zerotree and Fractal Image Compression on Color Image”, International Journal of Electronics and Communication Engineering & Technology (IJECET), Volume 3, Issue 2, 2012, pp. 10 - 21, ISSN Print: 0976- 6464, ISSN Online: 0976 –6472. [20] S.Anandanarayanan and Dr.S.K.Srivatsa, “A High Performance Novel Image Compression Technique using Huffman Coding with Edge Dection”, International Journal of Computer Engineering & Technology (IJCET), Volume 4, Issue 2, 2013, pp. 17 - 22, ISSN Print: 0976 – 6367, ISSN Online: 0976 – 6375.
×
Be the first to comment