Cow limp identification method based on back compensatory motion characteristics

By extracting the back compensatory motion and posture characteristics in the point cloud image of the trunk of the cattle, the problem of low efficiency in the cattle limp recognition in the prior art is solved, and fast and accurate limp recognition is achieved.

CN119785432APending Publication Date: 2025-04-08HENAN UNIV OF SCI & TECH

Patent Information

Application Number
CN202411872738.7
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-12-18
Publication Date
2025-04-08

AI Technical Summary

Technical Problem

In the prior art, the identification efficiency of the cattle lame recognition method is low, and the recognition accuracy of small sample data is not high.

Method used

By obtaining the dorsal trunk point cloud image during cattle movement, key parts are located and the back compensatory motor characteristics and pose characteristics, including the movement characteristics and pose characteristics of the lumbar horn bone, hip horn bone and spinal line, for lame recognition.

Benefits of technology

It improves the efficiency of limp recognition for cattle, can quickly identify limp conditions, and does not require training of models, greatly reducing the time and complexity of the recognition process.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119785432A_ABST
    Figure CN119785432A_ABST
Patent Text Reader

Abstract

The invention belongs to the technical field of intelligent cattle detection, and particularly relates to a cattle limp identification method based on back compensatory motion characteristics. According to the method, key parts of a cattle are positioned according to a back trunk point cloud image, then back compensation features are extracted, and cattle limp recognition is carried out according to the extracted features. The back compensation features are features extracted through deep analysis according to a cattle back movement stability mechanism, and comprise compensation movement features and / or compensation pose features; the compensatory motion characteristics comprise at least one of the average motion speed of the waist angle bone and / or the hip angle bone in the vertical direction, the average motion speed of the waist angle bone and / or the hip angle bone in the x direction, the landing speed of the rear hoof, the asymmetry of the hip angle bone and the sacrum height difference at the landing moment of the rear hoof; the compensatory pose features comprise at least one of the maximum height of the spine line contour, the fitting slope of the spine line contour and the height difference between the hip angle bone and the waist angle bone. The limp identification can be realized without training, and the identification efficiency is improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The invention belongs to the technical field of intelligent detection of cattle, and in particular relates to a method for identifying cattle lameness based on back compensatory movement characteristics. Background Art

[0002] It is reported that the average lameness rate of cattle is 23.5%, causing huge economic losses every year. Timely detection of lame cattle is very important for the welfare of cattle and the economic benefits of ranches. The earliest lameness scoring method was achieved by manual observation. According to the lameness scoring table, the lameness degree of cattle was determined by observing whether the corresponding lameness behavior occurred. However, the manual lameness scoring method is inefficient and subjective.

[0003] Later, scholars began to try to quantify the indicators of manual scoring. At first, they simulated a single lameness indicator, such as the flatness of the back, the support time of the left and right limbs, the relative step length of the left and right limbs, and the fitting curvature of the head and neck contour. And gradually achieved full coverage of manual scoring features. For example, some scholars extracted 6 lameness features by tracking the position of the limbs, including gait asymmetry, speed, tracking, asymmetry of standing time, stride, and ground sensitivity. The feature box plot shows that cattle have different lameness indicators at different lameness stages, verifying the feasibility of 6 motion features extracted based on the swing of the moving limbs for cattle lameness classification.

[0004] With the development of computer vision technology, scholars have begun to capture lameness features that are more detailed and comprehensive than manual lameness scoring tables from the perspective of time and space. Some scholars have used convolutional neural networks to extract micro-motion features in the optical flow map of cattle walking and classify lameness. Some scholars have conducted in-depth analysis of the movement process of cattle, proposed head-four hoof linkage features and back-four hoof linkage features, analyzed the possibility of using different features for lameness detection, and proved that head-four hoof linkage features and back-four hoof linkage features play an important role in distinguishing cattle with different lameness scores.

[0005] The data of the above research are almost all from the side-view RGB image acquisition device. Although the movement of the limbs and hooves of cattle can be clearly seen from the side-view image, the side-view image acquisition device usually requires the camera to be 3-5 meters away from the cattle, which limits the promotion and application of the side-view image acquisition device in cattle farms. Therefore, scholars thought of using a top-view depth camera to shoot videos of cattle walking.

[0006] For example, a Chinese invention patent with application publication number CN113288125A and application publication date 2021.08.24 discloses a lameness detection method based on the motion trajectory of key points of the cattle's body. The basic idea of ​​this method is to extract the hoof trajectory and head motion trajectory of the cattle's sideways walking video, and then extract lameness parameters including stride inconsistency, step time inconsistency, tracking performance, hoof landing sensitivity, hoof support phase ratio inconsistency and head swing amplitude to determine the lameness degree of the cattle. That is, it evaluates the lameness degree of the cattle based on the side view of the cattle, and the back movement stabilization mechanism and back lameness compensation behavior are still unclear.

[0007] For another example, the Chinese invention patent application with application publication number CN116671899A and application publication date 2023.09.01 discloses a method and device for identifying early lameness of cattle based on time series anomaly detection. The basic idea of ​​the method is to obtain cattle gait data, input the cattle gait data into a trained semi-supervised model for abnormal gait identification, and then judge the gait symmetry of the cattle according to the abnormal gait ratio of the cattle, and identify the degree of lameness of the cattle according to the symmetry. This method requires the use of a semi-supervised model for the identification of abnormal gaits. The semi-supervised model needs to be trained, and the process is relatively cumbersome. Abnormal gait identification can only be performed after training is completed, and training requires a lot of time, resulting in low recognition efficiency; moreover, the accuracy of the model depends on the accuracy of the training samples, and it is difficult to achieve high-precision recognition requirements for small samples. Summary of the invention

[0008] The purpose of the present invention is to provide a method for identifying cattle lameness based on back compensatory movement characteristics, so as to solve the problem of low identification efficiency caused by the methods in the prior art.

[0009] In order to solve the above technical problems, the present invention provides a method for identifying cattle lameness based on back compensatory movement characteristics, comprising the following steps:

[0010] 1) Obtaining a point cloud image of the back trunk of the cattle during movement, and locating the key parts of the cattle according to the point cloud image of the back trunk;

[0011] 2) extracting back compensation features according to key parts, the back compensation features include compensatory movement features and / or compensatory posture features, the compensatory movement features include at least one of the average movement speed of the lumbar horn bone and / or the hip horn bone in the vertical direction, the average movement speed of the lumbar horn bone and / or the hip horn bone in the x direction, the landing speed of the hind hoof, the asymmetry of the hip horn bone and the height difference of the sacrum at the moment of the hind hoof landing, and the compensatory posture features include at least one of the maximum height of the spine line contour, the fitting slope of the spine line contour, and the height difference between the hip horn bone and the lumbar horn bone; the x direction is parallel to the movement direction of the cattle;

[0012] 3) Identify cattle lameness based on the extracted back compensation features.

