Lossy dictionary-based image compression method - Semantic Scholar

Report 6 Downloads 69 Views
Image and Vision Computing 25 (2007) 883–889 www.elsevier.com/locate/imavis

Lossy dictionary-based image compression method Gabriela Dudek *, Przemysław Borys, Zbigniew J. Grzywna Section of Physics and Applied Mathematics, Department of Physical Chemistry and Technology of Polymers, Faculty of Chemistry, Silesian University of Technology, Ks. M. Strzody 9, 44-100 Gliwice, Poland Received 28 June 2005; received in revised form 27 March 2006; accepted 5 July 2006

Abstract In this paper, we report on the new method of image compression. The method is based on LZ77 dictionary algorithm. We introduce two modifications such as quantization and noise levels. Experimental results presented in this paper prove that the new method of image compression gives promising results as compared with original LZ77 dictionary algorithm and JPEG2000. Ó 2006 Elsevier B.V. All rights reserved. Keywords: Image; Compression; LZ77; Quantization; Noise

1. Introduction The data compression [1–6] has always been important, and it becomes even more popular and important nowadays. In many cases the data compression is necessary due to huge requirements of storage and time, especially in problems of information transmission. One of the well-known algorithms is the Lempel–Ziv, or LZ77, compression scheme [7]. It is a lossless ‘‘dictionary based’’ compression algorithm. Dictionary-based algorithms scan a file for sequences of data that occur more than once. These sequences are then stored in a dictionary and within the compressed file references are put wherever repetitive data occurred. In this paper, we compare the new method of image compression (in which we introduce quantization and noise ratio parameters) with original LZ77 dictionary algorithm and JPEG2000 [8–10]. Comparison is done by using the image of Lena shown in Fig. 1, and the microscopic image of diamond shown in Fig. 2. Lena is chosen as a reference point, while the microscopic image of diamond is supplied by our research, on

*

Corresponding author. Tel.: +48 032 2371067; fax: +48 032 2371722. E-mail address: [email protected] (G. Dudek).

0262-8856/$ - see front matter Ó 2006 Elsevier B.V. All rights reserved. doi:10.1016/j.imavis.2006.07.001

the methods for investigating self similarity of different images [11–13]. 2. Methods The method of image compression which we present in this paper is based on the LZ77 [14,15] compression algorithm. This compression algorithm [16,17] maintains its dictionary within the data themselves. The look ahead buffer in our approach has length of 255 bytes; the dictionary size is 65,535 bytes. In order to test the modified LZ77 compression algorithm we compress the image of Lena and the microscopic image of diamond. Similar compression was obtained for both sets, i.e. the compression ratio for image of Lena equals 4.0, and 3.8 for diamond, respectively. In this case PSNR equals 57.5 for Lena and 24.8 for diamond. The decompressed images have shown no differences as compared with original (Fig. 3). 2.1. Quantization In our procedure, we compress only identical blocks (LZ77) or we try to compress blocks that are similar, i.e. they differ in grey levels only slightly. This incorporates the quantization into the process. The pixel values, which

884

G. Dudek et al. / Image and Vision Computing 25 (2007) 883–889

Fig. 1. The image of Lena.

Fig. 3. The decompressed image of Lena (a), and diamond (b).

Fig. 2. The microscopic image of diamond.

are between thresholds of quantization can be represented by one of the neighboring values. The condition for quantization reads [18–20] eq > j^x  xj

ð1Þ

where eq is the quantization threshold, ^x is the quantized value and x is the non-quantized value. We can define a measure for the distance of two blocks of pixels, of the some length as X kða; bÞ ¼ sgn½jai  bi j ð2Þ

Quantization can be included to the encoding process by modifying the measure function into X sgn½1 þ sgn½jai  bi j  eq  ð4Þ kða; bÞ ¼ i

that is we count the wrong pixels only when the difference in their values exceeds quantization threshold. Note, that this quantization method does not reduce the histogram of image to a smaller spectrum of colors. It only sets a new criterion for similarity in compression. 2.2. Noise

i

where ai and bi are the subsequent pixels of blocks a and b. Now, if in standard approach kða; bÞ ¼ 0 then ‘‘b’’ can be coded as a callback to ‘‘a’’.

ð3Þ

