Portable Measurement Method and System for Horse Body Dimensions Based on a Single-View RGB-D Camera

Through the segmentation and key point model based on a single-view RGB-D camera, the automatic measurement of the horse ruler is realized, solving the problem of efficient and accurate measurement without Baoding environment, and improving the convenience and safety of horse measurement.

CN119359782BActive Publication Date: 2025-08-05CHINA AGRI UNIV
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202411477702.9
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2024-10-22
Publication Date
2025-08-05
Estimated Expiration
2044-10-22

AI Technical Summary

Technical Problem

The prior art is difficult to realize automated measurement of horse rulers in a simple environment without the need for Baoding, and the manual measurement is low and the accuracy is poor, which affects animal welfare and poses safety risks.

Method used

The horse ruler portable measurement method based on a single-view RGB-D camera is adopted to obtain the target area by segmenting the model, confirm the posture based on the key point model, and calculate the starting measurement point to determine parameters such as body height, body length, bust circumference and tube circumference.

Benefits of technology

Automatic measurement of horse ruler in free movement is achieved, improving measurement efficiency and accuracy, and reducing the time and safety risks of manual measurement.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119359782B_ABST
    Figure CN119359782B_ABST
Patent Text Reader

Abstract

The present invention relates to a portable horse body measurement method and system based on a single-view RGB-D camera, belonging to the field of computer technology. The method comprises: acquiring a target area based on a segmentation model and determining whether the target area is within a field of view; confirming the posture of the target area based on key points output by a key point model; calculating a starting measurement point based on the confirmed target key points of a preset number of frames when the posture of the target area is confirmed; determining different attribute measurement points based on the starting measurement point and the contour edge, wherein the different attribute measurement points include a body height measurement point and a body length measurement point; determining a body height value based on a ground point relative to the target area and the body height measurement point, and determining a body length value based on the distance between a chest measurement point and a hip end measurement point on a two-dimensional plane; and estimating chest circumference and tube circumference length based on chest circumference and tube circumference measurement points. The method realizes automated measurement of horse dimensions, improves measurement efficiency, and ensures accuracy.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention belongs to the field of computer technology, and in particular relates to an automatic measurement method and system for horse body size. Background Art

[0002] In modern animal husbandry, body measurements are essential phenotypic indicators for breeding selection. Accurate measurements can help assess genetic progress, prevent disease, and improve production efficiency and economic benefits. Equine body measurement technology plays a crucial role in identifying horse breeds and improving horse quality, so collecting and recording accurate body measurements is extremely important. Horse body measurements are typically obtained manually, using tools such as measuring rods and tape measures. However, this method has the following problems: 1) It is inefficient and time-consuming. Manual measurement of a horse's body size typically requires the horse to stand still (most often in a restraint), requiring four to five people. Restraining a horse takes at least 10-15 minutes. For grazing or untrained horses, the labor required is even greater and the time required is even longer. 2) Manual measurement is subject to numerous factors, resulting in significant deviations and poor accuracy. For example, when measuring chest circumference with a tape measure, it is difficult to maintain a perpendicular cross-section to the ground, resulting in an inflated measurement. 3) The measurement results are not objective, and the comparability between different measurement data is poor. Manual measurement results rely on the professional level of the measurement personnel. Different measurement personnel have different measurement habits, the errors between different measurement personnel are large, and the results are not very comparable; 4) The act of measurement can easily cause stress in horses, affecting production and damaging animal welfare, and the measurement personnel are also easily injured. Horses are more sensitive than other livestock and are easily stimulated. The uncontrollability of horse behavior in manual measurement is greatly increased, which not only affects accuracy, but also greatly increases the safety risks of horses and measurement personnel, which can easily cause injuries to people and horses, causing irreparable losses to stables and horse owners.

[0003] In recent years, leveraging visual intelligence within artificial intelligence (AI), a large number of strategies and devices have emerged for automated livestock body measurement, with some applications in pigs, cattle, and sheep. However, horses present unique characteristics compared to other livestock: high individual value, strict welfare requirements, sensitivity and susceptibility to stress, and significant differences in body shape and size compared to other livestock. Consequently, currently available products fall short of meeting the requirements for automated horse body measurement. A few equine body measurement technologies utilizing 3D visual recognition exist internationally, but these require 3D reconstruction based on data from multiple camera angles, making deployment difficult and investment intensive. Furthermore, untrained horses are sensitive and difficult to control. Current 3D vision measurement solutions are primarily targeted at docile livestock, often requiring the use of a restraint stall, and lack appropriate posture requirements for horse measurement. With the growing demand for precision horse breeding and refined animal husbandry, automated body measurement for a variety of equines, in a simple, unrestrained environment, has become a pressing challenge. Summary of the Invention

[0004] In view of the above shortcomings of the existing technology, the purpose of the present invention is to provide a portable horse body measurement method based on a single-view RGB-D camera. This method enables the horse to independently determine the standard measurement posture and complete automatic body measurement while freely moving, thereby improving measurement efficiency and accuracy.

[0005] In a first aspect of the present invention, a portable horse body measurement method based on a single-view RGB-D camera is proposed, comprising: S1, acquiring a target area based on a segmentation model and determining whether the target area is within a field of view; S2, if it is determined that the target area is within the field of view, confirming a target key point from the key points output by a key point model, and performing posture confirmation on the target area based on the target key point; S3, if the posture of the target area is confirmed, calculating a starting measurement point based on the target key points of a preset number of confirmed frames, wherein the target key points include a plurality of the starting measurement points, and the starting measurement points include a first starting measurement point and a second starting measurement point; S4, calculating a starting measurement point based on the starting measurement point and the side of the contour edge. S5: determining a body height value based on a ground point relative to the target area and the body height measurement point, and determining a body length value based on a distance between the chest measurement point and the hip end measurement point on a two-dimensional plane; S6: obtaining the contour endpoints of the chest and the tube part based on the chest circumference and tube circumference measurement points, respectively, and fitting a target smooth curve based on a set of points between the endpoints; calculating a first length of the target smooth curve and a first height difference between the endpoints of the target smooth curve; taking the sum of the first length and twice the first height difference as the chest circumference length; and taking the sum of the first length and twice the first height difference as the tube circumference length.

[0006] In a second aspect of the present invention, a portable horse body measurement system based on a single-view RGB-D camera is proposed, comprising: a first judgment module for acquiring a target area based on a segmentation model and judging whether the target area is within a field of view; a posture confirmation module for, when judging that the target area is within the field of view, confirming the target key points among the key points output by the key point model, and performing posture confirmation on the target area based on the target key points; a first calculation module for, when performing posture confirmation on the target area, calculating a starting measurement point based on the target key points of a preset number of confirmed frames, wherein the target key points include a plurality of the starting measurement points, and the starting measurement points include a first starting measurement point and a second starting measurement point; a first determination module for calculating a starting measurement point based on the starting measurement point. a second determining module for determining a body height value based on a ground point relative to the target area and the body height measuring points, and a body length value based on a distance between the chest measuring point and the hip end measuring point on a two-dimensional plane; a second calculating module for obtaining the contour endpoints of the chest and the tube part based on the chest circumference and tube circumference measuring points, respectively, and fitting a target smooth curve based on a set of points between the endpoints; calculating a first length of the target smooth curve and a first height difference between the endpoints of the target smooth curve; taking the sum of the first length and twice the first height difference as the chest circumference length; and taking the sum of the first length and twice the first height difference as the tube circumference length.

