Optimization of Fractal Image Compression

Fractal encoding is a promising method of image compression. It is built on the basis of the forms found in the image and the generation of repetitive blocks based on mathematical translations. The technique seems to be moved theoretically and practically, but it requires enormous programming time due to the excessive resources required when compressing large volumes of data. On the other hand, metaheuristics represent all of the methods used to solve difficult optimization problems with less consumption of resources. They are marked by their rapid convergence and their lessening in research difficulties. In this chapter, we have tried to apply a new experience around the performance of organic metaheuristics inspired by nature, which are, respectively, the wolf pack algorithm (WPA) and the bat-inspired algorithm (BIA), as bioinspired techniques to optimize the fractal image compression (FIC). Experiments show the enhancement of diverse characteristics (coding time, compression rate (CR), peak signal-to-noise ratio (PSNR), and mean square error (MSE)). In addition, an assessment of the proposed approaches via many other approaches highlights this improvement.


Introduction
Nowadays, a significant size of information is managed and transmitted, and mainly, images have involved prodigious status, particularly in recognition field. Thus, it is important to decrease the size of the data via compression algorithms which can allow their storage and their transmission while using limited resources. Compression is employed to overcome this problem and keep more files. Mainly multimedia files need more storage space than other types of files. Images represent the largest part of the most used multimedia files in almost all fields. Unlike other types of files, a huge amount of image data requires more resources for storage and transmission on computer networks, and compression is therefore presented as an inevitable tool with the aim of more maneuverability of this data. Today, several compression formats exist while presenting their limits (degradations, size, duration, etc.) on somewhat particular images (text images and background areas).
To overcome this difficulty, scientists are constantly developing new techniques to compress images in order to find a perfectionist compression method that can largely conserve storage space and preserve the quality of the source file.
The compression methods that exist tend to introduce the theory of fractals, which appears to be a strong instrument for boosting image quality and reducing the resources required. Nowadays, the image files intricated in several specific programs are characterized by massive data, pixel correlation, and similarity. Under such conditions, the old compression methods appear to be unsuitable for this mission because of their need for significant encoding time. On the other hand, the recently developed fractal image compression techniques offer better compression qualities [1][2][3]. These methods are built on the principle that shapes (fractals) can better represent usual scenes than traditional geometric forms. A number of fractal image compression techniques are presented in a lot of works; they include an image coding agreeing to more security and less degradation (Jeng et al. [4], Li [5], and Han [6]). These methods have revealed an important in information, reduced statistical characteristics of chaotic patterns, and weakness in statistical cryptanalysis. In addition, metaheuristics are likewise employed to optimize compression, like genetic algorithms [7], ant colonies [8], and optimization by particle swarms [9]. These methods have ability to create a partition constructed on a region which improves the compression ratio and maintains better the decompressed image quality.
In this chapter, we try for the first time to apply natural metaheuristics on fractal compression, by suggesting new methods which associate, both the bat-inspired algorithm (BIA) and the wolf pack algorithm (WPA) with fractal image compression (FIC) to speed up encoding and optimize both file size and image quality. The main objective of using these algorithms is its property of search for global solution and its capacity to generate very satisfactory results quickly and for less means compared to similar techniques. The algorithms also use fewer parameters and without initial approximation of the unidentified parameters. This document is organized as follows; Section 1 presents an introduction in the study context. Next, a summary of the fractal image compression is detailed in Section 2. Section 3 summarizes the natural metaheuristics and presents those used in this work, namely, the WPA and the BIA. In Section 4, we give a review of some related works. After that, we present our proposed methods in Sections 5 and 6. Experiments are explained in Section 7. Finally, the conclusion appears in Section 8.