[0013] Furthermore, the key parts located include the hip horn bone; the method for calculating the landing speed of the hind hoof is: determine the xz motion curve of the hip horn bone based on the located hip horn bone, and extract the local minimum point in the motion curve in the xz direction; for a minimum point, take a point near the front and back of the minimum point, calculate the change in the z direction value of the hip horn bone from the point taken behind the minimum point to the minimum point in one frame, and the change in the z direction value of the hip horn bone from the minimum point to the point taken in front of the minimum point in one frame, calculate the average of all the change in the z direction value of the hip horn bone in one frame, and use the average to evaluate the landing speed of the hind hoof; the z direction is the vertical direction.

[0014] Furthermore, the key parts located include the gluteal horn bone; the asymmetry of the gluteal horn bone is calculated as follows: based on the located gluteal horn bone, the movement curves of the left and right gluteal horn bones in the xz direction are determined, and the number of points with different change trends of the left and right gluteal horn bones in the z direction is determined, and the asymmetry of the gluteal horn bone is evaluated using the number; wherein the z direction is the vertical direction.

[0015] Furthermore, the key parts located include the hip horn bone and the sacrum; the method for calculating the height difference of the sacrum at the moment the hind hoof lands on the ground is: according to the located hip horn bone and sacrum, the movement curve of the hip horn bone in the xz direction and the movement curve of the sacrum in the xz direction are determined respectively, and the local minimum point in the movement curve of the hip horn bone in the xz direction is extracted; the position of the local minimum point in the movement curve of the sacrum in the xz direction at the corresponding moment is obtained, a point is taken near the front and back of the position, and the distance between the two points in the z direction of the sacrum is calculated, and the distance is the height difference of the sacrum at the moment the hind hoof lands on the ground; the z direction is the vertical direction.

[0016] Furthermore, the key parts located include the spinal line and the lumbar angle bone; the maximum height of the spinal line contour is calculated as follows: determine the movement curve of the lumbar angle bone in the xy direction according to the located lumbar angle bone, extract the first extreme point in the movement curve of the lumbar angle bone in the xy direction, and determine the spinal line at the moment corresponding to the first extreme point; calculate the maximum value of the spinal line in the z direction, and the maximum value is the maximum height of the spinal line contour; wherein the y direction is along the horizontal direction and perpendicular to the x direction, and the z direction is the vertical direction.

[0017] Furthermore, the key parts located include the spinal line and the lumbar angle bone; the fitting slope of the spinal line contour is calculated as follows: determine the movement curve of the lumbar angle bone in the xy direction according to the located lumbar angle bone, extract the first extreme point in the movement curve of the lumbar angle bone in the xy direction, and determine the spinal line at the moment corresponding to the first extreme point; calculate the fitting slope of the spinal line, and the fitting slope is the fitting slope of the spinal line contour; the y direction is along the horizontal direction and perpendicular to the x direction, and the z direction is the vertical direction.

[0018] Furthermore, the key parts located include the gluteal angle bone and the lumbar angle bone; the height difference between the gluteal angle bone and the lumbar angle bone is calculated as follows: based on the located lumbar angle bone and gluteal angle bone, the average value of the lumbar angle bone in the z direction and the average value of the gluteal angle bone in the z direction are respectively calculated, and the difference between the two average values ​​is calculated, and the difference is the height difference between the gluteal angle bone and the lumbar angle bone; the z direction is the vertical direction.

[0019] Furthermore, the spinal line positioning method is:

[0020] 2.1) Use a sliding window with the same side length and step length to traverse a frame of back trunk point cloud image, calculate the sum of the depth values ​​of each window; find the window with the largest sum of the depth values ​​of the windows in each column, and determine that the coordinates of a certain position of the window are one of the coordinates of the preliminary positioning spine line; the direction of the column is the y direction, and the y direction is horizontal and perpendicular to the x direction;

[0021] 2.2) fitting all the coordinates of the initially located spinal lines determined in step 2.1) to obtain a fitting line, expanding the first set area in the positive and negative directions of y with the fitting line as the starting position, and identifying the expanded area as the area where the spinal line may exist;

[0022] 2.3) Use the sliding window to traverse the area where the spine line may exist, and calculate the sum of the depth values ​​of each window; find the window with the largest sum of depth values ​​in each column, and determine that the coordinates of a certain position of the window are one of the final positioned spine line coordinates; determine the spine line in the back trunk point cloud image of this frame based on all the final positioned spine line coordinates.

[0023] Furthermore, the method for locating the lumbar angle bone is as follows:

[0024] 3.1) Locate the spine line in a frame of back torso point cloud image, and use the spine line to rotate the image so that the angle of the spine line is 0;

[0025] 3.2) Traverse the rotated image column by column along the x direction to find the maximum depth value of each column; for a column, compare the depth value of each pixel in the column with the maximum depth value of the column, and delete the pixels whose difference with the maximum depth value is greater than the set difference threshold; then, find the largest connected domain in the image and use it as the top-level trunk area; the direction of the column is the y direction, and the y direction is horizontal and perpendicular to the x direction;

[0026] 3.3) Traverse along the x direction, calculate the pixel sum of each column in the binary image of the top-level trunk area, find the column with the maximum pixel sum, and identify the column as the column where the lumbar horn bone may exist;

[0027] 3.4) Define a region, where the upper and lower boundaries of the region are the upper and lower boundaries of the trunk, and the left and right boundaries of the region are the boundaries obtained by extending the second set region in the positive and negative directions of x from the column where the lumbar horn bone may exist as the starting position, and the rectangular region is the region where the lumbar horn bone may exist;

[0028] 3.5) Use a sliding window with the same side length and step length to traverse the yz scatter plot of the area where the lumbar horn bone may exist, replace all the points in each window with one point, and replace it with the mean of the y and z coordinates of all the points in the window, so as to obtain a fitting curve using all the replaced points;

[0029] 3.6) Extract the convex hull of the fitting curve, calculate the area between the straight line where any two adjacent points on the convex hull are located and the corresponding points on the fitting curve, and find two points with the largest area on the fitting curve and respectively located near the two maxima of the fitting curve. These two points are the located left and right lumbar angle bones.

[0030] Further, the method for locating the hip angle bone is:

[0031] 4.1) Locate the coccyx region of the back trunk point cloud image;

[0032] 4.2) In the xoy plane, the column where the coccyx region is located is used as the column where the left and right hip angle regions are located, the row from the uppermost side of the trunk to the largest row of the coccyx is used as the row where the right hip angle region is located, and the row from the smallest row of the coccyx to the lowermost side of the trunk is used as the row where the left hip angle region is located; the direction of the column is the y direction, which is horizontal and perpendicular to the x direction;

[0033] 4.3) Retain multiple columns with larger x values ​​in the left hip angle bone area, and use the average value of the points in the retained multiple columns as the coordinates of the rough positioning point of the left hip angle bone point; retain multiple columns with larger x values ​​in the right hip angle bone area, and use the average value of the points in the retained multiple columns as the coordinates of the rough positioning point of the right hip angle bone point;