[0007] In a third aspect of the present invention, an electronic device is proposed, comprising: at least one processor; and a memory communicatively connected to the at least one processor; wherein the memory stores instructions executable by the at least one processor, and the instructions are executed by the at least one processor so that the at least one processor can execute any one of the methods described in the first aspect of the present invention.

[0008] According to a fourth aspect of the present invention, a non-transitory computer-readable storage medium storing computer instructions is provided, wherein the computer instructions are used to enable the computer to execute any one of the methods according to the first aspect of the present invention.

[0009] The beneficial effects of the present invention are as follows:

[0010] The portable horse body ruler measurement method and system based on a single-view RGB-D camera of the present invention obtains a target area based on a segmentation model and determines whether the target area is within the field of view; when it is determined that the target area is within the field of view, the target key point is confirmed among the key points output by the key point model, and the posture of the target area is confirmed based on the target key point; when the posture of the target area is confirmed, the starting measurement point is calculated based on the target key points of a preset number of confirmed frames, wherein the target key point includes multiple, and the starting measurement point includes a first starting measurement point and a second starting measurement point; based on the starting measurement point and the contour edge side measurement point, the starting measurement point is determined. Different attribute measurement points are determined, including height measurement points and length measurement points, with the latter including chest measurement points and hip end measurement points. The height value is determined based on the ground point relative to the target area and the height measurement points, and the length value is determined based on the distance between the chest measurement points and the hip end measurement points on a two-dimensional plane. The chest and tube contour endpoints are obtained based on the chest circumference and tube circumference measurement points, respectively, and a target smooth curve is fitted based on the point set between the endpoints. The first length of the target smooth curve and the first height difference between the endpoints of the target smooth curve are calculated. The sum of the first length and twice the first height difference is used as the chest circumference length; and the sum of the first length and twice the first height difference is used as the tube circumference length. This method achieves automated measurement of horse dimensions, improving measurement efficiency and accuracy. BRIEF DESCRIPTION OF THE DRAWINGS

[0011] The accompanying drawings are only for the purpose of illustrating specific embodiments and are not to be considered as limiting the present invention. Throughout the drawings, the same reference numerals represent the same components. Obviously, the drawings described below are only some of the embodiments of the present invention. Those skilled in the art can also derive other drawings based on these drawings.

[0012] Figure 1 is a flow chart of a portable horse body measurement method based on a single-view RGB-D camera according to one embodiment of the present invention;

[0013] Figure 2 This is a flow chart of a portable horse body measurement method based on a single-view RGB-D camera according to a specific embodiment of the present invention;

[0014] Figure 3 is a schematic diagram of determining target key points according to one embodiment of the present invention;

[0015] Figure 4 1 is a block diagram of a portable horse size measurement system based on a single-view RGB-D camera according to an embodiment of the present invention;

[0016] Figure 5 is a structural block diagram of an electronic device according to an embodiment of the present invention;

[0017] Figure 6 FIG. 4 is a schematic diagram of an on-site measurement scenario according to an embodiment of the present invention. DETAILED DESCRIPTION

[0018] In order to enable those skilled in the art to better understand the technical solutions in the embodiments of the present invention, the technical solutions of the present invention will be clearly and completely described below with reference to the accompanying drawings. Obviously, the embodiments described are part of the embodiments of the present invention, rather than all of the embodiments. It should be understood that these descriptions are merely exemplary and are not intended to limit the scope of the present invention. Based on the embodiments of the present invention, all other embodiments obtained by those of ordinary skill in the art without creative work should fall within the scope of protection of the present invention.

[0019] Furthermore, in the following description, descriptions of well-known structures and technologies are omitted to avoid unnecessarily obscuring the concepts disclosed in the present invention.

[0020] In the description of the present invention, it should be noted that, unless otherwise expressly specified and limited, the terms "center", "up", "down", "left", "right", "vertical", "horizontal", "inside", "outside" and the like indicate orientations or positional relationships based on the orientations or positional relationships shown in the accompanying drawings, and are only for the convenience of describing the present invention and simplifying the description, and do not indicate or imply that the device or element referred to must have a specific orientation, be constructed and operated in a specific orientation, and therefore cannot be understood as limiting the present invention. In addition, the terms "first", "second" and "third" are used for descriptive purposes only and cannot be understood as indicating or implying relative importance. The terms "installed", "connected" and "connected" should be understood in a broad sense, for example, it can be a fixed connection, a detachable connection, or an integral connection; it can be a mechanical connection or an electrical connection; it can be a direct connection, or an indirect connection through an intermediate medium, or it can be a communication between the internal parts of two elements. For those of ordinary skill in the art, the specific meanings of the above terms in the present invention can be understood according to specific circumstances.

[0021] Exemplary embodiments will be described in detail herein, examples of which are illustrated in the accompanying drawings. In the following description, when referring to the drawings, like numbers in different figures represent the same or similar elements unless otherwise indicated. The embodiments described in the following exemplary embodiments are not intended to represent all possible embodiments consistent with the present invention. Rather, they are merely examples of methods and systems consistent with certain aspects of the present invention, as detailed in the appended claims.

[0022] The present invention provides a portable horse body measurement method, system, and related equipment based on a single-view RGB-D camera. Specifically, the portable horse body measurement method, system, and related equipment based on a single-view RGB-D camera according to an embodiment of the present invention are described below with reference to the accompanying drawings.

[0023] Figure 1 This is a flowchart of a portable horse size measurement method based on a monoscopic RGB-D camera according to one embodiment of the present invention. It should be noted that the portable horse size measurement method based on a monoscopic RGB-D camera according to the embodiment of the present invention can be applied to the portable horse size measurement system based on a monoscopic RGB-D camera according to the embodiment of the present invention. The portable horse size measurement system based on a monoscopic RGB-D camera can be configured on an electronic device or on a server. This embodiment of the present application is not limited to this.

[0024] like Figure 1 As shown in the figure, the portable horse body measurement method based on a single-view RGB-D camera includes:

[0025] S110: Acquire a target area based on the segmentation model, and determine whether the target area is within the field of view.

[0026] In an embodiment of the present invention, the RGB image and the depth image of the target image are input into a segmentation model to obtain a target region. For example, the RGB image and the depth image of an image of a horse can be input into the segmentation model to obtain a target region, for example, the target region is a horse.

[0027] In an embodiment of the present invention, whether the target area is completely within the visual field is determined based on whether the detection frame of the target area is within 95% of the visual field.

[0028] S120 , when it is determined that the target area is within the field of view, confirming target key points from the key points output by the key point model, and performing posture confirmation on the target area based on the target key points.

[0029] In an embodiment of the present invention, when it is determined that the target area is within the field of view, all key points in the target area, that is, all key points of the horse, can be obtained based on the key point model, and then the target feature points can be determined from all the key points based on the key point model, and then the target key points can be confirmed from the target feature points.

[0030] Among them, the target feature points can be understood as points that show the characteristics of the horse.

