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

HAL
open science

# Application of Image Segmentation Technology in Crop Disease Detection and Recognition

Leilei Deng, Zhenghao Wang, Hui Zhou

► To cite this version:

Leilei Deng, Zhenghao Wang, Hui Zhou. Application of Image Segmentation Technology in Crop Disease Detection and Recognition. 11th International Conference on Computer and Computing Technologies in Agriculture (CCTA), Aug 2017, Jilin, China. pp.365-374, 10.1007/978-3-030-06137-1_33. hal-02124239

HAL Id: hal-02124239

https://inria.hal.science/hal-02124239

Submitted on 9 May 2019

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_2.png" /></figure>

Distributed under a Creative Commons Attribution 4.0 International License
Application of image segmentation technology in crop disease
detection and recognition

Leilei Deng¹(✉), Zhenghao Wang¹, Hui Zhou²

School of Information Technology, Jilin Agricultural University, Changchun 130118, China

{deng leilei, wang zhenghao, zhou hui} E-mail: 879579494@qq.com

**Abstract:** Computer vision technology and image processing technology are applied in the field of agriculture gradually. How to diagnose crop diseases quickly and effectively has become a research hotspot. In this paper, we combine edge detection and fuzzy clustering algorithm to get the new algorithm through the experiment of more than 1500 pictures. The different kinds of diseases and insect pests of the 5 different crop leaves are used as the research object. Through the gray processing of the images, the removal of the unrelated background, the image segmentation, and the filling of the pixels of the crop disease and insect pests, the final calculation is final. The degree of crop leaf diseases and insect pests is calculated. From the experimental data, the degree of crop damage can be accurately reflected, and the degree of crop leaf disease and insect damage can be calculated, and the automatic batch operation of image segmentation can be realized.

**Keywords:** Image segmentation; Regional location; Crop; Recognition processing

# 1 Introduction

Agriculture is the cornerstone for development of our economy. Along with the improvement of living standards, demands of high reliable crop have grown in people's mind. In the practical production, the crop disease is an important factor limiting the growth of farmers, which causes huge loss and a direct influence on the crop market. Farmers mostly depend on its own experience to restore the crop disease. And having gained some effect, but due to farmers are not experts and recognition capability is limited, the crop disease is often invisible to the naked eye cannot figure out "atcs appropriately the situatio" and timely preventing. So depend on visual system and rich experience( subjectivity, limitation, fuzzy) that is not enough to say the science of the disease identify. The traditional disease detection method not only time consuming, but also impacts the forecasted accuracy of the crop disease. With the rapidly developing of computer image processing and identification technology, it is possible for the crop disease to accurately identify, timely detection, adopt right measures and reduce losses. Therefore, it is endowed with great significance.

*Deng Leilei, in Changchun City, Jilin Province, Master, Associate professor
Wang Zhenghao, in Changchun City, Jilin Province, Postgraduate student
Zhou Hui, in Changchun City, Jilin Province, Postgraduate student
## 1.1 The Definition of Image Segmentation

Image segmentation technology has been developing for many years, scholars have made the expressing method of different interpretations and forms. In common parlance, the image segmentation call the propect that is the separation of useful and worthless content to reserve useful image information, which is the first step to the image processing and what to leave off is the background. Only after completion of the operation, the higher order operation can go on in the following image processing. For more abstract statement, the image segmentation means that the pixels in the image broken into separate blocks according to characteristics. The pixel in block has the same attributes where a different block is used for the value of output pixels is quite different. The computer programing technique might prefer the image segmentation, which provides the service locators to describe. R is set to the image to be split in a set. If R1, R2, R3 and RN are the correct segmentation, the following five conditions will be satisfied.

$$ \cup_{i=1}^{N} R_i = R \qquad (1) $$

$$ \forall i, j, i \neq j, R_i \cap R_j = \emptyset \qquad (2) $$

$$ i=1, 2, \dots, N, P(R_i)=T \qquad (3) $$

$$ \forall i, j, i \neq j, P(R_i \cap R_j)=F \qquad (4) $$

$$ i=1, 2, \dots, N, R_i \text{ is not empty} \qquad (5) $$

