A method, system and device for detecting corn veins
By processing the grayscale and binarization of color images, combining HSV and RGB color space conversion, and using the maximum inter-class variance method and convex hull algorithm to determine the center point of the leaf vein, and combining the DBSCAN algorithm of circular scanning and density clustering, the problems of incomplete information and slow speed in corn leaf vein detection are solved, and more efficient corn leaf vein recognition is achieved.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- CHINA AGRI UNIV
- Filing Date
- 2023-03-07
- Publication Date
- 2026-04-14
AI Technical Summary
Existing technologies for detecting leaf veins in maize suffer from incomplete information, low detection accuracy, and slow speed. They are particularly difficult to detect accurately when the grayscale changes of leaf vein pixels are gradual, and neural network-based methods have high computational complexity.
The method employs grayscale and binarization processing of color images, combined with HSV and RGB color space conversion, and uses the maximum inter-class variance method and convex hull algorithm to determine the center point of leaf veins. Leaf vein detection is then performed using the DBSCAN algorithm, which combines circular scanning and density clustering.
It effectively eliminates the influence of background and noise, improves the accuracy and speed of corn leaf vein detection, and achieves more efficient corn leaf vein recognition.
Smart Images

Figure CN116739968B_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of automatic detection of maize leaf veins, and in particular to a method, system and device for detecting maize leaf veins. Background Technology
[0002] Current research on maize leaf veins primarily utilizes two-dimensional color images or three-dimensional laser scanning point cloud data for detection. Two-dimensional color images of crops contain information such as pixels, color, texture, and grayscale values; three-dimensional point cloud data includes laser reflection intensity and three-dimensional spatial point coordinates. By leveraging the specificity and distribution characteristics of this information, automatic detection of leaf veins can be achieved. However, in the actual acquisition of three-dimensional point cloud data, some non-hollow data is lost, leading to incomplete detection of leaf vein information. Utilizing color information allows for better extraction of leaf regions, thereby obtaining a global leaf vein profile. Therefore, color image-based leaf vein detection remains a hot research topic.
[0003] Automatic detection of crop veins based on color images often involves detecting pixel regions with abrupt changes in grayscale values and extracting vein edge information to identify the veins. However, this method typically fails to achieve satisfactory results for images with gradual grayscale changes in vein pixels. Some studies transform the color image of crop veins to the HIS (Hue, Intensity, Saturation) color space, then enhance one of the color components before binarizing it to detect the veins. However, this method struggles to accurately and completely detect veins when the image resolution is low. With the continuous development of neural networks, some studies have proposed neural network-based methods for crop vein extraction. These methods leverage existing graphic features and continuously learn and optimize to automatically extract effective information from the image, ultimately achieving better detection results. However, this method has high time complexity and requires significant computational time. Summary of the Invention
[0004] The purpose of this invention is to provide a method, system, and device for detecting maize leaf veins, which can improve the accuracy and speed of maize leaf vein detection.
[0005] To achieve the above objectives, the present invention provides the following solution:
[0006] A method for detecting leaf veins in maize, comprising:
[0007] Acquire a color image of the corn to be detected;
[0008] The color image is subjected to grayscale and binarization processing;
[0009] The leaf veins of the maize to be detected are determined based on the grayscale and binarized images.
[0010] Optionally, the grayscale and binarization processing of the color image specifically includes:
[0011] The first grayscale image is determined based on the S component of the color image in the HSV color space;
[0012] The second and third grayscale images are determined based on the components of the color image in the RGB color space.
[0013] The first grayscale image is segmented using a segmentation threshold to determine the first binary image;
[0014] The second grayscale image is segmented using the Otsu's method to determine the second binary image.
[0015] Optionally, determining the second grayscale image and the third grayscale image based on the components of the color image in the RGB color space specifically includes:
[0016] Using Formula I gray2 (i,j)=G(i,j)*1.262-R(i,j)*0.884-B(i,j)*0.311 to determine the second grayscale image;
[0017] Using Formula I gray3 (i,j)=G(i,j)*0.587+R(i,j)*0.299+B(i,j)*0.114 to determine the third grayscale image;
[0018] Where i and j are the row and column coordinates of the pixel, G(i,j), R(i,j) and B(i,j) are the gray values of the G, R, and B color components of the pixel at (i,j) in the color image, respectively, and I gray2 (i, j) represents the gray value of the pixel at (i, j) in the converted second grayscale image. gray3 (i, j) represents the gray value of the pixel at (i, j) in the converted third grayscale image.
[0019] Optionally, the step of segmenting the second grayscale image using the maximum inter-class variance method to determine the second binary image further includes:
[0020] Denoising is performed on the second binary image.
[0021] Optionally, determining the leaf veins of the corn to be detected based on the grayscale and binarized image specifically includes:
[0022] Obtain the centroid of all pixels with a gray value of 1 in the first binary image, and use it as the center point of the corn to be detected;
[0023] Based on the second binary image, the convex hull algorithm is used to determine the smallest convex polygon that surrounds the corn to be detected, and the vertices of the convex polygon are obtained.
[0024] The maximum distance between the center point and each vertex is the maximum distance from the center point of the corn to be tested to the leaf.
[0025] A fourth grayscale image is determined by performing a logical AND operation between the second binary image and the third grayscale image.
[0026] Based on the fourth grayscale image of the corn to be detected, a circular scan is performed with the center point as the center to retrieve the pixels of the leaf veins of the corn to be detected and determine the leaf veins of the corn to be detected.
[0027] Optionally, the step of performing a circular scan with the center point as the center of the fourth grayscale image of the corn to be detected, retrieving the pixels of the leaf veins of the corn to be detected, and determining the leaf veins of the corn to be detected, specifically includes:
[0028] Using the center point as the center, scan the fourth grayscale image in a clockwise direction with circular pixels; set the initial radius of the scan and the number of pixels to be increased in each scan, and the maximum radius of the scan is the maximum distance from the center point to the blade;
[0029] The circular pixel is divided into multiple regions using pixels with a grayscale value of 0.
[0030] The pixel with the highest grayscale value in each region is retained and used as a potential pixel for detecting the veins of the corn leaf.
[0031] The DBSCAN algorithm based on density clustering is used to cluster potential pixels of corn leaf veins to achieve corn leaf vein detection.
[0032] A corn leaf vein detection system, comprising:
[0033] The color image acquisition module is used to acquire a color image of the corn to be detected;
[0034] The image processing module is used to perform grayscale and binarization processing on the color image;
[0035] The leaf vein detection module is used to determine the leaf veins of the corn to be detected based on the grayscale and binarized images.
[0036] A corn leaf vein detection device includes: at least one processor, at least one memory, and computer program instructions stored in the memory, which implement the method when the computer program instructions are executed by the processor.
[0037] According to specific embodiments provided by the present invention, the present invention discloses the following technical effects:
[0038] The present invention provides a method, system and device for detecting corn leaf veins, which determines the leaf veins of the corn to be detected based on grayscale and binarized images, effectively eliminating the influence of irrelevant components such as background and leaf noise, and improving the accuracy and speed of corn leaf vein detection. Attached Figure Description
[0039] To more clearly illustrate the technical solutions in the embodiments of the present invention or the prior art, the drawings used in the embodiments will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present invention. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort.
[0040] Figure 1 This is a schematic diagram of the process for a corn leaf vein detection method provided by the present invention;
[0041] Figure 2 This is a flowchart illustrating a method for detecting leaf veins in maize according to an embodiment of the present invention.
[0042] Figure 3 This is a schematic diagram of a first grayscale image (grayscale image 1), a second grayscale image (grayscale image 2), and a third grayscale image (grayscale image 3) of a maize plant according to an embodiment of the present invention for a method for detecting maize leaf veins.
[0043] Figure 4 This is a schematic diagram of a first binary image of most pixels in the central region of a maize plant according to an embodiment of the present invention for a method for detecting maize leaf veins.
[0044] Figure 5 This is a schematic diagram of the second binary image extracted from the corn region after removing scattered noise in a corn leaf vein detection method according to an embodiment of the present invention;
[0045] Figure 6 This is a schematic diagram illustrating the calculation of the minimum convex polygon surrounding the corn in a method for detecting corn leaf veins according to an embodiment of the present invention;
[0046] Figure 7 This is a schematic diagram of a fourth grayscale image extracted from the grayscale region of a corn leaf vein detection method according to an embodiment of the present invention;
[0047] Figure 8 This is a schematic diagram of the scanning of circular pixels in a corn leaf vein detection method according to an embodiment of the present invention;
[0048] Figure 9This is a schematic diagram illustrating the statistical analysis of grayscale values of pixels in a corn region under a specified circular scanning radius in a corn leaf vein detection method according to an embodiment of the present invention.
[0049] Figure 10 This is a schematic diagram of the initial detection results of maize leaf veins in a maize leaf vein detection method according to an embodiment of the present invention;
[0050] Figure 11 This is a schematic diagram of the optimized maize leaf vein detection result in a maize leaf vein detection method according to an embodiment of the present invention. Detailed Implementation
[0051] The technical solutions of the embodiments of the present invention will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of the present invention, and not all embodiments. Based on the embodiments of the present invention, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of the present invention.
[0052] The purpose of this invention is to provide a method, system, and device for detecting maize leaf veins, which can improve the accuracy and speed of maize leaf vein detection.
[0053] To make the above-mentioned objects, features and advantages of the present invention more apparent and understandable, the present invention will be further described in detail below with reference to the accompanying drawings and specific embodiments.
[0054] like Figure 1 As shown, the present invention provides a method for detecting maize leaf veins, comprising:
[0055] S101, Obtain a color image of the corn to be detected;
[0056] S102, perform grayscale and binarization processing on the color image;
[0057] S102 specifically includes:
[0058] S201, determine the first grayscale image based on the S component of the color image in the HSV color space;
[0059] S202, determine the second grayscale image and the third grayscale image based on the components of the color image in the RGB color space;
[0060] S202 specifically includes:
[0061] Using Formula I gray2 (i,j)=G(i,j)*1.262-R(i,j)*0.884-B(i,j)*0.311 to determine the second grayscale image;
[0062] Using Formula Igray3 (i,j)=G(i,j)*0.587+R(i,j)*0.299+B(i,j)*0.114 to determine the third grayscale image;
[0063] Where i and j are the row and column coordinates of the pixel, G(i,j), R(i,j) and B(i,j) are the gray values of the G, R, and B color components of the pixel at (i,j) in the color image, respectively, and I gray2 (i, j) represents the gray value of the pixel at (i, j) in the converted second grayscale image. gray3 (i, j) represents the gray value of the pixel at (i, j) in the converted third grayscale image.
[0064] like Figure 2 As shown in the illustration, as a specific embodiment, the present invention can effectively eliminate the influence of irrelevant components such as background and leaf noise, thereby improving the accuracy and speed of maize leaf vein detection. The method specifically includes the following steps.
[0065] Adjust the direction and position of the color camera so that it takes a vertical shot of the corn plant from top to bottom to obtain a color image of a single corn plant.
[0066] In the RGB color space of the corn color image, the gray value of the S component of the corn plant in the HSV color space is calculated by using the gray values of the red (R), green (G), and blue (B) components, thus obtaining the grayscale image 1 of the corn plant.
[0067] By applying the components of the corn color image in the RGB color space, the original color image of the corn is converted to grayscale to obtain grayscale image 2 and grayscale image 3 of the corn.
[0068] S203, the first grayscale image is segmented using a segmentation threshold to determine the first binary image; the segmentation threshold TH = 0.95.
[0069] S204, the second grayscale image is segmented using the maximum inter-class variance method to determine the second binary image.
[0070] Following S204 are:
[0071] Denoising is performed on the second binary image.
[0072] The denoising process includes removing the interference of scattered noise in the second binary image (binary image 2) by using the morphological "closing operation".
[0073] S103, determine the leaf veins of the maize to be detected based on the grayscale and binarized image.
[0074] S103 specifically includes:
[0075] S301, obtain the centroid of all pixels with a grayscale value of 1 in the first binary image, and use it as the center point of the corn to be detected; white pixels are the central region pixels of the corn plant with a grayscale value of 1, and black pixels are the background with a grayscale value of 0. In the second binary image, white pixels are the corn plant with a grayscale value of 1, and black pixels are the background with a grayscale value of 0.
[0076] S302, Based on the second binary image, the convex hull algorithm is used to determine the smallest convex polygon that surrounds the corn to be detected, and the vertices of the convex polygon are obtained.
[0077] S303, the maximum distance between the center point and each vertex is the maximum distance from the center point of the corn to be detected to the leaf.
[0078] S304, perform a logical AND operation on the second binary image and the third grayscale image to determine the fourth grayscale image; the black part is the non-corn area, and the grayscale value of the pixel is 0.
[0079] S305. Based on the fourth grayscale image of the corn to be detected, perform a circular scan with the center point as the center to retrieve the pixel points of the leaf veins of the corn to be detected and determine the leaf veins of the corn to be detected.
[0080] S305 specifically includes:
[0081] S501, with the center point as the center, scan the fourth grayscale image in a clockwise direction with circular pixels; set the initial radius of the scan and the number of pixels to be increased in each scan, and the maximum radius of the scan is the maximum distance from the center point to the blade;
[0082] S502 divides a circular pixel into multiple regions using pixels with a grayscale value of 0 in the circular pixel.
[0083] S503 retains the pixel with the highest gray value in each region and uses it as a potential pixel for detecting the veins of the corn leaf.
[0084] S504 uses the DBSCAN algorithm based on density clustering to cluster potential pixels of corn leaf veins to be detected, retaining the classes containing more than a threshold number of pixels, and finally realizing the detection of corn leaf veins.
[0085] Another specific embodiment of the present invention provides a method for detecting leaf veins in maize. Using maize as the research object, the method utilizes color images of maize to detect leaf veins in a field environment.
[0086] In this embodiment, the acquired color images only contain single corn plants. Grayscale conversion is performed on the color images to obtain grayscale image 1, grayscale image 2, and grayscale image 3, as shown below. Figure 3As shown. The grayscale image 1 of the corn is segmented, with a segmentation threshold TH = 0.95, to obtain the binary image 1 of the corn, as shown. Figure 4 As shown, the white pixels represent most of the pixels in the central region of the corn plant. The centroid of all pixels with a grayscale value of 1 in the binary image of the corn is calculated and used as the center point of the corn plant.
[0087] The segmentation threshold for the grayscale image 2 of corn was calculated to be 0.53 using the Otsu's method, resulting in a binary image 2. White pixels represent corn plants, and black pixels represent the background, thus extracting the corn region. This embodiment utilizes a square structuring element to perform a closing operation on the binary image 2. First, a square structuring element with a side length of 5 pixels is used to dilate the image, and then a square structuring element with a side length of 12 pixels is used to erode the image, eliminating interference from scattered noise. The result is as follows. Figure 5 As shown.
[0088] Using the processed binary image of the corn (image 2), the minimum convex polygon enclosing the corn was calculated using the convex hull algorithm. The result is as follows: Figure 6 As shown, obtain each vertex of the convex polygon.
[0089] The distance between the center point of the corn and each vertex of the convex polygon is calculated, and the largest value is selected as the maximum distance from the center point of the corn to the leaf. In this embodiment, it is 245 pixels.
[0090] Perform a logical AND operation between the grayscale image 3 of the corn kernel and the processed binary image 2 to generate a new grayscale image 4, as follows: Figure 7 As shown, the grayscale values of pixels in the corn region are retained, while the grayscale values of pixels outside the corn region are 0.
[0091] Using the center point of the corn as the center, the grayscale image 4 is scanned clockwise in a circular direction. In this embodiment, the initial radius of the circular scan is set to the 50th pixel point away from the center of the circle. Each scan increases by 3 pixels, and the maximum radius of the circular scan is the maximum distance of 245 pixels from the center point of the corn to the convex polygon of the corn leaf.
[0092] Figure 8 The diagram shows a circular scan with a specified radius of 100 pixels. Pixels with a grayscale value of 0 divide the circular area into four regions. The statistical results of the corresponding grayscale values of the circular scan pixels are shown below. Figure 9 As shown, the horizontal axis represents the order of pixels scanned during the circular scan, and the vertical axis represents the grayscale value of the pixels. In this embodiment, the threshold is set to 12 pixels. By setting the threshold, leaves with excessively small detection widths are deleted. Figure 9Of the four regions, the grayscale values of the three regions with a pixel width greater than 12 are ultimately retained.
[0093] For each circular scanning radius, the grayscale value of the corn region is detected and retained. The pixel with the highest grayscale value within each region is retained as the potential pixel for the corn vein under each circular scanning radius. Potential pixels for the corn vein are marked with an asterisk, such as... Figure 10 As shown.
[0094] Depend on Figure 10 It was found that the initial detection results contained some noise points that were not leaf veins. The DBSCAN algorithm, based on density clustering, was used to cluster the potential pixels of the corn leaf veins, dividing them into 17 classes. The number of pixels in each of the 17 clustered classes was counted. In this embodiment, classes containing more than 20 pixels were retained, as shown in the following figure. Figure 11 As shown by the asterisk-marked pixels, the detection of corn leaf veins is finally achieved.
[0095] As another specific embodiment, the present invention also provides a maize leaf vein detection system, comprising:
[0096] The color image acquisition module is used to acquire a color image of the corn to be detected;
[0097] The image processing module is used to perform grayscale and binarization processing on the color image;
[0098] The leaf vein detection module is used to determine the leaf veins of the corn to be detected based on the grayscale and binarized images.
[0099] In order to execute the method corresponding to Embodiment 1 above and achieve the corresponding functions and technical effects, the present invention also provides a corn leaf vein detection device, including: at least one processor, at least one memory, and computer program instructions stored in the memory, which implement the method when the computer program instructions are executed by the processor.
[0100] The various embodiments in this specification are described in a progressive manner, with each embodiment focusing on its differences from other embodiments. Similar or identical parts between embodiments can be referred to interchangeably. For the systems disclosed in the embodiments, since they correspond to the methods disclosed in the embodiments, the descriptions are relatively simple; relevant parts can be referred to the method section.
[0101] This document uses specific examples to illustrate the principles and implementation methods of the present invention. The descriptions of the above embodiments are only for the purpose of helping to understand the method and core ideas of the present invention. Furthermore, those skilled in the art will recognize that, based on the ideas of the present invention, there will be changes in the specific implementation methods and application scope. Therefore, the content of this specification should not be construed as a limitation of the present invention.
Claims
1. A method for detecting leaf veins in maize, characterized in that, include: S101, Obtain a color image of the corn to be detected; S102, perform grayscale and binarization processing on the color image; S103, determine the leaf veins of the maize to be detected based on the grayscale and binarized image; Specifically, the grayscale and binarization processing of the color image described in S102 includes: S201, determine the first grayscale image based on the S component of the color image in the HSV color space; S202, determine the second grayscale image and the third grayscale image based on the components of the color image in the RGB color space; specifically including: Using formula Determine the second grayscale image; Using formula Determine the third grayscale image; Where i and j are the row and column coordinates of the pixel, G(i,j), R(i,j) and B(i,j) are the gray values of the G, R, and B color components of the pixel at (i,j) in the color image, respectively, and I gray2 (i, j) represents the gray value of the pixel at (i, j) in the converted second grayscale image. gray3 (i, j) represents the gray value of the pixel at (i, j) in the converted third grayscale image; S203, perform segmentation processing on the first grayscale image using a segmentation threshold to determine the first binary image; S204, the second grayscale image is segmented using the maximum inter-class variance method to determine the second binary image; Specifically, S103, which describes determining the leaf veins of the corn to be detected based on the grayscale and binarized image, includes: S301, Obtain the centroid of all pixels with a gray value of 1 in the first binary image, and use it as the center point of the corn to be detected; S302, Based on the second binary image, the convex hull algorithm is used to determine the smallest convex polygon that surrounds the corn to be detected, and the vertices of the convex polygon are obtained. S303, the maximum distance between the center point and each vertex is the maximum distance from the center point of the corn to be detected to the leaf. S304, Perform a logical AND operation on the second binary image and the third grayscale image to determine the fourth grayscale image; S305. Based on the fourth grayscale image of the corn to be detected, perform a circular scan with the center point as the center to retrieve the pixel points of the leaf veins of the corn to be detected and determine the leaf veins of the corn to be detected. Furthermore, in S305, based on the fourth grayscale image of the corn to be detected, a circular scan is performed with the center point as the center to retrieve the pixels of the leaf veins of the corn to be detected and determine the leaf veins of the corn to be detected. This specifically includes: S501, with the center point as the center, scan the fourth grayscale image in a clockwise direction with circular pixels; set the initial radius of the scan and the number of pixels to be increased in each scan, and the maximum radius of the scan is the maximum distance from the center point to the blade; S502 divides a circular pixel into multiple regions using pixels with a grayscale value of 0 in the circular pixel. S503 retains the pixel with the highest gray value in each region and uses it as a potential pixel for detecting the veins of the corn leaf. S504 uses the DBSCAN algorithm based on density clustering to cluster potential pixels of corn leaf veins, thereby realizing the detection of corn leaf veins.
2. The method for detecting maize leaf veins according to claim 1, characterized in that, The step of segmenting the second grayscale image using the maximum inter-class variance method to determine the second binary image further includes: Denoising is performed on the second binary image.
3. A corn leaf vein detection system, used to implement the corn leaf vein detection method according to any one of claims 1-2, characterized in that, The corn leaf vein detection system includes: The color image acquisition module is used to acquire a color image of the corn to be detected; The image processing module is used to perform grayscale and binarization processing on the color image; The leaf vein detection module is used to determine the leaf veins of the corn to be detected based on the grayscale and binarized images.
4. A corn leaf vein detection device, characterized in that, include: The method comprises at least one processor, at least one memory, and computer program instructions stored in the memory, which, when executed by the processor, implement the corn leaf vein detection method as described in any one of claims 1-2.
Citation Information
Patent Citations
Field crop center area positioning method and system
CN113421301A
Clustering method for rosette scan images
US20020037106A1