A method and device for measuring livestock posture for livestock detection

By performing multiple shooting and image processing on livestock, identifying feature positioning points and obtaining three-dimensional models, the accuracy problem caused by the posture not meeting the standards in traditional livestock body measurement methods is solved, and higher measurement accuracy and safety are achieved.

CN118864908BActive Publication Date: 2024-12-10DALIAN JIAYUAN TECH DEV CO LTD
View PDF 4 Cites 0 Cited by

Patent Information

Application Number
CN202411336525.2
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2024-09-25
Publication Date
2024-12-10
Estimated Expiration
2044-09-25

AI Technical Summary

Technical Problem

Traditional livestock body measurement methods have problems such as safety risks for measuring personnel and limited accuracy of measurement results, especially because the posture of livestock does not meet the standards, it is difficult to ensure the accuracy of measurement results.

Method used

By taking multiple shots of livestock, obtaining initial images, identifying feature positioning points, and calculating the degree of image matching. If the threshold is reached, a depth camera will be used to obtain a three-dimensional model for body data measurement. It is suitable for livestock of different body types, and adjusting positioning points with multiple images combined with to improve accuracy.

Benefits of technology

It effectively reduces the inaccuracy of measurement results caused by body shape differences, improves the accuracy of feature point positioning, reduces the impact of livestock movement on measurement results, and improves the safety and accuracy of measurement.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN118864908B_ABST
    Figure CN118864908B_ABST
Patent Text Reader

Abstract

The present invention relates to the field of image processing technology, and in particular to a method and device for measuring the body shape of livestock for livestock detection. The method comprises: taking multiple shots of livestock to be detected to obtain an initial image; obtaining a template image, identifying feature positioning points of the livestock to be detected in the initial image, scaling the template image according to the feature positioning points, and calculating the matching degree between the initial image and the scaled template image; judging whether a preset threshold is exceeded based on the matching degree, and if so, obtaining a three-dimensional model of the livestock to be detected through a depth camera, and measuring the body shape data of the livestock to be detected according to the three-dimensional model; demarcating the head and body parts of the livestock to be detected and positioning them respectively, so that the standard posture can be applicable to livestock of different body shapes and proportions, and can effectively reduce the inaccuracy of matching results caused by body shape differences, thereby effectively reducing the influence of body shape differences on measurement results, and can effectively reduce the influence of livestock movement on measurement results.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The invention relates to the technical field of image processing, and in particular to a livestock posture measurement method and device for livestock detection. Background Art

[0002] Livestock body measurement refers to the process of measuring and evaluating the body shape, weight, volume, body length, etc. of livestock (such as cattle, sheep, pigs, etc.). This process is of great significance for improving breeding efficiency, ensuring animal health and conducting scientific research.

[0003] The traditional method of measuring livestock body shape mainly relies on manual operation, but this method has certain risks. For example, the measurement personnel may be injured due to the resistance of the livestock, and the livestock may also become ill due to stress response. In addition, when measuring the body shape data of livestock, the standing posture of the livestock has a great influence on the measurement results. For example, when measuring the body shape data of cattle, the cattle are required to stand naturally, with a straight body, stable limbs, uniform spacing between the front and rear hooves, a naturally hanging tail, and a horizontal head. However, when using image processing technology to measure the body shape of livestock images, it is difficult to ensure that the posture of the livestock fully meets the measurement standards, so the accuracy of the measurement results is often limited. Summary of the invention

[0004] In order to solve the technical problem of limited accuracy of existing livestock body shape data measurement, the purpose of the present invention is to provide a livestock body shape measurement method and device for livestock detection, and the technical scheme adopted is as follows:

[0005] Taking multiple shots of the livestock to be inspected to obtain an initial image, wherein the initial image includes a side view and a top view;

[0006] Acquire a template image, wherein the livestock in the template image is in a standard posture, identify characteristic positioning points of the livestock to be detected in the initial image, scale the template image according to the characteristic positioning points, and calculate the matching degree between the initial image and the scaled template image;

[0007] Based on the matching degree, it is determined whether it exceeds a preset threshold. If so, a three-dimensional model of the livestock to be detected is obtained through a depth camera, and the body data of the livestock to be detected is measured based on the three-dimensional model.

[0008] Preferably, the livestock to be detected is photographed multiple times to obtain an initial image, including:

[0009] A shooting area is set, the background of the shooting area is a single color, and cameras are installed in each direction around the shooting area and in each direction at a height parallel to the livestock to be detected to obtain a side view of the livestock to be detected; a camera is installed along the top center of the shooting area in a vertical direction with the livestock to be detected to obtain a top view of the livestock to be detected.

[0010] Preferably, identifying characteristic positioning points of the livestock to be detected in the initial image includes: respectively identifying characteristic positioning points of the head and body of the livestock to be detected;

[0011] Among them, the characteristic positioning points for identifying the head of the livestock to be detected include:

[0012] Based on the top view, the edge curvature of the outer contour of the nose and tail of the livestock to be detected is calculated respectively, and the nose and tail of the livestock to be detected are determined respectively by the edge curvature to obtain the predicted head of the livestock to be detected;

[0013] According to the predicted head of the livestock to be detected, two pixel points corresponding to the connection between the neck and shoulder blade of the livestock to be detected are respectively predicted positioning point 1 and predicted positioning point 2; based on the side view, the pixel points corresponding to the connection between the neck and abdomen of the livestock to be detected and the connection between the neck and shoulder blade on the same vertical line are respectively predicted positioning point 3 and predicted positioning point 4;

[0014] According to any one of the predicted positioning point one and the predicted positioning point two, and the predicted positioning point three, the possibility of the pixel point corresponding to the connection between the neck and the shoulder blade of the livestock to be detected and the possibility of the pixel point corresponding to the connection between the neck and the abdomen of the livestock to be detected are calculated respectively, and the two possibilities are combined to determine the target positioning point one or the target positioning point two, and the target positioning point three of the head of the livestock to be detected, and the target positioning point two or the target positioning point one is determined according to the target positioning point one or the target positioning point two and the target positioning point three, and the predicted positioning point four corresponds to the target positioning point one or the target positioning point two, that is, the target positioning point four, and the characteristic positioning point of the livestock to be detected is obtained based on the target positioning point one, the target positioning point two, the target positioning point three and the target positioning point four to determine the head of the livestock to be detected.

[0015] Preferably, the calculation formula corresponding to the edge curvature degree is:

[0016] ;

[0017] ;

[0018] in, Indicates the degree of edge curvature at the location of the outer contour pixel; Indicates The edge slope of the pixel location; No. The edge slope of the pixel location; Indicates the number of pixels used to calculate the degree of edge curvature; Indicates The position coordinates of the pixels; Indicates The position coordinates of the pixel points.