[0034] 4.4) Two rectangular areas are defined in the xoy plane; the upper and lower boundaries of one of the rectangular areas are respectively the lines after the connecting line of the left lumbar angle bone point and the left hip angle bone point coarse positioning points are translated upward and downward by the set pixels, the left and right boundaries of the rectangular area are both perpendicular to the connecting line of the left lumbar angle bone point and the left hip angle bone coarse positioning points, and one of the boundaries has a point after the left hip angle bone coarse positioning point is translated toward the cow's tail by several pixels, and the other boundary has a point after the left lumbar angle bone coarse positioning point is translated toward the cow's head by several pixels; the upper and lower boundaries of the other rectangular area are respectively the lines after the connecting line of the right lumbar angle bone point and the right hip angle bone point coarse positioning points are translated upward and downward by the set pixels, the left and right boundaries of the rectangular area are both perpendicular to the connecting line of the right lumbar angle bone point and the right hip angle bone coarse positioning points, and one of the boundaries has a point after the right hip angle bone coarse positioning point is translated toward the cow's tail by several pixels, and the other boundary has a point after the right lumbar angle bone coarse positioning point is translated toward the cow's head by several pixels;

[0035] 4.5) The two obtained rectangular areas are processed as follows: a sliding window with a side length equal to the step length is used to traverse the xz scatter plot of the rectangular area, and all points in each window are replaced with a point, and replaced with the mean of the x and z coordinates of all points in the window, so as to obtain a fitting curve using all the replaced points; the convex hull of the fitting curve is extracted, and the area between the straight line where any two adjacent points on the convex hull are located and the corresponding points on the fitting curve is calculated, and the point with the largest area on the fitting curve is found, and the point closest to the cow's tail among the found points is taken as one of the hip angle bone points; the z direction is the vertical direction.

[0036] Furthermore, the method for locating the sacrum is: locate the spinal column line and left and right lumbar angle bones in a frame of back trunk point cloud image; if there is an intersection between the column where the left and right lumbar angle bones are located and the spinal column line, then the intersection is the position of the sacrum; if there is no intersection between the column where the left and right lumbar angle bones are located and the spinal column line, then it is considered that the point closer to the column where the left and right lumbar angle bones are located and the spinal column line is the position of the sacrum; the direction of the column is the y direction, and the y direction is along the horizontal direction and perpendicular to the x direction.

[0037] Furthermore, the method of identifying cattle lameness based on the extracted back compensation features is as follows:

[0038] Compare each back compensatory feature with the corresponding back compensatory feature threshold, and determine the corresponding feature score according to the size relationship between each back compensatory feature and the corresponding back compensatory feature threshold; add the feature scores corresponding to each compensatory movement feature to obtain the total score of the compensatory movement feature, and add the feature scores corresponding to each compensatory posture feature to obtain the total score of the compensatory posture feature; evaluate the degree of lameness of the cattle according to the total score of the compensatory movement feature and the total score of the compensatory movement feature.

[0039] Furthermore, the back compensatory characteristic threshold corresponding to the compensatory movement characteristic is determined by: obtaining the box plots of the compensatory movement characteristics of healthy and mildly lame cows, calculating the average of the lower quartile of the box plot of healthy cows and the upper quartile of the box plot of mildly lame cows, and using the average as the back compensatory characteristic threshold corresponding to the compensatory movement characteristic;

[0040] and / or

[0041] The back compensatory characteristic threshold corresponding to the compensatory posture characteristic is determined as follows: obtain the box plot of the compensatory posture characteristics of cattle with mild lameness and severe lameness, calculate the average of the lower quartile of cattle with mild lameness and the upper quartile of cattle with severe lameness, and use the average as the back compensatory characteristic threshold corresponding to the compensatory posture characteristic.

[0042] Furthermore, the method for obtaining a point cloud image of the back and trunk of a cow during movement is as follows: obtain the point cloud data obtained by photographing the back of the cow during movement, and subtract it from the photographed background depth image, retaining the image area where the difference meets the requirements; find the largest connected domain in the retained image area, and fill the holes in the image area; and then remove the head and neck area in the image, thereby obtaining the point cloud image of the back and trunk of the cow during movement.

[0043] The present invention is a pioneering invention, and its beneficial effects are as follows: the present invention conducts an in-depth analysis of the stable mechanism of the back movement of cattle, and extracts features that can reflect the compensatory behavior of the back of cattle, which specifically include compensatory movement features and / or compensatory posture features, and the compensatory movement features include at least one of the average movement speed of the lumbar horn bone and / or hip horn bone in the vertical direction, the average movement speed of the lumbar horn bone and / or hip horn bone in the x direction, the landing speed of the hind hoof, the asymmetry of the hip horn bone, and the height difference of the sacrum at the moment of the hind hoof landing, and the compensatory posture features include at least one of the maximum height of the spine line contour, the fitting slope of the spine line contour, and the height difference between the hip horn bone and the lumbar horn bone. These features are obtained by locating the key points of the point cloud image of the back trunk of the cattle and then calculating the key point positioning results. The whole process does not require training, which greatly improves the efficiency of recognition. The lameness of cattle can be directly identified quickly by directly using the extracted features. BRIEF DESCRIPTION OF THE DRAWINGS

[0044] Figure 1 is a schematic diagram of an image acquisition device of the present invention;

[0045] Figure 2 The three-dimensional point cloud image of the back trunk area of ​​the cow of the present invention;

[0046] Figure 3 is a spinal line positioning result diagram of the present invention;

[0047] Figure 4is a binary image of the top-level trunk region (Tb) of the present invention;

[0048] Figure 5 is a positioning result diagram of the hookR region of the present invention;

[0049] Figure 6 It is the fitting result of the convex hull line and the positioning result diagram of the waist angle bone point of the present invention;

[0050] Figure 7 It is the positioning result diagram of the coccyx of the present invention;

[0051] Figure 8 is a Thr region diagram of the present invention;

[0052] Fig. 9 It is the fitting result of the convex hull line and the positioning result diagram of the waist angle bone point of the present invention;

[0053] Figure 10(a) , 10(c) They are respectively the xz and xy motion trajectory diagrams of the lumbar angle bone of the present invention;

[0054] Figure 10(b) , 10(d) They are respectively the xz and xy motion trajectory diagrams of the hip horn bone of the present invention;

[0055] Fig.11 is a height curve diagram of the spine of the present invention;

[0056] Fig.12 It is a schematic diagram of the calculation method of Zh1, Zh2, Zh3 and Zh4 of the present invention;

[0057] Fig.13 It is a schematic diagram of the calculation method of Psz of the present invention;

[0058] Fig.14 is a box plot of Pvx of the present invention;

[0059] Fig.15 The present invention is a flow chart of a method for identifying cattle lameness based on back compensatory movement characteristics. DETAILED DESCRIPTION

[0060] The core concept of the present invention is to locate the key parts of the cattle according to the point cloud image of the back trunk, and then extract the back compensation features according to the key parts, and identify the lameness of the cattle according to the extracted back compensation features. The back compensation features are features extracted by in-depth analysis based on the stable mechanism of the back movement of the cattle, specifically including compensatory movement features and / or compensatory posture features, wherein the compensatory movement features include at least one of the average movement speed of the lumbar horn bone and / or the hip horn bone in the vertical direction, the average movement speed of the lumbar horn bone and / or the hip horn bone in the x direction, the landing speed of the hind hoof, the asymmetry of the hip horn bone and the height difference of the sacrum at the moment of the hind hoof landing, and the compensatory posture features include at least one of the maximum height of the spine line contour, the fitting slope of the spine line contour, and the height difference between the hip horn bone and the lumbar horn bone; the x direction is parallel to the direction of movement of the cattle. Thereby, no training is required, and the efficiency of recognition is greatly improved.

