# Research of Fractal Compression Algorithm Taking Details in Consideration in Agriculture Plant Disease and Insect Pests Image

Qiao Deng, Chunhong Liu, Liting Fu

► To cite this version:

Qiao Deng, Chunhong Liu, Liting Fu. Research of Fractal Compression Algorithm Taking Details in Consideration in Agriculture Plant Disease and Insect Pests Image. 9th International Conference on Computer and Computing Technologies in Agriculture (CCTA), Sep 2015, Beijing, China. pp.496-504, 10.1007/978-3-319-48354-2_50 . hal-01614216

HAL Id: hal-01614216

https://inria.hal.science/hal-01614216v1

Submitted on 10 Oct 2017

HAL is a multi-disciplinary open access
archive for the deposit and dissemination of sci-
entific research documents, whether they are pub-
lished or not. The documents may come from
teaching and research institutions in France or
abroad, or from public or private research centers.

L'archive ouverte pluridisciplinaire HAL, est
destinée au dépôt et à la diffusion de documents
scientifiques de niveau recherche, publiés ou non,
émanant des établissements d'enseignement et de
recherche français ou étrangers, des laboratoires
publics ou privés.

<figure><img src="image_1.png" /></figure>

Distributed under a Creative Commons CC BY 4.0 - Attribution - International License
Research of Fractal Compression Algorithm
Taking Details in Consideration in Agriculture Plant
Disease and Insect Pests Image

Qiao Deng¹, Chunhong Liu¹,²,*, Liting Fu¹

¹College of Information and Electrical Engineering, China Agriculture University,
Beijing,P.R.China 10083

²Beijing Engineering and Technology Research Center for Internet of Things in Agriculture,
Beijing, P.R.China 100083

Tel.:+86-010-63736764, fax: +86-010-63737741

E-mail: sophia_liu@cau.edu.cn

**Abstract.** Agriculture plant disease and insect pests is varied and tremendously harmful, so experts are needed to diagnose. But experts can't have the energy and time to the field for the majority of farmers to guide, they can only get the image through remote. However, agriculture plant disease and insect pests image is rich in detail, while transmission bandwidth and storage is limited, it is necessary to compress image to make sure of image quality. This paper proposes an improved method based on Jacquin theory to reduce coding time. Encoded sub block is classified into detailed block and non-detailed block, so we can reduce the encoding time. Experimental results show that, for the agriculture plant disease and insect pests image which is rich in detail, the number of encoded blocks reduces to 31.45% and the encoding time reduces to 32.9% of the original one.

**Keywords:** plant disease and insect pests image, detail, fractal encoding, image compression

# 1 Introduction

China is an agricultural country with the frequency of crop disasters. The great harm of crops diseases and insect pests is an important restriction factor of agricultural product quality improvement. On the other hand, the scientific and technological cultural quality of farmers is generally low, and they are urgent to be guided by experts who have knowledge of crop diseases and insect pests. But experts can't have the energy and time to the field for the majority of farmers to guide, they can only get the image through remote. However, agriculture plant disease and insect pests image is rich in detail and it contains a lot of information. So it need much transmission bandwidth and storage. At present, because the cable communication cable is unable used to cover the majority of farmland, the wireless wide area network technology can be used to transmit the field images. The wireless communication network is narrow of bandwidth, easy of jitter, low of transmission efficiency, so it is not conducive to transmit a large amount of data. Therefore, it is very important to
develop an algorithm of high compression ratio, good quality in transmitting agricultural images [1].

There are many classification methods for image compression, the most commonly used one is lossless compression and lossy compression. Lossless compression is a technique of image compression and decompression without any loss of data. Image obtained by decompressing the image is completely equal to the original image, but the compression ratio is about 2:1, which is a very low ratio [2]. Lossy compression can be reconstructed only by the approximation of the original one, the reconstructed image is similar to the original one, but it is not the exact copy. Lossy compression can get higher ratio compare to lossless compression [3].

In decades of image compression research, great progress has been made with image compression technique, and a series of international compression standards were formed, such as JPEG based on DCT and JPEG2000 based on wavelet transform that have been widely used[4]. Although these methods have achieved a higher compression ratio, however, compared with a rapid development of multimedia technology, a development of image compression is relatively backward. Moreover, these traditional compression algorithms still have some problems, such as low compression ratio, the block effect, etc. In recent years, in order to overcome the shortcomings of traditional image compression, experts and scholars proposed many new compression and broke the limitation of traditional entropy coding, such as fractal image compression [5].

