Animal image segmentation method and device based on region growing
By performing rigid transformation and clustering on 3D point cloud data, and combining it with the region growing method for layer-by-layer scanning growth, the problem of inaccurate animal segmentation in 3D point cloud segmentation is solved, achieving efficient and controllable animal image segmentation.
Patent Information
- Application Number
- CN202511204961.9
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2025-08-27
- Publication Date
- 2025-11-21
- Estimated Expiration
- 2045-08-27
AI Technical Summary
Existing 3D point cloud segmentation methods suffer from insufficient accuracy in animal segmentation, especially due to difficulties in obtaining curvature changes, complex and uncontrollable parameter tuning, the RANSAC algorithm's difficulty in fitting 3D shapes, and the effects of K-means and DBSCAN clustering being affected by posture and camera viewpoint.
By acquiring filtered left and right view animal point cloud data, rigid transformation and clustering processing are performed to obtain seed regions. The region growing method is then used for layer-by-layer scanning and directional growth, and a preset stopping growth rule is set to control the growth of the seed regions, thus completing animal image segmentation.
It reduces the difficulty of parameter tuning, improves the controllability of the segmentation process and the accuracy of measurement results, adapts to different standing postures and camera positions, and is suitable for body segmentation of quadrupedal livestock.
Smart Images