[0031] The target key points can be understood as valuable points among the target feature points. For example, the target key points include but are not limited to eye key points, leg key points, etc. The target key points include 11 key points.

[0032] In an embodiment of the present invention, posture confirmation of a target area based on target key points is implemented by: determining that fewer than or equal to two of the target key points are occluded; determining that the depth difference between the target key points is less than a preset difference; determining whether the target's tilt is within a preset range based on a first angle between a first distance vector in the target area and the xy plane in three-dimensional space, and a second angle between a second distance vector in the target area and the xy plane in three-dimensional space; and determining whether the angle between the target's forelimbs is greater than a preset threshold based on a third angle between a third distance vector and a fourth distance vector in the target area in three-dimensional space. For more detailed implementation methods, please refer to the subsequent embodiments.

[0033] S130 , when confirming the posture of the target area, calculating a starting measurement point according to target key points of a preset number of confirmed frames, wherein the target key points include a plurality of them, and the starting measurement points include a first starting measurement point and a second starting measurement point.

[0034] In an embodiment of the present invention, a first key point and a second key point of a front leg region among target key points are obtained; and the average coordinates of the first key point and the second key point are used as the coordinates of the first starting measurement point.

[0035] In an embodiment of the present invention, the fourth and fifth key points of the hind leg region are obtained from the target key points; the average of the coordinates of the fourth and fifth key points is used as the coordinates of the second starting measurement point. For specific implementation methods, please refer to the subsequent embodiments.

[0036] S140 , determining different attribute measurement points based on the starting measurement point and the contour edge side measurement points, wherein the different attribute measurement points include a body height measurement point and a body length measurement point, and the body length measurement points include a chest measurement point and a hip end measurement point.

[0037] In an embodiment of the present invention, once a starting measurement point is obtained, a directional search can be performed based on a preset angle using the starting measurement point to determine a contour edge measurement point. Furthermore, a search can be performed along the direction of the starting measurement point based on the contour edge measurement point to determine a height measurement point and a length measurement point. For specific implementation methods, please refer to the subsequent embodiments.

[0038] S150, determining a body height value based on the ground point relative to the target area and the body height measurement point, and determining a body length value based on the distance between the front chest measurement point and the hip end measurement point on the two-dimensional plane.

[0039] In an embodiment of the present invention, the Y values of multiple ground points are determined, and the average of the Y values of the multiple ground points is used as the ground height value; the difference between the ground height value and the Y value of the body height measurement point is used as the body height value; the first three-dimensional coordinates of the chest measurement point and the second three-dimensional coordinates of the hip measurement point are determined; and the distance between the first three-dimensional coordinates and the second three-dimensional coordinates projected onto a two-dimensional plane is used as the body length value. For specific implementation methods, please refer to the subsequent embodiments.

[0040] S160: Obtain the contour endpoints of the chest and tube portion based on the chest circumference and tube circumference measurement points, respectively, and fit a target smooth curve based on the point set between the endpoints; calculate a first length of the target smooth curve and a first height difference between the endpoints of the target smooth curve; use the sum of the first length and twice the first height difference as the chest circumference length; and use the sum of the first length and twice the first height difference as the tube circumference length.

[0041] According to an embodiment of the present invention, a portable horse body ruler measurement method based on a single-view RGB-D camera obtains a target area based on a segmentation model and determines whether the target area is within the field of view; when it is determined that the target area is within the field of view, the target key points are confirmed from the key points output by the key point model, and the posture of the target area is confirmed based on the target key points; when the posture of the target area is confirmed, the starting measurement point is calculated based on the target key points of a preset number of confirmed frames, wherein the target key points include multiple, and the starting measurement points include a first starting measurement point and a second starting measurement point; based on the starting measurement point and the contour edge side measurement points, the starting measurement point is determined. Different attribute measurement points are determined, including height measurement points and length measurement points, with the latter including chest measurement points and hip end measurement points. The height value is determined based on the ground point relative to the target area and the height measurement points, and the length value is determined based on the distance between the chest measurement points and the hip end measurement points on a two-dimensional plane. The chest and tube contour endpoints are obtained based on the chest circumference and tube circumference measurement points, respectively, and a target smooth curve is fitted based on the point set between the endpoints. The first length of the target smooth curve and the first height difference between the endpoints of the target smooth curve are calculated. The sum of the first length and twice the first height difference is used as the chest circumference length; and the sum of the first length and twice the first height difference is used as the tube circumference length. This method achieves automated measurement of horse dimensions, improving measurement efficiency and accuracy.

[0042] In order to make it easier for those skilled in the art to understand the present invention, Figure 2 A portable horse body measurement method based on a single-view RGB-D camera according to a specific embodiment of the present invention is provided. Figure 2 As shown in FIG, the portable horse body measurement method based on a single-view RGB-D camera includes:

[0043] S210: Acquire a target area based on the segmentation model, and determine whether the target area is within the field of view.

[0044] In an embodiment of the present invention, the RGB image and the Depth image of the target image are input into a segmentation model to obtain a target region.

[0045] For example, (1) data preparation and preprocessing can be performed first: Data acquisition: Obtaining high-quality RGB images and corresponding depth images is a prerequisite for achieving accurate segmentation. This is usually done through a device equipped with a depth sensor (such as Kinect or AsusXtion Pro Live). For specific application scenarios, such as the segmentation of horse images, it is necessary to ensure that the dataset covers horse images in different postures and scenes. Data alignment: Since RGB images and depth images come from different sensors, they need to be aligned in the preprocessing stage to ensure consistency in their spatial positions. This usually involves image registration technology, including but not limited to feature point matching, transformation matrix calculation and other steps. Data enhancement: In order to improve the generalization ability of the model, the training data is usually enhanced, such as rotation, scaling, cropping, etc. This not only increases the amount of data, but also simulates various scenarios and challenges that may be encountered in actual applications; (2) Then the segmentation model is selected and constructed: Model selection: Select a suitable segmentation model according to application requirements. For the segmentation task of fusion of RGB and depth images, classic semantic segmentation networks such as U-Net, FCN (fully convolutional network), DeepLab, etc. can be used as the basic framework. These models have good spatial downsampling and upsampling structures, which can effectively capture the contextual information of the image. Multimodal fusion: How to effectively fuse RGB and Depth information is the key to improving segmentation results. Common fusion strategies include early fusion (fusion before the feature layer), late fusion (fusion at the decision layer), and intermediate fusion (fusion at the feature layer). Among them, intermediate fusion strategies, such as fusing RGB and Depth features through a cross-modal attention mechanism, have been shown to more effectively utilize information from both modalities. Model optimization: In order to further improve model performance, it is possible to consider using a multi-task learning framework to simultaneously learn depth estimation and semantic segmentation tasks. This approach can, to a certain extent, alleviate the impact of depth data noise and promote the model to learn more discriminative feature representations; (3) Training strategy and tuning are then performed: Loss function design: For semantic segmentation tasks, commonly used loss functions include cross entropy loss and Dice loss. When processing RGB and Depth fusion data, a weighted loss function can be designed to assign different weights to different modalities and different pixels to emphasize more important areas or modalities. Optimization algorithm selection: A suitable optimization algorithm can accelerate model convergence and improve performance. Common optimizers include Adam and RMSprop. For models with multimodal inputs, an optimizer with adaptive learning rate adjustment can better handle gradient variations across different modalities. Hyperparameter Tuning: The settings of hyperparameters (such as learning rate, batch size, and number of iterations) have a significant impact on model performance. Grid search, random search, or Bayesian optimization can be used to find the optimal hyperparameter combination.(4) Finally, the model is experimentally verified and applied: Performance evaluation: The model is evaluated using standard evaluation indicators (such as mIoU, Precision-Recall curve, etc.). By comparing the performance of different models and different fusion strategies, the effectiveness of the proposed method can be verified. Practical application testing: The trained model is deployed in actual application scenarios. Feedback iteration: Based on the feedback from actual applications, the model and training strategy are further optimized. For example, more challenging samples can be collected for difficult sample training to improve the robustness of the model.

