A wheat seedling profile counting method and system based on edge detection
Patent Information
- Application Number
- CN202510399384.7
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2025-04-01
- Publication Date
- 2026-10-23
- Estimated Expiration
- 2045-04-01
AI Technical Summary
[0005]本发明提供一种基于边缘检测的麦苗轮廓计数方法及系统,其主要目的在于解决现有的麦苗计数方法误差较大的问题
[0058]本发明实施例通过获取预设麦苗种植区域的麦苗图像数据以及环境光照数据,根据所述麦苗图像数据计算麦苗均匀度,根据所述麦苗均匀度以及所述环境光照数据计算自适应阈值,基于所述自适应阈值对所述麦苗图像数据进行边缘检测,得到重叠边缘数据,对所述重叠边缘数据进行重叠区域拟合,得到完整边缘数据,根据所述完整边缘数据生成麦苗数量数据。因此本发明提出的基于边缘检测的麦苗轮廓计数方法及系统,可以解决现有的麦苗计数方法误差较大的问题。
Smart Images

Figure CN120339362B_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of computer vision technology, and in particular to a method and system for counting wheat seedling outlines based on edge detection. Background Technology
[0002] In wheat production, accurately determining the number of wheat seedlings is crucial for monitoring plant growth, forecasting yield, and making decisions regarding wheat field management. Traditional methods of counting wheat seedlings rely heavily on manual field surveys, with agricultural technicians counting each plot and row of seedlings. This method is not only extremely inefficient, consuming significant manpower, resources, and time, but also highly susceptible to human error; the results from different personnel may exhibit substantial subjective bias, making it difficult to guarantee the accuracy and objectivity of the data.
[0003] With the development of modern technology, some automated counting techniques have emerged. Early image recognition-based counting methods typically used simple threshold segmentation algorithms to distinguish wheat seedlings from the background. However, the actual farmland environment is complex and variable, with unstable lighting conditions, inconsistent growth and development of wheat seedlings, and severe interference from weeds. These factors make it difficult to accurately extract the contour information of wheat seedlings by relying solely 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 deep learning-based object detection models, these methods often require a large amount of labeled data for model training. The labeling process is not only tedious but also prone to errors. Furthermore, these models have extremely high computational resource requirements, and in actual farmland scenarios, limited hardware conditions make it difficult to achieve real-time, accurate, and efficient wheat seedling outline counting. Summary of the Invention
[0005] This invention provides a method and system for counting wheat seedling outlines based on edge detection, the main purpose of which is to solve the problem of large errors in existing wheat seedling counting methods.
[0006] To achieve the above objectives, the present invention provides a wheat seedling outline counting method based on edge detection, comprising:
[0007] Acquire image data of wheat seedlings and ambient light data for a preset wheat planting area;
[0008] Calculate the uniformity of wheat seedlings based on the wheat seedling image data;
[0009] Calculate the adaptive threshold based on the wheat seedling uniformity and the ambient light data;
[0010] Edge detection is performed on the wheat seedling image data based on the adaptive threshold to obtain overlapping edge data;
[0011] The overlapping edge data is fitted with overlapping regions to obtain complete edge data;
[0012] The number of wheat seedlings is generated based on the complete edge data.
[0013] Optionally, calculating the uniformity of wheat seedlings based on the wheat seedling image data includes:
[0014] The wheat seedling image data is divided 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 window image data set;
[0016] Calculate the density coefficient of each window's image data based on the texture feature matrix of each window's image data;
[0017] The uniformity of wheat seedlings is calculated based on the density coefficient.
[0018] Optionally, calculating the density coefficient of each window image data based on the texture feature matrix of each window image data includes:
[0019] Obtain the RGB channel color values of the window image data;
[0020] The average values of the red, green, and blue channels are calculated based on the RGB channel color values.
[0021] Obtain the matrix entropy value of the texture feature matrix;
[0022] The RGB channel color values are converted to LAB color space to obtain LAB parameters;
[0023] The density coefficient is calculated based on 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 parameter.
[0024] Optionally, the density coefficient is calculated using the following formula:
[0025]
[0026] Among them, W ρ Let be the density coefficient, α be a preset first weighting parameter, β be a preset second weighting parameter, and T be the density coefficient. r Let G be the entropy value of the matrix, G be the green channel value included in the RGB channel color values, γ be a preset color modulation parameter, and ||T be the value of the matrix. c || F Let Frobenius norm be the covariance matrix of the texture feature matrix. The average value of the green channel. The average value of the red channel. The mean of the blue channel is given, δ is the preset green channel enhancement parameter, ∈ is the preset minimum value, and σ is the mean of the blue channel. T Let L be the variance of the texture feature matrix. * a is the brightness parameter included in the LAB parameters. * b represents the red and green axis color components contained in the LAB parameters. * The LAB parameter contains the yellow and blue axis color components.
[0027] Optionally, the adaptive threshold is calculated using the following formula:
[0028]
[0029] Where 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, and E is the ambient light intensity included in the ambient light data. o For the preset reference illumination intensity, a * b represents the red and green axis color components contained in the LAB parameters. * σ represents the yellow-blue axis color component included in the LAB parameters. T Let C be the variance of the texture feature matrix, cosh() be the hyperbolic function of texture variance, and C be the ambient light color temperature contained in the ambient lighting data. o ∈ represents the preset daylight reference color temperature, and ∈ represents the preset minimum value.
[0030] Optionally, the step of performing edge detection on the wheat seedling image data based on the adaptive threshold to obtain overlapping edge data includes:
[0031] The local dynamic threshold of each window image data is calculated based on the adaptive threshold and the density coefficient of each window image data in the window image data set.
[0032] Calculate the gradient magnitude of the image data for each window;
[0033] Non-maximum suppression is applied to the gradient magnitude of each window of image data to obtain a refined gradient magnitude.
[0034] For each pixel of each window image data, the pixels with a thinning gradient magnitude greater than the local dynamic threshold are marked as edge pixels, thus obtaining the edge data of each window image data.
[0035] By integrating the edge data of each window's image data, overlapping edge data is obtained.
[0036] Optionally, the step of fitting the overlapping region of the overlapping edge data to obtain complete edge data includes:
[0037] The overlapping edge data is connected by performing adjacent breakage operations on the morphological closing operation to obtain the connected edge data;
[0038] Based on the gradient direction of the connected edge data, the edge data is extended to obtain extended edge data.
[0039] The segmentation position is determined based on the edge concave points, concave point depths, and concave point angles in the extended edge data.
[0040] Based on the segmentation position, the overlapping edges in the extended edge data are separated to obtain sub-contour data;
[0041] Dynamic fitting is performed based on the edge complexity in the sub-contour data to obtain the fitted edge;
[0042] The fitted edge and the extended edge data are fused to obtain complete edge data.
[0043] Optionally, the step of dynamically fitting the edges based on the edge complexity in the sub-contour data to obtain the fitted edges includes:
[0044] Obtain the regular shape edges and complex shape edges from the sub-contour data;
[0045] The edges of the regular shape are fitted using the least squares elliptic algorithm to obtain the regular fitted edges;
[0046] The edges of the complex shape are fitted using a polygon approximation algorithm to obtain the fitted edges of the complex shape.
[0047] By integrating the fitted edges of the rules and the fitted edges of the complex shapes, a fitted edge is obtained.
[0048] Optionally, generating wheat seedling quantity data based on the complete edge data includes:
[0049] Obtain the area data of all edge contours of the complete edge data;
[0050] Based on the area data, invalid edge filtering is performed on the complete edge data to obtain filtered edge data;
[0051] The number of wheat seedlings was confirmed based on the filtered edge data.
[0052] To address the aforementioned problems, this invention also provides a wheat seedling outline 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, wherein:
[0053] The data acquisition module is used to acquire wheat seedling image data and ambient light data of the preset wheat seedling planting area;
[0054] The data calculation module is used to calculate the uniformity of wheat seedlings based on the wheat seedling image data, and to calculate an adaptive threshold based on the uniformity of wheat seedlings and the ambient 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 region of the overlapping edge data to obtain complete edge data;
[0057] The quantity generation module is used to generate wheat seedling quantity data based on the complete edge data.
[0058] This invention provides a method and system for counting wheat seedlings based on edge detection. The method acquires image data of wheat seedlings in a pre-defined planting area, along with ambient light data. It then calculates the uniformity of the wheat seedlings based on the image data, calculates an adaptive threshold based on the uniformity and the ambient light data, performs edge detection on the image data using the adaptive threshold, obtains overlapping edge data, fits the overlapping regions of the overlapping edge data to obtain complete edge data, and finally generates wheat seedling count data based on the complete edge data. Therefore, this invention solves the problem of large errors in existing wheat seedling counting methods. Attached Figure Description
[0059] Figure 1 This is a flowchart illustrating a wheat seedling outline counting method based on edge detection provided in an embodiment of the present invention.
[0060] Figure 2 This is a functional block diagram of a wheat seedling outline counting system based on edge detection provided in an embodiment of the present invention.
[0061] The realization of the objective, functional features and advantages of the present invention will be further explained in conjunction with the embodiments and with reference to the accompanying drawings. Detailed Implementation
[0062] It should be understood that the specific embodiments described herein are merely illustrative of the invention and are not intended to limit the invention.
[0063] This application provides a wheat seedling outline counting method based on edge detection. The execution entity of the edge detection-based wheat seedling outline counting method includes, but is not limited to, at least one of the following electronic devices that can be configured to execute the method provided in this application: a server, a terminal, etc. In other words, the edge detection-based wheat seedling outline counting method 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. 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 communication, middleware services, domain name services, security services, content delivery networks (CDNs), and big data and artificial intelligence platforms.
[0064] Reference Figure 1 The diagram shown is a flowchart illustrating a wheat seedling outline counting method based on edge detection according to an embodiment of the present invention. In this embodiment, the wheat seedling outline counting method based on edge detection includes:
[0065] S1. Obtain wheat seedling image data and ambient light data for the preset wheat seedling planting area.
[0066] In this embodiment of the invention, a preset camera can be used to acquire wheat seedling image data of a preset wheat seedling planting area.
[0067] Specifically, the wheat seedling image data is an image that uses RGB colors to represent image colors.
[0068] In detail, RGB represents the three color channels: red, green, and blue. In a computer, an image is viewed as a two-dimensional matrix composed of pixels, and each pixel is composed of three color components: red, green, and blue.
[0069] In this embodiment of the invention, the ambient light data includes ambient light intensity and ambient light color temperature.
[0070] Specifically, the ambient light data can be acquired using a light sensor.
[0071] S2. Calculate the uniformity of wheat seedlings based on the wheat seedling image data.
[0072] In this embodiment of the invention, the wheat seedling uniformity is a parameter that represents the uniformity of wheat seedling distribution in a preset wheat seedling planting area.
[0073] In this embodiment of the invention, calculating the uniformity of wheat seedlings based on the wheat seedling image data includes:
[0074] The wheat seedling image data is divided 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 window image data set;
[0076] Calculate the density coefficient of each window's image data based on the texture feature matrix of each window's image data;
[0077] The uniformity of wheat seedlings is calculated based on the density coefficient.
[0078] In this embodiment of the invention, the extraction of the texture feature matrix of each window image data in the window image data set is achieved by converting each window image data to grayscale, then performing filtering and denoising processing, calculating the co-occurrence matrix of the denoised image, and extracting the texture features of the co-occurrence matrix based on contrast.
[0079] In this embodiment of the invention, the density coefficient is a parameter used to represent the density of wheat seedlings within a single window area.
[0080] In this embodiment of the invention, the density coefficient of each window image data is calculated based on the texture feature matrix of each window image data, including:
[0081] Obtain the RGB channel color values of the window image data;
[0082] The average values of the red, green, and blue channels are calculated based on the RGB channel color values.
[0083] Obtain the matrix entropy value of the texture feature matrix;
[0084] The RGB channel color values are converted to LAB color space to obtain LAB parameters;
[0085] The density coefficient is calculated based on 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 parameter.
[0086] In detail, obtaining the matrix entropy value of the texture feature matrix is achieved by normalizing the elements in the matrix and then calculating the matrix entropy value according to the formula for calculating information entropy.
[0087] In detail, the LAB color space conversion of the RGB channel color values to obtain LAB parameters is performed by converting 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] In detail, each color in the XYZ color space is described by three values, X, Y, and Z, which are called tristimulus values. Unlike the primary red, green, and blue colors in the RGB model, the three components of XYZ are virtual, derived through mathematical modeling, and used to optimize the overall human perception of color. For example, X is primarily associated with red, Y is primarily associated with green (and is proportional to brightness), and Z is related to blue. Through the combination of these values, all colors visible to the human eye can be covered.
[0089] In detail, in the LAB color space, L represents the brightness of a color, ranging from 0 to 100. 0 represents black, i.e., no brightness at all; 100 represents white, i.e., 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 a channel value is negative, the color leans towards green; the closer the value is to -128, the higher the saturation of the green. When the a channel value is positive, the color leans towards red; the closer the value is to 127, the higher the saturation of the red. When the a value is 0, it indicates a neutral position between green and red, i.e., no green or red offset; representing the position of the color between blue and yellow. The value of the b channel also ranges from -128 to 127. When the b channel value is negative, the color leans towards blue; the closer the value is to -128, the higher the saturation of the blue. When the b channel value is positive, the color leans towards yellow; the closer the value is to 127, the higher the saturation of the yellow. When the value of b is 0, it indicates that the color is in a neutral position between blue and yellow, that is, there is no blue or yellow offset.
[0090] In detail, the formula for calculating the density coefficient is as follows:
[0091]
[0092] Among them, W ρ Let be the density coefficient, α be a preset first weighting parameter, β be a preset second weighting parameter, and T be the density coefficient. r Let G be the entropy value of the matrix, G be the green channel value included in the RGB channel color values, γ be a preset color modulation parameter, and ||T be the value of the matrix. c || F Let Frobenius norm be the covariance matrix of the texture feature matrix. The average value of the green channel. The average value of the red channel. The mean of the blue channel is given, δ is the preset green channel enhancement parameter, ∈ is the preset minimum value, and σ is the mean of the blue channel. T Let L be the variance of the texture feature matrix. * a is the brightness parameter included in the LAB parameters. *b represents the red and green axis color components contained in the LAB parameters. * The LAB parameter contains the yellow and blue axis color components.
[0093] In this embodiment of the invention, the calculation of wheat seedling uniformity based on the density coefficient is to calculate the standard deviation of the density coefficient of each window image data as the uniformity of the wheat seedlings.
[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] In detail, the Frobenius norm of the covariance matrix can be used to describe the statistical characteristics of image texture. When the Frobenius norm is large, it indicates that the elements (covariance values) in the covariance matrix are generally large, which means that the texture is more complex.
[0096] In this embodiment of the invention, by calculating the uniformity of wheat seedlings based on the wheat seedling image data, the subsequent uniformity is improved.
[0097] S3. Calculate the adaptive threshold based on the uniformity of the wheat seedlings and the ambient light data.
[0098] In this embodiment of the invention, before performing edge detection on the wheat seedling image, a threshold needs to be set for threshold segmentation. Since the penetration ability of sunlight varies at different parts of the wheat seedling, the threshold needs to be set according to the ambient light data.
[0099] In this embodiment of the invention, the formula for calculating the adaptive threshold is as follows:
[0100]
[0101] Where 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, and E is the ambient light intensity included in the ambient light data. o For the preset reference illumination intensity, a * b represents the red and green axis color components contained in the LAB parameters. * σ represents the yellow-blue axis color component included in the LAB parameters. T Let C be the variance of the texture feature matrix, cosh() be the hyperbolic function of texture variance, and C be the ambient light color temperature contained in the ambient lighting data. o ∈ represents the preset daylight reference color temperature, and ∈ represents the preset minimum value.
[0102] Specifically, the preset fundamental frequency of the spectral response can be 0.9.
[0103] Specifically, the density attenuation coefficient can be taken as 1.8.
[0104] In detail, the texture variance hyperbolic function can adjust the threshold sensitivity according to the magnitude of the variance.
[0105] In this embodiment of the invention, by calculating an adaptive threshold based on the uniformity of the wheat seedlings and the ambient light data, the accuracy of subsequent edge detection of the wheat seedling image data can be improved.
[0106] S4. Based on the adaptive threshold, perform edge detection on the wheat seedling image data to obtain overlapping edge data.
[0107] In this embodiment of the invention, the step of performing edge detection on the wheat seedling image data based on the adaptive threshold to obtain overlapping edge data includes:
[0108] The local dynamic threshold of each window image data is calculated based on the adaptive threshold and the density coefficient of each window image data in the window image data set.
[0109] Calculate the gradient magnitude of the image data for each window;
[0110] Non-maximum suppression is applied to the gradient magnitude of each window of image data to obtain a refined gradient magnitude.
[0111] For each pixel of each window image data, the pixels with a thinning gradient magnitude greater than the local dynamic threshold are marked as edge pixels, thus obtaining the edge data of each window image data.
[0112] By integrating the edge data of each window's image data, overlapping edge data is obtained.
[0113] In detail, the gradient magnitude is a measure of how drastic the pixel values in an image change.
[0114] In detail, nonmaximum suppression is a technique widely used in computer vision and image processing. Its main purpose is to remove elements that are not local maxima from among many candidate targets, thereby retaining the elements most likely to be the targets.
[0115] In this embodiment of the invention, edge detection is performed on the wheat seedling image data based on the adaptive threshold to obtain overlapping edge data, thereby improving the efficiency of subsequent overlapping region fitting of the overlapping edge data.
[0116] S5. Fit the overlapping region of the overlapping edge data to obtain complete edge data.
[0117] In this embodiment of the invention, since the wheat seedlings overlap with each other, the extracted edge data also has overlapping areas. Therefore, it is necessary to fit the overlapping areas to make each contour complete and improve the accuracy of wheat seedling counting.
[0118] In this embodiment of the invention, the step of fitting the overlapping region of the overlapping edge data to obtain complete edge data includes:
[0119] The overlapping edge data is connected by performing adjacent breakage operations on the morphological closing operation to obtain the connected edge data;
[0120] Based on the gradient direction of the connected edge data, the edge data is extended to obtain extended edge data.
[0121] The segmentation position is determined based on the edge concave points, concave point depths, and concave point angles in the extended edge data.
[0122] Based on the segmentation position, the overlapping edges in the extended edge data are separated to obtain sub-contour data;
[0123] Dynamic fitting is performed based on the edge complexity in the sub-contour data to obtain the fitted edge;
[0124] The fitted edge and the extended edge data are fused to obtain complete edge data.
[0125] In detail, the step of connecting adjacent broken edges of the overlapping edge data through morphological closing operation is to perform an expansion operation on the overlapping edge data followed by an erosion operation, thereby connecting the small broken edges.
[0126] In detail, the edge extension of the connection edge data based on the gradient direction of the connection edge data is achieved by extending the broken edge along the gradient direction until it intersects with other edges.
[0127] In detail, the step of separating 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] In detail, the step of dynamically fitting the edges based on the edge complexity in the sub-contour data to obtain the fitted edges includes:
[0129] Obtain the regular shape edges and complex shape edges from the sub-contour data;
[0130] The edges of the regular shape are fitted using the least squares elliptic algorithm to obtain the regular fitted edges;
[0131] The edges of the complex shape are fitted using a polygon approximation algorithm to obtain the fitted edges of the complex shape.
[0132] By integrating the fitted edges of the rules and the fitted edges of the complex shapes, a fitted edge is obtained.
[0133] In detail, the edge of the complex shape is fitted using a polygon approximation algorithm. By recursively segmenting the contour curve, the point that deviates furthest from the current approximate line segment is retained, and the original shape is gradually approximated.
[0134] In detail, the regular shape edge may refer to a small arc curve, and the complex shape fitting edge may include bifurcated edges and serrated edges.
[0135] In detail, the least squares ellipse algorithm is used to fit the edge of the regular shape by minimizing the sum of squared distances (sum of squared errors) from the contour points to the fitted ellipse, so that it fits the contour of the regular wheat seedling as closely as possible.
[0136] In detail, the process of fitting the complex shape contour using a polygon approximation algorithm to obtain the fitted edge of the complex shape involves using the Douglas-Peucker algorithm. This algorithm recursively segments the contour curve, retaining the feature points furthest from the current approximate line segment, gradually approximating the original shape. The maximum allowable error threshold is adaptively adjusted based on the complexity of the contour shape; the more complex the shape, the larger the allowable simplification error. High curvature points (such as leaf tips and bifurcation points) are selected using curvature calculations to ensure that key morphological features are preserved. Finally, a polygon composed of ordered vertices is obtained.
[0137] S6. Generate wheat seedling quantity data based on the complete edge data.
[0138] In this embodiment of the invention, generating wheat seedling quantity data based on the complete edge data includes:
[0139] Obtain the area data of all edge contours of the complete edge data;
[0140] Based on the area data, invalid edge filtering is performed on the complete edge data to obtain filtered edge data;
[0141] The number of wheat seedlings was confirmed based on the filtered edge data.
[0142] In this embodiment of the invention, RGB wheat seedling image data of a preset wheat seedling planting area is acquired using a camera, and ambient light data including light intensity and color temperature is acquired using a light sensor. The wheat seedling image is segmented into window images, texture feature matrix is extracted, density coefficient of each window is calculated, and the standard deviation of the density coefficient is used as the wheat seedling uniformity. Combining the wheat seedling uniformity and ambient 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 window density coefficient, a local dynamic threshold is determined, the window gradient magnitude is calculated, and edge pixels are marked after non-maximum suppression refinement. Overlapping edge data is integrated, and morphological closing operation and edge extension are performed on the overlapping edge data to determine the segmentation position and separate the overlapping edges. Dynamic fitting is performed according to the edge complexity, and finally, complete edge data is obtained by fusion. Wheat seedling quantity data is generated based on the effective area of the complete edge data, which can improve the accuracy of wheat seedling counting.
[0143] like Figure 2 The diagram shown is a functional block diagram of a wheat seedling outline counting system based on edge detection provided in an embodiment of the present invention.
[0144] The wheat seedling outline counting system 100 based on edge detection described in this invention can be installed in an electronic device. Depending on the functions implemented, the wheat seedling outline 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 module described in this invention can also be called a unit, which refers to a series of computer program segments that can be executed by the processor of an electronic device and can perform a fixed function, and which 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 used to acquire wheat seedling image data and ambient light data of a preset wheat seedling planting area.
[0147] The data calculation module 102 is used to calculate the uniformity of wheat seedlings based on the wheat seedling image data, and to calculate an adaptive threshold based on the uniformity of wheat seedlings and the ambient light data.
[0148] The edge detection module 103 is used 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 used to fit the overlapping region of the overlapping edge data to obtain complete edge data.
[0150] The quantity generation module 105 is used to generate wheat seedling quantity data based on the complete edge data.
[0151] In detail, the modules in the wheat seedling outline counting system 100 based on edge detection described in this embodiment of the invention employ the same methods as described above. Figures 1 to 2 The method used is the same as the edge detection-based wheat seedling outline counting method described above, and can produce the same technical effect, so it will not be repeated here.
[0152] In the embodiments provided by this 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 instance, the division of modules is only a logical functional division, and other division methods may be used in actual implementation.
[0153] The modules described as separate components may or may not be physically separate. The components shown as modules may or may not be physical units; that is, they may be located in one place or distributed across multiple network units. Some or all of the modules can be selected to achieve the purpose of this embodiment according to actual needs.
[0154] Furthermore, the functional modules in the various embodiments of the present invention can be integrated into one processing unit, or each unit can exist physically separately, or two or more units can be integrated into one unit. The integrated unit can be implemented in hardware or in the form of hardware plus software functional modules.
[0155] It will be apparent to those skilled in the art that the present invention is not limited to the details of the exemplary embodiments described above, and that the present invention can be implemented in other specific forms without departing from the spirit or essential characteristics of the present invention.
[0156] Therefore, the embodiments should be considered exemplary and non-limiting in all respects, and the scope of the invention is defined by the appended claims rather than the foregoing description. Thus, all variations falling within the meaning and scope of equivalents of the claims are intended to be embraced within the invention. No appended diagram markings in the claims should be construed as limiting the scope of the claims.
[0157] The embodiments of this application can acquire and process relevant data based on artificial intelligence technology. Artificial intelligence (AI) refers to the theories, methods, technologies, and application systems that use digital computers or machines controlled by digital computers to simulate, extend, and expand human intelligence, perceive the environment, acquire knowledge, and use that knowledge to obtain optimal results.
[0158] Furthermore, it is clear that the word "comprising" does not exclude other units or steps, and the singular does not exclude the plural. Multiple units or systems stated in a system claim may also be implemented by a single unit or system through software or hardware. The terms "first," "second," etc., are used to indicate names and do not indicate any specific order.
[0159] Finally, it should be noted that the above embodiments are only used to illustrate the technical solutions of the present invention and are not intended to limit it. Although the present invention has been described in detail with reference to preferred embodiments, those skilled in the art should understand that modifications or equivalent substitutions can be made to the technical solutions of the present invention without departing from the spirit and scope of the technical solutions of the present invention.
Claims
1. A method for counting wheat seedling outlines based on edge detection, characterized in that, The method includes: Acquire image data of wheat seedlings and ambient light data for the preset wheat seedling planting area; Calculate the uniformity of wheat seedlings based on the wheat seedling image data; An adaptive threshold is calculated based on the wheat seedling uniformity and the ambient light data, wherein the formula for calculating the adaptive threshold is as follows: ; in, The adaptive threshold, The preset spectral response fundamental frequency, The preset density attenuation coefficient, The uniformity of the wheat seedlings. The ambient light intensity included in the ambient light data. The preset reference light intensity, The red and green axis color components included in the LAB parameter. The yellow and blue axis color components included in the LAB parameters. The brightness parameters included in the LAB parameters. The variance of the texture feature matrix. The texture variance hyperbolic function, The ambient light color temperature included in the ambient lighting data. The preset daylight reference color temperature, This is the preset minimum value; Edge detection is performed on the wheat seedling image data based on the adaptive threshold to obtain overlapping edge data; The overlapping edge data is fitted with overlapping regions to obtain complete edge data; The number of wheat seedlings is generated based on the complete edge data.
2. The wheat seedling outline counting method based on edge detection as described in claim 1, characterized in that, The step of calculating the uniformity of wheat seedlings based on the wheat seedling image data includes: The wheat seedling image data is divided into multiple window image data of the same size to obtain a set of window image data; Extract the texture feature matrix of each window image data in the window image data set; Calculate the density coefficient of the image data for each window based on the texture feature matrix of each window; The uniformity of wheat seedlings is calculated based on the density coefficient.
3. The wheat seedling outline counting method based on edge detection as described in claim 2, characterized in that, The step of calculating the density coefficient of each window's image data based on the texture feature matrix of each window includes: Obtain the RGB channel color values of the window image data; The average values of the red, green, and blue channels are calculated based on the RGB channel color values. Obtain the matrix entropy value of the texture feature matrix; The RGB channel color values are converted to LAB color space to obtain LAB parameters; The density coefficient is calculated based on 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 parameter.
4. The wheat seedling outline counting method based on edge detection as described in claim 3, characterized in that, The formula for calculating the density coefficient is as follows: ; in, The density coefficient, The first weight parameter is preset. The second weight parameter is preset. The entropy value of the matrix is... The green channel value is included in the RGB channel color values. These are the preset color modulation parameters. Let Frobenius norm be the covariance matrix of the texture feature matrix. The average value of the green channel. The average value of the red channel. The mean of the blue channel. The preset green channel enhancement parameters, For a preset minimum number, The variance of the texture feature matrix is... The brightness parameters included in the LAB parameters. The red and green axis color components included in the LAB parameters. The LAB parameter contains the yellow and blue axis color components.
5. The wheat seedling outline counting method based on edge detection as described in claim 2, characterized in that, The step of performing edge detection on the wheat seedling image data based on the adaptive threshold to obtain overlapping edge data includes: The local dynamic threshold of each window data is calculated based on the adaptive threshold and the density coefficient of each window data in the window image data set. Calculate the gradient magnitude for each window of data; Non-maximum suppression is applied to the gradient magnitude of each window of data to obtain a refined gradient magnitude. For each pixel of each window data, the pixels with a thinning gradient magnitude greater than the local dynamic threshold are marked as edge pixels, thus obtaining the edge data of each window data. By integrating the edge data of each window, we obtain overlapping edge data.
6. The wheat seedling outline counting method based on edge detection as described in claim 1, characterized in that, The process of fitting the overlapping region of the overlapping edge data to obtain complete edge data includes: The overlapping edge data is connected by performing adjacent breakage connection operations on the morphological closing operation to obtain the connected edge data; Based on the gradient direction of the connected edge data, the edge data is extended to obtain extended edge data. The segmentation position is determined based on the edge concave points, concave point depths, and concave point angles in the extended edge data. Based on the segmentation position, the overlapping edges in the extended edge data are separated to obtain sub-contour data; Dynamic fitting is performed based on the edge complexity in the sub-contour data to obtain the fitted contour; The fitted edge and the extended edge data are fused to obtain complete edge data.
7. The wheat seedling outline counting method based on edge detection as described in claim 6, characterized in that, The dynamic fitting based on the edge complexity in the sub-contour data to obtain the fitted edge includes: Obtain the regular shape edges and complex shape edges from the sub-contour data; The edges of the regular shape are fitted using the least squares elliptic algorithm to obtain the regular fitted edges; The edges of the complex shape are fitted using a polygon approximation algorithm to obtain the fitted edges of the complex shape. By integrating the fitted edges of the rules and the fitted edges of the complex shapes, a fitted edge is obtained.
8. The wheat seedling outline counting method based on edge detection as described in claim 1, characterized in that, The step of generating wheat seedling quantity data based on the complete edge data includes: Obtain the area data of all edge contours of the complete edge data; Based on the area data, invalid edge filtering is performed on the complete edge data to obtain filtered edge data; The number of wheat seedlings was confirmed based on the filtered edge data.
9. A wheat seedling outline counting system based on edge detection, characterized in that, The system includes: The data acquisition module is used to acquire image data of wheat seedlings and ambient light data of the preset wheat seedling planting area; The data calculation module is used to calculate the uniformity of wheat seedlings based on the wheat seedling image data, and to calculate an adaptive threshold based on the wheat seedling uniformity and the ambient light data. The formula for calculating the adaptive threshold is as follows: ; in, The adaptive threshold, The preset spectral response fundamental frequency, The preset density attenuation coefficient, The uniformity of the wheat seedlings. The ambient light intensity included in the ambient light data. The preset reference light intensity, The red and green axis color components included in the LAB parameter. The yellow and blue axis color components included in the LAB parameters. The brightness parameters included in the LAB parameters. The variance of the texture feature matrix. Let be the hyperbolic function of texture variance. The ambient light color temperature included in the ambient lighting data. The preset daylight reference color temperature, This is the preset minimum value; 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; An edge fitting module is used to fit the overlapping region of the overlapping edge data to obtain complete edge data. The quantity generation module is used to generate wheat seedling quantity data based on the complete edge data.
Citation Information
Patent Citations
A fast counting method of wheat basic seedlings based on machine vision and graphics processing
CN109447945A
Whole ear image processing method and device
CN115439334A