Fractal encoding
Fractal compression is a new method of irreversible image compression [10]. It was adapted by Hutchinson [11] and Barnsley and Demko [12]. It searches for selfsimilarities among the diverse image blocks [13] and only keeps the parameters of the contractual transformation in place of the pixels of the image. Like this, we can build an estimate as close as possible to the source image by detecting the redundancy of forms at several scales and try to eliminate these redundancies in the original image so that the result is precise enough to be accepted.
The FIC is founded on an iterated function system f, a limited group of contractions defined on a metrical space R n by the relation: This contraction can be in several shapes depending on technical constraints. It can be done several points of the original image and carry them nearer to the compressed one. This reflection is named "affine transformation"; then, each subblock of the original image will be submitted either a rotation at an angle, a scale, or a translation (transformed using eight isometries) according to Equation 2: where T is a linear transformation, R n ! R n is a vector, and b ∈ R n is a vector. Practically, the general principle of fractal compression is to try to find the finest matching domain blocks for each range block in order to minimize the distance metric. The code that follows illustrates this idea well:

• End For
This process is realized following the relation: where v () is the function of the contraction which aims to modify D i . Thereafter, the nearest block B i is sought for all R i blocks by calculating the error between B i and R i , and we can use, for example, the Hausdorff distance defined by Equation 4: ðÞ (4) where d(B, R) = max b ϵ A min r ϵ B ||b-r||. Or using the Euclidean distance described by the equation: where n represents the pixel's number in R i and B i blocks. d should be as minimum as possible for blocks that look alike.
Fractal decompression consists of the reconstruction of R i from the blocks B i which appear identical the most by practicing the contraction used in compression.
In recent years, several studies have concentrated on the development of accelerated decryption procedures [14][15][16] with the aim of preserving image quality. Their principle is to choose a random image as the original one and execute an affine transformation like defined in Equations (6) and (7), founded on the fractal ciphers obtained by itself. This act is repeated recursively till the reconstructed image were satisfactory: where I is a contractive or isometric spatial transformation, D is a domain block, R is a range block, and S is the reconstructed image.
In fact, FIC is becoming among the most promising methods for image compression for its significant compression ratio (CR) and preservation of quality. Its beginnings date from the 1990s when Jacquin [17,18] introduced the first method of image compression; its principle is partitioning the image into two tiling blocks: the range and domain blocks.
The domain blocks are double the size of the range blocks and overlap such that a new domain block starts at each pixel. The main idea of this compression is to find the nearest domain block in concordance with each range block, to determine the right contractual transformation, and to store all these parameters. This principle was exciting; however it remained limited to local applications because it consumes a lot of CPU time. Since then, researchers have constantly presented new techniques to reduce the compression time; Thomas and Deravi [19] link range blocks and brand them more adaptive with image content by using the region-growing method. Cardinal [20] presented an alike principle; it is founded on a geometrical partition of the grayscale image block feature space. The experimental evaluations with earlier published methods illustrate an important enhancement in encoding time with practically better quality. He et al. [21] have used the normalized block with the aim to evade the extreme search in corresponding block. Chong and Pi [22] proposed a new adaptive search method to decrease the calculation complexity of fractal encoding to discard a big number of unqualified domain blocks so as to speed up FIC.
Other studies have been presented on new aspects to improve the way of research like the encoding via the Fourier transform [23], special image features [24], and discrete cosine transform inner product [25]. The majority of existing methods rely on a corresponding error threshold to limit the search. Lately, Lin and Wu [26] have defined another way of search built on image block edge property, which proves suitable results. Furthermore, many research articles have been published over the past decade; they increased the quality of the compressed image through the use of metaheuristics without resorting to more resources in the coding process.

Natural heuristics
Heuristics refer to the set of techniques that can solve several problems by maximizing gains and decreasing the resource's consumption; however, the optimal solution cannot be certain if, in the investigation space, there is an intersection between the local and global solution [27]. Natural heuristics represent a large family of heuristics which are inspired from communal conduct of animals existing in societies like assemblages of birds, ant colonies, or grouping of fish. They are founded on the principle of populations of entities who cooperate and develop rendering to reciprocal precepts. These techniques allow the invention of procedures which can resolve hard problems by dividing control. These approaches form a famous prototype which is effectively employed as a prodigious tool for resolving difficult problems [28] with less resource consumption. Several researches [29,30] illustrate that these systems have an effective potential to manage various situations and could be adapted to bring solutions to diversified optimization problems.

