Pig body size measuring method based on double-view point cloud registration

Based on the method of dual -perspective point cloud allocation, the problem of single parameters, complex equipment, and limited data processing in the existing pig ruler measurement method were solved, and the high -precision non -contact measurement of the pig's only ruler parameters was realized. , Meet the measurement needs of pig breeding.

CN119379761APending Publication Date: 2025-01-28ZHEJIANG FORESTRY UNIVERSITY
View PDF 0 Cites 2 Cited by

Patent Information

Application Number
CN202411295582.0
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-09-18
Publication Date
2025-01-28

AI Technical Summary

Technical Problem

The existing pig body ruler measurement methods have problems such as single parameters, complex equipment and limited large-scale point cloud data processing, resulting in low measurement efficiency and low accuracy.

Method used

Using the method based on the two -perspective point cloud standard, through the establishment of a pig only cloud acquisition system, collecting bilateral cloud data, carperts and improved LOOP filtering algorithm processing The combined double -perspective standard method, obtain a complete pork point cloud data, and use the method to use the method line cloud and Alpha Shapes point cloud feature extraction method to achieve non -contact measurement of multi -ruler parameters.

Benefits of technology

The high -precision measurement of pigs with a multi -body ruler is achieved, the average of the relative error is 2.20%, the average of the absolute error is 1.04cm, which significantly improves the measurement efficiency and accuracy, and meets the measurement requirements of the body ruler of pig breeding.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119379761A_ABST
    Figure CN119379761A_ABST
Patent Text Reader

Abstract

The invention discloses a pig body size measurement method based on double-view point cloud registration, and the method comprises the following steps: collecting point cloud data of two sides of a pig; simplifying the point cloud data by adopting an equal-interval thinning algorithm, and removing the abnormal value point cloud data by utilizing an improved LoOP filtering algorithm; obtaining complete pig point cloud data; the contour features of the pigs are extracted in combination with extraction, and non-contact measurement of the multi-body-size parameters of the pigs is achieved. The method has the advantages that the average relative errors of the measured body length, the measured body height, the measured hip height, the measured body width, the measured abdomen width, the measured hip width, the measured chest circumference and the measured abdomen circumference are 1.28%, 0.88%, 1.97%, 2.71%, 2.83%, 3.71%, 2.03% and 2.17% respectively, the average relative error value is 2.20%, and the average absolute error value is 1.04 cm; and 2, measurement of multiple body size parameters of the live pig can be realized, the precision is high, the body size measurement requirement during breeding of the live pig can be well met, and a new way is provided for non-contact measurement of the body size of the live pig.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the technical field of measuring body size parameters of pigs, and in particular to a method for measuring body size of pigs based on dual-view point cloud registration. Background Art

[0002] Body size parameters are one of the important indicators to reflect and evaluate the growth and development of pigs, and can provide an important reference for selecting excellent breeds. Traditional body size measurement methods mostly use contact methods, such as manual measurement using tape measures, measuring sticks, etc. In the case of large-scale farms, high measurement frequency, and many body size parameters, the contact measurement method is not only time-consuming and laborious, but also easily causes stress reactions in pigs. The use of non-contact measurement can not only avoid the problems existing in the contact measurement method, but also improve the welfare of pigs.

[0003] Although existing body measurement methods using three-dimensional point cloud technology have made significant progress in accuracy and efficiency, they still have certain limitations in the richness of measurement parameters, the complexity of equipment, and large-scale point cloud data processing. Summary of the invention

[0004] The purpose of this section is to summarize some aspects of embodiments of the present invention and briefly introduce some preferred embodiments. Some simplifications or omissions may be made in this section and the specification abstract and the invention title of this application to avoid blurring the purpose of this section, the specification abstract and the invention title, and such simplifications or omissions cannot be used to limit the scope of the present invention.

[0005] In view of the above existing problems, the present invention is proposed.

[0006] Therefore, the technical problem solved by the present invention is to provide a method for measuring pig body size based on dual-view point cloud registration.

[0007] In order to solve the above technical problems, the present invention provides the following technical solutions: a method for measuring pig body size based on dual-view point cloud registration, comprising the following steps: building a pig point cloud acquisition system and collecting bilateral point cloud data of pigs; using an equal-pitch thinning algorithm to simplify the point cloud data, and then using an improved LoOP filtering algorithm to remove outlier point cloud data to complete the preprocessing of the pig point cloud data; using a dual-view registration method combining coarse registration and fine registration for the preprocessed point cloud data to obtain complete pig point cloud data; combining the manual measurement method with the pig point cloud contour features to define various parameters of the live pig body size, and using the normal point cloud and alphashapes point cloud feature extraction to extract the pig contour features, thereby realizing non-contact measurement of multiple body size parameters of pigs.

[0008] Preferably, the equal spacing thinning algorithm includes the following simplification steps for the point cloud data: traverse each point in the point cloud, calculate the distance between it and the nearest neighbor point, and calculate the average value, calculate the average interval d, and determine the midpoint P of the interval between the surrounding discrete point cloud and the pig target point cloud. m , the calculation formulas for neighbor distance and average distance are as follows:

[0009] d i =||p i -p i,nn ||

[0010]

[0011] Where, d i is the current point P i With its previous point P i-1 The distance between neighboring points, is the average value of the distances of all neighboring points; on the basis of the average interval, a thinning factor threshold fatcor is set, and a point is selected for thinning every factor points. After the points in the point cloud set are thinned, a new point cloud set P' will be formed:

[0012] P′={p i |i%factor=0}

[0013] Flexibly set the sampling interval to evenly thin the point cloud.

[0014] Preferably, the method for removing outlier point cloud data comprises the following steps: according to the data dimension d and the preset dimension threshold d threshold Determine the data structure: if d≤d threshold , the point cloud to be processed is divided into a KD tree; otherwise, it is divided into an octree, and the corresponding data structure is constructed by dividing the point cloud to generate the subsequent input point cloud data; for each point p i , using the selected data structure to query its k-nearest neighbors N k (p i ), then calculate the point p i Local reachability density LRD:

[0015]

[0016] reach-dist k (p i , p j )=max{k-dist(p j ), dist(p i , p j )}

[0017] In the formula, k-dist(pj ) is point p j The distance to its kth nearest neighbor, dist(p j ) is point p i and p j The distance between them, reach is the reachable distance, reach-dist k (p j , p i ) means taking point p i to p j The actual distance and point p j The larger of the distances to its kth nearest neighbor; the local outlier probability LoOP of each point is calculated using the local reachable density:

[0018]

[0019] Where k represents the number of nearest neighbors considered when calculating local density, and N k represents the number of points in the kth cluster. LRD is the “reachability” or proximity of the evaluation point to other nearby points, which is used to measure the density of the area around the point relative to the density of its neighbors. For each point p i , if LoOP(p i ) is close to 1, then p i is an outlier; if the value is close to 0, then p i For normal points, the LoOP score of each point is output and outliers are marked as needed.

[0020] Preferably, the acquisition of complete pig point cloud data includes the following steps: using the optimized Super4PCS algorithm for coarse registration, the coarse registration increases the number of sampling points p when selecting the coplanar four points in the source point cloud. 0 , and added parallel calculation of the ratio and distance between two pairs of points in the point set in the construction and matching of the point pair set, adjusted the algorithm's running time parameter t, and used the transformation matrix to obtain the optimal perspective; then combined with the KSS-ICP algorithm for precise alignment; the left and right perspective point clouds were spliced ​​to obtain complete three-dimensional point cloud information of the pig.

[0021] Preferably, the rough registration comprises the following steps: selecting four coplanar point pairs m, n, o, p in the source point cloud P to form a reference point set B; calculating the ratio α, β and distance l between two pairs of points in the point set B 1 , l 2 :

