**5. 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:


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:

**Algorithm 2**. Proposed FIC-BAT

*Optimization of Fractal Image Compression DOI: http://dx.doi.org/10.5772/intechopen.93051*

**For** each bat

**Else**

**End-if End For End-while**

Search for best solutions;

**7.1 Fractal image compression with WPA**

exact, we must refer to calculable measures.

*Tested images (before compression). (a) Cameraman, (b) Lena, and (c) Barbara.*

above images with different resolutions:

**While** not (stopping criteria)

**If** similarity (distance) = 1

**Begin Loudness L**; **Frequency F**;

**End**.

**7. Experimentations**

(**Figures 1** and **2**).

**Figure 1.**

**9**

Initialization: Generate bats (Number\_bats = 1..N) //

Create domain block; Store location in vectors I,J; Store block sizes in vector blksz;

Store the locations and block sizes in a sparse S;

Store location in vectors I,J; Store block sizes in vector blksz;

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)

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

The table below presents the results obtained by applying our approach to the

Algorithm 1. FIC-WPA

```
Initialization:
Generate ri, (i = 1 … N)
For each ri, f(ri) 0, (i = 1 … N)
    While not (stopping criteria)
    it 0
        While not (Iter-scoot < It)
        Pick random numbers: λ ϵ [�1,1]
           For each ri do
                xi xi + λ|xg � xi|
                If (f(bxi) < f(g)) g i
                Endif
           Endfor
        ri v(di)
        Update It
        EndWhile
    EndWhile
End For.
```
### **6. 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:


**Algorithm 2**. Proposed FIC-BAT

The adapted WPA algorithm for FIC is showed as:

Algorithm 1. FIC-WPA

*Fractal Analysis - Selected Examples*

Initialization:

it 0

Generate ri, (i = 1 … N)

**For** each ri, f(ri) 0, (i = 1 … N) **While** not (stopping criteria)

For each ri do

**Endif**

**Endfor** ri v(di) Update It **EndWhile**

**6. BAT-inspired algorithm introduced in FIC**

FIC is completed through the succeeding phases:

**EndWhile**

**End For**.

frequency F.

domain block.

solution in this step.

**8**

**While** not (Iter-scoot < It) Pick random numbers: λ ϵ [�1,1]

> xi xi + λ|xg � xi| **If** (f(bxi) < f(g)) g i

The similar idea employed in the wolf pack algorithm and the BAT algorithm for

1.The whole image is scouted randomly by bats with the use of loudness L and

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

3.When the bats roam the whole picture. The iteration will be stopped.

4.After decomposing the image into domain blocks, the bats' position

store all information (locations, block sizes, and values).

regenerate the image data of the compressed image.

themselves at xi, and the size of the blksz block will be saved in a sparse S.

6. In order to calculate the compression ratio, we will use Huffman encoding to

7.Finally, and to reconstruct the image, we will use Huffman decoding to

5.By eliminating the solution with the smaller block, we try to find the best