[0019] Preferably, the possibility of calculating the pixel point corresponding to the connection between the neck and the shoulder blade of the livestock to be detected according to any one of the predicted positioning point 1 and the predicted positioning point 2 includes:

[0020] Based on any one of the predicted positioning points 1 and 2, the average slope of the N adjacent outer contour pixels before and after the predicted positioning point is calculated, where N is a natural number and the corresponding calculation formula is:

[0021] ;

[0022] in, Indicates The average slope before the outer contour pixels; Indicates the number of pixels selected to represent the slope characteristics of the pixels; Indicates The outer contour pixel before The slope of the outer contour pixel position; and based on The principle of The average slope after the outer contour pixels ;

[0023] Calculate the change degree of the average slope before and after the predicted positioning point. The corresponding calculation formula is:

[0024] ;

[0025] in, Indicates The degree of change of the average slope before and after the outer contour pixel point; Indicates The average slope before the outer contour pixels; Indicates The average slope after the outer contour pixels; represents the normalization function;

[0026] Calculate the smoothness of the adjacent outer contour pixels before and after the predicted positioning point. The corresponding calculation formula is:

[0027] ;

[0028] in, Indicates The smoothness of the outer contour pixels before the outer contour pixels; Indicates the number of pixels selected to represent the slope characteristics of the pixels; Indicates The outer contour pixel before The slope of the pixel position of the outer contour; Indicates The outer contour pixel before The slope of the outer contour pixel position; and based on The principle of The smoothness of the outer contour pixels after ;

[0029] Calculate the initial probability that the predicted positioning point is the pixel point at the junction of the neck and shoulder blade of the livestock to be detected. The corresponding calculation formula is:

[0030] ;

[0031] in, Indicates The outer contour pixels are the initial possibilities of the pixels at the connection between the neck and shoulder blade of the livestock to be detected; Indicates The degree of change of the average slope before and after the outer contour pixel point; Indicates The smoothness of the outer contour pixels before the outer contour pixels; Indicates The smoothness of the outer contour pixels after the outer contour pixels;

[0032] Based on multiple top views, the probability of adjusting the predicted positioning point to the pixel point at the connection between the neck and shoulder blade of the livestock to be detected is calculated as follows:

[0033] ;

[0034] in, Indicates the adjusted The possibility that the outer contour pixel is the pixel at the connection between the neck and shoulder blade of the livestock to be detected; Indicates The outer contour pixels are the initial possibilities of the pixels at the connection between the neck and shoulder blade of the livestock to be detected; Indicates the number of top views selected for adjustment; Indicates The pixel at The distance between the relative position in the previous top view and the current top view; represents a constant; Indicates The pixel at The difference in the degree of change of the slope of the front and rear outer contours in the previous top view and the current top view; Represents the normalization function.

[0035] Preferably, the possibility of calculating the pixel point corresponding to the connection between the neck and the abdomen of the livestock to be detected according to the predicted positioning point three includes:

[0036] Based on the calculation principle of the degree of change and the average slope, the degree of change and the average slope of the slope before and after the predicted positioning point three are obtained, and the probability of the pixel point corresponding to the connection between the neck and the abdomen of the livestock to be detected is calculated. The corresponding calculation formula is:

[0037] ;

[0038] in, Indicates The possibility that the outer contour pixel point is the pixel point corresponding to the connection between the neck and abdomen of the livestock to be detected; Indicates The degree of change of the average slope before and after the outer contour pixel point; Indicates The average slope after the outer contour pixels.

[0039] Preferably, the two possibilities are combined to determine the target positioning point 1 or the target positioning point 2 and the target positioning point 3 of the head of the livestock to be detected, including:

[0040] Combining the two possibilities for calculation, the corresponding calculation formula is:

[0041] ;

[0042] in, Indicates The possibility of group corresponding pixels being positioning points; Indicates the adjusted The possibility that the outer contour pixel is the pixel at the connection between the neck and shoulder blade of the livestock to be detected; Indicates The possibility that the outer contour pixel point is the pixel point corresponding to the connection between the neck and abdomen of the livestock to be detected;

[0043] according to Sort from largest to smallest, The largest group of pixel points is determined as target positioning point one, target positioning point two, and target positioning point three of the head of the livestock to be detected.

[0044] Preferably, identifying characteristic positioning points of the body of the livestock to be detected includes:

[0045] Based on the top view, the vertical line between the nose and the tail of the livestock to be detected is obtained to determine the target positioning point five and the target positioning point six, and the target positioning point seven of the livestock to be detected in the side view is determined according to the target positioning point five and the target positioning point six, and the target positioning point eight is determined based on the vertical line between the target positioning point seven and the ground to determine the body of the livestock to be detected.

[0046] Preferably, the calculation formula corresponding to the matching degree is:

[0047] ;

[0048] in, Indicates the matching degree between the scaled template image and the livestock to be detected in the current initial image; Indicates the number of outer contour pixels of the livestock to be detected in the top view that overlap with the livestock in the scaled template image; Indicates the total number of pixels of the outer contour of the livestock to be detected in the top view; Indicates the number of outer contour pixels of the livestock to be detected in the side view that overlap with the livestock in the scaled template image; Represents the total number of pixels of the outer contour of the livestock to be detected in the side view.

[0049] To solve the above technical problems, the present invention provides another technical solution as follows: a livestock posture measurement device for livestock detection, comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor implements the steps of the livestock posture measurement method for livestock detection as described in any one of the above when executing the computer program.

[0050] The present invention has the following beneficial effects:

[0051] 1. The initial image is obtained by taking multiple shots of the livestock to be detected, and the difference between the initial image and the template image is compared to determine whether the livestock to be detected meets the measurement standard. When the posture of the livestock to be detected meets the standard, the three-dimensional model of the livestock is obtained through the depth camera, and the livestock body data is obtained in the three-dimensional model; the head and body parts of the livestock to be detected are divided and positioned separately, so that the standard posture can be applied to livestock of different sizes and proportions, which can effectively reduce the inaccurate matching results caused by body size differences, thereby effectively reducing the impact of body size differences on the measurement results; and the predicted positioning points are adjusted and corrected in combination with multiple initial images, which can effectively improve the accuracy of positioning the feature points of the livestock to be detected, so that the matching results with the standard posture are more accurate; in addition, according to the matching degree between the top view and the side view of the livestock to be detected and the template image, it is determined whether the current livestock to be detected meets the measurement standard posture, and the three-dimensional model of the livestock is established when the livestock to be detected meets the measurement posture, and the body data is measured according to the three-dimensional model, which can effectively reduce the impact of livestock movement on the measurement results.

[0052] 2. The livestock posture measuring device for livestock detection provided by the present invention has the same beneficial effects as the livestock posture measuring method for livestock detection provided by the present invention, and will not be described in detail here. BRIEF DESCRIPTION OF THE DRAWINGS