[0022]

[0023] l 1 =||mn||,l 2 =||op||

[0024] For each point q in the target point cloud Q, draw a line with q as the center and l 1 and l 2 is a sphere with a radius of 1, and sets an error limit of δ to obtain two point pairs U 1 and U 2 :

[0025] U 1 ={(q i ,q j )|||l 1 -δ≤||q i -q j ||≤l 1 +δ||}

[0026] U 2 ={(q i ,q j )|||l 2 -δ≤||q i -q j ||≤l 2 +δ||}

[0027] On the point set U 1 and U 2 In the process, find the intersection point f and confirm that the angle between the point pairs in the point base B is close to the preset angle φ. Perform matching verification within the allowable error range. For all point groups in the point cloud Q that can correspond to the point base B, calculate their transformation matrices. Among all the transformation matrices, select a transformation matrix that can maximize the matching point set to perform global transformation.

[0028] Preferably, the KSS-ICP algorithm includes the following processing steps: normalizing the point cloud, calculating the centroid of the point cloud α, that is, the arithmetic mean of all point coordinates,

[0029]

[0030] The normalized point cloud K is obtained by calculating the vector from each point to the centroid and dividing it by the scale factor s(α) s (a):

[0031]

[0032] Where the scale factor s(α) is the average value of the modulus of the point-to-centroid vector; for two normalized point clouds K in shape space s (a) and K s (b) is used to measure the difference and use the Hausdorff distance H to replace the original shape metric:

[0033]

[0034] In the formula, E d is the Hausdorff distance between two point clouds, O is an element in the rotation group SO(3); a discrete candidate set {O} is established to represent the rotation transformation, and by searching in the rotation group SO(3), we find the rotation transformation that makes E d Minimize the set of rotation transformations O init :

[0035] O init = {O i |min E d (O i )},O i ∈{O}

[0036] Find the optimal transformation O from a discrete candidate set {O} init , and combined with the center displacement C init , forming an initial optimal registration pair (C init , O init ):

[0037] (C init , O init )={(C i , O j )|min E cd (C i , O j )}

[0038] Among them, C i represents the possible center displacement, E cd Represents the distance metric after considering the center displacement; the ICP algorithm is used to fine-tune the initial optimal registration pair. The algorithm minimizes the Euclidean distance between the point pairs of the two point clouds through iteration until it converges to a solution that meets a certain threshold.

[0039] Preferably, the multiple body measurement parameters include body length measurement, body height and hip height measurement, body width, abdominal width, hip width measurement, chest circumference and abdominal circumference measurement, wherein the body length measurement includes the following steps: for each point P in the point cloud i , based on the point P in its neighborhood j That is, the distance P i Calculate the normal vectors of all points less than the search radius r, and establish a local coordinate system to form the angle arrangement of the point set; use αshape boundary extraction to optimize the search of neighborhood points, use αshape to identify the shape boundary of the point set, find the edge of the empty circle with a radius of 1 / α, and form the outer contour line of the point cloud; use the b-spine curve method to fit the body length contour point cloud, and determine the extreme point C(t i ), calculate the adjacent extreme point C(ti ) and C(t i+1 ) between i :

[0040]

[0041] In the formula, x, y, and z represent t i and t i+1 spatial coordinates; finally, the pig's body length L is obtained by accumulating the Euclidean distances between all adjacent extreme points:

[0042]

[0043] Preferably, the body height and hip height measurement includes the following steps: first, segment the pig point cloud contour line to eliminate the interference of the head and tail on the measurement result; extract the ground point cloud, and use the first convex point obtained from left to right as the highest point of the pig's shoulder blade; start from the tail root point and go to the left as the highest point of the pig's hip joint and buttocks, use the ground point cloud as the reference plane, and calculate the vertical distance to the ground point cloud, which is the body height and hip height.

[0044] Preferably, the body width, abdominal width and hip width measurement includes the following steps: removing the head, tail and limbs of the pig point cloud, retaining the main point cloud contour of the trunk; calculating the normal vector of the point cloud contour to determine the direction, aligning the point cloud using the PCA method so that the Z axis is the main direction, rotating the point cloud to a standard coordinate system, and then projecting the point cloud in the area to the XY plane; segmenting the point cloud contour in the x-axis direction at equal intervals, and counting the distribution range of each segment in the x-direction, and the points with the largest distribution range are the body width, abdominal width and hip width.

[0045] Preferably, the chest circumference and abdominal circumference measurement includes the following steps: slicing the point cloud contours of the pig's abdomen and chest; extracting the minimum circumscribed rectangle of each part according to the box ellipse fitting method, and fitting the minimum inscribed ellipse based on each minimum circumscribed rectangle; using the fitted ellipse to calculate the chest circumference and abdominal circumference, BC represents the chest circumference, AC represents the abdominal circumference, BE represents the major axis radius of the chest ellipse, BS represents the minor axis radius of the chest ellipse, AE represents the major axis radius of the abdominal ellipse, AS represents the minor axis radius of the abdominal ellipse, and the calculation formulas of BC and AC are as follows:

[0046]

[0047] The beneficial effects of the present invention are as follows: firstly, the average relative errors of the measured body length, body height, hip height, body width, abdominal width, hip width, chest circumference and abdominal circumference are 1.28%, 0.88%, 1.97%, 2.71%, 2.83%, 3.71%, 2.03% and 2.17% respectively, the average relative error is 2.20%, and the average absolute error is 1.04 cm; secondly, the measurement of multiple body size parameters of pigs can be realized with high accuracy, the body size measurement requirements of pig breeding can be better met, and a new approach is provided for non-contact measurement of pig body size. BRIEF DESCRIPTION OF THE DRAWINGS

[0048] In order to more clearly illustrate the technical solutions of the embodiments of the present invention, the following briefly introduces the drawings required for describing the embodiments. Obviously, the drawings described below are only some embodiments of the present invention. For ordinary technicians in this field, other drawings can be obtained based on these drawings without creative labor. Among them:

[0049] Figure 1 It is a schematic diagram of the overall process of measuring the body size of pigs according to the present invention;

[0050] Figure 2 It is a structural schematic diagram of the point cloud data acquisition system of the present invention;

[0051] Figure 3 A schematic diagram of the manual measurement feature of the present invention;

[0052] Figure 4 is a schematic diagram of body length measurement according to the present invention;

[0053] Figure 5 A schematic diagram of body height and hip height measurement according to the present invention;

[0054] Figure 6 A schematic diagram of the width range division of the present invention;

[0055] Figure 7 It is a schematic diagram of the girth slice and the box ellipse fitting according to the present invention;

[0056] Figure 8 It is a schematic diagram of the box ellipse fitting results of the waist circumference and chest circumference of the present invention;

[0057] Fig. 9 This is a schematic diagram of the outlier removal result of the original point cloud filtering algorithm described in the present invention;

[0058] Fig.10 This is a schematic diagram of the outlier removal results of the LOF algorithm described in the present invention;

[0059] Fig.11This is a schematic diagram of the outlier removal results of the LoOP algorithm described in the present invention;

[0060] Fig.12 This is a schematic diagram of outlier removal results of the improved LoOP algorithm of the present invention;

[0061] Fig.13 This is a schematic diagram comparing the relative error results of multiple body size parameters of pigs with different serial numbers according to the present invention;

[0062] Fig.14 This is a schematic diagram comparing the absolute error results of multiple body size parameters of pigs with different serial numbers described in the present invention. DETAILED DESCRIPTION