The wolf pack algorithm (WPA)
The wolf pack algorithm (WPA) [31] belongs to the family of bioinspired techniques which can be used to estimate resolutions for numerous optimization problems. WPA is a metaheuristic built on the population invoked by the social hunting behavior of wolves. It basically involves hunting wolves, tracking down prey, and capturing it under the orders of a leader wolf. The wolf pack includes the strongest and most intelligent wolf chef. He is responsible for controlling the pack. Its decisions are always based on the surrounding environment: prey, pack wolves, and other hunters. The pack is divided into two families of wolves: scoot and ferocious.
The scoot wolves move autonomously in the milieu and adjust its way according to the concentration of the odor of the prey. When a prey is found, scoot wolves cry and transmit info by sound to the leading wolf who guesses the distance to reach this prey; it calls the furious wolves and quickly displaces towards the cry. The prey is then caught and is shared conferring to the nature of each wolf: from the sturdiest to the feeblest. Subsequently, feeble wolves could die from absence of nutrition. In this manner the pack ensures a certain dynamic and robustness at all times.
WPA is performed as follows: In a search environment ℝ n , any wolf i denotes an elementary solution to the problem, at a location x i .
Initially, wolves are distributed chaotically in the environment. At any instant t, the wolf i passes from the location x t i to the location x t+1 i . The choice of the following location is updated by rendering the following equation: where λ represents a vector randomly distributed in the interval [À1,1] and x g designates the location of the chief wolf. After a static sum of repetitions, which corresponds to a research stage, the wolf of the finest result gets converted to a leader one; feeble wolves (bad solutions) will be wiped out and substituted with a novel group of wolves in an arbitrary manner.

The bat-inspired algorithm
The bat-inspired algorithm (BIA) [32] belongs to the family of metaheuristics inspired by nature, introduced by Yang and founded on the echolocation comportment of bats. Bats have a system identical to radar except that radars use electromagnetic waves while bats use ultrasonic waves (of frequency inaudible to humans). Bats move and hunt with high-performance sonar. By another way, bats are distinguished by an extraordinary steering mechanism allowing them to differentiate between an obstacle and a prey, which allows them to hunt even all. The impulses produced by bats can be linked almost to the hunting plans of bats. Often, the pulses are between 25 and 150 kHz at a static frequency; they only persist for 8-10 ms. Bats generate between 10 and 20 ultrasonic sound eruptions every second, each of them stays between 5 and 20 ms. However, when bats seek their prey and feel so close, they can increase the rate of emission of sound eruptions up to 200/s. This proves the extraordinary ability of bats to process signals. Assuming that the speed of sound in air is v = 340 m/s, the wavelength λ of the ultrasonic sound therefore manifests with a continuous frequency f: The wavelengths vary between 2 and 14 mm and are equivalent to the size of the bat's prey, for a representative frequency between 25 and 150 kHz. The pulses produced by bats can spread an imposing sound intensity of 110 dB, but quite favorably, these pulses remain in the ultrasonic domain. The intensity of the pulse can take different stages, such as very strong when bats are chasing and weak at a quiet sound when they mark their prey. These short pulsations usually have a wandering range of a few meters which depends on the frequency.
In reality, bats combine all of their senses to effectively detect prey and navigate more easily. Here, we are only interested in echolocation and the behaviors that accompany it. To create new optimization techniques, the echolocation of bats can be transformed into an optimized objective function.
In a search space R i , the bats fly randomly using the speed Vi in location (solution) X i using velocity V i . They produce pulses at a static wavelength λ with a variable frequency f and an intensity A (differs from a big positive A 0 to a smallest constant value A min ) to hunt for prey. When the bats choice the finest results, they choose a local result from the best selected ones.