[0053] In order to more clearly illustrate the technical solutions and advantages in the embodiments of the present invention or the prior art, the drawings required for use in the embodiments or the prior art descriptions are briefly introduced below. 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 paying creative work.

[0054] Figure 1 A flowchart of the steps of a livestock posture measurement method for livestock detection provided by one embodiment of the present invention;

[0055] Figure 2 A schematic side view of a method for measuring the body shape of livestock for livestock testing provided by one embodiment of the present invention;

[0056] Figure 3 A schematic top view of a livestock posture measurement method for livestock testing provided by one embodiment of the present invention;

[0057] Figure 4 A side view of a schematic diagram of a three-dimensional model of a livestock to be detected in a livestock posture measurement method for livestock detection provided by an embodiment of the present invention;

[0058] Figure 5A rear view of a schematic diagram of a three-dimensional model of a livestock to be detected in a livestock posture measurement method for livestock detection provided by an embodiment of the present invention. DETAILED DESCRIPTION

[0059] In order to further explain the technical means and effects adopted by the present invention to achieve the predetermined invention purpose, the following is a detailed description of a livestock posture measurement method and device for livestock detection proposed by the present invention, its specific implementation, structure, features and effects, in conjunction with the accompanying drawings and preferred embodiments. In the following description, different "one embodiment" or "another embodiment" does not necessarily refer to the same embodiment. In addition, specific features, structures or characteristics in one or more embodiments may be combined in any suitable form.

[0060] Unless defined otherwise, all technical and scientific terms used herein have the same meaning as commonly understood by one of ordinary skill in the art to which this invention belongs.

[0061] The specific scheme of a livestock posture measurement method and device for livestock detection provided by the present invention is described in detail below in conjunction with the accompanying drawings.

[0062] The existing detection methods for the body shape of livestock will cause certain harm to the detection personnel or livestock, because livestock are dynamically changeable, and thus the accuracy of the measurement results will be limited; in one embodiment of the present invention, a method for measuring the body shape of livestock for livestock detection is provided, which obtains an initial image by taking multiple shots of the livestock to be detected, compares the difference between the initial image and the template image, and determines whether the livestock to be detected meets the measurement standard. When the posture of the livestock to be detected meets the standard, a three-dimensional model of the livestock is obtained through a depth camera, and the body shape data of the livestock is obtained in the three-dimensional model; in order to realize a method for measuring the body shape of livestock for livestock detection, a device for measuring the body shape of livestock for livestock detection is provided, which is essentially a software system, which is composed of various devices that realize corresponding functions, and the specific steps in the method are now described in detail.

[0063] Please combine Figure 1-Figure 3 , which respectively show a step flow chart, a side view schematic diagram and a top view schematic diagram of a livestock posture measurement method for livestock detection provided by an embodiment of the present invention, the method comprising:

[0064] Step S1: photograph the livestock to be inspected multiple times to obtain an initial image, which includes a side view and a top view;

[0065] Step S2: obtaining a template image, in which the livestock in the template image is in a standard posture, identifying the characteristic positioning points of the livestock to be detected in the initial image, scaling the template image according to the characteristic positioning points, and calculating the matching degree between the initial image and the scaled template image;

[0066] Step S3: Based on the matching degree, determine whether it exceeds a preset threshold. If so, obtain a three-dimensional model of the livestock to be detected through a depth camera, and measure the body data of the livestock to be detected based on the three-dimensional model.

[0067] It is explained that in the animal husbandry industry, livestock body measurement is an important detection work. By conducting detailed measurements of livestock body shape, their health status, growth and development level, and production performance can be effectively evaluated. Among them, body measurement includes accurate measurement of livestock's body length, body height, chest circumference, tube circumference and other indicators. These data help livestock breeders understand the growth of livestock and provide a scientific basis for the selection of excellent breeds. Through regular body measurements, breeders can promptly discover livestock health problems and take corresponding feeding and management measures, thereby improving overall breeding efficiency.

[0068] It can be explained that, in this embodiment, the livestock to be tested is analyzed by taking cattle as an example, providing a more intuitive analysis situation with typical livestock animals, which can provide a more scientific and efficient detection method for animal husbandry, thereby ensuring the health of livestock and improving breeding efficiency.

[0069] Furthermore, step S1 includes:

[0070] A shooting area is set with a single-color background. Cameras are installed in all directions around the shooting area at a height parallel to the livestock to be detected to obtain a side view of the livestock to be detected. A camera is installed along the top center of the shooting area in a vertical direction with the livestock to be detected to obtain a top view of the livestock to be detected.

[0071] It is explained that the background of the shooting area is set to a single color in order to ensure that the outer contour information of the livestock to be detected can be captured more clearly, that is, selecting a single background color with a high contrast with the color of the livestock to be detected can effectively highlight the outline of the livestock, help reduce visual interference, and make the shape and edges of the livestock more obvious, so that image processing technology can more easily identify and analyze the characteristics of livestock, simplify the complexity of image processing, and help improve the accuracy and efficiency of detection; the camera used to take the image is an ordinary camera, which can obtain the initial image, such as a video camera or other electronic device used to capture and record images.

[0072] It can be explained that through the side view, the outline, body shape and symmetry of the limbs of the livestock can be observed. The side view can clearly show the body length, height and trunk shape of the livestock; the top view provides a perspective of the livestock's back and buttocks, which helps to understand the livestock's body width, body symmetry and spinal curvature; and the comprehensive side view and top view are used to analyze the livestock to be detected, which further improves the matching accuracy between the livestock to be detected and the template image.

[0073] In real life, if the shooting area is determined temporarily and the background is not a single color, the RGB value of the shooting background is determined based on the RGB (Red, Green, Blue) three-channel values, and then the pixels that meet the background RGB three-channel values ​​are removed to obtain the pixels of the livestock to be detected. The intensity of each color in RGB is usually represented by an 8-bit value ranging from 0 to 255.

[0074] Specifically, in this embodiment, the livestock to be detected is guided into the shooting area, a green cloth is arranged in the shooting area, and 8 cameras are installed in eight directions around the shooting area at a height parallel to the cattle, so that the cattle are kept in the center of the picture to obtain a side view of the livestock to be detected and reduce the influence of lens distortion on the analysis; and a camera is installed in the top center of the shooting area to shoot the livestock to be detected from above to obtain a top view; the camera shoots once every second to form image data, from which an initial image for subsequent analysis is obtained.

[0075] It can be understood that since each livestock to be detected has certain individual differences in body shape and stature, the target positioning points of the head and body of the livestock to be detected are determined respectively, and the distance relationship between these positioning points is accurately measured to make appropriate scaling adjustments to the head and body of the livestock in the template image, so that the template image can better adapt to the actual body shape and stature of the current livestock to be detected, so as to significantly improve the accuracy of matching.