[0063] In order to make the above-mentioned purposes, features and advantages of the present invention more obvious and easy to understand, the specific implementation methods of the present invention are described in detail below in conjunction with the drawings of the specification. Obviously, the described embodiments are part of the embodiments of the present invention, but not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary persons in the art without creative work should fall within the scope of protection of the present invention.

[0064] In the following description, many specific details are set forth to facilitate a full understanding of the present invention, but the present invention may also be implemented in other ways different from those described herein, and those skilled in the art may make similar generalizations without violating the connotation of the present invention. Therefore, the present invention is not limited to the specific embodiments disclosed below.

[0065] Secondly, the term "one embodiment" or "embodiment" as used herein refers to a specific feature, structure, or characteristic that may be included in at least one implementation of the present invention. The term "in one embodiment" that appears in different places in this specification does not necessarily refer to the same embodiment, nor does it refer to a separate or selective embodiment that is mutually exclusive with other embodiments.

[0066] The present invention is described in detail with reference to schematic diagrams. When describing the embodiments of the present invention, for the sake of convenience, the cross-sectional diagrams showing the device structure will not be partially enlarged according to the general scale, and the schematic diagrams are only examples, which should not limit the scope of protection of the present invention. In addition, in actual production, the three-dimensional dimensions of length, width and depth should be included.

[0067] At the same time, in the description of the present invention, it should be noted that the directions or positional relationships indicated by the terms "upper, lower, inner and outer" are based on the directions or positional relationships shown in the drawings, and are only for the convenience of describing the present invention and simplifying the description, rather than indicating or implying that the device or element referred to must have a specific direction, be constructed and operated in a specific direction, and therefore cannot be understood as limiting the present invention. In addition, the terms "first, second or third" are only used for descriptive purposes and cannot be understood as indicating or implying relative importance.

[0068] In the present invention, unless otherwise clearly specified and limited, the terms "install, connect, connect" should be understood in a broad sense, for example: it can be a fixed connection, a detachable connection or an integral connection; it can also be a mechanical connection, an electrical connection or a direct connection, or it can be indirectly connected through an intermediate medium, or it can be the internal communication of two components. For ordinary technicians in this field, the specific meanings of the above terms in the present invention can be understood according to specific circumstances.

[0069] Example 1

[0070] Body size parameters are important indicators of pig breeding and provide a scientific basis for accurate selection and breeding optimization. Aiming at the problems of single measurement parameters, complex measurement equipment and limited processing of large-scale point cloud data in the existing pig body size measurement methods, a pig body size measurement method based on dual-view point cloud registration was proposed. Firstly, a pig point cloud acquisition channel was designed and built using two KinectDK depth cameras, and a total of 190 sets of bilateral point cloud data were collected. Secondly, after the point cloud was simplified by using the equal-spacing thinning algorithm, the improved LoOP filtering algorithm was used to remove the outlier point cloud to complete the preprocessing of the pig point cloud. Then, a dual-view registration method combining coarse registration and fine registration was used to obtain a complete pig point cloud, which significantly improved the registration accuracy of the point cloud. Finally, the normal point cloud and alpha shapes point cloud feature extraction were combined to extract the pig contour features, realizing the non-contact measurement of multiple body size parameters of pigs.

[0071] More specifically, the present embodiment proposes a method for measuring pig body size based on dual-view point cloud registration, comprising the following steps:

[0072] S1: Build a pig point cloud acquisition system and collect bilateral point cloud data of pigs;

[0073] S2: Use the equal-spacing thinning algorithm to simplify the point cloud data, and then use the improved LoOP filtering algorithm to remove outlier point cloud data to complete the preprocessing of pig point cloud data;

[0074] S3: The pre-processed point cloud data is subjected to a dual-view registration method combining coarse registration and fine registration to obtain complete pig point cloud data;

[0075] S4: Combine the manual measurement method with the pig point cloud contour features to define the various parameters of the pig body size. Use the normal point cloud and alpha shapes point cloud feature extraction to extract the pig contour features, and realize the non-contact measurement of multiple body size parameters of the pig.

[0076] Further, in step S1 of this embodiment, refer to Figure 1 The figure shows the overall process of body size measurement. First, the KinectDK camera is used to obtain the RGB image and depth image of the target pig under the left and right dual perspectives, and then the point cloud data under different perspectives are obtained by image fusion. In the point cloud preprocessing stage, the point cloud is simplified by the equal spacing thinning algorithm to reduce the point cloud density, and the LoOP filter algorithm is improved to remove outlier point clouds such as background points and noise points. In the point cloud registration stage, the pig point cloud is first coarsely registered using the optimized Super4PCS, and then the KSS-ICP algorithm is used for fine registration. The pig point clouds under the left and right perspectives are spliced ​​to obtain a complete three-dimensional point cloud. Finally, for body length, body height and hip height, the corresponding body size information is extracted using the point cloud contour features; for body width, abdominal width and hip width, the point cloud contour is segmented at equal intervals to calculate the maximum width distance of the distribution range in the main direction; for abdominal circumference and hip circumference, the point cloud contours of the abdomen and chest are sliced, and the minimum circumscribed rectangle is extracted according to the box ellipse fitting method, and the minimum inscribed ellipse is fitted on the basis of the minimum circumscribed rectangle to estimate.

[0077] In order to facilitate the efficient collection of pig point cloud data, a point cloud collection system was designed and built. The structural diagram is shown in the figure. Figure 2 As shown in the figure. The numbers 1 and 2 in the figure are depth cameras, 3 is the host computer, 4 is the synchronization transmission line, and 5 is the telescopic channel. The system is a single-channel structure. The point cloud data acquisition unit uses the Azure Kinect DK depth camera, which is mainly composed of an RGB camera (resolution of 1920 pixels × 1080 pixels) and a depth sensor (resolution of 512 pixels × 512 pixels). The working mode of the depth camera is set to WFOV (wide field of view depth mode) 2x2 boxing mode, with a field of view of 120°x120° and a depth detection range of 0.5~4.5m. The acquisition channel is 1.6m long and 0.9m wide. The cameras are symmetrically fixed on the left and right sides of the channel, with a height of 0.8m, a horizontal spacing of 1.1m, and a horizontal angle of 35°~40° between the camera and the ground. Use the Azure Kinect recorder in conjunction with an external synchronization device, and extract and generate RGB images and depth images based on the MKV file, and then generate RGB-D point cloud data through image fusion of the RGB image and the depth image.

[0078] Point cloud data collection: The objects of point cloud data collection include steady-state model pigs in laboratory environments and live pigs in farm environments. The data collection of steady-state model pigs is used for the design and adjustment of body size algorithms and the precise measurement of various body size parameters, while the data collection of live pigs in farms is used to verify the reliability and accuracy of body size algorithms. The data collection of live pigs in farms was completed on June 3, 2024 at a farmer in Hangzhou City, Zhejiang Province, and the collection objects were 7 Landrace pigs. In the end, 14,991 RGB images and depth images were obtained respectively. After eliminating data with non-standard postures and incomplete body features, the images that met the requirements were fused into RGB-D, and a total of 190 sets of relatively complete pig point cloud data were obtained.

[0079] Furthermore, in step S2 of this embodiment, the preprocessing of the point cloud data is more specific. The point cloud data of the target pig obtained by the Kinect DK camera is huge. In order to reduce the amount of data and improve the calculation speed, point cloud simplification is required. At the same time, the influence of external factors such as the surrounding environment of the pig will cause some invalid target point cloud data to appear in the captured image, and due to the distortion of the Kinect DK camera itself, certain outliers will be generated. Therefore, it is necessary to filter the point cloud data to reduce the time of point cloud registration and improve the accuracy of point cloud registration.

[0080] The point cloud simplification process is as follows:

[0081] The point cloud is simplified by using an equal-interval thinning algorithm, which dilutes the original point cloud by selecting points at a certain interval in the point cloud, thereby reducing the number of point clouds.

[0082] First, we need to traverse each point in the point cloud, calculate the distance between it and the nearest neighbor point, and take the average value, calculate the average interval d, and then determine the midpoint P between the surrounding discrete point cloud and the pig target point cloud. m , the calculation formulas for neighbor distance and average distance are as follows:

[0083] d i =||p i -p i,nn || (1)

[0084]

[0085] Where, d i is the current point P i With its previous point P i-1 The distance between neighboring points, is the average distance of all neighboring points.

[0086] On the basis of the average interval, a thinning factor threshold fatcor is set, and a point is selected for thinning every factor points. After the points in the point cloud set are thinned, a new point cloud set P' is formed:

[0087] P′={p i |i%factor=0} (3)

[0088] The key to the algorithm lies in the flexible setting of the sampling interval. Since the point cloud is thinned evenly, the main features of the point cloud are better preserved while reducing the amount of data.

[0089] The point cloud filtering process is as follows:

[0090] The LoOP filter algorithm is a probability-based outlier detection algorithm. This algorithm is an improvement on the LOF (local outlier factor algorithm) and aims to identify outliers in point cloud data and solve the problem that the LOF algorithm is prone to misjudgment of outliers. The LoOP filter algorithm can represent outliers in the range of [0,1] and ultimately judge outliers based on probability. When the LoOP filter algorithm processes large-scale point cloud data, it is often difficult to balance the efficiency and accuracy of dividing point sets of different dimensions when establishing the KD tree structure. Octrees and KD trees, as two commonly used data structures, have advantages in processing data in high-dimensional and low-dimensional point cloud spaces, respectively.

[0091] To this end, this embodiment improves the LoOP filtering algorithm and proposes a hybrid point cloud data storage scheme to divide the algorithm point set. This scheme combines the advantages of both the octree and the KD tree, and dynamically selects a suitable data structure and division strategy according to the characteristics of the data and query requirements, thereby improving the filtering effect of the outlier point cloud.

[0092] The improved algorithm steps are as follows:

[0093] (1) According to the data dimension d and the preset dimension threshold d threshold Determine the data structure: if d≤d threshold , the point cloud to be processed is divided into a KD tree; otherwise, it is divided into an octree. The corresponding data structure is constructed by dividing the point cloud to generate the subsequent input point cloud data.

[0094] (2) For each point p i , using the selected data structure to query its k-nearest neighbors N k (p i ). Then calculate the point p i Local reachability density LRD:

[0095]

[0096] reach-dist k (p i , p j )=max{k-dist(p j ), dist(p i , p j )} (5)

[0097] In the formula, k-dist(p j ) is point p j The distance to its kth nearest neighbor, dist(p j ) is point p i and p j The distance between them, reach is the reachable distance, reach-dist k (p j , p i ) means taking point p i to p j The actual distance and point p j The larger of the distances to its kth nearest neighbor. The core idea of ​​"reach-dist" is to avoid the anomaly detection results being affected by extreme values ​​in local dense or sparse areas when the local density is uneven. By using the max function, "reach-dist" ensures that edge points or isolated points of dense clusters are treated fairly when calculating local density.

[0098] (3) Calculate the local anomaly probability LoOP of each point using the local reachable density:

[0099]

[0100] Where k represents the number of nearest neighbors considered when calculating local density, and N k represents the number of points in the kth cluster, and LRD is the “reachability” or proximity of an evaluation point to other nearby points, which is used to measure the density of the area around a point relative to the density of its neighbors.

[0101] (4) For each point p i , if LoOP(p i ) is close to 1, then p i is an outlier; if the value is close to 0, then p i The LoOP score of each point is output, and outliers are marked as needed.

[0102] Furthermore, in step S3 of this embodiment, in more detail, the point cloud registration first uses the optimized Super4PCS algorithm for coarse registration, then combines it with the KSS-ICP algorithm for fine registration, and finally splices the left and right view point clouds to quickly and accurately obtain complete three-dimensional point cloud information of the pig.

[0103] The specific details of point cloud coarse registration are as follows:

[0104] The Super4PCS algorithm is based on an iterative process. After the data set is preprocessed, four sets of points are randomly selected to estimate the correspondence between the point clouds. In order to optimize the registration accuracy of the Super4PCS algorithm and shorten its maximum running time, the number of sampling points p is increased when selecting the four coplanar points in the source point cloud. 0 , and added parallel calculation of the ratio and distance between two pairs of points in the point set in the construction and matching of the point set, adjusted the algorithm's running time parameter t, and used the transformation matrix to obtain the optimal viewing angle to obtain better registration quality. The specific algorithm steps are as follows:

[0105] (1) Select four coplanar point pairs m, n, o, p in the source point cloud P to form a reference point set B. Calculate the ratio α, β and distance l between two pairs of points in point set B 1 , l 2 :

[0106]

[0107] l 1 =||mn||,l 2 =||op|| (8)

[0108] (2) For each point q in the target point cloud Q, draw a line with q as the center and l as the center. 1 and l 2 is a sphere with a radius of 1, and sets an error limit of δ to obtain two point pairs U 1 and U 2 :

[0109] U 1 ={(q i ,q j )|||l 1 -δ≤||q i -q j ||≤l1 + δ||} (9)

[0110] U 2 ={(q i ,q j )|||l 2 -δ≤||q i -qj ||≤l 2 +δ||} (10)

[0111] (3) In the point pair set U 1 and U 2 In , find the intersection point f and confirm that the angle between the point pairs in the point base B is close to the preset angle φ, and perform matching verification within the allowable error range. For all point groups in the point cloud Q that can correspond to the point base B, calculate their transformation matrices. Among all transformation matrices, select a transformation matrix that can maximize the matching point set to perform global transformation.

[0112] The specific process of point cloud precise registration is as follows:

[0113] After using the optimized Super4PCS algorithm for rough registration, the KSS-ICP algorithm is combined for fine registration to improve the registration accuracy. The main process of the KSS-ICP algorithm is as follows:

[0114] (1) Normalize the point cloud and calculate the centroid of the point cloud α, which is the arithmetic mean of the coordinates of all points (as shown below):

[0115]

[0116] The normalized point cloud K is obtained by calculating the vector from each point to the centroid and dividing it by the scale factor s(α) s (a):

[0117]

[0118] Where the scale factor s(α) is the average value of the modulus of the vector from the point to the centroid.

[0119] (2) In the shape space, two normalized point clouds K s (a) and K s (b) is used to measure the difference and use the Hausdorff distance H to replace the original shape metric:

[0120]

[0121] In the formula, E d is the Hausdorff distance between two point clouds, and O is an element of the rotation group SO(3).

[0122] (3) Establish a discrete candidate set {O} to represent the rotation transformation, and find the rotation transformation that makes E d Minimize the set of rotation transformations O init :

[0123] O init = {O i|min E d (O i )},O i ∈{O} (15)

[0124] (4) Find the optimal transformation O from the discrete candidate set {O} init , and combined with the center displacement C init , forming an initial optimal registration pair (C init , O init ):

[0125] (C init , O init )={(C i , O j )|min Ecd(C i ,O j )} (16)

[0126] Among them, C i represents the possible center displacement, E cd Represents the distance metric after taking into account the center displacement.

[0127] (5) The ICP algorithm is used to fine-tune the initial optimal registration pair. The algorithm iterates to minimize the Euclidean distance between the point pairs of the two point clouds until it converges to a solution that satisfies a certain threshold, thereby further reducing the error and achieving fine registration.