Fractal compression method is a new method of compression in the 90's of last century. It uses the similarity of image itself to achieve compression, so we can achieve a high compression ratio. In 1990, A.E.Jacquin, one of Barnsley's student, using local iteration function theory, put forward a full automatic fractal image compression based on block and make fractal image compression from manual coding to automatic coding become a reality[6].

When small scale for sub block was used in Jacquin algorithm encoding, lost details were small and encoding time is short, but the compression rate is low. While the use of large scale for sub block encoding is the opposite. To improve the efficiency of Jacquin algorithm, quartering method, adaptive search method and other fractal generation algorithms have been proposed in recent years. But when encoding image of rich details, compression rate of these algorithms is almost same with the original one, and the encoding time is too long [7]. Therefore, this paper proposes a fractal image algorithm based on image details to shorten compression time and improve the efficiency of encoding [8].

## 2 Jacquin Algorithm

In corresponding decompression process, fractal compress is used as operator to calculate fixed point, which is suitable for the situation of one compression, multiple decompression. The basic compression algorithm is shown in Fig.1. First, original image was divided into blocks of equal size, which was called range block (R) or sub block, then image region matching for each range block R was found, called domain block (D) or parent block. The length of parent block is generally 2 times of the sub block [9]. Then it shrinks to the same size to match the range blocks, then rotates and transforms symmetricly to get 8 transformed domain blocks. Comparing
transformation of domain blocks with every range block to search the best match of the domain block. Compression coefficients and offset were calculated, so that the error of R and sD+oI is the smallest, I is a unit vector whose size is the same as D. After calculating the whole image, the encoding parameters are obtained [10].

<figure><img src="image_2.png" /><figcaption>Fig.1. Regional matching image</figcaption></figure>

Jacquin compression algorithm solves the image segmentation problem of Barnsley compression algorithm, by taking use of local self-similarity to construct affine transformation, which is the first practical image segmentation method. However, the searching volume of sub block is very large and searching time is very long. For example, an original image A, if there are 2^N × 2^N pixels, by using Jacquin's compression algorithm, can be divided into sub block of 2^N × 2^N. Sub blocks were not relevant, the number of sub blocks were:

$$n = \frac{2^N \times 2^N}{2^R \times 2^R} = (2^{N-R})^2 \quad (1)$$

If A is divided into parent block of 2^D × 2^D, D>R, the number of parent blocks is: (2^N - 2^D + 1) × (2^N - 2^D + 1).

In Jacquin algorithm, 8 kinds of transformations, such as rotation and reflection, are performed to a parent block. So 错误!未找到引用源。8×(2^N - 2^D + 1)×(2^N - 2^D + 1) times searching for computation is needed to complete encoding. The magnitude of searching is about 错误!未找到引用源。. For example, a gray image of 512 × 512 pixels is divided into sub blocks of 8 × 8 and parent blocks of 16 × 16. Each sub block is compared with (512-16+1) × (512-16+1) =247009 parent blocks, and each time there are 8 kinds of operations such as rotation, reflection, in the comparison with parent blocks.So each sub block is compared 8 × 247009=1976072 times. All sub blocks are compared 4096 × 1976072=8093990912 times [11].错误!未找到引用源。

Thus, the main reason for the slow speed of the fractal image encoding is that time searching for the best parent block consume too much. Therefore, researching for a fast and effective method of encoding is an important direction of fractal encoding [12].

The above discussion shows that, using Jacquin algorithm, for each sub block 错误!未找到引用源。, the number of parent block D, needed to search is:
$$K = 8 \times (2^N - 2^D + 1) \times (2^N - 2^D + 1) \quad (2)$$

Fixed network algorithm is that position of the parent block is fixed on the image grid to reduce the number of K. There is no need to search for each possible parent block but to search for the parent block on the grid. So the number of searching times can be reduced not to produce much impact on the compression quality [13]. The grid interval is $l$, which is distributed in image A, **错误!未找到引用源**. The upper left corner of parent block is located on the grid. This number of parent block is:

$$K_1 = \frac{1}{l^2} K \quad (3)$$

When **错误!未找到引用源**. the number of parent blocks in the parent block library are 1/4 of the original number. But this method is not combined with the characteristics of different images respectively, and it is not adaptive. Therefore, there is great significant to find a kind of image compression algorithm with short encoding time, high image quality and adaptability.

**错误!未找到引用源。**

### 3 Fractal compression algorithm taking details in consideration

A sub block segmented from an image can be divided into two categories. One is rich in detail, the other does not contain details [14]. These two kinds of sub blocks have their own features in the encoding. Sub blocks are rich in detail, which have high complexity and much time to encode. While non-detailed sub blocks have low complexity and high degree of similarity. According to the differences, different methods can be used to encode. The detailed sub blocks have much impact on the quality of the image, so the detailed sub block need to be fully encoded. Non-detailed sub blocks have a high degree of similarity, so that we can only encode a small part of detailed sub blocks to reduce encoding time and encoding space.