[0076] Furthermore, step S2 includes: respectively identifying characteristic positioning points of the head and body of the livestock to be detected;

[0077] Among them, the characteristic positioning points for identifying the head of the livestock to be detected include:

[0078] Step S21: calculating the edge curvature of the outer contours of the nose and tail of the livestock to be detected based on the top view, and determining the nose and tail of the livestock to be detected by the edge curvature to obtain the predicted head of the livestock to be detected;

[0079] Step S22: two pixel points corresponding to the connection between the neck and shoulder blade of the livestock to be detected obtained based on the predicted head of the livestock to be detected are respectively predicted positioning point 1 and predicted positioning point 2; pixel points corresponding to the connection between the neck and abdomen of the livestock to be detected and the connection between the neck and shoulder blade on the same vertical line obtained based on the side view are respectively predicted positioning point 3 and predicted positioning point 4;

[0080] Step S23: According to the predicted positioning point 1 and the predicted positioning point 2, and the predicted positioning point 3, respectively, the possibility of the pixel point corresponding to the connection between the neck and the shoulder blade of the livestock to be detected and the possibility of the pixel point corresponding to the connection between the neck and the abdomen of the livestock to be detected are calculated, and the two possibilities are combined to determine the target positioning point 1 or the target positioning point 2, and the target positioning point 3 of the head of the livestock to be detected, and the target positioning point 2 or the target positioning point 1 is determined according to the target positioning point 1 or the target positioning point 2 and the target positioning point 3, and the predicted positioning point 4 corresponds to the target positioning point 1 or the target positioning point 2, that is, the target positioning point 4, and the characteristic positioning point of the livestock to be detected is obtained based on the target positioning point 1, the target positioning point 2, the target positioning point 3 and the target positioning point 4 to determine the head of the livestock to be detected.

[0081] In this embodiment, the nose portion is analyzed for the nose tip portion of the livestock to be detected to confirm the maximum distance between the nose and the tail.

[0082] To explain, based on the fact that the livestock to be detected is in a natural standing posture, the pixels at the tip of the nose and the base of the tail of the livestock to be detected that are the farthest apart in the outer contour in the top view are confirmed, and thus, the head and tail of the livestock to be detected in the top view can be determined based on the two pixels at the farthest distance in the outer contour; in addition, since the ground in the shooting area is flat, when the livestock to be detected stands on the ground in a natural standing posture, the base of the tail and the tip of the nose are basically on the same horizontal line, so the maximum distance of each row of pixels of the cattle in the initial image is calculated from top to bottom in the initial image, and the two endpoint pixels of the row with the largest maximum distance value are the pixels at the tip of the nose and the base of the tail of the livestock to be detected, that is, the initial image with the largest distance between the pixels at the tip of the nose and the base of the tail of the livestock to be detected among all the initial images taken at the same horizontal height as the livestock to be detected is confirmed as the side view used for analysis in this embodiment.

[0083] It can be explained that, from the top view, it can be seen that the trend of the outer contour of the connection between the neck and the shoulder blade of the livestock cattle to be detected has changed significantly, and the width at both ends of the neck reflects the lateral width of the cattle's head, and the distance between the pixels of the neck and the nose tip reflects the overall length of the cattle's head, so the two pixel points at the connection between the neck and the shoulder blade of the livestock cattle to be detected in the top view are respectively defined as predicted positioning point one and predicted positioning point two; in the side view, the outer contour pixel point on the same vertical line as the pixel point at the connection between the neck and the shoulder blade of the livestock cattle to be detected is the pixel point at the connection between the neck and the abdomen of the livestock cattle to be detected is the predicted positioning point three, and similarly, the trend of the outer contour at this position has also changed significantly, and the distance between the pixel point at this position and the predicted positioning point one and the predicted positioning point two can reflect the overall width of the side of the cattle's head; the pixel point corresponding to the connection between the neck and the shoulder blade of the livestock cattle to be detected in the side view is the predicted positioning point four.

[0084] Furthermore, the calculation formula corresponding to the edge curvature is:

[0085] ;

[0086] ;

[0087] in, Indicates the degree of edge curvature at the location of the outer contour pixel; Indicates The edge slope of the pixel location; No. The edge slope of the pixel location; Indicates the number of pixels used to calculate the degree of edge curvature; Indicates The position coordinates of the pixels; Indicates The position coordinates of the pixel points.

[0088] To clarify, the degree of marginal curvature refers to the curve or curvature of certain parts of the livestock's body, such as the curvature of the spine, the curvature of the limbs, and even the curve of the head and neck; the degree of curvature can be used to assess the body structure of the livestock to be tested.

[0089] It can be explained that, in this embodiment, the cattle to be tested are required to have their tails naturally drooping in the standard measuring posture. When the tail of the cattle to be tested is upturned, it does not meet the standard standing posture. In this embodiment, errors in the judgment results of the nose and the base of the tail of the cattle due to the upturned tail of the cattle to be tested are not considered. The same applies to errors in the analysis results caused by the movement of the cattle's head.

[0090] Represents the slope and value of the outer contour pixel point. The larger the value, the greater the curvature of the edge where the outer contour pixel point is located. It indicates the degree of change of the slope between the pixels of the outer contour. The larger the value, the greater the degree of change of the slope, that is, the greater the edge curvature. The edge curvature of the pixels at both ends of the nose and tail of the livestock to be detected is obtained respectively, and confirmed by conventional means of the livestock to be detected. The part with a larger edge curvature value is the nose part of the livestock to be detected, and the part with a smaller edge curvature value is the tail part of the livestock to be detected.

[0091] Specifically, during the calculation process, since the nose and tail of the livestock to be detected are bent, the horizontal coordinates of the pixels will hardly be exactly the same during image processing, so it is impossible to calculate the edge slope. The denominator is 0, and the curved nose and tail make these differences not zero, ensuring the feasibility of slope calculation and avoiding calculation errors caused by the denominator being zero; In addition, in this embodiment, the number of pixels used to calculate the degree of edge curvature This value is determined artificially based on actual needs and experience. By setting such a specific value, the curvature of the edge can be quantified more accurately, thereby obtaining more reliable results in image processing and analysis.

[0092] It can be understood that in order to facilitate analysis, the pixel point corresponding to the nose of the livestock to be detected is traversed to the adjacent pixel points on both sides. Since the range of the head part of the livestock to be detected usually does not exceed half of the whole livestock to be detected, the midpoint of the line is found according to the line between the pixel points of the nose and the tail of the livestock, and a vertical line is drawn perpendicular to the line. Through this vertical line, the image of the entire livestock to be detected is divided into two parts: the front half and the back half, that is, the head and body of the livestock to be detected, so as to analyze them separately.

[0093] Furthermore, the possibility of calculating the pixel point corresponding to the connection between the neck and the shoulder blade of the livestock to be detected according to any one of the predicted positioning point 1 and the predicted positioning point 2 in step S23 includes:

[0094] Based on any one of the predicted positioning points 1 and 2, the average slope of the N adjacent outer contour pixels before and after the predicted positioning point is calculated, where N is a natural number and the corresponding calculation formula is:

[0095] ;

[0096] in, Indicates The average slope before the outer contour pixels; Indicates the number of pixels selected to represent the slope characteristics of the pixels; Indicates The outer contour pixel before The slope of the outer contour pixel position; and based on The principle of The average slope after the outer contour pixels ;

[0097] Calculate the change degree of the average slope before and after the predicted positioning point. The corresponding calculation formula is:

[0098] ;

[0099] in, Indicates The degree of change of the average slope before and after the outer contour pixel point; Indicates The average slope before the outer contour pixels; Indicates The average slope after the outer contour pixels; represents the normalization function;

[0100] Calculate the smoothness of the adjacent outer contour pixels before and after the predicted positioning point. The corresponding calculation formula is:

[0101] ;

[0102] in, Indicates The smoothness of the outer contour pixels before the outer contour pixels; Indicates the number of pixels selected to represent the slope characteristics of the pixels; Indicates The outer contour pixel before The slope of the pixel position of the outer contour; Indicates The outer contour pixel before The slope of the outer contour pixel position; and based on The principle of The smoothness of the outer contour pixels after ;

[0103] Calculate the initial probability that the predicted positioning point is the pixel point at the junction of the neck and shoulder blade of the livestock to be detected. The corresponding calculation formula is:

[0104] ;

[0105] in, Indicates The outer contour pixels are the initial possibilities of the pixels at the connection between the neck and shoulder blade of the livestock to be detected; Indicates The degree of change of the average slope before and after the outer contour pixel point; Indicates The smoothness of the outer contour pixels before the outer contour pixels; Indicates The smoothness of the outer contour pixels after the outer contour pixels;

[0106] Based on multiple top views, the probability of adjusting the predicted positioning point to the pixel point at the connection between the neck and shoulder blade of the livestock to be detected is calculated as follows:

[0107] ;

[0108] in, Indicates the adjusted The possibility that the outer contour pixel is the pixel at the connection between the neck and shoulder blade of the livestock to be detected; Indicates The outer contour pixels are the initial possibilities of the pixels at the connection between the neck and shoulder blade of the livestock to be detected; Indicates the number of top views selected for adjustment; Indicates The pixel at The distance between the relative position in the previous top view and the current top view; Represents a constant, used to prevent the denominator from being 0. Here, ; Indicates The pixel at The difference in the degree of change of the slope of the front and rear outer contours in the previous top view and the current top view; Represents the normalization function.

[0109] It is explained that in actual calculation requirements, the predicted positioning point 1 and the predicted positioning point 2 obtained from the top view are only a matter of direction change in the image. When analyzing, any predicted positioning point can be selected for calculation.

[0110] The average slope is used to provide the change in the direction and inclination of the outer contour of the livestock to be detected. Preferably, in this embodiment, .

[0111] The degree of change refers to the difference between the average slopes of the pixels before and after the predicted positioning point to evaluate the degree of change in the average slope; The larger the value is, the greater the change in the slope of the outer contour before and after the pixel point is, which means that the predicted positioning point is more likely to be the pixel point at the connection between the neck and shoulder blade of the livestock to be detected.

[0112] Smoothness refers to the continuity and consistency of the spatial distribution of the predicted positioning point and its front and back contour pixels. The smoothness reflects whether the difference between adjacent pixels is small, that is, whether they are closely arranged without drastic jumps or mutations. If the smoothness between adjacent pixels is small, it is considered that these pixels form a smooth contour; on the contrary, if the difference between adjacent pixels is large, the smoothness of the contour decreases, showing a rough or irregular shape; among them, The smaller the slope difference between adjacent outer contour pixels, the smoother the outer contour. Make sure the denominator is not zero, and .

[0113] The initial possibility refers to the possibility that the predicted positioning point is the target positioning point. However, in actual situations, the pixel points at the junction of the horns and the head of the livestock to be detected also have similar characteristics to the pixel points at the junction of the neck and the shoulder blade, that is, the slope of the outer contour changes greatly and the edge is relatively smooth. Therefore, it is necessary to further distinguish the pixel points at the junction of the horns and the head from the pixel points at the junction of the neck and the shoulder blade, that is, to correct the calculation of the initial possibility.

[0114] It can be understood that after the livestock cattle to be detected are guided to the shooting area, the cattle's body remains basically stable, while the cattle's head may swing and twist, and the rotation of the cattle's head will not affect the slope difference between the cattle's horns and the cattle's head contour, but will cause the position of the pixel points at the connection between the cattle's horns and the cattle's head to change significantly, while the connection between the cattle's neck and shoulder blades is relatively stable, and the position of the pixel points at the connection between the cattle's neck and shoulder blades will not change significantly, but the slope difference between the cattle's neck and shoulder blades will continue to change with the change in the rotation angle of the cattle's head; therefore, since the length of the cattle's head and neck will not change, the position of each pixel point in multiple cattle overhead images before the current image is determined based on the distance between each pixel point and the pixel point of the nose tip, and the possibility of each pixel point being a pixel point at the connection between the cattle's neck and shoulder blade is adjusted based on the feature changes of these pixel points in multiple images, so as to obtain a determined target positioning point. Preferably, in this embodiment, five overhead views are used for adjustment and analysis.

[0115] Indicates the degree of conformity between the feature change of each pixel point in multiple top views and the pixel point feature at the connection between the neck and shoulder blade of the livestock to be detected; As a constant to prevent The denominator is 0, which is infinite and affects subsequent analysis; Indicates The distance between the relative positions of pixels in the tth image and the current image is determined by the Euclidean distance between pixels, i.e., by the standard method of measuring the straight-line distance between two points in two or three-dimensional space; Indicates The pixel at The difference in the degree of change of the outer contour slope between the top view and the current top view, that is, Indicates the absolute value of the difference.

[0116] It can be understood that according to the vertical line of each outer contour pixel point in the top view, that is, perpendicular to the line between the pixel point at the tip of the nose and the pixel point at the base of the tail of the livestock to be detected, based on the distance between the intersection with the pixel point at the tip of the nose and the pixel point at the base of the tail to the pixel point at the tip of the nose, its corresponding position is found in the side view, and a vertical line perpendicular to the ground is made through the pixel point at this position, and the intersection point obtained in the lower half of the livestock to be detected is the corresponding pixel point at the connection between the suspected cow's neck and the cow's abdomen, that is, the predicted positioning point three is obtained; it can be explained that the predicted positioning point three has the characteristics of a large difference in the front and rear outer contour slopes, and the contour of the rear abdominal part is relatively straight, that is, the slope is smaller.