[0128] Further, in step S3 of this embodiment, in more detail, based on the richness of the pig body size parameters, refer to Figure 3 The 8 body size parameters that can reflect the body shape characteristics of pigs are determined as shown in the figure. Combining the manual measurement method with the pig point cloud contour characteristics, the definition of the measurement method of each parameter of the pig body size is shown in Table 1.

[0129] Table 1: Definition of body size parameter measurement methods.

[0130]

[0131] Body length measurement:

[0132] The normal point cloud and the alphashapes plane point cloud boundary feature extraction are combined to measure the pig's body length. The measurement diagram is shown in the figure. Figure 4 As shown. For each point P in the point cloud i , based on the point P in its neighborhood j That is, the distance P iThe normal vectors of all points less than the search radius r are calculated, and a local coordinate system is established to form the angle arrangement of the point set. Then, the search of the neighborhood points is optimized by using the αshape boundary extraction, and the shape boundary of the point set is identified by using the αshape, and the edge of the empty circle with a radius of 1 / α is found to form the outer contour line of the point cloud. Then, the b-spine curve method is used to fit the body length contour line point cloud to determine the extreme point C (t i ), calculate the adjacent extreme point C(t i ) and C(t i+1 ) between i :

[0133]

[0134] In the formula, x, y, and z represent t i and t i+1 The spatial coordinates of .

[0135] Finally, by accumulating the Euclidean distances between all adjacent extreme points, the pig's body length L can be calculated:

[0136]

[0137] Height and hip height measurements:

[0138] In order to avoid the influence of the head and tail of the pig on the measurement of body height, the body height and hip height of the pig are measured using the point cloud contour. First, the pig point cloud contour line is segmented to eliminate the interference of the head and tail on the measurement results. Then the ground point cloud is extracted, and the first convex point obtained from left to right is taken as the highest point of the pig's shoulder blade, and the highest convex point obtained from the tail root to the left is taken as the highest point of the pig's hip joint. The ground point cloud is used as the reference plane, and the vertical distance to the ground point cloud is calculated as the body height and hip height. The measurement diagram is shown in the figure. Figure 5 shown.

[0139] Body width, abdominal width and hip width measurements:

[0140] Since the body width, abdominal width and hip width of the pig are calculated based on the maximum width of vertices at different positions, the head, tail and limbs of the pig point cloud are removed, and the main point cloud outline of the trunk is retained. The normal vector of the point cloud outline is calculated to determine the direction, and the point cloud is aligned using the PCA method so that the Z axis is the main direction. After rotating the point cloud to the standard coordinate system, the point cloud in the area is projected onto the XY plane, and the point cloud outline in the x-axis direction is segmented at equal distances. The distribution range of each segment in the x-direction is counted. The maximum distribution range is the body width, abdominal width and hip width. The three width ranges are divided as follows: Figure 6 shown.

[0141] Chest and Abdomen Measurements:

[0142] Chest and waist measurement diagram Figure 7 As shown in the figure, the contour of the point cloud of the pig's abdomen and chest is sliced, and the minimum circumscribed rectangle of each part is extracted according to the box ellipse fitting method. Based on each minimum circumscribed rectangle, the minimum inscribed ellipse is fitted. The chest circumference and abdominal circumference are calculated using the fitted ellipse. The box ellipse fitting results are shown in Figure 8 As shown. BC represents chest circumference, AC represents abdominal circumference, BE represents the major axis radius of the chest ellipse, BS represents the minor axis radius of the chest ellipse, AE represents the major axis radius of the abdominal ellipse, and AS represents the minor axis radius of the abdominal ellipse. The calculation formulas for BC and AC are as follows:

[0143]

[0144] In order to solve the problems of single parameters and complex equipment in the existing pig body size measurement methods, this embodiment proposes a pig body size measurement method based on dual-view point cloud registration. First, two Kinect DK depth cameras are used to collect pig point clouds, and then the LoOP filtering algorithm is used to remove point cloud outliers. Then, the complete pig three-dimensional point cloud features are obtained through dual-view point cloud registration. Finally, the normal point cloud and alpha shapes point cloud feature extraction are combined to realize non-contact measurement of multiple body size parameters of pigs.

[0145] Example 2

[0146] In order to verify the actual effect of the pig body size measurement method based on dual-view point cloud registration proposed in the previous embodiment, this embodiment respectively performs point cloud filtering results and analysis, point cloud registration results and analysis, and pig body size measurement results and analysis. The details are as follows:

[0147] (1) Point cloud filtering results and analysis:

[0148] In order to verify the performance of the improved LoOP filtering algorithm, the traditional LOF algorithm and the LoOP filtering algorithm before improvement were selected for comparison. The algorithm of this embodiment and the two algorithms were compared and analyzed on the actual collected pig point cloud. The filtering effect, number of outlier point clouds removed and time consumed of the three algorithms were compared respectively. The results of the separated outlier part are shown in the figure. Figure 9-12 shown. Fig. 9 is the original point cloud, from Fig.10 (LOF algorithm) It can be seen that the tail point cloud of the pig point cloud has sparse outliers, indicating that there is an error in judging outliers. This also shows that the traditional LOF algorithm cannot judge the degree of outliers in some parts, resulting in an error in the probability of outliers. Fig.11It can be seen from the (LoOP algorithm) that the removal of outlier point clouds of pigs is uneven, which shows that the LoOP filtering algorithm can solve the problem that the final score cannot judge the degree of outliers to a certain extent, but it has limitations in removing outliers from the overall point cloud; Fig.12 It can be seen from the improved LoOP algorithm that the method of this embodiment effectively avoids these outlier judgment problems, while removing outliers from the point cloud evenly and better restoring the contour features of the retained pig point cloud.

[0149] The comparison of the filtering results of the three algorithms is shown in Table 2. It can be seen from the table that compared with the two filtering algorithms LOF and LoOP, the number of outlier point clouds removed by the improved LoOP algorithm is significantly increased, which shows that the algorithm of this embodiment can more accurately identify and remove the outliers and discrete points of the point cloud, and the outlier detection effect is better. In terms of time consumption, compared with the LOF algorithm, the improved algorithm of this embodiment runs faster, and the time consumed can reach 7.523ms. Although it is slightly lower than the LoOP filtering algorithm before the improvement, it can still achieve the rapid removal of outliers in large cardinality point clouds. The above analysis shows that the algorithm of this embodiment can fully utilize the advantages of octrees and KD trees by using a hybrid point cloud data storage solution. Compared with LOF and the LoOP filtering algorithm before the improvement, this optimization strategy can effectively solve the problems of low efficiency and low precision encountered by traditional methods when processing point cloud data of different dimensions and scales, so as to better cope with the anomaly detection needs in actual application scenarios.

[0150] Table 2: Analysis of filtering algorithm results.

[0151]

[0152]

[0153] (2) Point cloud registration results and analysis:

[0154] This embodiment first uses the optimized Super4PCS algorithm for coarse registration to obtain a better initial position, and then uses different algorithms to perform matrix transformation to further refine the registration accuracy.

