Method and apparatus for measuring leaf angle in plants

By generating depth maps and performing normalization and feature fusion processing, combined with clustering and guided filtering, the problems of high resource consumption and light interference in traditional methods are solved, achieving high-precision leaf angle measurement, which is applicable to plants at various growth stages.

CN120976040BActive Publication Date: 2025-12-26XINGYUN TECH (SHANGHAI) CO LTD +1
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202511495487.X
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2025-10-20
Publication Date
2025-12-26
Estimated Expiration
2045-10-20

AI Technical Summary

Technical Problem

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 lighting and background interference.

Method used

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.

Benefits of technology

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 robustness of segmentation.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN120976040B_ABST
    Figure CN120976040B_ABST
Patent Text Reader

Abstract

The application provides a plant leaf angle measurement method and device. A corresponding depth map can be generated according to a plant image obtained, the depth map and the plant image are normalized, a corresponding depth gradient feature is determined according to the normalized depth map, a fusion feature space data is obtained by fusing the normalized depth map, the normalized plant image and the depth gradient feature; the fusion feature space data is clustered to determine an initial mask with accurate foreground; the normalized depth map is used as a guide to filter the initial mask, main edge features are retained, and a smoothed image is obtained by anisotropic diffusion of the filtered image according to the depth gradient feature; a skeleton structure of the smoothed image is extracted, a main branch and a side branch are determined, a main straight line and a side straight line are obtained by linear fitting, and an angle between the main straight line and the side straight line is taken as a leaf angle. The method can be applied to determination of leaf angles of plants in various growth stages and has high practicability and adaptability.
Need to check novelty before this filing date? Find Prior Art

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 is mainly to obtain a segmentation model trained by deep learning or to extract a branch mask using color, and to determine the angle of the leaf relative to the trunk according to the branch mask.

[0003] However, the traditional method of determining the angle of the leaf 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 angle of the leaf. 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:

[0006] 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;

[0007] fusing the normalized depth map, the normalized plant image, and the depth gradient feature to obtain fused feature space data;

[0008] performing clustering processing on the fused 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;

[0009] using the normalized depth map as a guide image, performing guided filtering processing on the initial mask to obtain a filtered image;

[0010] performing anisotropic expansion processing on the filtered image according to the gradient direction corresponding to the depth gradient feature to obtain a smoothed image;

[0011] extracting a skeleton based on the smoothed image to obtain a skeleton structure;

[0012] determining a main branch and a side branch according to the skeleton structure;

[0013] Fitting a straight line to the main branch to obtain a main straight line, and fitting a straight line to the side branch to obtain a side straight line;

[0014] Determining an included angle between the main straight line and the side straight line to obtain a leaf included angle result and output.

[0015] Based on the same inventive concept, the present application also provides an electronic device comprising a memory, a processor, and a computer program stored on the memory and executable by the processor, wherein the processor implements the method described above when executing the computer program.

[0016] As can be seen from the above, the plant leaf included angle measurement method and device provided by the present 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 of each dimension. Then, based on the fusion feature space data, clustering is performed, so that the initial mask determined by the foreground clustering 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, after skeleton extraction is performed on the smoothed image, the main branch and the side branch are determined, the main straight line and the side straight line are obtained through straight line fitting, and the included angle between the main straight line and the side straight line is taken as the leaf included angle. This way of determining the leaf included angle can be applied to plants at various growth stages, and has high practicability and adaptability. BRIEF DESCRIPTION OF DRAWINGS

[0017] In order to more clearly illustrate the technical solutions in the present application or 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 present application, and other drawings can be obtained by those skilled in the art without creative labor.

[0018] Figure 1 Flowchart of the plant leaf included angle measurement method of the embodiments of the present application;

[0019] Figure 2 Schematic diagram of the plant image of the embodiments of the present application;

[0020] Figure 3 Schematic diagram of the depth map of the embodiments of the present application;

[0021] Figure 4 A schematic diagram of an initial mask of an embodiment of the present application;

[0022] Figure 5 A schematic diagram of each branch in a skeleton structure of an embodiment of the present application;

[0023] Figure 6 A schematic diagram of a main branch and a side branch after branch optimization of an embodiment of the present application;

[0024] Figure 7 A schematic diagram of a leaf angle result of an embodiment of the present application;

[0025] Figure 8 A structural block diagram of a plant leaf angle measuring device of an embodiment of the present application;

[0026] Figure 9 A structural schematic diagram of an electronic device of an embodiment of the present application. DETAILED DESCRIPTION

[0027] In order to make the objectives, technical solutions and advantages of the present application clearer, the present application will be further described in detail below with reference to specific embodiments and drawings.

[0028] 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 understood by those with ordinary skills 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", "contain", and similar terms mean that the elements or objects before the terms encompass the elements or objects listed after the terms and their equivalents, and do not exclude other elements or objects. The terms "connect" or "connected" and similar terms do not mean physical or mechanical connections, but can include electrical connections, whether direct or indirect. The terms "upper", "lower", "left", "right", and the like only represent relative positional relationships, and when the absolute positions of the described objects change, the relative positional relationships can also change accordingly.