Figure CN120726074B_ABST
Abstract
Description
TECHNICAL FIELD
[0001] The present application relates to the technical field of animal image segmentation, in particular to an animal image segmentation method and device based on region growing. BACKGROUND
[0002] Compared with two-dimensional image segmentation, the segmentation of the detected body based on three-dimensional point cloud can fully utilize the rich geometric information and spatial relationship contained in the point cloud data, and avoid the loss of geometric information caused by projection in two-dimensional image segmentation. For example, when dealing with a three-dimensional animal, the traditional two-dimensional image segmentation method is difficult to accurately obtain the depth information and the partially occluded region of the animal due to the projection from a certain perspective, while the three-dimensional point cloud segmentation can completely retain the three-dimensional structure of the animal, thereby more accurately identifying each part of the detected body. The common segmentation methods at present include: using an improved region growing method to merge by using the change of curvature; using a RANSAC algorithm to fit the local region into different planes or three-dimensional shapes to merge; using a graph theory segmentation algorithm to merge according to the radius and clustering data; using a K-means centroid method to divide different centroid ranges to merge; and using DBSCAN to perform body segmentation based on the point cloud density.
[0003] However, the problem of using curvature change to merge is that it is difficult to obtain the obvious change of the curvature of the segmented part and other regions in a three-dimensional space, and the curvature is affected by multiple conditions such as radius, normal vector, etc., so the parameter adjustment process is complex and uncontrollable. When the point cloud data cannot scan the complete detected three-dimensional information, the RANSAC algorithm is difficult to fit the three-dimensional shape according to the actual animal characteristics. K-means and DBSCAN are both density-based clustering methods, and in the clustering process, due to the different poses of the detected body and the camera perspective, it is difficult to achieve good clustering results. SUMMARY
[0004] The main purpose of the present application is to provide an animal image segmentation method and device based on region growing, which aims to solve the technical problem of inaccurate animal segmentation.
[0005] To achieve the above purpose, the present application provides an animal image segmentation method based on region growing, which comprises:
[0006] obtaining filtered left-view animal point cloud data and right-view animal point cloud data;
[0007] performing rigid change and clustering processing on the filtered left-view animal point cloud data and the right-view animal point cloud data to obtain a seed region;
[0008] regionally directional growth of the seed region by region growing method through layer-by-layer scanning;
[0009] controlling the seed region to stop growing according to preset stopping growing rules to obtain point cloud data in the growing region;
[0010] completing animal image segmentation based on the point cloud data in the growing region.
[0011] In an embodiment, the step of regionally directional growth of the seed region by region growing method through layer-by-layer scanning comprises:
[0012] setting a growing radius by the region growing method and point cloud density;
[0013] constructing a binary tree for points in the seed region according to the growing radius;
[0014] controlling the binary tree to scan along a vertical axis layer by layer for directional growth of the region.
[0015] In an embodiment, the step of controlling the seed region to stop growing according to preset stopping growing rules to obtain point cloud data in the growing region comprises:
[0016] projecting points in the growing region onto a two-dimensional plane by projection method and calculating Euclidean distances between points in the first left view point cloud, the second left view point cloud, the first right view point cloud and the second right view point cloud in the seed region on the two-dimensional plane;
[0017] taking the maximum Euclidean distance in the Euclidean distances as a maximum width of the seed region to obtain a maximum width of the current layer;
[0018] setting a height threshold, a maximum width threshold, a maximum width change rate threshold and a maximum projection width threshold;
[0019] taking the height threshold, the maximum width threshold, the maximum width change rate threshold and the maximum projection width threshold as preset stopping growing rules;
[0020] obtaining a current growing distance of directional growth of the seed region, a maximum projection width of the current scanning layer and a historical maximum width of the last iteration, and calculating a change rate of the projection maximum width according to the maximum width and the historical maximum width;
[0021] controlling the seed region to stop growing according to the current growing distance, the maximum projection width of the current scanning layer, the change rate of the projection maximum width and at least one of the height threshold, the maximum width threshold, the maximum width change rate threshold and the maximum projection width threshold to obtain point cloud data in the growing region.
[0022] In an embodiment, the step of controlling the seed region to stop growing according to the current growing distance, the maximum projection width of the current scanning layer, the rate of change of the maximum projection width, and at least one of the height threshold, the maximum width threshold, the maximum width change rate threshold, and the maximum projection width threshold, to obtain the point cloud data in the growing region comprises:
[0023] detecting whether the current growing distance is greater than or equal to the height threshold, whether the current growing distance is greater than or equal to the maximum width, whether the rate of change of the maximum projection width is greater than or equal to the maximum width change rate threshold, and whether the maximum projection width is greater than or equal to the maximum projection width threshold;
[0024] controlling the seed region to stop growing when any one of the current growing distance is greater than or equal to the height threshold, the current growing distance is greater than or equal to the maximum width, the rate of change of the maximum projection width is greater than or equal to the maximum width change rate threshold, and the maximum projection width is greater than or equal to the maximum projection width threshold, to obtain the point cloud data in the growing region.
[0025] In an embodiment, the step of performing rigid transformation and clustering processing on the filtered left-view animal point cloud data and the right-view animal point cloud data to obtain a seed region comprises:
[0026] obtaining a rigid transformation matrix;
[0027] performing rotation and translation of different views on the filtered left-view animal point cloud data and the right-view animal point cloud data through the rigid transformation matrix, to obtain preprocessed left-view animal point cloud data and preprocessed right-view animal point cloud data;
[0028] performing clustering processing on the preprocessed left-view animal point cloud data and the preprocessed right-view animal point cloud data through a clustering algorithm, to obtain a first left-view point cloud, a second left-view point cloud, a first right-view point cloud, and a second right-view point cloud;
[0029] obtaining a seed region based on the first left-view point cloud, the second left-view point cloud, the first right-view point cloud, and the second right-view point cloud.
[0030] In an embodiment, the step of obtaining a seed region based on the first left-view point cloud, the second left-view point cloud, the first right-view point cloud, and the second right-view point cloud comprises:
[0031] obtaining a set height threshold;
[0032] filtering the points in the first left-view point cloud, the second left-view point cloud, the first right-view point cloud and the second right-view point cloud through the height threshold value;
[0033] regarding the points in the first left-view point cloud, the second left-view point cloud, the first right-view point cloud and the second right-view point cloud that are higher than the height threshold value as a seed region.
[0034] In an embodiment, the step of completing animal image segmentation based on the point cloud data in the growth region comprises:
[0035] obtaining animal leg point cloud data based on the point cloud data in the growth region;
[0036] merging according to the animal leg point cloud data and the top-view point cloud to obtain segmented point cloud data;
[0037] completing animal image segmentation according to the segmented point cloud data.
[0038] In addition, to achieve the above object, the present application further provides an animal image segmentation device based on region growing, which comprises:
[0039] an acquisition module, configured to acquire filtered left-view animal point cloud data and right-view animal point cloud data;
[0040] a processing module, configured to perform rigid change and clustering processing on the filtered left-view animal point cloud data and the right-view animal point cloud data to obtain a seed region;
[0041] a growth module, configured to perform region-oriented growth on the seed region through layer-by-layer scanning by using a region growing method;
[0042] a control module, configured to control the seed region to stop growing according to a preset stopping growth rule to obtain point cloud data in a growth region;
[0043] a segmentation module, configured to complete animal image segmentation based on the point cloud data in the growth region.
[0044] In addition, to achieve the above object, the present application further provides an electronic device, which comprises a memory, a processor and a computer program stored in the memory and capable of running on the processor, and the computer program is configured to implement the steps of the animal image segmentation method based on region growing as described above.
[0045] In addition, to achieve the above object, the application further provides a storage medium, which is a computer readable storage medium, and a computer program is stored on the storage medium, and the computer program is executed by a processor to implement the steps of the animal image segmentation method based on region growing.
[0046] In addition, to achieve the above object, the application further provides a computer program product, which comprises a computer program, and the computer program is executed by a processor to implement the steps of the animal image segmentation method based on region growing.
[0047] The one or more technical solutions provided by the application obtain filtered left-view animal point cloud data and right-view animal point cloud data; perform rigid change and clustering processing on the filtered left-view animal point cloud data and right-view animal point cloud data to obtain a seed region; perform region-oriented growth on the seed region through layer-by-layer scanning by using a region growing method; control the seed region to stop growing according to a preset stopping growing rule to obtain point cloud data in a growing region; and complete animal image segmentation based on the point cloud data in the growing region. Through rigid change and clustering on point cloud data of different views, the difficulty of parameter adjustment is reduced, and through layer-by-layer scanning to grow the seed region, the stopping condition of growth is set to prevent parameter adjustment failure caused by region diffusion, thereby ensuring controllability of the segmentation process and accuracy of the measurement result. BRIEF DESCRIPTION OF DRAWINGS
[0048] The accompanying drawings, which are incorporated into and form part of the specification, illustrate embodiments consistent with the present application and, together with the specification, serve to explain the principles of the application.
[0049] In order to more clearly illustrate the technical solutions in the embodiments of the present application or the prior art, the accompanying drawings needed to be used in the embodiments or prior art description will be briefly introduced. Obviously, for those skilled in the art, other drawings can also be obtained without creative labor based on these drawings.
[0050] Figure 1 The flowchart provided for the animal image segmentation method based on region growing of the present application is shown in Figure 1;
[0051] Figure 2 The segmentation diagram of the animal image segmentation method based on region growing is provided for the animal image segmentation method based on region growing of the present application;
[0052] Figure 3 The flowchart provided for the animal image segmentation method based on region growing of the present application is shown in Figure 1;
[0053] Figure 4 A schematic diagram for calculating the maximum width of a growth region based on a projection method is provided for an embodiment of the animal image segmentation method based on region growing of the present application;
[0054] Figure 5 A flowchart is provided for an embodiment of the animal image segmentation method based on region growing of the present application;
[0055] Figure 6 A segmentation effect diagram obtained by segmenting an animal is provided for an embodiment of the animal image segmentation method based on region growing of the present application;
[0056] Figure 7 A brief flowchart is provided for an embodiment of the animal image segmentation method based on region growing of the present application;
[0057] Figure 8 A module structure diagram of the animal image segmentation device based on region growing of an embodiment of the present application is provided;
[0058] Figure 9 A device structure diagram of the hardware running environment involved in the animal image segmentation method based on region growing in an embodiment of the present application is provided.
[0059] The object implementation, functional features and advantages of the present application will be further described with reference to the embodiments and the accompanying drawings. DETAILED DESCRIPTION
[0060] It should be understood that the specific embodiments described herein are only used to explain the technical solutions of the present application, and are not used to limit the present application.
[0061] In order to better understand the technical solutions of the present application, the following will be described in detail in combination with the drawings and specific embodiments of the specification.
[0062] The main solution of the embodiment of the present application is: obtaining filtered left view animal point cloud data and right view animal point cloud data; performing rigid change and clustering processing on the filtered left view animal point cloud data and the right view animal point cloud data to obtain a seed region; performing layer-by-layer scanning region directional growth on the seed region through a region growing method; controlling the seed region to stop growing according to a preset stop growing rule to obtain point cloud data in the growth region; and completing animal image segmentation based on the point cloud data in the growth region.
[0063] Since the prior art is difficult to obtain the obvious change of the curvature of the segmented part and other regions, meanwhile, the curvature is affected by multiple conditions such as radius, normal vector, etc., the parameter adjustment process is complex and uncontrollable. When the point cloud data cannot scan the complete three-dimensional information of the detected animal, the RANSAC algorithm is difficult to fit the three-dimensional shape according to the actual animal characteristics. K-means and DBSCAN are both based on density clustering. In the clustering process, due to the different station poses and camera angles of the detected object, it is difficult to achieve good clustering results.
[0064] The present application provides a solution using the projection maximum width change rate to reduce the parameter adjustment process, quickly obtain the segmented part, has strong generalization ability, is not affected by the station pose and camera position, and is also applicable to the body segmentation of quadruped livestock. It can solve the problems of difficult to obtain curvature, complex and long parameter adjustment process, uncertain centroid, and random clustering results in the three-dimensional point cloud body segmentation process.
[0065] It should be noted that the execution subject of the present embodiment can be a computing service device with data processing, network communication and program running functions, such as a tablet computer, a personal computer, a mobile phone, etc., or an electronic device capable of realizing the above functions. The present embodiment and the following embodiments will be described below with the electronic device as an example.
[0066] Based on this, the animal image segmentation method based on region growing provided by the embodiments of the present application is provided, which is described with reference to Figure 1 , Figure 1 The flowchart of the first embodiment of the animal image segmentation method based on region growing of the present application is shown in the figure.
[0067] In the present embodiment, the animal image segmentation method based on region growing includes steps S10-S50:
[0068] Step S10: Obtain the filtered left view animal point cloud data and right view animal point cloud data.
[0069] It should be noted that when the animal image segmentation method based on region growing is executed, the filtered left view and right view animal point cloud data need to be obtained first. These data usually come from three-dimensional scanning devices such as laser radar or depth camera, which can capture the three-dimensional shape information of the animal and convert it into point cloud data.
[0070] The left view and right view animal point cloud data respectively represent the three-dimensional shape information observed from the left and right sides of the animal. Due to the difference in viewing angle, these data may contain some noise or redundant information, so they need to be filtered before subsequent processing. The purpose of filtering is to remove the noise points in the point cloud data while retaining the key features of the animal to improve the accuracy of subsequent segmentation.
[0071] The filtering processing can adopt various methods, such as statistical filtering, radius filtering, voxel filtering, etc. The statistical filtering removes the noise points with a small number of points in the neighborhood of each point in the point cloud. The radius filtering removes the points that are too close or too far away according to the set radius range. The voxel filtering divides the point cloud data into a plurality of small cubes (voxels) and selects a representative point in each voxel to reduce the number of data points. For example, the Kinect V2 camera is used to collect the top, left and right view data of the target detection object, and the straight-through method, DBSCAN, region growing method, radius filtering and other methods are used for multiple filtering to obtain the filtered left view animal point cloud data and right view animal point cloud data and the filtered top view point cloud data.
[0072] After the filtering processing, the left view and right view animal point cloud data obtained will be clearer and more accurate, providing a reliable basis for subsequent region growing and animal image segmentation. These filtered point cloud data will be input to the subsequent step S20 for rigid change and clustering processing.
[0073] It should be noted that the embodiment can be used for segmentation processing of multiple types of animals, such as segmentation processing of the body and legs of quadruped animals, and the embodiment is described by taking the segmentation processing of the body and legs of a sheep as an example.
[0074] Step S20: performing rigid change and clustering processing on the filtered left view animal point cloud data and right view animal point cloud data to obtain a seed region.
[0075] In a specific implementation, the rigid change includes rotation and translation change processing on the filtered left view sheep body point cloud data and right view sheep body point cloud data. The point cloud is changed respectively using the registered rigid change matrix, so that the first seed region can be used for the four legs.
[0076] In one possible implementation, step S20 can include steps S21-S24:
[0077] Step S21: obtaining a rigid change matrix;
[0078] It should be noted that the rigid change matrix is obtained to register the left view and right view animal point cloud data, i.e., to convert them to the same coordinate system for subsequent clustering processing. The rigid change matrix contains the parameters of rotation and translation, and by applying this matrix, the point cloud data of different views can be aligned.
[0079] In a specific implementation, the rigid change matrix can be represented by {R, T}, where R represents a rotation matrix and T represents a translation matrix.
[0080] Step S22: Rotating and translating the filtered left-view animal point cloud data and the filtered right-view animal point cloud data by the rigid change matrix to obtain preprocessed left-view animal point cloud data and preprocessed right-view animal point cloud data.
[0081] In a specific implementation, actual rotation and translation operations can be performed on the point cloud data to obtain the aligned point cloud data. Specifically, the filtered left-view animal point cloud data can be rotated and translated by different angles, and the filtered right-view animal point cloud data can be rotated and translated by different angles, so that the point cloud is changed respectively. Specifically, the filtered left-view and right-view animal point cloud data can be rotated and translated by using {Rl, Tl} and {Rr, Tr} respectively, so as to obtain the preprocessed left-view animal point cloud data and the preprocessed right-view animal point cloud data.
[0082] Step S23: Clustering the preprocessed left-view animal point cloud data and the preprocessed right-view animal point cloud data by a clustering algorithm to obtain a first left-view point cloud, a second left-view point cloud, a first right-view point cloud, and a second right-view point cloud.
[0083] It should be noted that the clustering algorithm can be a K-means clustering algorithm, where k = 2. The point clouds of the left and right views are clustered according to the centroids respectively, so as to obtain four pieces of point cloud data, i.e., the first left-view point cloud, the second left-view point cloud, the first right-view point cloud, and the second right-view point cloud, which are labeled as left-left, left-right, right-left, and right-right. The left-left label is 1, the left-right label is 2, the right-left label is 3, and the right-right label is 4. This facilitates different parameter settings for different body parts and reduces the difficulty of prior value and parameter adjustment time.
[0084] Step S24: Obtaining a seed region based on the first left-view point cloud, the second left-view point cloud, the first right-view point cloud, and the second right-view point cloud.
[0085] It should be noted that the seed region can be obtained by filtering the point cloud data of different positions and different views. The seed region is one or more initial points or regions for the four legs. For example, the point cloud data near the centroid in each cluster can be selected as the seed point, and then the seed region is constructed based on the seed point. The seed region will serve as the starting point for the subsequent region growing method, which is used to gradually expand and cover the entire animal.
[0086] In an implementable embodiment, step S24 can include: obtaining a set height threshold; screening the points in the first left view point cloud, the second left view point cloud, the first right view point cloud and the second right view point cloud by the height threshold; and taking the points in the first left view point cloud, the second left view point cloud, the first right view point cloud and the second right view point cloud that are higher than the height threshold as seed regions.
[0087] It should be noted that the height threshold is a threshold for screening points in the point cloud data, which can be set in advance. The height threshold is a Z-axis height threshold, for example, set to 25. Since the maximum projection change between the soles and the bottom of the legs of a quadruped is within a certain change interval, the Z-axis height threshold cannot be set too high to prevent the sheep from mistakenly taking the head region as a seed region point when in a low head posture.
[0088] In a specific implementation, the points in the first left view point cloud, the second left view point cloud, the first right view point cloud and the second right view point cloud can be screened according to the height threshold 25, and the points in the point cloud that are higher than 25 are taken as seed regions. If the height value of a point is higher than the height threshold, it is considered to be part of the key part of the animal and is retained; otherwise, if the height value of a point is lower than the height threshold, it is considered to be noise or unnecessary part and is excluded from the seed region.
[0089] After screening, the points in the first left view point cloud, the second left view point cloud, the first right view point cloud and the second right view point cloud that are higher than the height threshold are taken as seed regions. These seed regions will serve as the starting point for the subsequent region growing method, which is used to gradually expand and cover the entire animal. Through this method, the segmentation of the animal can be more accurate and efficient.
[0090] Step S30: region-oriented growth of the seed regions by layer-by-layer scanning of the region growing method.
[0091] Region growing method is a region-oriented growth. The region growing method is applied to the seed region to realize the layer-by-layer scanning and directional growth of the animal. Specifically, the method first scans the seed region layer by layer upwards according to the preset scanning direction and step or growth radius. During the scanning process, the algorithm will constantly check whether the current scanning point meets the preset growth conditions. These growth conditions may include the density, curvature, color and other factors of the point cloud data, depending on the characteristics of the animal to be segmented and the application scenario. Once the current scanning point meets the growth condition, it will be included in the seed region, thereby realizing the expansion of the region. This process will be repeated until the entire animal is completely covered and a complete segmentation result is formed. It is worth noting that the directional growth characteristics of the region growing method make it better adapt to the complex morphology and structure of the animal, thereby improving the accuracy and efficiency of animal image segmentation.
[0092] Through layer-by-layer scanning and directional growth of the seed region, a solid foundation is provided for subsequent animal image segmentation. Through region-oriented growth by region growing method, the invalidation of parameter adjustment caused by region expansion is effectively prevented. By setting a reasonable growth radius, the region growing method can continue to grow in the predetermined direction when encountering local holes, avoiding growth interruption caused by holes.
[0093] In a feasible implementation, step S30 can include steps S31-S33:
[0094] Step S31: setting a growth radius by the region growing method and point cloud density;
[0095] It should be noted that the region growing method is specifically directional region growing, and a reasonable growth radius can be set according to the point cloud density, so as to control the region-oriented growth of the seed region through the growth radius.
[0096] Step S32: constructing a binary tree for the points in the seed region according to the growth radius;
[0097] In specific implementation, a binary tree can be constructed for the points in the seed region through the growth radius. When constructing the KD tree, a Z-axis division point is selected from the seed region each time, and if the distance between the division point and the query point is less than the radius r, the left and right sub-trees thereof are continuously checked.
[0098] Step S33: controlling the binary tree to scan layer by layer along the vertical axis for region-oriented growth.
[0099] In specific implementation, the binary tree is controlled to scan layer by layer along the Z-axis, so as to grow region-oriented along the Z-axis, specifically from bottom to top.
[0100] Step S40: Control the seed region to stop growing according to the preset stop growth rule, and obtain point cloud data within the growth region.
[0101] It should be noted that during the directional growth process, the seed region can be controlled to stop growing by setting a preset stop growth rule, such as setting the width and height of growth, thereby limiting the directional region to the leg direction and avoiding disorderly spread. The directional growth method effectively prevents the failure of parameter adjustment due to regional spread, thus ensuring the controllability of the segmentation process and the accuracy of the measurement results.
[0102] Step S50: Complete animal image segmentation based on point cloud data within the growth region.
[0103] It should be noted that the sheep's body and legs can be segmented based on the point cloud data within the growth area. For example, the point cloud data within the growth area can be merged to form a complete animal with segmented parts.
[0104] like Figure 2 As shown, Figure 2 This is a schematic diagram of animal image segmentation based on region growing. The point cloud data of the sheep is processed by a rigid transformation matrix, and then the processed data is processed by K-Means bisection to obtain four point clouds: left-left, left-right, right-left, and right-right. The left-left, left-right, right-left, and right-right point clouds are filtered to obtain seed regions. Specifically, a height threshold can be set to select points above the threshold as seed regions. At the same time, the maximum width dn of the seed region is calculated by projecting it onto the XY plane of the growing region.
[0105] This embodiment provides an animal image segmentation method based on region growing. It acquires filtered left-view and right-view animal point cloud data; performs rigid transformation and clustering on the filtered left-view and right-view animal point cloud data to obtain seed regions; performs region-oriented growth on the seed regions through layer-by-layer scanning; controls the growth of the seed regions to stop according to a preset stopping rule, obtaining point cloud data within the growth region; and completes animal image segmentation based on the point cloud data within the growth region. By performing rigid transformation and clustering on the point cloud data of different views, the difficulty of parameter tuning is reduced. Furthermore, by growing the seed regions layer-by-layer and setting a stopping condition for growth, parameter adjustment failure due to region diffusion is prevented, thereby ensuring the controllability of the segmentation process and the accuracy of the measurement results.
[0106] Based on the first embodiment of this application, in the second embodiment of this application, the content that is the same as or similar to that in the first embodiment described above can be referred to the above description, and will not be repeated hereafter. Based on this, please refer to... Figure 3Step S40 includes steps S401-S406:
[0107] Step S401: Project the points in the growing region to a two-dimensional plane by the projection method, and calculate the Euclidean distance between the point pairs in the first left view point cloud, the second left view point cloud, the first right view point cloud and the second right view point cloud in the seed region on the two-dimensional plane.
[0108] It should be noted that, in order to improve the control effect of region growing, the maximum width of the seed region can be calculated in advance. Specifically, based on the projection method, the points in the growing region are projected to the XY two-dimensional plane. Assume that points is an N×3 array, where each row represents the three-dimensional coordinates (x, y, z) of a point. region_indices is an index array representing the index of the points in the current growing region, and the complete point cloud is composed of index numbers and point cloud coordinates. The x and y coordinates of all points in the growing region are extracted to form a new two-dimensional array xy_region_indices, which has a shape of M×2, where M is the number of points in the growing region. Therefore, each row of xy_region_indices represents the coordinates (xi, yi) of a point on the XY plane.
[0109] In specific implementation, for labels 1 and 3, i.e., the first left view point cloud and the first right view point cloud, the Euclidean distance calculation can be performed from left to right, and for labels 2 and 4, i.e., the second left view point cloud and the second right view point cloud, the Euclidean distance calculation can be performed from right to left.
[0110] In specific implementation, first, the indices of the leftmost and rightmost points in the growing region can be found, so as to obtain the coordinates of the leftmost and rightmost points on the XY plane, and then the Euclidean distance between the point pairs is calculated.
[0111] Specifically, for the region growing from left to right (labels 1 and 3), the indices are represented as follows:
[0112]
[0113]
[0114] For the region growing from right to left (labels 2 and 4), the indices are represented as follows:
[0115]
[0116]
[0117] In specific implementation, the Euclidean distance between the leftmost point and the rightmost point can be calculated. Specifically, the coordinate difference between all point pairs can be calculated first, i.e., Since the shape of xy_region_indices changes from M×2 to M×1×2, a three-dimensional array can be obtained by calculating the coordinate differences between all pairs of points through a broadcast mechanism. The shape is M×M×2. Then, the Euclidean distance between all pairs of points is calculated, as follows:
[0118]
[0119] Step S402: Use the maximum Euclidean distance among the Euclidean distances as the maximum width of the seed region to obtain the maximum width of the current layer.
[0120] It should be noted that after calculating the Euclidean distances for all point pairs, the maximum Euclidean distance can be found and used as the maximum width of the current layer. For example... Figure 4 As shown, Figure 4 This diagram illustrates the calculation of the maximum width of the growth region based on the projection method. The projection method projects the seed region onto an XY 2D plane to calculate the maximum width. For point clouds labeled 1 and 3, the maximum width is calculated from left to right; for labels 2 and 4, it's calculated from right to left, thus obtaining the maximum width of different layers, including the current layer. The maximum projection variation between the sole and bottom of a quadruped's leg can be set within a reasonable range to improve retrieval efficiency during the region growth process. Simplifying 3D point cloud data to a 2D plane for calculation using the projection method effectively reduces interference from complex geometric relationships in 3D space, flexibly adapting to point cloud data of different shapes and orientations. Furthermore, directional calculation is used for point clouds with different labels, ensuring accurate acquisition of the maximum width in various complex scenarios and avoiding errors caused by inconsistent orientations, thus improving the algorithm's versatility and robustness.
[0121] Step S403: Set the height threshold, maximum width threshold, maximum width change rate threshold, and maximum projection width threshold.
[0122] It should be understood that stopping conditions for directional growth can be set in advance, such as not growing beyond a height threshold, not growing beyond a maximum width, not growing at a speed exceeding a set speed threshold, or not exceeding a maximum width change rate threshold. Therefore, height thresholds, maximum width thresholds, maximum width change rate thresholds, and maximum projected width thresholds can be set. The height threshold is the highest value during directional growth. The maximum width threshold can be determined based on the range of the seed region. The maximum width change rate threshold can be calculated based on the maximum width of the current projection and the maximum width of the historical projections. A suitable threshold can be set based on the ratio of the maximum width of the current projection to the maximum width of the historical projections. The maximum projected width threshold is set as a threshold T for the maximum projected width of the corresponding scan layer.
[0123] Step S404: set the height threshold, the maximum width threshold, the maximum width change rate threshold and the maximum projection width threshold as preset stop growth rules.
[0124] In specific implementations, one or more of the height threshold, the maximum width threshold, the maximum width change rate threshold and the maximum projection width threshold can be set as preset stop growth rules.
[0125] Step S405: obtain a current growth distance of the seed region directional growth, a maximum projection width of a current scanning layer and a historical maximum width of a last iteration, and calculate a projection maximum width change rate according to the maximum width and the historical maximum width.
[0126] It should be noted that the current growth distance of the seed region directional growth, i.e. the growth distance of the directional growth in the current scanning layer, includes a lateral growth distance w and a longitudinal growth distance h, and the maximum projection width of the current scanning layer, i.e. the maximum value of the projection width of all point cloud data of the current layer in the XY plane. The projection maximum width change rate, i.e. the ratio of the maximum projection width of the current scanning layer to the maximum projection width of the historical scanning layer, is used to measure the change of the growth speed. These parameters can reflect the growth state of the seed region in real time and provide a basis for the subsequent stop growth decision.
[0127] Step S406: control the seed region to stop growth according to the current growth distance, the maximum projection width of the current scanning layer, the projection maximum width change rate and at least one of the height threshold, the maximum width threshold, the maximum width change rate threshold and the maximum projection width threshold, to obtain point cloud data in the growth region.
[0128] In specific implementations, whether the preset stop growth rule is met can be determined by comparing the current growth distance with the height threshold, the current growth distance with the maximum width threshold, the maximum projection width of the current scanning layer with the maximum projection width threshold and the projection maximum width change rate with the maximum width change rate threshold. If any of the parameters exceeds the corresponding threshold, the growth is immediately stopped.
[0129] For example, the maximum width of the current layer is , the historical maximum width of the last iteration is , and the projection maximum width change rate is: .
[0130] This real-time judgment and stop growth strategy can effectively avoid the problem of inaccurate segmentation caused by excessive growth, and ensure the accuracy and controllability of the segmentation result. At the same time, by comprehensively considering multiple growth parameters, the robustness and adaptability of the algorithm are improved, which can cope with animal image segmentation tasks in various complex scenes.
[0131] In a feasible implementation, step S406 can include: detecting whether the current growth distance is greater than or equal to the height threshold, whether the current growth distance is greater than or equal to the maximum width threshold, whether the change rate of the projection maximum width is greater than or equal to the maximum width change rate threshold, and whether the maximum projection width is greater than or equal to the maximum projection width threshold; when any one of the current growth distance being greater than or equal to the height threshold, the current growth distance being greater than or equal to the maximum width, the change rate of the projection maximum width being greater than or equal to the maximum width change rate threshold, and the maximum projection width being greater than or equal to the maximum projection width threshold is met, controlling the seed region to stop growing to obtain point cloud data in the growth region.
[0132] It should be noted that the growth distance judgment in the growth region, the projection maximum width change rate judgment, and the judgment of the scanning layer and the seed region can be performed respectively to determine whether the growth needs to be stopped. ① The growth distance judgment is to judge whether the longitudinal distance h of the current growth distance exceeds the height threshold , if it exceeds, the growth is stopped to obtain point cloud data in the growth region; the transverse distance w of the growth distance can also be judged whether it exceeds the maximum width threshold, if it exceeds, the growth is stopped to obtain point cloud data in the growth region. ② The projection maximum width change rate judgment is that the change rate of the projection maximum width exceeds the threshold , if it is, the growth is stopped to obtain point cloud data in the growth region; ③ The scanning layer and the seed region judgment is to obtain the maximum projection width of the seed region , according to the maximum projection width of the current scanning layer and the maximum projection width of the seed region , the ratio is calculated, if the maximum projection width threshold Q is exceeded, the growth is stopped to obtain point cloud data in the growth region.
[0133] It should be noted that if any one of the above ①, ②, and ③ is met, the growth is stopped, if any one of ①, ②, and ③ is not met, that is, the transverse distance of the current growth distance is less than the maximum width threshold, the longitudinal distance of the current growth distance is less than the height threshold, the change rate of the projection maximum width is less than the maximum width change rate threshold, and the ratio of the maximum projection width of the current scanning layer to the maximum projection width of the seed region is less than the maximum projection width threshold, the step of obtaining the maximum width by the projection method is returned, and the directional growth is continued.
[0134] The segmentation algorithm parameters of the scheme are , , And The four parameters of the above formula are determined for different views. For example, in the process of segmenting 448 point cloud data of 4 sheep bodies, the number of parameters to be adjusted accounts for 8% of the total, which indicates that the parameters of the algorithm have high generalization ability and can be adapted to the segmentation of the legs of quadruped animals.
[0135] In this embodiment, the points in the growth region are projected onto a two-dimensional plane by the projection method, and the Euclidean distances between the point pairs in the first left view point cloud, the second left view point cloud, the first right view point cloud and the second right view point cloud in the seed region on the two-dimensional plane are calculated; the maximum Euclidean distance in the Euclidean distances is taken as the maximum width of the seed region to obtain the maximum width of the current layer; a height threshold, a maximum width threshold, a maximum width change rate threshold and a maximum projection width threshold are set; the height threshold, the maximum width threshold, the maximum width change rate threshold and the maximum projection width threshold are taken as the preset stop growth rule; the current growth distance of the directional growth of the seed region, the maximum projection width of the current scanning layer and the historical maximum width of the last iteration are obtained, and the change rate of the projection maximum width is calculated according to the maximum width and the historical maximum width; the current growth distance, the maximum projection width of the current scanning layer, the change rate of the projection maximum width and at least one of the height threshold, the maximum width threshold, the maximum width change rate threshold and the maximum projection width threshold are used to control the seed region to stop growing to obtain the point cloud data in the growth region. The stop of directional region growth is performed by layer-by-layer scanning combined with the maximum width change rate of the projection method, the three-dimensional point cloud data is simplified to a two-dimensional plane for calculation by the projection method, the interference of complex geometric relationships in the three-dimensional space is reduced, the point cloud data of different shapes and directions is flexibly adapted, the directional calculation mode is used for point cloud data of different labels to ensure that the maximum width can be accurately obtained in various complex scenes, errors caused by inconsistent directions are avoided, and the universality and robustness of the algorithm are improved.
[0136] Based on the first and second embodiments of the present application, the same or similar contents as the above embodiments one and two can be referred to the above introduction, and will not be described in detail. On this basis, please refer to Figure 5 , step S50 includes steps S501-S503:
[0137] Step S501: obtaining animal leg point cloud data based on the point cloud data in the growth region.
[0138] It should be noted that the point cloud data in the growth region can be obtained according to the above steps, and the point cloud data in the growth region is the animal leg point cloud data, such as the sheep leg point cloud data.
[0139] Step S502: merging according to the animal leg point cloud data and the top view point cloud to obtain segmented point cloud data.
[0140] It should be noted that, in order to ensure the integrity of the sheep body point cloud data, the sheep body leg point cloud data can also be merged with the point cloud data of other parts. Since the point cloud data of the sheep body leg can be collected by left and right view shooting, but the top view shooting can only obtain the data of the back of the sheep body, therefore, the point cloud data of the top view can be obtained, and the left-left, left-right, right-left and right-right point cloud data in the animal leg point cloud data can be merged with the point cloud data of the top view, so as to obtain the segmented sheep body leg and body data.
[0141] Step S503: completing animal image segmentation according to the segmented point cloud data.
[0142] In the specific implementation, the merged point cloud data is labeled with the shape of different parts of the sheep body, so that the segmentation of the sheep body and leg is completed, as shown in Figure 6 , Figure 6 The segmentation effect diagram obtained by segmenting the animal is shown in the figure. By merging the left-left, left-right, right-left and right-right point cloud data in the animal leg point cloud data with the point cloud data of the top view, the segmented sheep body leg and body data are obtained.
[0143] The embodiment obtains the animal leg point cloud data based on the point cloud data in the growth area; merges the animal leg point cloud data and the top view point cloud to obtain the segmented point cloud data; and completes animal image segmentation according to the segmented point cloud data, so as to realize accurate segmentation of the sheep body point cloud data. Not only the efficiency and accuracy of point cloud data processing are improved, but also the integrity and consistency of the point cloud data of different parts of the sheep body are ensured. Merging the animal leg point cloud data with the point cloud data of the top view can further supplement and perfect the sheep body point cloud data. This merging method not only considers the shape and characteristics of the sheep leg, but also combines the perspective information of the top view, so as to obtain more accurate and complete sheep body point cloud data. According to the segmented point cloud data, animal image segmentation is completed, so as to realize accurate identification and analysis of different parts of the sheep body.
[0144] Exemplarily, in order to help understand the implementation process of the animal image segmentation method based on region growing obtained after the above embodiment one, please refer to Figure 7 , Figure 7A brief flowchart of an animal image segmentation method based on region growing is provided, specifically: obtaining filtered left view sheep point cloud data and filtered right view sheep point cloud data, applying a rigid change matrix {Rl, Tl} to the left view point cloud for change, and applying a rigid change matrix {Rr, Tr} to the right view point cloud for change, and based on a K-means clustering algorithm, k=2, dividing the left view point cloud into different clusters, based on a K-means clustering algorithm, k=2, dividing the right view point cloud into different clusters, the clustered point cloud: left-left is set as label 1, the clustered point cloud: left-right is set as label 2, the clustered point cloud: right-left is set as label 3, and the clustered point cloud: right-right is set as label 4; selecting each clustered sheep leg bottom point cloud as a seed region, projecting the seed point to the XY plane by using a projection method, then calculating the Euclidean distance between all pairs of points, and finding the maximum value as the maximum width of the seed region; applying a region growing method to grow directionally by layer-by-layer scanning, and in the directional growing process, projecting the points in the growing region to the XY plane by using a projection method, then calculating the Euclidean distance between all pairs of points, and finding the maximum value as the width of the current growing region. For labels 1 and 3, the maximum Euclidean distance of the point cloud from left to right is calculated, and for labels 2 and 4, the maximum Euclidean distance of the point cloud from right to left is calculated, and whether the maximum width exceeds the set maximum width, whether the maximum directional growing distance exceeds the set maximum directional growing distance, whether the change rate of the current width and the last growing width exceeds the set change rate threshold, and whether the current width and the maximum width of the seed region exceed the set maximum projection width threshold are judged, and if one of the above exceeds the set threshold, the growing is stopped, and three-dimensional point cloud segmentation of the leg and the body is performed, and if all of the above do not meet the set threshold, i.e., none of the above exceeds the set threshold, the step of obtaining the maximum width by using the projection method is returned to.
[0145] It should be noted that the above examples are only used for understanding the present application and do not constitute a limitation on the animal image segmentation method based on region growing of the present application, and more forms of simple transformation based on this technical concept are within the protection scope of the present application.
[0146] The present application also provides an animal image segmentation device based on region growing, please refer to Figure 8 , the animal image segmentation device based on region growing comprises:
[0147] The acquisition module 10 is used for acquiring filtered left view animal point cloud data and right view animal point cloud data;
[0148] The processing module 20 is used for performing rigid change and clustering processing on the filtered left view animal point cloud data and the right view animal point cloud data to obtain a seed region;
[0149] a growth module 30 configured to perform region-oriented growth on the seed region by layer-by-layer scanning of the seed region through a region growing method;
[0150] a control module 40 configured to control the seed region to stop growing according to a preset stop growing rule, to obtain point cloud data in the growth region;
[0151] a segmentation module 50 configured to complete animal image segmentation based on the point cloud data in the growth region.
[0152] The animal image segmentation device based on region growing provided in the application adopts the animal image segmentation method based on region growing in the above embodiment, and can solve the technical problem that animal segmentation is not accurate enough. Compared with the prior art, the animal image segmentation device based on region growing provided in the application has the same beneficial effects as the animal image segmentation method based on region growing provided in the above embodiment, and other technical features in the animal image segmentation device based on region growing are the same as the features disclosed in the above embodiment method, and will not be repeated here.
[0153] The application provides an electronic device, which comprises at least one processor and a memory connected with the at least one processor; the memory stores instructions executable by the at least one processor, and the instructions are executed by the at least one processor to enable the at least one processor to execute the animal image segmentation method based on region growing in the above embodiment one.
[0154] Reference will be made to the following description of the drawings Figure 9 which shows a structural schematic diagram of an electronic device suitable for implementing the embodiments of the application. The electronic device in the embodiments of the application can include but is not limited to mobile terminals such as mobile phones, notebook computers, digital broadcast receivers, PDAs (Personal Digital Assistant, personal digital assistants), PADs (Portable Application Description, tablet computers), PMPs (Portable Media Player, portable multimedia players), vehicle terminals (such as vehicle navigation terminals), and the like, and fixed terminals such as digital TVs, desktop computers, and the like. Figure 9 The electronic device shown is only an example, and should not impose any limitation on the functions and use range of the embodiments of the application.
[0155] As Figure 9As shown, the electronic device can include a processing device 1001 (e.g., a central processor, a graphics processor, etc.) that can perform various appropriate actions and processes according to programs stored in a ROM (Read Only Memory) 1002 or loaded into a RAM (Random Access Memory) 1004 from a storage device 1003. Various programs and data required for operation of the electronic device are also stored in the RAM 1004. The processing device 1001, the ROM 1002, and the RAM 1004 are connected to each other through a bus 1005. An input / output (I / O) interface 1006 is also connected to the bus. Generally, the following systems can be connected to the I / O interface 1006: input devices 1007 including, for example, a touch screen, a touch pad, a keyboard, a mouse, an image sensor, a microphone, an accelerometer, a gyroscope, etc.; output devices 1008 including, for example, an LCD (Liquid Crystal Display), a speaker, a vibrator, etc.; the storage device 1003 including, for example, a magnetic tape, a hard disk, etc.; and a communication device 1009. The communication device 1009 can allow the electronic device to communicate wirelessly or wired with other devices to exchange data. Although the electronic device with various systems is shown in the figure, it should be understood that all the shown systems are not required to be implemented or possessed. More or less systems can be alternatively implemented or possessed.
[0156] In particular, according to embodiments of the present disclosure, the processes described above with reference to the flowcharts can be implemented as a computer software program. For example, embodiments of the present disclosure include a computer program product comprising a computer program carried on a computer readable medium, the computer program containing program code for performing the methods shown in the flowcharts. In such embodiments, the computer program can be downloaded and installed from a network through the communication device, or installed from the storage device 1003, or installed from the ROM 1002. When the computer program is executed by the processing device 1001, the above-mentioned functions defined in the methods of embodiments of the present disclosure are performed.
[0157] The electronic device provided by the present application adopts the animal image segmentation method based on region growing in the above-mentioned embodiments, which can solve the technical problem of inaccurate animal segmentation. Compared with the prior art, the electronic device provided by the present application has the same beneficial effects as the animal image segmentation method based on region growing provided by the above-mentioned embodiments, and other technical features in the electronic device are the same as the features disclosed in the previous embodiment method, which will not be repeated here.
[0158] It should be understood that various aspects of the disclosure can be implemented in hardware, software, firmware, or a combination thereof. In the description of the above embodiments, specific features, structures, materials or characteristics can be combined in any appropriate manner in any one or more embodiments or examples.
[0159] The above description is merely illustrative of the application and is not intended to limit the scope of the application. Any variations and modifications that can be made by any person skilled in the art within the spirit and scope of the application are intended to be encompassed by the application. Therefore, the scope of the application should be determined by the appended claims.
[0160] The application provides a computer readable storage medium having stored thereon computer readable program instructions (i.e., computer programs) for performing the animal image segmentation method based on region growing in the above embodiments.
[0161] The computer readable storage medium provided by the application may, for example, be a U disk, but is not limited to an electric, magnetic, optical, electromagnetic, infrared, or semiconductor system, system, or device, or any combination thereof. More specific examples of the computer readable storage medium can include, but are not limited to, an electric connection with one or more conductive wires, a portable computer disk, a hard disk, a RAM (Random Access Memory), a ROM (Read Only Memory), an EPROM (Erasable Programmable Read Only Memory or flash memory), an optical fiber, a CD-ROM (CD-Read Only Memory), an optical storage device, a magnetic storage device, or any appropriate combination thereof. In the present embodiment, the computer readable storage medium can be any tangible medium containing or storing a program that can be used by or in conjunction with an instruction execution system, system, or device. The program code contained on the computer readable storage medium can be transmitted by any appropriate medium, including but not limited to an electric wire, an optical cable, an RF (Radio Frequency), etc., or any appropriate combination thereof.
[0162] The above computer readable storage medium can be contained in an electronic device; or can exist separately without being assembled into an electronic device.
[0163] The computer readable storage medium described above carries one or more programs, when the one or more programs are executed by the electronic device, cause the electronic device to: acquire filtered left view animal point cloud data and right view animal point cloud data; perform rigid transformation and clustering processing on the filtered left view animal point cloud data and the right view animal point cloud data to obtain a seed region; perform layer-by-layer region-oriented growth on the seed region by a region growing method; control the seed region to stop growing according to a preset stop growing rule to obtain point cloud data in a growth region; and complete animal image segmentation based on the point cloud data in the growth region.
[0164] Computer program code for carrying out operations of the present application can be written in any combination of one or more programming languages, including an object oriented programming language such as Java, Smalltalk, C++ or the like and conventional procedural programming languages, such as the "C" programming language or similar programming languages. The program code can execute entirely on the user's computer, partly on the user's computer, as a stand-alone software package, partly on the user's computer and partly on a remote computer or entirely on the remote computer or server. In the latter scenario, the remote computer can be connected to the user's computer through any type of network, including a local area network (LAN) or a wide area network (WAN), or the connection can be made to an external computer (for example, through the Internet using an Internet Service Provider).
[0165] The computer program instructions can also be loaded onto a computer or other programmable information processing apparatus to cause a series of operations to be performed on the computer or other programmable information processing apparatus to produce a computer implemented process such that the instructions which execute on the computer or other programmable information processing apparatus implement the functions / acts specified in the flowchart and / or block diagram block or blocks.
[0166] The modules described in the embodiments of the present application can be implemented in the form of software or in the form of hardware. In some cases, the names of the modules do not constitute a limitation on the modules themselves.
[0167] The readable storage medium provided by the present application is a computer readable storage medium, which stores computer readable program instructions (i.e., a computer program) for executing the animal image segmentation method based on region growing described above, and can solve the technical problem of inaccurate animal segmentation. Compared with the prior art, the computer readable storage medium provided by the present application has the same beneficial effects as the animal image segmentation method based on region growing provided by the above embodiments, and will not be described here.
[0168] The present application also provides a computer program product comprising a computer program, which, when executed by a processor, implements the steps of the animal image segmentation method based on region growing as described above.
[0169] The computer program product provided by the present application can solve the technical problem of inaccurate animal segmentation. Compared with the prior art, the computer program product provided by the present application has the same beneficial effects as the animal image segmentation method based on region growing provided by the above embodiments, and will not be described here.
[0170] The above only describes some embodiments of the present application, and does not limit the patent scope of the present application. Any equivalent structural transformation, direct / indirect application in other related technical fields based on the technical concept of the present application, and the contents of the present application and the accompanying drawings are included in the patent protection scope of the present application.
Claims
1. A method for animal image segmentation based on region growing, characterized in that, The region-growing-based animal image segmentation method includes: Obtain the filtered animal point cloud data for the left and right views; The filtered left-view animal point cloud data and right-view animal point cloud data are subjected to rigid transformation and clustering processing to obtain seed regions. The seed region is subjected to region-oriented growth by scanning layer by layer using the region growth method; The seed region is controlled to stop growing according to a preset stop growth rule, and point cloud data within the growth region is obtained; Animal image segmentation is performed based on point cloud data within the growth region; The step of controlling the seed region to stop growing according to a preset stopping growth rule to obtain point cloud data within the growth region includes: The points in the growth region are projected onto a two-dimensional plane using a projection method, and the Euclidean distance between pairs of points in the first left view point cloud, the second left view point cloud, the first right view point cloud, and the second right view point cloud in the seed region on the two-dimensional plane is calculated. The maximum Euclidean distance among the Euclidean distances is used as the maximum width of the seed region to obtain the maximum width of the current layer. Set the height threshold, maximum width threshold, maximum width change rate threshold, and maximum projection width threshold; The height threshold, the maximum width threshold, the maximum width change rate threshold, and the maximum projected width threshold are used as preset growth stop rules; Obtain the current growth distance of the seed region for directional growth, the maximum projection width of the current scanned layer, and the historical maximum width of the previous iteration, and calculate the rate of change of the maximum projection width based on the maximum width and the historical maximum width; Based on the current growth distance, the maximum projection width of the current scanned layer, the rate of change of the maximum projection width, and at least one of the height threshold, the maximum width threshold, the maximum width rate of change threshold, and the maximum projection width threshold, the seed region is controlled to stop growing, thereby obtaining point cloud data within the growth region.
2. The method as described in claim 1, characterized in that, The step of performing layer-by-layer scanning of the seed region using the region growth method for region-oriented growth includes: The growth radius is set using the region growth method and point cloud density; Construct a binary tree for the points in the seed region based on the growth radius; The binary tree is controlled to perform directional growth of the region by scanning layer by layer along the vertical axis.
3. The method as described in claim 1, characterized in that, The step of controlling the seed region to stop growing based on at least one of the current growth distance, the maximum projection width of the current scanned layer, the rate of change of the maximum projection width, the height threshold, the maximum width threshold, the maximum width change rate threshold, and the maximum projection width threshold, to obtain point cloud data within the growth region includes: Detect whether the current growth distance is greater than or equal to the height threshold, whether the current growth distance is greater than or equal to the maximum width threshold, whether the rate of change of the maximum projection width is greater than or equal to the maximum width change rate threshold, and whether the maximum projection width is greater than or equal to the maximum projection width threshold; When any one of the following conditions is met—that the current growth distance is greater than or equal to the height threshold, the current growth distance is greater than or equal to the maximum width, the rate of change of the maximum projection width is greater than or equal to the maximum width change rate threshold, and the maximum projection width is greater than or equal to the maximum projection width threshold—the seed region is controlled to stop growing, and point cloud data within the growth region is obtained.
4. The method as described in claim 1, characterized in that, The step of performing rigid transformation and clustering processing on the filtered left-view animal point cloud data and right-view animal point cloud data to obtain seed regions includes: Obtain the rigidity transformation matrix; The filtered left-view animal point cloud data and right-view animal point cloud data are rotated and translated from different perspectives using the rigid transformation matrix to obtain preprocessed left-view animal point cloud data and preprocessed right-view animal point cloud data. Clustering algorithms were used to cluster the preprocessed left-view animal point cloud data and the preprocessed right-view animal point cloud data respectively, resulting in the clustered first left-view point cloud, second left-view point cloud, first right-view point cloud and second right-view point cloud. A seed region is obtained based on the first left view point cloud, the second left view point cloud, the first right view point cloud, and the second right view point cloud.
5. The method as described in claim 4, characterized in that, The step of obtaining the seed region based on the first left view point cloud, the second left view point cloud, the first right view point cloud, and the second right view point cloud includes: Get the set height threshold; The points in the first left view point cloud, the second left view point cloud, the first right view point cloud, and the second right view point cloud are filtered using the height threshold. Points in the first left view point cloud, the second left view point cloud, the first right view point cloud, and the second right view point cloud that are higher than the height threshold are used as seed regions.
6. The method as described in claim 1, characterized in that, The steps for completing animal image segmentation based on point cloud data within the growth region include: Point cloud data of the animal's leg is obtained based on the point cloud data within the growth area; The point cloud data of the animal's leg and the point cloud data of the top view are merged to obtain the segmented point cloud data. Animal image segmentation is performed based on the segmented point cloud data.
7. An animal image segmentation device based on region growing, characterized in that, The device includes: The acquisition module is used to acquire the filtered animal point cloud data in the left and right views. The processing module is used to perform rigid transformation and clustering processing on the filtered left-view animal point cloud data and the right-view animal point cloud data to obtain seed regions; The growth module is used to perform region-oriented growth of the seed region by scanning layer by layer using the region growth method; The control module is used to control the seed region to stop growing according to a preset stop growth rule, and to obtain point cloud data within the growth region; The segmentation module is used to segment animal images based on point cloud data within the growth region; The step of controlling the seed region to stop growing according to a preset stopping growth rule to obtain point cloud data within the growth region includes: The points in the growth region are projected onto a two-dimensional plane using a projection method, and the Euclidean distance between pairs of points in the first left view point cloud, the second left view point cloud, the first right view point cloud, and the second right view point cloud in the seed region on the two-dimensional plane is calculated. The maximum Euclidean distance among the Euclidean distances is used as the maximum width of the seed region to obtain the maximum width of the current layer. Set the height threshold, maximum width threshold, maximum width change rate threshold, and maximum projection width threshold; The height threshold, the maximum width threshold, the maximum width change rate threshold, and the maximum projected width threshold are used as preset growth stop rules; Obtain the current growth distance of the seed region for directional growth, the maximum projection width of the current scanned layer, and the historical maximum width of the previous iteration, and calculate the rate of change of the maximum projection width based on the maximum width and the historical maximum width; Based on the current growth distance, the maximum projection width of the current scanned layer, the rate of change of the maximum projection width, and at least one of the height threshold, the maximum width threshold, the maximum width rate of change threshold, and the maximum projection width threshold, the seed region is controlled to stop growing, thereby obtaining point cloud data within the growth region.
8. An electronic device, characterized in that, The device includes: a memory, a processor, and a computer program stored in the memory and executable on the processor, the computer program being configured to implement the steps of the region-growing-based animal image segmentation method as described in any one of claims 1 to 6.
9. A storage medium, characterized in that, The storage medium is a computer-readable storage medium, and a computer program is stored on the storage medium. When the computer program is executed by a processor, it implements the steps of the animal image segmentation method based on region growing as described in any one of claims 1 to 6.
Citation Information
Patent Citations
Single-plant tree point cloud automatic extraction method based on vehicle-mounted laser scanning data
CN105894044A