[0155] In order to verify the effectiveness of the method proposed in this embodiment, the Super4PCS algorithm, Super4PCS+ICP algorithm, Super4PCS+GICP algorithm, Super4PCS+GMM-Tree algorithm, Super4PCS+FilterReg algorithm and the algorithm of this embodiment are compared and analyzed, and the results are shown in Table 3. As can be seen from Table 3, only using the optimized Super4PCS rough registration for processing before fine registration can improve the registration accuracy of the point cloud to a certain extent, while the classic ICP algorithm and GICP algorithm are prone to fall into the local optimal solution when processing a large range of pig point clouds. Compared with these two algorithms, the single Super4PCS algorithm has a RMSE of Avg and MSE Avg Lower, can reach 2.15cm and 4.61cm 2 , MAE Avg and MAPE Avg It is also close to the GICP algorithm; compared with the GMM-Tree algorithm using Gaussian mixture model and tree structure and the FilterReg algorithm based on probability model, the algorithm of this embodiment uses the optimized Super4PCS algorithm for coarse registration, and then combines the KSS-ICP algorithm for fine registration by introducing the shape analysis tool based on manifold space to establish the registration. The algorithm performance is higher than other algorithms, the error value is smaller, and the RMSE is Avg 、MAE Avg , MSE Avg 、MAPE Avg Up to 1.10cm, 0.84cm, 1.21cm 2 , 1.54%. Among them, RMSE Avg 、MAE Avg , MSE Avg 、MAPE Avg It refers to the average value of the root mean square error, mean absolute error, root mean square error, and mean absolute percentage error of the point clouds of 7 Landrace pigs after point cloud registration, which is used to indicate the registration effect between the overall point clouds.

[0156] Table 3: Performance comparison of point cloud registration algorithms.

[0157]

[0158] (3) Pig body measurement results and analysis:

[0159] In order to verify the accuracy of the algorithm for measuring body size based on point cloud contour, the model pig was first measured three times in a laboratory environment using the method of this embodiment and the average value was calculated as the measurement result. The comparison with the manual measurement value is shown in Table 4. As can be seen from Table 4, the maximum and minimum relative errors of the body size parameters simulated in the laboratory environment are 4.84% and 0.21%, respectively; the maximum and minimum absolute errors are 2.46cm and 0.08cm, respectively. The average relative error is 1.54%, and the average absolute error is 0.96cm. The algorithm has high accuracy and good stability, which can lay the foundation for subsequent live pig body size measurement experiments.

[0160] Table 4: Comparison of manual and automatic measurement results of model pigs.

[0161]

[0162] To further verify the effectiveness of the algorithm of this embodiment for measuring the body size of live pigs, 7 Landrace pigs were measured in a farm environment. Since the pigs would have unnatural standing postures such as crawling with their heads down, twisting their heads and backs when collecting point clouds, 3 groups of relatively natural standing point cloud data were selected for each pig to extract body size parameters, and the average value of the three groups was taken as the automatic measurement value. At the same time, the average value of the three manual measurements was taken as the true value. The measurement results are shown in Table 5. By comparing Table 5 with Table 4, it can be concluded that although it is affected by the complex environment of the farm, the body size measurement data of the pigs can be close to or even reach the simulated measurement effect in the laboratory environment.

[0163] Table 5: Comparison of manual and automatic measurement results of live pigs.

[0164]

[0165]

[0166] The comparison results in Table 5 are more intuitive. The comparison results of body measurement errors of pigs with different serial numbers are as follows: Figure 13-14 As shown by Fig.13According to the relative error, the height and width of pig No. 1 are measured with high accuracy, and the relative errors are as low as 0.12% and 0.04%; the abdominal width of pig No. 2 is measured with high accuracy, and the relative error is as low as 0.05%; the hip width of pig No. 3 is measured with low accuracy, and the relative error is as high as 5.78%; the abdominal width of pig No. 4 and No. 5 is measured with low accuracy, and the relative errors are 5.07% and 5.59%, but the length and hip height of pig No. 5 are measured with high accuracy, and the relative errors are as high as 0.16% and 0.29%; the length of pig No. 6 is measured with low accuracy, and the relative error is as high as 3.88%; the width of pig No. 7 is measured with low accuracy, and the relative error is as high as 6.34%. By analyzing the actual body size and error of pigs, it is found that body size affects the error to a certain extent. Pig No. 1 and Pig No. 5 are smaller in size, and their average absolute error and average relative error are also the smallest, which are 0.59cm and 1.16% for Pig No. 1, and 0.78cm and 1.71% for Pig No. 5; Pig No. 2, Pig No. 3 and Pig No. 4 are of moderate size, and their average absolute errors are moderate, which are 1.21cm, 1.01cm and 1.03cm respectively, and their average relative errors are 2.42%, 2.28% and 2.59% respectively; Pig No. 6 and Pig No. 7 are larger in size, and their average absolute errors are the largest, which are 1.41cm and 1.27cm, and their average relative errors are also larger, which are 2.53% for Pig No. 6 and 2.69% for Pig No. 7.

[0167] The average absolute error and average relative error of body size parameters are shown in Table 6. The average absolute error of body length is 1.15 cm, and the average relative error is 1.28%. The body length is mainly measured based on the point cloud of the pig's back contour, so the problem of body floating is better considered, and the error is low; the average absolute errors of body height and hip height are 0.50 cm and 1.16 cm, and the average relative errors are 0.88% and 1.97%. Due to the swing of the pig's hips and the influence of the tail, the positioning of the highest point of the hip joint hip will have a certain deviation compared with the shoulder blade; the average absolute errors of body width, abdominal width, and hip width are 0.60 cm, 0.56 cm, and 0.82 cm, and the average relative errors are 2.71%, 2.83%, and 3.71%. The three types of width measurements are more easily affected than other parameters, so the average relative errors are large. The main reason is that the pig's walking posture is unstable when passing through the collection channel, and there are always various morphological movements such as lowering the head and crawling, twisting the head and twisting the back, which affect the accuracy of the measurement to a certain extent. The average absolute errors of waist circumference and hip circumference are 1.68cm and 1.85cm, and the average relative errors are 2.03% and 2.17%. The box ellipse fitting method can provide a more stable estimation of waist circumference and hip circumference.

[0168] Table 6: Mean absolute error and mean relative error of body size parameters of pigs.

[0169]

[0170]

[0171] To demonstrate the performance advantage of the method of this embodiment, it is compared with three representative existing methods for measuring the body size of pigs, and the results are shown in Table 7. As can be seen from Table 7, the body size parameters measured by the point cloud mirror method are relatively few, and the average absolute error is higher than that of the method of this embodiment. This is because the method uses a mirror algorithm to symmetrically reverse the point cloud data on one side to obtain the complete pig shape, so it is only suitable for the body size measurement of pigs with good body symmetry. In addition, this method is limited by factors such as occlusion and acquisition angle, resulting in inaccurate circumference estimation. The method of this embodiment uses the box ellipse fitting principle to estimate the circumference, so the requirements for data integrity are relatively low, and it is simpler and more efficient. The integrated interactive software LSSA_CAU estimates the body size of livestock based on three-dimensional point cloud data, integrates livestock posture normalization based on 2D / 3D information fusion and bilateral symmetric posture normalization framework, improves the robustness of the calculation process, but the overall mean absolute error of its measurement results is higher than that of the method of this embodiment. This is because when the method uses the posture normalization algorithm for measurement, in order to maintain the ideality of the pig's posture, some body size parameters will be magnified in some cases, especially when the pig has a certain back bending and limb swinging, the measured value will be larger. The point cloud rotation normalization method is a rotation normalization method corrected by the ground normal vector. First, the pig body is adjusted to the standard measurement coordinate system, and then the point cloud data is adjusted according to the direction of the ground normal vector so that the body length, height, and body width of the pig body are aligned with the x, y, and z axes. Although the point cloud rotation normalization method has high accuracy, it depends on the ground point cloud data in the environment. When the ground conditions are complex or irregular, the effect of rotation normalization will be affected, and the method is more suitable for linear body size measurement, not for circumference estimation. The improved LoOP filtering algorithm in the method of this embodiment can better cope with the processing of large-scale pig point cloud data and avoid the influence of equipment and environment. At the same time, the dual-view point cloud registration method can ensure the accuracy of the pig point cloud. Moreover, the method of this embodiment extracts body size parameters at different positions based on the point cloud contour features, which not only solves the problem of relatively few parameters in the current pig body size measurement method, but also effectively reduces the influence of pig contour and body posture floating on the body size parameter measurement results.

