# Research on Color and Shape Recognition of Maize Diseases Based on HSV and OTSU Method

Guifen Chen, Ying Meng, Jian Lu, Dongxue Wang

► To cite this version:

Guifen Chen, Ying Meng, Jian Lu, Dongxue Wang. Research on Color and Shape Recognition of Maize Diseases Based on HSV and OTSU Method. 10th International Conference on Computer and Computing Technologies in Agriculture (CCTA), Oct 2016, Dongying, China. pp.298-309, 10.1007/978-3-030-06155-5_30. hal-02179991

HAL Id: hal-02179991

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

Submitted on 12 Jul 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_1.png" /></figure>

Distributed under a Creative Commons Attribution 4.0 International License
Research on color and shape recognition of maize
diseases based on HSV and OTSU method

Guifen Chen¹〔*〕, Ying Meng¹, Jian Lu¹, Dongxue Wang²

School of Information Technology, Jilin Agricultural University, Changchun

130118,China[guifchen@163.com](mailto:guifchen@163.com)

**Abstract:** With the application of IOT technology in maize disease images for monitoring and collecting, timely detection of the types and characteristics of identification of disease has become a hot research in the diagnosis and treatment of diseases and insect pests. In order to improve the recognition accuracy of maize leaf, achieve rapid diagnostic purposes, this paper takes the leaf spot of maize gray leaf spot and image as the research object, use the computer image processing technology is studied on the effective segmentation and recognition of color and shape features. The genetic algorithm was adopted to optimize the selection of maize disease images real-time filtering; 3*3 mode noise suppression of the image selected by value smoothing; then select the HSV component of the color feature extraction of the disease; the maximum between class variance (OTSU) disease shape character segmentation and recognition. The results show that, based on genetic algorithm optimization based on image In HSV and Otsu method can be more accurate segmentation and recognition of the disease of color and shape features, and enhance the real-time and accuracy of the image of maize disease detection and recognition and oriented under the condition of things plant diseases and insect pests of maize and provide technical support.

**Key words:** maize diseases, genetic algorithm, Internet of things, HSV, OTSU

# 1 Introduction

With the continuous application of real-time monitoring and image acquisition in networking technology and in the maize, single computer image processing technology has been unable to meet the fast, accurate and intelligent identification and diagnosis and treatment of diseases and insect pests. The computer image processing technology, pattern recognition technology and data mining technology effectively, provide a new method for recognition of crop disease and diagnosis, and its objective, rapid, accurate and intelligent features such as increasing attention. To diagnose the disease detection based on image recognition technology, it has become an important research direction of crop disease diagnosis of disease; timely segmentation this
disease diagnosis detection method can be used in real time using color features and
shape features of the disease, to accurately determine the disease category; can make
the disease diagnosis means of detection technology with artificial intelligence
technology, make the diagnosis becomes Intelligent; the use of data mining
technology in the genetic algorithm optimization and neural network method can filter
information effectively and improve the recognition speed. Combined with the
technical, agricultural production personnel can take timely corresponding prevention
measures, which can reduce the loss, improve the yield and quality, increase
economic efficiency, but also reduce the time, the waste of manpower and material
resources, so the study has high practical value.

We in the implementation of the national Spark plan "based on IOT of maize
precision operation technology integration and demonstration (2015GA660004),
based on Internet of things technology in Nongan County, Jilin Province Helong town
and Zhen an establishment of the farmland environment and crop growth monitoring
station, access to a large number of corn growth conditions and pest damage image
information, this study play under the foundation.

At present, with the latest technology of computer image processing and data
mining, this paper intends to study diagnosis recognition by image recognition based
on genetic algorithms and data mining methods such as maize diseases for remote
monitoring of the color and shape, as corn diseases provide fast, accurate diagnosis,
detection of high-tech means, not only can rapid detection of maize disease diagnosis
service for the majority of agricultural production personnel, but also improves the
detection of maize disease diagnosis level, improve the production efficiency of corn.
Through the research of maize diseases, contributed to the development of remote
image recognition technology for the Internet of things in terms of maize disease
diagnosis and prevention research.

## 2 Image preprocessing

### 2.1 Image acquisition