[0117] Furthermore, the possibility of calculating the pixel point corresponding to the connection between the neck and the abdomen of the livestock to be detected according to the predicted positioning point three includes:

[0118] Based on the calculation principle of the degree of change and the average slope, the degree of change and the average slope of the slope before and after the predicted positioning point three are obtained, and the probability of the pixel point corresponding to the connection between the neck and the abdomen of the livestock to be detected is calculated. The corresponding calculation formula is:

[0119] ;

[0120] in, Indicates The possibility that the outer contour pixel point is the pixel point corresponding to the connection between the neck and abdomen of the livestock to be detected; Indicates The degree of change of the average slope before and after the outer contour pixel point; Indicates The average slope after the outer contour pixels.

[0121] To explain, The smaller the average slope after the outer contour pixel point, the more likely it is that the predicted positioning point three is the connection pixel point, that is, the target positioning point three. Make sure the denominator is not zero.

[0122] The target location point is considered to be the connection between the neck and shoulder blade of the livestock to be detected, and the connection between the neck and abdomen of the livestock to be detected. The double verification ensures the accuracy of positioning and avoids misjudging other irrelevant areas as targets.

[0123] Further, the two possibilities are combined to determine the target positioning point 1 or the target positioning point 2 and the target positioning point 3 of the head of the livestock to be detected, including:

[0124] Combining the two possibilities for calculation, the corresponding calculation formula is:

[0125] ;

[0126] in, Indicates The possibility of group corresponding pixels being positioning points; Indicates the adjusted The possibility that the outer contour pixel is the pixel at the connection between the neck and shoulder blade of the livestock to be detected; Indicates The possibility that the outer contour pixel point is the pixel point corresponding to the connection between the neck and abdomen of the livestock to be detected;

[0127] according to Sort from largest to smallest, The largest group of pixel points is determined as target positioning point one, target positioning point two, and target positioning point three of the head of the livestock to be detected.

[0128] Specifically, after determining the target positioning point 1 or the target positioning point 2 and the target positioning point 3 based on the above steps, in step S23, if the above steps determine the target positioning point 1, the subsequent steps are used to confirm the target positioning point 2. On the contrary, if the above steps confirm the target positioning point 2, the target positioning point 1 needs to be confirmed at this time. In this embodiment, the above steps confirm the target positioning point 1 and the target positioning point 3, that is, Indicates the adjusted The probability that the outer contour pixel is the pixel at the connection between the neck and shoulder blade of the livestock to be detected, The outer contour pixel point is the predicted positioning point one. Indicates The probability that the outer contour pixel is the pixel corresponding to the connection between the neck and abdomen of the livestock to be detected, The outer contour pixel point is the predicted positioning point three; the two predicted positioning points are combined to obtain the The predicted positioning point 1 and the predicted positioning point 3 are combined into a group of pixels to calculate the possibility of the positioning point, and then the determined target positioning point is obtained by comparing the sizes.

[0129] Based on the above sorting situation, predict the second positioning point, and predict the difference between the distance from the second positioning point to the pixel point of the nose tip of the livestock to be detected and the distance from the target positioning point to the pixel point of the nose tip of the livestock to be detected in the top view. , and the distance between the predicted anchor point 2 and the target anchor point 3 in the side view , the first one that satisfies and The positioning point whose values ​​are all less than 2 is confirmed as the target positioning point 2.

[0130] The position corresponding to the target positioning point one in the side view is the target positioning point four. The line between the target positioning point one and the target positioning point two segments the part of the head of the livestock to be detected in the top view. The line between the target positioning point three and the target positioning point four segments the part of the head of the livestock to be detected in the side view, that is, the characteristic positioning points of the heads of all the livestock to be detected are determined.

[0131] Further, identifying characteristic positioning points of the body of the livestock to be detected includes:

[0132] Based on the top view, the vertical line between the nose and the tail of the livestock to be detected is obtained to determine the target positioning point five and the target positioning point six, and the target positioning point seven of the livestock to be detected in the side view is determined according to the target positioning point five and the target positioning point six, and the target positioning point eight is determined based on the vertical line between the target positioning point seven and the ground to determine the body of the livestock to be detected.

[0133] Specifically, in the top view, the abdomen of the livestock cattle to be detected is the widest part of the whole. In the top view, a line is connected between the nose tip and the base of the tail of the livestock cattle to be detected, and then a connecting line is made, where the two outer contour pixel points on the same vertical line and the farthest apart are the abdomen positioning points in the top view, that is, target positioning point five and target positioning point six are obtained; a connecting line is made between the two pixel points of target positioning point five and target positioning point six, and the intersection of the two pixel points with the connecting line of the nose tip and the base of the tail of the livestock cattle to be detected is obtained to determine the pixel point corresponding to the back position of the livestock cattle to be detected in the side view, which is the target positioning point seven; a vertical line perpendicular to the ground is drawn from the target positioning point seven, and the vertical line passes through the pixel point of the outer contour of the abdomen of the livestock cattle to be detected, which is the target positioning point eight, and then all the characteristic positioning points of the body of the livestock cattle to be detected are obtained.

[0134] It can be explained that in step S2, the template image is scaled according to the feature positioning points, specifically:

[0135] Obtain the ratio of the distance between the four positioning points of the head of the livestock to be detected to the distance between the corresponding four positioning points in the template image, obtain the degree to which the template image needs to be scaled, and scale the head of the livestock in the template image;

[0136] Similarly, the ratio of the distance between the four positioning points on the body of the livestock to be detected and the distance between the corresponding four positioning points in the template image is obtained, and the body of the livestock in the template image is scaled;

[0137] To obtain the scaled template image.

[0138] It is noted that the livestock in the template image is in a standard pose, which is used as a benchmark for evaluating and comparing the poses of livestock in other images.

[0139] It can be understood that if the posture of the livestock cattle to be detected in the initial image currently being analyzed meets the standard measurement posture, then the outer contours of the top view and side view of the cattle currently taken should have a high degree of overlap with the scaled template image, which can ensure the accuracy and reliability of the measurement results.

[0140] Furthermore, the calculation formula corresponding to the matching degree is:

[0141] ;

[0142] in, Indicates the matching degree between the scaled template image and the livestock to be detected in the current initial image; Indicates the number of outer contour pixels of the livestock to be detected in the top view that overlap with the livestock in the scaled template image; Indicates the total number of pixels of the outer contour of the livestock to be detected in the top view; Indicates the number of outer contour pixels of the livestock to be detected in the side view that overlap with the livestock in the scaled template image; Represents the total number of pixels of the outer contour of the livestock to be detected in the side view.

[0143] Please combine Figure 4 and Figure 5 , explain, in step S3: based on the matching degree, determine whether it exceeds the preset threshold. If so, obtain the three-dimensional model of the livestock to be detected through the depth camera, and measure the body data of the livestock to be detected according to the three-dimensional model.