[0046] In summary, effectively fusing RGB and depth images and inputting them into a segmentation model is an effective way to achieve highly accurate target region segmentation. Through reasonable data preprocessing, carefully selected segmentation models, effective training strategies, and experimental verification, accurate target segmentation can be achieved in a variety of application scenarios.

[0047] In an embodiment of the present invention, whether the target area is completely within the visual field is determined based on whether the detection frame of the target area is within 95% of the visual field.

[0048] S220 : When it is determined that the target area is within the field of view, target key points are confirmed based on the key points output by the key point model.

[0049] In the embodiment of the present invention, the implementation of step S220 may refer to the implementation of the above-mentioned step S120, and the present invention will not elaborate on this.

[0050] In an embodiment of the present invention, the camera data stream (RGB+depth, 10 frames per second*2) is passed to the key point model and the segmentation model frame by frame, the contours and key points are optimized, and the output deduction results include key points, key point confidence, and contours. Example: 10 frames of data need to be processed per second, consider using batch processing instead of single frame processing. Design a buffer to collect a certain number of frames each time (for example, 2 frames are processed each time), and then send these frames to the model as a batch; compress and crop the image to retain only the region of interest (horse_boxx). Store the model results of each frame in an array form [ID, [key point], [confidence], [contour]] in a fixed order to improve computational efficiency.

[0051] S230: Confirm the posture of the target area based on the target key points.