[0061] In order to make the purpose, technical solutions and advantages of the present invention more clear, the present invention is further described in detail below with reference to the accompanying drawings and embodiments.

[0062] The present invention provides a method for identifying cattle lameness based on back compensatory movement characteristics. The method first collects top-view depth walking images of cattle on the road returning to the cowshed to construct a data set. Then, according to the skeletal structure characteristics and movement mechanism of cattle, the key parts of the cattle are located: lumbar horn bone, hip horn bone, sacrum, and spinal line, and the movement curve of the key parts is drawn according to the positioning results; then, the back compensatory movement characteristics and back compensatory posture characteristics are extracted according to the drawn movement curve and spinal height curve; on this basis, a threshold discrimination method is used to construct a lameness classification model. The specific process is as follows: Fig.15 As shown, the content is as follows:

[0063] Step 1: Data collection.

[0064] After milking, Holstein cows in the lactating period will return to the cowshed through a fixed passage, and the process is filmed. The depth camera (Intel RealSense D455) is installed just above the center of the passage, 2.7 meters above the ground, and the camera is tilted 33° in the direction of the cow's movement to capture the complete walking process of the cow. Figure 1 As shown. Before shooting the video of the cow walking, take a depth image of the background (excluding the cow) for subsequent background removal. When the cow enters the field of view of the top view camera, the depth camera starts shooting, and when it completely leaves the field of view of the top view camera, the depth camera stops shooting. The shooting process can be controlled manually.

[0065] Step 2: Build a data set. Specifically:

[0066] 1) Video screening: Screen the videos taken and remove those showing cattle gathering or being still.

[0067] 2) Manual lameness scoring: Three experienced observers manually scored the cattle walking videos and classified the cattle into healthy (S category), mild lameness (ML category) and severe lameness (SL category).

[0068] 3) Point cloud coordinate system conversion. First, the pixel coordinate system in the depth image is converted to the world coordinate system using the intrinsic reference data obtained through calibration of the depth camera. Then, a plane fitting is performed based on the captured ground part to obtain the ground expression. Then, the actual ground is used as the new XOY plane to rotate the point cloud.

[0069] 4) Background removal. First, subtract the acquired point cloud data from the captured background depth image, and retain the image area with a difference value less than -500 (in pixels); then find the largest connected domain in the image; finally fill the holes in the image to obtain pure point cloud data of the cow's back.

[0070] 5) Removal of the head and neck. Since the head and neck are relatively narrow, a statistical method is used to find the narrowest column in the trunk area, and the right area of ​​the column is removed, leaving the back trunk area of ​​the cow. The point cloud image of the back trunk area and the constructed xyz coordinate system are as follows: Figure 2 As shown in the figure. The z coordinate is the depth coordinate.

[0071] Step three: Locate the key parts of the cow's back.

[0072] According to the bone structure and movement mechanism of cattle, this embodiment selects the lumbar angle bone, hip angle bone, spinal line, and sacrum as the key parts of the back of the cattle, and locates these key parts.

[0073] 1. Positioning of the cow's spine line. According to the physiological structure of the cow, the spine line is located near the symmetry line of the cow's back trunk, and the area where the spine line is located is higher than the nearby back surface. The spine line positioning process based on this design is as follows:

[0074] (1) The first positioning of the spine. Use a sliding window with a side length of 5 pixels and a step size of 5 pixels to traverse the entire cow area in the xoy plane and calculate the sum of the depth values ​​of each window. Find the window with the largest sum of depth values ​​in each column of windows, and consider the coordinates (x, y) of the upper left corner of the window as one of the coordinates of the cow's spine. The direction of the column here is parallel to the y-axis direction.

[0075] (2) Spinal line fitting. After the first traversal search, the (x, y) coordinates of the spine of the cattle are fitted using the least squares method, and the points with large differences from the fitted values ​​are removed. The spine fitting line is extended along the positive and negative directions of the y axis by 30 lines respectively (the area obtained by extending 30 lines is the first set area, which can be adjusted according to actual conditions) and is considered to be the area Br where the spine line may exist.

[0076] (3) Final positioning of the spine line. Use a sliding window with a side length of 5 pixels and a step size of 5 pixels to traverse the area Br where the spine line may exist along the xoy plane. The coordinate value of the spine line is found again in the same way as the first positioning method. Figure 3 The blue circle is the positioning result of the spine line.

[0077] 2. Positioning of the horn bones of cattle. The horn bones of cattle are a pair of bone structures with protruding features and symmetrically distributed on both sides of the spine line. According to their physiological characteristics, the positioning method of the horn bones used in the present invention is as follows:

[0078] (1) Image correction: According to the inclination angle of the spine fitting line, the image is rotated so that the angle of the cow spine fitting line is 0.

[0079] (2) Locate the top-level trunk region. Traverse the cow region column by column along the x-axis direction, find the maximum z value Zjmax (i.e., the maximum depth value) of each column, and compare the z value of each pixel in the column with Zjmax, and delete the pixels whose difference with Zjmax is greater than 100 (i.e., the set difference threshold, in pixels). Next, find the largest connected domain in the image as the top-level trunk region Tb. Figure 4 Shown is a binary image of the Tb region.

[0080] (3) Find the column where the lumbar horn bone may be located. Traverse along the x-axis direction, calculate the pixel sum of each column in the binary image of the Tb region, and find the column with the maximum pixel sum. This is considered to be the column hookj where the lumbar horn bone may be located. Figure 4 The red mark in the hookj is the column where the lumbar bone may be located.

[0081] (4) Positioning of the lumbar angle bone.

[0082] ① Define a rectangular area with hookj column as the center. The left and right boundaries of the rectangular area are the boundaries obtained by extending hookj column by 10 columns along the negative and positive directions of the x-axis respectively (the area extended by 10 columns is the second set area, which can be adjusted according to actual conditions). The upper and lower boundaries are the upper and lower boundaries of the trunk, which are the areas where the lumbar angle bones may exist, such as Figure 5 The red area in the 3D point cloud shown is the hookR area.

[0083] ② Ignore the x coordinate of the hookR region. In order to simplify the y and z values ​​in this region into a curve, use a sliding window of size 5*5 and step length 5 (pixels) to traverse the yz scatter plot, and replace all points in each window with one point. The y coordinate of the replacement point is the mean of the y coordinates of all points in the sliding window, and the z coordinate of the replacement point is the mean of the z coordinates of all points in the sliding window, thus obtaining a yz fitting curve of the hookj column.

[0084] ③ Construct the minimum convex polygon of the fitting curve, i.e., the convex hull. Calculate the area between the straight line fitted by the i-th point and the i+1 point of the convex hull and the corresponding point of the yz fitting curve, and find the two points with the largest area on the yz fitting curve, which are close to the two local maximum points of the yz curve and are located at both ends. These two points are the left and right lumbar bone points Hl and Hr of the cattle trunk. Figure 6 The figure shows the fitting result of the convex hull line. The blue points in the figure represent the yz fitting curve of the hookj column, the red solid line represents the convex hull fitting line, and the green marked points are the positioning results of the left and right lumbar angle bone points.