The counting of repeated sequences of boxes can be load with some percentage of mistakes which exceed the quantization threshold. Sequences of boxes, which do not differ much in the number of incorrect boxes, can be recognized as the same, and recorded as identical.

G. Dudek et al. / Image and Vision Computing 25 (2007) 883–889

885

Fig. 4. Influence of quantization on PSNR for Lena and diamond images.

Recall, that k(a, b) is the function which measures the number of differences in the blocks. Define l(a) as the length of block ‘‘a’’. Then, if kða; bÞ < Noise ratio lðaÞ

ð5Þ

we can accept two blocks as being identical. In such a way we introduce noise ratio to image which enlarges the compression of image considerably, but also worsens its quality (Fig. 6). Physically, we can associate this noise ratio with the noise put by imaging devices at the moment of image acquisition. The noise ratio parameter should not be confused with PSNR, which is considered here as a measure of noise introduced by compression, and not measure of the noise introduced by imaging devices. 3. Results 3.1. The influence of quantization on the level of compression The level of quantization has great positive impact on compression but, unfortunately, on PSNR as well. We present this influence of quantization on PSNR for the image of Lena, and diamond in the Fig. 4. As can be seen from Fig. 4 PSNR is decreasing function of quantization in both investigated cases. The values for PSNR and compression ratio versus quantization are shown in Table 1.

Table 1 PSNR and compression ratio versus quantization for Lena and diamond images Quantization accuracy

PSNR (dB)

Compression ratio

Image of Lena

Image of diamond

Image of Lena

Image of diamond

35 30 25 20 15 10 5 0

21.8 22.5 24.1 25.7 27.7 29.7 36.4 57.5

19.9 20.7 21.3 22.2 23.2 23.9 24.6 24.8

52 47 39 29 22 15 9 4

35 19 16 13 10 8 6 4

Fig. 5. The decompressed image of Lena. (a) Quantization 0; compression ratio 4, PSNR 57.5 dB, (b) quantization 10; compression ratio 15, PSNR 29.7 dB, (c) quantization 30; compression ratio 47, PSNR 22.5 dB.

886

G. Dudek et al. / Image and Vision Computing 25 (2007) 883–889

Table 2 PSNR and compression ratio on noise dependence for Lena and diamond images Noise ratio

35 30 25 20 15 10 7 5 0

PSNR (dB)

Compression ratio

Image of Lena

Image of diamond

Image of Lena

Image of diamond

26.5 29.2 30.7 33.2 35.7 40.1 44.5 45.6 45.7

19.0 19.0 19.0 19.0 19.7 22.0 23.5 26.0 29.9

8 7 7 6 6 5 5 5 4

5 5 5 4 4 4 4 4 4

3.2. The visual inspection of decompressed image of Lena upon quantization For visual inspection we present the decompressed images of Lena (Fig. 5). In Fig. 5a the decompressed image of Lena for quantization accuracy equal 0 is presented. In Fig. 5b and c the levels of quantization equal 10 and 30, respectively, are shown. We notice that the level of quantization has great impact on the quality of received images, as well as on the degree of their compression. In cases, when compression ratio is high (PSNR is small), the decompressed image of Lena looks poorer than in cases of low compression ratio (the level of quantization is smaller then). We observe this relation because the interval of the grey levels is wider when the quantization accuracy grows. 3.3. The influence of noise ratio on the level of compression For the Lena and diamond images the values of PSNR and compression ratio depending on the noise ratio are presented in Table 2. (This relationship is also presented graphically in Fig. 6). We can notice that for small values of noise ratio there is no influence on PSNR and compression ratio. There is a specific point of which the degree of Lena’s and diamond’s image compression starts to grow. For the image of Lena

Fig. 6. The influence of noise ratio on PSNR for Lena and diamond images.

Fig. 7. The decompressed image of Lena. (a) Noise ratio 0; compression ratio 4, PSNR 15.5 dB, (b) noise ratio 15; compression ratio 6, PSNR 20.6 dB, (c) noise ratio 30; compression ratio 7, PSNR 29.2 dB.

G. Dudek et al. / Image and Vision Computing 25 (2007) 883–889

this specific point is placed for noise ratio equals 7 whilst for the image of diamond it is equal to 15. This threshold refers to the self similarity level found in the image. Table 3 PSNR and compression ratio to noise ratio dependence for image of Lena and diamond when the quantization accuracy equals 30 Noise ratio