Description(1) says that the subset combination is equal to the collection of image. Description(2) says that the two of these subsets are neccessary to be disjointed, which the each segmentation is independent. Description(3) shows that all elements of the each subset are connected[1]. Description(4) says that all elements of the different subset are disconnected. Description(5) says that the each subset must be non-null. The image can split by defining and the defined way of expressiveness has great significance. The image segmentation is extracted and the useful region is marked, and the usefulness of regions completely be defined subjectively. It is truly successful when the useful region can be extracted[2,3,4].

# 2 Different Identification Methods

## 2.1 Threshold Segmentation Method

The threshold segmentation method is a simple and efficient image segmentation method, which useing one or more thresholds to the image grayscale is divided into several parts, the same part of the pixel is a whole. The threshold segmentation method is the earliest method to study the image identification of the crop disease[5]. In 1989, the threshold segmentation method is first proposed by the Japanese to divide the sagittifolia disease leaf of micronutrients such as calcium, magnesium and iron. Because the extracted RGB bar chart features and location characteristics are not representative, which resulting in segmentation effect is not ideal[6]. On the basis of it, the
domestic Chen Jiajuan try to use the local threshold method to extract the bar chart feature and adopt local threshold segmentation to segment the cotton disease image from the background in a laboratory environment. In 2009, the British scholar in the plant disease recognition identification system, taking the banana and plantain black leaf streak as an example, and using the optimal threshold of the bar chart segmentation method, the lesion and the background of the leaves are successfully separated, and the impact is positive. The characteristic of the threshold segmentation method are that is both simple and space-efficient, the difficulty lies in the selection of threshold. The texture and color of the pest area are different from the pest-free area, and based on analyzing the gray bar chart can be more intuitive to find the threshold to achieve the image segmentation.

<figure><img src="image_3.png" /><figcaption>Figure.1. The simple process of Threshold Segmentation</figcaption></figure>

## 2.2 Edge Detection Method

Much of the information of the image exists in the edge that the basic characteristic of the edge can effectively solve the problem of the image segmentation. The edge detection method is classical image segmentation theory, which is widely used in image segmentation. In 2011, Baumt uses the Soble edge detection algorithm to separate the wheat plaque from the background. And in 2012, He Dandan uses the algorithm is designed by combining the minimum external rectangle algorithm with the median filter and the Canny operator to propose the rice leaf edge detection algorithm based on multi-strategy fusion technology, which is efficient and accurate. The edge detection method is based on the change of the gray value of the pixel on the edge in between the different region. In the crop disease image, there are many mutations in the edge gray value of the disease. Although the edge detection method has such features as easy operation, the disadvantage of the segmentation efficiency depends on the edge detection operator and the robustness is poor[7,8].

People will notice the place where objects intersect when they see a picture, and people can select the main useful information automatically in the brain. And the place where objects intersect is also the area where the gray value of the image changes obviously. The regional information provides important information for the main location of the image, which provides the important basis for the segmentation of the target object. The study found that the region where the gray value of the image violently would normally be the edge of the object. If people can determine the edge of the object, through variance of the gray value, which can improve efficiency and accuracy of the image segmentation. The edge of the image is the important and useful information in the image segmentation. The characteristic of the pixel of the image along the edge becomes incontinuous, which can be a great help by finding the edge of the object in the image[9]. The researchers found that the signal presented along the edge of the form can be roughly classified into three ways. The three types are the stepped edge, the roof-edge and the linear edge. The characteristic of the stepped edge is that the gray value of changing abruptly up and down in the steady state, and the balance is maintained after it complete the change. The roof-edge is characterized by the fact that the gray value in the state is slow rising and slow descending, however, there is a turning point, the gray value of the sudden change in the state of slow
descending and slow rising. And the characteristic of the linear edge is that the gray value in the steady state suddenly upward and downward after the dramatic change, however, the gray value of the state has gone through a series of changes can return to the original state soon[10]. The three forms of edge should look like the Figure. 2 below.

<figure><img src="image_4.png" /><figcaption>Figure. 2. Three forms of the edge</figcaption></figure>