[0085] 3. Positioning of hip horn bones of cattle. The hip horn bones of cattle are a pair of bone structures with protruding features and symmetrically distributed on both sides of the coccyx. According to their physiological characteristics, the positioning method of hip horn bones used in the present invention is as follows:

[0086] (1) Coccygeal location. First, crop the image and crop the images with y values ​​greater than (hookj+40) (40 refers to pixels) to obtain the rear half image of the cow. According to the depth value of the rear half image, convert the depth image into a color image. A yolov8 model (other target location models in the prior art can also be used) is trained to locate the position of the coccygeal bone in the rear half image. Figure 7 The figure shows the positioning result of the coccyx. The area within the red outline in the figure is the positioning result of the coccyx.

[0087] (2) Positioning of the left and right hip angle bone regions. Define the left and right hip angle bone regions in the xoy plane. The column where the coccyx region is located is used as the column where the left and right hip angle bone regions are located. The right hip angle bone region pinR1 is defined from the top of the trunk to the largest row of the coccyx; the left hip angle bone region pinL2 is defined from the smallest row of the coccyx to the bottom of the trunk.

[0088] (3) Rough positioning of the hip angle bone. Keep the 10 columns with the largest x-values ​​in the left hip angle bone area (the direction with the larger x-value is toward the bull's head), and use the average value of the points in the hip angle bone area here as the coordinate value Pl1 of the left hip angle bone point; keep the 10 columns with the largest x-values ​​in the right hip angle bone area, and use the average value of the points in the hip angle bone area here as the coordinate value of the rough positioning point Pr1 of the right hip angle bone. The left hip angle bone is located on the left side of the right hip angle bone, so its y value must be smaller than the y value of the right hip angle bone. Therefore, compare the y values ​​of the left and right hip angle bones. If the y value of the left hip angle bone is larger than the y value of the right hip angle bone, then swap the x, y, and z values ​​of the left and right hip angle bones.

[0089] (4) Accurate positioning of the hip angle bone point.

[0090] ① The precise positioning methods of the left hip angle bone point and the right hip angle bone point are similar. Here we only introduce the positioning method of the left hip angle bone point. Define a region Thr in the xoy plane. The upper and lower boundaries of this region are the line connecting the left hip angle bone point Hl and the coarse positioning point Pl1 of the left hip angle bone translated 10 pixels upward and downward respectively. The left boundary is the straight line connecting the left hip angle bone point Hl and the left hip angle bone point Pl1 translated 100 pixels in the negative direction of the x-axis (actually towards the cow's tail), and perpendicular to the line connecting the left hip angle bone point Hl and the left hip angle bone point Pl1. The right boundary is the straight line connecting the left hip angle bone point Hl and the left hip angle bone Pl1 translated 100 pixels in the positive direction of the x-axis (actually towards the cow's head), and perpendicular to the line connecting the left hip angle bone Hl and the left hip angle bone Pl1. The defined region Thr is as follows: Figure 8 Shown in red area.

[0091] ② Ignore the y coordinate of the area, simplify the x and z values ​​in the area, process the points on the xz plane with a sliding window of size 5*5 and step length 5 (pixels), and replace all points in each window with a point, where the x coordinate of the replacement point is the mean of the x coordinates of all points in the sliding window, and the z coordinate of the replacement point is the mean of the z coordinates of all points in the sliding window. Thus, an xz curve is obtained.

[0092] ③ Construct the minimum convex polygon of the xz curve, i.e. the convex hull. Calculate the area between the straight line fitted by the i-th fitting point of the convex hull and the i+1 fitting point and the xz curve to find the point with the largest area. This point is located on the xz curve and close to the extreme point of the xz curve. The extreme point with the smallest x value is taken as the left hip angle bone point. Fig. 9 The figure shows the fitting result of the convex hull line, where the blue points represent the xz curve and the red solid line represents the convex hull fitting line. The green-marked points in the figure are the positioning results of the left and right lumbar angle bone points.

[0093] The method for locating the right hip angle bone point is similar to that for locating the left hip angle bone point, and will not be repeated below.

[0094] 4. Sacrum positioning. The sacrum is located in the middle of the left and right lumbar bones. If there is an intersection between the left and right lumbar bones and the spine line, then the intersection is the location of the sacrum. If there is no intersection between the left and right lumbar bones and the spine line, then the point closer to the left and right lumbar bones and the spine line is the location of the sacrum.

[0095] Step 4: Draw the motion curve of key parts.

[0096] 1. Draw the three-dimensional motion curves of the left and right lumbar angle bones and hip angle bones.

[0097] According to the positioning results of the left and right lumbar angle bones and hip angle bones, the xy motion curves and xz motion curves of the left and right lumbar angle bones are drawn respectively, and the curves are preprocessed.

[0098] First, outliers in the curve are detected and replaced. Outliers are detected using a window of length 5, and outliers are defined as elements that differ from the local median by more than three times the local divisor (MAD) within the specified window length. This method is also called the Hampel filter. The filling method to replace outliers is linear interpolation based on adjacent non-outlier values. The curve is then smoothed. Smoothing is performed using weighted linear least squares and local regression with a quadratic polynomial model. The number of data points used to calculate the smoothed value is 7.

[0099] The motion curves of the left and right lumbar angle bones and hip angle bones after treatment are as follows Figures 10(a) to 10(d) shown.

[0100] 2. Drawing of the spine height curve.

[0101] Get the height of the spine line corresponding to the first extreme point of the xy curve of the cow's flank bone, and draw the cow's spine height line. Since the value of the spine curve is relatively large, it is not conducive to subsequent data processing, so calculate the relative height of the spine curve. Find the minimum value of the first 1 / 2 segment of the spine contour curve, and subtract the minimum value from the contour curve to get the relative height of the spine curve, such as Fig.11 As shown in the figure, outliers are replaced and curves are smoothed on the spine contour line.

[0102] Step 5: Extract back compensation features.

[0103] 1. Compensatory movement characteristics. Specifically include the following characteristics:

[0104] (1) The average movement speed Pvx of the left and right lumbar and hip angle bones along the x-axis. The calculation method is: calculate the movement speed of the left and right lumbar and hip angle bones of the cattle along the x-axis respectively, and calculate the average value. This feature reflects whether the cattle have the ability to move freely.

[0105] (2) The average movement speed Pvz of the left and right flank bones and hip horn bones along the z-axis. The calculation method is: calculate the movement speed of the left and right flank bones and hip horn bones along the z-axis of the cattle respectively, and calculate the average value. This feature reflects whether the cattle's limbs and hooves are fully lifted and stretched.

[0106] (3) Hind hoof landing speed Ppz. The calculation method is: find all local minimum points in the hip horn bone xz curve, and calculate the average value of the z value change within the range of two points on the left and right sides of the minimum point in the left and right hip horn bone xz curves, as shown in formula (1). Although this value is a distance value, it can reflect the landing speed of the hind hoof, which is the change in the z direction of one frame. According to the analysis of the side and top views of cattle walking videos, it is found that the local minimum point of the hip horn bone usually corresponds to the landing point of the cattle's moving hind hoof. Therefore, this characteristic value represents the landing speed of the hind hoof at the moment of landing, reflecting whether the hind hoof has normal support ability.

[0107] Pzm=(Zh1+Zh2+Zh3+Zh4) / 8 (1)

[0108] Among them, the calculation method of Zh1, Zh2, Zh3, and Zh4 is as follows Fig.12 shown.

[0109] It should be noted that formula (1) is a calculation method for a minimum value. If there are multiple minimum points, the multiple minimum points can be calculated according to formula (1), and then the average value of the calculation results of all minimum points corresponding to formula (1) is calculated as the final result.

[0110] (4) Asymmetry of the hip horn bone Plr. The calculation method is: find the number of points where the z-values ​​of the left and right hip horn bones have different rising and falling trends. This number can reflect the asymmetry of the left and right hip horn bones. According to the analysis of the videos of cattle walking from the side and top views, the hip horn bone of the cattle is a structure that maintains the balance of the body. Its function is more like a fixed fulcrum of the lumbar horn bone. Therefore, when a normal cattle walks, the left and right hip horn bones should rise or fall along the z-axis at the same time. When a diseased hoof of the cattle touches the ground, in order to relieve the pain, the cattle will make compensatory movements, and its left and right hip horn bones will show different change trends. This feature reflects the symmetry of the cattle's movement.

[0111] (5) Sacral height difference Psz at the moment of hind hoof landing. The calculation method is: obtain the z-value change curve of the sacrum in the frame corresponding to the hind hoof landing point (i.e., the minimum value point in the xz curve of the hip horn bone) and the two frames before and after, and calculate the difference between the maximum and minimum values, as follows: Fig.13 shown. Fig.13The point marked in red is the landing point. The sacrum of the cattle is almost located in the center of the hindquarters of the cattle, and its height change basically reflects the height change of the entire hindquarters. When the cattle walk normally, the stride and lift height of the hind hoof are large, so the up and down swing amplitude of the hindquarters and sacrum is also large when the hind hoof lands on the ground; when the cattle suffer from lameness and the limbs and hooves are stiff, the stride and lift height of the hind hoof are small, so the up and down swing amplitude of the hindquarters and sacrum is also small when the hind hoof lands on the ground. This feature indirectly reflects the followability of the cattle's movement.

[0112] 2. Compensatory posture characteristics.

[0113] (1) The maximum height Pbm of the spine line contour at the suspended point. The calculation method is: obtain the spine line corresponding to the first extreme point of the xy curve of the lumbar horn bone of the cow, and calculate the maximum value Pbm of the spine line height in this frame. Since the height of the cow's spine will change when the cow walks, it is necessary to extract the spine line features corresponding to a certain state of the cow. According to the analysis of the cow's walking video from the side and top views, the extreme points of the xy curves of the cow's left and right lumbar horn bones usually correspond to the moment when the cow's moving limbs and hooves reach the bottom of the trunk. This feature value reflects whether the cow has an arched back.

[0114] (2) The fitting slope Pbx of the spine line contour at the suspended point. The calculation method is as follows: the spine line corresponding to the first extreme point of the xy curve of the flank bone of the cattle is obtained in the same way as the maximum height Bmax of the spine line contour, and the fitting slope Pbx of the spine line of this frame is calculated using the least squares method. This feature reflects whether the center of gravity of the cattle's body is transferred forward or backward. It should be noted that the "suspended point" in the names of Pbm and Pbx refers to the cattle's hind hooves being suspended.

[0115] (3) The height difference Pd between the hip angle bone and the lumbar angle bone. It is calculated by calculating the difference between the average value of the z-value variation range of the left and right hip angle bones and the average value of the z-value variation range of the left and right lumbar angle bones. According to the skeletal structure of cattle, the hip angle bone of normal cattle is slightly lower than the lumbar angle bone. When the cattle are severely lame, in order to reduce the load, the upper joints of the hind hoof flex to lower the center of the rear half of the trunk. Therefore, when cattle with severe lameness are walking, the height of the hip angle bone will be significantly lower than the height of the lumbar angle bone. Therefore, this feature reflects the support ability of the hind hoof.

[0116] Step six, lameness classification.

[0117] The idea of ​​the threshold segmentation method is to use the set threshold and the superposition of compensatory movement behaviors to provide lameness scores for lame cattle. First, find a suitable threshold for each feature based on the feature box plot, and use the threshold to determine whether the cattle have the lameness behavior corresponding to the feature; then determine the degree of lameness of the cattle based on the superposition of different lameness behaviors.

[0118] (1) Identification of lameness behavior.

[0119] After analyzing the box plots of the eight characteristics, it was found that the difference between the compensatory movement characteristics of S-type cattle and ML and SL-type cattle was more obvious. The movement range of S-type cattle was larger, while the movement range of ML and SL-type cattle was smaller. The difference between S, ML and SL-type cattle in compensatory posture characteristics was more obvious, and the degree of posture abnormality of SL-type cattle was higher than that of S and ML-type cattle. Therefore, the classification method designed is as follows:

[0120] First, a threshold is set for each feature to determine whether the cattle have the corresponding compensatory behavior. For each compensatory movement feature, the discrimination threshold is determined by the box plot of the S and ML classes, and the specific calculation method is the average of the lower quartile of the S feature box and the upper quartile of the ML feature box. For each compensatory posture feature, the discrimination threshold is determined by the box plot of the ML and SL classes, and the specific calculation method is the average of the lower quartile of the ML feature box and the upper quartile of the SL feature box. Then, according to the threshold corresponding to each feature and the distribution of different scoring feature boxes, it is judged whether the cattle have the corresponding compensatory feature, and the feature is assigned a two-dimensional feature of "0" (normal) and "1" (lameness).

[0121] Taking the compensatory movement feature Pvx as an example, firstly, according to its box plot ( Fig.14 ) to obtain Pvx1 and Pvx2, and calculate the threshold Tvx according to the following formula (2):

[0122] T Vx =(Pvx1+Pvx2) / 2 (2)

[0123] Then, according to the feature boxes of the three scores, it can be seen that the walking speed of ML and SL cattle is generally lower than that of S cattle. Therefore, when the average walking speed Pvxi of cattle along the x-axis is greater than the threshold Tvx, it is considered that the cattle do not show this lame behavior, and the value of the two-dimensional feature Pvx is "0". When the average walking speed Vx of cattle along the x-axis is less than the threshold Tvx, the cattle are suspected of having lame symptoms, and the value of the two-dimensional feature Bvx of the behavior speed is "1". The specific calculation method is shown in the following formula (3). Among them, the value of the two-dimensional feature can also be called the feature score.

[0124]

[0125] Where Pvxi represents the average movement speed of a cow along the x-axis.

[0126] Using the above method, the thresholds Tvz, Tpz, Tlr, Tlz, Tbm, Tbx, and Td of the other seven features and the two-dimensional features Bvz, Bpz, Blr, Blz, Bbm, Bbx, and Bd of other features can also be obtained.

[0127] (2) Classification of lameness degree.

[0128] Calculate the two-dimensional feature Bmov of the compensatory movement feature (also called the total score of the compensatory movement feature):

[0129] Bmov=Bvx+Bvz+Bpz+Blr+Blz (4)

[0130] Calculate the two-dimensional feature Bpos of the compensatory posture feature (also called the total score of the compensatory posture feature):

[0131] Bpos=Bbm+Bbx+Bd (5)

[0132] Based on the above two characteristic values, the total lameness score of the cattle is calculated using the following formula:

[0133]

[0134] It should be noted that in order to comprehensively consider the lameness of cattle, the selected features are features that include all features, specifically including compensatory movement features and compensatory posture features, wherein the compensatory movement features include the average movement speed of the lumbar horn bone and the hip horn bone in the vertical direction, the average movement speed of the lumbar horn bone and the hip horn bone in the x direction, the landing speed of the hind hoof, the asymmetry of the hip horn bone and the height difference of the sacrum at the moment of the hind hoof landing, and the compensatory posture features include the maximum height of the spine line contour, the fitting slope of the spine line contour, and the height difference between the hip horn bone and the lumbar horn bone. Considering the actual situation, only one type of feature from the compensatory movement feature and the compensatory posture feature can be selected for cattle lameness identification; moreover, one, two or more than three features of the compensatory movement features can be selected according to the actual situation, and one, two or more than three features of the compensatory movement features can be selected.

[0135] In summary, the present invention has the following characteristics: 1) The present invention conducts an in-depth analysis of the back movement stabilization mechanism of cattle, extracts the back lameness compensatory movement and compensatory posture characteristics, and realizes top-view lameness detection; 2) Based on the distribution characteristics of the lumbar horn bones of cattle, an efficient lumbar horn bone positioning method is proposed; 3) Based on the distribution characteristics of the hip horn bones of cattle, an efficient hip horn bone positioning method is proposed; 4) A threshold-based lameness classification method is proposed. This method first calculates a threshold based on a feature box plot, and determines whether the cattle have a certain lameness compensatory behavior based on this threshold, and then determines the lameness degree based on the number and type of lameness compensatory behaviors that occur in the cattle. This classification method does not require training and is more adaptable to the classification of small sample data.

