Method, system and device for automatic extraction of crop leaf pixels
By performing spectral feature processing and adaptive threshold segmentation on crop RGB images, combined with the adaptive contour algorithm, the problem of low leaf pixel extraction accuracy and efficiency in the existing technology is solved, and efficient and automated leaf pixel extraction is achieved, which is suitable for many applications. kind of scene.
Patent Information
- Application Number
- CN202310674417.5
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2023-06-08
- Publication Date
- 2024-09-03
- Estimated Expiration
- 2043-06-08
AI Technical Summary
The existing technology ignores the integration of unique spectral characteristics of leaves in crop leaf pixel extraction, and uses pixels as the smallest processing unit, resulting in low extraction accuracy and efficiency, and relies on cumbersome human-computer interaction and sample labeling, with a low degree of automation.
By performing spectral feature conversion, normalization processing and local adaptive threshold segmentation on the RGB image of the crop to be processed, the target space object is obtained, and the adaptive contour algorithm is used to fit and reconstruct the leaf edge to achieve automatic extraction of leaf pixels.
It improves the accuracy and efficiency of leaf pixel extraction, reduces the need for human-computer interaction and sample labeling, enhances the applicability and accuracy of extraction, and is suitable for scenes in different seasons and regions.
Smart Images

Figure CN116777942B
Abstract
Description
Technical Field
[0001] The present invention relates to the technical field of crop phenotype and crop precision management, and in particular to a method, system and equipment for automatic pixel extraction of crop leaves. Background Art
[0002] Leaves are one of the most important nutritional organs of plants, and they play an indispensable role in the life activities of most plants. Parameters such as crop leaf morphology and area are often closely related to the genotype of the species. Accurately and quickly obtaining the crop leaf area and leaf scale disease susceptibility from RGB optical images is of great significance for the breeding of new crop varieties and related research on crop phenotypes. The realization of the above goals is based on the premise of automated crop leaf pixel extraction, so the development of high-performance leaf pixel extraction methods has a far-reaching impact on phenotypic research and precise crop management.
[0003] Traditionally, crop leaf pixel acquisition indoors or in the field is done by manual outlining, which is time-consuming, labor-intensive, and easily affected by subjective factors. It can no longer meet the actual needs of precise crop management and large-scale crop trait surveys. Therefore, it is urgent and necessary to develop more accurate and efficient crop leaf pixel extraction methods. Driven by the development of related technologies and actual needs, threshold segmentation algorithms represented by the Otsu method (OTSU), marker-watershed segmentation algorithms, support vector machines (SVM), fully convolutional neural networks (FCN) and other machine learning or deep learning algorithms have begun to be introduced into the relevant fields of crop leaf pixel extraction.
[0004] Affected by plant photosynthesis, crop leaves will produce unique responses such as absorption and reflection to incident light. These unique signals can be effectively captured by optical images such as RGB and multispectral. By enhancing the spectral characteristics of the reflection or scattering signals of leaves, the coverage area of leaf pixels can be effectively highlighted, which has a huge impact on the automatic extraction of crop leaf pixels. However, it should be noted that as an important task in the field of crop phenotyping, leaf pixel extraction is often regarded as a challenge of computer vision. Previous explorations have focused on the simple application of existing algorithms and lacked the integration of crop leaf spectral characteristics, which is very unfavorable to improving the accuracy, efficiency and automation level of leaf pixel extraction algorithms. As a continuous coverage area, leaf pixels can show obvious contextual relationships. However, almost all current methods use pixels as the minimum processing unit, ignoring the comprehensive utilization of pixel spatial variation characteristics. With the widespread application of object-oriented image analysis technology in target recognition, image classification and other fields, it provides a feasible solution to such problems and provides new theoretical support for the development of more accurate and efficient crop leaf automatic extraction methods.
[0005] In summary, crop leaf pixel extraction technology has made some progress, but the current leaf pixel extraction based on RGB optical images still faces the following major problems: 1) It focuses on exploring the potential of existing algorithms, ignoring the integration of leaf-specific spectral characteristics; 2) Almost all algorithms use pixels as the minimum processing unit, without considering the spatial variation characteristics of leaf pixels, which reduces computational efficiency; 3) The accuracy of existing conventional algorithms is relatively limited, and their transferability is poor; high-performance machine learning or deep learning algorithms rely on appropriate sample labeling and cumbersome human-computer interaction, and have a low degree of automation. Summary of the invention
[0006] The purpose of the present invention is to provide a method, system and device for automatically extracting crop leaf pixels, which abandons the cumbersome human-computer interaction and time-consuming sample marking process, and improves the extraction efficiency and extraction accuracy of leaf pixels.
[0007] To achieve the above object, the present invention provides the following solutions:
[0008] In a first aspect, the present invention provides a method for automatically extracting crop leaf pixels, comprising:
[0009] Get the RGB image of the crop to be processed;
[0010] The RGB image of the crop to be processed is sequentially subjected to spectral feature conversion, spectral feature normalization processing and local adaptive threshold segmentation processing to obtain a plurality of target space objects;
[0011] Performing category judgment on each of the target space objects to obtain a plurality of crop leaf objects; the categories of the target space objects include leaves and background;
[0012] Taking the crop RGB image to be processed as a reference, an adaptive contour algorithm is used to perform leaf edge fitting and reconstruction on the crop leaf object to obtain a final crop leaf pixel region.
[0013] Optionally, the RGB image of the crop to be processed is sequentially subjected to spectral feature conversion, spectral feature normalization processing and local adaptive threshold segmentation processing to obtain multiple target space objects, specifically including:
[0014] Acquire the intensity value of the red component signal, the intensity value of the green component signal, and the intensity value of the blue component signal of each pixel in the RGB image of the crop to be processed;
[0015] According to the intensity value of the red component signal, the intensity value of the green component signal and the intensity value of the blue component signal of each pixel point, the spectral characteristic value corresponding to each pixel point is calculated; the spectral characteristic values corresponding to multiple pixels points constitute a target spectral characteristic matrix;
[0016] Based on the target spectral feature matrix, determining a spectral feature lower limit value and a spectral feature upper limit value;
[0017] Based on the spectral feature lower limit value and the spectral feature upper limit value, normalizing the target spectral feature matrix to obtain a normalized spectral feature matrix;
[0018] The normalized spectral feature matrix is subjected to local adaptive threshold segmentation to obtain a plurality of target space objects.
[0019] Optionally, the calculation formula for the spectral characteristic value corresponding to each pixel is:
[0020] CIVE(I,J)=u1*DN(i,j) Red -u2*DN(i,j) Green +u3*DN(i,j) Blue +u4;
[0021] Among them, CIVE(i,j) represents the spectral characteristic value corresponding to the pixel point (i,j), DN(i,j) Red Represents the intensity value of the red component signal of pixel (i, j), DN(i, j) Green Represents the intensity value of the green component signal of pixel (i, j), DN(i, j) Blue Represents the intensity value of the blue component signal of the pixel point (i, j), and u1, u2, u3, and u4 all represent preset constant values.
[0022] Optionally, the calculation formula of the normalized spectral feature matrix is:
[0023]
[0024] Among them, CIVE(i,j) N represents the normalized spectral feature matrix, CIVE(i,j) represents the spectral feature value corresponding to the pixel point (i,j), CIVE Bottom Indicates the lower limit of the spectral feature, CIVE Top Indicates the upper limit of the spectral feature.
[0025] Optionally, the determination formula for multiple target space objects is:
[0026]
[0027] Among them, Object(i,j) represents the feature matrix composed of multiple target space objects obtained after segmentation, CIVE(n,m) N represents the normalized spectral feature matrix with n rows and m columns corresponding to each local area under the t segmentation scale, AdaptThresh(CIVE(n,m) N ) t Indicates the CIVE(n,m) of each local area under the segmentation scale t N The optimal segmentation threshold is generated by the local adaptive threshold segmentation algorithm.
[0028] Optionally, performing category judgment on each of the target space objects to obtain a plurality of crop leaf objects specifically includes:
[0029] For each of the target space objects, a mean value of the normalized spectral feature is calculated to obtain a normalized spectral feature mean value;
[0030] The intensity values of the red component signal, the green component signal and the blue component signal in each target space object are respectively averaged to obtain the average signal intensity of the red band, the average signal intensity of the green band and the average signal intensity of the blue band;
[0031] According to the normalized spectral feature mean, the red band average signal intensity, the green band average signal intensity and the blue band average signal intensity, the category of the target space object is judged to obtain a plurality of crop leaf objects.
[0032] Optionally, the function formula for determining the category of the target space object is:
[0033]
[0034]
[0035] Among them, LeafObject(k) represents a matrix composed of multiple crop leaf objects; CIVE(k) N represents the normalized spectral feature mean, u5 represents the preset constant value; DN(k) Red Indicates the average signal strength of the red band, DN(k) Green Indicates the average signal strength of the green band, DN(k) Blue Indicates the average signal strength of the blue band.
[0036] In a second aspect, the present invention provides a system for automatically extracting crop leaf pixels, comprising:
[0037] An image acquisition module is used to acquire RGB images of crops to be processed;
[0038] A spatial object determination module is used to sequentially perform spectral feature conversion, spectral feature normalization processing and local adaptive threshold segmentation processing on the crop RGB image to be processed, so as to obtain a plurality of target spatial objects;
[0039] An object discrimination module is used to perform category judgment on each of the target space objects to obtain a plurality of crop leaf objects; the categories of the target space objects include leaves and background;
[0040] The leaf optimization reconstruction module is used to use the crop RGB image to be processed as a reference, adopt an adaptive contour algorithm, and perform leaf edge fitting reconstruction on the crop leaf object to obtain a final crop leaf pixel area.
[0041] In a third aspect, the present invention provides an electronic device, comprising a memory and a processor, wherein the memory is used to store a computer program, and the processor runs the computer program to enable the electronic device to perform a method for automatically extracting crop leaf pixels.
[0042] According to the specific embodiments provided by the present invention, the present invention discloses the following technical effects:
[0043] The present invention discloses a method, system and device for automatically extracting crop leaf pixels. The spectral feature conversion, spectral feature normalization and local adaptive threshold segmentation processing are sequentially performed on the crop RGB image to be processed to obtain multiple target space objects, highlight the leaf spectral features, realize the automatic identification of objects, thereby avoiding cumbersome human-computer interaction. The process saves the time-consuming sample marking process and abandons the systematic error caused by the subjectivity of technicians. The category (leaf or background) of each target space object is judged to obtain multiple crop leaf objects, that is, the present invention adopts an object-oriented image processing method, which greatly improves the efficiency of leaf pixel extraction. With the crop RGB image to be processed as a reference, the crop leaf object is reconstructed by fitting the leaf edge using an adaptive contour algorithm to obtain the final crop leaf pixel area. The present invention effectively integrates the normalized spectral features of the leaf, and on the premise of ensuring the leaf extraction accuracy, improves the applicability of the present invention, so that it can be applied to leaf pixel extraction operations in different seasons, different regional environments and various scenes, and improves the accuracy of leaf pixel extraction in complex scenes. BRIEF DESCRIPTION OF THE DRAWINGS
[0044] In order to more clearly illustrate the embodiments of the present invention or the technical solutions in the prior art, the drawings required for use in the embodiments will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present invention. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying creative labor.
[0045] Figure 1 A schematic diagram of the process of the method for automatically extracting crop leaf pixels of the present invention;
[0046] Figure 2 A feature map including multiple target space objects provided by an embodiment of the present invention;
[0047] Figure 3 A detailed image of a blade object space before and after post-processing of the blade object provided by an embodiment of the present invention;
[0048] Figure 4 A comparison diagram of different performances of leaf pixel extraction on the same set of RGB images using different algorithms provided by the embodiments of the present invention;
[0049] Figure 5 This is a schematic diagram of the structure of the system for automatically extracting crop leaf pixels according to the present invention. DETAILED DESCRIPTION
[0050] The following will be combined with the drawings in the embodiments of the present invention to clearly and completely describe the technical solutions in the embodiments of the present invention. Obviously, the described embodiments are only part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of the present invention.
[0051] The method, system and device for automatically extracting crop leaf pixels of the present invention can quickly and accurately obtain crop leaf pixels in various environments without human interference.
[0052] In order to make the above-mentioned objects, features and advantages of the present invention more obvious and easy to understand, the present invention is further described in detail below with reference to the accompanying drawings and specific embodiments.
[0053] Embodiment 1
[0054] like Figure 1 As shown, the present invention provides a method for automatically extracting crop leaf pixels, comprising:
[0055] Step 100: Obtain an RGB image of the crop to be processed.
[0056] Step 200, the RGB image of the crop to be processed is sequentially subjected to spectral feature conversion, spectral feature normalization processing and local adaptive threshold segmentation processing to obtain a plurality of target space objects.
[0057] Step 200 specifically includes:
[0058] (1) Obtaining the intensity value of the red component signal, the intensity value of the green component signal, and the intensity value of the blue component signal of each pixel in the RGB image of the crop to be processed.
[0059] Specifically, each pixel in the RGB image of the crop to be processed is assigned a row and column number (i, j); then, the red, green, and blue component signals corresponding to each pixel in the RGB image of the crop to be processed are extracted, and the intensity value corresponding to each component signal is DN (i, j) Red DN(i,j) Green , DN(i,j) Blue .
[0060] (2) According to the intensity value of the red component signal, the intensity value of the green component signal and the intensity value of the blue component signal of each pixel, the spectral characteristic value corresponding to each pixel is calculated; the spectral characteristic values corresponding to multiple pixels constitute the target spectral characteristic matrix (Color index ofvegetation extraction, CIVE). The calculation formula of the spectral characteristic value corresponding to each pixel is:
[0061] CIVE(i,j)=u1*DN(i,j) Red -u2*DN(i,j) Green +u3*DN(i,j) Blue +u4.
[0062] Among them, CIVE(i,j) represents the spectral characteristic value corresponding to the pixel point (i,j), DN(i,j) Red Represents the intensity value of the red component signal of pixel (i, j), DN(i, j) Green Represents the intensity value of the green component signal of pixel (i, j), DN(i, j) Blue represents the intensity value of the blue component signal of the pixel point (i, j), and u1, u2, u3, and u4 all represent preset constant values. In a specific embodiment, u1=0.441, u2=0.811, u3=0.385, and u4=18.78745.
[0063] (3) Based on the target spectral feature matrix, determine the spectral feature lower limit value and the spectral feature upper limit value. Specifically, the spectral feature values of all pixels in the target spectral feature matrix are arranged in order from large to small; the largest first 0.5% of the pixels in the arrangement are taken, and the spectral feature value of the pixel with the smallest spectral feature value among the obtained pixels is defined as the spectral feature upper limit value; the smallest first 0.5% of the pixels in the arrangement are taken, and the spectral feature value of the pixel with the largest spectral feature value among the obtained pixels is defined as the spectral feature lower limit value. In practical applications, the number of pixels obtained can be set to the first 0.6% or the first 0.4% according to actual needs.
[0064] (4) Based on the spectral feature lower limit value and the spectral feature upper limit value, the target spectral feature matrix is normalized to obtain a normalized spectral feature matrix; the calculation formula of the normalized spectral feature matrix is:
[0065]
[0066] Among them, CIVE(i,j) N represents the normalized spectral feature matrix, CIVE(i,j) represents the spectral feature value corresponding to the pixel point (i,j), CIVE Bottom Indicates the lower limit of the spectral feature, CIVE Top Indicates the upper limit of the spectral feature.
[0067] Specifically, when the spectral feature value of a pixel point in the target spectral feature matrix is less than or equal to the spectral feature lower limit value, the pixel value corresponding to the pixel point is assigned to 0; when the spectral feature value of a pixel point in the target spectral feature matrix is greater than or equal to the spectral feature upper limit value, the pixel value corresponding to the pixel point is assigned to 1; when the spectral feature value of a pixel point in the target spectral feature matrix is greater than the spectral feature lower limit value and less than the spectral feature upper limit value, the pixel value corresponding to the pixel point is converted so that the dimension range of the calculated feature matrix is 0 to 1.
[0068] (5) Perform local adaptive threshold segmentation on the normalized spectral feature matrix to obtain multiple target space objects. The formula for determining multiple target space objects is:
[0069]
[0070] Among them, Object(i,j) represents the feature matrix composed of multiple target space objects obtained after segmentation, CIVE(n,m) N represents the normalized spectral feature matrix with n rows and m columns corresponding to each local area under the t segmentation scale, AdaptThresh(CIVE(n,m) N ) t Indicates the CIVE(n,m) of each local area under the segmentation scale t N The optimal segmentation threshold is generated by the Local Adaptive Thresholding Segmentation (ATS) algorithm. The AdaptThresh function selects the threshold based on the local mean intensity (first-order statistic) of each pixel neighborhood.
[0071] By adopting the above step (5), spatial objects such as crops can be effectively captured in scenes with uneven illumination. In a specific embodiment, after completing the image segmentation, extremely small objects with an area smaller than i×j / 8000 pixels caused by image noise are removed, where i and j are the total number of rows and columns of the original RGB image, respectively.
[0072] Step 300, performing category judgment on each of the target space objects to obtain a plurality of crop leaf objects; the categories of the target space objects include leaves and background.
[0073] Step 300 specifically includes:
[0074] (1) For each target space object, the mean of the normalized spectral features is calculated to obtain the mean of the normalized spectral features. Specifically, multiple target space objects contained in an RGB image of a crop to be processed are numbered, and the specific ID corresponding to each target space object is marked as k, and then the average value CIVE(k) of the normalized spectral features in each object area is calculated. N .
[0075] (2) Calculate the mean of the intensity value of the red component signal, the intensity value of the green component signal, and the intensity value of the blue component signal in each of the target space objects, and obtain the corresponding average signal strength of the red band, the average signal strength of the green band, and the average signal strength of the blue band.
[0076] (3) According to the normalized spectral feature mean, the red band average signal intensity, the green band average signal intensity and the blue band average signal intensity, the category of the target space object is judged to obtain multiple crop leaf objects.
[0077] The function formula for judging the category of the target space object is:
[0078]
[0079]
[0080] Among them, LeafObject(k) represents a matrix composed of multiple crop leaf objects, which is the discrimination of leaf objects, in which leaf pixels are assigned a value of 1 and background pixels are assigned a value of 0; CIVE(k) N represents the normalized spectral feature mean, u5 represents the preset constant value; DN(k) Red Indicates the average signal strength of the red band, DN(k) Green Indicates the average signal strength of the green band, DN(k) Blue Represents the average signal intensity of the blue band. Veg(k)>0 is a discriminant rule determined to eliminate the influence of some background objects in the leaf object recognition process. The pixels corresponding to the leaf object will be assigned a value of 1, and the background pixels will be assigned a value of 0. Veg(k)>0 is constructed based on the unique response law of vegetation pixels to different bands in RGB images, with the purpose of highlighting the reflection peak of the green band of vegetation pixels and the absorption peaks of the blue and green bands.
[0081] In a specific embodiment, u5=0.5, and the value of u5 is determined by the spatial distribution of the normalized spectral characteristics of the leaf and background pixels. The specific construction process is: a) Count the normalized spectral characteristics CIVE(k) of each spatial object contained in any number of RGB images (for example, 50 images) N; b) Mark the leaf objects and background objects in each RGB image respectively, and calculate the corresponding CIVE(k) according to the leaf objects and background objects. N The relative size of the value is used to find the hyperplane separating the two types of objects in the feature space by trial and error. Based on the above principle, the feature separation hyperplane obtained by the present invention is the threshold CIVE(k) N = 0.5, normalized spectral feature CIVE(k) of leaf object N <0.5, normalized spectral characteristics of background objects CIVE(k) N ≥0.5.
[0082] Step 400, using the RGB image of the crop to be processed as a reference, adopting an adaptive contour algorithm, reconstructing the edge of the crop leaf object by fitting, so as to obtain the final crop leaf pixel area. Specifically, after the initial leaf object is obtained, the matrix corresponding to the leaf object is input into the adaptive contour algorithm (Adaptive Active Contours without Edges, ACE), and the leaf edge and shape are fitted based on the spatial variation characteristics of the leaf pixels in the original RGB image and the original leaf as a reference, and the morphology and edge of the original leaf are optimized, so that the obtained leaf object is as close to the true value as possible.
[0083] The following will take the corn, rice and soybean images obtained in an outdoor field environment as an example to further illustrate the specific implementation results, and at the same time, the characteristics and working process of the present invention will be more intuitively and clearly demonstrated.
[0084] On a clear afternoon, RGB images of corn, rice, and soybeans were collected in an agricultural experimental station under different backgrounds and growth conditions. The height of the mobile phone lens from the crop canopy was about 0.5m, and the lens direction was always vertically downward. The image collection time was 16:00-17:00. A total of 300 high-quality RGB digital images were collected in the process. The details of the above images are shown in Table 1.
[0085] Table 1
[0086]
[0087] This embodiment randomly selects 5 crop RGB images for display, all of which are representative RGB images of corn, rice, and soybean. Using MATLAB R2022a software, the crop RGB images obtained in this embodiment are converted into target spectral feature matrices one by one. After that, the frequency distribution histogram of the intensity value of each CIVE feature layer is constructed in turn. According to the size and frequency distribution of the intensity value, the largest and smallest top 0.5% pixels in the feature layer are found respectively, and the CIVE is determined.Top and CIVE Bottom , all CIVE feature layers are converted into normalized spectral feature matrices. Then, the normalized spectral features are input into the local adaptive threshold segmentation (AST) algorithm. At the scale of t = 1000, the normalized spectral feature image CIVE N Segmentation is performed to obtain the original spatial objects in each RGB image one by one. After image segmentation is completed, the extremely small objects with an area less than i×j / 8000 pixels caused by image noise are removed. In this example, the number of rows of the RGB image is i=4032, and the number of columns is j=2268, so the area threshold of the extremely small object is 1143 pixels (4032×2268 / 8000). After completing the segmentation in MATLAB R2022a software, the following can be obtained: Figure 2 The feature map shown contains multiple target space objects.
[0088] On this basis, the original spectral characteristics of each space in the same RGB image are obtained in turn: DN(k) Red DN(k) Green DN(k) Blue , and the normalized spectral feature CIVE(k) N , and filter the leaf objects according to the leaf object discrimination rules. After the original leaf object is discriminated, the binary image corresponding to the original leaf object is input into the adaptive contour algorithm (ACE), and the extracted original leaf object is used as the input layer and the original RGB image is used as the reference layer to post-process and reconstruct the leaf object. The object fitting algorithm used is Chan-Vese, and the number of algorithm iterations is 5. Then, the accurate extraction of crop leaf pixels in the RGB image can be completed. The implementation platform of this process is still MATLAB R2022a. The details of the leaf pixels before and after processing can be found in Figure 3 Among them, the first line is the representative RGB images of corn, rice, and soybean collected initially; the second line is the reference leaf Reference, the third line is the original leaf Origin Leaf obtained after spectral feature processing and threshold segmentation, and the fourth line is the RefinedLeaf obtained after category judgment and fitting reconstruction.
[0089] In order to further clarify the characteristics of the present invention, in a specific embodiment, two classic algorithms, Otsu's method (OTSU) and Marker-Watershed, are selected as controls to process the same set of crop RGB image data sets. By comparing the differences in their extraction details of crop leaf pixels, the advantages and disadvantages of the method of the present invention are clarified. Specifically, in order to explore the accuracy of different methods on the same set of data, accuracy (Precision), recall (Recall), Dice coefficient, Jaccard similarity coefficient (Jaccard), and Manhattan distance (Manhanttan) are used to evaluate the Otsu method, marker watershed segmentation, and the method of the present invention. The closer the value is to 1, the higher the accuracy of the method. In this example. The comparison of the leaf pixel extraction effects of the three methods on the same set of data can be seen in Figure 4 , the extraction accuracy can be seen in Table 2.
[0090] Table 2
[0091]
[0092] like Figure 4 As shown in the figure, the method of the present invention can accurately and quickly extract crop leaf pixels in farmland scenes, and its average precision, recall, Dice coefficient, Jaccard similarity coefficient, and Manhattan distance are as high as 100%, which is much higher than the classic OTSU and Marker-Watershed algorithms. The extracted leaf pixel morphology is similar to the real leaf morphology, with clear and complete edges.
[0093] In summary, the present invention provides a new method for automatically extracting crop leaf pixels from RGB images using object-oriented image analysis technology. First, multiple crop RGB images in some scenes are collected, and then spectral features are converted to obtain normalized spectral features; based on the normalized spectral features, spatial objects are obtained by relying on the local adaptive threshold segmentation algorithm; then the normalized spectral features of the leaves and background objects are used to distinguish the leaf objects through rules; finally, the adaptive contour algorithm (ACE) is used to post-process the original leaf objects, fit the accurate leaf edges, post-process and reconstruct the leaf objects, and finally accurate crop leaf pixels can be obtained. The present invention can realize the automatic and accurate extraction of crop leaf pixels in RGB images based on the signal response differences of vegetation to different spectral bands without human-computer interaction and labeled samples, with the help of object-oriented image analysis technology. Its performance is far better than classic algorithms such as OSTU and Marker-Watershed; at the same time, the invention also has the advantages of simple operation, high computational efficiency, extremely low cost, adaptability to various indoor and outdoor scenes, strong method robustness, etc., and its performance has obvious advantages.
[0094] Embodiment 2
[0095] like Figure 5 As shown, in order to implement the technical solution in the first embodiment and achieve the corresponding functions and technical effects, this embodiment provides a system for automatically extracting crop leaf pixels, including:
[0096] The image acquisition module 101 is used to acquire the RGB image of the crop to be processed.
[0097] The spatial object determination module 201 is used to sequentially perform spectral feature conversion, spectral feature normalization processing and local adaptive threshold segmentation processing on the crop RGB image to be processed, so as to obtain multiple target spatial objects.
[0098] The object identification module 301 is used to perform category identification on each of the target space objects to obtain a plurality of crop leaf objects; the categories of the target space objects include leaves and background.
[0099] The leaf optimization reconstruction module 401 is used to use the crop RGB image to be processed as a reference and adopt an adaptive contour algorithm to perform leaf edge fitting reconstruction on the crop leaf object to obtain a final crop leaf pixel area.
[0100] Embodiment 3
[0101] This embodiment provides an electronic device, including a memory and a processor, wherein the memory is used to store a computer program, and the processor runs the computer program to enable the electronic device to execute the method for automatic crop leaf pixel extraction of the first embodiment.
[0102] Optionally, the above-mentioned electronic device may be a server.
[0103] In addition, an embodiment of the present invention further provides a computer-readable storage medium storing a computer program, which, when executed by a processor, implements the method for automatic crop leaf pixel extraction of the first embodiment.
[0104] In this specification, each embodiment is described in a progressive manner, and each embodiment focuses on the differences from other embodiments. The same or similar parts between the embodiments can be referred to each other. For the system disclosed in the embodiment, since it corresponds to the method disclosed in the embodiment, the description is relatively simple, and the relevant parts can be referred to the method part.
[0105] The principles and implementation methods of the present invention are described in this article using specific examples. The description of the above embodiments is only used to help understand the method and core idea of the present invention. At the same time, for those skilled in the art, according to the idea of the present invention, there will be changes in the specific implementation methods and application scope. In summary, the content of this specification should not be understood as limiting the present invention.
Claims
1. A method for automatically extracting crop leaf pixels, characterized in that: Methods include: Get the RGB image of the crop to be processed; The RGB image of the crop to be processed is sequentially subjected to spectral feature conversion, spectral feature normalization processing and local adaptive threshold segmentation processing to obtain a plurality of target space objects; The RGB image of the crop to be processed is sequentially subjected to spectral feature conversion, spectral feature normalization processing and local adaptive threshold segmentation processing to obtain a plurality of target space objects, specifically comprising: obtaining the intensity value of the red component signal, the intensity value of the green component signal and the intensity value of the blue component signal of each pixel in the RGB image of the crop to be processed; calculating the spectral feature value corresponding to each pixel according to the intensity value of the red component signal, the intensity value of the green component signal and the intensity value of the blue component signal of each pixel; the spectral feature values corresponding to a plurality of pixels constitute a target spectral feature matrix; based on the target spectral feature matrix, determining a spectral feature lower limit value and a spectral feature upper limit value; based on the spectral feature lower limit value and the spectral feature upper limit value, normalizing the target spectral feature matrix to obtain a normalized spectral feature matrix; performing local adaptive threshold segmentation on the normalized spectral feature matrix to obtain a plurality of target space objects; The calculation formula of the spectral characteristic value corresponding to each pixel point is: CIVE(i,j)=u1*DN(i,j) Red -u2*DN(i,j) Green +u3*DN(i,j) Blue +u4; where CIVE(i,j) represents the spectral characteristic value corresponding to the pixel point (i,j), DN(i,j) Red Represents the intensity value of the red component signal of pixel (i, j), DN(i, j) Green Represents the intensity value of the green component signal of pixel (i, j), DN(i, j) Blue represents the intensity value of the blue component signal of the pixel (i, j), where u1, u2, u3, and u4 all represent preset constant values; Performing category judgment on each of the target space objects to obtain a plurality of crop leaf objects; the categories of the target space objects include leaves and background; Taking the crop RGB image to be processed as a reference, an adaptive contour algorithm is used to perform leaf edge fitting and reconstruction on the crop leaf object to obtain a final crop leaf pixel region.
2. The method for automatic extraction of crop leaf pixels according to claim 1, characterized in that: The calculation formula of the normalized spectral feature matrix is: Among them, CIVE(i,j) N represents the normalized spectral feature matrix, CIVE(i,j) represents the spectral feature value corresponding to the pixel point (i,j), CIVE Bottom Indicates the lower limit of the spectral feature, CIVE Top Indicates the upper limit of the spectral feature.
3. The method for automatic extraction of crop leaf pixels according to claim 1, characterized in that: The formula for determining multiple target space objects is: Among them, Object(i,j) represents the feature matrix composed of multiple target space objects obtained after segmentation, CIVE(n,m) N Represents a normalized spectral feature matrix with n rows and m columns, AdaptThresh(CIVE(n,m) N ) t Indicates CIVE(n,m) at t segmentation scale N The optimal segmentation threshold is generated by the local adaptive threshold segmentation algorithm.
4. The method for automatic extraction of crop leaf pixels according to claim 1, characterized in that: Performing category judgment on each of the target space objects to obtain a plurality of crop leaf objects specifically includes: For each of the target space objects, a mean value of the normalized spectral feature is calculated to obtain a normalized spectral feature mean value; The intensity values of the red component signal, the green component signal and the blue component signal in each target space object are respectively averaged to obtain the average signal intensity of the red band, the average signal intensity of the green band and the average signal intensity of the blue band; According to the normalized spectral feature mean, the red band average signal intensity, the green band average signal intensity and the blue band average signal intensity, the category of the target space object is judged to obtain a plurality of crop leaf objects.
5. The method for automatic extraction of crop leaf pixels according to claim 4, characterized in that: The function formula for judging the category of the target space object is: Among them, LeafObject(k) represents a matrix composed of multiple crop leaf objects; CIVE(k) N represents the normalized spectral feature mean, u5 represents the preset constant value; DN(k) Red Indicates the average signal strength of the red band, DN(k) Green Indicates the average signal strength of the green band, DN(k) Blue Represents the average signal strength of the blue band, and Veg(k) represents the value after discrimination, which is 0 or 1.
6. A system for automatic extraction of crop leaf pixels, characterized in that: The system includes: An image acquisition module is used to acquire RGB images of crops to be processed; A spatial object determination module is used to sequentially perform spectral feature conversion, spectral feature normalization processing and local adaptive threshold segmentation processing on the crop RGB image to be processed, so as to obtain a plurality of target spatial objects; The RGB image of the crop to be processed is sequentially subjected to spectral feature conversion, spectral feature normalization processing and local adaptive threshold segmentation processing to obtain a plurality of target space objects, specifically comprising: obtaining the intensity value of the red component signal, the intensity value of the green component signal and the intensity value of the blue component signal of each pixel in the RGB image of the crop to be processed; calculating the spectral feature value corresponding to each pixel according to the intensity value of the red component signal, the intensity value of the green component signal and the intensity value of the blue component signal of each pixel; the spectral feature values corresponding to a plurality of pixels constitute a target spectral feature matrix; based on the target spectral feature matrix, determining a spectral feature lower limit value and a spectral feature upper limit value; based on the spectral feature lower limit value and the spectral feature upper limit value, normalizing the target spectral feature matrix to obtain a normalized spectral feature matrix; performing local adaptive threshold segmentation on the normalized spectral feature matrix to obtain a plurality of target space objects; The calculation formula of the spectral characteristic value corresponding to each pixel point is: CIVE(i,j)=u1*DN(i,j) Red -u2*DN(i,j) Green +u3*DN(i,j) Blue +u4; where CIVE(i,j) represents the spectral characteristic value corresponding to the pixel point (i,j), DN(i,j) Red Represents the intensity value of the red component signal of pixel (i, j), DN(i, j) Green Represents the intensity value of the green component signal of pixel (i, j), DN(i, j) Blue Indicates the intensity value of the blue component signal of the pixel (i, j), where u1, u2, u3, and u4 all represent preset constant values; An object discrimination module is used to perform category discrimination on each of the target space objects to obtain a plurality of crop leaf objects; the categories of the target space objects include leaves and background; The leaf optimization reconstruction module is used to use the crop RGB image to be processed as a reference, adopt an adaptive contour algorithm, and perform leaf edge fitting reconstruction on the crop leaf object to obtain a final crop leaf pixel area.
7. An electronic device, characterized in that: The electronic device comprises a memory and a processor, wherein the memory is used to store a computer program, and the processor runs the computer program to enable the electronic device to execute the method for automatic extraction of crop leaf pixels as described in any one of claims 1 to 5.