There are recognizable and unrecognizable diseases in the image areas. In order to achieve higher recognition accuracy of the disease area, we can set the initial image of the initial position in the image, where the length and width of the rectangular box represent a certain percentage of the length and breadth of the image, respectively. The two experiments are carried out through a large number of the image measurements. The average value $\alpha, \beta$ where $\alpha = 0.7$ is the long scale factor of the image and $\beta = 0.8$ as the image of the wide scale factor [11].

## 2.3 Accurate Location Method

Combined with the edgelocation method, the image of the target region of the position box to further refine and make the four sides closer to the edge of the disease area. Such as outward gradually widening. For example, taking the border outward a distance, and the original frame will form a new expansion region after the distance of the border and the original, as this Figure. 3 shows, the region is set to D. In this region, the number of the edge information is calculated by the edge detection algorithm iterative computation[12]. This process can be carried out several times and kept it. Compare the completion to the amount of information within specified time limits. Of course, the optimal solution contains the most edge information to determine the final precise border.
<figure><img src="image_5.png" /><figcaption>Figure. 3. Diagram of the Accurate Location Method</figcaption></figure>

Left, right, and bottom three borders of the calculation of the step size, as shown in Figure. 3.

(1) Specifies that the vertex of the lower left corner of the original image is at the origin of the coordinate axis. The left edge of the original image coincides with the ordinate axis and the lower edge coincides with the abscissa axis. The original image length is L and the width is t W.

(2) If the rectangle length and width of the disease area are a*b and the center coordinates are (x₀, y₀), then the size of the rectangular box of the crop is 4a*3b and the abscissa of the center coordinates of the rectangular box remains unchanged. The vertical coordinates of b/2+2b is that the crop coordinates of the rectangular box center coordinates (x₀, y₀-5a/2). The distance from the left frame to the ordinate axis is wL=x₀-3b/2, the distance from the right frame to the right edge of the original image is wR=W-x₀-3b/2, the distance from the lower edge to the abscissa axis is wB=y₀-9a/2 and the number of expansion is 3 times, which you can calculate the expansion time. The three borders of the respective steps, set the left side of the block step dL, the right border step dR, the lower frame step dB, then dL= (x₀-3b/2) / 3 and dR=(W-x₀-3b/2)/3, dB=(y₀-9a/2)/3 [13,14,15].

2.4 Fuzzy Clustering Method

Ruspin first proposed the fuzzy clustering theory in 1969 based on the unsupervised learning
of pattern recognition [16]. In 2009, Wang Shouzhi adopts the Mercer kernel based on K-means
clustering algorithm to complete the maize leaf disease spot segmentation, and the correctly in
82%. In 2012, JawareTH utilizes the Otsus algorithm to calculate, and the edge of the infected
image is eliminated by using the optimized K-means clustering method[18]. The algorithm is
proved to be an efficient and high-precision segmentation algorithm. In 2012, Li Zhen uses the
model of Lab color based on k-means clustering method to identify the color image of the red
spider.

The fuzzy clustering method dictates the parent-child relationship of the each pixel of image has fuzziness, and the fuzzy clustering method has been used abroad in recently years. A massive amount of the crop disease image data will get the feature of ambiguity and uncertainty. The membership function of the fuzzy clustering will be modeled with the feature of ambiguity and uncertainty, therefore it is not only suitable for still the image segmentation. The fuzzy clustering method also has flaws, the sensitivity of the noise and initialization data and the calculation of algorithm are the practical application of the agricultural production to become further improvement and optimization [17].

# 3 Image Segmentation Algorithm

## 3.1 The Flow Diagram of Segmentation Algorithm

We will illustrate the image segmentation algorithm by considering the simple process shown in figure. 4[19].
<figure><img src="image_6.png" /><figcaption>Fig. 4. Flowchart of the diseased Image Segmentation Algorithm based on pre-detection</figcaption></figure>

## 3.2 Segmentation Result

After the algorithm implementation, the paper experiments with the 1500 images to meet the scientific and extensive nature of the experimental samples and choose the disease image in the actual marketing network system consist of the disease image, not diseased image, simple background image, complex background image and the color of the black and gray[20]. In order to
obtain the experimental results of the new algorithm and be convenient for the reference and comparison based on the classical Crabcut algorithm.