In this paper, fractal image algorithm based on details is proposed. Firstly, the edge of the image was detected which is the main component of the image details. Sobel algorithm was used to detect the edge of the image. The operator of Sobel algorithm is:

$$D(x, y) = \begin{cases} f(x-1, y-1) + 2f(x-1, y) + f(x-1, y+1) - f(x+1, y-1) - 2f(x+1, y) - f(x+1, y+1) & (4) \\ f(x-1, y+1) + 2f(x, y+1) + f(x+1, y+1) - f(x-1, y-1) - 2f(x, y-1) - f(x+1, y-1) & \end{cases}$$

To filter out the details which can't be resolved by human eyes, we treat them as non-detailed part, a threshold value need to be set. The formula is:

**错误!未找到引用源。**

$$D'(x, y) = \begin{cases} D(x, y) & (D(x, y) \ge T) \\ 0 & (D(x, y) < T) \end{cases} \quad (5)$$

T is the threshold value, **错误!未找到引用源**. is the gradient after setting the threshold value. The selection of T is based on adaptive method and the value is 1/5 of the max gradient value. After the details of the image was detected, the encoding detailed sub blocks were selected. The selection method is to calculate the sum of gradient of each pixel in the sub block and calculate whether the sub block contains the details. The mathematical expression is: **错误!未找到引用源。**
$$s_{ij} = \sum_{x=0}^{M-1} \sum_{y=0}^{N-1} D'(x, y) \qquad (6)$$

$s_{ij}$ is the sum of internal pixel's gradient value of sub block whose coordinate is $(i, j)$. If $s_{ij}$ is not 0, then the sub-block is considered containing details. After analyzing all the sub blocks, we start encoding from the first sub block. First sub blocks containing details were encoded, then a representative of non-detailed sub block for encoding was selected. The method to select detailed sub block is to calculate the variance of each pixel value and average gray value in each sub block and select the block which has mini variance as a non-detailed block encoding.

First, calculate the average gray value $U(s_{ij})$错误!未找到引用源。of sub blocks whose coordinate is $(i, j)$:

$$U(s_{ij}) = \frac{1}{M^2} \sum_{n=0}^{M-1} \sum_{m=0}^{M-1} s_{ij}(m,n) \qquad (7)$$

Then calculate the variance 错误!未找到引用源。according to its gray mean value:

$$D(s_{ij}) = \sum_{n=0}^{M-1} \sum_{m=0}^{M-1} (s_{ij}(m,n) - U(s_{ij}))^2 \qquad (8)$$

错误!未找到引用源。

Because there are only difference 错误!未找到引用源。on the gray level between other no-encoded sub blocks and the sub blocks of mini variance, we can get the encoding parameter $p'$, $g'$ of other no-encoded sub blocks according to the parameters 错误!未找到引用源。that sub block D had calculated:

$$\begin{cases} p'(i, j) = p \\ g'(i, j) = g + \Delta N(i, j) \end{cases} \qquad (9)$$

# 4 Experiment and analysis of results

To verify the effect of proposed algorithm, encoding and decoding test were carried for Jacquin algorithm and the proposed algorithm, the computer is Intel(R) Core(TM) i3-2120 3.30GHz. The size of test image is 256 × 256 pixels, which is shown in Fig.2, the image is a leaf of northern leaf blight of corn. The sub block size is 4 × 4, and is divided into 4096 sub blocks and 1024 parent blocks.

In the experiment, the number of detailed sub blocks, which is obtained by the edge detection algorithm is 1287, about 31.42% of the total blocks. Non-detailed blocks is 2809, about 68.91% of the total blocks. There is a sub block has to encode of the non-detailed blocks, so the actual encoding number is 1288. In this paper, the actual encoding number is 31.45% of Jacquin algorithm. The result of Sobel operators is shown in Fig.3. The distribution of details is shown in this image. The result of 10 times decoding image using Jacquin algorithm is shown in Fig. 4. The result of 10 times decoding image using algorithm of this paper is shown in Fig.5.
<figure><img src="image_3.png" /><figcaption>Fig.2. Original image</figcaption></figure>

<figure><img src="image_4.png" /><figcaption>Fig.3. The detailed image after calculating by Sobel operator</figcaption></figure>

<figure><img src="image_5.png" /><figcaption>Fig. 4. 10 times decoding image using Jacquin algorithm</figcaption></figure>

<figure><img src="image_6.png" /><figcaption>Fig. 5. 10 times decoding image using proposed algorithm</figcaption></figure>

