Keywords

1 Introduction

Compression of image reduces its size and is very important before storing and communicating it over network. Fractal based image coding recently got attention for this task since it decodes image in resolution dependent way with very high compression rate and decoding speed is also very high. In the encoding process, the input image is divided into a number of domain and range and most similar domain must be searched for each range. The large number of comparisons between range and domain require huge time. The major limitation of fractal based coding is therefore its long encoding time. However, the domains can be classified to reduce the number of comparisons where each range is compared with only same class domains as range. There were varieties of schemes to meet this goal. The conventional classification presented by Fisher [1] grouped domains into 72 classes based on proportional average and variance of four quadrants of domains to reduce number of range-domain comparisons. Xing et al. [2] improved the Fisher’s classification scheme by grouping domains into 576 classes according to combinations of average and its variance in hierarchical way. Bhattacharya et al. [3] proposed a hierarchical classification scheme and reduced encoding time well. Jayamohan et al. [4] suggested a classification scheme depending on local fractal dimension using B+ tree. They [5] also did the same using AVL tree. Wang and Zheng [6] classified domains by applying pearson’s correlation coefficient as similarity measure. Nandi and Mandal [7] proposed a fast classification strategy using 64 bit sub-image id. The existing classification schemes were specially designed for quadtree partitioning based fractal image coding. But, the quadtree partitioning divides image block into four equal quadrants without using image context and does not share self-similar portions of image. As a result, the quality of reconstructed fractal compressed image degrades significantly. To deal with this problem, adaptive quadtree partitioning [8, 9] can be applied where the partitioning is based on image context to share self-similar portions. However, there are few known classification schemes that fit with adaptive quadtree partitioning. Nandi and Mandal applied archetype classification scheme [10, 11] in adaptive quadtree partitioning based fractal image coding. But, the technique suffers from high encoding time. In this paper, a novel hierarchical classification scheme has been proposed for adaptive quadtree partitioning based fractal image coding that significantly reduces the encoding time and offers also better decoded image quality and compression ratio. The detail of adaptive quadtree partitioning is given in Sect. 2. The proposed hierarchical classification scheme is explained in Sect. 3. The fractal image coding with adaptive quadtree partitioning and proposed hierarchical classification scheme are discussed in Sect. 4. The performance analysis is done in Sect. 5. The comparative experimental results in terms of encoding time, reconstructed image quality (i.e. PSNR) and compression ratio are given and analyzed in Sect. 6. Final conclusions are made in Sect. 7 and references are given at end.

2 Adaptive Quadtree Partitioning Scheme

The adaptive quadtree partitioning splits image block based on its gray values to find structure that are similar with itself at different scale. Consider an R × C image block with left-top point (t1, t2) and Gi,j is the gray value of point (i, j), t1 ≤ i ≤ t1 + R − 1, t2 ≤ j ≤ t2 + C − 1. It partitions image block (range/domain) into four unequal parts using three steps as shown in Fig. 1. In the first step, the scheme partitions the image block horizontally into upper and lower sub-images. It obtains the horizontal line (HL) for partitioning by Eq. 1 where the biased horizontal difference (BHDi) of ith horizontal line is calculated in Eq. 2 for each horizontal line i, t1 ≤ i ≤ t1 + R − 1.

Fig. 1.
figure 1

The adaptive quadtree partitioning scheme

$$ {\text{HL}} = {\text{ MAX }}\left( {{\text{BHD}}_{\text{i}} } \right),{\text{ Subject}}\,\,{\text{to}}\,\,{\text{t}}_{1} \le {\text{ i }} \le {\text{ t}}_{1} + {\text{ R }} - \, 1 $$
(1)
$$ {\text{BHD}}_{\text{i}} = {\text{MIN}}\left( {{\text{i}}, {\text{R}} - {\text{i}} - 1} \right)\left| {\sum\nolimits_{j = t2}^{t2 + C - 1} {{\text{G}}_{{{\text{i}},{\text{j}}}} - \sum\nolimits_{j = t2}^{t2 + C - 1} {{\text{G}}_{{{\text{i}} + 1,{\text{j}}}} } } } \right| $$
(2)

In the next step, the upper sub-image is divided vertically into left and right portions. The vertical line (VL1) for partitioning is selected by using the Eq. 3 where the biased vertical difference (BVD1j) of jth vertical line is calculated in Eq. 4 for each vertical line j, t2 ≤ j ≤ t2 + V − 1.