The maximum between-cluster method of the divisions, shown in the diagram as below. The crop disease is calculated. Firstly, the size of the segmented image (unfilled) for calculation. Then, the target area is filled with the segmented image and the disease is filled as shown below. The degree of crop disease can be calculated by the corresponding image pixel spot, where M and N are the width of the image in pixel and the height of the image in pixel, and the maximum number of the black and white pixels in the binary image is divided by the maximum between-cluster method[21]. By way of example, the $X_2$ represents the total number of white pixels in the A area (including the disease region of the target leaf), the $X_2$ represents the total number of black pixels, and according to the demands to the target object. Therefore, the binary image of the disease in the black pixel filled with the black pixel, and called the binary image in Matlab. After the disease area has been filled, the white pixel of the disease area is filled again and the full black pixel is filled after the statistical filling. The $X_3$ represents the number of the black pixel i where is the number of the disease spot. Finally, can obtain the percentage of the leaf disease is $L = (X_1 - X_2) / X_3 \times 100\%$.

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

a

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

b

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

c

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

d

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

e

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

A

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

B

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

C

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

D

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

E

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

f

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

g

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

h

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

i

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

j

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

F

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

G

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

H

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

I

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

J

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

k

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

l

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

m

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

n

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

o

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

K

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

L

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

M

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

N

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

O
<figure><img src="image_37.png" /></figure>

## 4 Evaluation of the Result

The different types of crop diseases are taken as the research subjects. The size of the crop disease is calculated by the gray processing of the image, the removal of the background quantity, the image segmentation, the filling of the pixels in the crop disease area[22]. Experimental results show that the average danger degree of tomato, pepper, rice, citrus and maize disease is 9.36%, 3.174%, 7.393%, 3.723%, 11.306%, respectively. And the results of the miss rate of tomato, pepper, rice, citrus and maize disease area is 0.767%, 0.549%, 0.922%, 0.253%, 0.902%[23], respectively, and can be control at a lower percentage. The error rate reflects the difference of the effect of the different sample segmentation, and the experimental data can reflect the degree of crop disease accurately. According to the segmentation results, the maximum between-cluster is not ideal for the segmentation effect[24]. As the lesion area to deal with, so the algorithm optimization needs to be further improved. The percentage of crop disease can effectively control the dose of pesticide with reduced environmental pollution. The studied result will provide a certain scientific basis for the quality of the crop disease.

## 5 Conclusions

The paper consider finding the available method of image processing to resolve the problem by measuring the damaged degree of crop leaves. Firstly, the sample image is executed to pre-process. Then, using the maximum between-cluster segmentation algorithm to catch the pest and pest-free areas of crop leaves. Finally, a method to the pest area is used to filling of picture element, and the crop disease degree percentage is calculated. The method is suitable for the determination of many kinds of crop diseases, but the leaf disease spot is still indivisible, which need to be further improved and perfected.
References

1. Zhang Shuifa, Wang Kaiyi, Zu Qin, et al.: Algorithm for Damaged Leaf Segmentation Based on Block Mark. J. Transactions of the Chinese Society of Agricultural Engineering(Transaction of the CSAE). 30, (2014)

2. Ge Jing, Shao Lushou, Ding Kejian.: Image Detecting for Hazard Levels of Corn Spots. J. Transactions of the Chinese Society of Agricultural Machinery. 21, (2008)

3. Zhang Fang, Wang Lu, Fu Lisi.: Recognition of Cucumber Leaf Disease Based on Support Vector Machine. J. Journal of Shenyang Agricultural University. 45, (2014)

4. Diao Zhihua, Wang Huan, Song Yinmao., et al.: Segmentation Method for Cotton Mite Disease Image under Complex Background. J. Transactions of the Chinese Society of Agricultural Engineering(Transaction of the CSAE). 05, (2013)

5. Chen Jinwei, Wu Bing.: A Otsu Threshold Segmentation Method Based on Rebuilding and Dimension Reduction of the Two-Dimensional Histogram. J. Journal of Graphics. 36, (2015)

