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

. 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.


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].

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].

Fig.1. Regional matching image
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 22 NN  pixels, by using algorithm, can be divided into sub block of 22 NN  .Sub blocks were not relevant, the number of sub blocks were: (2 ) 22 If A is divided into parent block of 22 DD  , D>R, the number of parent blocks is: (2 2 1) (2 2 1)      .In Jacquin algorithm, 8 kinds of transformations, such as rotation and reflection, are performed to a parent block.So 错误! 未 找 到 引 用 源 。 8 (2 2 1) (2 2 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 i D needed to search is: ) 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: 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.

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: 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: 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:错误!未找到引用源。 ij s is the sum of internal pixel's gradient value of sub block whose coordinate is (i,j).If ij s 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 ij Us ( ) 错误!未找到引用源。of sub blocks whose coordinate is (i,j): Then calculate the variance 错误!未找到引用源。according to its gray mean value: 错误!未找到引用源。 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:

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.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: 错误!未找到引用源。 () f x, y is an image to be evaluated ,and 0 () f x, y is a referencing image.The image size is M  N.

Table 1 .
The comparison of proposed algorithm and Jacquin algorithm