Sources of image acquisition in Nongan County, Jilin Province Helong town and Ann Town, the national Spark Program corn demonstration base. First of all, the use of networking technology establish the farmland environment and crop growth monitoring stations, installed at the same time corresponding maize growth monitoring equipment, in the field of natural light illumination conditions, using the installed professional industrial camera, take a auto exposure mode, capture the maize growth period of leaf disease image and in JPEG format incoming computer, using Photoshop software to remove disease images in the independent part of the background and the uniform size of the image, in order to maize disease images preprocessing using and establish corn leaf disease image library and model library.

### 2.2 Optimal genetic algorithm

Genetic algorithm simulation in the process of natural selection and natural genetic breeding, genetic crossover and mutation phenomenon, in each iteration have retained a set of candidate solutions, and according to some indicators from the solution group in select the better individual, the use of genetic operators (selection, crossover and mutation) of these individual combination, produced a new generation
of candidate solutions group, repeat this process until they meet some convergence index so far.

According to the characteristic of genetic algorithm optimization to grab disease images of preprocessing, all image coding and genetic simulated in the process of reproduction, crossover and gene mutation phenomenon choose the better picture, after continuous iterative screening, selected high quality, clear diagram, picture noise content is less, the initial establishment of Maize Diseases preferred image library.

## 2.3 image smoothing

### 2.3.1 noise suppression algorithm

In this paper, because it is collected in the natural environment image of maize disease, so inevitably exist some random noise, so as to take corresponding countermeasures is the diseases image of the necessary image smoothing processing

Image of simple smoothing of image enhancement is one of the most basic method of treatment, it makes use of the convolution of the image neighborhood pixel gray of average, so as to reduce the image noise influence, the purpose of reducing the contrast of the image. Experiment via the comparison of different smoothing methods, calculate the median value filtering method for digital camera image of maize disease of effective noise processing. Digital camera CCD image sensor is prone to impulse noise, so the adaptive median filtering to filter image of maize disease, can be very good to filter noise. At the same time, the detail loss less.

The n×n median filtering mode. That is to say, only will n² templates window pixel gray value data are sorted, with the median ranking results instead of template window center pixel gray value. Median filtering, the mathematical model for:

$$g(i, j) = \text{median}(f(i, j))$$

g(i, j) represents the output image f(i, j) the input image representation.

Defined by median filtering algorithm which can be inferred, in the n×n in the filter window, if noise pixel number greater than n(n+ 1)/22, the noise will not are filtered, in order to improve the median filtering denoising effect, we must increase the filter window. On the other hand, if the window in figure like details of edge pixel number less than n(n+ 1)/2, details of the pixel will is other pixel gray value substitution, resulting in a fuzzy image detail. Specific core algorithm are as follows:

Label:

I=imread('');

I=rgb2gray(I);

K=medfilt2(J)
### 2.3.2 implementation results and analysis

Respectively of corn leaf blight and gray leaf spot disease of image smoothing processing using median filtering algorithm, according to the definition of the picture is divided into 3×3, 5×5, 7×7 template for comparative analysis. The experimental results as shown in Figure 1(a、b、c、d), figure 2(a、b、c、d)shown in:

<figure><img src="image_2.png" /><figcaption>Fig.1.Median filtering of corn leaf spot disease</figcaption></figure>

<figure><img src="image_3.png" /><figcaption>Fig.2.Gray leaf spot disease median filter</figcaption></figure>

By Figure 1(a、b、c、d)the results can analyze, leaf blight 3×3 model to obtain the image noise suppression better, disorder of image clear display, shown in Figure 1(b), so according to the contrast and selection, decided to use 3×3 median filter model of corn leaf disease image for smoothing.

By Figure2(a、b、c、d)the results can analyze and gray leaf spot of 3×3 model to obtain the image noise is good for reducing, disorder of image display clear, as shown in Figure 2(b), so according to the contrast and selection, decided to use 3×3 median filter model of gray leaf spot of maize disease images for smoothing.

## 3 Image disease color feature extraction

Commonly used color feature extraction method based on RGB color space model, HSV color space model. In this paper the through image processing technology were obtained from the histogram of the image in RGB and HSV color space, intended to be used for the comparison between what kind of method can highlight the image color contrast.

### 3.1 extraction of color component based on RGB

Respectively RGB color components of extraction of image after median filtering selected northern leaf blight of corn and corn gray leaf spot disease, and in the histogram display get various color resolution, the highest and the lowest threshold, selected from the effect of the best component histogram. Experimental results as shown in Figure3(a、b、c), figure4(a、b、c), figure5(a、b、c), Figure6(a、b、c)shown in:
<figure><img src="image_4.png" /><figcaption>(a) R component</figcaption></figure>