[0144] It can be explained that a depth camera is a special type of imaging device that can capture three-dimensional information of an object, not just a two-dimensional image. The camera calculates the depth information of the object's surface by emitting infrared light or other types of light and measuring the time or phase change of the light reflected back. Compared with traditional two-dimensional cameras, depth cameras can provide richer spatial data, allowing computers to better understand and process objects and scenes in the real world.

[0145] In this embodiment, the preset threshold is set to 0.7, that is, when At this moment, it is considered that the standing posture of the livestock to be detected meets the measurement standard. At this moment, the three-dimensional model of the livestock to be detected is obtained using the surrounding depth cameras. Then, according to the body data measurement method of the livestock to be detected, the body length, shoulder height and other body data of the cattle are obtained in the three-dimensional model.

[0146] On the contrary, if When the standing posture of the livestock cattle to be detected does not meet the standard, it means that the initial image currently analyzed is unqualified. Then, the image is re-acquired based on the images taken multiple times, and then the above steps are repeated for analysis until the initial image is unqualified. .

[0147] Explain, such as Figure 4 and Figure 5 As shown, based on the three-dimensional model of the livestock to be detected, the body data of the livestock to be detected is measured, wherein A represents the nail of the livestock to be detected; M represents the front paw of the livestock to be detected, and the body height of the livestock to be detected can be obtained through A and M; C represents the back of the livestock to be detected; B represents the waist of the livestock to be detected; E represents the arm of the livestock to be detected, and the arm length of the cattle can be obtained; I represents the abdominal milk well of the livestock to be detected; J represents the wrist joint of the livestock to be detected; a vertical line from point B to the ground is obtained to obtain N, and the waist height of the livestock to be detected can be measured through B and N; D represents the tail of the livestock to be detected; G represents the waist angle of the livestock to be detected; D and The distance between H and The distance between G and The distance between them is the waist width of the cattle to be tested.

[0148] It can be explained that the measurement technology described in this method can realize non-contact measurement with the livestock to be tested, effectively avoiding possible casualties of workers and stress injuries to livestock during the measurement process, which not only improves the safety of measurement, but also reduces interference and pressure on the livestock to be tested, making the measurement results more accurate and reliable; in this way, workers can complete the measurement task quickly and efficiently without direct contact with livestock, which not only ensures the safety of personnel, but also ensures the health and welfare of livestock.

[0149] It can be understood that the initial image is obtained by taking multiple shots of the livestock to be detected, and the difference between the initial image and the template image is compared to determine whether the livestock to be detected meets the measurement standard. When the posture of the livestock to be detected meets the standard, the three-dimensional model of the livestock is obtained through the depth camera, and the livestock body data is obtained in the three-dimensional model; the head and body parts of the livestock to be detected are divided and positioned separately, so that the standard posture can be applied to livestock of different sizes and proportions, which can effectively reduce the inaccurate matching results caused by body size differences, thereby effectively reducing the impact of body size differences on the measurement results; and the predicted positioning points are adjusted and corrected in combination with multiple initial images, which can effectively improve the accuracy of positioning the feature points of the livestock to be detected, so that the matching results with the standard posture are more accurate; in addition, according to the matching degree between the top view and side view of the livestock to be detected and the template image, it is determined whether the current livestock to be detected meets the standard measurement posture, and a three-dimensional model of the livestock is established when the livestock to be detected meets the measurement posture, and the body data is measured according to the three-dimensional model, which can effectively reduce the impact of livestock movement on the measurement results.

[0150] An embodiment of the present invention further proposes a livestock posture measurement device for livestock detection, comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor implements the steps of a livestock posture measurement method for livestock detection provided in an embodiment of the present invention when executing the computer program; the device has the same beneficial effects as the livestock posture measurement method for livestock detection provided above, and will not be elaborated here.

[0151] It can be understood that when the various devices of a livestock posture measurement device for livestock detection are in operation, it is necessary to utilize a livestock posture measurement method for livestock detection provided in the aforementioned embodiment. Therefore, whether the memory, processor and computer program are integrated or different hardware is configured to produce functions similar to the effects achieved by the present invention, they all fall within the scope of protection of the present invention.

[0152] It should be noted that the sequence of the above embodiments of the present invention is only for description and does not represent the advantages and disadvantages of the embodiments. The processes depicted in the accompanying drawings do not necessarily require the specific order or continuous order shown to achieve the desired results. In some embodiments, multitasking and parallel processing are also possible or may be advantageous.

[0153] The various embodiments in this specification are described in a progressive manner, and the same or similar parts between the various embodiments can be referenced to each other, and each embodiment focuses on the differences from other embodiments.

Claims

1. A method for measuring the body shape of livestock for livestock testing, It is characterized in that The method comprises: Taking multiple shots of the livestock to be inspected to obtain an initial image, wherein the initial image includes a side view and a top view; Acquire a template image, wherein the livestock in the template image is in a standard posture, identify characteristic positioning points of the livestock to be detected in the initial image, scale the template image according to the characteristic positioning points, and calculate the matching degree between the initial image and the scaled template image; Based on the matching degree, it is determined whether it exceeds a preset threshold. If so, a three-dimensional model of the livestock to be detected is obtained through a depth camera, and the body data of the livestock to be detected is measured according to the three-dimensional model; Identifying characteristic positioning points of the livestock to be detected in the initial image, including: respectively identifying characteristic positioning points of the head and body of the livestock to be detected; Among them, the characteristic positioning points for identifying the head of the livestock to be detected include: Based on the top view, the edge curvature of the outer contour of the nose and tail of the livestock to be detected is calculated respectively, and the nose and tail of the livestock to be detected are determined respectively by the edge curvature to obtain the predicted head of the livestock to be detected; According to the predicted head of the livestock to be detected, two pixel points corresponding to the connection between the neck and shoulder blade of the livestock to be detected are respectively predicted positioning point 1 and predicted positioning point 2; based on the side view, the pixel points corresponding to the connection between the neck and abdomen of the livestock to be detected and the connection between the neck and shoulder blade on the same vertical line are respectively predicted positioning point 3 and predicted positioning point 4; According to any one of the predicted positioning point one and the predicted positioning point two, and the predicted positioning point three, the possibility of the pixel point corresponding to the connection between the neck and the shoulder blade of the livestock to be detected and the possibility of the pixel point corresponding to the connection between the neck and the abdomen of the livestock to be detected are calculated respectively, and the two possibilities are combined to determine the target positioning point one or the target positioning point two, and the target positioning point three of the head of the livestock to be detected, and the target positioning point two or the target positioning point one is determined according to the target positioning point one or the target positioning point two and the target positioning point three, and the predicted positioning point four corresponds to the target positioning point one or the target positioning point two, that is, the target positioning point four, and the characteristic positioning point of the livestock to be detected is obtained based on the target positioning point one, the target positioning point two, the target positioning point three and the target positioning point four to determine the head of the livestock to be detected.