[0172] Table 7: Comparison of results of body measurement methods for pigs.

[0173]

[0174] Therefore, in order to address the problems of single parameters, complex equipment and limitations in processing large-scale point cloud data in existing pig body size measurement methods, this embodiment proposes a pig body size measurement method based on dual-view point cloud registration. First, in the point cloud filtering link, an improved LoOP filtering algorithm based on hybrid point cloud data storage is proposed, which can fully utilize the advantages of octrees and KD trees, and effectively solve the problems of outlier judgment and processing errors encountered by traditional methods when processing point cloud data of different dimensions and scales. Compared with the LOF and LoOP filtering algorithms, the efficiency and accuracy are significantly improved. Second, in the point cloud registration link, a dual-view registration method combining coarse registration and fine registration is proposed. Compared with the four types of fine registration algorithms combining ICP, GICP, GMM-Tree, and FilterReg, the RMSE of the dual-view registration method is Avg 、MAE Avg , MSE Avg and MAPE Avg All of them were significantly reduced, 1.10cm, 0.84cm, and 1.21cm respectively 2 and 1.54%, indicating that by refining the pig point cloud registration accuracy, an important foundation can be laid for the subsequent measurement of multiple body size parameters of pigs. Third, on the basis of point cloud filtering and registration, in order to solve the problem of pig contour and body floating, a point cloud contour body size measurement method based on the combination of normal point cloud and alphashapes plane point cloud boundary feature extraction was proposed. The average absolute error of each body size parameter was less than 1.85cm, and the average was 1.04cm; the average relative error was less than 3.71%, and the average was 2.20cm. These errors show that the multi-body size parameter extraction algorithm based on point cloud contour is stable and has good results, which provides a practical new method for non-contact measurement of pig body size.

[0175] It should be appreciated that embodiments of the present invention may be implemented or enforced by computer hardware, a combination of hardware and software, or by computer instructions stored in a non-transitory computer-readable memory. The method may be implemented in a computer program using standard programming techniques - including a non-transitory computer-readable storage medium configured with a computer program, wherein the storage medium so configured causes the computer to operate in a specific and predefined manner - according to the methods and drawings described in the specific embodiments. Each program may be implemented in a high-level procedural or object-oriented programming language to communicate with a computer system. However, if desired, the program may be implemented in an assembly or machine language. In any case, the language may be a compiled or interpreted language. In addition, the program may be run on a programmed ASIC for this purpose.

[0176] In addition, the operations of the process described in this embodiment may be performed in any suitable order, unless otherwise indicated in this embodiment or otherwise clearly contradicted by the context. The process described in this embodiment (or variations and / or combinations thereof) may be performed under the control of one or more computer systems configured with executable instructions, and may be implemented as a code (e.g., executable instructions, one or more computer programs, or one or more applications) executed jointly on one or more processors, by hardware or a combination thereof. The computer program includes a plurality of instructions that may be executed by one or more processors.

[0177] Further, the method can be implemented in any type of computing platform that is operably connected to a suitable computer, including but not limited to a personal computer, a minicomputer, a mainframe, a workstation, a network or distributed computing environment, a separate or integrated computer platform, or in communication with a charged particle tool or other imaging device, etc. Aspects of the present invention can be implemented in machine-readable code stored on a non-transitory storage medium or device, whether removable or integrated into a computing platform, such as a hard disk, an optical read and / or write storage medium, a RAM, a ROM, etc., so that it can be read by a programmable computer, and when the storage medium or device is read by the computer, it can be used to configure and operate the computer to perform the process described herein. In addition, the machine-readable code, or part thereof, can be transmitted via a wired or wireless network. When such media includes instructions or programs that implement the steps described above in conjunction with a microprocessor or other data processor, the invention described in this embodiment includes these and other different types of non-transitory computer-readable storage media. When programmed according to the methods and techniques described in the present invention, the present invention also includes the computer itself. The computer program can be applied to input data to perform the functions described in this embodiment, thereby converting the input data to generate output data stored in a non-volatile memory. The output information can also be applied to one or more output devices such as a display. In a preferred embodiment of the present invention, the converted data represents a physical and tangible object, including a specific visual depiction of the physical and tangible object produced on a display.

[0178] As used in this application, the terms "component", "module", "system", etc. are intended to refer to a computer-related entity, which can be hardware, firmware, a combination of hardware and software, software, or software in operation. For example, a component can be, but is not limited to: a process running on a processor, a processor, an object, an executable file, a thread in execution, a program, and / or a computer. As an example, an application running on a computing device and the computing device can both be components. One or more components can exist in a process and / or thread in execution, and a component can be located in a computer and / or distributed between two or more computers. In addition, these components can be executed from various computer-readable media having various data structures thereon. These components can communicate in a local and / or remote process manner, such as according to a signal having one or more data packets (e.g., data from a component that interacts with another component in a local system, a distributed system, and / or interacts with other systems in a signal manner through a network such as the Internet).

[0179] It should also be understood that the present invention is described through implementation methods, and the embodiments are only clear and complete descriptions of the technical solutions proposed in the claims of the present invention, that is, explanations of the claims. Therefore, when judging whether the technical solutions recorded in the specification of the present invention are sufficiently disclosed, full consideration should be given to the core essence of the solutions defined by the claims. In the specification, there must be other technical problems that are not related to the core technical problems proposed in this embodiment. The corresponding technical features and technical solutions do not belong to the essence of this embodiment and are non-essential technical features. Therefore, they can be referred to as implicit disclosures. Those skilled in the art can fully implement them in combination with existing technologies and common knowledge. Therefore, there is no need to describe them in detail.

[0180] 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 preferred embodiments, those skilled in the art should understand that the technical solutions of the present invention may be modified or replaced by equivalents without departing from the spirit and scope of the technical solutions of the present invention, which should all be included in the scope of the claims of the present invention.

Claims

1. A method for measuring pig body size based on dual-view point cloud registration, characterized in that: The following steps are included: Build a pig point cloud collection system and collect pig bilateral point cloud data; The point cloud data was simplified by using the equal-spacing thinning algorithm, and then the improved LoOP filtering algorithm was used to remove outlier point cloud data to complete the preprocessing of pig point cloud data. The pre-processed point cloud data is subjected to a dual-view registration method combining coarse registration and fine registration to obtain complete pig point cloud data. The manual measurement method is combined with the pig point cloud contour features to define the various parameters of the pig body size. The pig contour features are extracted by combining the normal point cloud and alpha shapes point cloud feature extraction, thus realizing the non-contact measurement of multiple body size parameters of pigs.

2. The method for measuring pig body size based on dual-view point cloud registration according to claim 1, characterized in that: The equal spacing thinning algorithm includes the following simplification steps for the point cloud data: Traverse each point in the point cloud, calculate the distance between it and the nearest neighbor, and take the average value to calculate the average interval Determine the midpoint P between the surrounding discrete point cloud and the pig target point cloud m , the calculation formulas for neighbor distance and average distance are as follows: d i =||p i -p i,nn || In the formula, (x i ,y i , z i )、(x j ,y j , z j ) is the coordinate of the surrounding discrete point cloud and the pig target point cloud, d i The current point Pi and its previous point P i-1 The neighbor distance between them, n is the total number of points in the point cloud, is the average of all neighboring point distances; On the basis of the average interval, a thinning factor threshold fatcor is set, and a point is selected for thinning every factor points. After the points in the point cloud set are thinned, a new point cloud set P' will be formed: P′={p i |i%factor=0} Flexibly set the sampling interval to evenly thin the point cloud.