<figure><img src="image_5.png" /><figcaption>(b) G component</figcaption></figure>

<figure><img src="image_6.png" /><figcaption>(c) B component</figcaption></figure>

<figure><img src="image_7.png" /><figcaption>(a) R component</figcaption></figure>

<figure><img src="image_8.png" /><figcaption>(b) G component</figcaption></figure>

<figure><img src="image_9.png" /><figcaption>(c) B component</figcaption></figure>

<figure><img src="image_10.png" /><figcaption>(a) R component</figcaption></figure>

<figure><img src="image_11.png" /><figcaption>(b) G component</figcaption></figure>

<figure><img src="image_12.png" /><figcaption>(c) B component</figcaption></figure>

<figure><img src="image_13.png" /><figcaption>(a) R component</figcaption></figure>

<figure><img src="image_14.png" /><figcaption>(b) G component</figcaption></figure>

<figure><img src="image_15.png" /><figcaption>(c) B component</figcaption></figure>

<caption>Fig.6. Gray histogram of gray leaf spot of Maize Based on RGB component</caption>

According to the R component of the color components in the image display effect was significantly higher than that of the other two components, and from the histogram of the image can be obtained color of maximum and minimum threshold image display, including corn big spot the highest threshold for R (80), G (110) and B (100); the lowest threshold for R (140), G (180), B (170). The highest threshold of gray leaf spot of maize for R (105), G (110), B (95); the lowest threshold for R (150), G (160), B (130).
## 3.2 Extraction of color component based on HSV

Respectively HSV color component extraction of image after median filtering selected northern leaf blight of corn and corn gray leaf spot disease, and in the histogram display get various color resolution, the highest and the lowest threshold, selected from the effect of the best component histogram. Experimental results as shown in Figure 7(a, b, c), figure8(a, b, c),Figure 9(a, b, c), figure10(a, b, c)shown in:

<figure><img src="image_16.png" /><figcaption>Fig.7. The corn with disease based on image of HSV component</figcaption></figure>

<figure><img src="image_17.png" /><figcaption>Fig.8. Gray scale histogram based on HSV component of corn leaf spot disease</figcaption></figure>

<figure><img src="image_18.png" /><figcaption>Fig.9. Corn Gray Leaf Spot Disease Based on the HSV component of the image</figcaption></figure>

<figure><img src="image_19.png" /><figcaption>Fig.10. Gray histogram of gray leaf spot of Maize Based on HSV component</figcaption></figure>

Displays the color components in the image hue display effect was significantly higher than that of the other two components, and from the histogram of the image can be obtained tone of maximum and minimum threshold according to the image,
including corn big spot the highest threshold for H (0.35), s (0.4), V (0.3); the lowest threshold value for H (0.25), s (0.15), V (0.75). The highest threshold of gray leaf spot of maize for H (0.35), s (0.25), V (0.46); the lowest threshold for H (0.2), s (0.4), V (0.6).

### 3.3 RGB and HSV comparative analysis results

From RGB and HSV two kinds of color space histogram can be seen in the HSV color space that is more obvious than RGB color space. According to the data analysis obtained by RGB to obtain the color information is easy, but easy to lose some color information, if the extracted R/G/B three channel color information, which will cause the characteristic dimension of redundancy. Affect the recognition accuracy of image. The human visual system sensitivity to color is much higher than the sensitive degree of brightness, so the HSV color model can be more consistent with human visual characteristics. Therefore, according to the experimental analysis and data access assisted selection HSV model as the color feature extraction technique, and to determine the H component the best spot image of target and background discrimination.

## 4 Disease shape feature segmentation and recognition

In order to improve the accuracy of the experiment, the image is segmented by the global threshold method and the maximum between class variance, and the shape feature of the disease is extracted.

### 4.1 Global threshold method

Global threshold is through the global information to obtain the image of a threshold (the minimum threshold), then using this method, the whole image is divided into two regions, namely the target object (black) and background objects (white), the global threshold need to accurately obtain the image of the low threshold, so obtained via RGB and HSV histogram can be directly and accurately obtain disease threshold. The core program is as follows:

Lable:

for i=1:width
for j=1:height
if(I(i,j)>150)
K(i,j)=1;
else
K(i,j)=0;
end
end
end

