Method and device for bidirectional fault region segmentation of livestock point cloud
Through the bidirectional fault region segmentation method of livestock point cloud, the problem of low measurement accuracy of livestock body rulers in the prior art is solved, and higher adaptability and calculation results are achieved.
Patent Information
- Application Number
- CN202111168810.4
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2021-09-30
- Publication Date
- 2025-02-28
- Estimated Expiration
- 2041-09-30
AI Technical Summary
The prior art is susceptible to interference from animal posture and individual differences when measuring the parameters of livestock body rulers, resulting in low accuracy of calculation results.
The bidirectional fault region segmentation method of livestock point cloud is used to determine the main direction of point cloud data, build a coordinate system, and perform vertical and horizontal point cloud slice segmentation to determine the leg circumference and body ruler slice point cloud clusters.
This method can improve the accuracy of body ruler calculation without requiring domestic animals to maintain a strict straight posture, and overcome the interference of animal posture and individual differences.
Smart Images

Figure CN114022489B_ABST
Abstract
Description
Technical Field
[0001] The invention relates to the field of image processing, and in particular to a method and a device for segmenting a livestock point cloud bidirectional fault region. Background Art
[0002] In animal husbandry, the body size parameters of animals can be used to estimate their growth status, calculate feed conversion efficiency, predict animal welfare and economic indicators such as production, and conduct differentiated feeding of livestock animals accordingly to achieve the best economic benefits and animal welfare. In addition, the body size of animals is an important phenotypic data of genetic breeding results, which is of great significance to the assessment of heritability and genetic value.
[0003] Contact-based manual body measurement of large animals is difficult and time-consuming, and the measurement results are easily seriously disturbed by factors such as the animal's body swing, the actual position of the tape measure and the error in the reading. It also causes great pressure and stress to the animals. Studies have shown that manual weighing of live pigs will significantly reduce their feed intake, proving that the contact measurement process interferes with the animals and seriously affects their growth process.
[0004] In the calculation of animal body size based on point cloud after 3D reconstruction, the current method is based on the recognition of "point" position, such as locating the chest circumference cutting point through the extreme point of the pig spine curve, calculating the body length parameters of cows and pigs through the root point of the cow's tail, etc. The method of calculating animal body size parameters by point determination is easily affected by the animal's posture and individual differences, which makes the accuracy of the calculation result low. Summary of the invention
[0005] In view of the problems existing in the prior art, considering that "regional" segmentation of animal point clouds can solve this problem, the present invention provides a method and device for bidirectional fault region segmentation of livestock point clouds.
[0006] The present invention provides a method for segmenting a livestock point cloud bidirectional fault region, comprising: determining the main direction of livestock point cloud data, and constructing a coordinate system for the point cloud data; performing point cloud slicing segmentation in a vertical coordinate direction on the livestock point cloud data, and determining a leg circumference slice interval of interest; extracting clustering results of all points of each slice for a plurality of slice point clouds within the leg circumference slice interval of interest, and determining a leg circumference effective slice according to the clustering result; performing a coordinate system secondary reconstruction according to positional features of the leg circumference effective slice, and performing lateral point cloud slicing segmentation according to the secondary reconstructed point cloud data, and determining a body size slice point cloud cluster.
[0007] According to a method for bidirectional fault region segmentation of livestock point clouds according to an embodiment of the present invention, the main direction of livestock point cloud data is determined and a coordinate system is constructed for the point cloud data, including: projecting the point cloud onto the ground plane in the direction of the ground normal vector; extracting the covariance matrix, eigenvalues and eigenvectors of the projected point cloud, and determining the main direction through principal component analysis; generating a rotation matrix based on the main direction and constructing a coordinate system for the point cloud data.
[0008] According to an embodiment of the present invention, a method for bidirectional fault region segmentation of a livestock point cloud is provided, wherein the livestock point cloud data is segmented in the vertical coordinate direction and the slice interval of interest of the leg circumference slice is determined, including: extracting the fault slice point cloud clusters at preset intervals along the ground normal vector direction, and counting the number of points in each point cloud cluster from bottom to top in turn to generate a probability density function of the number of points in the point cloud cluster; performing polynomial fitting on the probability density function to obtain a fitting function, and determining a plurality of maximum points based on the fitting function; dividing the fitting function into a plurality of closed intervals based on the plurality of maximum points, and determining the slice interval of interest of the leg circumference slice from the plurality of closed intervals.
[0009] According to a method for bidirectional fault region segmentation of livestock point clouds according to an embodiment of the present invention, determining the leg circumference slice interval of interest from multiple closed intervals includes: extracting characteristic parameters of each interval according to the position and domain and range attributes of each interval, the characteristic parameters including domain proportion, range proportion, interval position parameters and extreme point slope; inputting the extracted characteristic parameters into a preset logistic regression model, and outputting the result of whether each interval is an interval of interest; wherein the logistic regression model is obtained by training with labeled samples.
[0010] According to a method for bidirectional fault region segmentation of livestock point clouds according to an embodiment of the present invention, for multiple slice point clouds within the slice interval of interest of the leg circumference, clustering results of all points in each slice are extracted, and effective slices of the leg circumference are determined according to the clustering results, including: for the point cloud data of the slice interval of interest of the leg circumference, multiple point cloud clusters are cut perpendicular to the vertical coordinate z; all points of each point cloud cluster are projected on the xy plane; for the projected leg point cloud clusters, all points are clustered by the DBSCAN algorithm, and candidate slices with a cluster number of 4 or 5 are retained; and effective slices of the leg circumference are selected from the candidate slices with a cluster number of 4 or 5.
[0011] According to a livestock point cloud bidirectional fault region segmentation method according to an embodiment of the present invention, selecting effective slices of leg circumference from the candidate slices with a cluster number of 4 or 5 includes: performing feature extraction on the candidate slices with a cluster number of 4 or 5, inputting a preset second logistic regression model, outputting a leg circumference slice evaluation index for each candidate slice, and determining effective slices of leg circumference based on the leg circumference slice evaluation index; wherein the second logistic regression model is obtained by training with samples of known leg circumference effective slice evaluation indexes.
[0012] According to an embodiment of the present invention, a method for bidirectional fault region segmentation of a livestock point cloud is provided, wherein the method performs transverse point cloud slicing segmentation based on the secondary reconstructed point cloud data to determine the body size slice point cloud cluster, including: extracting the fault slice point cloud cluster at a preset interval along the main direction, and sequentially counting the maximum span values of the z coordinates of all points in each point cloud cluster from back to front to generate a span value distribution function of the vertical height of the point cloud cluster; performing polynomial fitting on the span value distribution function to obtain a second fitting function, and determining all maximum value points based on the second fitting function; and segmenting the point cloud based on the positional features of the maximum value points and the leg circumference effective slices to determine the body size slice point cloud cluster.
[0013] The present invention also provides a livestock point cloud bidirectional fault region segmentation device, comprising: a coordinate construction module, used to determine the main direction of livestock point cloud data, and construct a coordinate system for the point cloud data; a region extraction module, used to perform point cloud slicing segmentation on the livestock point cloud data in the vertical coordinate direction, and determine the slice interval of interest of the leg circumference slice; a first determination module, used to extract the clustering results of all points of each slice for multiple slice point clouds within the slice interval of interest of the leg circumference, and determine the effective slice of the leg circumference according to the clustering results; a second determination module, used to perform secondary reconstruction of the coordinate system according to the position characteristics of the effective slice of the leg circumference, and perform horizontal point cloud slicing segmentation according to the point cloud data after the secondary reconstruction, and determine the body size slice point cloud cluster.
[0014] The present invention also provides an electronic device, comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein when the processor executes the program, the steps of any of the above-mentioned methods for bidirectional fault area segmentation of livestock point clouds are implemented.
[0015] The present invention also provides a non-transitory computer-readable storage medium having a computer program stored thereon, which, when executed by a processor, implements the steps of any of the above-mentioned methods for bidirectional fault region segmentation of livestock point clouds.
[0016] The livestock point cloud bidirectional fault region segmentation method and device provided by the present invention overcome the influence of the posture of cattle and pigs on the body size calculation to a certain extent, do not require cattle and pigs to maintain a strictly straight posture, have higher adaptability, are not easily affected by the posture of animals and individual differences, and thus the calculation results are more accurate. BRIEF DESCRIPTION OF THE DRAWINGS
[0017] In order to more clearly illustrate the technical solutions in the present invention or the prior art, the following briefly introduces the drawings required for use in the embodiments or the description of the prior art. Obviously, the drawings described below are some embodiments of the present invention. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying creative work.
[0018] Figure 1 It is a schematic flow chart of the method for bidirectional fault region segmentation of livestock point cloud provided by the present invention;
[0019] Figure 2 It is a schematic diagram of the projection point cloud of a cow and a pig after the coordinate system is calibrated provided by the present invention;
[0020] Figure 3 It is a schematic diagram of secondary reconstruction of the coordinate system provided by the present invention;
[0021] Figure 4 It is a probability density function distribution diagram of a longitudinal slice point cloud cluster provided by the present invention;
[0022] Figure 5 It is a schematic diagram of the clustering results of the point cloud slices of the cow and pig legs provided by the present invention;
[0023] Figure 6 It is a vertical height function distribution diagram of the transverse cutting point cloud cluster provided by the present invention;
[0024] Figure 7 It is a schematic diagram of the width extraction result of the rectangular bounding box of the horizontal point cloud slice provided by the present invention;
[0025] Figure 8 It is a structural schematic diagram of the livestock point cloud bidirectional fault region segmentation device provided by the present invention;
[0026] Fig. 9 It is a structural schematic diagram of the electronic device provided by the present invention. DETAILED DESCRIPTION
[0027] In order to make the purpose, technical solution and advantages of the present invention clearer, the technical solution of the present invention will be clearly and completely described below in conjunction with the drawings of the present invention. Obviously, the described embodiments are part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of the present invention.
[0028] "Point cloud region" has richer semantic information than "point" feature or "line" feature. In order to achieve accurate measurement of the body size of livestock such as cattle and pigs, and overcome the influence of different postures of livestock such as cattle and pigs on the measurement results, the present invention extracts "point cloud region" as the core operator and proposes a livestock point cloud segmentation method "based on bidirectional tomographic slicing". The present invention is explained by taking livestock such as pigs and cattle as examples, but it can also be applied to other animals with similar body shapes to livestock, such as wild boars and hippos.
[0029] Combine the following Figure 1-Figure 9 The present invention describes a method and device for bidirectional fault region segmentation of livestock point clouds. Figure 1 FIG. 1 is a flow chart of the method for bidirectional fault region segmentation of livestock point cloud provided by the present invention. Figure 1 As shown, the present invention provides a method for segmenting livestock point cloud bidirectional fault regions, comprising:
[0030] 101. Determine the main direction of the livestock point cloud data, and construct a coordinate system for the point cloud data.
[0031] In order to overcome the interference of the non-uniformity of livestock three-dimensional point clouds on the identification of the main direction, it is necessary to determine the main direction of the point cloud data and construct a coordinate system for calculation.
[0032] In one embodiment, the method of determining the main direction of livestock point cloud data and constructing a coordinate system for the point cloud data includes: projecting the point cloud on the ground plane in the direction of the ground normal vector; extracting the covariance matrix, eigenvalues and eigenvectors of the projected point cloud, and determining the main direction through principal component analysis; generating a rotation matrix based on the main direction, and constructing a coordinate system for the point cloud data.
[0033] For example, first select the ground normal vector M as the z-axis, perform a planar projection on the livestock point cloud in this direction, extract the covariance matrix, eigenvalues and eigenvectors of the projected point cloud, and use the PCA algorithm to obtain its main direction. Based on this standard, a rotation matrix is generated to determine the coordinate system of the point cloud data. The results are as follows: Figure 2 shown.
[0034] 102. Perform vertical coordinate point cloud segmentation on the livestock point cloud data to determine the interesting segment interval of the leg circumference segment.
[0035] Livestock "point cloud slice" refers to the point cloud clusters extracted continuously by tomography of livestock point clouds along a certain coordinate axis. The longitudinal slice point cloud cluster Vl i Defined as formula (1), the horizontal slice point cloud cluster Sl i It is defined as formula (2).
[0036] V i ={p j |p j .z∈(i-δ,i+δ)} (1)
[0037] S i ={p j |p j .y∈(i-δ,i+δ)} (2)
[0038] Among them, p i represents the point in the livestock point cloud, p j .z represents the z coordinate value of a point, p j .y represents the y coordinate value of a point, i is the point cloud cluster number, i is not less than δ, and δ is the slice width.
[0039] The leg circumference slice interval of interest is the range interval where the leg circumference valid slices are located.
[0040] 103. Divide the point cloud data of the slice interval of interest of the leg circumference into multiple slices, and determine the valid slice of the leg circumference according to the clustering result of each slice.
[0041] After the interval of interest is determined, the effective slice is further accurately positioned. The effective slice is a slice that can be used to determine the leg circumference, which can be determined according to the leg circumference measurement position of different types of livestock. The present invention selects from multiple slices of the leg circumference slice interval of interest according to the clustering method.
[0042] 104. The coordinate system is reconstructed according to the position characteristics of the effective slices of the leg circumference, and the horizontal point cloud slices are segmented according to the point cloud data after the secondary reconstruction to determine the body size slice point cloud cluster.
[0043] Specifically, the portion below the effective slice of the leg circumference may be cut off, and the portion of the effective slice of the leg circumference in the direction of the head and neck may be cut off, and then the coordinate system of the remaining portion may be reconstructed.
[0044] For example, according to the edge position of the leg circumference effective slice, the part below the leg circumference effective slice is horizontally truncated, and the head and neck of the animal point cloud are removed by vertical truncation. Then, the remaining point cloud is projected on the xy plane, and the covariance matrix, eigenvalue and eigenvector of the projected point cloud are extracted. The main direction is obtained through the PCA algorithm, and the rotation matrix is generated based on this standard to reconstruct the coordinate system of the point cloud data. Then, the horizontal point cloud slice is segmented to determine the body size slice point cloud cluster.
[0045] The livestock point cloud bidirectional fault region segmentation method provided by the present invention overcomes the influence of the posture of cattle and pigs on the body size calculation to a certain extent, does not require cattle and pigs to maintain a strictly straight posture, has higher adaptability, is not easily affected by the posture of animals and individual differences, and thus the calculation result has a higher accuracy.
[0046] In one embodiment, the livestock point cloud data is sliced and segmented in the vertical coordinate direction to determine the interesting slice interval of the leg circumference slice, including: extracting fault slice point cloud clusters at preset intervals along the ground normal vector direction, and counting the number of points in each point cloud cluster from bottom to top to generate a probability density function of the number of points in the point cloud cluster; performing polynomial fitting on the probability density function to obtain a fitting function, and determining a plurality of maximum points based on the fitting function; dividing the fitting function into a plurality of closed intervals based on the plurality of maximum points, and determining the interesting slice interval of the leg circumference slice from the plurality of closed intervals.
[0047] The point cloud clusters of livestock slices are extracted layer by layer at intervals of 2 mm along the z-axis. When δ = 5, the number of points in each point cloud cluster is counted in ascending order along the z-axis, and the probability density function distribution diagram of the point cloud cluster points is drawn. In particular, in order to adapt to the different directions of livestock travel, the cluster sequence with the highest number of points is extracted first. This position divides the cluster sequence into two groups, and the side with more points is specified as the starting point of the cluster sequence. The high-order polynomial regression is used to obtain Figure 4 The curve in the middle of the waveform is plotted and the maximum point of the fitting function is identified and marked as a black circle.
[0048] The present invention determines that the best livestock leg cutting point is the midpoint of the interval formed by the slice at the midpoint of the livestock leg to the slice at the connection between the livestock body and the leg. Figure 4 -The secant line T in the middle right is shown. The interval where the cutting point is located is the interval of interest that needs to be located, such as Figure 4 The interval between points AB in the middle. According to the distribution of the maximum points, the fitting function is divided into several closed intervals, and the closed interval containing the best leg slice point cloud cluster is defined as the interval of interest (ROI_FC). When the slice position moves from the livestock leg to the livestock chest and abdomen, the number of tomographic slice points increases rapidly, which can be used to determine the slice interval of interest for the leg circumference slice.
[0049] In one embodiment, the determining of the interesting slice intervals of the leg circumference slices from the multiple closed intervals includes: extracting characteristic parameters of each interval according to the position and domain and range attributes of each interval, wherein the characteristic parameters include the domain proportion, the range proportion, the interval position parameter and the extreme point slope; inputting the extracted characteristic parameters into a preset logistic regression model, and outputting the result of whether each interval is an interesting interval; wherein the logistic regression model is obtained after training with samples with labels, such as obtained after training with samples with interesting intervals and non-interesting intervals as labels.
[0050] Specifically, in order to accurately identify ROI_FC, the following features are extracted for each closed interval:
[0051] Df=Wid / Xa (3)
[0052] Vf=|Var-Val| / Ya (4)
[0053]
[0054] Md=(Var-Val) / Wid (6)
[0055] For livestock point clouds, Xa represents the entire domain range of the probability density function of the slice point cloud cluster, Ya represents the range of the entire value range of the fitting function, Df is the domain ratio, Vf is the value range ratio, Wid is the domain width of the interval, Var and Val are the values of the two extreme points of the interval at the Y coordinate, Mf is the interval position parameter, Md is the extreme point slope, and Ran is the horizontal coordinate value of the extreme point on the left side (close to the X-axis side) of each interval. In order to quantify the characteristics of the research area, 20 three-dimensional point clouds of livestock were selected and their probability density distribution maps were extracted. A total of 100 closed intervals were obtained by extreme point segmentation in the 20 livestock point clouds, of which 20 were intervals of interest. For each interval, four features such as Df, Vf, Mf, and Md were extracted to obtain the characteristic distribution of sensitive intervals and non-sensitive intervals.
[0056] There are significant differences in the distribution quantiles of the Df, Vf, Mf, and Md characteristics between the intervals of interest and the intervals of non-interest, but there is still a large overlap, and it is difficult to effectively separate the sensitive intervals from the non-sensitive intervals by using a fixed threshold.
[0057] The present invention marks the interval of interest as "1" and the interval of no interest as "0", and then performs fitting analysis based on the Logistic regression model through the gradient ascent optimal parameter method, with a step size of 0.0001 and 5000 rounds of training to obtain the fitting result as shown in Formula 7, where Y is the regression data result of the label.
[0058] Y=-3.29979+14.5581*Df+11.2511*Vf+2.3044*Mf-14.3124*Md (7)
[0059] In one embodiment, the clustering results of all points in each slice of the multiple slice point clouds in the slice interval of interest of the leg circumference are extracted, and the valid slice of the leg circumference is determined according to the clustering results, including: for the point cloud data of the slice interval of interest of the leg circumference, multiple point cloud clusters are cut perpendicular to the vertical coordinate z; all points of each point cloud cluster are projected on the xy plane; for the projected leg point cloud clusters, all points are clustered by the DBSCAN algorithm, and candidate slices with a cluster number of 4 or 5 are retained; and a valid slice of the leg circumference is selected from the candidate slices with a cluster number of 4 or 5.
[0060] In one embodiment, selecting a valid slice of the leg circumference from the candidate slices whose cluster number is 4 or 5 includes: performing feature extraction on the candidate slices whose cluster number is 4 or 5, inputting a preset second logistic regression model, outputting a leg circumference slice evaluation index of each candidate slice, and determining a valid slice of the leg circumference according to the leg circumference slice evaluation index; wherein the second logistic regression model is obtained after training with samples of known leg circumference valid slice evaluation indexes.
[0061] In order to accurately identify the best effective tomographic slice within the interval of interest, this paper proposes a discrimination algorithm based on the leg circumference slice evaluation index PoL.
[0062] For example, within the ROI_FC where all livestock point clouds have been extracted, multiple point cloud clusters VI are cut out. i All points are projected on the xy plane. For the projected livestock leg point cloud slices, all points are clustered using the DBSCAN algorithm. For example, 17 is used as the point clustering lower limit (minPts) and 39 is used as the clustering radius (Epsilon). Some clustering results generated in the experiment are shown below. Figure 5 As shown. (The vertical direction is the x-axis, and the horizontal direction is the y-axis)
[0063] Figure 5Slices (1), (2), and (3) are acceptable valid point cloud slices, and the cut point is within the livestock's legs. In particular, in point cloud slice (1), an additional cluster is caused by the drooping hair on the livestock's abdomen, but it does not affect the position recognition and leg circumference calculation effect, so it is marked as a valid point cloud slice; (4), (5), and (6) are invalid point cloud slices. For example, slice (4) cuts the livestock's body part instead of the leg, and slice (5) is too close to the base of the livestock's leg, resulting in point cloud adhesion. At the same time, the slice position contacts the livestock's abdomen. Slice (6) has some point data missing due to improper cutting position, and cannot reflect the leg circumference. Such cases are marked as invalid point cloud slices.
[0064] In order to effectively identify valid point cloud slices, only candidate slices with cluster numbers of 4 or 5 are retained, and other slices are directly marked as invalid slices. For slices with a cluster number of 5, the cluster closest to the centroid of the overall point cloud is deleted, and the remaining 4 clusters are retained for subsequent processing.
[0065] Experimental data show that the number of cluster points and cluster diameters between clusters of valid slice point clouds are similar, the number of unclustered points in the slice is small, and the centroid coordinates of each cluster cluster are symmetrical, and the clustering effect is good. In view of the above characteristics, this paper extracts the inter-cluster point number variation coefficient Nc, inter-cluster maximum radius variation coefficient Dc, inter-cluster symmetry index Si, unclustered point number Nk, cluster confidence index Ch index and other features for each point cloud slice. The relevant features are defined as:
[0066]
[0067]
[0068]
[0069] Where Ni and Di represent the number of points and diameter of each point cloud cluster, respectively; Xi represents the x-coordinate value of the center point of the x-coordinate span range in each point cloud cluster. Represents the average number of points and average diameter of all point cloud clusters in the slice. It represents the mean x-coordinate of the center point of the x-coordinate span range of all points in the slice, and L represents the span distance covered by the x-coordinates of all points.
[0070] The clustering confidence index is defined based on the Calinski-Harabaz index. It is generated by calculating the relationship between the intra-class variance and the inter-class variance and the number of points. The value is positively correlated with the clustering effect. The index calculation is shown in Formula 12-14.
[0071]
[0072] In the formula, B k is the inter-class discrete matrix:
[0073]
[0074] W k is the intra-class discrete matrix
[0075]
[0076] K is the number of clusters, q is the cluster number, and N is the total number of sample points.
[0077] n q represents the number of sample points in cluster q, c q Represents all sample points in cluster q.
[0078] C q represents the center point of cluster q, and c represents the center point of all data.
[0079] Based on the above characteristics, the present invention is based on the Logistic regression model, combined with manual labels, and the gradient ascent optimal parameter method is used to perform fitting analysis, and the regression result K is obtained as follows:
[0080] K=10.86-16.38*Nc-0.39*Nk-33.4*Dc+0.23*Ch-13.314*Si (14) Determine the leg circumference slice evaluation index based on K:
[0081]
[0082] Then, the coordinate system is reconstructed based on the point cloud of the effective leg circumference slice, as follows:
[0083] The y coordinates of the centroid points of the four point cloud clusters in the effective leg circumference slice are denoted as Y1, Y2, Y3, and Y4, respectively.
[0084] Y1, Y2, Y3, and Y4 were then sorted by the y-coordinate of the centroid. The two clusters with the smallest coordinates were merged into the front leg region (region B), and the two clusters with the largest coordinates were merged into the hind leg region (region A). The boundary with the smallest y-coordinate in region B (left boundary) was used as the cutting plane to segment the head, neck, and trunk of the animal.
[0085] After removing the head and neck of the animal point cloud, the remaining point cloud is projected on the xy plane, and the covariance matrix, eigenvalues and eigenvectors of the projected point cloud are extracted. The main direction is obtained through the PCA algorithm, and the rotation matrix is generated based on this standard to reconstruct the coordinate system of the point cloud data. The secondary reconstruction result is as follows: Figure 3 Shown on the right. Figure 3 The left direction is the y-axis and the top direction is the x-axis.
[0086] In one embodiment, the method of performing transverse point cloud slicing segmentation according to the secondary reconstructed point cloud data to determine the body size slice point cloud cluster includes: extracting the tomographic slice point cloud cluster at a preset interval along the main direction, and counting the maximum span values of the z coordinates of all points in each point cloud cluster from back to front in order to generate a span value distribution function of the vertical height of the point cloud cluster; performing polynomial fitting on the span value distribution function to obtain a second fitting function, and determining all maximum value points according to the second fitting function; and segmenting the point cloud according to the position characteristics of the maximum value points and the leg circumference effective slices to obtain the body size slice point cloud cluster.
[0087] The main direction is horizontal. From the rear to the front of the livestock, the maximum span value of the z coordinates of all points in each point cloud cluster is counted in ascending order of the y axis. The vertical height span value distribution diagram of the point cloud cluster is drawn. The curve corresponding to the waveform in the figure is obtained through high-order polynomial regression, and the maximum value point of the fitting function is identified. The livestock point cloud is segmented based on the A and B intervals (the A and B intervals are determined according to the position characteristics of the effective slices of the leg circumference, and the corresponding position characteristics include the positions of the front and rear legs in the main direction, i.e., the y axis). Figure 6 shown.
[0088] It can be concluded from the figure that the base of the livestock legs is the key set feature for horizontal cutting of the livestock point cloud, the front edge of the base of the left and right front legs of the livestock is the key tangent separating the livestock body and head and neck, the rear edge of the base of the left and right front legs is the sensitive position for chest circumference calculation, and the rear edge of the base of the left and right hind legs is the area that needs attention for body length calculation. Therefore, the y-coordinate position feature of the effective leg circumference slice is used to horizontally segment the livestock point cloud. The right boundary of the B interval is the livestock head and neck slice position, the left boundary of the B interval is the livestock chest slice position, and in the middle area of the AB interval, the maximum point with the largest fitting function value is the livestock abdomen slice position (such as Figure 6 The black dotted line between area A and area B in the middle), all slices are 70 mm wide, and the slices at key locations (head and neck, chest, and abdomen) are projected as follows Figure 7 shown.
[0089] The livestock point cloud bidirectional fault region segmentation method provided in this embodiment overcomes the influence of livestock posture on body size calculation, does not require livestock to maintain a strictly straight posture, has higher adaptability, is not easily affected by animal posture and individual differences, and thus the calculation result has a higher accuracy.
[0090] The livestock point cloud bidirectional fault region segmentation device provided by the present invention is described below. The livestock point cloud bidirectional fault region segmentation device described below and the livestock point cloud bidirectional fault region segmentation method described above can be referenced to each other.
[0091] Figure 8 Schematic diagram of the structure of the livestock point cloud bidirectional fault region segmentation device provided by the present invention. Figure 8 As shown, the livestock point cloud bidirectional fault region segmentation device includes: a coordinate construction module 801, a region extraction module 802, a first determination module 803 and a second determination module 804. Among them, the coordinate construction module 801 is used to determine the main direction of the livestock point cloud data and construct a coordinate system for the point cloud data; the region extraction module 802 is used to perform vertical coordinate direction point cloud slicing segmentation on the livestock point cloud data and determine the slice interval of interest of the leg circumference slice; the first determination module 803 is used to extract the clustering results of all points of each slice for multiple slice point clouds within the slice interval of interest of the leg circumference, and determine the effective slice of the leg circumference according to the clustering results; the second determination module 804 is used to perform a secondary reconstruction of the coordinate system according to the position characteristics of the effective slice of the leg circumference, and perform a horizontal point cloud slicing segmentation according to the point cloud data after the secondary reconstruction, and determine the body size slice point cloud cluster.
[0092] The device embodiments provided in the embodiments of the present invention are for implementing the above-mentioned method embodiments. For specific processes and detailed contents, please refer to the above-mentioned method embodiments, which will not be repeated here.
[0093] The livestock point cloud bidirectional fault region segmentation device provided by the embodiment of the present invention overcomes the influence of the posture of cattle and pigs on the body size calculation to a certain extent, does not require cattle and pigs to maintain a strictly straight posture, has higher adaptability, is not easily affected by the posture of animals and individual differences, and thus the calculation results are more accurate.
[0094] Fig. 9 is a schematic diagram of the structure of the electronic device provided by the present invention, such as Figure 3 As shown, the electronic device may include: a processor 901, a communication interface 902, a memory 903 and a communication bus 904, wherein the processor 901, the communication interface 902 and the memory 903 communicate with each other through the communication bus 904. The processor 901 may call the logic instructions in the memory 903 to execute the method for segmenting the livestock point cloud bidirectional fault region, the method comprising: determining the main direction of the livestock point cloud data, and constructing a coordinate system for the point cloud data; performing vertical coordinate direction point cloud slicing segmentation on the livestock point cloud data, and determining the slice interval of interest of the leg circumference slice; extracting the clustering results of all points of each slice for multiple slice point clouds within the slice interval of interest of the leg circumference, and determining the effective slice of the leg circumference according to the clustering results; performing secondary reconstruction of the coordinate system according to the position characteristics of the effective slice of the leg circumference, and performing horizontal point cloud slicing segmentation according to the point cloud data after secondary reconstruction, and determining the body size slice point cloud cluster.
[0095] In addition, the logic instructions in the above-mentioned memory 903 can be implemented in the form of software functional units and can be stored in a computer-readable storage medium when sold or used as an independent product. Based on such an understanding, the technical solution of the present invention, in essence, or the part that contributes to the prior art or the part of the technical solution, can be embodied in the form of a software product, which is stored in a storage medium and includes several instructions for a computer device (which can be a personal computer, a server, or a network device, etc.) to perform all or part of the steps of the method described in each embodiment of the present invention. The aforementioned storage medium includes: various media that can store program codes, such as a USB flash drive, a mobile hard disk, a read-only memory (ROM), a random access memory (RAM), a magnetic disk or an optical disk.
[0096] On the other hand, the present invention also provides a computer program product, which includes a computer program stored on a non-transitory computer-readable storage medium, and the computer program includes program instructions. When the program instructions are executed by a computer, the computer can execute the livestock point cloud bidirectional fault area segmentation method provided by the above methods, and the method includes: determining the main direction of the livestock point cloud data and constructing a coordinate system for the point cloud data; performing point cloud slicing segmentation in the vertical coordinate direction on the livestock point cloud data to determine a slice interval of interest for the leg circumference slice; for multiple slice point clouds within the slice interval of interest for the leg circumference, extracting the clustering results of all points in each slice, and determining the effective slice of the leg circumference according to the clustering results; performing secondary reconstruction of the coordinate system according to the position characteristics of the effective slice of the leg circumference, and performing lateral point cloud slicing segmentation according to the point cloud data after secondary reconstruction to determine the body size slice point cloud cluster.
[0097] On the other hand, the present invention also provides a non-transitory computer-readable storage medium having a computer program stored thereon, which is implemented when the computer program is executed by a processor to execute the livestock point cloud bidirectional fault area segmentation method provided in the above-mentioned embodiments, the method comprising: determining the main direction of the livestock point cloud data, and constructing a coordinate system for the point cloud data; performing point cloud slicing segmentation in the vertical coordinate direction on the livestock point cloud data, and determining a slice interval of interest for the leg circumference slice; for multiple slice point clouds within the slice interval of interest for the leg circumference, extracting clustering results of all points in each slice, and determining the effective slice of the leg circumference according to the clustering results; performing secondary reconstruction of the coordinate system according to the positional features of the effective slice of the leg circumference, and performing lateral point cloud slicing segmentation according to the point cloud data after secondary reconstruction, and determining a body size slice point cloud cluster.
[0098] The device embodiments described above are merely illustrative, wherein the units described as separate components may or may not be physically separated, and the components displayed as units may or may not be physical units, that is, they may be located in one place, or they may be distributed on multiple network units. Some or all of the modules may be selected according to actual needs to achieve the purpose of the scheme of this embodiment. Ordinary technicians in this field can understand and implement it without paying creative labor.
[0099] Through the description of the above implementation methods, those skilled in the art can clearly understand that each implementation method can be implemented by means of software plus a necessary general hardware platform, and of course, it can also be implemented by hardware. Based on this understanding, the above technical solution is essentially or the part that contributes to the prior art can be embodied in the form of a software product, and the computer software product can be stored in a computer-readable storage medium, such as ROM / RAM, a disk, an optical disk, etc., including a number of instructions for a computer device (which can be a personal computer, a server, or a network device, etc.) to execute the methods described in each embodiment or some parts of the embodiments.
[0100] Finally, it should be noted that the above embodiments are only used to illustrate the technical solutions of the present invention, rather than to limit it. Although the present invention has been described in detail with reference to the aforementioned embodiments, those skilled in the art should understand that they can still modify the technical solutions described in the aforementioned embodiments, or make equivalent replacements for some of the technical features therein. However, these modifications or replacements do not deviate the essence of the corresponding technical solutions from the spirit and scope of the technical solutions of the embodiments of the present invention.
Claims
1. A method for segmenting livestock point clouds into two-way fault regions, characterized in that: include: Determine the main direction of the livestock point cloud data and construct a coordinate system for the point cloud data; Perform vertical coordinate direction point cloud segmentation on livestock point cloud data to determine the interesting segment interval of leg circumference segment; Extracting clustering results of all points in each slice for multiple slice point clouds within the slice interval of interest of the leg circumference, and determining valid slices of the leg circumference according to the clustering results; The coordinate system is reconstructed according to the position characteristics of the effective slices of the leg circumference, and the horizontal point cloud slices are segmented according to the point cloud data after the secondary reconstruction to determine the point cloud clusters of the body size slices; The step of performing vertical coordinate direction point cloud segmentation on the livestock point cloud data to determine the interesting segment interval of the leg circumference segment includes: Extract the fault slice point cloud clusters at preset intervals along the ground normal vector direction, and count the number of points in each point cloud cluster from bottom to top to generate the probability density function of the number of point cloud cluster points; Performing polynomial fitting on the probability density function to obtain a fitting function, and determining a plurality of maximum points according to the fitting function; According to the multiple maximum points, the fitting function is divided into multiple closed intervals, and the interesting slice interval of the leg circumference slice is determined from the multiple closed intervals.
2. The method for bidirectional fault region segmentation of livestock point cloud according to claim 1, characterized in that: The determining of the main direction of the livestock point cloud data and constructing a coordinate system for the point cloud data includes: Project the point cloud onto the ground plane in the direction of the ground normal vector; Extract the covariance matrix, eigenvalues and eigenvectors of the projected point cloud, and determine the main directions through principal component analysis; A rotation matrix is generated based on the main direction, and a coordinate system is constructed for the point cloud data.
3. The method for bidirectional fault region segmentation of livestock point cloud according to claim 1, characterized in that: Determining the interesting slice interval of the leg circumference slice from the multiple closed intervals includes: Extract characteristic parameters of each interval according to the location, domain and range attributes of each interval, wherein the characteristic parameters include domain proportion, range proportion, interval location parameter and extreme point slope; The extracted feature parameters are input into the preset logistic regression model, and the result of whether each interval is an interval of interest is output; The logistic regression model is obtained by training with samples with labels.
4. The method for bidirectional fault region segmentation of livestock point cloud according to claim 1, characterized in that: Extracting clustering results of all points in each slice from multiple slice point clouds within the slice interval of interest of the leg circumference, and determining valid slices of the leg circumference according to the clustering results, including: For the point cloud data of the slice interval of interest of the leg circumference, multiple point cloud clusters are cut perpendicularly to the vertical coordinate z; Project all points of each point cloud cluster on the xy plane; For the projected leg point cloud cluster, all points are clustered using the DBSCAN algorithm, and candidate slices with cluster numbers of 4 or 5 are retained; From the candidate slices whose cluster number is 4 or 5, a valid slice of the leg circumference is selected.
5. The method for bidirectional fault region segmentation of livestock point cloud according to claim 4, characterized in that: The step of selecting a valid slice of the leg circumference from the candidate slices with a cluster number of 4 or 5 comprises: For the candidate slices with a cluster number of 4 or 5, feature extraction is performed, a preset second logistic regression model is input, a leg circumference slice evaluation index of each candidate slice is output, and a valid leg circumference slice is determined according to the leg circumference slice evaluation index; The second logistic regression model is obtained after training with samples of known leg circumference effective slice evaluation index.
6. The method for bidirectional fault region segmentation of livestock point cloud according to claim 1, characterized in that: The step of performing horizontal point cloud slicing segmentation according to the secondary reconstructed point cloud data to determine the body size slice point cloud cluster includes: Extract the tomographic slice point cloud clusters at preset intervals along the main direction, and count the maximum span values of the z coordinates of all points in each point cloud cluster from back to front in order to generate a span value distribution function of the vertical height of the point cloud cluster; Performing polynomial fitting on the span value distribution function to obtain a second fitting function, and determining all maximum value points according to the second fitting function; And according to the position characteristics of the maximum value points and the effective slices of the leg circumference, the point cloud is segmented to determine the body size slice point cloud cluster.
7. A livestock point cloud bidirectional fault region segmentation device, characterized in that: include: A coordinate construction module, used to determine the main direction of the livestock point cloud data and construct a coordinate system for the point cloud data; A region extraction module is used to segment the livestock point cloud data in the vertical coordinate direction and determine the interesting slice interval of the leg circumference slice; A first determination module is used to extract the clustering results of all points in each slice from a plurality of slice point clouds within the slice interval of interest of the leg circumference, and determine the valid slice of the leg circumference according to the clustering results; The second determination module is used to reconstruct the coordinate system according to the position characteristics of the effective slices of the leg circumference, and to perform horizontal point cloud slice segmentation according to the point cloud data after the secondary reconstruction to determine the body size slice point cloud cluster; The step of performing vertical coordinate direction point cloud segmentation on the livestock point cloud data to determine the interesting segment interval of the leg circumference segment includes: Extract the fault slice point cloud clusters at preset intervals along the ground normal vector direction, and count the number of points in each point cloud cluster from bottom to top to generate the probability density function of the number of point cloud cluster points; Performing polynomial fitting on the probability density function to obtain a fitting function, and determining a plurality of maximum points according to the fitting function; According to the multiple maximum points, the fitting function is divided into multiple closed intervals, and the interesting slice interval of the leg circumference slice is determined from the multiple closed intervals.
8. An electronic device comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein: When the processor executes the program, the steps of the livestock point cloud bidirectional fault area segmentation method as described in any one of claims 1 to 6 are implemented.
9. A non-transitory computer-readable storage medium having a computer program stored thereon, characterized in that: When the computer program is executed by a processor, the steps of the livestock point cloud bidirectional fault region segmentation method as claimed in any one of claims 1 to 6 are implemented.
Citation Information
Patent Citations
Dairy cow body surface point cloud three-dimensional reconstruction method under shielding condition
CN112258651A
Rule set-based point cloud classification and recognition method for clear official building styles
CN112906487A
Aerial line extraction system and aerial line extraction method
US20210103727A1