$$ {\text{VL}}_{1} = {\text{ MAX }}\left( {{\text{BVD}}1_{\text{j}} } \right),{\text{ Subject }}\,\,{\text{to t}}_{2} \le {\text{ j }} \le {\text{ t}}_{2} + {\text{C}} - 1 $$
(3)
$$ {\text{BVD}}1_{\text{j}} = {\text{MIN}}\left( {{\text{j}}, {\text{C}} - {\text{j}} - 1} \right)\left| {\sum\nolimits_{{i = {\text{t}}1}}^{HL - 1} {{\text{G}}_{{{\text{i}},{\text{j}}}} - \sum\nolimits_{{i = {\text{t}}1}}^{HL - 1} {{\text{G}}_{{{\text{i}},{\text{j}} + 1}} } } } \right| $$
(4)

Finally, the lower sub-image is partitioned vertically into left and right portion. The scheme gets the vertical line (VL2) for partitioning by using the Eq. 5 where the biased vertical differences (BVD2j) of jth vertical line is evaluated in Eq. 6 for each vertical line j, t2 ≤ j ≤ t2 + C − 1.

$$ {\text{VL}}_{2} = {\text{ MAX }}\left( {{\text{BVD}}2_{\text{j}} } \right),{\text{ Subject }}\,\,{\text{to}}\,\,{\text{ t}}_{2} \le {\text{ j }} \le {\text{ t}}_{2} + {\text{ C }}{-} \, 1 $$
(5)
$$ {\text{BVD}}2_{\text{j}} = {\text{MIN}}\left( {{\text{j}}, {\text{C}} - {\text{j}} - 1} \right)\left| {\sum\nolimits_{i = HL}^{{{\text{t}}1 + R - 1}} {{\text{G}}_{{{\text{i}},{\text{j}}}} - \sum\nolimits_{i = HL}^{{{\text{t}}1 + R - 1}} {{\text{G}}_{{{\text{i}},{\text{j}} + 1}} } } } \right| $$
(6)

3 Proposed Hierarchical Classification Scheme for Adaptive Quadtree Partitioning

The proposed Hierarchical classification scheme is designed for adaptive quadtree partitioning based fractal image coding. The steps of the classification scheme are given in algorithm 1. Initially, an input sub-image (range/domain) is taken as shown in Fig. 2(a). Then, the sub-image is partitioned into four quadrants Q1, Q2, Q3 and Q4 (Fig. 2(b)) using adaptive quadtree partitioning scheme. For each quadrant Qi, 1 ≤ i ≤ 4 obtain the sum of all the pixel values of Qi as QSi using Eq. 7 where nj is the number of pixels and Gi1, Gi2, …..Ginj are the pixel values of Qi.

Fig. 2.
figure 2

Hierarchical decomposition of sub-image block to find its class (a) Input sub-images (b) First level classification using four quadrants (24 classes) (c) Second level classification using sixteen quadrants (244 = 331776 classes)

$$ {\text{QS}}_{\text{i}} = \sum\nolimits_{k = 1}^{{n_{j} }} {{\text{G}}_{\text{ik}} } $$
(7)

There are 24 classes based on orientations of four quadrants Qi, 1 ≤ i ≤ 4. The appropriate class of first level is assigned to the sub-image based on its quadrant ordering. Then, each quadrant Qi, 1 ≤ i ≤ 4 is partitioned into four sub-quadrants Qi1, Qi2, Qi3 and Qi4 (Fig. 2 (c)) using adaptive quadtree partitioning scheme. Again, the calculation of sum of the pixel values as QSij, 1 ≤ j ≤ 4, for each sub-quadrant Qij, 1 ≤ i ≤ 4, are done using Eq. 8 where nij is the number of pixels and Gij1, Gij2, ….. Gijnj are the pixel values of Qij.

$$ {\text{QS}}_{\text{ij}} = \sum\nolimits_{k = 1}^{{n_{ij} }} {{\text{G}}_{\text{ijk}} } $$
(8)
figure a

There are 24 ordering of sub-quadrant Qi1, Qi2, Qi3 and Qi4 of each quadrant Qi, 1 ≤ i ≤ 4 and there are four such quadrants. Therefore, there are 244 = 331776 classes in second level. The appropriate class of second level is assigned to the sub-image based on its sub-quadrant ordering. Finally, the sub-image class is returned.

In adaptive quadtree partitioning, a range is compared with at least double size domain. If a similar domain is not found, the range is broken into four quadrants Qi, 1 ≤ i ≤ 4. The size of each quadrant may not be equal. If 2 × 2, 2 × 3 and 3 × 2 ranges are

considered as minimum size ranges and 8 × 8 as maximum size range, then the possible quadrant sizes are x × i, 2 ≤ x ≤ 8, 2 ≤ i ≤ x and i × x, 2 ≤ x ≤ 8, 2 ≤ i ≤ x, x ≠ i. Therefore, the domain pool must contain domains of sizes 2x × 2i, 2 ≤ x ≤8, 2 ≤ i ≤ x and 2i × 2x, 2 ≤ x ≤ 8, 2 ≤ i ≤ x, x ≠ i. Initially, the domains are grouped based on their sizes (Fig. 3). Afterthat, these are classified into first level based on four quadrant pixel value sums and ultimately into second level based on sixteen quadrant pixel value sums. The domain is then kept in a list correspond to the second level class.

