Horse body ruler portable measurement method and system based on single-view RGB-D camera

The portable measurement method of horse body measurements based on a single-view RGB-D camera solves the problem of automated measurement of horse body measurements, achieves efficient and accurate measurement, and reduces the risk of stress to horses.

CN119359782AActive Publication Date: 2025-01-24CHINA AGRI UNIV

Patent Information

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

AI Technical Summary

Technical Problem

It is difficult to realize the automated measurement of horse rulers in the prior art, especially in unsecured and simple environments, and traditional manual measurements have problems such as low efficiency, inaccurate results, and affecting animal welfare.

Method used

A portable measurement method based on a single-view RGB-D camera is used to obtain the target area through the segmentation model. The key point model confirms the key points of the target, calculates the starting measurement point, and determines attributes such as body height, body length, chest circumference, and tube circumference. Measuring points to achieve automated measurement of horse size.

Benefits of technology

It improves the efficiency and accuracy of horse body measurement, reduces manual intervention, reduces stress risks to horses, and achieves fast, accurate and non-contact measurement.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119359782A_ABST
    Figure CN119359782A_ABST
Patent Text Reader

Abstract

The invention relates to a horse body ruler portable measurement method and system based on a single-view RGB-D camera, and belongs to the technical field of computers, and the method comprises the steps: obtaining a target region based on a segmentation model, and judging whether the target region is in a view range or not; performing attitude confirmation on the target area based on key points output by the key point model; under the condition that the attitude of the target area is confirmed, calculating an initial measurement point according to the confirmed target key points of the preset number of frames; according to the initial measurement point and the contour edge, different attribute measurement points are determined, and the different attribute measurement points comprise a body height measurement point and a body length measurement point; determining a body height value according to the ground point and the body height measuring point of the relative target area, and determining a body length value according to the distance between the chest measuring point and the hip end measuring point on the two-dimensional plane; and estimating the chest circumference length and the tube circumference length according to the chest circumference measuring points and the tube circumference measuring points. According to the method, the automatic measurement of the horse size is realized, the measurement efficiency is improved, and the accuracy is ensured.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The 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 the related art, in modern animal husbandry, body size parameters are key phenotypic indicators that are indispensable in breeding selection. Accurate body size parameters can help evaluate genetic progress, prevent diseases, and improve production efficiency and economic benefits. Horse body size measurement technology plays a vital role in identifying horse breeds and improving horse quality, so it is very important to collect and record accurate body size parameters. The acquisition of horse body size parameters usually adopts manual measurement. Workers use tools such as measuring sticks and soft rulers to measure livestock body size parameters, but this measurement method has the following problems: 1) Low efficiency and long time. Usually, when manually measuring the body size of a horse, the horse needs to stand still (in most cases, it needs to be restrained by a restraining frame) before measurement can be carried out. Generally, 4-5 people are required. It takes at least 10-15 minutes to restrain a horse. For grazing or untrained horses, more manpower is required and it takes longer. 2) There are many factors affecting manual measurement, large deviations, and poor accuracy of results. For example: when using a soft ruler to measure chest circumference, it is not easy to keep the measured cross section perpendicular to the ground, resulting in a larger measured value. 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 measurement behavior can easily cause stress to horses, affect production and damage 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 the accuracy, but also greatly increases the safety risks of horses and measurement personnel, which can easily cause injuries to people and horses, and cause irreparable losses to stables and horse owners.

[0003] In recent years, a large number of strategies and equipment for automatic measurement of livestock body size have emerged using visual intelligence technology in artificial intelligence, and some applications have been made on pigs, cattle, and sheep. However, compared with other livestock, horses have their own particularities: high individual value, high welfare requirements, and at the same time, horses are sensitive, easily stressed, and their body shape and body size are very different from other livestock. The products currently on the market cannot meet the automatic measurement of horse body size. There are also a few horse body size measurement technologies that use three-dimensional visual recognition abroad, but they require three-dimensional reconstruction based on data from multi-view cameras, which is difficult to set up and requires a large investment. Moreover, untrained horses are more sensitive and difficult to control. The current three-dimensional visual measurement scheme is mainly aimed at docile livestock, and usually requires the use of a restraining fence to assist, and there is no appropriate conditional posture in horse measurement. With the increasing demand for precision breeding and refined feeding of horses, how to achieve automatic measurement of the body size of a variety of horses in a simple environment without restraint has become an urgent problem to be solved. Summary of the invention

