Wheat seedling contour counting method and system based on edge detection
By acquiring wheat seedling images and lighting data, and calculating adaptive thresholds for edge detection and fitting, the problem of large errors in existing wheat seedling counting methods is solved, and efficient and accurate wheat seedling counting is achieved.
Patent Information
- Application Number
- CN202510399384.7
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-04-01
- Publication Date
- 2025-07-18
AI Technical Summary
The existing wheat seedling counting methods have large errors, traditional manual counting is inefficient and inaccurate, and the automated counting method requires a large amount of labeled data and has high computing resource requirements, making it difficult to achieve real-time, accurate and efficient wheat seedling profile counting.
By acquiring wheat seedling image data and ambient light data, calculating wheat seedling uniformity and adaptive threshold, edge detection and overlapping area fitting, and generating wheat seedling number data.
It improves the accuracy and efficiency of wheat seedling counting, reduces artificial errors, reduces computing resource requirements, and realizes real-time and efficient wheat seedling profile counting.
Smart Images

Figure CN120339362A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of computer vision technology, and particularly to a wheat seedling contour counting method and system based on edge detection. Background Art
[0002] In wheat production, accurately grasping the number of wheat seedlings is of crucial significance for aspects such as plant growth monitoring, yield prediction, and wheat field management decision-making. Traditional wheat seedling counting methods mostly rely on manual on-site inspections, where agricultural technicians conduct statistics row by row in each wheat field. This method not only consumes a large amount of human, material, and time costs and has extremely low efficiency, but is also significantly affected by human factors. The counting results of different personnel may have large subjective biases, making it difficult to ensure the accuracy and objectivity of the data.
[0003] With the development of modern technology, some automated counting technologies have emerged. Early image recognition-based counting methods usually use simple threshold segmentation algorithms to distinguish wheat seedlings from the background. However, the actual farmland environment is complex and changeable. Factors such as unstable lighting conditions, inconsistent growth and development states of wheat seedlings, and severe interference from field weeds make it difficult to accurately extract the contour information of wheat seedlings solely relying on threshold segmentation, resulting in large errors in the counting results.
[0004] In recent years, although some advanced machine learning algorithms have been applied to wheat seedling counting, such as object detection models based on deep learning. However, such methods often require a large amount of labeled data for model training, and the labeling process is not only cumbersome but also error-prone. Moreover, these models have extremely high requirements for computing resources, and in actual farmland scenarios, limited by hardware device conditions, it is difficult to achieve real-time, accurate, and efficient wheat seedling contour counting. Summary of the Invention
[0005] The present invention provides a wheat seedling contour counting method and system based on edge detection, and its main purpose is to solve the problem of large errors in existing wheat seedling counting methods.
[0006] To achieve the above object, a wheat seedling contour counting method based on edge detection provided by the present invention includes:
[0007] Obtain the wheat seedling image data and environmental light data of a preset wheat planting area;
[0008] Calculate the wheat seedling uniformity according to the wheat seedling image data;
[0009] Calculate an adaptive threshold according to the wheat seedling uniformity and the environmental light data;
[0010] Perform edge detection on the wheat seedling image data based on the adaptive threshold to obtain overlapping edge data;
[0011] Perform overlapping region fitting on the overlapping edge data to obtain complete edge data;
[0012] Generate wheat seedling quantity data based on the complete edge data.
[0013] Optionally, the calculating the uniformity of wheat seedlings based on the wheat seedling image data includes:
[0014] Segment the wheat seedling image data into multiple window image data of the same size to obtain a set of window image data;
[0015] Extract the texture feature matrix of each window image data in the set of window image data;
[0016] Calculate the density coefficient of each window image data according to the texture feature matrix of each window image data;
[0017] Calculate the uniformity of wheat seedlings according to the density coefficient.
[0018] Optionally, the calculating the density coefficient of each window image data according to the texture feature matrix of each window image data includes:
[0019] Obtain the RGB channel color values of the window image data;
[0020] Calculate the mean value of the red channel, the mean value of the green channel, and the mean value of the blue channel according to the RGB channel color values;
[0021] Obtain the matrix entropy value of the texture feature matrix;
[0022] Perform LAB color space conversion on the RGB channel color values to obtain LAB parameters;
[0023] Calculate the density coefficient according to the texture feature matrix, the RGB channel color values, the mean value of the red channel, the mean value of the green channel, the mean value of the blue channel, the matrix entropy value, and the LAB parameters.
[0024] Optionally, the calculation formula of the density coefficient is as follows:
[0025]
[0026] Where, W ρ is the density coefficient, α is a preset first weight parameter, β is a preset second weight parameter, T r is the matrix entropy value, G is the green channel value included in the RGB channel color values, γ is a preset color modulation parameter, ||T c || F is the Frobenius norm of the covariance matrix of the texture feature matrix, is the mean value of the green channel, is the mean value of the red channel, is the mean value of the blue channel, δ is a preset green channel enhancement parameter, ∈ is a preset extremely small number, and σ T is the variance of the texture feature matrix, L * is the luminance parameter included in the LAB parameter, a * is the red-green axis color component included in the LAB parameter, b * is the yellow-blue axis color component included in the LAB parameter.
[0027] Optionally, the calculation formula of the adaptive threshold is as follows:
[0028]
[0029] where H is the adaptive threshold, λ is a preset spectral response fundamental frequency, k is a preset density attenuation coefficient, S is the wheat seedling uniformity, E is the environmental light intensity included in the environmental light data, E o is a preset reference light intensity, a * is the red-green axis color component included in the LAB parameter, b * is the yellow-blue axis color component included in the LAB parameter, σ T is the variance of the texture feature matrix, cosh() is the texture variance hyperbolic function, C is the environmental light color temperature included in the environmental light data, C o is a preset daylight reference color temperature, and ∈ is a preset minimum value.
[0030] Optionally, the edge detection of the wheat seedling image data based on the adaptive threshold to obtain overlapping edge data includes:
[0031] Calculating the local dynamic threshold of each window image data according to the adaptive threshold and the density coefficient of each window image data in the window image data set;
[0032] Calculating the gradient magnitude of each window image data;
[0033] Performing non-maximum suppression on the gradient magnitude of each window image data to obtain a refined gradient magnitude;
[0034] Traversing each pixel of each window image data, and marking the pixels with the refined gradient magnitude greater than the local dynamic threshold as edge pixels to obtain the edge data of each window image data;
[0035] Integrating the edge data of each window image data to obtain overlapping edge data.
[0036] Optionally, fitting the overlapping area of the overlapping edge data to obtain complete edge data, including:
[0037] Performing adjacent fracture connection edges on the overlapping edge data through morphological closing operation to obtain connected edge data;
[0038] Performing edge extension on the connected edge data based on the gradient direction of the connected edge data to obtain extended edge data;
[0039] Determining the segmentation position according to the edge concave points, concave point depths and concave point angles in the extended edge data;
[0040] Separating the overlapping edges in the extended edge data according to the segmentation position to obtain sub-contour data;
[0041] Performing dynamic fitting based on the edge complexity in the sub-contour data to obtain a fitted edge;
[0042] Fusing the fitted edge and the extended edge data to obtain complete edge data.
[0043] Optionally, the performing dynamic fitting based on the edge complexity in the sub-contour data to obtain a fitted edge includes:
[0044] Obtaining regular shape edges and complex shape edges in the sub-contour data;
[0045] Fitting the regular shape edges using the least squares ellipse algorithm to obtain a regular fitted edge;
[0046] Fitting the complex shape edges using a polygon approximation algorithm to obtain a complex shape fitted edge;
[0047] Integrating the regular fitted edge and the complex shape fitted edge to obtain a fitted edge.
[0048] Optionally, the generating wheat seedling quantity data according to the complete edge data includes:
[0049] Obtaining area data of all edge contours of the complete edge data;
[0050] Filtering invalid edges from the complete edge data according to the area data to obtain filtered edge data;
[0051] Confirming the wheat seedling quantity data according to the filtered edge data.
[0052] To solve the above problems, the present invention also provides a wheat seedling contour counting system based on edge detection. The system includes a data acquisition module, a data calculation module, an edge detection module, an edge fitting module, and a quantity generation module, where:
[0053] The data acquisition module is used to acquire the wheat seedling image data and environmental light data of a preset wheat seedling planting area;
[0054] The data calculation module is used to calculate the wheat seedling uniformity according to the wheat seedling image data, and calculate an adaptive threshold according to the wheat seedling uniformity and the environmental light data;
[0055] The edge detection module is used to perform edge detection on the wheat seedling image data based on the adaptive threshold to obtain overlapping edge data;
[0056] The edge fitting module is used to fit the overlapping areas of the overlapping edge data to obtain complete edge data;
[0057] The quantity generation module is used to generate wheat seedling quantity data according to the complete edge data.
[0058] In the embodiment of the present invention, the wheat seedling image data and environmental light data of a preset wheat seedling planting area are acquired, the wheat seedling uniformity is calculated according to the wheat seedling image data, the adaptive threshold is calculated according to the wheat seedling uniformity and the environmental light data, edge detection is performed on the wheat seedling image data based on the adaptive threshold to obtain overlapping edge data, the overlapping areas of the overlapping edge data are fitted to obtain complete edge data, and wheat seedling quantity data is generated according to the complete edge data. Therefore, the wheat seedling contour counting method and system based on edge detection proposed by the present invention can solve the problem of large errors in the existing wheat seedling counting methods. BRIEF DESCRIPTION OF THE DRAWINGS
[0059] Figure 1 is a schematic flow chart of a wheat seedling contour counting method based on edge detection provided by an embodiment of the present invention;
[0060] Figure 2 is a functional module diagram of a wheat seedling contour counting system based on edge detection provided by an embodiment of the present invention.
[0061] The realization, functional features, and advantages of the objectives of the present invention will be further described in conjunction with the embodiments and with reference to the accompanying drawings. DETAILED DESCRIPTION OF THE EMBODIMENTS
[0062] It should be understood that the specific embodiments described herein are only used to explain the present invention and are not used to limit the present invention.
[0063] An embodiment of the present application provides a wheat seedling contour counting method based on edge detection. The execution subject of the wheat seedling contour counting method based on edge detection includes, but is not limited to, at least one of electronic devices such as a server, a terminal, etc. that can be configured to execute the method provided in the embodiment of the present application. In other words, the wheat seedling contour counting method based on edge detection can be executed by software or hardware installed on a terminal device or a server device, and the software can be a blockchain platform. The server includes, but is not limited to: a single server, a server cluster, a cloud server, or a cloud server cluster, etc. The server can be an independent server or a cloud server that provides basic cloud computing services such as cloud services, cloud databases, cloud computing, cloud functions, cloud storage, network services, cloud communications, middleware services, domain name services, security services, Content Delivery Network (CDN), and big data and artificial intelligence platforms.
[0064] Referring to Figure 1 As shown in the figure, it is a schematic flowchart of a wheat seedling contour counting method based on edge detection provided by an embodiment of the present invention. In this embodiment, the wheat seedling contour counting method based on edge detection includes:
[0065] S1. Obtain the wheat seedling image data and environmental light data of a preset wheat seedling planting area.
[0066] In an embodiment of the present invention, the wheat seedling image data of a preset wheat seedling planting area can be obtained by using a preset camera.
[0067] Specifically, the wheat seedling image data is an image that uses RGB colors to represent the image colors.
[0068] Specifically, RGB respectively represent the three color channels of red, green, and blue. In a computer, an image is regarded as a two-dimensional matrix composed of pixels, and each pixel is composed of three color components of red, green, and blue.
[0069] In an embodiment of the present invention, the environmental light data includes the environmental light intensity and the environmental light color temperature.
[0070] Specifically, the environmental light data can be obtained by using a light sensor.
[0071] S2. Calculate the wheat seedling uniformity according to the wheat seedling image data.
[0072] In an embodiment of the present invention, the wheat seedling uniformity is a parameter that represents the degree of uniformity of the wheat seedling distribution in a preset wheat seedling planting area.
[0073] In an embodiment of the present invention, calculating the wheat seedling uniformity according to the wheat seedling image data includes:
[0074] Segment the wheat seedling image data into multiple window image data of the same size to obtain a set of window image data;
[0075] Extract the texture feature matrix of each window image data in the set of window image data;
[0076] Calculate the density coefficient of each window image data according to the texture feature matrix of each window image data;
[0077] Calculate the wheat seedling uniformity according to the density coefficient.
[0078] In an embodiment of the present invention, to extract the texture feature matrix of each window image data in the set of window image data, after graying each window image data, perform a filtering and denoising process, calculate the co-occurrence matrix of the denoised image, and extract the texture features of the co-occurrence matrix based on the contrast.
[0079] In an embodiment of the present invention, the density coefficient is a parameter used to represent the density of wheat seedlings in a single window area.
[0080] In an embodiment of the present invention, calculating the density coefficient of each window image data according to the texture feature matrix of each window image data includes:
[0081] Obtain the RGB channel color values of the window image data;
[0082] Calculate the red channel mean value, the green channel mean value, and the blue channel mean value according to the RGB channel color values;
[0083] Obtain the matrix entropy value of the texture feature matrix;
[0084] Perform a LAB color space conversion on the RGB channel color values to obtain LAB parameters;
[0085] Calculate the density coefficient according to the texture feature matrix, the RGB channel color values, the red channel mean value, the green channel mean value, the blue channel mean value, the matrix entropy value, and the LAB parameters.
[0086] Specifically, to obtain the matrix entropy value of the texture feature matrix, after normalizing the elements in the matrix, calculate the matrix entropy value according to the calculation formula of information entropy.
[0087] Specifically, to perform a LAB color space conversion on the RGB channel color values to obtain LAB parameters, convert the RGB channel color values from the RGB space to the XYZ color space, and then from the XYZ color space to the LAB color space.
[0088] Specifically, each color in the XYZ color space is described by three numerical values X, Y, and Z, which are called tristimulus values. Different from the primary colors of red, green, and blue in the RGB model, the three components of XYZ are virtual and obtained through mathematical modeling to optimize the overall human perception of color. For example, X is mainly associated with red, Y is mainly associated with green (and is proportional to brightness), and Z is related to blue. Through the combination of these numerical values, all colors visible to the human eye can be covered.
[0089] Specifically, in the LAB color space, L represents the brightness of the color, with a value range from 0 to 100. Among them, 0 represents black, that is, there is no brightness at all; 100 represents white, that is, the highest brightness; A represents the position of the color between green and red. The value of the a channel ranges from -128 to 127. When the value of the a channel is negative, the color tends to green; the closer the value is to -128, the higher the saturation of green. When the value of the a channel is positive, the color tends to red; the closer the value is to 127, the higher the saturation of red. When the value of a is 0, it means that the color is in the neutral position between green and red, that is, there is no green or red offset; B represents the position of the color between blue and yellow. The value range of the b channel is also -128 to 127. When the value of the b channel is negative, the color tends to blue; the closer the value is to -128, the higher the saturation of blue. When the value of the b channel is positive, the color tends to yellow; the closer the value is to 127, the higher the saturation of yellow. When the value of b is 0, it means that the color is in the neutral position between blue and yellow, that is, there is no blue or yellow offset.
[0090] Specifically, the calculation formula of the density coefficient is as follows:
[0091]
[0092] Where W ρ is the density coefficient, α is a preset first weight parameter, β is a preset second weight parameter, T r is the matrix entropy value, G is the green channel value included in the RGB channel color value, γ is a preset color modulation parameter, ||T c || F is the Frobenius norm of the covariance matrix of the texture feature matrix, is the mean value of the green channel, is the mean value of the red channel, is the mean value of the blue channel, δ is a preset green channel enhancement parameter, ∈ is a preset extremely small number, σ T is the variance of the texture feature matrix, L * is the brightness parameter included in the LAB parameter, a *is the color component of the red-green axis contained in the LAB parameter, b * is the color component of the yellow-blue axis contained in the LAB parameter.
[0093] In the embodiment of the present invention, calculating the wheat seedling uniformity according to the density coefficient is to calculate the standard deviation as the wheat seedling uniformity according to the density coefficient of each window image data.
[0094] Specifically, the covariance matrix of the texture feature matrix is used to describe the covariance relationship between the elements in the texture feature matrix.
[0095] Specifically, the Frobenius norm of the covariance matrix can be used to describe the statistical characteristics of the image texture. When the Frobenius norm is large, it indicates that the elements (covariance values) in the covariance matrix are generally large, meaning that the complexity of the texture is high.
[0096] In the embodiment of the present invention, by calculating the wheat seedling uniformity according to the wheat seedling image data, the subsequent
[0097] S3. Calculate the adaptive threshold according to the wheat seedling uniformity and the environmental light data.
[0098] In the embodiment of the present invention, before edge detection of the wheat seedling image, a threshold needs to be set for threshold segmentation. Since the penetration ability of sunlight in different parts of the wheat seedlings is different, the threshold needs to be set according to the environmental light data.
[0099] In the embodiment of the present invention, the calculation formula of the adaptive threshold is as follows:
[0100]
[0101] Wherein, H is the adaptive threshold, λ is the preset spectral response fundamental frequency, k is the preset density attenuation coefficient, S is the wheat seedling uniformity, E is the environmental light intensity included in the environmental light data, E o is the preset reference light intensity, a * is the color component of the red-green axis contained in the LAB parameter, b * is the color component of the yellow-blue axis contained in the LAB parameter, σ T is the variance of the texture feature matrix, cosh() is the texture variance hyperbolic function, C is the environmental light color temperature included in the environmental light data, C o is the preset daylight reference color temperature, ∈ is the preset minimum value.
[0102] Specifically, the preset spectral response fundamental frequency can be taken as 0.9.
[0103] Specifically, the density attenuation coefficient can be taken as 1.8.
[0104] Specifically, the texture variance hyperbolic function can adjust the threshold sensitivity according to the magnitude of the variance.
[0105] In the embodiment of the present invention, by calculating the adaptive threshold according to the wheat seedling uniformity and the environmental light data, the accuracy of subsequent edge detection of the wheat seedling image data can be improved.
[0106] S4. Perform edge detection on the wheat seedling image data based on the adaptive threshold to obtain overlapping edge data.
[0107] In the embodiment of the present invention, the performing edge detection on the wheat seedling image data based on the adaptive threshold to obtain overlapping edge data includes:
[0108] Calculating the local dynamic threshold of each window image data according to the adaptive threshold and the density coefficient of each window image data in the window image data set;
[0109] Calculating the gradient magnitude of each window image data;
[0110] Performing non-maximum suppression on the gradient magnitude of each window image data to obtain a refined gradient magnitude;
[0111] Traversing each pixel of each window image data, and marking the pixels with the refined gradient magnitude greater than the local dynamic threshold as edge pixels to obtain the edge data of each window image data;
[0112] Integrating the edge data of each window image data to obtain overlapping edge data.
[0113] Specifically, the gradient magnitude is a quantity that measures the degree of change in pixel values in an image.
[0114] Specifically, non-maximum suppression is a technique widely used in the fields of computer vision and image processing. Its main purpose is to remove those elements that are not local maxima among many candidate targets, so as to retain the elements most likely to be the targets.
[0115] In the embodiment of the present invention, by performing edge detection on the wheat seedling image data based on the adaptive threshold to obtain overlapping edge data, the efficiency of subsequent fitting of the overlapping area of the overlapping edge data is improved.
[0116] S5. Perform overlapping area fitting on the overlapping edge data to obtain complete edge data.
[0117] In the embodiments of the present invention, since the wheat seedlings overlap with each other, the extracted edge data also has overlapping regions. Therefore, it is necessary to fit the overlapping regions to make each contour complete and improve the accuracy of wheat seedling counting.
[0118] In the embodiments of the present invention, the fitting of the overlapping regions of the overlapping edge data to obtain complete edge data includes:
[0119] Connecting adjacent broken edges of the overlapping edge data through morphological closing operation to obtain connected edge data;
[0120] Extending the connected edge data based on the gradient direction of the connected edge data to obtain extended edge data;
[0121] Determining the segmentation position according to the edge concave points, concave point depths and concave point angles in the extended edge data;
[0122] Separating the overlapping edges in the extended edge data according to the segmentation position to obtain sub-contour data;
[0123] Performing dynamic fitting based on the edge complexity in the sub-contour data to obtain a fitted edge;
[0124] Fusing the fitted edge and the extended edge data to obtain complete edge data.
[0125] Specifically, the connecting of adjacent broken edges of the overlapping edge data through morphological closing operation is to perform an erosion operation after a dilation operation on the overlapping edge data, so as to connect the broken fine edges.
[0126] Specifically, the extending of the connected edge data based on the gradient direction of the connected edge data is to extend the broken edge along the gradient direction until it intersects with other edges.
[0127] Specifically, the separating of the overlapping edges in the extended edge data according to the segmentation position is to apply the watershed algorithm combined with distance transformation and gradient map to separate the edges of the overlapping region.
[0128] Specifically, the performing of dynamic fitting based on the edge complexity in the sub-contour data to obtain a fitted edge includes:
[0129] Obtaining the regular-shaped edges and complex-shaped edges in the sub-contour data;
[0130] Fitting the regular-shaped edges by the least squares ellipse algorithm to obtain a regular fitted edge;
[0131] The polygon approximation algorithm is used to fit the edges of the complex shape to obtain the fitted edges of the complex shape;
[0132] Integrate the regular fitted edges and the fitted edges of the complex shape to obtain the fitted edges.
[0133] Specifically, when using the polygon approximation algorithm to fit the edges of the complex shape, the contour curve is recursively segmented, the points farthest from the current approximate line segment are retained, and the original shape is gradually approximated.
[0134] Specifically, the edges of the regular shape may refer to small-arc curves, and the fitted edges of the complex shape may include bifurcated edges and serrated edges.
[0135] Specifically, when using the least squares ellipse algorithm to fit the edges of the regular shape, by minimizing the sum of the squares of the distances from the contour points to the fitted ellipse (sum of squared errors), the optimal ellipse parameters are found to make it as close as possible to the contour of the regular-shaped wheat seedlings.
[0136] Specifically, when using the polygon approximation algorithm to fit the complex shape contour to obtain the fitted edges of the complex shape, the Douglas-Peucker algorithm is used. The contour curve is recursively segmented, the feature points farthest from the current approximate line segment are retained, and the original shape is gradually approximated. The maximum allowable error threshold is adaptively adjusted according to the complexity of the contour shape. The more complex the shape, the greater the allowable simplification error. Combining curvature calculation to screen high-curvature points (such as leaf tips and bifurcation points) to ensure that key morphological features are retained. Finally, a polygon composed of ordered vertices is obtained.
[0137] S6. Generate wheat seedling quantity data according to the complete edge data.
[0138] In the embodiment of the present invention, generating the wheat seedling quantity data according to the complete edge data includes:
[0139] Obtain the area data of all edge contours of the complete edge data;
[0140] Filter out invalid edges from the complete edge data according to the area data to obtain filtered edge data;
[0141] Confirm the wheat seedling quantity data according to the filtered edge data.
[0142] In an embodiment of the present invention, RGB wheat seedling image data of a preset wheat seedling planting area is obtained by using a camera, and environmental light data including light intensity and color temperature is obtained by using a light sensor; the wheat seedling image is segmented into window images, a texture feature matrix is extracted, the density coefficient of each window is calculated, and finally the standard deviation of the density coefficient is used as the wheat seedling uniformity; combining the wheat seedling uniformity and the environmental light data, an adaptive threshold is calculated according to a specific formula to improve the accuracy of subsequent edge detection; based on the adaptive threshold and the window density coefficient, a local dynamic threshold is determined, the window gradient amplitude is calculated, the edge pixels are marked after non-maximum suppression refinement, the overlapping edge data is integrated, a morphological closing operation and edge extension are performed on the overlapping edge data, the segmentation position is determined to separate the overlapping edges, and the edges are dynamically fitted according to the edge complexity, and finally the complete edge data is obtained by fusion; the wheat seedling quantity data is generated according to the effective area of the complete edge data, which can improve the accuracy of wheat seedling counting.
[0143] As Figure 2 shown, it is a functional module diagram of a wheat seedling contour counting system based on edge detection provided by an embodiment of the present invention.
[0144] The wheat seedling contour counting system 100 based on edge detection according to the present invention can be installed in an electronic device. According to the implemented functions, the wheat seedling contour counting system 100 based on edge detection may include a data acquisition module 101, a data calculation module 102, an edge detection module 103, an edge fitting module 104, and a quantity generation module 105. The modules in the present invention may also be referred to as units, which refer to a series of computer program segments that can be executed by a processor of an electronic device and can complete fixed functions, and are stored in the memory of the electronic device.
[0145] In this embodiment, the functions of each module / unit are as follows:
[0146] The data acquisition module 101 is configured to acquire wheat seedling image data and environmental light data of a preset wheat seedling planting area;
[0147] The data calculation module 102 is configured to calculate the wheat seedling uniformity according to the wheat seedling image data, and calculate an adaptive threshold according to the wheat seedling uniformity and the environmental light data;
[0148] The edge detection module 103 is configured to perform edge detection on the wheat seedling image data based on the adaptive threshold to obtain overlapping edge data;
[0149] The edge fitting module 104 is configured to perform overlapping area fitting on the overlapping edge data to obtain complete edge data;
[0150] The quantity generation module 105 is configured to generate wheat seedling quantity data according to the complete edge data.
[0151] Specifically, each module in the wheat seedling contour counting system 100 based on edge detection in the embodiments of the present invention uses the same technical means as the above-mentioned Figures 1 to 2 edge detection-based wheat seedling contour counting method described, and can produce the same technical effects, which will not be elaborated here.
[0152] In the embodiments provided by the present invention, it should be understood that the disclosed devices, systems and methods can be implemented in other ways. For example, the system embodiments described above are merely illustrative. For example, the division of the modules is only a logical function division, and there can be other division methods in actual implementation.
[0153] The modules described as separate components may or may not be physically separated, and the components shown as modules may or may not be physical units, that is, they can be located in one place, or distributed to multiple network units. Some or all of the modules can be selected according to actual needs to achieve the purpose of the solution of this embodiment.
[0154] In addition, in each embodiment of the present invention, the functional modules can be integrated in a processing unit, or each unit can exist physically alone, or two or more units can be integrated in one unit. The above-mentioned integrated unit can be implemented in the form of hardware, or in the form of a combination of hardware and software function modules.
[0155] For those skilled in the art, it is obvious that the present invention is not limited to the details of the above-mentioned exemplary embodiments, and can be implemented in other specific forms without departing from the spirit or basic characteristics of the present invention.
[0156] Therefore, from any point of view, the embodiments should be regarded as exemplary and non-restrictive. The scope of the present invention is defined by the appended claims rather than the above description. Therefore, it is intended to cover all changes falling within the meaning and scope of the equivalent elements of the claims in the present invention. Any reference signs attached to the claims should not be regarded as limiting the claimed rights.
[0157] The embodiments of this application can acquire and process relevant data based on artificial intelligence technology. Among them, artificial intelligence (AI) is a theory, method, technology and application system that uses a digital computer or a machine controlled by a digital computer to simulate, extend and expand human intelligence, perceive the environment, acquire knowledge and use knowledge to obtain the best results.
[0158] In addition, it is obvious that the term "comprising" does not exclude other elements or steps, and the singular does not exclude the plural. A plurality of elements or systems stated in the system claims can also be implemented by one element or system through software or hardware. Terms such as first and second are used to denote names and do not denote any particular order.
[0159] Finally, it should be noted that the above embodiments are only used to illustrate the technical solutions of the present invention and not to limit them. Although the present invention has been described in detail with reference to the preferred embodiments, those of ordinary skill in the art should understand that the technical solutions of the present invention can be modified or equivalently replaced without departing from the spirit and scope of the technical solutions of the present invention.
Claims
1. A method for counting the contour of wheat seedlings based on edge detection, characterized in that, The method includes: Obtaining seedling image data and environmental light data of a preset wheat planting area; Calculating the uniformity of wheat seedlings according to the wheat seedling image data; Calculating an adaptive threshold according to the wheat seedling uniformity and the environmental light data; Performing edge detection on the wheat seedling image data based on the adaptive threshold to obtain overlapping edge data; Performing overlapping region fitting on the overlapping edge data to obtain complete edge data; Generating wheat seedling quantity data according to the complete edge data.
2. The method for counting the wheat seedling contours based on edge detection according to claim 1, wherein The calculating the uniformity of wheat seedlings according to the wheat seedling image data includes: Dividing the wheat seedling image data into multiple window image data of the same size to obtain a set of window image data; Extracting the texture feature matrix of each window image data in the set of window image data; Calculating the density coefficient of each window image data according to the texture feature matrix of each window image data; Calculating the uniformity of wheat seedlings according to the density coefficient.
3. The method for counting the wheat seedling contours based on edge detection according to claim 2, wherein The calculating the density coefficient of each window image data according to the texture feature matrix of each window image data includes: Obtaining the RGB channel color values of the window image data; Calculating the mean value of the red channel, the mean value of the green channel, and the mean value of the blue channel according to the RGB channel color values; Obtaining the matrix entropy value of the texture feature matrix; Performing LAB color space conversion on the RGB channel color values to obtain LAB parameters; Calculating the density coefficient according to the texture feature matrix, the RGB channel color values, the mean value of the red channel, the mean value of the green channel, the mean value of the blue channel, the matrix entropy value, and the LAB parameters.
4. The method for counting the wheat seedling contour based on edge detection according to claim 3, wherein The calculation formula of the density coefficient is as follows: Among them, W ρ is the density coefficient, α is a preset first weight parameter, β is a preset second weight parameter, T r is the matrix entropy value, G is the green channel value included in the RGB channel color value, γ is a preset color modulation parameter, ||T c || F is the Frobenius norm of the covariance matrix of the texture feature matrix, is the green channel mean value, is the red channel mean value, is the blue channel mean value, δ is a preset green channel enhancement parameter, ∈ is a preset extremely small number, σ T is the variance of the texture feature matrix, L * is the brightness parameter included in the LAB parameter, a * is the red-green axis color component included in the LAB parameter, b * is the yellow-blue axis color component included in the LAB parameter.
5. The method for counting the wheat seedling contours based on edge detection according to claim 3, wherein The calculation formula of the adaptive threshold is as follows: Among them, H is the adaptive threshold, λ is the preset spectral response fundamental frequency, k is the preset density attenuation coefficient, S is the uniformity of the wheat seedlings, E is the ambient light intensity included in the ambient light data, E o is the preset reference light intensity, a * is the red-green axis color component included in the LAB parameter, b * is the yellow-blue axis color component included in the LAB parameter, σ T is the variance of the texture feature matrix, cosh() is the texture variance hyperbolic function, C is the ambient light color temperature included in the ambient light data, C o is the preset daylight reference color temperature, ∈ is the preset minimum value.
6. The method for counting the wheat seedling contours based on edge detection according to claim 2, characterized in that, The performing edge detection on the wheat seedling image data based on the adaptive threshold to obtain overlapping edge data includes: Calculating the local dynamic threshold of each window image data according to the adaptive threshold and the density coefficient of each window image data in the set of window image data; Calculating the gradient magnitude of each window image data; Performing non-maximum suppression on the gradient magnitude of each window image data to obtain a refined gradient magnitude; Traversing each pixel of each window image data, and marking the pixels with the refined gradient magnitude greater than the local dynamic threshold as edge pixels to obtain the edge data of each window image data; Integrating the edge data of each window image data to obtain overlapping edge data.
7. The method for counting the wheat seedling contours based on edge detection according to claim 1, wherein The performing overlapping region fitting on the overlapping edge data to obtain complete edge data includes: Performing adjacent broken-edge connection on the overlapping edge data through morphological closing operation to obtain connected edge data; Performing edge extension on the connected edge data based on the gradient direction of the connected edge data to obtain extended edge data; Determining the segmentation position according to the edge concave points, the concave point depth, and the concave point included angle in the extended edge data; Separating the overlapping edges in the extended edge data according to the segmentation position to obtain sub-contour data; Performing dynamic fitting based on the edge complexity in the sub-contour data to obtain a fitted edge; Fuse the fitted edge and the extended edge data to obtain complete edge data.
8. The method for counting the wheat seedling outlines based on edge detection according to claim 7, characterized in that, The dynamic fitting based on the edge complexity in the sub - contour data to obtain a fitted edge includes: Obtain the regular - shaped edges and complex - shaped edges in the sub - contour data; Fit the regular - shaped edges using the least - squares ellipse algorithm to obtain regular - fitted edges; Fit the complex - shaped edges using the polygon approximation algorithm to obtain complex - shaped fitted edges; Integrate the regular - fitted edges and the complex - shaped fitted edges to obtain a fitted edge.
9. The method for counting the wheat seedling contour based on edge detection according to claim 1, wherein The generation of wheat - seedling quantity data according to the complete edge data includes: Obtain the area data of all edge contours of the complete edge data; Filter out the invalid edges from the complete edge data according to the area data to obtain filtered edge data; Confirm the wheat - seedling quantity data according to the filtered edge data.
10. A wheat seedling contour counting system based on edge detection, characterized in that, The system includes a data acquisition module, a data calculation module, an edge detection module, an edge fitting module, and a quantity generation module, where: The data acquisition module is used to acquire the wheat - seedling image data and environmental light data of a preset wheat - seedling planting area; The data calculation module is used to calculate the wheat - seedling uniformity according to the wheat - seedling image data, and calculate the adaptive threshold according to the wheat - seedling uniformity and the environmental light data; The edge detection module is used to perform edge detection on the wheat - seedling image data based on the adaptive threshold to obtain overlapping edge data; The edge fitting module is used to fit the overlapping areas of the overlapping edge data to obtain complete edge data; The quantity generation module is used to generate wheat - seedling quantity data according to the complete edge data.