Fig. 3.
figure 3

The classification of domains based on domain-size, first level and second level classes

4 Fractal Image Coding with Adaptive Quadtree Partitioning and Proposed Hierarchical Classification Scheme

At the time of compression process, the coding technique splits the input image into a number of non-overlapping blocks of size 8 × 8 known as ranges (Ri). These ranges are included in the list of uncovered range. The input image is again partitioned into a number of overlapping blocks known as domains (Di) where the size of domains are double than range. The coding technique applies adaptive quadtree partitioning scheme. Therefore, if an enough similar domain of an 8 × 8 range does not exist, it is further broken into four unequal sub-ranges. The possible ranges/sub-ranges sizes are x × i, 2 ≤ x ≤ 8, 2 ≤ i≤ x and i × x, 2 ≤ x ≤ 8, 2 ≤ i ≤ x, x ≠ i. As a result, the sizes of domains are 2x × 2i, 2 ≤ x ≤ 8, 2 ≤ i ≤ x and 2i × 2x, 2 ≤ x ≤ 8, 2 ≤ i ≤ x, x ≠ i. The sizes of a range considered minimum are 2 × 2, 2 × 3 and 3 × 2 and the minimum size range is not broken further even no similar enough domain not found. The domains are classified by using proposed hierarchical classification scheme to reduce the number of comparisons between domain and range. After that, for each range (Ri), the technique detects its corresponding class (Ci) by using proposed hierarchical classification scheme and the range (Ri) is compared only with domains of class Ci and the domain that matches best with Ri is selected. If this domain is similar up to the certain threshold or the range size is minimum, the corresponding affine map is kept into the output compressed file and this range is removed from the list of uncovered range. Otherwise, the range is broken up into four unequal sub-ranges using adaptive quadtree partitioning scheme and these are included into the list of uncovered range. This process is continued until all ranges are covered. The final output compressed file contains a number of affine maps. At the time of decompression process, an arbitrary image is taken as input and affine maps are applied on it that produces another image. Now, this image acts as input and does the same. This is repeated for eight iterations and final decompressed image is produced. The technique is termed as Fractal image coding with adaptive quadtree partitioning and hierarchical classification scheme (FIC-AQP-HC).

A variant of FIC-AQP-HC has also been proposed. The technique is based on the concept that if a domain matches best with a large number of ranges of a class, then it has high chance to match again with other ranges also of that class and should give preference to it. To implement the idea, a counter is included with each domain. The counters of all domains are initially set to zero. The counter of a domain is incremented for each match with a range. The domains of each class are arranged in descending order based on counter. A range starts comparisons from the first domain of sorted same class domain list and ends searching as soon as a similar enough domain is found. As a result, it reduces further the number of comparisons between domain and range and termed as Fractal image coding with adaptive quadtree partitioning and modified hierarchical classification scheme (FIC-AQP-MHC).

5 Performance Analysis

In this section, the performances of conventional and proposed classification schemes are analyzed in terms of the number of comparisons between domain and range.

Let us consider the total number of domains and ranges of conventional classification are Dn and Rn respectively. The number of classes used in this scheme is 72. Therefore, the average number of domains per class is \( \frac{{{\text{D}}_{\text{n}} }}{72} \) and the number of comparisons between domain and range is \( \left( {\frac{{{\text{D}}_{\text{n}} }}{72}} \right){\text{R}}_{\text{n}} \).

Now, the total number of domains and ranges of proposed hierarchical classification are considered as dn and rn respectively. The numbers of first and second levels classes used in this scheme are 24 and 244 respectively. As a result, the total number of classes is 245. Therefore, the average number of domains per class is \( \frac{{{\text{d}}_{\text{n}} }}{{24^{5} }} \) and the number of comparisons between domain and range is \( \left( {\frac{{{\text{d}}_{\text{n}} }}{{24^{5} }}} \right){\text{r}}_{\text{n}} = \left( {\frac{{49 {\text{D}}_{\text{n}} }}{{3 \times 24^{5} }}} \right){\text{r}}_{\text{n}} \) since the possible domain sizes of conventional and proposed classifications are 3 and 49 respectively and \( {\text{d}}_{\text{n}} = \left( {\frac{49}{3}} \right){\text{D}}_{\text{n}} \). Hence, the proposed classification scheme reduces greatly number of domains and ranges as Rn ≈ rn and \( \left( {\frac{{49 {\text{D}}_{\text{n}} }}{{3 \times 24^{5} }}} \right){\text{r}}_{\text{n}} < \left( {\frac{{{\text{D}}_{\text{n}} }}{72}} \right){\text{R}}_{\text{n}} \). However, the initial classification of the proposed classification scheme requires huge time. Again, the number of comparisons between domain and range of the proposed variant is less than or equal to the proposed scheme since it ends searching as soon as an enough similar domain is found.