6. Ma Xiuli, Jiao Licheng.: SAR Image Segmentation Based on Watershed and Spectral Clustering. J. Infrared Millimeter Waves. 06, (2008)

7. Zheng Jiaming, Chen Zhaojiong.: Connectivity Constrained Graph-Cut for Fast Interactive Image Segmentation. J. Journal of Computer-Aided Design & Information Technology. 03,(2011)

8. Liu Jia, Wang Hongqi.: A Graph Cuts Based Interactive Image Segmentation Method. J. Journal of Electronics & Information Technology. 08, (2008)

9. Han Shoudong, Zhao Yong, Tao Wenbing, Sang Nong.: Gaussian Super-Pixel Based Fast Image Segmentation Using Graph Cuts. J. Acta Automatica Sinica. 01, (2011)

10. Li Shuanqiang, Feng Qianjin.: Liver Tumor Segmentation Using Graph Cuts Based on CUDA. J. Chinese Journal of Biomedical Engineering. 05, (2011)

11. Chen Xiaodan, Li Siming.: Research Progress on Image Segmentation. J. Modern Computer(Professional Edition). 33, (2013)

12. Liu Chen, Li Fengxia, Zhang Yan.: An Interactive Object Cutout Algorithm Based on Graph-Cut and Generalized Shape Prior. J. Journal of Computer-Aided Design & Computer Graphics. 12, (2009)

13. Li Xiaobin, Tian Zheng, Liu Mige, Xu Haixia.: Image Segmentation based on Weighted Cut. J. Journal of Electronics. 01, (2008)

14. Li Yuchuan., Tian Zheng.: Multiscale Image Segmentation Based on Graph Weighted Kernel K-means. J. Acta Optica Sinica. 10, (2009)

15. Tang Peng, Gao Lin, Cheng Peng.: A Novel Dynamic Shape Based Infrared Object Subtraction Method. J. Journal of Optelectronics•Laser. 08, (2009)

16. Wang Mei, He Gaoming, He Jie.: Analysis and Comparison of Common Image Segmentation Techniques. J. Computer CD Software and Applications. 06, (2013)

17. Wang Yixiu.: An Enhanced Scheme for Interactive Image Segmentation. J. Journal of University of Science and Technology of China. 02, (2010)

18. Tao Wenbing, Jin Hai.: A New Image Thresholding Method Based on Graph Spectral Theory. J. Chinese Journal of Computers. 01, (2007)

19. Wei Qing, Lu Zhaogan, Shao Chao.: Discriminatory Technology of Necessity for Image Segmentation Based on Complexity Index. J. Computer Engineering and Applications. 16,
(2013)

20. Huang Xiaoli, Zeng Huanglin, Wang Xiubi, Liu Yongchun.: Image Segmentation Based on Pulse-Coupled Neural Networks. J. Information Technology. 09, (2008)

21. Gong Yongyi, Huang Hui, Yu Jiming, Guan Lvtai.: Entropy Based Bi-region Image Segmentation. J. Journal of Image and Graphics. 05, (2011)

22. Zhang Fu, Li Xinglai, Chen Jiajun.: Research on Application of Image Segmentation Method. J. Technology Innovation and Application. 04, (2012)

23. Li Dan.: Image Segmentation Methods and its Applications. J. Science and Technology Information. 36, (2010)

24. Xiao Fei, Qi Xingguang.: A Survey of Image Segmentation. J. Programmable Controller & Factory Automation(PLC & FA). 11, (2009)

25. IJ-Open CV:Combining Image J and Open CV for processing images in biomedicine. César Domínguez,Jónathan Heras,Vico Pascual. Computers in Biology and Medicine . 2017

26. Text-independent speaker verification using ant colony optimization-based selected features[J]. Shahla Nemati,Mohammad Ehsan Basiri. Expert Systems With Applications . 2010 (1)

27. Category Level Object Segmentation by Combining Bag-of-Words Models with Dirichlet Processes and Random Fields[J]. Diane Larlus,Jakob Verbeek,Frédéric Jurie. International Journal of Computer Vision. 2010 (2)