Introducing bioinspired approaches in the FIC
In 2005, Dervis Karaboga proposed a new iterative optimization method based on artificial bee colonies (ABC). This technique is based on three different classes of bees, (a) bee used, (b) spectator bee, and (c) scout bee. The spectator bees waiting in the store obtain data concerning the sources of nectar revealed earlier from the employees. Then they choose a usable nutrition source built on the received information. Scout bees arbitrarily search for nutriment in the area for [33].
In 2006, Cristian Martinez presented an enhanced image compression using the ant colony technique. The basic idea is that ants always seek and find the shortest path from nest to food source using the pheromone. For fractal compression, the pheromone is positioned on the range block i and the domain block j. The pheromone matrix is rectangular (not symmetrical) where the lines designate range blocks (image blocks) and the columns indicate domain blocks (blocks to transform). Then, the ants build routes by choosing a block of domain j for each block of range i. the solution will be found on the basis of updating the pheromone and heuristic information [34]. The result proposes similar image quality to that obtained with a deterministic way while minimizing the calculation time by 34%.
In 2009, many of studies were focalized on FIC: Chakrapani and Soundara Rajan [35] have created a new fractal image compression founded on a genetic algorithm in the intention of optimizing the encoding time for an acceptable image quality. The results give improved performance over exhaustive search.
In the work of Xing-yuan, Fan-ping, and Shu-guo [36], a spatial correlation hybrid genetic algorithm that uses the features of the fractal and divided iterative function system is proposed. It consists of two stages. The first uses spatial correlation in the images for the range and the domain blocks in order to exploit the local optima. The second one is based on a genetic-simulated annealing algorithm (SAGA) to find the global optima if the local optima is not satisfied. In order to escape early convergence, the algorithm approves that the dyadic mutation operator takes place in place of the traditional operator.
In 2010, Chakrapani et al. have enhanced the fractal image compression using particle swarm optimization (PSO) technique [37]. PSO is used to speed up the search of the nearest finest match block for a definite block to be encoded. This method illustrates that the recovered image quality can be conserved when in comparison with the full-search FIC.
In 2016, Shaimaa S. Al-Bundi et al. [38] use an upgraded genetic algorithm to enhance the exploration space in the target image by good estimation to the global optimum in an only execution.
In 2017, Al-Saidi N.M.G et al. [39] optimize the fractal image compression by introducing the harmony search algorithm. This strategy searches for the best solution through singing a song; this proposed technique offers splendid performances in terms of image quality, reduced computation time, and storage space when compared to other methods.
In 2018, we [40] used the wolf pack algorithm to improve the FIC; the idea is to take the entire image for the search space where this space is divided into blocks; scooters wolves roam the environment to find other smaller and similar blocks. They examine the entire space and select the blocks with the best physical shape. By this method, the encoding time was considerably reduced, and we also obtained a better compression rate.
In 2019, we have [41] chosen to improve the FIC by using the bat-inspired algorithm. Our tow proposed methods are detailed and well explained in Sections 5 and 6, respectively.

Wolf pack algorithm to optimize fractal image compression
We assume an image of m x n pixels as exploration space, represented by an array P where each pixel is considered as a cell and on a byte (gray pixel). The resulting image C of m/2 Â n/2 pixels is reached by following the steps: • Divide the entire image into tiny nonoverlapping r i blocks of size s Â s (with s << m). More simply, we will proceed with blocks of square size of b x b; this partition called range block will be represented by R N ={r 1 ,r 2 , … ,r N }.
• For all the blocks r i , the scooting wolves roam the space in order to find a di of size 2b Â 2b similar with r i while respecting the parameters mentioned above.
A fitness value f (di) will be assigned for each block d i according to Eq. (6). The block d i is taken for prey.
• After the hunting wolves have inspected the entire space and for all r i blocks, d i blocks with the best physical form are selected. It will be mapped according to Eqs. (4) and (5).
If no improvement is made to the wolf chef solution, the process will be stopped after a fixed number of iterations. The adapted WPA algorithm for FIC is showed as: While not (Iter-scoot < It) Pick random numbers: λϵ[À1,1] For each r i do