[0004] In view of the above shortcomings of the prior art, the purpose of the invention is to provide a portable horse body size measurement method based on a single-view RGB-D camera. This method enables the horse to independently judge the standard measurement posture and complete the automatic measurement of body size when it is free to move, thereby improving the measurement efficiency and accuracy.

[0005] In a first aspect of the present invention, a portable measurement method for horse body size 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, in the case where it is determined that the target area is within the field of view, confirming a target key point among key points output by a key point model, and performing posture confirmation on the target area based on the target key point; S3, in the case where 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 point includes a plurality of points, and the starting measurement point includes a first starting measurement point and a second starting measurement point; S4, calculating a starting measurement point based on the starting measurement point and a side of a contour edge; S5, determining the body height value according to the ground point relative to the target area and the body height measurement point, and determining the body length value according to the distance between the front chest measurement point and the hip end measurement point on the two-dimensional plane; S6, obtaining the contour endpoints of the chest and the tube according to the chest circumference and tube circumference measurement points respectively, fitting the target smooth curve according to the point set between the endpoints; calculating the first length of the target smooth curve and the first height difference of 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; 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 measurement system for horse body size based on a single-view RGB-D camera is proposed, comprising: a first judgment module, used to obtain a target area based on a segmentation model, and to judge whether the target area is within a field of view; a posture confirmation module, used to confirm the target key points among the key points output by the key point model when judging that the target area is within the field of view, and to perform posture confirmation on the target area based on the target key points; a first calculation module, used to calculate a starting measurement point according to the target key points of a preset number of confirmed frames when performing posture confirmation on the target area, 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, used to calculate a starting measurement point according to the starting measurement point. a second determining module, for determining the body height value according to the ground point relative to the target area and the body height measuring point, and determining the body length value according to the distance between the front 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 according to the chest circumference and tube circumference measuring points respectively, fitting a target smooth curve according to the point set between the endpoints; calculating a first length of the target smooth curve and a first height difference of 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; taking the sum of the first length and twice the first height difference as the tube circumference length.

[0007] According to 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 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 measurement method and system for horse body size 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 a field of view; when it is determined that the target area is within the field of view, the target key points are 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 points; when the posture of the target area is confirmed, a starting measurement point is calculated based on the confirmed target key points of a preset number of 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; according to the starting measurement point and the contour edge side measurement points, the starting measurement point is confirmed. Different attribute measurement points are determined, wherein the different attribute measurement points include body height measurement points and body length measurement points, and the body length measurement points include front chest measurement points and hip end measurement points; the body height value is determined according to the ground point relative to the target area and the body height measurement point, and the body length value is determined according to the distance between the front chest measurement point and the hip end measurement point on the two-dimensional plane; the contour endpoints of the chest and the tube are obtained according to the chest circumference and tube circumference measurement points respectively, and the target smooth curve is fitted according to the point set between the endpoints; the first length of the target smooth curve and the first height difference of the endpoints of the target smooth curve are calculated; the sum of the first length and twice the first height difference is taken as the chest circumference length; the sum of the first length and twice the first height difference is taken as the tube circumference length. The method realizes the automatic measurement of horse size and improves the measurement efficiency and accuracy. BRIEF DESCRIPTION OF THE DRAWINGS

[0011] The accompanying drawings are only used to illustrate specific embodiments and are not considered to limit the present invention. In the entire drawings, the same reference symbols represent the same components. Obviously, the drawings described below are only some embodiments recorded in the embodiments of the present invention. For those of ordinary skill in the art, other drawings can also be obtained based on these drawings.

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

