A tea disease degree analysis method based on OpenCV and fuzzy mathematics
By combining OpenCV and fuzzy mathematics to analyze the severity of tea diseases, the problems of high complexity of traditional models and subjectivity of expert evaluation are solved, and efficient and accurate analysis of the severity of tea diseases is achieved.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- YUNNAN AGRICULTURAL UNIVERSITY
- Filing Date
- 2022-12-27
- Publication Date
- 2026-04-21
AI Technical Summary
Traditional machine learning models have high parameter complexity in tea disease identification, making them difficult to run on edge devices. Furthermore, expert evaluations are subjective, affecting the training accuracy and applicability of the identification models.
By combining OpenCV and fuzzy mathematics, a tea disease evaluation system is constructed. OpenCV is used to identify the proportion of tea disease spots, and fuzzy mathematics is used to avoid the subjectivity of expert scoring. Factor weights and fuzzy judgment scores are used to calculate the degree of tea disease.
This improves the accuracy and ease of operation in analyzing the severity of tea diseases, reduces the time and cost of manual identification, and enables precise evaluation of the severity of tea diseases.
Smart Images

Figure CN116228657B_ABST
Abstract
Description
Technical Field
[0001] This invention belongs to the field of image target detection technology, and more specifically relates to a method for analyzing the degree of tea disease based on OpenCV and fuzzy mathematics. Background Technology
[0002] Tea is an important economic crop, and there are currently hundreds of recorded tea tree diseases, which seriously affect the yield and quality of tea. Among them, leaf diseases account for the largest proportion, and manual identification is time-consuming and labor-intensive. With the expansion of tea tree planting, promoting intelligent, precise, and efficient tea garden disease prevention and control is an urgent problem to be solved. Traditional machine learning models are difficult to adapt to edge devices due to their large number of parameters and high computational complexity. Considering the incomplete network infrastructure in remote mountainous areas, deep learning image recognition technology has been gradually applied to tea disease severity identification. During the training process of deep recognition models, expert annotation is usually used to evaluate the severity of diseases. However, each expert has a different level of understanding of the factors causing tea diseases, which can easily lead to non-specificity in tea quality rating. Moreover, expert evaluations of disease observations are somewhat subjective and cannot be qualitative, resulting in evaluation results lacking sufficient evidence. Incorrect evaluations will affect the training accuracy of the recognition model and its applicability. Summary of the Invention
[0003] To overcome the problems existing in the background technology, this invention patent provides a method for analyzing the severity of tea diseases based on OpenCV and fuzzy mathematics. This method constructs a tea disease evaluation system and uses OpenCV and deep learning methods to comprehensively analyze tea diseases. Using OpenCV to identify the proportion of tea disease spots not only solves the problems of time-consuming, labor-intensive, and inefficient work for plant protection personnel, but also avoids the subjectivity of expert scoring methods by combining fuzzy mathematics methods, making the evaluation results of the severity of tea diseases more realistic. The evaluation method is easy to understand and simple to operate, improving the accuracy of tea disease severity analysis and having universality.
[0004] To achieve the above objectives, the present invention is implemented through the following technical solution: A method for analyzing the degree of tea disease based on OpenCV and fuzzy mathematics includes the following steps: Step 1: Randomly select experts to conduct qualitative evaluations on the size of tea lesions, tea texture, tea color and tea size, and use the 1-9 degree method as the comparison standard to obtain the tea disease degree judgment matrix;
[0005] Step 2: After normalizing the tea disease severity judgment matrix, convert it into the weights ω of factors at the same level;
[0006] Step 3: Selected experts evaluate the images of diseased tea leaves based on four characteristic indicators: size of tea lesions, texture of tea leaves, color of tea leaves, and size of tea leaves. The results are graded into five dimensions: healthy, sub-healthy, fair, poor, and very poor. Each grade is scored S, and an expert evaluation table for the degree of tea disease is established.
[0007] Step 4: Calculate the evaluation relationship coefficients based on the percentage of people in each grade of the tea disease evaluation table, and obtain the evaluation relationship matrix R;
[0008] Step 5: Calculate the fuzzy judgment score T1 for the degree of tea disease:
[0009] T1=ω×R×S
[0010] In the formula, ω is the factor weight, R is the evaluation relationship matrix, and S is the score for each level.
[0011] Step 6: Use OpenCV to convert the tea disease image to grayscale, extract the leaves from the image, fill in the leaf edges with black, restore the image, distinguish the lesions from the leaf characteristic colors by RGB color pixels, and count the number of each RGB color pixel;
[0012] Step 7: Calculate the percentage of leaf area occupied by the lesion area (A), substitute it into the magnification ratio, and calculate the lesion judgment score (T2).
[0013] Step 8: Set the weight of the fuzzy judgment score T1 and the weight of the lesion judgment score T2, and obtain the final judgment result.
[0014] Furthermore, the formula for calculating the factor weight ω in step 2 is as follows:
[0015]
[0016]
[0017]
[0018]
[0019] In the formula, ω1 is the weight of lesion size, ω2 is the weight of tea texture, ω3 is the weight of tea color, ω4 is the weight of tea size, t1 is the feature vector of lesion size, t2 is the feature vector of tea texture, t3 is the feature vector of tea color, and t4 is the feature vector of tea size.
[0020] Furthermore, the weights of each evaluation index calculated in step 2 are tested for consistency using the random consistency ratio (CR). When CR < 0.1, the judgment matrix has satisfactory consistency, indicating that the weight allocation of each evaluation index is reasonable. When CR ≥ 0.1, the weights need to be re-allocated.
[0021] Furthermore, the magnification ratios for step 7 are as follows: 1000 for leaf area with lesions accounting for 0-10% of the total leaf area; 500 for leaf area with lesions accounting for 10%-20% of the total leaf area; 100 for leaf area with lesions accounting for 20%-30% of the total leaf area; 50 for leaf area with lesions accounting for 30%-40% of the total leaf area; and 25 for leaf area with lesions accounting for 40%-50% of the total leaf area.
[0022] Furthermore, in step 8, the weight of the fuzzy judgment score is 0.9, and the weight of the lesion judgment score is 0.1.
[0023] The beneficial effects of this invention are: the evaluation method combining OpenCV and fuzzy mathematics avoids the subjectivity of expert scoring, the evaluation method is easy to understand, and improves the accuracy of disease severity analysis. Attached Figure Description
[0024] Figure 1 Image of a tea leaf spot disease example from Example 1;
[0025] Figure 2 Image of a tea white spot disease case from Example 2;
[0026] Figure 3 This is an image of a tea bud blight case from Example 3. Detailed Implementation
[0027] To make the objectives, technical solutions, and beneficial effects of the present invention clearer, the preferred embodiments of the present invention will be described in detail below with reference to the accompanying drawings, so as to facilitate understanding by those skilled in the art.
[0028] Example 1: Sample image of tea leaf spot disease as shown Figure 1 As shown.
[0029] Step 1: Randomly select experts to conduct qualitative evaluations of the size of tea lesions, tea texture, tea color, and tea size, using a 1-9 degree method as a comparison standard to obtain a tea disease severity judgment matrix;
[0030] The statistical table for the 1-9 degree method is as follows:
[0031]
[0032] b1, b2, b3, b4, and b5 can take any value from positive integers 1 to 9 and their reciprocals.
[0033] The following table shows the annotation of the characteristic parameters of tea disease severity.
[0034] Notes meaning 1 Equal importance 3 The former is slightly more important than the latter. 5 The former is slightly more important than the latter. 7 The former is slightly more important than the latter. 9 The former is slightly more important than the latter. 2、4、6、8 Adjacency Intermediate Value Take the inverse value Compared to the numerator, the relative importance of the denominator to the numerator.
[0035] Step 2: After normalizing the tea disease severity judgment matrix, convert it into the weights ω of factors at the same level;
[0036] The formula for calculating the factor weight ω in step 2 is as follows:
[0037]
[0038]
[0039]
[0040]
[0041] In the formula, ω1 is the weight of lesion size, ω2 is the weight of tea texture, ω3 is the weight of tea color, ω4 is the weight of tea size, t1 is the feature vector of lesion size, t2 is the feature vector of tea texture, t3 is the feature vector of tea color, and t4 is the feature vector of tea size.
[0042] Furthermore, the weights of each evaluation index calculated in step 2 are tested for consistency using the random consistency ratio (CR). When CR < 0.1, the judgment matrix has satisfactory consistency, indicating that the weight allocation of each evaluation index is reasonable. When CR ≥ 0.1, the weights need to be re-allocated.
[0043] To verify the consistency of the judgment matrix with respect to the four factors, we examine the eigenvector t of the largest eigenvalue δmax of the judgment matrix. The eigenvector values are normalized and converted into factor weights of the same level. The matrix consistency index is the negative average of the remaining eigenvalues excluding the largest eigenvalue. When the random consistency ratio CR < 0.1, the consistency of the judgment matrix is considered to be satisfactory. The results are as follows:
[0044] If A is an n-order matrix, and if a number δ and an n-dimensional non-zero column vector x satisfy the equation Ax = δx, then the number δ is called an eigenvalue of A, and x is called the eigenvector corresponding to the eigenvalue δ. The largest eigenvalue can be found using the following formula:
[0045] Ax=δx→Ax=δEx→(δE-A)x=0
[0046] The tea disease severity characteristic judgment matrix in this embodiment is:
[0047]
[0048] The maximum eigenvalue δmax = 4.0228 and the matrix consistency ratio CR = 0.0076 < 0.1, which meets the requirements.
[0049] Step 3: Selected experts evaluate the images of diseased tea leaves based on four characteristic indicators: size of tea lesions, texture of tea leaves, color of tea leaves, and size of tea leaves. The results are graded into five dimensions: healthy, sub-healthy, fair, poor, and very poor. Each grade is scored S, and an expert evaluation table for the degree of tea disease is established.
[0050] The expert evaluation form for the severity of tea disease in this embodiment is as follows:
[0051]
[0052] Step 4: Calculate the evaluation relationship coefficients based on the percentage of people in each grade of the tea disease evaluation table, and obtain the evaluation relationship matrix R;
[0053] Establish an evaluation relationship matrix: Normalize the evaluation results and use the number of people evaluated at each level to form the total number of people, and combine the factors to form an evaluation relationship matrix R.
[0054]
[0055] Step 5: Calculate the fuzzy judgment score T1 for the degree of tea disease:
[0056] T1=ω×R×S
[0057] In the formula, ω is the factor weight, R is the evaluation relationship matrix, and S is the score for each level.
[0058] The fuzzy judgment score T1 for the degree of tea disease in this embodiment is:
[0059]
[0060] T = 82.4875
[0061] Step 6: Use OpenCV to convert the tea disease image to grayscale, extract the leaves from the image, fill the leaf edges with black and restore the image, distinguish the lesions from the leaf characteristic colors by RGB color pixels, and count the number of each RGB color pixel.
[0062] Figure 1 To detect tea leaf spot disease, OpenCV was used to convert the image to grayscale, extract the leaves, and then fill in the edges with black to restore the image. The lesions and leaves were then distinguished by RGB color pixels. Lesions are represented by orange pixels, while green to brown pixels represent leaves.
[0063] Step 7: Calculate the percentage of leaf area occupied by the lesion area (A), substitute it into the magnification ratio, and calculate the lesion judgment score (T2).
[0064] In this embodiment:
[0065]
[0066] N: Number of orange pixels = 695358; M: Number of green to brown pixels = 5087611;
[0067] A: The percentage of leaf area covered by lesions is 13.68%;
[0068] Qualitative evaluation results were obtained by training and analyzing the proportion of lesions on tea leaves using OpenCV. The corresponding magnification ratios of the lesion proportions are shown in the table below.
[0069] Percentage of lesions Magnification 0-10% 1000 10%-20% 500 20%-30% 100 30%-40% 50 40%-50% 25
[0070] In this embodiment, the proportion of lesions is first multiplied by 500 to increase its weight in the evaluation result: 13.68% × 500 = 68.4.
[0071] Set the weights for the fuzzy judgment score T1 and the lesion judgment score T2, and then obtain the final evaluation result.
[0072] In this embodiment, the weight of the proportion of lesions is 0.1, the weight of the result of fuzzy learning is 0.9, and the final evaluation result is: 82.4875×0.9+0.1×68.4=80.07875, indicating that the health level is average.
[0073] In this embodiment, expert evaluation primarily categorizes the disease severity as sub-healthy. The analytical method of this invention classifies the plant as generally healthy. When the incidence of tea leaf spot exceeds 15%, further spraying is necessary. Sub-healthy plants will yield slightly less after harvesting than healthy plants. Plants in a generally healthy state require close monitoring, real-time recording of tea leaf condition, and timely control measures. In later stages of cultivation, the lesions on these plants may expand, impacting tea yield. Therefore, the analytical method of this invention is more accurate than traditional expert scoring.
[0074] Example 2: Images of tea leaves affected by white spot disease (as shown in the image). Figure 2 As shown.
[0075] Step 1: Randomly select experts to conduct qualitative evaluations of the size of tea lesions, tea texture, tea color, and tea size, using a 1-9 degree method as a comparison standard to obtain a tea disease severity judgment matrix;
[0076] Step 2: After normalizing the tea disease severity judgment matrix, convert it into the weights ω of factors at the same level;
[0077] In this embodiment, 20 experts were randomly selected from the expert database to conduct qualitative evaluations on four characteristics of tea leaves: size of lesions, texture, color, and size. A 1-9 scale was used, and the results are as follows:
[0078]
[0079] The maximum eigenvalue δmax = 4.0847 and the matrix consistency ratio CR = 0.0287 < 0.1, which meets the requirements.
[0080] Step 3: Selected experts evaluate the images of diseased tea leaves based on four characteristic indicators: size of tea lesions, tea texture, tea color, and tea size. The results are graded into five categories: healthy, sub-healthy, fair, poor, and very poor. A score S is assigned to each category, and an expert evaluation table for the degree of tea disease is established. In this embodiment, the expert evaluation table for the degree of tea disease is as follows:
[0081]
[0082] Step 4: Calculate the evaluation relationship coefficients based on the percentage of people in each grade of the tea disease evaluation table, and obtain the evaluation relationship matrix R;
[0083] In this embodiment, the evaluation relation matrix R is as follows.
[0084]
[0085] Step 5: Calculate the fuzzy judgment score T1 for the degree of tea disease:
[0086] In this embodiment, the fuzzy judgment score T1 for the degree of tea disease is:
[0087]
[0088] T1 = 73.7125
[0089] Step 6: Use OpenCV to convert the tea disease image to grayscale, extract the leaves from the image, fill in the leaf edges with black, restore the image, distinguish the lesions from the leaf characteristic colors by RGB color pixels, and count the number of each RGB color pixel;
[0090] Figure 2 For tea white spot disease, OpenCV was used to convert the image to grayscale, extract the leaves from the image, then add red edges to restore the image, and distinguish the lesions from the leaves using RGB color pixels. Figure 2 The lesions are black pixels, and the dark green ones are pixels on the leaf blade.
[0091] Step 7: Calculate the percentage of leaf area occupied by the lesion area (A), substitute it into the magnification ratio, and calculate the lesion judgment score (T2).
[0092]
[0093] N: Number of black pixels = 385614, M: Number of dark green pixels = 1484323.
[0094] A: The percentage of leaf area covered by lesions is 25.98%.
[0095] T2 = 25.98% × 100 = 25.98
[0096] Step 8: Set the weight of the fuzzy judgment score T1 and the weight of the lesion judgment score T2, and obtain the final judgment result.
[0097] The weight of the proportion of lesions is 0.1, the weight of the result of fuzzy learning is 0.9, and the final evaluation result is: 77.6025×0.9+0.1×25.98=68.93925, indicating a poor health level.
[0098] In this embodiment, the experts assessed the plant's health status as mainly falling into three categories: healthy, sub-healthy, and poor. It was difficult to accurately determine the plant's specific health status. However, the analysis method of this invention determined that the plant's health status was poor, which is consistent with the actual situation after the plant was planted and harvested. The accuracy of this invention is superior to that of the expert assessment.
[0099] Example 3, tea bud blight example image as shown Figure 3 As shown.
[0100] Example 2: Images of tea leaves affected by white spot disease (as shown in the image). Figure 2 As shown.
[0101] Step 1: Randomly select experts to conduct qualitative evaluations of the size of tea lesions, tea texture, tea color, and tea size, using a 1-9 degree method as a comparison standard to obtain a tea disease severity judgment matrix;
[0102] Step 2: After normalizing the tea disease severity judgment matrix, convert it into the weights ω of factors at the same level;
[0103] In this embodiment, 20 experts were randomly selected from the expert database to conduct qualitative evaluations on four characteristics of tea leaves: size of lesions, texture, color, and size. A 1-9 scale was used, and the results are as follows:
[0104]
[0105]
[0106] The maximum eigenvalue δmax = 4.0847 and the matrix consistency ratio CR = 0.0287 < 0.1, which meets the requirements.
[0107] Step 3: Selected experts evaluate the images of diseased tea leaves based on four characteristic indicators: size of tea lesions, tea texture, tea color, and tea size. The results are graded into five categories: healthy, sub-healthy, fair, poor, and very poor. A score S is assigned to each category, and an expert evaluation table for the degree of tea disease is established. In this embodiment, the expert evaluation table for the degree of tea disease is as follows:
[0108]
[0109] Step 4: Calculate the evaluation relationship coefficients based on the percentage of people in each grade of the tea disease evaluation table, and obtain the evaluation relationship matrix R;
[0110] In this embodiment, the evaluation relation matrix R is as follows.
[0111]
[0112] Step 5: Calculate the fuzzy judgment score T1 for the degree of tea disease:
[0113] In this embodiment, the fuzzy judgment score T1 for the degree of tea disease is:
[0114]
[0115] T1 = 91.0375
[0116] Step 6: Use OpenCV to convert the tea disease image to grayscale, extract the leaves from the image, fill the leaf edges with black and restore the image, distinguish the lesions from the leaf characteristic colors by RGB color pixels, and count the number of each RGB color pixel.
[0117] Figure 3 For example images of tea bud blight, OpenCV was used to convert the images to grayscale and extract the leaves from the images.
[0118] The image was then processed, and the edges were filled in with black to restore the original image. The RGB color pixels were used to distinguish between the lesions and the leaves. For example... Figure 3 The lesions are yellowish-brown pixels, while the dark green ones are pixels on the leaf blade.
[0119] Step 7: Calculate the percentage of leaf area occupied by the lesion area (A), substitute it into the magnification ratio, and calculate the lesion judgment score (T2).
[0120]
[0121] N: Number of tan pixels = 255027; M: Number of dark green pixels = 5087611;
[0122] A: The percentage of leaf area covered by lesions = 5.00%;
[0123] T2 = 5.00% × 1000 = 50
[0124] Step 8: Set the weight of the fuzzy judgment score T1 and the weight of the lesion judgment score T2, and obtain the final judgment result.
[0125] The weight of the proportion of lesions is 0.1, the weight of the result of fuzzy learning is 0.9, and the final evaluation result is: 91.0375×0.9+0.1×50=86.93375, the health level is sub-healthy.
[0126] In this embodiment, the expert evaluation score mainly determines the degree of disease as healthy. However, the analysis method of this invention judges the plant to be in a sub-healthy state. The yield of this plant is slightly lower than that of healthy plants during the later harvesting process. Therefore, the disease degree analysis method used in this invention is more accurate than the expert evaluation.
[0127] Finally, it should be noted that the above preferred embodiments are only used to illustrate the technical solutions of the invention, and are not intended to limit it. Although the present invention has been described in detail through the above preferred embodiments, those skilled in the art should understand that various changes can be made to it in form and detail without departing from the protection scope of the present invention.
Claims
1. A method for analyzing the severity of tea disease based on OpenCV and fuzzy mathematics, characterized in that, Includes the following steps: Step 1: Randomly select experts to conduct qualitative evaluations of the size of tea lesions, tea texture, tea color, and tea size, using a 1-9 degree method as a comparison standard to obtain a tea disease severity judgment matrix; Step 2: After normalizing the tea disease severity judgment matrix, convert it into the weights of factors at the same level. ; Step 3: Selected experts evaluated the images of diseased tea leaves based on four characteristics: the size of tea lesions, the texture of the tea leaves, the color of the tea leaves, and the size of the tea leaves. The results were graded into five categories: healthy, sub-healthy, fair, poor, and very poor, with a scoring system set for each category. Establish an expert evaluation form for the severity of tea diseases; Step 4: Calculate the evaluation relationship coefficients based on the percentage of experts evaluating the severity of tea diseases in each grade, and obtain the evaluation relationship matrix. ; Step 5: Calculate the fuzzy judgment score of the degree of tea disease. : In the formula, For factor weights, To evaluate the relation matrix, Scoring is done for each grade level; Step 6: Use OpenCV to convert the tea disease image to grayscale, extract the leaves from the image, fill the leaf edges with black and restore the image, distinguish the lesions from the leaf characteristic colors by RGB color pixels, and count the number of each RGB color pixel. Step 7: Calculate the percentage of leaf area covered by lesions. Substitute the magnification ratio to calculate the lesion judgment score. ;in: , : Number of pixels in the lesion : Number of pixels in the leaf blade T2 = A × magnification ratio; The magnification ratios for step 7 are as follows: The percentage of leaf area covered by lesions (A) is 0-10%, and the magnification ratio is 1000. The percentage of leaf area covered by lesions (A) is 10%-20%, magnified at a scale of 500. The percentage of leaf area covered by lesions (A) is 20%-30%, magnified at a scale of 100. The percentage of leaf area covered by lesions (A) is 30%-40%, magnified at a scale of 50. The percentage of leaf area covered by lesions (A) is 40%-50%, and the magnification ratio is 25. Step 8: Set the fuzzy judgment score Percentage weighting, lesion judgment score The weighting of each percentage point determines the final evaluation result.
2. The method for analyzing the severity of tea diseases based on OpenCV and fuzzy mathematics according to claim 1, characterized in that, The weighting of factors in step 2 The calculation formula is = = = = In the formula Weighting based on lesion size, Weighting of tea texture 3. Weighting of tea color, 4. Weighting based on tea leaf size Feature vector of lesion size, 2 represents the tea leaf texture feature vector. 3 represents the tea color feature vector. 4 represents the feature vector of tea leaf size.
3. The method for analyzing the severity of tea diseases based on OpenCV and fuzzy mathematics according to claim 1 or 2, characterized in that, The weights of each evaluation index calculated in step 2 are determined using a random consistency ratio. Perform consistency checks when When the value is less than 0.1, the judgment matrix has satisfactory consistency, indicating that the weight allocation of each evaluation index is reasonable. When the value is ≥0.1, the weights need to be reallocated.
4. The method for analyzing the degree of tea disease based on OpenCV and fuzzy mathematics according to claim 1, characterized in that, The fuzzy judgment score in step 8 is described above. The weighting is 0.9, and the lesion judgment score is... The weighting is 0.1.