Plant leaf included angle measuring method and device
By generating depth maps and performing normalization and feature fusion processing, combined with clustering and filtering techniques, the problems of high resource consumption and light interference in traditional methods are solved, and high-precision blade angle measurement is achieved.
Patent Information
- Application Number
- CN202511495487.X
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-10-20
- Publication Date
- 2025-11-18
- Estimated Expiration
- 2045-10-20
AI Technical Summary
Traditional methods for measuring the angle between plant leaves suffer from problems such as high training data requirements, high resource consumption, and inaccurate segmentation under complex lighting conditions.
Depth maps are generated from plant images and normalized. They are then fused with depth gradient features, and anisotropic expansion and skeleton extraction are performed using clustering and guided filtering. The main stem line and lateral lines are fitted to determine the leaf angle.
It enables high-precision measurement of leaf angles in plants at different growth stages, improving the practicality and adaptability of the measurement, reducing noise interference, and enhancing the accuracy of the measurement.
Smart Images

Figure CN120976040A_ABST
Abstract
Description
TECHNICAL FIELD
[0001] The present application relates to the technical field of image processing, in particular to a plant leaf angle measurement method and device. BACKGROUND
[0002] In plant phenotype research, accurate measurement of leaf angle is crucial for analyzing plant morphology and photosynthetic efficiency. The traditional method mainly uses a segmentation model trained by deep learning or extracts a branch mask using color, and determines the angle of the leaf relative to the trunk according to the branch mask.
[0003] However, the traditional method of determining the leaf angle has limitations in practical application: first, deep learning requires a large amount of labeled training data, takes a long time to train, and consumes a lot of resources; second, the traditional color extraction method is not accurate in the face of complex lighting and background interference, resulting in inaccurate determination of the leaf angle. SUMMARY
[0004] Therefore, the purpose of the present application is to provide a plant leaf angle measurement method and device to solve or partially solve the above technical problems.
[0005] To achieve the above purpose, the present application provides a plant leaf angle measurement method, comprising: obtaining a plant image, generating a corresponding depth map according to the plant image, performing normalization processing on the depth map to obtain a normalized depth map, performing normalization on the plant image to obtain a normalized plant image, and determining a depth gradient feature according to the normalized depth map; fusing the normalized depth map, the normalized plant image, and the depth gradient feature to obtain fusion feature space data; performing clustering processing on the fusion feature space data, separating out a foreground clustering group based on the result of the clustering processing, and obtaining an initial mask according to the foreground clustering group; using the normalized depth map as a guide image, performing guided filtering processing on the initial mask to obtain a filtered image; performing anisotropic expansion processing on the filtered image according to the gradient direction corresponding to the depth gradient feature to obtain a smoothed image; extracting a skeleton based on the smoothed image to obtain a skeleton structure; determining a main branch and a side branch according to the skeleton structure; performing straight line fitting on the main branch to obtain a main straight line, and performing straight line fitting on the side branch to obtain a side straight line; determining the angle between the main straight line and the side straight line to obtain a leaf angle result and outputting the leaf angle result.
[0006] Based on the same inventive concept, the application further provides an electronic device comprising a memory, a processor, and a computer program stored in the memory and executable by the processor, wherein the processor implements the method as described above when executing the computer program.
[0007] As can be seen from the above, the plant leaf angle measurement method and device provided by the application can generate a corresponding depth map according to the obtained plant image, and normalize the depth map and the plant image, so that the data can be unified, the consistency of the data is improved, and the depth gradient feature is determined according to the normalized depth map. In this way, the normalized depth map, the normalized plant image and the depth gradient feature are fused to obtain fusion feature space data, so as to ensure that the fusion feature space data has data in each dimension. Then, clustering is performed based on the fusion feature space data, so that the initial mask determined by the foreground cluster group of the clustering is more accurate. Then, the initial mask is filtered according to the normalized depth map as a guide, the main edge feature is retained, the noise is reduced, and the filtered image is anisotropically diffused according to the gradient direction corresponding to the depth gradient feature, so that the image is smoother, and a smoothed image is obtained. Then, the main stem branch and the side branch are determined after skeleton extraction of the smoothed image, and the main straight line and the side straight line are obtained through linear fitting, and the angle between the main straight line and the side straight line is taken as the leaf angle. This way of determining the leaf angle can be applied to plants in various growth stages, and has high practicability and adaptability. BRIEF DESCRIPTION OF DRAWINGS
[0008] In order to more clearly illustrate the technical solutions in the application or the related art, the following will briefly introduce the drawings needed to be used in the embodiments or related art descriptions. Obviously, the drawings in the following description are only embodiments of the application, and other drawings can also be obtained by those skilled in the art without creative labor.
[0009] Figure 1 The flowchart of the plant leaf angle measurement method of the embodiments of the application; Figure 2 The schematic diagram of the plant image of the embodiments of the application; Figure 3 The schematic diagram of the depth map of the embodiments of the application; Figure 4 The schematic diagram of the initial mask of the embodiments of the application; Figure 5 The schematic diagram of each branch in the skeleton structure of the embodiments of the application; Figure 6 The schematic diagram of the main stem branch and the side branch after optimization of the branches of the embodiments of the application; Figure 7 A schematic diagram of a leaf angle result of an embodiment of the present application; Figure 8 A structural block diagram of a plant leaf angle measurement device of an embodiment of the present application; Figure 9 A structural schematic diagram of an electronic device of an embodiment of the present application. DETAILED DESCRIPTION
[0010] To make the objectives, technical solutions and advantages of the present application clearer, further detailed description will be made to the present application with reference to specific embodiments and the accompanying drawings.
[0011] It should be noted that, unless otherwise defined, the technical terms or scientific terms used in the embodiments of the present application should be understood as the common meanings thereof by those skilled in the art to which the present application belongs. The terms “first”, “second” and similar terms used in the embodiments of the present application do not represent any order, number or importance, but are only used to distinguish different components. The terms “include” or “contain” and similar terms mean that the components or objects before the terms cover the components or objects listed after the terms and their equivalents, without excluding other components or objects. The terms “connect” or “connected” and similar terms do not mean physical or mechanical connection, but can include electrical connection, whether direct or indirect. The terms “up”, “down”, “left”, “right” and the like only represent relative positional relationships, which can change accordingly when the absolute positions of the described objects change.
[0012] The embodiments of the present application will be described in detail below with reference to the accompanying drawings.
[0013] The plant leaf angle measurement method proposed in the embodiments of the present application, as shown in Figure 1 , includes: Step 101, obtaining a plant image (as shown in Figure 2 ), generating a corresponding depth map (as shown in Figure 3 ) according to the plant image, performing normalization processing on the depth map to obtain a normalized depth map, performing normalization on the plant image to obtain a normalized plant image, and determining a depth gradient according to the normalized depth map to obtain a depth gradient feature.
[0014] In specific implementation, a high-resolution RGB camera is used to shoot a front view image containing plant (for example, crops, preferably corn, wheat, rice, etc.) stems and leaves or ear leaves, and an RGB image containing plant color information is obtained as a plant image (for example, ). The color information of the plant image is crucial for subsequent feature fusion and segmentation, because it can help to distinguish different plant tissues (such as leaves, stems, ears, etc.).
[0015] Depth Anything from RGB images using a pre-trained monocular depth estimation model. The depth map provides depth information for each pixel in three-dimensional space, which is crucial for distinguishing foreground and background and maintaining the morphological integrity of leaves.
[0016] Formula: ; where, is the input RGB image, f is a pre-trained monocular depth estimation model, is the image position corresponding depth value.
[0017] The generated depth map is normalized to unify the depth value range to [0, 1] for subsequent feature fusion and segmentation processing. It also helps to improve the robustness and consistency of the algorithm.
[0018] Formula: ; where, and are the minimum and maximum values in the depth map
[0019] Plant image (RGB image) normalization: Normalize the three color channels (red, green, blue) of the plant image respectively, and unify the pixel value range of each channel to [0, 1].
[0020] Formula: ; where, C represents the pixel in the R (red), G (green), B (blue) channel of the plant image, and are the minimum and maximum values in the channel.
[0021] Depth gradient calculation: Calculate the gradient amplitude of the normalized depth map using the Sobel operator.
[0022] Formula: ; where, and are the gradients of the depth map in the x and y directions.
[0023] Step 102, fuse the normalized depth map, the normalized plant image and the depth gradient feature to obtain the fusion feature space data.
[0024] In specific implementation, the normalized depth map is one-dimensional data, the normalized plant images corresponding to red, green and blue are three-dimensional data, and the depth gradient feature is one-dimensional data. Therefore, the fusion feature space data obtained after fusion is five-dimensional data.
[0025] Fusion feature space data The formula is: ; Wherein, is a normalized depth map, is a red channel R corresponding image in a normalized plant image, is a green channel G corresponding image in a normalized plant image, is a blue channel B corresponding image in a normalized plant image, is a depth gradient feature.
[0026] The depth gradient feature reflects the rate of depth change and helps to retain edge information. The normalized plant image provides rich visual features and can distinguish different colored crop parts, thereby enhancing the robustness of segmentation.
[0027] In step 103, the fusion feature space data is clustered, and a foreground cluster group is separated based on the clustering result. An initial mask is obtained according to the foreground cluster group (as shown in FIG. 1C). Figure 4
[0028] In specific implementation, the corresponding clustering mode includes K-means clustering. In the clustering process, because depth is more critical for distinguishing foreground and background, the clustering weight of the normalized depth map in the fusion feature space data is set to be the maximum, i.e., greater than the clustering weights of the depth gradient feature and the normalized plant image. After weighted clustering, the foreground cluster group and the background cluster group can be accurately separated.
[0029] Then, the foreground cluster group is segmented and extracted as an initial mask.
[0030] In step 104, the normalized depth map is used as a guide image to perform guided filtering on the initial mask to obtain a filtered image.
[0031] In specific implementation, in order to avoid the influence of some noise and discontinuous edges in the initial mask image, the initial mask is subjected to depth-guided filtering using the normalized depth map to obtain a filtered image. The main edge features are retained and the noise is reduced.
[0032] In step 105, the filtered image is subjected to anisotropic expansion processing according to the gradient direction corresponding to the depth gradient feature to obtain a smoothed image.
[0033] In implementation, in order to avoid the damage of isotropic processing to the blade topology structure in the filtered image, anisotropic expansion processing is performed on the filtered image according to the gradient direction corresponding to the depth gradient feature, selective smoothing processing is performed, and a more easily recognizable smoothed image is obtained.
[0034] In step 106, skeleton extraction is performed based on the smoothed image to obtain a skeleton structure (as shown in FIG. 6). Figure 5
[0035] In step 107, main stem branches and side branches are determined according to the skeleton structure (as shown in FIG. 7). Figure 6
[0036] In implementation, the branch value of each branch is determined, the main stem branches are filtered by using the branch value, the pseudo branches are proposed from the main stem branches by using a non-recursive manner, and the side branches are obtained.
[0037] In step 108, a main stem straight line is obtained by performing straight line fitting on the main stem branches, and a side straight line is obtained by performing straight line fitting on the side branches.
[0038] In step 109, an included angle between the main stem straight line and the side straight line is determined to obtain a blade included angle result (as shown in FIG. 8) and output. Figure 7
[0039] In implementation, since the obtained main stem branches and side branches are not straight lines, in order to better perform the blade included angle, the obtained main stem branches and side branches are respectively subjected to straight line fitting (for example, RANSAC straight line fitting algorithm), and then the main stem straight line and the side straight line are obtained. Then, the main stem straight line and the side straight line are projected into a two-dimensional plane (for example, a predetermined vertical plane) to obtain a main stem projection and a side projection. In this way, the included angle corresponding to the main stem projection and the side projection can be accurately calculated as the blade included angle.
[0040] By the above scheme, the corresponding depth map can be generated according to the obtained plant image, and the depth map and the plant image are both normalized, so that the data can be unified, the consistency of the data is improved, and the depth gradient feature is determined according to the normalized depth map, so that the normalized depth map, the normalized plant image and the depth gradient feature are fused to obtain the fusion feature space data, so that the fusion feature space data has data of each dimension; then, clustering is performed based on the fusion feature space data, so that the initial mask determined by the foreground cluster group of the clustering is more accurate; then, the initial mask is filtered according to the normalized depth map as a guide, the main edge feature is retained, the noise is reduced, and the filtered image is anisotropically diffused according to the gradient direction corresponding to the depth gradient feature, so that the image is smoother, and a smoothed image is obtained; then, the main stem branch and the side branch are determined after skeleton extraction of the smoothed image, the main straight line and the side straight line are obtained through linear fitting, and the included angle between the main straight line and the side straight line is taken as the leaf angle. This way of determining the leaf angle can be applied to plants at various growth stages, and has high practicability and adaptability.
[0041] In some embodiments, each fusion feature in the fusion feature space data includes: a depth value corresponding to the normalized depth map, a pixel value corresponding to the normalized plant image, and a depth gradient value corresponding to the depth gradient feature.
[0042] Step 103 includes: Step 1031, determining a plurality of cluster centers based on the fusion feature space data.
[0043] In specific implementation, k cluster centers are randomly selected at the beginning, and these cluster centers can be feature vectors of randomly selected pixel points in the fusion feature space data.
[0044] Step 1032, determining a first weight value corresponding to the depth value , a second weight value corresponding to the pixel value , and a third weight value corresponding to the depth gradient value , wherein the first weight value is greater than the second weight value , and greater than the third weight value .
[0045] Step 1033, for each fusion feature in the fusion feature space data, determining a weighted distance between the fusion feature and each cluster center according to the first weight value, the second weight value and the third weight value.
[0046] In specific implementation, the calculation formula of the weighted distance is: = ; wherein i represents the i-th pixel point in the data point corresponding to the fusion feature to be clustered, j is the j-th cluster center, is the fusion feature corresponding to the i-th pixel point, is the value of the fusion feature corresponding to the i-th pixel point on the color channel k, k belongs to the red channel R, the green channel G and the blue channel B, is the value of the j-th cluster center on the color channel k, is the depth gradient value corresponding to the i-th pixel point, is the depth gradient value corresponding to the j-th cluster center.
[0047] Step 1034, according to the weighted distance, the fusion feature is assigned to the grouping of the cluster center with the minimum weighted distance, and the cluster center is re-determined based on the grouping result for clustering until the cluster center no longer changes, and a plurality of cluster groupings are obtained.
[0048] In specific implementation, for the fusion feature corresponding to each pixel point , the weighted distance corresponding to each cluster center is calculated to obtain , and the fusion feature corresponding to the pixel point is assigned to the cluster center corresponding to the minimum weighted distance.
[0049] After the fusion features corresponding to all pixel points in the fusion feature space data are assigned, the cluster center is updated, and the formula for updating is: wherein is the set of fusion features corresponding to all pixel points assigned to the j-th cluster center, is the number of data contained in the set .
[0050] Through the iterative clustering process of continuously re-determining the cluster center, the clustering is stopped until the cluster center no longer changes or the iteration number reaches the preset iteration threshold, and the final plurality of cluster groupings are obtained.
[0051] Step 1035, a foreground cluster group meeting the foreground part is selected from the plurality of cluster groupings, and an initial mask is generated according to the foreground cluster group.
[0052] In specific implementation, one cluster grouping (or a plurality of cluster groupings) with the minimum depth value is taken as the foreground cluster group, and the remaining cluster groupings are taken as background cluster groupings.
[0053] The initial mask is determined by using a binaryzation manner for the foreground cluster group The corresponding formula is: ; wherein, is the foreground cluster group.
[0054] Wherein, 1 represents that the pixel value is white, and 0 represents that the pixel value is black, so that the initial mask obtained is a mask image in which the foreground part is white and the background part is black.
[0055] Through the above scheme, the morphological continuity of the leaf can be better maintained due to the higher weight corresponding to the depth value in the process of clustering processing, the defects of isotropic processing are avoided, the foreground cluster group is accurately separated, and a more accurate initial mask is obtained.
[0056] In some embodiments, step 104 includes: Step 1041, taking the normalized depth map as a guide image , determining that the guide image corresponding to the pixel position p is .
[0057] Step 1042, determining the local window corresponding to the pixel position q.
[0058] Step 1043, performing minimization processing on the target function to determine the first coefficient and the second coefficient , wherein the target function is: , wherein, is the initial mask corresponding to the pixel position p, is a regularization coefficient.
[0059] Step 1044, determining the filtered image based on the filtering formula corresponding to the first coefficient and the second coefficient , wherein the filtering formula is: , wherein, is the filtered image corresponding to the pixel position p.
[0060] Through the above scheme, in order to avoid the influence of some noise and discontinuous edges in the initial mask image, the initial mask is subjected to depth-guided filtering processing using the normalized depth map to obtain a filtered image, main edge features are retained, and noise is reduced.
[0061] In some embodiments, step 105 includes: Step 1051, determining the time evolution image I at the current time, wherein the time evolution image at the initial time is the filtered image .
[0062] Step 1052, determining gradient amplitude according to the depth gradient feature corresponding to the time evolution image I of the current moment .
[0063] Step 1053, determining edge stopping function according to the gradient amplitude . The corresponding calculation formula is: Wherein, is the diffusion intensity coefficient.
[0064] Step 1054, determining partial differential function based on the edge stopping function The formula is: Wherein, t is time.
[0065] Step 1055, according to the gradient amplitude corresponding to each direction in the time evolution image I of the current moment , the partial differential function is expanded by using finite difference method, and the time evolution image of the next moment is determined, and the anisotropic expansion processing of the time evolution image of the current moment is completed.
[0066] In specific implementation, for the initial moment, the filtered image The corresponding gradient amplitude is . Take as I, and take as Substitute the formula , and the edge stopping function value is obtained.
[0067] Then the partial differential function is expanded by using finite difference method, and the time evolution image of the next moment is determined based on , so that the anisotropic expansion processing of the time evolution image of the current moment is completed.
[0068] In some embodiments, step 1055 comprises: Step 10551, determining the time evolution image of the current moment n .
[0069] Step 10552, determining the first direction gradient amplitude , the formula is: Wherein, i and j are the horizontal coordinate and vertical coordinate of the time evolution image of the current moment n respectively , and the direction diffusion coefficient corresponding to the first direction is determined.
[0070] Step 10553, determining the second direction gradient amplitude , the formula is: , and determining the directional diffusion coefficient corresponding to the second direction .
[0071] Step 10554, determining the gradient amplitude of the third direction , the formula is: , and determining the directional diffusion coefficient corresponding to the third direction .
[0072] Step 10555, determining the gradient amplitude of the fourth direction , the formula is: , and determining the directional diffusion coefficient corresponding to the fourth direction .
[0073] Step 10556, obtaining the time step , using the finite difference method to expand the partial differential function, determining the time evolution image of the next time n+1 , the corresponding formula is: .
[0074] Wherein, the first direction, the second direction, the third direction and the fourth direction refer to the corresponding two-dimensional geographical direction, for example, the first direction is north (N), the second direction is south (S), the third direction is east (E), and the fourth direction is west (W). The first direction, the second direction, the third direction and the fourth direction can also be other allocation mode, specific allocation setting according to actual need.
[0075] Through the above scheme, accurate anisotropic diffusion can be performed, and damage to the leaf topological structure caused by isotropic processing can be effectively avoided.
[0076] Step 1056, iterating the process of the anisotropic expansion processing in time sequence until the iteration end condition is met, and determining the time evolution image of the last time as the optimized image.
[0077] Then, using the time evolution image of the next time as the time evolution image of the current time, iterating the process according to the above steps 1051 to 1055 until the time evolution image of the end time converges, or the iteration number reaches the preset iteration number, and ending the process of anisotropic expansion processing. The time evolution image of the last time (end time) is taken as the optimized image .
[0078] Step 1057, performing binaryzation processing on the optimized image to obtain the smoothed image.
[0079] In specific implementation, the optimized image Conducting a binary conversion to obtain a smoothed image .
[0080] Through the above scheme, the depth gradient information helps to retain the edge information, so that the edges of the main stem and the leaf / ear are clearer, and the anisotropic diffusion can keep the morphological continuity of the leaves, avoiding the defects of isotropic processing.
[0081] In some embodiments, step 106 includes: Step 1061, processing the smoothed image using a skeletonization algorithm to obtain an initial skeleton graph.
[0082] Among them, the nodes in the initial skeleton graph include branch points, end points and intermediate points.
[0083] The branch point is a pixel point with multiple adjacent pixel points (for example, more than two adjacent pixel points), which is the starting point or branching point of the skeleton branch.
[0084] The end point is a pixel point with only one adjacent pixel point, indicating the termination position of the skeleton.
[0085] The intermediate point is a skeleton pixel point other than the branch point and the end point.
[0086] Among them, the initial skeleton graph is obtained by skeleton extraction using the Zhang-Suen skeleton algorithm.
[0087] Step 1062, determine the depth value corresponding to each pixel point in the initial skeleton graph as the skeleton depth value.
[0088] Step 1063, according to the comparison of the skeleton depth value and the depth threshold, the initial skeleton graph is binarized to obtain a binary skeleton structure.
[0089] In specific implementation, since the initial skeleton graph obtained by skeleton extraction using the Zhang-Suen skeleton algorithm may mistakenly consider background noise or unimportant small structures as part of the foreground, some pseudo-branches will be generated. In order to improve the accuracy and robustness of skeleton extraction, depth constraint condition is introduced, and depth value is used to screen the pixel points participating in skeletonization, so that only the pixel points with significant depth value (i.e. the pixel points with skeleton depth value greater than the depth threshold) are considered, thereby removing the noise with insignificant depth information, and accurately binarizing to obtain a binary skeleton structure.
[0090] Among them, the median depth value is determined , and the specific determination formula is: ; wherein median is the function of taking the median value, is the pixel point ( x, yThe depth value of ) The x-axis is x The set of depth values of pixels.
[0091] Determine the depth threshold as , where a is the threshold coefficient.
[0092] Corresponding binary skeleton structure The formula is: .
[0093] Step 1064: Remove the pixels in the binarized skeleton structure whose skeleton depth value is less than the depth threshold to obtain the skeleton structure.
[0094] By introducing depth constraints through the above scheme, noise with insignificant depth values can be effectively removed, the main foreground parts can be preserved, the accuracy and robustness of skeleton extraction can be improved, high-quality input can be provided for subsequent processing, and the reliability of the final result can be ensured.
[0095] In some embodiments, step 107 includes: Step 1071: Determine the branch structure of the skeleton structure.
[0096] In practice, all initial branches are determined for the skeleton structure, and adjacent initial branches are combined to form a branch structure.
[0097] Step 1072, for each branch structure branch Determine the sum of distances between all pixels in the branch structure, which serves as the physical length of the branch structure. .
[0098] In practice, Where p represents a branch office. branch pixels, For branch offices branch In and pixel p Adjacent pixels, Adjacent pixels p and The Euclidean distance between them.
[0099] Step 1073: For each branch structure, determine the local curvature of each pixel in the branch structure, and determine the average value of the local curvature of all pixels in the branch structure as the curvature of the branch structure.
[0100] In practice, this applies to branch offices. branch pixels pThe local curvature corresponding to the pixel point p is calculated according to the coordinates (x, y) of the pixel point p by using the difference method, and the specific formula is as follows: wherein, is the local curvature, and is the first-order derivative of x and y, and is the second-order derivative of x and y.
[0101] Then, the average value of the local curvatures of all pixel points in the branch structure is calculated, and the formula is as follows: branch wherein, N is the total number of pixel points in the branch structure. wherein, N is the total number of pixel points in the branch structure. branch
[0102] In step 1074, for each branch structure, the weighted physical length of the branch structure is obtained by multiplying the physical length of the branch structure by a first weight coefficient, the weighted curvature of the branch structure is obtained by multiplying the curvature of the branch structure by a second weight coefficient, and the branch value is obtained by subtracting the weighted curvature from the weighted physical length.
[0103] In specific implementation, the calculation formula of the branch value is as follows: wherein, is the first weight coefficient, is the second weight coefficient.
[0104] In step 1075, the branch structure with the largest branch value is taken as the main branch.
[0105] In specific implementation, since the main branch generally has high connectivity, it is the key path of other branch structures, and the main branch is generally relatively straight and has small curvature.
[0106] Therefore, the branch values of the branch structures are combined to form a candidate set, each branch value of each branch structure in the candidate set is traversed, and the branch structure with the largest branch value is selected as the main branch.
[0107] In step 1076, the branch structures other than the main branch are taken as other branch structures, each other branch structure is traversed from the end of the main branch as the starting point, and the other branch structure with the largest branch value is taken as the side branch.
[0108] In practice, during skeleton extraction, especially when processing branch points, many pseudo-branches exist due to noise or small structures. These pseudo-branches are often meaningless in practical applications and can affect subsequent operations such as blade angle calculation, so they need to be removed. To achieve this, starting from the end point of the main branch, a non-recursive method is used to traverse the adjacent pixels of the end point to identify the branch points of the main branch. For each identified branch point, the branch value of the branch structure to which that branch point belongs is obtained. And the branch structure and branch values are then linked. Store in the candidate branch set.
[0109] In the candidate branch set, based on the branch value Filter by value size. Select branch value. The largest branch is treated as a side branch, preserving its topological integrity. For other branch structures, if their branch values... If the branch value is less than the branch threshold, it is considered a pseudo-branch and is removed.
[0110] The above scheme allows for the selection of main branches and side branches based on the branch values corresponding to each branch structure in the skeleton structure, resulting in more accurate main branches and side branches, and thus more accurate angle determination.
[0111] In some embodiments, step 108, which involves performing linear fitting on the main branches to obtain the main straight line, includes: Step A1: Select any two main sample points from the main branches as the main sample group, and select multiple main sample groups.
[0112] Among them, the two main sample points are any two pixels in the main branch. and Random selection can reduce the impact of noise and outliers.
[0113] Step A2: For each backbone sample group, based on the two backbone sample points in the backbone sample group, determine the initial backbone line corresponding to the backbone sample group, determine the first vertical distance between each pixel point in the backbone branch and the initial backbone line, and count the number of first pixels in the backbone branch whose first vertical distance is less than the distance threshold.
[0114] In practice, two main sample points were determined. and Corresponding direction vector The initial main line is obtained by fitting a line using the least squares method: ,in, is a longitudinal coordinate parameter (i.e., a longitudinal coordinate of an arbitrary point in the initial trunk straight line), and t is a transverse coordinate parameter.
[0115] In implementation, a plurality of trunk sample groups are randomly selected, and then a plurality of initial trunk straight lines are obtained. For each initial trunk straight line, a first perpendicular distance of each pixel point p in the trunk branch to the initial trunk straight line is calculated, and the calculation formula is: .
[0116] The number of first pixel points in the trunk branch with a first perpendicular distance less than a distance threshold is counted, and the number of first pixel points is stored in association with the initial trunk straight line as a first set.
[0117] In step A3, the initial trunk straight line corresponding to the largest number of first pixel points is selected as the trunk straight line.
[0118] In implementation, the initial trunk straight line corresponding to the largest number of first pixel points is selected from the first set as the trunk straight line.
[0119] Through the above scheme, the number of first pixel points in the trunk branch corresponding to each initial trunk straight line with a first perpendicular distance less than a distance threshold is counted, and then the initial trunk straight line corresponding to the largest number of first pixel points is selected, which is the initial trunk straight line with the best fitting effect, and is selected as the trunk straight line. The trunk obtained in this way is the most accurate.
[0120] In some embodiments, in step 108, the straight line fitting of the side branch to obtain a side straight line includes: In step B1, any two side sample points in the side branch are selected as a side sample group, and a plurality of side sample groups are selected.
[0121] wherein the two side sample points are any two pixel points in the side branch and Random selection can reduce the influence of noise and outliers.
[0122] In step B2, for each side sample group, an initial side straight line corresponding to the side sample group is determined according to the two side sample points in the side sample group, a second perpendicular distance of each pixel point in the side branch to the initial side straight line is determined, and the number of second pixel points in the side branch with a second perpendicular distance less than a distance threshold is counted.
[0123] In implementation, the direction vectors and corresponding to the two side sample points are determined, and the initial side straight line is obtained by using the least square method for straight line fitting: wherein, is a longitudinal coordinate parameter (i.e., a longitudinal coordinate of an arbitrary point in the initial side straight line), and t is a transverse coordinate parameter.
[0124] In implementation, a plurality of side sample groups are randomly selected, and then a plurality of initial side straight lines are obtained. For each initial side straight line, the second perpendicular distance of each pixel point p in the side branch to the initial side straight line is calculated, and the calculation formula is: .
[0125] The number of second pixel points in the side branch with the second perpendicular distance less than the distance threshold is counted, and the number of second pixel points is stored in association with the initial side straight line as a second set.
[0126] In step B3, the initial side straight line corresponding to the maximum number of second pixel points is selected as the side straight line.
[0127] In implementation, the initial side straight line corresponding to the maximum number of second pixel points is selected from the second set as the side straight line.
[0128] Through the above scheme, the number of second pixel points in the side branch corresponding to each initial side straight line with the second perpendicular distance less than the distance threshold is counted, and then the initial side straight line corresponding to the maximum number of second pixel points is selected, which is the initial side straight line with the best fitting effect, and is selected as the side straight line. The side straight line obtained finally is the most accurate.
[0129] As a preferred embodiment, in step 109, the direction vector of the two-dimensional projection corresponding to the trunk straight line is , the direction vector of the two-dimensional projection corresponding to the side straight line is , and the calculation formula of the included angle between the trunk straight line and the side straight line is: .
[0130] Through the above scheme, an accurate blade included angle can be obtained.
[0131] It should be noted that the method of the embodiments of the present application can be executed by a single device, such as a computer or a server, etc. The method of the embodiments of the present application can also be applied to a distributed scenario, and completed by multiple devices cooperating with each other. In this distributed scenario, one of the multiple devices can only execute one or more steps in the method of the embodiments of the present application, and the multiple devices will interact with each other to complete the method.
[0132] It is to be understood that the foregoing description is directed to embodiments of the application. Various embodiments are described herein, including the best mode of the inventors. It will be apparent, however, to those skilled in the art having the benefit of this disclosure, that variations and / or modifications of these embodiments can be made without departing from the spirit and scope of the application. Thus, the present application is not intended to be limited to the embodiments shown, but is to be accorded the widest scope consistent with the principles and features disclosed herein.
[0133] Based on the same inventive concept, the present application also provides a plant leaf angle measurement device corresponding to any of the above-mentioned embodiment methods.
[0134] Reference Figure 8 , the device comprises: The preprocessing module 201 is configured to acquire a plant image, generate a corresponding depth map according to the plant image, perform normalization processing on the depth map to obtain a normalized depth map, perform normalization on the plant image to obtain a normalized plant image, and determine a depth gradient feature according to the normalized depth map; The fusion module 202 is configured to fuse the normalized depth map, the normalized plant image, and the depth gradient feature to obtain fusion feature space data; The clustering module 203 is configured to perform clustering processing on the fusion feature space data, separate out a foreground clustering group based on the result of the clustering processing, and obtain an initial mask according to the foreground clustering group; The guided filtering module 204 is configured to use the normalized depth map as a guide image to perform guided filtering processing on the initial mask to obtain a filtered image; The anisotropic expansion module 205 is configured to perform anisotropic expansion processing on the filtered image according to a gradient direction corresponding to the depth gradient feature to obtain a smoothed image.
[0135] The skeleton extraction module 206 is configured to perform skeleton extraction based on the smoothed image to obtain a skeleton structure; The main branch and side branch determination module 207 is configured to determine a main branch and a side branch according to the skeleton structure; The straight line fitting module 208 is configured to perform straight line fitting on the main branch to obtain a main straight line and perform straight line fitting on the side branch to obtain a side straight line; The angle determination module 209 is configured to determine an angle between the main straight line and the side straight line to obtain a leaf angle result and output.
[0136] In some embodiments, each fusion feature in the fusion feature space data comprises: a depth value corresponding to the normalized depth map, a pixel value corresponding to the normalized plant image, and a depth gradient value corresponding to the depth gradient feature; The clustering module 203 is specifically configured to: determine a plurality of clustering centers based on the fusion feature space data; determine a first weight value corresponding to the depth value, a second weight value corresponding to the pixel value, and a third weight value corresponding to the depth gradient value, wherein the first weight value is greater than the second weight value and greater than the third weight value; for each fusion feature in the fusion feature space data, determine a weighted distance between the fusion feature and each clustering center according to the first weight value, the second weight value, and the third weight value; assign the fusion feature to a grouping of the clustering center with the smallest weighted distance according to the weighted distance, and re-determine the clustering centers based on the grouping result to cluster, until the clustering centers no longer change, to obtain a plurality of clustering groupings; select a foreground clustering group meeting the foreground part from the plurality of clustering groupings, and generate an initial mask according to the foreground clustering group.
[0137] In some embodiments, the guided filtering module 204 is specifically configured to: use the normalized depth map as a guide image determine a guide image corresponding to the pixel position p as ; determine a local window corresponding to the pixel position q ; determine a first coefficient and a second coefficient by minimizing the target function, wherein the target function is: wherein, is the initial mask corresponding to the pixel position p, is a regularization coefficient; determine a filtered image based on the first coefficient and the second coefficient corresponding to the filtering formula, wherein the filtering formula is: wherein, is the filtered image corresponding to the pixel position p.
[0138] In some embodiments, the anisotropic expansion module 205 is specifically configured to: Determine the time evolution image I at the current time step, where the time evolution image at the initial time step is the filtered image. ; The gradient magnitude is determined based on the depth gradient features corresponding to the time-evolution image I at the current moment. ; Based on gradient magnitude Determine the edge stopping function The corresponding calculation formula is: in, The diffusion intensity coefficient; Based on the edge stopping function The partial differential function is determined by the following formula: where t is time; According to the gradient magnitude in each direction in the time evolution image I at the current moment. The partial differential function is expanded using the finite difference method to determine the time evolution image at the next moment, thus completing the anisotropic expansion processing of the time evolution image at the current moment. The anisotropic extension process is iterated in chronological order until the iteration termination condition is met, and the time evolution image at the last moment is determined as the optimized image. The optimized image is binarized to obtain the smoothed image.
[0139] In some embodiments, the anisotropic extension module 205 is further configured to: Determine the time evolution graph at the current time n ; Determine the gradient magnitude in the first direction The formula is: Where i and j are the time evolution images at the current time n, respectively. The x and y coordinates are used to determine the directional diffusion coefficient corresponding to the first direction. ; Determine the gradient magnitude in the second direction The formula is: And determine the directional diffusion coefficient corresponding to the second direction. ; Determine the magnitude of the third-direction gradient The formula is: And determine the diffusion coefficient of the third party in the corresponding direction. ; Determine the gradient magnitude in the fourth direction The formula is: And determine the directional diffusion coefficient corresponding to the fourth direction. ; Get Time Step determining the time evolution image at the next time n+1 by expanding the partial differential function using the finite difference method The corresponding formula is: .
[0140] In some embodiments, the skeleton extraction module 206 is specifically configured to: processing the smoothed image using a skeletonization algorithm to obtain an initial skeleton image; determining the depth value corresponding to each pixel point in the initial skeleton image as a skeleton depth value; performing binaryzation processing on the initial skeleton image according to the comparison between the skeleton depth value and the depth threshold value to obtain a binaryzation skeleton structure; removing the pixel points in the binaryzation skeleton structure with a skeleton depth value less than the depth threshold value to obtain the skeleton structure.
[0141] In some embodiments, the main branch and side branch determination module 207 is specifically configured to: determining the branch structure of the skeleton structure; for each branch structure, determining the sum of distances of all pixel points in the branch structure as the physical length of the branch structure; for each branch structure, determining the local curvature of each pixel point in the branch structure and determining the average value of the local curvatures of all pixel points in the branch structure as the curvature of the branch structure; for each branch structure, multiplying the physical length of the branch structure by a first weight coefficient to obtain a weighted physical length, multiplying the curvature of the branch structure by a second weight coefficient to obtain a weighted curvature, and subtracting the weighted curvature from the weighted physical length to obtain a branch value; taking the branch structure with the largest branch value as the main branch; taking the branch structures other than the main branch as other branch structures, traversing each other branch structure from the end of the main branch as the starting point, and taking the other branch structure with the largest branch value as the side branch.
[0142] In some embodiments, the straight line fitting module 208 is specifically configured to: selecting any two main sample points in the main branch as a main sample group, and selecting a plurality of main sample groups; for each main sample group, determining an initial main straight line corresponding to the main sample group according to the two main sample points in the main sample group, determining the first perpendicular distance of each pixel point in the main branch from the initial main straight line, and counting the first pixel point number of the main branch with a first perpendicular distance less than a distance threshold value; select the initial main straight line corresponding to the maximum first pixel point number as the main straight line.
[0143] In some embodiments, the straight line fitting module 208 is further configured to: select any two side sample points in the side branch as a side sample group, and select a plurality of side sample groups; for each side sample group, determine an initial side straight line corresponding to the side sample group according to the two side sample points in the side sample group, determine the second perpendicular distance between each pixel point in the side branch and the initial side straight line, and count the second pixel point number of the side branch with a second perpendicular distance less than the distance threshold value; select the initial side straight line corresponding to the maximum second pixel point number as the side straight line.
[0144] For the convenience of description, the above device is described as various modules described respectively according to functions. Of course, in the implementation of the present application, the functions of each module can be implemented in the same or multiple software and / or hardware.
[0145] The device of the above embodiment is used to implement the corresponding method in any of the above embodiments, and has the beneficial effects of the corresponding method embodiment, which will not be repeated here.
[0146] Based on the same inventive concept, corresponding to any of the above embodiment methods, the present application also provides an electronic device, including a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor executes the computer program to implement the method of any one of the above embodiments.
[0147] Figure 9 A more specific hardware structure of an electronic device is shown, which can include a processor 1010, a memory 1020, an input / output interface 1030, a communication interface 1040, and a bus 1050. The processor 1010, the memory 1020, the input / output interface 1030, and the communication interface 1040 are connected to each other through the bus 1050 for communication within the device.
[0148] The processor 1010 can be implemented by a general CPU (Central Processing Unit, central processor), a microprocessor, an application specific integrated circuit (Application Specific Integrated Circuit, ASIC), or one or more integrated circuits, etc., for executing related programs to implement the technical solutions provided by the embodiments of the present application.
[0149] The memory 1020 can be implemented in the form of a ROM (Read Only Memory), a RAM (Random Access Memory), a static storage device, a dynamic storage device, etc. The memory 1020 can store an operating system and other application programs, and when the technical solutions provided in the embodiments of the present specification are implemented by software or firmware, the related program codes are stored in the memory 1020 and are called and executed by the processor 1010.
[0150] The input / output interface 1030 is configured to connect an input / output module to realize information input and output. The input / output module can be configured as a component in the device (not shown in the figure) or can be externally connected to the device to provide corresponding functions. The input device can include a keyboard, a mouse, a touch screen, a microphone, various sensors, etc., and the output device can include a display, a speaker, a vibrator, an indicator light, etc.
[0151] The communication interface 1040 is configured to connect a communication module (not shown in the figure) to realize communication interaction between the device and other devices. The communication module can realize communication through a wired manner (such as a USB, a network cable, etc.) or through a wireless manner (such as a mobile network, WIFI, Bluetooth, etc.).
[0152] The bus 1050 includes a channel to transmit information between various components (such as the processor 1010, the memory 1020, the input / output interface 1030, and the communication interface 1040) of the device.
[0153] It should be noted that although the above device only shows the processor 1010, the memory 1020, the input / output interface 1030, the communication interface 1040, and the bus 1050, in the specific implementation process, the device can also include other components necessary for normal operation. In addition, those skilled in the art can understand that the above device can also only include components necessary for implementing the embodiments of the present specification, and does not have to include all the components shown in the figure.
[0154] The electronic device of the above embodiments is used to implement the corresponding method in any of the above embodiments, and has the beneficial effects of the corresponding method embodiments, which are not described here again.
[0155] Based on the same inventive concept, corresponding to the method of any of the above embodiments, the present application also provides a non-transitory computer readable storage medium storing computer instructions for causing the computer to execute the method of any of the above embodiments.
[0156] The computer readable medium of the embodiments includes permanent and non-permanent, removable and non-removable media, which can realize information storage by any method or technology. The information can be computer readable instructions, data structures, program modules or other data. Examples of computer storage media include, but are not limited to, phase change memory (PRAM, Parameter Random Access Memory), static random access memory (SRAM, Static Random-Access Memory), dynamic random access memory (DRAM, Dynamic Random Access Memory), other types of random access memory (RAM), read-only memory (ROM), electrically erasable programmable read-only memory (EEPROM, Electrically Erasable Programmable Read Only Memory), flash memory or other memory technologies, compact disc read-only memory (CD-ROM, Compact Disc Read-Only Memory), digital versatile disc (DVD, Digital Video Disc) or other optical storage, magnetic cassette, magnetic tape, magnetic disk storage or other magnetic storage device, or any other non-transmission medium that can be used to store information accessible by a computing device.
[0157] The storage medium of the above embodiments stores computer instructions for causing the computer to execute the method as described in any of the above embodiments, and has the beneficial effects of the corresponding method embodiments, which are not repeated here.
[0158] Based on the same concept, the present application also provides a computer program product corresponding to the method of any of the above embodiments, which includes computer program instructions, when the computer program instructions run on a computer, make the computer execute the method as described in any of the above embodiments, have the beneficial effects of the corresponding method embodiments, which are not repeated here.
[0159] It can be understood that before using the technical solutions of various embodiments of the present application, the type of personal information involved, the scope of use, the use scenario, etc. will be informed to the user in a proper manner, and the authorization of the user will be obtained.
[0160] For example, in response to receiving the user's active request, send prompt information to the user to explicitly prompt the user that the operation requested to be executed will require obtaining and using the user's personal information. Thus, the user can voluntarily choose whether to provide personal information to the electronic device, application program, server or storage medium, etc. software or hardware that executes the operation of the technical solutions of the present application according to the prompt information.
[0161] As an optional but non-limiting implementation manner, in response to accepting the active request of the user, the manner of sending the prompt information to the user may be, for example, a pop-up window manner, and the prompt information may be presented in the pop-up window in the form of text. In addition, the pop-up window may also carry a selection control for the user to select "agree" or "disagree" to provide the personal information to the electronic device.
[0162] It can be understood that the above notification and user authorization obtaining process is only illustrative, and does not limit the implementation manners of the present application, and other manners meeting the relevant laws and regulations can also be applied to the implementation manners of the present application.
[0163] It should be understood by those skilled in the art that the above discussion of any embodiment is only exemplary and is not intended to imply that the scope (including claims) of the present application is limited to these examples; under the idea of the present application, the technical features in the above embodiments or different embodiments can also be combined, the steps can be implemented in any order, and there are many other changes of different aspects of the embodiments of the present application as described above, which are not provided in detail for the sake of brevity.
[0164] In addition, in order to simplify the description and discussion, and so as not to make the embodiments of the present application difficult to understand, the known power / ground connections of integrated circuit (IC) chips and other components can or can not be shown in the provided drawings. In addition, the devices can be shown in the form of block diagrams in order to avoid making the embodiments of the present application difficult to understand, and this also takes into account the fact that the details of the implementation of these block diagram devices are highly dependent on the platform on which the embodiments of the present application are to be implemented (i.e., these details should be entirely within the understanding of those skilled in the art). Where specific details (e.g., circuitry) are set forth in order to describe an illustrative embodiment of the present application, it will be apparent to those skilled in the art that the embodiments of the present application can be practiced without these specific details or with an implementation varying from these specific details. Therefore, these descriptions should be considered as illustrative rather than limiting.
[0165] Although the present application has been described in conjunction with the specific embodiments thereof, it is evident that many alternatives, modifications and variations will be apparent to those skilled in the art in light of the foregoing description. For example, other memory architectures (e.g., dynamic RAM (DRAM)) can use the embodiments discussed.
[0166] The embodiments of the present application are intended to cover all such alternatives, modifications and variations as falling within the broad scope of the appended claims. Accordingly, any and all such modifications, variations or equivalents that fall within the spirit and scope of the embodiments of the present application should also be included.
Claims
1. A method for measuring the included angle of plant leaves, characterized in that, include: Acquire a plant image, generate a corresponding depth map based on the plant image, normalize the depth map to obtain a normalized depth map, normalize the plant image to obtain a normalized plant image, and determine the depth gradient feature based on the normalized depth map. The normalized depth map, the normalized plant image, and the depth gradient features are fused to obtain fused feature space data; The fused feature space data is subjected to clustering processing. Based on the results of the clustering processing, foreground cluster groups are separated, and an initial mask is obtained based on the foreground cluster groups. Using the normalized depth map as a guide image, the initial mask is subjected to guided filtering to obtain the filtered image. The filtered image is subjected to anisotropic expansion processing according to the gradient direction corresponding to the depth gradient feature to obtain a smooth image; Skeleton extraction is performed on the smoothed image to obtain the skeleton structure; The main branches and lateral branches are determined based on the described skeletal structure; The main branch is fitted with a straight line to obtain the main straight line, and the side branch is fitted with a straight line to obtain the side straight line; Determine the angle between the main straight line and the side straight line, obtain the blade angle result, and output it.
2. The method according to claim 1, characterized in that, Each fusion feature in the fusion feature space data includes: a depth value corresponding to the normalized depth map, a pixel value corresponding to the normalized plant image, and a depth gradient value corresponding to the depth gradient feature. The process of clustering the fused feature space data, separating foreground clusters based on the clustering results, and obtaining an initial mask based on the foreground clusters includes: Multiple cluster centers are determined based on the fused feature spatial data; A first weight value corresponding to the depth value, a second weight value corresponding to the pixel value, and a third weight value corresponding to the depth gradient value are determined, wherein the first weight value is greater than the second weight value and is also greater than the third weight value; For each fusion feature in the fusion feature space data, the weighted distance between the fusion feature and each cluster center is determined based on the first weight value, the second weight value, and the third weight value. Based on the weighted distance, the fused feature is assigned to the group with the smallest weighted distance cluster center, and the cluster center is re-determined based on the grouping results for clustering until the cluster center no longer changes, resulting in multiple cluster groups; Select the foreground cluster group that matches the foreground portion from multiple cluster groups, and generate an initial mask based on the foreground cluster group.
3. The method according to claim 1, characterized in that, The step of using the normalized depth map as a guide image to perform guided filtering on the initial mask to obtain the filtered image includes: The normalized depth map is used as the guide image. The guiding image corresponding to pixel position p is determined as follows. ; Determine the local window corresponding to pixel position q ; Minimize the objective function and determine the first coefficient. Second coefficient The objective function is: ,in, This is the initial mask corresponding to pixel position p. The regularization coefficient is used. Based on the first coefficient and the second coefficient The corresponding filtering formula determines the filtered image. The filtering formula is as follows: ,in, This is the filtered image corresponding to pixel position p.
4. The method according to claim 1, characterized in that, The step of performing anisotropic expansion processing on the filtered image according to the gradient direction corresponding to the depth gradient feature to obtain a smoothed image includes: Determine the time evolution image I at the current time step, where the time evolution image at the initial time step is the filtered image. ; The gradient magnitude is determined based on the depth gradient features corresponding to the time-evolution image I at the current moment. ; Based on gradient magnitude Determine the edge stopping function The corresponding calculation formula is: in, The diffusion intensity coefficient; Based on the edge stopping function The partial differential function is determined by the following formula: where t is time; According to the gradient magnitude in each direction in the time evolution image I at the current moment. The partial differential function is expanded using the finite difference method to determine the time evolution image at the next moment, thus completing the anisotropic expansion processing of the time evolution image at the current moment. The anisotropic extension process is iterated in chronological order until the iteration termination condition is met, and the time evolution image at the last moment is determined as the optimized image. The optimized image is binarized to obtain the smoothed image.
5. The method according to claim 4, characterized in that, The gradient magnitudes in each direction corresponding to the time evolution image I at the current moment. The partial differential function is expanded using the finite difference method to determine the time evolution image at the next moment, including: Determine the time evolution graph at the current time n ; Determine the gradient magnitude in the first direction The formula is: Where i and j are the time evolution images at the current time n, respectively. The x and y coordinates are used to determine the directional diffusion coefficient corresponding to the first direction. ; Determine the gradient magnitude in the second direction The formula is: And determine the directional diffusion coefficient corresponding to the second direction. ; Determine the magnitude of the third-direction gradient The formula is: And determine the diffusion coefficient of the third party in the corresponding direction. ; Determine the gradient magnitude in the fourth direction The formula is: And determine the directional diffusion coefficient corresponding to the fourth direction. ; Get Time Step The partial differential function is expanded using the finite difference method to determine the time evolution image at the next time step n+1. The corresponding formula is: 。 6. The method according to claim 1, characterized in that, The process of extracting the skeleton from the smoothed image to obtain the skeleton structure includes: The smoothed image is processed using a skeletonization algorithm to obtain an initial skeleton map; Determine the depth value corresponding to each pixel in the initial skeleton image, and use it as the skeleton depth value; The initial skeleton image is binarized by comparing the skeleton depth value with the depth threshold to obtain a binarized skeleton structure. In the binarized skeleton structure, the pixels with skeleton depth values less than a depth threshold are removed to obtain the skeleton structure.
7. The method according to claim 1, characterized in that, Based on the described skeletal structure, the main branches and lateral branches are determined, including: Determine the branch structure of the skeleton structure; For each branch structure, the sum of distances between all pixels in that branch structure is determined as the physical length of that branch structure; For each branch structure, determine the local curvature of each pixel in the branch structure, and determine the average value of the local curvature of all pixels in the branch structure as the curvature of the branch structure. For each branch structure, the physical length of the branch structure is multiplied by the first weighting coefficient to obtain the weighted physical length, the curvature of the branch structure is multiplied by the second weighting coefficient to obtain the weighted curvature, and the weighted physical length is subtracted from the weighted curvature to obtain the branch value. The branch with the largest value is taken as the main branch; Take the branch structures other than the main branch as other branch structures, traverse each other branch structure starting from the end of the main branch, and take the other branch structure with the largest branch value as a side branch.
8. The method according to claim 1, characterized in that, The step of performing linear fitting on the main branches to obtain the main straight line includes: Select any two main sample points from the main branch as the main sample group, and select multiple main sample groups. For each backbone sample group, based on the two backbone sample points in the backbone sample group, the initial backbone line corresponding to the backbone sample group is determined, the first vertical distance between each pixel point in the backbone branch and the initial backbone line is determined, and the number of first pixels in the backbone branch whose first vertical distance is less than the distance threshold is counted. Select the initial main line corresponding to the largest number of first pixels as the main line.
9. The method according to claim 1, characterized in that, The step of performing linear fitting on the side branches to obtain the side lines includes: Select any two side sample points from the side branch as a side sample group, and select multiple side sample groups; For each side sample group, based on the two side sample points in the side sample group, determine the initial side line corresponding to the side sample group, determine the second vertical distance between each pixel point in the side branch and the initial side line, and count the number of second pixels in the side branch whose second vertical distance is less than the distance threshold. Select the initial side line corresponding to the largest number of second-pixel points as the side line.
10. An electronic device comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, characterized in that, When the processor executes the computer program, it implements the method as described in any one of claims 1 to 9.
Citation Information
Patent Citations
Corn plant type parameter measurement method, system and device and storage medium
CN114170148A
Quantitative measurement method and device for morphological characteristics of plant leaves
CN115719371A
Image-based leaf form information extraction method
CN115731257A
Plant phenotype analysis method
CN120032190A
Corn plant leaf dip angle field in-situ extraction method based on depth camera
CN120279100A