[0052] In the embodiment of the present invention, the target key point can be understood as a valuable point among the target feature points, for example, Figure 3As shown, the target key points include (eye, neck, tail, left_front_leg_1, left_front_leg_2, left_front_leg_3, right_front_leg_2, left_back_leg_1, left_back_leg_2, left_back_leg_3, right_back_leg_2.

[0053] In an embodiment of the present invention, it is determined that less than or equal to two key points among the target key points are blocked; it is determined that the depth difference between the target key points is less than a preset difference; based on a first angle between a first distance vector in the target area and an xy plane in three-dimensional space and a second angle between a second distance vector and the xy plane in three-dimensional space, it is judged whether the target inclination degree is within a preset range; based on a third angle between a third distance vector in the target area and a fourth distance vector in the three-dimensional space of the xy plane, it is judged whether the angle between the two legs of the target forelimb is greater than a preset threshold.

[0054] Among them, the first distance vector can be understood as the vector connecting the key point neck and the key point tail; the second distance vector can be understood as the vector connecting left_front_leg_1 and the key point left_back_leg_1. The first two distance vectors can be understood as vectors on the target torso, used to determine the parallel relationship between the target and the device camera; the third distance vector can be understood as the vector connecting the key point left_front_leg_1 and the key point left_front_leg_2, representing the horse's left forelimb. The fourth distance vector can be understood as the vector connecting the key point left_front_leg_1 and the key point right_front_leg_1. The projection angle on the xy plane represents the degree of bifurcation of the horse's legs.

[0055] For example, posture confirmation needs to meet the following conditions: A. Only less than or equal to two depth points among the 11 key points are blocked; B. The depth value deviation of all key points is less than 0.5m; C. The angle between the ("neck", "tail"), ("left_front_leg_1", "left_back_leg_1") 1-2 vector and the plane xy is less than 10°; D. The angle between the ("left_front_leg_1", "left_front_leg_2"), ("left_back_leg_1", "left_back_leg_2") 3-4 vector and the 7-8 vector projected onto the xy plane is less than 15°.

[0056] In this embodiment of the present invention, the confidence level of keypoints, the depth relationship between the camera and the horse, and the angle between the vectors of the two sets of keypoints are used to determine whether the pose meets the standard requirements. This process continues until three consecutive frames that meet the requirements are found. From this point on, the next 10 frames of data are saved to the hard drive, and only these 10 frames are saved in memory. Example: a. Design a function that maintains a sliding window with a size of at least three frames of input data. Whenever a new frame of input data arrives and is processed, the window is updated and the new window data is analyzed. Only when all frames in the window meet the pose confirmation criteria are the depth and color data for these three frames and the following seven frames, totaling 10 frames, saved to the hard drive and memory. b. Before confirmation, cache the data in memory instead of writing it directly to the hard drive. Once confirmation is complete, batch write the data; use numpy arrays to store the frame data. c. Use np.diff() to calculate the depth difference between each two consecutive keypoints and np.max() to obtain the maximum difference within each frame, selecting frames with a fluctuation of less than 0.5 meters.

[0057] S240 , when confirming the posture of the target area, calculating a starting measurement point according to the target key points of the confirmed preset number of frames, wherein the target key points include a plurality of them, and the starting measurement points include a first starting measurement point and a second starting measurement point.

[0058] In an embodiment of the present invention, the first key point and the second key point of the front leg region in the target key point are obtained; the average coordinates of the first key point and the second key point are used as the coordinates of the first starting measurement point. Figure 3 As shown, the first key point is neck and the second key point is left_front_leg_1.

[0059] In an embodiment of the present invention, the fourth and fifth key points of the hind leg region of the target key points are obtained; the average of the coordinates of the fourth and fifth key points is used as the coordinates of the second starting measurement point. Figure 3 As shown, the fourth key point is tail and the fifth key point is left_back_leg_1.

[0060] S250: Determine a body height measurement point based on the first starting measurement point and the contour edge side measurement point.

[0061] In an embodiment of the present invention, when a first starting measurement point is calculated, a direction search is performed on the first starting measurement point based on a first preset angle to determine the coordinates of a first intersection point between the first starting measurement point and the boundary contour, and an average value of a preset number of first intersection coordinates is used as a contour edge side measurement point; starting from a position of a preset number of pixel values outside the contour edge side measurement point, a search is performed along the direction from the contour edge side measurement point to the first starting measurement point to obtain a three-dimensional edge coordinate point, and the three-dimensional edge coordinate point is used as a body height measurement point.

[0062] For example, if the first starting measurement point is P1, point P1 is searched for contour intersections along the two angles (325° and 345°); when the horse enters from the right to the left, point P1 is searched for contour intersections along the two angles (15° and 35°), and the average value of the intersections is used as the contour edge side measurement point. After that, the 10 pixel values outside the contour edge side measurement point are searched in the direction from the contour edge side measurement point to P1 to obtain the 3D coordinate point of the outermost edge, that is, Figure 3 H1 in the figure is used as the height measurement point.

[0063] S260: Determine a body length measurement point based on the second starting measurement point and the contour edge side measurement point.

[0064] In an embodiment of the present invention, the body length measurement points include a chest measurement point and a hip end measurement point.

[0065] In an embodiment of the present invention, a direction search is performed on the first starting measurement point based on a second preset angle to determine the coordinates of a second intersection of the first starting measurement point and the boundary contour, and an average value of a preset number of the second intersection coordinates is used as the contour edge side measurement point; starting from a position of a preset number of pixel values outside the contour edge side measurement point, a search is performed along the direction from the contour edge side measurement point to the first starting measurement point to obtain a three-dimensional edge coordinate point, and the three-dimensional edge coordinate point is used as the front chest measurement point; a direction search is performed on the second starting measurement point based on a third preset angle to determine the coordinates of a third intersection of the second starting measurement point and the boundary contour, and an average value of the preset number of the third intersection coordinates is used as the contour edge side measurement point; starting from a position of a preset number of pixel values outside the contour edge side measurement point, a search is performed along the direction from the contour edge side measurement point to the second starting measurement point to obtain a three-dimensional edge coordinate point, and the three-dimensional edge coordinate point is used as the hip end measurement point; and a body length measurement point is determined based on the front chest measurement point and the hip end measurement point.

[0066] For example, when the horse enters from left to right, the first starting measurement point P1 is searched for contour intersections along two angles (30° and 75°); when the horse enters from right to left, the first starting measurement point P1 is searched for contour intersections along two angles (225° and 245°), and the average value is taken as the contour edge side measurement point. Then, from the outer contour edge side measurement point to the P1 vector 20 pixels inward (in the opposite direction of the vector) to obtain the most edge valid depth value point. Figure 3 L1 in the figure is used as the chest measurement point.

[0067] For example, when the horse enters from left to right, the second starting point is used to search for contour intersections along the two angles (285° and 330°); when the horse enters from right to left, the second starting point is used to search for contour intersections along the two angles (115° and 135°), and the average value is taken as the contour edge side measurement point. From the outer contour edge side measurement point to the P1 vector 20 pixels inward (in the opposite direction of the vector) to obtain the most edge effective depth value point. Figure 3 L2 in the figure is used as the hip end measurement point.

[0068] In one embodiment of the present invention, a direction search is performed on the first starting measurement point based on a fourth preset angle to determine a first target intersection point between the first starting measurement point and the boundary contour, and a second target intersection point between the first target intersection point and the boundary contour is determined using the first target intersection point as a perpendicular line. An average of the first target intersection point and the second target intersection point is used as the chest measurement point. Based on the vector direction of the sixth key point and the seventh key point, a horizontal line is drawn with the seventh key point as the starting point to determine the X-value difference between the two points. A tube circumference measurement position is determined based on the vector direction and the X-value difference, and the tube circumference measurement point is determined based on the tube circumference measurement position.

[0069] For example, when a horse enters from the left to the right, the contour intersection is searched along 320 degrees, i.e., one angle, from the first starting measurement point P1. After the intersection is determined, another intersection is determined in the vertical downward direction of the intersection. The average of the two intersections is taken as the chest measurement point. Figure 3 B1 in the figure is used as the chest measurement point; when the horse enters from the right to the left, search for the contour intersection point along 40°, that is, an angle, from the first starting measurement point P1. After the intersection point is determined, another intersection point is determined vertically downward from the intersection point. The average of the two intersection points is taken as the chest measurement point. Figure 3 B1 in the figure is used as the chest measurement point.

[0070] For example, Figure 3 As shown, left_front_leg_2 is used as the sixth key point, left_back_leg_3 is used as the seventh key point, and the vector direction from the sixth key point to the seventh key point is defined. Iterate along every two pixels, remove 200 depth values from each pixel, cluster and extract the small parts, obtain the intersection points at both ends, and calculate the distance between the two intersection points. The average value of the two intersection points with the smallest distance is the pipe surrounding measurement point, that is, Figure 3 T1 in the figure is used as the pipe circumference measurement point.

[0071] S270: Determine the body height value based on the ground points and the body height measurement points relative to the target area.

[0072] In an embodiment of the present invention, when determining the body height measurement point, the Y values of multiple ground points are determined, and the average value of the Y values of the multiple ground points is used as the ground height value; the difference between the ground height value and the Y value of the body height measurement point is used as the body height value.

[0073] For example, the ground height calculation: Figure 3 As shown, based on the center point of the quadrilateral with the joints of the left_front_leg_2, right_front_leg_2, left_back_leg_2, and right_back_leg_2 limbs as endpoints, a rectangle with a length of 160 and a width of 90 is taken. The height of all points is calculated using internal parameters and depth data. The extreme values are filtered out and the average is taken as the ground height Dy (calculated only once in 10 frames). Next, the height value Hy of the H1 measurement point is calculated: body height = Hy - Dy.

[0074] S280: Determine the body length value based on the distance between the front chest measurement point and the hip end measurement point on the two-dimensional plane.

[0075] In an embodiment of the present invention, when the front chest measurement point and the hip end measurement point are determined, the first three-dimensional coordinates of the front chest measurement point and the second three-dimensional coordinates of the hip end measurement point are determined; and the distance between the first three-dimensional coordinates and the second three-dimensional coordinates projected onto a two-dimensional plane is used as the body length value.

[0076] S290, calculate chest length and tube length.

[0077] In one embodiment of the present invention, after determining the chest girth measurement point and the tube girth measurement point, a target smooth curve is fitted according to the endpoints of the horse's outline; a first length of the target smooth curve and a first height difference between the endpoints of the target smooth curve are calculated (the height difference is considered to be half of the horse's chest girth or the blind spot of the tube girth outline); twice the sum of the first length and the first height difference is used as the chest girth length; and the sum of the first length and twice the first height difference is used as the tube girth length.

[0078] For example, based on the upper and lower endpoints of the horse's outline obtained by chest circumference measurement, all coordinates and their corresponding depth values on the connecting line are taken and converted into three-dimensional coordinates. The possible extreme values at both ends (outward expansion of the outline) are filtered out. These points are projected onto the YZ plane, and a smooth curve is fitted. The curve length and the height difference between the fitted curve endpoints are calculated. The curve length plus twice the height difference is considered the chest circumference length.

[0079] Take out the left and right endpoints of the pipe circumference measurement point, filter out the extreme values that may appear at both ends, project these points onto the XZ plane, fit a smooth curve, calculate the curve length and the height difference of the fitted curve endpoints, and the curve length plus twice the height difference is considered as the pipe circumference length.