[0136] Specific implementation methods are given above, but the present invention is not limited to the described implementation methods. The basic idea of ​​the present invention lies in the above basic scheme. For ordinary technicians in this field, it does not take creative work to design various deformed models, formulas, and parameters according to the teachings of the present invention. Changes, modifications, substitutions, and variations of the implementation methods without departing from the principles and spirit of the present invention still fall within the scope of protection of the present invention.

Claims

1. A method for identifying cattle lameness based on back compensatory movement characteristics, characterized in that: The steps include: 1) Obtaining a point cloud image of the back trunk of the cattle during movement, and locating the key parts of the cattle according to the point cloud image of the back trunk; 2) extracting back compensation features according to key parts, the back compensation features include compensatory movement features and / or compensatory posture features, the compensatory movement features include at least one of the average movement speed of the lumbar horn bone and / or the hip horn bone in the vertical direction, the average movement speed of the lumbar horn bone and / or the hip horn bone in the x direction, the landing speed of the hind hoof, the asymmetry of the hip horn bone and the height difference of the sacrum at the moment of the hind hoof landing, and the compensatory posture features include at least one of the maximum height of the spine line contour, the fitting slope of the spine line contour, and the height difference between the hip horn bone and the lumbar horn bone; the x direction is parallel to the movement direction of the cattle; 3) Identify cattle lameness based on the extracted back compensation features.

