➠
➡ Fractal Image Compression with Variance and Mean Yung-Gi, Wu, Ming-Zhi, Huang, Yu-Ling, Wen Institute of Applied Information Leader University, Tainan, Taiwan ABSTRACT Although Fractal image compression has high quality at high compression ratio, it needs a lot of encoding time so that it has not been widely applied as other coding schemes in the field of image compression. In this paper, an algorithm is devised to improve this drawback. We utilize mean and variance to classify image blocks and combine the transformation reduction techniques to decrease the encoding time. The experimental result shows that our proposed method makes the encoder about 480 times faster than the conventional fractal compression method and the quality is imperceptible to that of the conventional fractal encoding algorithm while decreasing the bit rate as well. 1. INTRODUCTION Fractal image coding has many advantages, such as the high quality at high compression ratio [1] and the application in security in the field of image compression. The cause of fractal image coding with high compression is that the minority of blocks through rotations represent the majority of blocks. In a word, fractal encoding is based on Partitioned Iterated Function System (PIFS). The detailed descriptions of PIFS can be found in [2], [3], [4]. However, fractal encoding has a fatal drawback of being time consuming during its encoding process. If we can improve this shortcoming, fractal image coding can be widely applied. To improve the drawback of being time consuming in encoding process, we utilize classification, local search techniques and simplified eight transformations to reduce the time in this paper. Experimental results show that the major drawback of fractal image coding is improved. Section 2 depicts the basic fractal image coding. Our method and results are shown in Section 3 and Section 4. 2. FRACTAL IMAGE CODING Fractal image coding is based on partition iterated function system (PIFS), in which an original image can be partitioned into non-overlapping regions called range blocks (R) and overlapping regions called domains blocks (D). The size of each domain block should be larger than that of the range block. It must be contractive. D’ denotes the down sampled domain block of D and the D’ size is equal to range blocks to match the contractive property. For each range block, the best matching domain block (D’) must be found by affine transformations ti as follows
x ai bi 0 x ei ti y = ci di 0 y + fi z 0 0 si z oi
(1)
where si controls the contrast and oi controls the brightness. Z = f (x, y) is the gray level value at (x, y) and ai, bi, ci, di, ei, fi denote the eight symmetry such as (1) Identity (2) Rotation through +90 ° (3) Rotation through +180 ° (4) Rotation through -90 ° (5) Reflection about mid-vertical axis (6) Reflection about mid-horizontal axis (7) Reflection about first diagonal (8) Reflection about second diagonal. Here we calculate si and oi respectively in equation (2) and equation (3) as follows,
n n n n ∑ a kb k − ∑ a k ∑ b k s i = k = 1 k = 1 k2 = 1 n n n ∑ a k2 − ∑ a k k =1 k =1
n
(2)
n
∑ b − si ∑ a k
oi = k = 1
k
k =1
(3)
n
where ak represents the pixel value of the domain blocks (D’) after eight transformations and bk represents the pixel value of the range blocks and n is the block size. There are many best matched criteria to choose. The root mean square (RMS) is usually used in fractal image coding and the minimal RMS is the better matching. In practice, we compare a range block and domain blocks using the simplified RMS metric as follows
RMS =
n×n
∑ (s ⋅d + o − r )
2
i
k
i
k
(4)
k =1
where dk, rk denote the pixel value of the range and domain blocks (D’) respectively and n is the block size. We use Equation (4) to find the optimal si and oi and then quantize them for storage or transmission. In addition, the encoder must record the position of the best matched domain block (D’) and its transformation for each range block so as to reconstruct the decoded block on the decoder side. The time to search the best matched range block is intolerant of a time consuming job. Therefore, we develop a new encoding algorithm to reduce the time in this research. A lot of people make efforts in fractal improvement. Some investigate region-based image coding methods in [5], and some combine fractal with other algorithms such as wavelet in [6], genetic algorithms in [7], discrete cosine transform in [8], [9]. In a word, they make use of classification methods to reduce time. 3. FAST ENCODING ALGORITHM In the proposed encoding algorithm, classification and transformation reduction are the two major contributions to the
0-7803-7965-9/03/$17.00 ©2003 IEEE
I - 353
ICME 2003
➡
➡ reduction of the encoding time. The ideas are intuitively due to the following facts. The first one is that it is unnecessary for the complicated range block to search the pure domain to waste the encoding time. The second one is that the eight transformations in equation (1) can also be decreased so that the encoder does not have to calculate so many transformations to find its best matched domain block for each range block. Detailed descriptions are given as follows. 3.1 Classification with Variance and Mean In this paper, the block variance and mean are the methods to classify. Blocks variance is usually used to classify the simplicity or complexity for each block. The variance of block I is defined as
Var(I)=
1 n× n 2 ∑ Xi n × n i = 1
2 1 n×n − n×n ∑ Xi i =1
total twenty-four possible patterns. Some of them do not need to make eight transformations after the following analysis. The mean values of the four sub-blocks are set as P1, P2, P3, and P4. Their correlative position can be seen in Fig. 2. The simplified transformation algorithm can decrease four classes as Class1: If P1=P2=P3=P4, it only makes one transformation. Class2: If P1=P4 and P2=P3, it makes two transformations. See Fig. 3. Class3: (a) If P1=P2=P3 or P1=P2=P4 or P2=P3=P4 or P1=P3=P4, it makes four transformations. (b) If P1=P2 and P3=P4, it makes four transformations. (c) If P1=P3 and P2=P4, it makes four transformations. (d) If P1=P4 and P2≠P3, it makes four transformations. (e) If P2=P3 and P1≠P4, it makes four transformations. Class4: If it doesn’t belong to calss1, class2, class3, it must make eight transformations.
(5)
where n is the size of the block and Xi is the pixel value of the range or domain blocks. Range blocks are classified according to variance difference between Var(R) and Var(D’). Then, both range and domain blocks are classified into a number of classes according to mean value. The searched domain blocks for every range block are not all domain blocks now. The proposed method only searches the domain blocks whose mean value classes are the same or adjacent as the class of range block to reduce the searching time. Fig. 1 illustrates the above operation. In this paper, we combine variance difference with classification of mean value to search the best matching domain block. The reduction of searched domain blocks decreases the decoded quality. However, the searching time decreased dramatically.
3.5 Procedures of the Proposed Algorithm The main purpose is to use the variance and mean value to exclude the searching of those domain blocks whose characteristics are inconsistent to the range block. Therefore, using the computation reduction of RMSE and simplified transformation to find the best matched domain block would be useful. The steps of the proposed algorithm are given as follows.
Partial distance search (PDS) in [10] is a method of reducing the amount of computation, which has been applied to reduce the codebook search in vector quantization schemes successfully. The PDS applied in this paper diminishes the calculation amount during the searching of domain blocks for every range block. During the calculation of the RMSE to find the best matched range, if the partial RMSE exceeds the minimum RMSE, the calculation is aborted. In this way, we would decrease much unnecessary computation overhead and speed up the whole processing time.
Step 1: Partition the original image into non-overlapping range blocks and overlapping domain blocks. Step 2: Down-sampling domain blocks (D) to the size of range blocks (D’). Step 3: Calculate variance of range and domain blocks by the equation (5). Step 4: For each range block R, select those domain blocks that can meet the criterion of | Var(R) − Var(D’) | ≤ Threshold. Then, classify those selected D’s by the individual mean value. Step 5: Use the simplified transformation analysis and reduced RMSE to find the best matched domain block and its transformation. Then, store this position of searched domain block and mapped transformation, si and oi . Step 6: Repeat Step 4-6 for all other range blocks until all the range blocks are processed. Step 7: We use simple smooth linear filters in [11] to reduce the discontinuities at block and region boundaries.
3.3 Eight Transformations Simplified
4. EXPERIMENTAL RESULTS
Conventional fractal encoding needs eight transformations for each domain block (D’) to find the best matched one for every range block (R). The image size of 512 by 512, the range block is 8 by 8, and the domain block is 16 by 16. Eight transformations yield eight sets ( si , oi ). Conventional computed number to implement equation (4) is 247009 × 8. This is the one of the fatal causes, which makes the encoding time consuming. Therefore, reducing the transformation number can decrease the total computation time effectively. We find some regulations to decrease eight transformations by observing rotation of different block patterns. First, a domain block (D’) is divided into four sub-blocks and then the mean value of every sub-block is calculated. The mean value of each sub-block is used to generate the pattern of each domain block. Due to four sub-blocks within each domain block (D’), there are
The proposed fast fractal encoding is simulated using by several 512 × 5 12 images with 256 gray levels. The conventional algorithm uses non-overlapping 8 × 8 range blocks and overlapping 16 × 16 domain blocks and full exhaustive search. For the purpose of performance comparison, the sizes for range and domain blocks are the same as the conventional scheme in the proposed experiment. The threshold of Lena is set to 1800, threshold of Lenna is set to 1900 and threshold of Zelda is set to 160. The data listed in Table 1 shows the decoded image quality in different threshold values. The numbers of range blocks (R) in each class through simplified eight transformations algorithm are shown in Table 2, respectively. All of the above methods have been coded in C language on Celeron 2GHz PC. The main memory is 512MB. The experimental results are shown in Table 3. The traditional
3.2 Computation Reduction of RMS Error
I - 354
➡
➡ fractal reconstructed image and our fractal reconstructed image are shown in Fig. 4. ~ Fig. 9. From Table 3, our encoding method shoes to be faster than traditional fractal encoding while PSNR only drops 1.7dB to 2dB and the bit rate reduces 0.049 bpp to 0.01571 bpp. The experimental results show that our proposed method makes the encoder 480 times faster than the conventional fractal compression method and the quality is imperceptible to that of the conventional fractal encoding algorithm while decreasing the bit rate. REFERENCES Fig. 1. Search area for class 4
[1] M. F. Barnsley, Fractal everywhere, Academic Press, New York, 1988. [2] Y. Fisher, Fractal Image Compression. Theory and Application, New York: Springer-Verlag, 1994. [3] A.E. Jacquin, “Fractal image coding: a review, Proceedings of the IEEE, Vol.81, No.10, pp.1451-1456 Oct. 1993. [4] A.E. Jacquin, “Image coding based on a fractal theory of iterated contractive image transformations,” IEEE Trans. Image Processing, vol. 1, pp.18-30, Jan. 1992. [5] B. Wohlberg and G. de Jager, “A review of the fractal image coding literature, ” IEEE Trans. Image Processing, vol. 8, pp. 1716-1729, Dec. 1999. [6] G.M. Davis, “A wavelet-based analysis of fractal image compression, ” IEEE Trans. Image Processing, vol. 7, pp. 141 -154, Feb. 1998. [7] M. Takezawa, H. Honda, J. Miura, H. Haseyama and H. Kitajima, “A genetic-algorithm based quantization method for fractal image coding,” IEEE Trans. Image Processing, vol. 1, pp. 458-461, 1999. [8] Y. Zhao and B. Yuan, “Image compression using fractals and discrete cosine transform,” Electron. Lett., vol. 30, no. 6, pp. 474-475, 1994. [9] Y. Zhao and B. Yuan, “A hybrid image compression scheme combining block-based fractal coding and DCT, ” Image Communication, Vol. 8, No. 2, pp. 73-78, Mar. 1996. [10] C. Bei and R.M. Gray, “An improvement of the minimum distortion encoding algorithm for vector quantization,”IEEE Trans. Commun., vol. COM-33, pp. 1132-1133, Oct. 1985 [11] R. C. Gonzales and R. E. Woods, Digital Image Processing Second Edition, Prentice Hall, 2002.
Fig. 2. Correlative position
Fig. 3. Class 2 of eight transformations
Fig. 4.Fractal image decoding of Lena
Fig. 5.Our fractal image decoding of Lena. Threshold=1800.
Fig. 6. Fractal image decoding of Lenna.
Fig. 7. Our fractal image decoding of Lenna. Threshold=1900.
I - 355
➡
➠
Fig. 8. Fractal image decoding of Zelda.
Fig. 9. Our fractal image decoding of Zelda. Threshold=160.
Table 1 Choose variance difference Lena Lenna Zelda
Threshold PSNR Threshold PSNR Threshold PSNR
1700 1800 1900 26.991 27.016 27.033 1900 2000 2500 28.818 28.848 28.955 160 2100 2400 30.423 31.886 31.955
182920 28.030 179143 29.912 125144 32.6686
Table 2 the number of Eight Transformations Simplified 512 × 512 Lena Lenna Zelda
Class 1 9 22 8
Class 2 18 20 9
Class 3 1387 1563 1253
Class 4 2682 2491 2826
Table 3 Experimental Results 512 × 512 Pictures Lena (1800) Lenna (1900) Zelda (160)
Method
PSNR Encoding Time Bit rate (dB) (sec) (bit/pixel) Traditional 28.18 28685 0.5156 Proposed 26.94 65 0.5101 Traditional 29.9152 25380 0.5156 Proposed 28.59 57 0.5093 Traditional 32.6999 26408 0.5156 Proposed 29.79 55 0.5107
I - 356