2. The livestock body measurement method for livestock testing according to claim 1, It is characterized in that Take multiple shots of the livestock to be inspected to obtain the initial image, including: A shooting area is set, the background of the shooting area is a single color, and cameras are installed in each direction around the shooting area and in each direction at a height parallel to the livestock to be detected to obtain a side view of the livestock to be detected; a camera is installed along the top center of the shooting area in a vertical direction with the livestock to be detected to obtain a top view of the livestock to be detected.

3. The livestock body measurement method for livestock testing according to claim 1, It is characterized in that The calculation formula corresponding to the edge curvature is: ; ; in, Indicates the degree of edge curvature at the location of the outer contour pixel; Indicates The edge slope of the pixel location; No. The edge slope of the pixel location; Indicates the number of pixels used to calculate the degree of edge curvature; Indicates The position coordinates of the pixel points; Indicates The position coordinates of the pixel points.

4. The livestock body measurement method for livestock testing according to claim 1, It is characterized in that The possibility of calculating the pixel point corresponding to the connection between the neck and the shoulder blade of the livestock to be detected according to any one of the predicted positioning point 1 and the predicted positioning point 2 includes: Based on any one of the predicted positioning points 1 and 2, the average slope of the N adjacent outer contour pixels before and after the predicted positioning point is calculated, where N is a natural number and the corresponding calculation formula is: ; in, Indicates The average slope before the outer contour pixels; Indicates the number of pixels selected to represent the slope characteristics of the pixels; Indicates The outer contour pixel before The slope of the outer contour pixel position; and based on The principle of The average slope after the outer contour pixels ; Calculate the change degree of the average slope before and after the predicted positioning point. The corresponding calculation formula is: ; in, Indicates The degree of change of the average slope before and after the outer contour pixel point; Indicates The average slope before the outer contour pixels; Indicates The average slope after the outer contour pixels; represents the normalization function; Calculate the smoothness of the adjacent outer contour pixels before and after the predicted positioning point. The corresponding calculation formula is: ; in, Indicates The smoothness of the outer contour pixels before the outer contour pixels; Indicates the number of pixels selected to represent the slope characteristics of the pixels; Indicates The outer contour pixel before The slope of the pixel position of the outer contour; Indicates The outer contour pixel before The slope of the outer contour pixel position; and based on The principle of The smoothness of the outer contour pixels after ; Calculate the initial probability that the predicted positioning point is the pixel point at the junction of the neck and shoulder blade of the livestock to be detected. The corresponding calculation formula is: ; in, Indicates The outer contour pixels are the initial possibilities of the pixels at the connection between the neck and shoulder blade of the livestock to be detected; Indicates The degree of change of the average slope before and after the outer contour pixel point; Indicates The smoothness of the outer contour pixels before the outer contour pixels; Indicates The smoothness of the outer contour pixels after the outer contour pixels; Based on multiple top views, the probability of adjusting the predicted positioning point to the pixel point at the connection between the neck and shoulder blade of the livestock to be detected is calculated as follows: ; in, Indicates the adjusted The possibility that the outer contour pixel is the pixel at the connection between the neck and shoulder blade of the livestock to be detected; Indicates The outer contour pixels are the initial possibilities of the pixels at the connection between the neck and shoulder blade of the livestock to be detected; Indicates the number of top views selected for adjustment; Indicates The pixel at The distance between the relative position in the previous top view and the current top view; represents a constant; Indicates The pixel at The difference in the degree of change of the slope of the front and rear outer contours in the previous top view and the current top view; Represents the normalization function.

5. The livestock body measurement method for livestock testing as claimed in claim 4, It is characterized in that The possibility of calculating the pixel point corresponding to the connection between the neck and the abdomen of the livestock to be detected according to the predicted positioning point three includes: Based on the calculation principle of the change degree and the average slope, the change degree and the average slope of the slope before and after the predicted positioning point 3 are obtained, and the probability of the pixel point corresponding to the connection between the neck and the abdomen of the livestock to be detected is calculated. The corresponding calculation formula is: ; in, Indicates The possibility that the outer contour pixel point is the pixel point corresponding to the connection between the neck and abdomen of the livestock to be detected; Indicates The degree of change of the average slope before and after the outer contour pixel point; Indicates The average slope after the outer contour pixels.

6. The livestock body measurement method for livestock testing according to claim 5, It is characterized in that Combining the two possibilities to determine the target location point 1 or the target location point 2 and the target location point 3 of the head of the livestock to be detected includes: Combining the two possibilities for calculation, the corresponding calculation formula is: ; in, Indicates The possibility of group corresponding pixels being positioning points; Indicates the adjusted The possibility that the outer contour pixel is the pixel at the connection between the neck and shoulder blade of the livestock to be detected; Indicates The possibility that the outer contour pixel point is the pixel point corresponding to the connection between the neck and abdomen of the livestock to be detected; according to Sort from largest to smallest, The largest group of pixel points is determined as target positioning point one, target positioning point two, and target positioning point three of the head of the livestock to be detected.

7. The livestock body measurement method for livestock testing according to claim 1, It is characterized in that Identify the characteristic points on the body of the livestock to be inspected, including: Based on the top view, the vertical line between the nose and the tail of the livestock to be detected is obtained to determine the target positioning point five and the target positioning point six, and the target positioning point seven of the livestock to be detected in the side view is determined according to the target positioning point five and the target positioning point six, and the target positioning point eight is determined based on the vertical line between the target positioning point seven and the ground to determine the body of the livestock to be detected.

8. The livestock body measurement method for livestock testing according to claim 1, It is characterized in that The calculation formula corresponding to the matching degree is: ; in, Indicates the matching degree between the scaled template image and the livestock to be detected in the current initial image; Indicates the number of outer contour pixels of the livestock to be detected in the top view that overlap with the livestock in the scaled template image; Indicates the total number of pixels of the outer contour of the livestock to be detected in the top view; Indicates the number of outer contour pixels of the livestock to be detected in the side view that overlap with the livestock in the scaled template image; Represents the total number of pixels of the outer contour of the livestock to be detected in the side view.

9. A livestock posture measuring device for livestock detection, comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, It is characterized in that When the processor executes the computer program, the steps of the livestock posture measurement method for livestock detection as described in any one of claims 1 to 8 are implemented.

Citation Information

Patent Citations

  • Livestock three-dimensional measurement-based attitude detection method and system and storage medium

    CN111353416A

  • Method and device for measuring bending body size of pig body, equipment and medium

    CN113344898A

  • Non-contact livestock body size measuring method and electronic equipment

    CN118196175A

  • Monitoring system for individual growth monitoring of livestock animals

    WO2023285945A1