1 Introduction

Agriculture is the cornerstore 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.

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

$$ \bigcup\nolimits_{\text{i = 1}}^{\text{N}} {\text{Ri}} = {\text{R}} $$
(1)
$$ \forall {\text{i,}}\,{\text{j,}}\,{\text{i}} \ne {\text{j,}}\,{\text{Ri}} \cap {\text{Rj = }}\,\varnothing $$
(2)
$$ {\text{i}} = 1, \, 2, \, \ldots \ldots ,{\text{ N, P}}\left( {\text{Ri}} \right){\text{ = T}} $$
(3)
$$ \forall {\text{i,}}\,{\text{j,}}\,{\text{i}} \ne {\text{j,}}\,{\text{P}}({\text{Ri}} \cap {\text{Rj) = F}} $$
(4)
$$ {\text{i}} = 1, \, 2, \, \ldots \ldots ,{\text{ N, Ri is not empty}} $$
(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 using 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 (Fig. 1).

Fig. 1.
figure 1

The simple process of threshold segmentation

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 Fig. 2 below.

Fig. 2.
figure 2

Three forms of the edge

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 \( \upalpha,\,\upbeta \) where \( \upalpha = \, 0.7 \) is the long scale factor of the image and \( \upbeta = \, 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 Fig. 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.

Fig. 3.
figure 3

Diagram of the accurate location method

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

  1. (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. (2)

    If the rectangle length and width of the disease area are a * b and the center coordinates are (x0, y0), 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 (x0, y0 − 5a/2). The distance from the left frame to the ordinate axis is wL = x0 − 3b/2, the distance from the right frame to the right edge of the original image is wR = W − x0− 3b/2, the distance from the lower edge to the abscissa axis is wB = y0 − 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 = (x0 − 3b/2)/ 3 and dR = (W − x0 − 3b/2)/3, dB = (y0 − 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 Fig. 4 [19].

Fig. 4.
figure 4

Flowchart of the diseased image segmentation algorithm based on pre-detection

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 X2 represents the total number of white pixels in the A area (including the disease region of the target leaf), the X2 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 X3 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 = (X1 − X2)/X3 × 100%.

figure a

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.