According to the color contrast and analysis of the process of northern leaf blight of corn and Corn Gray Leaf Spot Disease of two kinds of disease images of maximum and minimum threshold can be obtained by the minimum threshold through the program can be global threshold method to deal with image. The experimental results show that as shown in Figure 11 (a, b):
<figure><img src="image_20.png" /><figcaption>(a) corn northern leaf blight</figcaption></figure>

<figure><img src="image_21.png" /><figcaption>(b) Gray leaf spot of Maize</figcaption></figure>

<caption>Fig.11.Global threshold image of maize disease</caption>

## 4.2 Maximum between class variance method

The Otsu method is first proposed by Japanese scholar in 1979 the Otsu threshold is determined, an adaptive method, also called the Otsu method, referred to as the OTSU[32]. Otsu method for its calculation is simple, stable and effective, has been widely used. The main idea of Otsu method is: from the image the identification of point of view, the separation performance of the optimal threshold should produce the best target and background, for the performance, we can use the variance to represent, therefore can be introduced between class variance between background and target class variance is bigger, explain the background and the target image in the part of the difference is bigger, if will the recognition error led to the phenomenon of the two part of the difference is smaller, the two part of the variance becomes small. Therefore, when the between class variance threshold segmentation means minimizing the probability of error identification.

In order to obtain the optimal threshold segmentation and maximum between class variance the variance between two classes as the criteria, that make the between class variance maximum threshold is derived the optimal threshold segmentation. The maximum between class variance method can give a satisfactory threshold, especially when regional points than was close. The maximum between class variance method is considered to be the most useful global thresholding segmentation method. The core of the program is as follows:

Lable:

while abs(T2-T1)<T0
    T1=T2;
    r1 find(I>T1);
    r2 = find(I<=T1);
    T2=(mean(I(r1))+mean(I(r2)))/2;
    End

The experimental results are shown in Figure 12 (a, b):

<figure><img src="image_22.png" /><figcaption>(a) corn northern leaf blight</figcaption></figure>

<figure><img src="image_23.png" /><figcaption>(b) Gray leaf spot of Maize</figcaption></figure>

<caption>Fig.12.OTUS of maize disease</caption>
## 4.3 Comparison of global threshold and OTUS method

By comparing Figure 11(a、b),12(a、b)global threshold and the maximum between class variance method segmentation recognition image can be found, the global threshold can be split out the disease part, but smaller disease parts of segmentation is not complete; the maximum between class variance method in segmentation recognition process can be smaller due to the disease part segment to more accurate to obtain images of the lowest threshold. At the same time, the disease part of a complete segmentation. So the maximum between class variance method not only can accurately obtain the segmentation threshold, but also more effective accurate knowledge of some diseases.

# 5 Conclusions

Computer image processing technology, combination of networking technology and data mining technology can not only increase the reliability of the experimental data, also can improve the efficiency of this paper on maize disease recognition research, lay a solid foundation for maize disease effective prevention and treatment. The main results of this paper are as follows:

1. to acquire the disease image preprocessing using inheritance algorithm optimization features, from all the pictures in the screening in addition to high quality, clear diagram, picture noise content is less, the initial establishment of Maize Diseases preferred image library.

2. through the contrast color feature based on RGB and HSV method based on the obtained image extraction disease, HSV method as the color feature extraction techniques and determine the H component in lesion images of target and background discrimination best.

3. through the comparison of global threshold and the maximum between class variance method segmentation recognition method to extract shape features of the disease, finally determine the threshold image segmentation to obtain maximum between class variance method is not only accurate, also can more effectively and accurate identification of out of some diseases.

4. based on Genetic Algorithm in optimization of image, based on HSV and Otsu method can more accurately segment and recognize the disease of color and shape features, and enhance the real-time and accuracy of the image of maize disease detection and recognition and oriented under the condition of things plant diseases and insect pests of maize and providing technical support.

# Acknowledgments

This work was funded by the China Spark Program.2015GA66004.“Integration and demonstration of corn precise operation technology based on Internet of things”
References

1. Takahiko Horiuchi, Abdelhameed Ibrahim, Hideki Kadoi. An effective method for illumination-invariant representation of color image[C]//Computer Vision- ECCV2012, 2012, 7584: 401–410.