2. The method for identifying cattle lameness based on back compensatory movement characteristics according to claim 1, characterized in that: The key parts located include the hip horn bone; the z direction is defined as the vertical direction; The method for calculating the landing speed of the hind hoof is as follows: determine the xz motion curve of the horn bone according to the located horn bone, and extract the local minimum point in the motion curve in the xz direction; for a minimum point, take a point near the front and rear of the minimum point, calculate the change in the z direction value of the horn bone in one frame from the point taken behind the minimum point to the point taken in front of the minimum point, and calculate the change in the z direction value of the horn bone in one frame from the point taken behind the minimum point to the point taken in front of the minimum point, calculate the average of all the change in the z direction value of the horn bone in one frame, and use the average to evaluate the landing speed of the hind hoof; and / or The asymmetry of the hip horn bone is calculated as follows: based on the located hip horn bone, the movement curves of the left and right hip horn bones in the xz direction are determined, the number of points with different change trends of the left and right hip horn bones in the z direction is determined, and the asymmetry of the hip horn bone is evaluated using the number.

3. The method for identifying cattle lameness based on back compensatory movement characteristics according to claim 1, characterized in that: Key sites located include the hip angle bone and sacrum; The method for calculating the sacrum height difference at the moment when the hind hoof lands is as follows: determine the movement curve of the hip horn bone in the xz direction and the movement curve of the sacrum in the xz direction respectively according to the located hip horn bone and sacrum, and extract the local minimum point in the movement curve of the hip horn bone in the xz direction; obtain the position of the local minimum point in the movement curve of the sacrum in the xz direction at the corresponding moment, take a point near the front and back of the position, and calculate the distance between the two points in the z direction of the sacrum, which is the sacrum height difference at the moment when the hind hoof lands; the z direction is the vertical direction.

4. The method for identifying cattle lameness based on back compensatory movement characteristics according to claim 1, characterized in that: The key parts located include the spine line and the lumbar angle bone; the y direction is defined as the horizontal direction and perpendicular to the x direction, and the z direction is the vertical direction; The maximum height of the spine line profile is calculated as follows: determine the motion curve of the lumbar angle bone in the xy direction according to the located lumbar angle bone, extract the first extreme point in the motion curve of the lumbar angle bone in the xy direction, and determine the spine line at the time corresponding to the first extreme point; calculate the maximum value of the spine line in the z direction, and the maximum value is the maximum height of the spine line profile; and / or The fitting slope of the spine line contour is calculated as follows: determine the movement curve of the lumbar horn bone in the xy direction based on the located lumbar horn bone, extract the first extreme point in the movement curve of the lumbar horn bone in the xy direction, and determine the spine line at the moment corresponding to the first extreme point; calculate the fitting slope of the spine line, and the fitting slope is the fitting slope of the spine line contour.

5. The method for identifying cattle lameness based on back compensatory movement characteristics according to claim 1 or 4, characterized in that: The spinal line is located as follows: 2.1) Use a sliding window with the same side length and step length to traverse a frame of back trunk point cloud image, calculate the sum of the depth values ​​of each window; find the window with the largest sum of the depth values ​​of the windows in each column, and determine that the coordinates of a certain position of the window are one of the coordinates of the preliminary positioning spine line; the direction of the column is the y direction, and the y direction is horizontal and perpendicular to the x direction; 2.2) fitting all the coordinates of the initially located spinal lines determined in step 2.1) to obtain a fitting line, expanding the first set area in the positive and negative directions of y with the fitting line as the starting position, and identifying the expanded area as the area where the spinal line may exist; 2.3) Use the sliding window to traverse the area where the spine line may exist, and calculate the sum of the depth values ​​of each window; find the window with the largest sum of depth values ​​in each column, and determine that the coordinates of a certain position of the window are one of the final positioned spine line coordinates; determine the spine line in the back trunk point cloud image of this frame based on all the final positioned spine line coordinates.