[0080] In one embodiment of the present invention, the effectiveness of the method provided by the present invention is verified by taking the measurement of body dimensions of 120 horses at a large-scale horse farm as an example. During the measurement process, a total of 254 segments of depth data were captured, totaling about 12,000 frames. The number of individuals that met the standard measurement posture was verified by the posture confirmation module to be 90. According to statistics, the average manual measurement speed for docile horses is 180 seconds per horse, and the average measurement speed for untrained horses is greater than 300 seconds per horse. Among them, the automatic measurement speed in the present invention is 15-30 seconds per horse, and the manual point selection to assist in the correction of body length and height measurement requires 30-50 seconds per horse. Compared with the restraint pen measurement and manual measurement, the time for animal soothing, waiting, and measurement preparation is greatly reduced, and the measurement efficiency is doubled. Referring to Table 1, the measurement results using the method provided by the present invention and the hand-selected point cloud were compared with the manual measurement results, and it was found that the automatic measurement method of the present invention generally has smaller errors in various indicators, especially the average absolute errors of body height and body length are 2.57 cm and 3.26 cm respectively, and the average absolute percentage errors are 1.64% and 2.00% respectively. The posture confirmation and measurement search module not only greatly improves the measurement accuracy, but also greatly improves the stability of the measurement results compared with the non-contact shooting method of "manual selection of measurement points". In addition, the fitting model of tube circumference and chest circumference is established based on the body size data of 1057 small and medium-sized horses accumulated in the early stage. As Figure 6 As shown, in the scenario of demarcating a simple measurement site, a computing device with a computing power of 20TOPS can be equipped with the calculation program described in this invention, and the mean absolute error of chest circumference and tube circumference in single-view calculations can be controlled to 2.19% and 7.51% respectively. While meeting the same error requirements, compared with multi-camera fusion and calculation methods, this invention reduces camera costs by 75% and computing power requirements by 50%, significantly improving practicality and convenience.

[0081]

[0082] Table 1

[0083] According to an embodiment of the present invention, the portable horse body measurement method based on a single-view RGB-D camera can accurately capture the details of the target area and improve segmentation accuracy by combining the segmentation model of RGB images and depth images. Key point models are used to further precisely locate feature points, ensuring the accuracy of the measurement data. The entire process, from data acquisition, preprocessing, segmentation, feature point identification, to size measurement, can be completed automatically, greatly improving efficiency and reducing the need for human intervention. This technical solution is not only suitable for measuring the size of horses, but can also be extended to the size measurement of other animals or objects, and has broad application prospects. Compared with traditional manual measurement methods, automated image processing and analysis technology greatly reduces measurement errors caused by human factors and improves the objectivity and repeatability of measurements, achieving rapid, accurate, and non-contact measurement of target object sizes.

[0084] Through the description of the above implementation methods, those skilled in the art can clearly understand that the method according to the above embodiment can be implemented by means of software plus the necessary general hardware platform, and of course it can also be implemented by hardware, but in many cases the former is a better implementation method. Based on this understanding, the technical solution of the present application, or the part that contributes to the prior art, can be embodied in the form of a software product, which is stored in a storage medium (such as ROM / RAM, magnetic disk, optical disk), and includes a number of instructions for enabling a terminal device (which can be a mobile phone, computer, server, or network device, etc.) to execute the methods of each embodiment of the present application.

[0085] According to one aspect of the embodiments of the present invention, a portable horse size measurement system based on a single-view RGB-D camera is also proposed. Figure 4 is a structural block diagram of a portable horse size measurement system based on a single-view RGB-D camera according to an embodiment of the present invention; Figure 4 As shown, including:

[0086] A first judgment module 410 is configured to obtain a target area based on the segmentation model and determine whether the target area is within a field of view;

[0087] a posture confirmation module 420 for confirming target key points from the key points output by the key point model when the target area is determined to be within the field of view, and performing posture confirmation on the target area based on the target key points;

[0088] A first calculation module 430 is configured to calculate a starting measurement point based on the target key points of a preset number of confirmed frames when the posture of the target area is confirmed, wherein the target key points include a plurality of target key points, and the starting measurement points include a first starting measurement point and a second starting measurement point;

[0089] A first determining module 440 is configured to determine different attribute measurement points based on the starting measurement point and the contour edge side measurement points, wherein the different attribute measurement points include a body height measurement point and a body length measurement point, and the body length measurement points include a chest measurement point and a hip end measurement point;

[0090] A second determining module 450 is configured to determine a body height value based on a ground point relative to the target area and the body height measuring point, and to determine a body length value based on a distance between the chest measuring point and the hip end measuring point on a two-dimensional plane;

[0091] The second calculation module 460 is used to obtain the contour endpoints of the chest and tube part based on the chest circumference and tube circumference measurement points respectively, and fit a target smooth curve based on the point set between the endpoints; calculate a first length of the target smooth curve and a first height difference between the endpoints of the target smooth curve; use the sum of the first length and twice the first height difference as the chest circumference length; and use the sum of the first length and twice the first height difference as the tube circumference length.

[0092] According to an embodiment of the present invention, a portable horse body ruler measurement system based on a single-view RGB-D camera acquires a target area based on a segmentation model and determines whether the target area is within a field of view. When it is determined that the target area is within the field of view, the target key points are confirmed based on the key points output by the key point model, and the posture of the target area is confirmed based on the target key points. When the posture of the target area is confirmed, a starting measurement point is calculated based on the target key points of a preset number of confirmed frames, wherein the target key points include multiple, and the starting measurement points include a first starting measurement point and a second starting measurement point. The starting measurement point and the contour edge side measurement points are used to determine the posture of the target area. Different attribute measurement points are determined, including height and length measurement points. The latter include chest and hip points. The height value is determined based on the ground point relative to the target area and the height measurement point, and the length value is determined based on the distance between the chest and hip points on a two-dimensional plane. The chest and tube contour endpoints are obtained based on the chest and tube circumference measurement points, respectively. A target smooth curve is fitted based on the point set between the endpoints. The first length of the target smooth curve and the first height difference between the endpoints of the target smooth curve are calculated. The sum of the first length and twice the first height difference is used as the chest circumference length. The sum of the first length and twice the first height difference is used as the tube circumference length. This achieves automated measurement of horse dimensions, improving measurement efficiency and accuracy.

[0093] Optionally, the first judgment module 410 is specifically used to input the RGB image and the Depth image of the target image into the segmentation model to obtain the target area; determine whether the target area is completely within the field of view based on whether the detection frame of the target horse is within 95% of the center of the field of view; the target key points include 11 key points, wherein the posture confirmation module 420 is specifically used to determine that less than or equal to two key points among the target key points are blocked; determine that the depth difference between the target key points is less than a preset difference; determine whether the target inclination degree is within a preset range based on the first angle between the first distance vector in the target area and the xy plane in the three-dimensional space and the second angle between the second distance vector and the xy plane in the three-dimensional space; determine whether the angle between the target forelimbs is greater than a preset threshold based on the third angle between the third distance vector in the target area and the fourth distance vector in the three-dimensional space.

[0094] Optionally, the first calculation module 430 is specifically configured to obtain a first key point and a second key point in the front leg region of the target key point; and use the average coordinates of the first key point and the second key point as the coordinates of the first starting measurement point.

[0095] Optionally, the first calculation module 430 is specifically used to obtain a fourth key point and a fifth key point in the hind leg area of the target key point; and take the average of the coordinates of the fourth key point and the fifth key point as the coordinates of the second starting measurement point.

[0096] Optionally, the first determination module 440 is specifically configured to perform a direction search based on a first preset angle for the first starting measurement point, determine the coordinates of a first intersection point between the first starting measurement point and the boundary contour, and use the average value of a preset number of the first intersection coordinates as the contour edge side measurement point; start from a position of a preset number of pixel values outside the contour edge side measurement point, and search along the direction from the contour edge side measurement point to the first starting measurement point to obtain a three-dimensional edge coordinate point, and use the three-dimensional edge coordinate point as the body height measurement point.