15 10 5 2

PSNR (dB)

Compression ratio

Image of Lena

Image of diamond

Image of Lena

Image of diamond

18.1 19.8 21.3 22.5

16.7 18.1 19.8 20.7

65 65 52 43

38 30 25 24

887

Noise has smaller impact on compression than quantization. This is because quantization allows to have more mistakes (however of small magnitude) in a coded block than the noise ratio does. 3.4. The visual inspection of the decompressed image of Lena dependence on noise ratio For visual inspection we present in Fig. 7 the decompressed images of Lena for various noise on compression ratio and PSNR. We can see that the increase of noise ratio influences the quality of image. This is occupied by higher PSNR.

Fig. 8. The decompressed image of Lena when the quantization accuracy equals 30. (a) Noise ratio 2; compression ratio 43, PSNR 22.5 dB, (b) noise ratio 5; compression ratio 52, PSNR 21.3 dB, (c) noise ratio 10; compression ratio 65, PSNR 19.8 dB, (d) noise ratio 15; compression ratio 65, PSNR 18.1 dB.

888

G. Dudek et al. / Image and Vision Computing 25 (2007) 883–889

3.5. Influence of quantization accuracy and noise ratio on the level of compression We can obtain higher compression for the image of Lena when the level of quantization and noise ratio is large enough. Therefore, we compress the image of Lena for the different values of noise ratio, keeping the quantization accuracy equal 30. The received values of PSNR and compression ratio are presented in Table 3. For visual inspection we present the decompressed images of Lena in Fig. 8. In all cases the quantization accuracy equals 30. As can be seen from above we can obtain the large compression for the image of Lena in the mentioned case. This large compression influences very much the visual effect of the decompressed image. We obtain small PSNR. As expected, when we increase the level of noise we receive fuzzier image of Lena. 3.6. Comparison with JPEG2000 compression method Additionally, we compress the image of Lena using JPEG2000 method. During decompressing the image of Lena, we change quality from 90 to 2. For each quality, we calculate PSNR, and check how this lossy compression influences the decompressed image. Next, we compare the effect compression the image of Lena using JPEG2000 against our method. We choose three decompressed images of Lena in which compression ratio is similar (equals about 9). The result of comparison between these two methods is presented in Fig. 9. It shows the decompressed image of Lena when use the JPEG2000 algorithm. Fig. 9b and c presents new method of image compression when quantization accuracy equals 5 (Fig. 9b), and when noise ratio equals 35 (Fig. 9c). We observe that when we compress images through new method we obtain comparable image of Lena with JPEG2000 compression method. The introduction of noise ratio causes the creation of holes in the decompressed images. 4. Discussion

Fig. 9. The decompressed images of Lena for different compression methods. (a) JPEG2000, compression ratio 10, PSNR 40.5 dB, (b) quantization accuracy: 5, compression ratio 9, PSNR 36.4 dB, (c) noise ratio 35; compression ratio 8, PSNR 26.5 dB.

In this paper, we compare the method of image compression based roughly on LZ77 dictionary algorithm and JPEG2000, with the new method in which modifications such as quantization and noise ratio were introduced. The method of image compression based on the LZ77 compression algorithm led to the compression ratio equal about 4 for our test images. When we introduce the quantization and noise ratio we can increase the level of image compression remarkably (up to 65 times). However, increasing the level of compression we influence the visual effect of decompressed images. In the cases, when the compression ratio advances, we notice that the decompressed images look clearly much worse as compared with the cases of smaller compression (see Fig. 8).

G. Dudek et al. / Image and Vision Computing 25 (2007) 883–889