BAT-inspired algorithm introduced in FIC
The similar idea employed in the wolf pack algorithm and the BAT algorithm for FIC is completed through the succeeding phases: 1. The whole image is scouted randomly by bats with the use of loudness L and frequency F.
2. Each block is compared to all of its neighboring blocks by bats for its degree of homogeneity as a function of volume and frequency. If they meet a criterion (color_level_block -neighboring color level ≤ frequency), we create a domain block of size L * L whose value is only the mean of the domain block.
3. When the bats roam the whole picture. The iteration will be stopped.

4.
After decomposing the image into domain blocks, the bats' position themselves at xi, and the size of the blksz block will be saved in a sparse S.

5.
By eliminating the solution with the smaller block, we try to find the best solution in this step. 6. In order to calculate the compression ratio, we will use Huffman encoding to store all information (locations, block sizes, and values).
7. Finally, and to reconstruct the image, we will use Huffman decoding to regenerate the image data of the compressed image.

Fractal image compression with WPA
The resolution presents an aspect that should not be ignored when trying to test the efficiency of an approach. For our circumstance, we will take into consideration the three test images (Lena, Barbara, and cameraman) with different resolutions (16 * 16, 32 * 32, 64 * 64, 128 * 128, 256 * 256) so that we can see the impact of this factor on the quality quantities (compression ratio, compression time, EQM, PSNR) (Figures 1 and 2).
From the test images with a reconstructed resolution of 256 * 256, it can be seen that the quality of the images is acceptable to a very good degree. And to be more exact, we must refer to calculable measures.
The table below presents the results obtained by applying our approach to the above images with different resolutions: The results obtained (detailed in Table 1) illustrate firstly the agreement between image resolution and encoding time, which demonstrates that our proposed method is significantly responsive to image resolution; it is also clear that the image quality is in contrast linked to it (image quality degrades quickly as resolution increases). This is clearly shown by the amplitudes of the PSNR and the MSE.
The compression ratio remains relative to the resolution where we indicate that our method interferes in this measurement. Wolves appear when the quantity of blocks is very huge (higher resolution) by contributing a higher compression rate than that existing in lesser resolutions.
Decompression time stays optimized and is similar for almost all methods. This is due to the decompression process which is not complex compared to the compression process.
We will now focus on comparing our proposed method with some other techniques. The following table (Table 2) shows the notable alteration between our method and the others:

Using bat-inspired algorithm to enhance fractal image compression
Bat's number: In Table 3, we will examine the images of the cameraman and Lena in order to extract the adequate number of bats that will be used in our approach.
Loudness: Table 4 presents some tests carried out on an additional stress which is loudness, with the objective of taking into consideration the good value for the test.
Frequency: The last test table (Table 5) is made to pick up the best frequencies that will be used in our algorithm. As we can see from the previous tables, the best choices are given by 8 for the number of bats, 8 for the intensity, and 30 for the frequency, so the treatment parameters are as follows: The number of iterations is in the interval of [10,100]. The number of bats is fixed at 8. Loudness 8, Frequency 30.
We experienced the proposed approach on five images through diverse resolutions. Table 6 illustrates certain quality measurement liable on the resolutions.     Figure 3 shows the image of blonde women before and after proposed compression.
In Figure 4, we show a cameraman image before and after proposed compression, Figures 5 and 6 describe separately Lena and living room images before and after applying the proposed compression.
Finally, we conclude our sequence of assessments with mandrill image before and after proposed compression, in Figure 7.
As we can observe, the images' quality is very suitable. And to approve this effect, Table 6 explores additional quality measure.   The table shows that our approach is significantly sensitive to changing resolutions. It is also clear that the quality of the images is inversely linked to the resolution (as soon as the resolution increases, the quality of the images degrades) which is well proven by the MSE and PSNR measurements.