[0029] The embodiments of the present application will be described in detail below with reference to the drawings.

[0030] The plant leaf angle measuring method proposed in the embodiments of the present application, as shown in Figure 1 , includes:

[0031] Step 101, a plant image is acquired (as shown in Figure 2 ), and a corresponding depth map is generated according to the plant image (as shown in Figure 3The normalized depth map is obtained by normalizing the depth map, and the normalized plant image is obtained by normalizing the plant image. The depth gradient feature is obtained by determining the depth gradient according to the normalized depth map.

[0032] In specific implementation, a high-resolution RGB camera is used to capture 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, as it can help distinguish different plant tissues (such as leaves, stems, ears, etc.).

[0033] A pre-trained monocular depth estimation model Depth Anything is used to extract depth information from the RGB image and generate a depth map. 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.

[0034] Formula: ; wherein, is the input RGB image, f is the pre-trained monocular depth estimation model, is the image position corresponding depth value.

[0035] 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.

[0036] Formula: ; wherein, and are the minimum and maximum values in the depth map , respectively.

[0037] Plant image (RGB image) normalization: The three color channels (red, green, blue) of the plant image are normalized respectively, and the pixel value range of each channel is unified to [0, 1].

[0038] Formula: ; wherein, C represents the pixel in the single channel of R (red), G (green), B (blue) in the plant image, and are the minimum and maximum values in the channel, respectively.

[0039] Depth gradient calculation: The normalized depth map The gradient magnitude is calculated using the Sobel operator.

[0040] The formula is:

[0041] ;

[0042] wherein, and are the gradients of the depth map in the x and y directions, respectively.

[0043] Step 102, fusing the normalized depth map, the normalized plant image, and the depth gradient feature to obtain fused feature space data.

[0044] In specific implementation, the normalized depth map is one-dimensional data, the normalized plant image corresponding to red, green, and blue is three-dimensional data, and the depth gradient feature is one-dimensional data. Therefore, the fused feature space data obtained after fusion is five-dimensional data.

[0045] The formula of the fused feature space data is:

[0046] ;

[0047] wherein, is the normalized depth map, is the image corresponding to the red channel R in the normalized plant image, is the image corresponding to the green channel G in the normalized plant image, is the image corresponding to the blue channel B in the normalized plant image, is the depth gradient feature.

[0048] The depth gradient feature reflects the rate of change in depth, which 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.

[0049] Step 103, performing clustering processing on the fused feature space data, separating out a foreground cluster group based on the result of the clustering processing, and obtaining an initial mask (as shown in FIG. 4) according to the foreground cluster group. Figure 4

[0050] In specific implementation, the corresponding clustering method includes K-means clustering. In the clustering process, because depth is more critical for distinguishing foreground and background, the clustering weight corresponding to the normalized depth map in the fused 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. ​​

[0051] Further, the foreground cluster component is extracted as an initial mask.

[0052] In step 104, the initial mask is guided filter processed using the normalized depth map as a guide image to obtain a filtered image.

[0053] In implementation, in order to avoid the influence of some noise and discontinuous edges in the initial mask image, the initial mask is depth-guided filter processed using the normalized depth map to obtain a filtered image. The main edge features are retained and the noise is reduced.

[0054] In step 105, the filtered image is anisotropically expanded according to the gradient direction corresponding to the depth gradient feature to obtain a smoothed image.

[0055] In implementation, in order to avoid the destruction of the leaf topology structure in the filtered image by isotropic processing, the filtered image is anisotropically expanded according to the gradient direction corresponding to the depth gradient feature to perform selective smoothing processing, and then a more easily recognizable smoothed image is obtained.

[0056] In step 106, a skeleton is extracted based on the smoothed image to obtain a skeleton structure (as shown in Figure 5 ).

[0057] In step 107, a main branch and a side branch are determined according to the skeleton structure (as shown in Figure 6 ).

[0058] In implementation, the branch value of each branch is determined, the main branch is filtered using the branch value, and then the pseudo branch is proposed using a non-recursive method from the main branch trigger to obtain the side branch.

[0059] In step 108, a main straight line is obtained by performing straight line fitting on the main branch, and a side straight line is obtained by performing straight line fitting on the side branch.

[0060] In step 109, an included angle between the main straight line and the side straight line is determined to obtain a leaf included angle result (as shown in Figure 7 ) and output.

[0061] In implementation, since the obtained main branch and side branch are not straight lines, in order to better perform the leaf included angle, the obtained main branch and side branch are respectively straight line fitted (for example, using the RANSAC straight line fitting algorithm), and then the main straight line and the side straight line are obtained. Then the main straight line and the side straight line are projected into a two-dimensional plane (for example, a predetermined vertical plane) to obtain a main projection and a side projection, so that the included angle corresponding to the main projection and the side projection can be accurately calculated as the leaf included angle.

[0062] 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.

[0063] 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.

[0064] Step 103 includes:

[0065] Step 1031, determining a plurality of cluster centers based on the fusion feature space data.

[0066] 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.

[0067] 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 .

[0068] 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.

[0069] In a specific implementation, the calculation formula corresponding to the weighted distance is:

[0070] = ;

[0071] where 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.

[0072] In step 1034, according to the weighted distance, the fusion feature is assigned to the grouping of the cluster center with the smallest 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.

[0073] In a 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 smallest weighted distance.

[0074] 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:

[0075] where 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 .

[0076] The cluster center is re-determined iteratively until the cluster center no longer changes or the number of iterations reaches a preset iteration threshold, and the clustering is stopped to obtain the final plurality of cluster groupings.

[0077] In step 1035, a foreground cluster group that meets the foreground part is selected from the plurality of cluster groupings, and an initial mask is generated according to the foreground cluster group.

[0078] In implementation, the cluster group with the smallest depth value is taken as the foreground cluster group, and the remaining cluster groups are taken as the background cluster groups.

[0079] An initial mask is determined for the foreground cluster group by using a binarization method The corresponding formula is:

[0080] wherein, is the foreground cluster group.

[0081] Wherein, 1 represents that the pixel value is white, and 0 represents that the pixel value is black. Thus, the initial mask obtained is a mask image in which the foreground part is white and the background part is black.

[0082] Through the above scheme, the morphological continuity of the leaf can be better maintained due to the higher weight of the depth value corresponding to the clustering process, the defects of isotropic processing can be avoided, the foreground cluster group can be accurately separated, and a more accurate initial mask can be obtained.

[0083] In some embodiments, step 104 includes:

[0084] Step 1041, taking the normalized depth map as a guide image , the guide image corresponding to the pixel position p is determined as .

[0085] Step 1042, determining the local window corresponding to the pixel position q .

[0086] Step 1043, performing minimization processing on the target function to determine the first coefficient and the second coefficient , wherein the target function is:

[0087] wherein, is the initial mask corresponding to the pixel position p, is a regularization coefficient.

[0088] 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:

[0089] wherein, is the filtered image corresponding to the pixel position p.

[0090] To avoid the influence of noise and discontinuous edges in the initial mask image, the above scheme uses a normalized depth map to perform depth-guided filtering on the initial mask, resulting in a filtered image that retains the main edge features and reduces noise.

[0091] In some embodiments, step 105 includes:

[0092] Step 1051: Determine the time evolution image I at the current time, wherein the time evolution image at the initial time is the filtered image. .

[0093] Step 1052: Determine the gradient magnitude based on the depth gradient features corresponding to the time-evolution image I at the current moment. .

[0094] Step 1053, based on gradient magnitude Determine the edge stopping function The corresponding calculation formula is: in, is the diffusion intensity coefficient.

[0095] Step 1054, based on the edge stopping function The partial differential function is determined by the following formula: , where t is time.

[0096] Step 1055: According to the gradient magnitudes 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.

[0097] In practice, for the initial time, for the filtered image The corresponding gradient magnitude is .Will As I, will As Substitute into the formula The edge stopping function value is obtained. .

[0098] Then, the partial differential function is expanded using the finite difference method, based on... This determines the time evolution image at the next moment, thus completing an anisotropic expansion process of the time evolution image at the current moment.

[0099] In some embodiments, step 1055 includes:

[0100] Step 10551: Determine the time evolution image at the current time n. .

[0101] Step 10552, 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. .

[0102] Step 10553, determine the gradient magnitude in the second direction. The formula is: And determine the directional diffusion coefficient corresponding to the second direction. .

[0103] Step 10554: Determine the magnitude of the third-direction gradient. The formula is: And determine the diffusion coefficient of the third party in the corresponding direction. .

[0104] Step 10555: Determine the gradient magnitude in the fourth direction. The formula is: And determine the directional diffusion coefficient corresponding to the fourth direction. .

[0105] Step 10556, Obtain the 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:

[0106] .

[0107] The first direction, second direction, third direction, and fourth direction refer to the corresponding two-dimensional geographic directions. 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, second direction, third direction, and fourth direction can also be other allocation methods, which are set according to actual needs.

[0108] The above scheme enables accurate anisotropic diffusion, effectively avoiding damage to the blade topology caused by isotropic treatment.

[0109] Step 1056: Iterate the anisotropic extension process in chronological order until the iteration termination condition is met, and determine the time evolution image at the last moment as the optimized image.

[0110] Then, the time evolution image of the next moment is taken as the time evolution image of the current moment, and the process is iteratively executed according to the above steps 1051 to 1055 until the time evolution image of the end moment converges, or the preset number of iterations is reached, and the process of anisotropic expansion processing is ended. The time evolution image of the last moment (end moment) is taken as the optimized image .

[0111] Step 1057, the optimized image is binarized to obtain the smoothed image.

[0112] In specific implementation, the optimized image is binarized to obtain the smoothed image .

[0113] Through the above scheme, the depth gradient information helps to retain the edge information, so that the edges of the main stem and the leaves / ears are clearer, and the anisotropic diffusion can maintain the morphological continuity of the leaves, avoiding the defects of isotropic processing.

[0114] In some embodiments, step 106 includes:

[0115] Step 1061, using a skeletonization algorithm to process the smoothed image to obtain an initial skeleton map.

[0116] The nodes in the initial skeleton map include branch points, end points and intermediate points.

[0117] 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.

[0118] The end point is a pixel point with only one adjacent pixel point, indicating the termination position of the skeleton.

[0119] The intermediate point is a skeleton pixel point other than the branch point and the end point.

[0120] The initial skeleton map is obtained by skeleton extraction using the Zhang-Suen skeleton algorithm.

[0121] Step 1062, determining the depth value corresponding to each pixel point in the initial skeleton map as the skeleton depth value.

[0122] Step 1063, according to the comparison of the skeleton depth value and the depth threshold value, the initial skeleton map is binarized to obtain the binarized skeleton structure.

[0123] In specific implementation, the initial skeleton graph obtained by using the Zhang-Suen skeleton algorithm for skeleton extraction may mistakenly regard background noise or unimportant small structures as part of the foreground, thereby generating some pseudo branches. In order to improve the accuracy and robustness of skeleton extraction, a depth constraint condition is introduced, and the depth value is used to screen the pixel points participating in skeletonization, so that only the pixel points with a significant depth value (i.e., the pixel points with a skeleton depth value greater than a depth threshold) are considered, thereby removing noise with insignificant depth information, performing accurate binary processing, and obtaining a binary skeleton structure.

[0124] wherein the median depth value is determined , and the specific determination formula is:

[0125] wherein median is a median function, is the depth value of the pixel point (x, y), x, y is the depth value of the pixel point with the horizontal coordinate x and the vertical coordinate y. x The depth threshold is determined as , and a is a threshold coefficient.

[0126] The formula corresponding to the binary skeleton structure is:

[0127] .

[0128] Step 1064, removing the pixel points with a skeleton depth value less than the depth threshold from the binary skeleton structure, to obtain the skeleton structure.

[0129] Through the above scheme, the depth constraint condition is introduced, which can effectively remove noise with insignificant depth values, retain the main foreground part, improve the accuracy and robustness of skeleton extraction, provide high-quality input for subsequent processing, and ensure the reliability of the final result.

[0130] In some embodiments, step 107 includes:

[0131] Step 1071, determining the branch structure of the skeleton structure.

[0132] In specific implementation, all initial branches of the skeleton structure are determined, the adjacent initial branches of the initial branch are determined, and the adjacent initial branches are combined to form a branch structure.

[0133] Step 1072, determining the distance sum of all pixel points in each branch structure as the physical length of the branch structure.

[0134] branch ​​​​

[0135] In specific implementation, ; wherein p is a pixel point in the branch structure branch , a pixel point adjacent to the pixel point p in the branch structure branch , p a pixel point adjacent to the pixel point p in the branch structure , p and is the Euclidean distance between the pixel point p and the pixel point adjacent to the pixel point p in the branch structure.

[0136] Step 1073, 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.

[0137] In specific implementation, for a pixel point p in a branch structure, branch , the 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: p

[0138] ; wherein is the local curvature, and are the first-order derivatives of x and y, and are the second-order derivatives of x and y.

[0139] Then, the average value of the local curvatures of all pixel points in the branch structure branch is calculated , and the formula is:

[0140] wherein N is the total number of pixel points in the branch structure branch .

[0141] Step 1074, 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.

[0142] In specific implementation, the calculation formula of the branch value is:

[0143] ; wherein is the first weight coefficient, is the second weight coefficient.

[0144] Step 1075, taking the branch structure with the largest branch value as the main branch. ​​

[0145] In implementation, the trunk branch is generally of high connectivity, is a critical path of other branch structures, and is generally straight and has small curvature.

[0146] Therefore, branch values of each branch structure are combined to form a candidate set, and each branch value of each branch structure in the candidate set is traversed, and a branch structure with the largest branch value is selected as the trunk branch.

[0147] In step 1076, the branch structure other than the trunk branch is taken as another branch structure, each other branch structure is traversed from the end of the trunk branch as a starting point, and the other branch structure with the largest branch value is taken as a side branch.

[0148] In implementation, in the skeleton extraction process, especially when processing branch points, there are many false branches caused by noise or small structures. These false branches often have no meaning in actual application and can affect subsequent operations such as calculation of leaf angles, and need to be removed. In order to achieve this goal, a non-recursive method is used to traverse adjacent pixel points of the end point of the trunk branch to identify branch points of the trunk branch. For each identified branch point, the branch value of the branch structure in which the branch point is located is obtained , and the branch structure and the branch value are stored in a candidate branch set.

[0149] In the candidate branch set, the branch values are filtered according to the size of the branch value . The branch structure with the largest branch value is selected as a side branch, and the topological structure is retained. For other branch structures, if the branch value is less than the branch threshold value, it is regarded as a false branch and is removed.

[0150] Through the above scheme, the trunk branch and the side branch can be screened according to the branch values of each branch structure in the skeleton structure, so that the obtained trunk branch and side branch are more accurate, and the determined included angle is also more accurate.

[0151] In some embodiments, the straight line fitting of the trunk branch in step 108 to obtain a trunk straight line comprises:

[0152] In step A1, any two trunk sample points in the trunk branch are selected as a trunk sample group, and a plurality of trunk sample groups are selected.

[0153] Two trunk sample points are any two pixel points and in the trunk branch. Random selection can reduce the influence of noise and outliers.

[0154] Step A2, for each trunk sample group, determining an initial trunk straight line corresponding to the trunk sample group according to two trunk sample points in the trunk sample group, determining a first vertical distance between each pixel point in the trunk branch and the initial trunk straight line, and counting a first pixel point number of the trunk branch with a first vertical distance less than a distance threshold.

[0155] In specific implementation, two trunk sample points and corresponding direction vectors are determined, and the initial trunk straight line is obtained by using the least square method for straight line fitting:

[0156] wherein, is a longitudinal coordinate parameter (i.e., the longitudinal coordinate of any point in the initial trunk straight line), and t is a horizontal coordinate parameter.

[0157] In specific 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 vertical distance between each pixel point p in the trunk branch and the initial trunk straight line is calculated, and the calculation formula is: .

[0158] The first pixel point number with a first vertical distance less than a distance threshold in the trunk branch is counted, and the first pixel point number is stored in association with the initial trunk straight line as a first set.

[0159] Step A3, selecting the initial trunk straight line corresponding to the maximum first pixel point number as the trunk straight line.

[0160] In specific implementation, the initial trunk straight line corresponding to the maximum first pixel point number is selected from the first set as the trunk straight line.

[0161] Through the above scheme, the first pixel point number with a first vertical distance less than a distance threshold in the trunk branch corresponding to each initial trunk straight line can be counted, and then the initial trunk straight line corresponding to the maximum first pixel point number 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 finally is the most accurate.

[0162] In some embodiments, in step 108, the side branch is fitted to obtain a side straight line, including:

[0163] Step B1, selecting any two side sample points in the side branch as a side sample group, and selecting a plurality of side sample groups.

[0164] wherein, the two side sample points are any two pixel points and Random selection can reduce the influence of noise and outliers.

[0165] Step B2, for each side sample group, determining an initial side straight line corresponding to the side sample group according to two side sample points in the side sample group, determining a second vertical distance between each pixel point in the side branch and the initial side straight line, and counting a second pixel point number of the side branch with a second vertical distance less than a distance threshold.

[0166] In specific implementation, two side sample points and corresponding direction vectors are determined, and a least square method is used for straight line fitting to obtain the initial side straight line:

[0167] 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 horizontal coordinate parameter.

[0168] In specific implementation, a plurality of side sample groups are randomly selected, and a plurality of initial side straight lines are obtained. For each initial side straight line, a second vertical distance between each pixel point p in the side branch and the initial side straight line is calculated, and the calculation formula is: .

[0169] The second pixel point number with a second vertical distance less than the distance threshold in the side branch is counted, and the second pixel point number is stored in association with the initial side straight line as a second set.

[0170] Step B3, selecting an initial side straight line corresponding to the largest second pixel point number as the side straight line.

[0171] In specific implementation, the initial side straight line corresponding to the largest second pixel point number is selected from the second set as the side straight line.

[0172] Through the above scheme, the second pixel point number with a second vertical distance less than the distance threshold in the side branch corresponding to each initial side straight line can be counted, and then the initial side straight line corresponding to the largest second pixel point number 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 in this way is the most accurate.

[0173] 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: .

[0174] Through the above scheme, an accurate blade included angle can be obtained.

[0175] 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 can also be applied to a distributed scenario, and be completed by multiple devices cooperating with each other. In the case of such a 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 can interact with each other to complete the method.

[0176] It should be noted that some embodiments of the present application have been described above. Other embodiments are within the scope of the appended claims. In some cases, the actions or steps recited in the claims can be performed in a different order than that described above and still achieve desirable results. Additionally, the processes depicted in the figures do not necessarily require the particular order shown, or sequential order to achieve the desired results. In certain implementations, multitasking and parallel processing can be advantageous.

[0177] Based on the same inventive concept, the present application also provides a plant leaf included angle measuring device corresponding to the method of any of the above embodiments.

[0178] Reference Figure 8 The device comprises:

[0179] 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;

[0180] 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;

[0181] The clustering module 203 is configured to perform clustering processing on the fusion feature space data, separate a foreground clustering group based on the result of the clustering processing, and obtain an initial mask according to the foreground clustering group;

[0182] 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;

[0183] 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.

[0184] The skeleton extraction module 206 is configured to perform skeleton extraction based on the smoothed image to obtain a skeleton structure;

[0185] The trunk branch and side branch determination module 207 is configured to determine a trunk branch and a side branch according to the skeleton structure;

[0186] The straight line fitting module 208 is configured to perform straight line fitting on the trunk branch to obtain a trunk straight line and perform straight line fitting on the side branch to obtain a side straight line;

[0187] The included angle determination module 209 is configured to determine an included angle between the trunk straight line and the side straight line to obtain a leaflet included angle result and output.

[0188] 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;

[0189] The clustering module 203 is specifically configured to:

[0190] determine a plurality of clustering centers based on the fusion feature space data;

[0191] 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;

[0192] 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;

[0193] According to the weighted distance, assign the fusion feature to a grouping of the clustering center with the smallest weighted distance, and re-determine the clustering centers based on the grouping result to perform clustering until the clustering centers no longer change, to obtain a plurality of clustering groupings;

[0194] Select a foreground clustering group that meets the foreground part from the plurality of clustering groupings, and generate an initial mask according to the foreground clustering group.

[0195] In some embodiments, the guided filtering module 204 is specifically configured to:

[0196] use the normalized depth map as a guide image , determine a guide image corresponding to a pixel position p as ;

[0197] determine a local window corresponding to a pixel position q ;

[0198] minimizing the target function to determine the first coefficient and the second coefficient wherein the target function is:

[0199] wherein, is an initial mask corresponding to the pixel position p, is a regularization coefficient;

[0200] based on the first coefficient and the second coefficient corresponding filtering formula, determine the filtered image wherein the filtering formula is:

[0201] wherein, is the filtered image corresponding to the pixel position p.

[0202] In some embodiments, the anisotropic expansion module 205 is specifically configured to:

[0203] determine a time evolution image at a current time, wherein the time evolution image at an initial time is the filtered image ;

[0204] determine a gradient amplitude according to a depth gradient feature corresponding to the time evolution image at the current time;

[0205] determine an edge stopping function according to the gradient amplitude , and the corresponding calculation formula is: wherein, is a diffusion intensity coefficient;

[0206] determine a partial differential function based on the edge stopping function , and the formula is: wherein, t is time;

[0207] determine a time evolution image at a next time by expanding the partial differential function using a finite difference method according to the gradient amplitude corresponding to each direction in the time evolution image at the current time, to complete the anisotropic expansion processing of the time evolution image at the current time;

[0208] iterate the process of the anisotropic expansion processing in time sequence until an iteration end condition is met, to determine the time evolution image at the last time as an optimized image;

[0209] The optimized image is binarized to obtain the smoothed image.

[0210] In some embodiments, the anisotropic propagation module 205 is specifically configured to:

[0211] determine a time evolution image at a current time n ;

[0212] determine a first direction gradient amplitude , the formula being: wherein i and j are the horizontal and vertical coordinates of the time evolution image at the current time n , and determine a direction diffusion coefficient corresponding to the first direction ;

[0213] determine a second direction gradient amplitude , the formula being: and determine a direction diffusion coefficient corresponding to the second direction ;

[0214] determine a third direction gradient amplitude , the formula being: and determine a direction diffusion coefficient corresponding to the third direction ;

[0215] determine a fourth direction gradient amplitude , the formula being: and determine a direction diffusion coefficient corresponding to the fourth direction ;

[0216] obtain a time step , expand the partial differential function using the finite difference method, and determine a time evolution image at a next time n+1 , the corresponding formula being:

[0217] .

[0218] In some embodiments, the skeleton extraction module 206 is specifically configured to:

[0219] process the smoothed image using a skeletonization algorithm to obtain an initial skeleton image;

[0220] determine a depth value corresponding to each pixel point in the initial skeleton image as a skeleton depth value;

[0221] perform binarization processing on the initial skeleton image according to a comparison between the skeleton depth value and a depth threshold value to obtain a binary skeleton structure;

[0222] Remove, in the binarized skeleton structure, a pixel point corresponding to a skeleton depth value less than a depth threshold value, to obtain the skeleton structure.

[0223] In some embodiments, the trunk branch and side branch determination module 207 is specifically configured to:

[0224] determine a branch structure of the skeleton structure;

[0225] for each branch structure, determine a sum of distances of all pixel points in the branch structure as a physical length of the branch structure;

[0226] for each branch structure, determine a local curvature of each pixel point in the branch structure, and determine an average value of the local curvatures of all pixel points in the branch structure as a curvature of the branch structure;

[0227] for each branch structure, multiply the physical length of the branch structure by a first weight coefficient to obtain a weighted physical length, multiply the curvature of the branch structure by a second weight coefficient to obtain a weighted curvature, and subtract the weighted curvature from the weighted physical length to obtain a branch value;

[0228] take the branch structure with the largest branch value as the trunk branch;

[0229] take the branch structures other than the trunk branch as other branch structures, traverse each other branch structure from the end of the trunk branch as a starting point, and take the other branch structure with the largest branch value as a side branch.

[0230] In some embodiments, the straight line fitting module 208 is specifically configured to:

[0231] select any two trunk sample points in the trunk branch as a trunk sample group, and select a plurality of trunk sample groups;

[0232] for each trunk sample group, determine an initial trunk straight line corresponding to the trunk sample group according to the two trunk sample points in the trunk sample group, determine a first perpendicular distance of each pixel point in the trunk branch from the initial trunk straight line, and count a first pixel point number of the trunk branch with a first perpendicular distance less than a distance threshold value;

[0233] select the initial trunk straight line corresponding to the largest first pixel point number as the trunk straight line.

[0234] In some embodiments, the straight line fitting module 208 is specifically further configured to:

[0235] select any two side sample points in the side branch as a side sample group, and select a plurality of side sample groups;

[0236] For each side sample group, according to two side sample points in the side sample group, determine an initial side straight line corresponding to the side sample group, determine the second vertical 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 the second vertical distance less than the distance threshold value;

[0237] Select the initial side straight line corresponding to the maximum second pixel point number as the side straight line.

[0238] For the convenience of description, the above device is described as various modules respectively described in function. 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.

[0239] 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.

[0240] 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.

[0241] Figure 9 A more specific hardware structure schematic diagram of an electronic device provided by the present embodiment 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.

[0242] 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 present embodiment.

[0243] 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.

[0244] 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.

[0245] 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 (for example, a USB, a network cable, etc.) or through a wireless manner (for example, a mobile network, WIFI, Bluetooth, etc.).

[0246] The bus 1050 includes a channel for transmitting information between various components (for example, the processor 1010, the memory 1020, the input / output interface 1030, and the communication interface 1040) of the device.

[0247] 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.

[0248] 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.

[0249] Based on the same inventive concept, the present application also provides a non-transitory computer readable storage medium, which stores computer instructions for causing the computer to execute the method of any of the above embodiments.

[0250] 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.

[0251] 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.

[0252] Based on the same concept, the present application also provides a computer program product corresponding to the method of any of the above embodiments, comprising computer program instructions, which, when executed on a computer, cause the computer to execute the method as described in any of the above embodiments, and have the beneficial effects of the corresponding method embodiments, which are not repeated here.

[0253] It can be understood that before using the technical solutions of various embodiments of the present application, the type, use range, use scenario, etc. of the personal information involved will be informed to the user in a proper manner, and the authorization of the user will be obtained.

[0254] For example, in response to receiving the user's active request, prompt information is sent to the user to explicitly prompt the user that the operation requested to be performed will require obtaining and using the user's personal information. Thus, the user can voluntarily choose whether to provide personal information to the software or hardware such as electronic device, application program, server or storage medium, etc. that performs the operation of the technical solutions of the present application according to the prompt information.

[0255] As an optional but not limited implementation, in response to a user's active request, sending a prompt message to the user can be done via a pop-up window, where the prompt message can be presented in text format. Furthermore, the pop-up window can also include a selection control allowing the user to choose "agree" or "disagree" to provide personal information to the electronic device.

[0256] It is understood that the above notification and user authorization process is merely illustrative and does not limit the implementation of this application. Other methods that comply with relevant laws and regulations may also be applied to the implementation of this application.

[0257] Those skilled in the art should understand that the discussion of any of the above embodiments is merely exemplary and is not intended to imply that the scope of this application (including the claims) is limited to these examples; within the framework of this application, the technical features of the above embodiments or different embodiments can also be combined, the steps can be implemented in any order, and there are many other variations of different aspects of the embodiments of this application as described above, which are not provided in the details for the sake of brevity.

[0258] Additionally, to simplify the description and discussion, and to avoid obscuring the embodiments of this application, the well-known power / ground connections to integrated circuit (IC) chips and other components may or may not be shown in the provided drawings. Furthermore, the apparatus may be shown in block diagram form to avoid obscuring the embodiments of this application, and this also takes into account the fact that the details of the implementation of these block diagram apparatuses are highly dependent on the platform on which the embodiments of this application will be implemented (i.e., these details should be fully understood by those skilled in the art). While specific details (e.g., circuits) have been set forth to describe exemplary embodiments of this application, it will be apparent to those skilled in the art that the embodiments of this application can be implemented without these specific details or with variations thereof. Therefore, these descriptions should be considered illustrative rather than restrictive.

[0259] Although this application has been described in conjunction with specific embodiments thereof, many substitutions, modifications, and variations of these embodiments will be apparent to those skilled in the art from the foregoing description. For example, other memory architectures (e.g., dynamic RAM (DRAM)) may be used with the embodiments discussed.

[0260] The embodiments of this application are intended to cover all such substitutions, modifications, and variations that fall within the broad scope of the appended claims. Therefore, any omissions, modifications, equivalent substitutions, improvements, etc., made within the spirit and principles of the embodiments of this application should be included within the protection scope of this application.

Claims

1. A method of measuring the angle of a plant leaf, characterized by, The method comprises the following steps: 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, determining a depth gradient according to the normalized depth map to obtain a depth gradient feature; fusing the normalized depth map, the normalized plant image and the depth gradient feature to obtain fused feature space data; performing clustering processing on the fused feature space data, separating out a foreground clustering group based on the clustering processing result, 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 included angle between the main straight line and the side straight line to obtain a leaf included angle result and outputting the same; each fusion feature in the fused 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 processing on the fused feature space data, the separation of the foreground clustering group based on the clustering processing result, and the obtaining of the initial mask according to the foreground clustering group comprise: determining a plurality of clustering centers based on the fused feature space data; 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; for each fusion feature in the fused feature space data, determining 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; according to the weighted distance, assigning the fusion feature to the grouping of the clustering center with the smallest weighted distance, and re-determining the clustering centers based on the grouping result to perform clustering until the clustering centers no longer change, thereby obtaining a plurality of clustering groups; selecting a foreground clustering group meeting the foreground part from the plurality of clustering groups, and generating an initial mask according to the foreground clustering group; determining the main branch and the side branch according to the skeleton structure comprises: 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, multiply the physical length of the branch structure by a first weight coefficient to obtain a weighted physical length, multiply the curvature of the branch structure by a second weight coefficient to obtain a weighted curvature, and subtract the weighted curvature from the weighted physical length to obtain a branch value; select the branch structure with the largest branch value as the main branch; select the branch structures other than the main branch as other branch structures, traverse each of the other branch structures from the end of the main branch as the starting point, and select the other branch structure with the largest branch value as the side branch.

2. The method of claim 1, wherein, The guided filtering processing of the initial mask by using the normalized depth map as a guide image to obtain a filtered image, comprising: using the normalized depth map as a guide image , determining a guide image corresponding to the pixel position p as ; determining a local window corresponding to the pixel position q ; minimizing a target function to determine the first coefficient and the second coefficient wherein the target function is: wherein, is an initial mask corresponding to the pixel position p, is a regularization coefficient; based on the first coefficient and the second coefficient a corresponding filtering formula to determine a filtered image where the filtering formula is wherein, is the filtered image corresponding to the pixel position p.

3. The method of claim 1, wherein, The anisotropic expansion processing of the filtered image according to the gradient direction corresponding to the depth gradient feature to obtain a smoothed image, comprising: determining a time evolution image I at a current time, wherein the time evolution image at an initial time is the filtered image ; determining a gradient amplitude based on the depth gradient features corresponding to the time-evolving image I at the current time instant ; According to the gradient amplitude , the edge stop function is determined , the corresponding calculation formula is: Wherein, is the diffusion intensity coefficient; based on the edge stop function a partial differential function is determined, given by: where t is time; The gradient amplitude corresponding to each direction in the time evolution image I according to the current time The partial differential function is expanded by using the finite difference method to determine the time evolution image of the next time, and the anisotropic expansion processing of the time evolution image of the current time is completed. iterating the process of the anisotropic expansion processing in time sequence until the iteration end condition is met, and determining the time evolution image at the last time as the optimized image; The binarization processing of the optimized image to obtain the smoothed image.

4. The method of claim 3, wherein, said gradient amplitudes corresponding to each direction in the time-evolution image I at the current time instant determining the time-evolution image at the next time instant by expanding said partial differential function using finite difference method determining a time evolution image at a 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. ; determining a second direction gradient magnitude , the formula is: , and determining a direction diffusion coefficient corresponding to the second direction ; determining a third direction gradient magnitude , the formula is: , and determining a direction diffusion coefficient corresponding to the third direction ; determining a fourth directional gradient magnitude , the formula is: , and determining a directional diffusion coefficient corresponding to the fourth direction ; Acquisition time step determining a time evolution image at a next time n+1 by expanding the partial differential function using a finite difference method The corresponding formula is: 。 5. The method of claim 1, wherein, The skeleton extraction based on the smoothed image to obtain a skeleton structure, comprising: processing the smoothed image using a skeletonization algorithm to obtain an initial skeleton graph; determining the depth value corresponding to each pixel point in the initial skeleton graph as a skeleton depth value; The binarization processing of the initial skeleton graph according to the comparison between the skeleton depth value and the depth threshold to obtain a binary skeleton structure; removing the pixel points with the skeleton depth value less than the depth threshold in the binary skeleton structure to obtain the skeleton structure.

6. The method of claim 1, wherein, The straight line fitting of the main branch to obtain a main straight line, comprising: selecting any two main sample points in the main branch as a main sample group, and selecting multiple 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 between each pixel point in the main branch and the initial main straight line, and counting the first pixel point number of the main branch with the first perpendicular distance less than the distance threshold; selecting the initial main straight line corresponding to the largest first pixel point number as the main straight line.

7. The method of claim 1, wherein, The straight line fitting of the side branch to obtain a side straight line, comprising: selecting any two side sample points in the side branch as a side sample group, and selecting multiple side sample groups; for each side sample group, determining an initial side straight line corresponding to the side sample group according to the two side sample points in the side sample group, determining the second perpendicular distance between each pixel point in the side branch and the initial side straight line, and counting the second pixel point number of the side branch with the second perpendicular distance less than the distance threshold; selecting the initial side straight line corresponding to the largest second pixel point number as the side straight line.

8. An electronic device comprising a memory, a processor, and a computer program stored on the memory and executable on the processor, characterized in that, The processor executes the computer program to implement the method of any one of claims 1 to 7. The processor executes the computer program to implement the method of any one of claims 1 to 7.

Citation Information

Patent Citations

  • Image-based leaf form information extraction method

    CN115731257A

  • Corn plant leaf dip angle field in-situ extraction method based on depth camera

    CN120279100A