The comparison of proposed algorithm with the original Jacquin algorithm is shown in Table 1, the PSNR (peak signal-to-noise ratio) is calculated as follows:

$$PSNR = 10 \lg \frac{f_{max}^2}{\frac{1}{MN} \sum_{x=0}^{M-1} \sum_{y=0}^{N-1} [f(x, y) - f_0(x, y)]^2} \quad (10)$$

错误!未找到引用源。$f(x, y)$ is an image to be evaluated, and $f_0(x, y)$ is a referencing image. The image size is $M \times N$.

<table><caption>Table 1. The comparison of proposed algorithm and Jacquin algorithm</caption><thead><tr><td>Encoding algorithm</td><td>Encoding time /s</td><td>Decoding time /s</td><td>Encoding blocks</td><td>PSNR</td></tr></thead><tbody><tr><td>Jacquin algorithm</td><td>440.862</td><td>0.880</td><td>4096</td><td>38.755</td></tr><tr><td>Proposed algorithm</td><td>145.239</td><td>0.683</td><td>1288</td><td>37.863</td></tr></tbody></table>

The PSNR got by using Jacquin algorithm is slightly greater than the proposed one, which is shown in Table 1. While the encoding blocks of the proposed algorithm is
much less than Jacquin's, so time of the proposed algorithm is less compare to Jacquin algorithm. The decoding time is both short. The number of encoded blocks reduces to 31.45% and the encoding time reduces to 32.9% of the original one. This algorithm is better than Jacquin algorithm.

## 5 Conclusions

Fractal image algorithm has much potential of increasing compression ratio, and decoding time is very short. Therefore, in image and multimedia, the fractal image compression algorithm is promising in application. But the process time of the fractal image algorithm is too long to be done, which greatly limits the application of this method.

In this paper, the fractal image compression method based on details of the image was proposed. So the number of sub block encoding is significantly less than the existing method in the image which is rich in detail. Encoding time of proposed method is greatly shorter than the original method, and it improved the compression effect of encoding.

## Acknowled

This paper was financially supported by the National International Cooperation Special Program (Grant No. 2013DFA11320).

## References

1. Salar&N M, Nadernejad E, Najmi H M. A new modified fast fractal image compression algorithm [J]. The Journal of Imaging Science, 2013,61(2):219-231.

2. Y. Fisher. Fractal image compression: Theory and Applications [M]. New York: Springer, 1995,34.

3. Lin Y L, Wu M S. An edge property-based neighborhood regions search strategy for fractal image compression[J]. Computers&Mathematics with Applications, 2011,62(1): 310-318.

4. Shin C W, Chun H C, Chen Y M, et al. The effectiveness of image features based on fractal image coding for image annotation [J]. Expert Systems with Applications, 2012, 39(17):12897-12904.

5. Seeli D S, Jeyakumar M K. A study on fractal image compression using soft computing techniques[J]. International Journal of Computer Science Issues, 2012, 9(6): 420-430.

6. Jacquin A E. Image coding based on a fractal theory of iterated contractive image transformations [J]. IEEE Trans. on Image Processing, 1992,1(1):18-30.

7. George L E, Minas N A. Speeding up fractal image compression using DCT descriptors [J]. Journal of Information and Computing Science. 2011,6(4):287-294.

8. PeiXin N. Image compression research based on fractal theory [D]. Chongqing University.2012 (in Chinese).

9. Sheng Fei. Fast encoding algorithm for fractal image compression [D]. Nanjing University of Posts and Telecommunications, 2013(in Chinese).
10.Tang Wujia, Wu Xiaohong, Yu Yanmei, Luo Daisheng. Fractal encoding compression method based on detail block of image [J]. Computer Engineering. 2010, 09:217-218+221. (in Chinese).

11.Wang X.Y.A fast fractal coding in application of image retrieval.Fractals, 2009, 17(4), 441-450.

12.Wee Y C, Shin H J.A novel fast fractal super resolution technique. IEEE Transactions on Consumer Electronics, 2010,56(3),1537-1541.

13.Huang X Q, Yu S L, Zhang W.A noval method for embedding gray image watermarking into orthogonal fractal compression image.Proceedings of International Conference of Communications, Circuits and Systems, 2009, 485-488.

14.Fan Guangchao, Jiang Qiyan. An improved fractal image compression algorithm [J]. Communication Technology, 2013, 04:109-111. (in Chinese).

**ContactAuthor:** ChunhongLiu (1977- ), female, Ph.D., associate professor, her main research direction is agricultural IOT key technologies and applied research. Phone Number: 010-62736764, E-mail: sophia_liu@cau.edu.cn