[0013] Figure 2 is a flow chart of a portable horse body size 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 is a structural block diagram of a portable horse body 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 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 in conjunction with the accompanying drawings. Obviously, the described embodiments are part of the embodiments of the present invention, rather than all of the embodiments. It should be understood that these descriptions are only 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 ordinary technicians in the field without making 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 clearly specified and limited, the orientation or position relationship indicated by the terms "center", "upper", "lower", "left", "right", "vertical", "horizontal", "inside", "outside", etc. is based on the orientation or position relationship shown in the drawings, which is only for the convenience of describing the present invention and simplifying the description, and does 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 a limitation of the present invention. In addition, the terms "first", "second", and "third" are only used for descriptive purposes 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 it can be indirectly connected through an intermediate medium, or it can be a connection between the 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 shown in the accompanying drawings. When the following description refers to the drawings, unless otherwise indicated, the same numbers in different drawings represent the same or similar elements. The embodiments described in the following exemplary embodiments do not represent all embodiments consistent with the present invention. Instead, they are merely examples of methods and systems consistent with some aspects of the present invention as detailed in the appended claims.

[0022] The present invention proposes a portable horse body size measurement method, system and related equipment based on a single-view RGB-D camera. Specifically, the portable horse body size 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 flow chart of a portable horse size measurement method based on a single-view RGB-D camera according to an embodiment of the present invention. It should be noted that the portable horse size measurement method based on a single-view RGB-D camera in the embodiment of the present invention can be applied to a portable horse size measurement system based on a single-view RGB-D camera in the embodiment of the present invention. The portable horse size measurement system based on a single-view RGB-D camera can be configured on an electronic device or in a server. This embodiment of the present application is not limited to this.

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

[0025] S110, acquiring a target area based on the segmentation model, and determining whether the target area is within a 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 the segmentation model to obtain the target region. For example, the RGB image and the Depth image of the horse image can be input into the segmentation model to obtain the target region, for example, the target region is the horse.

[0027] In the 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 the target key points among the key points output by the key point model, and confirming the posture of 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 horses.

[0031] The target key points can be understood as valuable points in 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, the implementation method of confirming the posture of the target area based on the target key points is: determine that less than or equal to two key points in 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 tilt 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 two legs of the target forelimb is greater than a preset threshold based on the third angle between the third distance vector and the fourth distance vector in the target area in the three-dimensional space. For specific implementation methods, please refer to the subsequent embodiments.

[0033] S130, when confirming the posture of the target area, calculating the starting measurement point according to the confirmed target key points of a preset number of frames, wherein the target key points include a plurality of them, and the starting measurement point includes 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 average coordinates of the first key point and the second key point are used as coordinates of a first starting measurement point.

[0035] In an embodiment of the present invention, the fourth key point and the fifth key point of the hind leg region in the target key point are obtained; the average of the coordinates of the fourth key point and the fifth key point is used as the coordinate of the second starting measurement point. The specific implementation method can be referred to the subsequent embodiments.

[0036] S140, determining different attribute measurement points according to 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 point includes a front chest measurement point and a hip end measurement point.

[0037] In the embodiment of the present invention, when the starting measurement point is obtained, the starting measurement point can be searched in the direction based on the preset angle to determine the contour edge side measurement point, and then the body height measurement point and the body length measurement point can be determined based on the contour edge side measurement point along the direction of the starting measurement point. The specific implementation method can refer to the subsequent embodiments.

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

[0039] In the embodiment of the present invention, 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; 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; the distance between the first three-dimensional coordinates and the second three-dimensional coordinates projected onto the two-dimensional plane is used as the body length value. For specific implementation methods, please refer to the subsequent embodiments.