6. The method for identifying cattle lameness based on back compensatory movement characteristics according to claim 1 or 4, characterized in that: The positioning method of the lumbar angle bone is: 3.1) Locate the spine line in a frame of back torso point cloud image, and use the spine line to rotate the image so that the angle of the spine line is 0; 3.2) Traverse the rotated image column by column along the x direction to find the maximum depth value of each column; for a column, compare the depth value of each pixel in the column with the maximum depth value of the column, and delete the pixels whose difference with the maximum depth value is greater than the set difference threshold; then, find the largest connected domain in the image and use it as the top-level trunk area; the direction of the column is the y direction, and the y direction is horizontal and perpendicular to the x direction; 3.3) Traverse along the x direction, calculate the pixel sum of each column in the binary image of the top-level trunk area, find the column with the maximum pixel sum, and identify the column as the column where the lumbar horn bone may exist; 3.4) Define a region, where the upper and lower boundaries of the region are the upper and lower boundaries of the trunk, and the left and right boundaries of the region are the boundaries obtained by extending the second set region in the positive and negative directions of x from the column where the lumbar horn bone may exist as the starting position, and the rectangular region is the region where the lumbar horn bone may exist; 3.5) Use a sliding window with the same side length and step length to traverse the yz scatter plot of the area where the lumbar horn bone may exist, replace all the points in each window with one point, and replace it with the mean of the y and z coordinates of all the points in the window, so as to obtain a fitting curve using all the replaced points; 3.6) Extract the convex hull of the fitting curve, calculate the area between the straight line where any two adjacent points on the convex hull are located and the corresponding points on the fitting curve, and find two points with the largest area on the fitting curve and respectively located near the two maxima of the fitting curve. These two points are the located left and right lumbar angle bones.

7. The method for identifying cattle lameness based on back compensatory movement characteristics according to claim 1, 2 or 3, characterized in that: The method of locating the hip angle bone is: 4.1) Locate the coccyx region of the back trunk point cloud image; 4.2) In the xoy plane, the column where the coccyx region is located is used as the column where the left and right hip angle regions are located, the row from the uppermost side of the trunk to the largest row of the coccyx is used as the row where the right hip angle region is located, and the row from the smallest row of the coccyx to the lowermost side of the trunk is used as the row where the left hip angle region is located; the direction of the column is the y direction, which is horizontal and perpendicular to the x direction; 4.3) Retain multiple columns with larger x values ​​in the left hip angle bone area, and use the average value of the points in the retained multiple columns as the coordinates of the rough positioning point of the left hip angle bone point; retain multiple columns with larger x values ​​in the right hip angle bone area, and use the average value of the points in the retained multiple columns as the coordinates of the rough positioning point of the right hip angle bone point; 4.4) Two rectangular areas are defined in the xoy plane; the upper and lower boundaries of one of the rectangular areas are respectively the lines after the connecting line of the left lumbar angle bone point and the left hip angle bone point coarse positioning points are translated upward and downward by the set pixels, the left and right boundaries of the rectangular area are both perpendicular to the connecting line of the left lumbar angle bone point and the left hip angle bone coarse positioning points, and one of the boundaries has a point after the left hip angle bone coarse positioning point is translated toward the cow's tail by several pixels, and the other boundary has a point after the left lumbar angle bone coarse positioning point is translated toward the cow's head by several pixels; the upper and lower boundaries of the other rectangular area are respectively the lines after the connecting line of the right lumbar angle bone point and the right hip angle bone point coarse positioning points are translated upward and downward by the set pixels, the left and right boundaries of the rectangular area are both perpendicular to the connecting line of the right lumbar angle bone point and the right hip angle bone coarse positioning points, and one of the boundaries has a point after the right hip angle bone coarse positioning point is translated toward the cow's tail by several pixels, and the other boundary has a point after the right lumbar angle bone coarse positioning point is translated toward the cow's head by several pixels; 4.5) The two obtained rectangular areas are processed as follows: a sliding window with a side length equal to the step length is used to traverse the xz scatter plot of the rectangular area, and all points in each window are replaced with a point, and replaced with the mean of the x and z coordinates of all points in the window, so as to obtain a fitting curve using all the replaced points; the convex hull of the fitting curve is extracted, and the area between the straight line where any two adjacent points on the convex hull are located and the corresponding points on the fitting curve is calculated, and the point with the largest area on the fitting curve is found, and the point closest to the cow's tail among the found points is taken as one of the hip angle bone points; the z direction is the vertical direction.

8. The method for identifying cattle lameness based on back compensatory movement characteristics according to claim 1 or 3, characterized in that: The method for locating the sacrum is as follows: locate the spine line and the left and right lumbar angle bones in a frame of back trunk point cloud image; if there is an intersection between the column where the left and right lumbar angle bones are located and the spine line, then the intersection is the position of the sacrum; if there is no intersection between the column where the left and right lumbar angle bones are located and the spine line, then it is considered that the point closer to the column where the left and right lumbar angle bones are located and the spine line is the position of the sacrum; the direction of the column is the y direction, and the y direction is along the horizontal direction and perpendicular to the x direction.

9. The method for identifying cattle lameness based on back compensatory movement characteristics according to claim 1, characterized in that: The method of identifying cattle lameness based on the extracted back compensation features is as follows: Compare each back compensatory feature with the corresponding back compensatory feature threshold, and determine the corresponding feature score according to the size relationship between each back compensatory feature and the corresponding back compensatory feature threshold; add the feature scores corresponding to each compensatory movement feature to obtain the total score of the compensatory movement feature, and add the feature scores corresponding to each compensatory posture feature to obtain the total score of the compensatory posture feature; evaluate the degree of lameness of the cattle according to the total score of the compensatory movement feature and the total score of the compensatory movement feature.

10. The method for identifying cattle lameness based on back compensatory movement characteristics according to claim 9, characterized in that: The back compensatory characteristic threshold corresponding to the compensatory movement characteristic is determined as follows: obtaining the box plots of the compensatory movement characteristics of healthy and mildly lame cows, calculating the average of the lower quartile of the box plot of healthy cows and the upper quartile of the box plot of mildly lame cows, and using the average as the back compensatory characteristic threshold corresponding to the compensatory movement characteristic; and / or The back compensatory characteristic threshold corresponding to the compensatory posture characteristic is determined as follows: obtain the box plot of the compensatory posture characteristics of cattle with mild lameness and severe lameness, calculate the average of the lower quartile of cattle with mild lameness and the upper quartile of cattle with severe lameness, and use the average as the back compensatory characteristic threshold corresponding to the compensatory posture characteristic.

Citation Information

Patent Citations

  • Limp detection method based on dairy cow body key point motion trails

    CN113288125A

  • Cow early limp identification method and device based on time sequence anomaly detection

    CN116671899A

Cited By

  • Lamb limp behavior recognition method and device based on indoor camera

    CN120635979A