3. The method for measuring pig body size based on dual-view point cloud registration according to claim 1, characterized in that: The method of removing outlier point cloud data comprises the following steps: According to the data dimension d and the preset dimension threshold d threshold Determine the data structure: if d≤d threshold , then divide the point cloud to be processed into the KD tree; Otherwise, it is divided into octrees, and the corresponding data structure is constructed by dividing the point cloud to generate the subsequent input point cloud data; For each point p i , using the selected data structure to query its k-nearest neighbors N k (p i ), then calculate the point p i Local reachability density LRD: reach-dist t k (p i ,p j )=max{k-dist(p j ),dist(p i ,p j )} In the formula, k-dist(p j ) is point p j The distance to its kth nearest neighbor, dist(p j ) is point p i and p j The distance between them, reach is the reachable distance, reach-dist k (p j , p i ) means taking point p i to p j The actual distance and point p j The larger of the distances to its kth nearest neighbor; The local outlier probability LoOP of each point is calculated using the local reachable density: Where k represents the number of nearest neighbors considered when calculating local density, and N k represents the number of points in the kth cluster. LRD is the "reachability" or proximity of the evaluation point to other nearby points, which is used to measure the density of the area around the point relative to the density of its neighbors. For each point p i , if LoOP(p i ) is close to 1, then p i is an outlier point; If the value is close to 0, then p i For normal points, the LoOP score of each point is output and outliers are marked as needed.

4. The method for measuring pig body size based on dual-view point cloud registration according to claim 1, characterized in that: The acquisition of complete pig point cloud data includes the following steps: The optimized Super4PCS algorithm is used for rough registration. When selecting four coplanar points in the source point cloud, the number of sampling points p0 is increased, and the parallel calculation of the ratio and distance between two pairs of points in the point set is added in the construction and matching of the point pair set. The algorithm's running time parameter t is adjusted, and the optimal viewing angle is obtained by the transformation matrix. Then combine the KSS-ICP algorithm for precise registration; The left and right view point clouds are stitched together to obtain complete three-dimensional point cloud information of the pig.

5. The method for measuring pig body size based on dual-view point cloud registration according to claim 4, characterized in that: The coarse registration comprises the following steps: Select four coplanar point pairs m, n, o, p in the source point cloud P to form a reference point set B; Calculate the ratio α, β and distance l1, l2 between two pairs of points in point set B: l1=||mn||,l2=|||op|| For each point q in the target point cloud Q, draw a sphere with q as the center and l1 and l2 as the radius, set the error limit δ, and obtain two point pair sets U1 and U2: U1={(q i ,q j )|l1-δ≤||q i -q j ||≤l1+δ||} U2={(q i ,q j )||l2-δ≤||q i -q j ||≤l2+δ||} In the point pair sets U1 and U2, find the intersection point f and confirm that the angle between the point pairs in the point base B is close to the preset angle φ. Perform matching verification within the allowable error range. For all point groups in the point cloud Q that can correspond to the point base B, calculate their transformation matrices. Among all transformation matrices, select a transformation matrix that can maximize the matching point set to perform global transformation.

6. The method for measuring pig body size based on dual-view point cloud registration according to claim 4, characterized in that: The KSS-ICP algorithm includes the following processing steps: Normalize the point cloud and calculate the centroid of the point cloud α, which is the arithmetic mean of all point coordinates. The normalized point cloud K is obtained by calculating the vector from each point to the centroid and dividing it by the scale factor s(α) s (a): Where, the scale factor s(α) is the average value of the modulus of the vector from the point to the centroid; In shape space, two normalized point clouds K s (a) and K s (b) is used to measure the difference and use the Hausdorff distance H to replace the original shape metric: In the formula, E d is the Hausdorff distance between two point clouds, O is an element in the rotation group SO(3); Establish a discrete candidate set {O} to represent the rotation transformation, and find the rotation transformation that makes E d Minimize the set of rotation transformations O init : O init ={O i |my E d (O i )},O i ∈{O} Find the optimal transformation O from the discrete candidate set {0} init , and combined with the center displacement C init , forming an initial optimal registration pair (C init , O init ): (C init , O init )={(C i , O j )|min E cd (C i , O j )}in, C i represents the possible center displacement, E cd represents the distance metric after considering the center displacement; The ICP algorithm is used to fine-tune the initial optimal registration pair. The algorithm iterates to minimize the Euclidean distance between the point pairs of the two point clouds until it converges to a solution that meets a certain threshold.

7. The method for measuring pig body size based on dual-view point cloud registration according to claim 1, characterized in that: The multiple body measurement parameters include body length measurement, body height and hip height measurement, body width, abdominal width, hip width measurement, chest circumference and abdominal circumference measurement, wherein the body length measurement includes the following steps: For each point P in the point cloud i , based on the point P in its neighborhood j That is, the distance P i Calculate the normal vectors for all points smaller than the search radius r, and establish a local coordinate system to form the angle arrangement of the point set; αshape boundary extraction is used to optimize the search for neighborhood points. αshape is used to identify the shape boundary of the point set, find the edge of the empty circle with a radius of 1 / α, and form the outer contour of the point cloud. The b-spine curve method is used to fit the body length contour point cloud, and the extreme point C (t i ), calculate the adjacent extreme point C(t i ) and C(t i+1 ) between i : In the formula, x, y, and z represent t i and t i+1 The spatial coordinates of Finally, by accumulating the Euclidean distances between all adjacent extreme points, the pig's body length L is obtained:

8. The method for measuring pig body size based on dual-view point cloud registration according to claim 7, characterized in that: The body height and hip height measurement comprises the following steps: First, segment the pig point cloud contour line to eliminate the interference of the head and tail on the measurement results; Extract the ground point cloud, and take the first convex point obtained from left to right as the highest point of the pig's shoulder blade; The highest convex point obtained from the tail root point to the left is taken as the highest point of the pig's hip joint and buttocks. The ground point cloud is used as the reference plane, and the vertical distance to the ground point cloud is calculated as the body height and buttocks height.

9. The method for measuring pig body size based on dual-view point cloud registration according to claim 1, characterized in that: The body width, abdomen width and hip width measurement comprises the following steps: The head, tail and limbs of the pig point cloud are removed, and the main point cloud outline of the trunk is retained; Calculate the normal vector of the point cloud contour to determine the direction, use the PCA method to align the point cloud so that the Z axis is the main direction, rotate the point cloud to the standard coordinate system, and then project the point cloud in the area to the XY plane; The point cloud contours in the x-axis direction were divided into segments at equal intervals, and the distribution range of each segment in the x-direction was counted. The ones with the largest distribution range were the body width, abdominal width, and hip width.

10. The method for measuring pig body size based on dual-view point cloud registration according to claim 1, characterized in that: The chest and waist measurements include the following steps: Slice the point cloud contours of the pig's abdomen and chest; According to the box ellipse fitting method, the minimum circumscribed rectangle of each part is extracted, and the minimum inscribed ellipse is fitted based on each minimum circumscribed rectangle; Use the fitted ellipse to calculate the chest circumference and abdominal circumference, with BC representing the chest circumference, AC representing the abdominal circumference, BE representing the major axis radius of the chest ellipse, BS representing the minor axis radius of the chest ellipse, AE representing the major axis radius of the abdominal ellipse, and AS representing the minor axis radius of the abdominal ellipse. The calculation formulas for BC and AC are as follows:

Citation Information

Cited By

  • Sheep body size measuring method and device based on three-dimensional reconstruction and point cloud segmentation, medium and program product

    CN120558098A

  • Pig weight estimation method, device, equipment, medium and computer program product

    CN121033260A