[0040] S160, respectively obtaining the contour endpoints of the chest and the tube according to the chest circumference and the tube circumference measurement points, and fitting a target smooth curve according to the point set between the endpoints; calculating a first length of the target smooth curve and a first height difference of 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; taking the sum of the first length and twice the first height difference as the tube circumference length.

[0041] According to the portable measurement method for horse body size based on a single-view RGB-D camera of an embodiment of the present invention, a target area is acquired based on a segmentation model, and it is determined 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 among 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 confirmed target key points of a preset number of 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; according to the starting measurement point and the contour edge side measurement points, a starting measurement point is determined. Different attribute measurement points are determined, wherein the different attribute measurement points include body height measurement points and body length measurement points, and the body length measurement points include front chest measurement points and hip end measurement points; the body height value is determined according to the ground point relative to the target area and the body height measurement point, and the body length value is determined according to the distance between the front chest measurement point and the hip end measurement point on the two-dimensional plane; the contour endpoints of the chest and the tube are obtained according to the chest circumference and tube circumference measurement points respectively, and the target smooth curve is fitted according to the point set between the endpoints; the first length of the target smooth curve and the first height difference of the endpoints of the target smooth curve are calculated; the sum of the first length and twice the first height difference is taken as the chest circumference length; the sum of the first length and twice the first height difference is taken as the tube circumference length. The method realizes the automatic measurement of horse size and improves the 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, the portable horse body size measurement method based on a single-view RGB-D camera includes:

[0043] S210, acquiring a target area based on the segmentation model, and determining whether the target area is within a 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 the segmentation model to obtain the target area.