[0097] Optionally, the first determination module 440 is specifically configured to perform a direction search based on a second preset angle on the first starting measurement point to determine the coordinates of a second intersection between the first starting measurement point and the boundary contour, and use the average value of a preset number of the coordinates of the second intersection points as the contour edge side measurement point; starting from a position a preset number of pixel values outside the contour edge side measurement point, search along the direction from the contour edge side measurement point to the first starting measurement point to obtain a three-dimensional edge coordinate point, and use the three-dimensional edge coordinate point as the front chest measurement point; performing a direction search based on the second starting measurement point based on a third preset angle to determine the coordinates of a third intersection between the second starting measurement point and the boundary contour, and use the average value of a preset number of the coordinates of the third intersection points as the contour edge side measurement point; starting from a position a preset number of pixel values outside the contour edge side measurement point, search along the direction from the contour edge side measurement point to the second starting measurement point to obtain a three-dimensional edge coordinate point, and use the three-dimensional edge coordinate point as the hip end measurement point; and determining the body length measurement point based on the front chest measurement point and the hip end measurement point.

[0098] Optionally, the different attribute measurement points further include a chest circumference measurement point and a tube circumference measurement point, wherein a direction search is performed on the first starting measurement point based on a fourth preset angle to determine a first target intersection point between the first starting measurement point and the boundary contour, and a second target intersection point between the first target intersection point and the boundary contour is determined using the first target intersection point as a perpendicular line. An average of the first target intersection point and the second target intersection point is used as the chest circumference measurement point. Based on the vector direction of the sixth key point and the seventh key point, a horizontal line is drawn with the seventh key point as the starting point to determine an X-value difference between the two points. A tube circumference measurement position is determined based on the vector direction and the X-value difference, and the tube circumference measurement point is determined based on the tube circumference measurement position.

[0099] Optionally, the second calculation module 460 is specifically used to determine the Y values of multiple ground points, and take the average of the Y values of the multiple ground points as the ground height value; take the difference between the ground height value and the Y value of the body height measurement point as the body height value; determine the first three-dimensional coordinates of the chest measurement point and the second three-dimensional coordinates of the hip measurement point; and take the distance between the first three-dimensional coordinates and the second three-dimensional coordinates projected onto the two-dimensional plane as the body length value.

[0100] According to one aspect of an embodiment of the present invention, an electronic device is provided.

[0101] Figure 5 FIG. 1 is a schematic diagram of the structure of an electronic device according to an embodiment of the present invention. Figure 5 As shown, the electronic device may include one or more ( Figure 5Only one is shown in the figure) a processor 102 (the processor 102 may include but is not limited to a microprocessor (Microprocessor Unit, referred to as MPU) or a programmable logic device (Programmable logic device, referred to as PLD)) and a memory 104 for storing data. In an exemplary embodiment, the electronic device may further include a transmission device 106 and an input / output device 108 for communication functions. It will be understood by those skilled in the art that Figure 5 The structure shown is only for illustration and does not limit the structure of the above terminal device. Figure 5 More or fewer components than shown, or with Figure 5 Equivalent functions or comparisons shown Figure 5 Shown are different configurations with more functionality.

[0102] Memory 104 can be used to store computer programs, such as application software programs and modules, such as the computer program corresponding to the portable horse body measurement method based on a single-view RGB-D camera in the embodiments of the present invention. Processor 102 executes the computer program stored in memory 104 to perform various functional applications and data processing, thereby implementing the aforementioned method. Memory 104 may include high-speed random access memory (RAM) and may also include non-volatile memory, such as one or more magnetic storage devices, flash memory, or other non-volatile solid-state memory. In some examples, memory 104 may further include memory remotely located from processor 102, which can be connected to the terminal device via a network. Examples of such networks include, but are not limited to, the Internet, corporate intranets, local area networks, mobile communication networks, and combinations thereof.

[0103] The transmission device 106 is used to receive or transmit data via a network. A specific example of the aforementioned network may include a wireless network provided by a communications provider of a switching device. In one embodiment, the transmission device 106 includes a network interface controller (NIC), which can be connected to other network devices via a base station to enable communication with the Internet. In another embodiment, the transmission device 106 may be a radio frequency (RF) module, which is used to communicate with the Internet wirelessly.

[0104] The present invention provides a computer-readable storage medium having a computer program stored thereon. The computer program can be loaded and executed by a processor to implement the portable horse body size measurement method based on a single-view RGB-D camera as described in the first aspect.

[0105] The applicant of the present invention has made a detailed explanation and description of the implementation examples of the present invention in conjunction with the drawings in the specification. However, those skilled in the art should understand that the above implementation examples are only preferred implementation plans of the present invention, and the detailed description is only to help readers better understand the spirit of the present invention, and is not a limitation on the scope of protection of the present invention. On the contrary, any improvements or modifications based on the inventive spirit of the present invention should fall within the scope of protection of the present invention.

[0106] In addition, the functional units in the various embodiments of the present invention may be integrated into a single processing module, or each unit may exist physically separately, or two or more units may be integrated into a single module. The aforementioned integrated modules may be implemented in the form of hardware or in the form of software functional modules. If the integrated modules are implemented in the form of software functional modules and sold or used as independent products, they may also be stored in a computer-readable storage medium.

[0107] The storage medium mentioned above may be a read-only memory, a magnetic disk, or an optical disk, etc. Although the embodiments of the present invention have been shown and described above, it is understood that the above embodiments are exemplary and are not to be construed as limiting the present invention. Persons skilled in the art may make changes, modifications, substitutions, and variations to the above embodiments within the scope of the present invention.

[0108] Finally, it should be noted that the above embodiments are merely illustrative of the technical solutions of the embodiments of the present invention, and are not intended to limit them. Although the present invention has been described in detail with reference to the aforementioned embodiments, those skilled in the art should understand that they may still modify the technical solutions described in the aforementioned embodiments, or replace some of the technical features therein with equivalents; and such modifications or replacements do not deviate from the essence of the corresponding technical solutions from the spirit and scope of the technical solutions of the embodiments of the present invention. Any changes or replacements that can be easily conceived by those skilled in the art within the technical scope disclosed in the present invention should be covered by the scope of protection of the present invention.

Claims

1. A portable horse body measurement method based on a single-view RGB-D camera, characterized by: include: S1, obtaining a target area based on a segmentation model, and determining whether the target area is within a field of view; S2, when it is determined that the target area is within the field of view, confirming target key points from the key points output by the key point model, and confirming the posture of the target area based on the target key points; S3, when confirming the posture of the target area, calculating a starting measurement point based on the target key points of a preset number of confirmed frames, wherein the target key points include a plurality of them, and the starting measurement points include a first starting measurement point and a second starting measurement point; S4, determining different attribute measurement points based on the starting measurement point and the contour edge side measurement points, wherein the different attribute measurement points include a body height measurement point and a body length measurement point, and the body length measurement points include a chest measurement point and a hip end measurement point; S5, determining a body height value based on a ground point relative to the target area and the body height measuring point, and determining a body length value based on a distance between the front chest measuring point and the hip end measuring point on a two-dimensional plane; S6, respectively obtain the contour endpoints of the chest and tube part according to the chest circumference and tube circumference measurement points, and fit a target smooth curve according to the point set between the endpoints; calculate a first length of the target smooth curve and a first height difference between the endpoints of the target smooth curve; take the sum of the first length and twice the first height difference as the chest circumference length; take the sum of the first length and twice the first height difference as the tube circumference length.