6 Result and Analysis

Five gray scale image of size 256 × 256 [13] have been chosen for our experiment. The proposed FIC-AQP-HC and FIC-AQP-MHC are compared with existing Fractal Image Compression with Quadtree Partitioning and Fisher’s conventional classification (FIC-QP-CC) [1], Fractal Image Compression with Adaptive Quadtree Partitioning and Fisher’s conventional classification (FIC-AQP-CC) [8, 9], Fractal Image Compression with Adaptive Quadtree Partitioning and Archetype classification (FIC-AQP-AC) [10, 11] and Fractal Image Compression with Quadtree Partitioning and DWT (FIC-QP-DWT) [12] in terms of encoding time, reconstructed image quality (i.e. PSNR) and compression ratio with the help of statistical parameters mean and standard deviation. The compression ratio, PSNR, mean and standard deviation are obtained by using Eqs. 9, 10, 11 and 12 respectively.

$$ {\mathbf{Compression}}\,\,{\mathbf{ratio}} = \frac{{{\mathbf{compressed}} \,{\mathbf{image}}\,{\mathbf{size}}\,{\mathbf{in}}\,{\mathbf{bits}}}}{{{\mathbf{Original}} \,{\mathbf{image}} \,{\mathbf{size}} \,{\mathbf{in}}\,{\mathbf{bytes}}}}\,\,{\text{bpp}} $$
(9)
$$ {\text{PSNR}} = \, 20\,{\mathbf{log}}_{{{\mathbf{10}}}} \left( {\frac{255}{{\varvec{RMS}}}} \right){\text{dB}} $$
(10)
$$ {\text{Mean}}\left( {\bar{\varvec{x}}} \right) = \frac{1}{\varvec{n}}\sum\nolimits_{{\varvec{i} = 0}}^{\varvec{n}} {\varvec{x}_{\varvec{i}} } $$
(11)
$$ {\text{Standard Deviation}} = \sqrt {\frac{1}{\varvec{n}}\sum\nolimits_{{\varvec{i} = 0}}^{\varvec{n}} {|(\varvec{x}_{\varvec{i}} - \bar{\varvec{x}})|^{2} } } $$
(12)

Table 1 contains the encoding time of all the examined techniques with its mean and standard deviation. The graphical representation of average encoding time of all the examined techniques is shown in Fig. 4. A significant reduction of encoding time is noticed in both the proposed techniques compare to others. Moreover, the proposed FIC-AQP-MHC is found faster than the proposed FIC-AQP-HC. Table 2 keeps the compression ratio with its mean and standard deviation of all examined techniques. Figure 5 illustrates the graphical representation of average compression ratio. The compression ratios of both the proposed techniques are same with FIC-AQP-CC and better than other examined techniques. The comparisons of reconstructed image quality in terms of PSNR including its mean and standard deviation are done in Table 3. The graphical representation of average PSNR is depicted in Fig. 6. For visual inspection, the original lena image is shown in Fig. 7 and the corresponding reconstructed images using all examined techniques are illustrated in Fig. 8. The average PSNRs of both the proposed techniques are better than FIC-QP-CC, same with FIC-AQP-CC and very close to FIC-AQP-AC for not only lena but also other four images.

Table 1. Encoding time in second
Fig. 4.
figure 4

The graphical representation of comparison of encoding time of fractal image compression techniques

Table 2. Compression ratio in bpp
Fig. 5.
figure 5

The graphical representation of comparison of PSNR of fractal image compression techniques

Table 3. PSNR in dB
Fig. 6.
figure 6

The graphical representation of comparison of PSNR of fractal image compression techniques

Fig. 7.
figure 7

The original lena image

Fig. 8.
figure 8

The reconstructed images using all examined techniques (a) FIC-QP-CC (28.90 dB) (b) FIC-QP-DWT (28.86 dB) (c) FIC-AQP-AC (29.36 dB) (d) FIC-AQP-CC/FIC-AQP-HC/FIC-AQP-MHC (29.31 dB)

7 Conclusion

Both the proposed FIC-AQP-HC and FIC-AQP-MHC techniques applied hierarchical classification scheme into adaptive quadtree partitioning based fractal image coding and greatly reduces the encoding time than all other examined techniques. Moreover, the proposed FIC-AQP-MHC is faster than FIC-AQP-HC. The proposed techniques also have better compression ratio and reconstructed image quality. Further improvement of the compression ratio of the proposed techniques is possible by using loss-less coding to encode parameters of affine maps of compressed image.