The relationship between quantization and PSNR is a decreasing function (see Fig. 4). For small values of PSNR it does not decline with the noise ratio. Its influence on PSNR is observed when the specific point is reached. This point is characteristic for the individual image (see Fig. 6). We can obtain the large compression when the quantization accuracy and noise ratio is large enough. This large compression influences very much the visual effect of the decompressed image of Lena (PSNR equals 18.1 dB). It is quite obvious that when we increase the level of noise and quantization, we receive fuzzier image of Lena. When we compare this new method with JPEG2000 we observe that comparable decompressed images can be obtained (see Fig. 9). In cases when noise ratio rises, some holes appear in the decompressed images. Quite good visual effect can be seen when only quantization accuracy increases. The compression ratio in that case is also pretty attractive. The method can be further improved by introducing multiscale representation of interpolated continuous version of image, ignoring shortest wavelet coefficients [21]. Original at image can then be restored by means of interpolation. This procedure has slight analogy to Fourier transform decomposition of image (only the set of orthogonal functions differs) and may be viewed as an introduction of a ‘‘frequency’’ based technique. Note that because the wavelets would be applied to a continuous interpolated version of image, their scale would not be limited by a pixel size, and this way it seems possible to introduce a controlled gradual loss of information in the image. Appendix A See Tables 1–4. Table 4 PSNR and compression ratio versus quantization for JPEG2000 and dictionary compression methods for Lena.image JPEG2000

PSNR (dB) Compression ratio

40.5 10

Dictionary method Quantization accuracy: 5 noise ratio: 0

Quantization ratio: 0 noise ratio: 35

36.4 9

26.5 8

889

References [1] D. Hankerson, G.A. Harris, P.D. Johnson Jr., Introduction to Information Theory and Data Compression, CRC Press, Boca Raton, FL, 1997. [2] O. Egger, P. Fleury, T. Ebrahimi, M. Kunt, High performance compression of visual information a tutorial review – part I: still pictures, Proc. IEEE 87 (1999). [3] V.P. Baligar, L.M. Patnaik, G.R. Nagabhushana, High compression and low order linear predictor for lossless coding of grayscale images, Image Vis. Comput. 21 (6) (2003). [4] D. Salomon, Data Compression: The Complete Reference, third ed., Springer, New York, 2004. [5] D. Salomon, A Guide to Data Compression Methods, Springer, New York, 2002. [6] K. Sayood, Introduction to Data Compression, second ed., Academic Press, San Diego, CA, 2000. [7] J. Ziv, A. Lempel, A universal algorithm for sequential data compression, IEEE Trans. Informat. Theory 23 (3) (1977). [8] W.B. Pennebaker, J.L. Mitchell, JPEG Still Image Data Compression Standard, VanNostrand Reinhold, New York, 1993. [9] J. Miano, Compressed Image File Formats: JPEG, PNG, GIF, XBM, BMP, ACM Press, New York, 1999. [10] H.H. Bauschke, M.S. Macklem, Recompression of JPEG images by requantization, IEEE Trans. Image Process. 12 (2003). [11] Z.J. Grzywna, M. Krasowska, J. Stolarczyk, On the application of PIFS – SF and Dq (f(a)) to dendrites analysis, Acta Phys. Pol. B 34 (7) (2003) 3681. [12] Z.J. Grzywna, M. Krasowska, Ł. Ostrowski, J. Stolarczyk, Can generalized dimension (Dq) and f(a) be used in structure – morphology analysis? Acta Phys. Pol. B 32 (5) (2001) 1561. [13] A. E Jaquin, Fractal image coding – a review, Proc. IEEE 81 (10) (1993). [14] M.J. Atallah., S. Lonardi, Authentication of LZ-77 compressed data, in: Proceedings of the ACM Symposium on Applied Computing (SAC’03), Melbourne, FL, 2003, pp. 282–287. [15] S. Lonardi, W. Szpankowski, Joint Source-Channel LZ’77 Coding, in: Proceedings of the 2003 IEEE Data Compression Conference (DCC’03), Snowbird, Utah, 2003, pp. 273–283. [16] S.A. Savari, Redundancy of the Lempel-Ziv Incremental Parsing Rule, IEEE Transact. Informat. Theory 43 (1) (1997) 9–21. [17] K. Sadakane, H. Imai, Improving the speed of LZ77 compression by hashing and suffix sorting, IEICE Trans. Fundam. E83–A (12) (2000) 2689–2698. [18] H. Abut, Vector Quantization, IEEE Press, New York, 1990. [19] A. Gersho, R.M. Gray, Vector Quantization and Signal Compression, Kluwer Academic, Boston, 1992. [20] M.N. Nasrabadi, R.A. King, Image Coding Using Vector Quantization: A Review, IEEE Trans. Commun. 36 (1988). [21] J.T. Białasiewicz, Wavelets and Approximations (Polish title: falki i aproksymacje), WNT, Warsaw, 2000.