[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 the consistency of 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 select and build the segmentation model: Model selection: Select a suitable segmentation model according to application requirements. For the segmentation task of RGB and Depth image fusion, 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 and 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 feature layer), late fusion (fusion at decision layer) and intermediate fusion (fusion at 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 the information of the two modalities. Model optimization: In order to further improve model performance, a multi-task learning framework can be considered to simultaneously learn depth estimation and semantic segmentation tasks. This approach can alleviate the impact of depth data noise to a certain extent and promote the model to learn more discriminative feature representations; (3) Then perform training strategies and tuning: 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, RMSprop, etc. For models with multimodal inputs, an optimizer with adaptive learning rate adjustment can better handle gradient changes in different modalities. Hyperparameter adjustment: The setting of hyperparameters (such as learning rate, batch size, number of iterations, etc.) has a significant impact on model performance. The optimal hyperparameter combination can be found through grid search, random search, or Bayesian optimization methods.(4) Finally, the model is experimentally verified and applied: Performance evaluation: Use standard evaluation indicators (such as mIoU, Precision-Recall curve, etc.) to evaluate the model. By comparing the performance of different models and different fusion strategies, the effectiveness of the proposed method can be verified. Practical application test: Deploy the trained model to the actual application scenario. Feedback iteration: Further optimize the model and training strategy based on feedback from actual applications. For example, collect more challenging samples for difficult sample training to improve the robustness of the model.

[0046] In summary, effectively fusing RGB and Depth images and inputting them into the segmentation model is an effective way to achieve high-accuracy target area segmentation. Through reasonable data preprocessing, carefully selected segmentation models, effective training strategies, and experimental verification, accurate target segmentation can be achieved in various application scenarios.

[0047] In the 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 step S120 described above, and the present invention will not elaborate on this any more.

[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 contour and key points are optimized, and the output deduction results include key points, key point confidence, and contour. 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 area 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 computing efficiency.

[0051] S230: confirming 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 xy plane in three-dimensional space, it is judged whether the angle between the target forelimbs 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, which are 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 left forelimb of the horse. 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 to the xy plane is less than 15°.

[0056] In an embodiment of the present invention, the confidence of the key points, the depth relationship between the camera and the horse, and the vector angle between the two sets of key points are used to determine whether the standard posture requirements are met, until 3 consecutive frames that meet the requirements are found, and the next 10 frames of data are saved in the hard disk from here, and only the 10 frames of data are saved in the memory. Example: a. Design a function that maintains a sliding window with a window size of at least 3 frames of input data. Whenever the input data of a new frame arrives and is processed, update the window and analyze the new window data. Only when all frames in the window meet the standard for posture confirmation, the hard disk and memory save these 3 frames and the subsequent 7 frames, a total of 10 frames of depth and color data. b. Before confirmation, cache data in memory instead of writing it directly to the hard disk, and write it in batches once confirmed; use numpy arrays to store frame data. c. Use np.diff() to calculate the depth value difference between each two consecutive key points, use np.max() to obtain the maximum difference value in each frame, and filter frames with fluctuations 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 a preset number of confirmed frames, wherein the target key points include a plurality of points, and the starting measurement point includes 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; 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. 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 key point and the fifth key point of the hind leg region in the target key point are obtained; the average of the coordinates of the fourth key point and the fifth key point is used as the coordinate 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 according to 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 used to search for contour intersections along the two angles (325° and 345°); when the horse enters from the right to the left, point P1 is used to search 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 three-dimensional coordinate point at the edge, that is, Figure 3 H1 in the figure is used as the body height measurement point.

[0063] S260: Determine a body length measurement point according to 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 front 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 the second intersection of the first starting measurement point and the boundary contour, and an average value of the preset number of second intersection coordinates is used as the contour edge side measurement point; starting from the 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 the third intersection of the second starting measurement point and the boundary contour, and an average value of the preset number of third intersection coordinates is used as the contour edge side measurement point; starting from the 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; 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 used to search for contour intersections along two angles (30° and 75°); when the horse enters from right to left, the first starting measurement point P1 is used to search for contour intersections along two angles (225° and 245°), and the average value is taken as the contour edge side measurement point, and then the outer contour edge side measurement point is searched from the outer contour edge side measurement point to 20 pixels on the P1 vector inward (in the opposite direction of the vector) to obtain the most edge effective 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 measurement 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 measurement 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 20 pixels on the P1 vector inward (in the opposite direction of the vector), the effective depth value point at the edge is obtained. Figure 3 L2 in the figure is used as the hip end measurement point.

[0068] In one embodiment of the present invention, a first starting measurement point is searched for direction based on a fourth preset angle to determine a first target intersection of the first starting measurement point and the boundary contour, and the first target intersection is used as a vertical line to determine a second target intersection of the vertical line and the boundary contour; an average value of the first target intersection and the second target intersection is used as a chest circumference measurement point; and 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 according to 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 the horse enters from the left to the right, the contour intersection point is searched along 320 degrees, i.e., one angle, from the first starting measurement point P1. After the intersection point is determined, another intersection point is determined in the vertical downward direction of 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; when the horse enters from the right to the left, the contour intersection point is searched along 40°, that is, an angle, from the first starting measurement point P1. After the intersection point is determined, another intersection point is determined in the vertical downward direction of 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 in the figure, 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 perimeter measurement point, that is, Figure 3 T1 in the figure is used as the pipe circumference measuring point.

[0071] S270, determining the body height value according to 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, ground height calculation: Figure 3 As shown, based on the center point of the quadrilateral with the left_front_leg_2, right_front_leg_2, left_back_leg_2, and right_back_leg_2 limb joints as endpoints, a rectangle with a length of 160 and a width of 90 is taken out, and the height of all points is calculated using the internal parameters and depth data, and the extreme values ​​are filtered out, and the average value is taken as the ground height Dy (only calculated once in 10 frames). Secondly, the height value Hy of the H1 measuring point is calculated, and the body height = Hy-Dy.

[0074] S280, determining a body length value according to a distance between a front chest measuring point and a hip end measuring point on a two-dimensional plane.

[0075] In an embodiment of the present invention, when the front chest measuring point and the hip end measuring point are determined, the first three-dimensional coordinates of the front chest measuring point and the second three-dimensional coordinates of the hip end measuring 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 taken as the body length value.

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

[0077] In one embodiment of the present invention, when the chest circumference measuring point and the tube circumference measuring point are determined, a target smooth curve is fitted according to the endpoints of the horse's contour; a first length of the target smooth curve and a first height difference of the endpoints of the target smooth curve are calculated (the height difference is considered to be half of the horse's chest circumference or the blind spot of the tube circumference contour); twice the sum of the first length and the first height difference is taken as the chest circumference length; and the sum of the first length and twice the first height difference is taken as the tube circumference length.

[0078] For example, based on the upper and lower endpoints of the horse's outline obtained by chest circumference measurement, all coordinates on the connecting line and their corresponding depth values ​​are taken out, all of which are converted into three-dimensional coordinates, and the possible extreme values ​​(outward expansion of the outline) at both ends are filtered out. These points are projected onto the YZ plane, and a smooth curve is fitted. The length of the curve and the height difference of the endpoints of the fitted curve are calculated, and the curve length plus twice the height difference is regarded as 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 regarded 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 in 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 of docile horses is 180 seconds per horse, and the average measurement speed of 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 auxiliary 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 manually 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 small errors in various indicators, especially the average absolute errors of body height and body length are 2.57 cm and 3.26 cm, 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 to the non-contact shooting method of "manually selecting 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. Figure 6 As shown in the figure, in the scenario of demarcating a simple measurement site, a computing device with a computing power of 20TOPS can be equipped with the computing program described in the present invention, and the average absolute error of chest circumference and tube circumference can be controlled at 2.19% and 7.51% in single-view calculation. Under the condition of meeting the same error requirements, compared with the multi-camera fusion and calculation method, the present invention reduces the camera cost by 75%, reduces the computing power requirement of the computing device by 50%, and greatly improves the practicality and convenience.

[0081]

[0082] Table 1

[0083] According to the portable horse body measurement method based on a single-view RGB-D camera according to an embodiment of the present invention, by combining the segmentation model of the RGB image and the Depth image, it is possible to accurately capture the details of the target area and improve the accuracy of the segmentation. The key point model is used to further accurately locate the feature points to ensure the accuracy of the measurement data; the entire process from data acquisition, preprocessing, segmentation, feature point recognition to size measurement can be completed automatically, greatly improving efficiency and reducing the need for manual intervention; this technical solution is not only suitable for the size measurement 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 the measurement errors caused by human factors, improves the objectivity and repeatability of the measurement; and realizes fast, accurate and non-contact measurement of the size of the target object.

[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 a necessary general hardware platform, and of course by hardware, but in many cases the former is a better implementation method. Based on such an 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 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 an embodiment 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 body 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 used to obtain a target area based on a segmentation model and judge whether the target area is within a field of view;

[0087] A posture confirmation module 420 is used to confirm the target key points among the key points output by the key point model when it is determined that the target area is within the field of view, and to perform posture confirmation on the target area based on the target key points;

[0088] A first calculation module 430 is used to calculate a starting measurement point according to 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 points, and the starting measurement point includes a first starting measurement point and a second starting measurement point;

[0089] A first determination module 440 is used to determine different attribute measurement points according to 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 point includes a front chest measurement point and a hip end measurement point;

[0090] A second determination module 450 is used to determine a body height value according to a ground point relative to the target area and the body height measurement point, and to determine a body length value according to a distance between the front chest measurement point and the hip end measurement point on a two-dimensional plane;

[0091] The second calculation module 460 is used to obtain the contour endpoints of the chest and the tube according to 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; 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.

[0092] According to the portable horse body ruler measurement system based on a single-view RGB-D camera of an embodiment of the present invention, a target area is acquired based on a segmentation model, and it is determined 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 among 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 confirmed target key points of a preset number of 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; according to the starting measurement point and the contour edge side measurement points, a starting measurement point is determined. Different attribute measurement points are determined, wherein the different attribute measurement points include body height measurement points and body length measurement points, and the body length measurement points include front chest measurement points and hip end measurement points; the body height value is determined according to the ground point relative to the target area and the body height measurement point, and the body length value is determined according to the distance between the front chest measurement point and the hip end measurement point on the two-dimensional plane; the contour endpoints of the chest and the tube are obtained according to the chest circumference and tube circumference measurement points respectively, and the target smooth curve is fitted according to the point set between the endpoints; the first length of the target smooth curve and the first height difference of the endpoints of the target smooth curve are calculated; the sum of the first length and twice the first height difference is taken as the chest circumference length; the sum of the first length and twice the first height difference is taken as the tube circumference length. In this way, the automatic measurement of the horse size is realized, and the measurement efficiency and accuracy are improved.

[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 according to 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 of 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 is within a preset range according to 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; determine whether the angle between the target forelimbs is greater than a preset threshold according to a third angle between a third distance vector in the target area and a fourth distance vector in the three-dimensional space.

[0094] Optionally, the first calculation module 430 is specifically used to obtain a first key point and a second key point in the front leg area 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 coordinate points 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 used to perform a direction search for the first starting measurement point based on a first preset angle, determine the coordinates of the first intersection of 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 the 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 the edge three-dimensional coordinate point, and use the edge three-dimensional 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 an average value of a preset number of the coordinates of the second intersection 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 front chest measurement point; perform a direction search based on a third preset angle on the second starting measurement point to determine the coordinates of a third intersection between the second starting measurement point and the boundary contour, and use an average value of a preset number of the coordinates of the third intersection 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 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; determine the body length measurement point according to 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 the first starting measurement point is directionally searched based on a fourth preset angle to determine a first target intersection point between the first starting measurement point and a boundary contour, and the first target intersection point is used as a vertical line to determine a second target intersection point between the vertical line and the boundary contour; an average value of the first target intersection point and the second target intersection point is used as the chest circumference measurement point; and 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 according to 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 value 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 front chest measurement point and the second three-dimensional coordinates of the hip end 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 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) processor 102 (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 also include a transmission device 106 and an input / output device 108 for communication functions. It can be understood by those skilled in the art that Figure 5 The structure shown is for illustration only and does not limit the structure of the above terminal device. Figure 5 More or fewer components as shown, or with Figure 5 Equivalent functions or comparisons shown Figure 5 A different configuration with more features is shown.

[0102] The memory 104 can be used to store computer programs, for example, software programs and modules of application software, such as the computer program corresponding to the portable measurement method for horse body size based on a single-view RGB-D camera in the embodiment of the present invention. The processor 102 executes various functional applications and data processing by running the computer program stored in the memory 104, that is, to implement the above method. The memory 104 may include a high-speed random access memory, and may also include a non-volatile memory, such as one or more magnetic storage devices, flash memory, or other non-volatile solid-state memory. In some instances, the memory 104 may further include a memory remotely arranged relative to the processor 102, and these remote memories may be connected to the terminal device via a network. Examples of the above-mentioned network include, but are not limited to, the Internet, an intranet, a local area network, a mobile communication network, and combinations thereof.

[0103] The transmission device 106 is used to receive or send data via a network. The specific example of the above network may include a wireless network provided by a communication provider of the switching device. In one example, the transmission device 106 includes a network adapter (Network Interface Controller, referred to as NIC), which can be connected to other network devices through a base station so as to communicate with the Internet. In one example, the transmission device 106 can 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, wherein 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 schemes of the present invention, and the detailed description is only to help readers better understand the spirit of the present invention, but not to limit 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, each functional unit in each embodiment of the present invention may be integrated into a processing module, or each unit may exist physically separately, or two or more units may be integrated into one module. The above-mentioned integrated module may be implemented in the form of hardware or in the form of a software functional module. If the integrated module is implemented in the form of a software functional module and sold or used as an independent product, it 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 can be understood that the above embodiments are exemplary and cannot be understood as limiting the present invention. A person of ordinary skill in the art may change, modify, replace and modify the above embodiments within the scope of the present invention.

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

Claims

1. A portable horse body measurement method based on a single-view RGB-D camera, characterized in that: include: S1, acquiring 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 the target key points among 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 according to the target key points of a preset number of confirmed frames, wherein the target key points include a plurality of points, and the starting measurement point includes a first starting measurement point and a second starting measurement point; S4, determining different attribute measurement points according to 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 point includes a front chest measurement point and a hip end measurement point; S5, determining a body height value according to a ground point relative to the target area and the body height measuring point, and determining a body length value according to a distance between the front chest measuring point and the hip end measuring point on a two-dimensional plane; S6, respectively obtaining the contour endpoints of the chest and the tube according to the chest circumference and the tube circumference measurement points, and fitting a target smooth curve according to the point set 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; taking the sum of the first length and twice the first height difference as the tube circumference length.

2. The portable horse body 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 the 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: According to whether the detection frame of the target horse is within 95% of the center of the field of view, it is judged whether the target area is completely within 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 of the target key points are occluded; Determining that the depth difference between the target key points is less than a preset difference value; Determining whether the target inclination is within a preset range according to a first angle between a first distance vector in the target area and an xy plane in the three-dimensional space and a second angle between a second distance vector and the xy plane in the 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 body 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: Acquire 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 body measurement method based on a single-view RGB-D camera according to claim 3 is characterized in that: Also includes: Obtain 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 body measurement method based on a single-view RGB-D camera according to claim 1, characterized in that: According to the starting measurement point and the contour edge side measurement point, 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 the position of a preset number of pixel values ​​outside the contour edge side measuring point, and searching along the direction from the contour edge side measuring point to the first starting measuring point, the edge three-dimensional coordinate point is obtained, and the edge three-dimensional coordinate point is used as the body height measuring point.

6. The portable horse body 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 coordinates of the second intersection points as the contour edge side measurement point; Starting from the position of a preset number of pixel values ​​outside the contour edge side measuring point, searching along the direction from the contour edge side measuring point to the first starting measuring point, obtaining edge three-dimensional coordinate points, and using the edge three-dimensional coordinate points as the front chest measuring points; 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 direction from the contour edge side measuring point to the second starting measuring point, obtaining edge three-dimensional coordinate points, and using the edge three-dimensional coordinate points as the hip end measuring points; The body length measurement point is determined according to the front chest measurement point and the hip end measurement point.

7. The portable horse body 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 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 taking the first target intersection point as a vertical line to determine a second target intersection point between the vertical line and the boundary contour; taking the average value of the first target intersection point and the second target intersection point as the chest circumference 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 to 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 body measurement method based on a single-view RGB-D camera according to claim 1, characterized in that: Determining a body height value according to a ground point relative to the target area and the body height measuring point, and determining a body length value according to a distance between the front chest measuring point and the hip end measuring point on a two-dimensional plane, including: Determine the Y values ​​of the plurality of ground points, and take the average value 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 measuring point is taken as the body height value; Determine the first three-dimensional coordinates of the front chest measurement point and the second three-dimensional coordinates of the hip end 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 in that: include: A first judgment module is used to obtain a target area based on a segmentation model and judge whether the target area is within a field of view; A posture confirmation module, used for confirming the target key points among the key points output by the key point model when it is determined that the target area is within the field of view, and performing posture confirmation on the target area based on the target key points; A first calculation module is used to calculate a starting measurement point according to 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 point includes a first starting measurement point and a second starting measurement point; A first determination module is used to determine different attribute measurement points according to 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 point includes a front chest measurement point and a hip end measurement point; A second determination module is used to determine the body height value according to the ground point relative to the target area and the body height measurement point, and to determine the body length value according to the distance between the front chest measurement point and the hip end measurement point on the two-dimensional plane; The second calculation module is used to obtain the contour endpoints of the chest and the tube according to 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; 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.

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

Cited By

  • Portable equine body dimension measurement method and system based on single-view RGB-d camera

    WO2026061547A1