2. The portable horse size measurement method based on a single-view RGB-D camera according to claim 1 is characterized in that: Obtain the target area based on the segmentation model, including: The RGB image and Depth image of the target image are input into the segmentation model to obtain the target area; wherein, Determining whether the target area is within the field of view includes: Determine whether the target area is completely within the field of view based on whether the detection frame of the target horse is within 95% of the center of the field of view; The target key points include 11 key points, wherein the posture confirmation of the target area based on the target key points includes: Determining that less than or equal to two key points among the target key points are occluded; Determining that the depth difference between the target key points is less than a preset difference; determining whether the target tilt is within a preset range based on a first angle between a first distance vector in the target area and an xy plane in three-dimensional space and a second angle between a second distance vector in the target area and the xy plane in three-dimensional space; According to a third angle between the third distance vector and the fourth distance vector in the target area in the xy plane of the three-dimensional space, it is determined whether the angle between the two legs of the target forelimb is greater than a preset threshold.

3. The portable horse size measurement method based on a single-view RGB-D camera according to claim 1 is characterized in that: The starting measurement point is calculated based on the target key points of the confirmed preset number of frames, including: Obtaining a first key point and a second key point of a front leg region among the target key points; The average coordinates of the first key point and the second key point are used as the coordinates of the first starting measurement point.

4. The portable horse size measurement method based on a single-view RGB-D camera according to claim 3 is characterized in that: Also includes: Obtaining the fourth key point and the fifth key point of the hind leg area among the target key points; The average of the coordinates of the fourth key point and the fifth key point is used as the coordinates of the second starting measurement point.

5. The portable horse size measurement method based on a single-view RGB-D camera according to claim 1 is characterized in that: According to the starting measurement point and the contour edge side measurement points, different attribute measurement points are determined, including: Performing a direction search based on a first preset angle on the first starting measurement point to determine the coordinates of a first intersection point between the first starting measurement point and the boundary contour, and taking an average value of a preset number of the first intersection coordinates as the contour edge side measurement point; Starting from a position of a preset number of pixel values outside the contour edge side measuring point, a search is performed along the contour edge side measuring point to the first starting measuring point to obtain an edge three-dimensional coordinate point, and the edge three-dimensional coordinate point is used as the body height measuring point.

6. The portable horse size measurement method based on a single-view RGB-D camera according to claim 5, characterized in that: Also includes: Performing a direction search based on a second preset angle on the first starting measurement point to determine the coordinates of a second intersection point between the first starting measurement point and the boundary contour, and taking an average value of a preset number of the second intersection coordinates as the contour edge side measurement point; Starting from a position with a preset number of pixel values outside the contour edge side measuring point, searching along the contour edge side measuring point to the first starting measuring point to obtain a three-dimensional edge coordinate point, and using the three-dimensional edge coordinate point as the front chest measuring point; Performing a direction search based on a third preset angle on the second starting measurement point to determine the coordinates of a third intersection point between the second starting measurement point and the boundary contour, and taking an average value of a preset number of the third intersection coordinates as the contour edge side measurement point; Starting from a position with a preset number of pixel values outside the contour edge side measuring point, searching along the contour edge side measuring point to the second starting measuring point to obtain a three-dimensional edge coordinate point, and using the three-dimensional edge coordinate point as the hip end measuring point; The body length measurement point is determined according to the front chest measurement point and the hip end measurement point.

7. The portable horse size measurement method based on a single-view RGB-D camera according to claim 3 is characterized in that: The different attribute measurement points also include chest measurement points and tube measurement points, wherein: Performing a direction search based on a fourth preset angle on the first starting measurement point to determine a first target intersection point between the first starting measurement point and the boundary contour, and using the first target intersection point as a perpendicular line, determining a second target intersection point between the perpendicular line and the boundary contour; Taking the average value of the first target intersection point and the second target intersection point as the chest measurement point; and Based on the vector directions of the sixth key point and the seventh key point, draw a horizontal line with the seventh key point as the starting point, and determine the X value difference between the two points; The pipe circumference measurement position is determined according to the vector direction and the X value difference, and the pipe circumference measurement point is determined based on the pipe circumference measurement position.

8. The portable horse size measurement method based on a single-view RGB-D camera according to claim 1, characterized in that: Determining a body height value based on a ground point relative to the target area and the body height measurement point, and determining a body length value based on a distance between the chest measurement point and the hip end measurement point on a two-dimensional plane, including: Determine the Y values of the plurality of ground points, and take the average of the Y values of the plurality of ground points as the ground height value; The difference between the ground height value and the Y value of the body height measurement point is used as the body height value; Determine the first three-dimensional coordinates of the chest measurement point and the second three-dimensional coordinates of the hip measurement point; The distance between the first three-dimensional coordinate and the second three-dimensional coordinate projected onto the two-dimensional plane is used as the body length value.

9. A portable horse body measurement system based on a single-view RGB-D camera, characterized by: include: A first judgment module is used to obtain a target area based on the segmentation model and determine whether the target area is within the field of view; a posture confirmation module, configured to, when it is determined that the target area is within the field of view, confirm target key points from the key points output by the key point model, and perform posture confirmation on the target area based on the target key points; A first calculation module is configured to calculate a starting measurement point based on the target key points of a preset number of confirmed frames when the posture of the target area is confirmed, wherein the target key points include a plurality of them, and the starting measurement points include a first starting measurement point and a second starting measurement point; A first determining module is configured to determine different attribute measuring points based on the starting measurement point and the contour edge side measurement points, wherein the different attribute measuring points include a body height measurement point and a body length measurement point, and the body length measurement points include a chest measurement point and a hip end measurement point; a second determining module, configured to determine a body height value based on a ground point relative to the target area and the body height measuring point, and to determine a body length value based on a distance between the front chest measuring point and the hip end measuring point on a two-dimensional plane; The second calculation module is used to obtain the contour endpoints of the chest and tube part based on the chest circumference and tube circumference measurement points respectively, and fit the target smooth curve according to the point set between the endpoints; calculate the first length of the target smooth curve and the first height difference of the endpoints of the target smooth curve; use the sum of the first length and twice the first height difference as the chest circumference length; and use the sum of the first length and twice the first height difference as the tube circumference length.

10. An electronic device, characterized in that: include: at least one processor; as well as a memory communicatively connected to the at least one processor; wherein, The memory stores instructions that can be executed by the at least one processor, and the instructions are executed by the at least one processor to enable the at least one processor to perform the method according to any one of claims 1 to 8.

Citation Information

Patent Citations

  • Horse body ruler measurement method based on deep learning and image processing

    CN110782467A

  • Key point detection model training method and apparatus and virtual character driving method and apparatus

    WO2024060978A1