2. Karaboga D, Basturk B. On the performance of artificial bee colony algorithm[J]. Swarm and Evolutionary Computation, 2012, 2(1): 39–52.

3. Xiuli Si. A Study of Image Processing and Identifying Technology on Cucumber Disease[J]. Jilin Agricultural University. Master Thesis, 2006

4. LIU Yi-xin, GUO Yi-zheng. Gray-scale Histograms Feature Extraction Using Matlab. Computer Knowledge and Technology, 2009

5. WANG Na, WANG Ke-ru, XIE Rui-zhi, LAI Jun-chen, MING Bo LI Shao-kun. Maize Leaf Disease Identification Based on Fisher Discrimination Analysis. Scientia Agricultura Sinica, 2009.42 (11)

6. ZHONG Quan, ZHOU Jin, WU Qinzhang, WANG Hui, LEI Tao. A Method of Line Tracking Based on Hough Transforms and Edge Histogram. Opto-Electronic Engineering, March, 2014

7. CHEN Yixin1, YE Feng, XIAO Feng, LI Qingnan. Detection and Recognition of Traffic Signs Based on HSV Vision Model and Shape Features. J. Jianghan Univ. (Nat. Sci. Ed.) ,Apr. 2016

8. YANG Jing, ZHU Lei. Color Image Segmentation Method Based on RGB Color Space. ISUANJIYU XIANDAIHUA, (2010)08-0147-03

9. Wen Changji, Wang Shengsheng, Yu Helong, Su Hengqiang. Image segmentation method for maize diseases based on pulse coupled neural network with modified artificial bee algorithm. Transactions of the Chinese Society of Agricultural Engineering, Jul. 2013

10. ZHANG Jin-hua, ZHUANG Jian, DU Hai-feng, et al. Self-organizing genetic algorithm based tuning of PID controllers [J]. InformationSciences, 2009, 179(7): 1007-1018.

11. LI Fa-chao, XU Li-da, JIN Chen-xia, et al. Intelligent bionic genetic algorithm (IB-GA) and its convergence [J]. Expert Systems with Applications, 2011, 38(7): 8804-8811.

12. Yang Hu. ON THE DEVELOPMENT OF MAIZE SEED INDUSTRY THE 20 CENTURY. Nanjing Agricultural University. In Partial Fulfillment of the Requirements For the Doctor Degree, 2011

13. BAO Hua, FAN Yu-bo, RAO Chang-hui, ZHANG Yu-dong, DAI Yun. Fast Median Filtering Algorithm Based on Mean Searching. JOURNAL OF SICHUAN UNIVERSITY (ENGINEERING SCIENCE EDITION), Mar. 2011

14. Zhang Yunli, Han Xianzhong, Wang Kejian. Study on Corn Variety Identification Based on Depth and Color Features of Gray Histogram. Crops 2015(1): 156 – 159

15. Li Wang. Research on the Cucumber Leaf Diseases recognition Based on Image Processing. Hunan Agricultural University. Master Thesis, 2013

16. Zong hua li. RESEARCH AND APPLICATION OF MAIZE LEAF DISEASE FUZZY RECOGNITION METHOD BASED ON IMAGE CHARACTERISTICS. Beijing Posts and Telecommunications University, 2010

17. Liu Zhi, Kang Jinxia. A brief analysis on meteorological conditions of several crop diseases. Heilongjiang agricultural science. Hei Longjiang Agricultural Sciences, 2013(1):157

18. Li Shimo. BIOLGICAL CONTROL OF SOILBORN PHYTHOPATHOGENS INCLUDING RALASTONIA SOLANACEARUM, PHYTOPHTTHORA CAPSICI, AND MELOIDOGYNE INCOGNITA ON PEPPER AND TOMATO. Nanjing Agricultural University. 2008

19. Tan Rongrong. Research of Weed Recognitong Method Using Color and Shape Features. JiangSu University. 2009

20. Hu Yueli, Ji Huijie, Wu Pin, Xuan Xiangguang. Research on Image Filtering Algorithm and Its FPGA implementation. Computer Measurement & Control, (2008)11-1672-04

21. PING Li. Comparison of image smoothing processing methods. Information Technology. (2010)-01-0065-03

22. MA Yong-jie, YUN Wen-xia. Research progress of genetic algorithm. Application Research of Computers, Apr. 2012

23. Su Hengqiang. Design and Implementation of Maize Disease Image Recogniton System. JiLin University, 2009