Portable equine body dimension measurement method and system based on single-view RGB-d camera
By using segmentation and key point modeling based on a single-view RGB-D camera, automated measurement of horse body size was achieved, solving the problems of low efficiency and poor accuracy in existing technologies and improving measurement efficiency and safety.
Patent Information
- Authority / Receiving Office
- WO · WO
- Patent Type
- Applications
- Current Assignee / Owner
- Filing Date
- 2025-10-10
- Publication Date
- 2026-03-26
AI Technical Summary
In existing technologies, horse body size measurement is inefficient and inaccurate, and manual measurement poses significant safety risks to both the horses and the personnel involved, making it difficult to automate the measurement of various types of horses in unrestrained or simple environments.
A portable measurement method based on a single-view RGB-D camera is adopted. The target area is obtained by segmentation model, it is determined whether it is within the field of view, and the key points of the target are confirmed based on the key point model. The starting measurement point is calculated, and the measurement points of attributes such as height, length, chest circumference and tube circumference are determined to achieve automated measurement.
It improves the efficiency and accuracy of horse body measurement, reduces safety risks to horses and measurement personnel, and enables autonomous measurement under free movement conditions.
Smart Images

Figure CN2025126632_26032026_PF_FP_ABST
Abstract
Description
Horse body size portable measurement method and system based on single-view RGB-D camera TECHNICAL FIELD
[0001] The present application belongs to the technical field of computer, and particularly relates to a horse body size automatic measurement method and system. BACKGROUND
[0002] In related art, in modern livestock breeding industry, body size parameters are indispensable key phenotype indexes in breeding selection, and accurate body size parameters can help evaluate genetic progress, prevent diseases, improve production efficiency and economic benefits. The horse body size measurement technology plays a crucial role in identifying the breed of horses and improving the process of 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, and workers use measuring rods and soft rulers to measure livestock body size parameters, but this measurement method has the following problems: 1) low efficiency and long time. Usually, it takes 4-5 people to measure the body size of a horse, and it takes at least 10-15 minutes to fix a horse, and for grazing or untrained horses, more manpower and longer time are required; 2) manual measurement has many influencing factors, large deviation and poor accuracy. For example, when using a soft ruler to measure the chest circumference, it is not easy to keep the measurement cross section and the ground perpendicular, resulting in an overestimation of the measurement value; 3) the measurement result is not objective, and the comparability between different measurement data is poor. The manual measurement result depends on the professional level of the measurer. Different measurement habits of different measurers have large errors, and the results are not comparable; 4) the measurement behavior easily causes stress of the horse, affects production and animal welfare, and the measurer is also easy to be injured. Horses are more sensitive than other livestock, and are easily stimulated. The uncontrollability of horse behavior in manual measurement greatly increases the risk of injury to the horse and the measurer, and causes irreparable loss to the horse farm and the horse owner.
[0003] In recent years, with the use of visual intelligence technology in artificial intelligence, a large number of strategies and devices for automatic measurement of livestock body size have emerged, and some applications have been made on pigs, cattle and sheep. However, compared with other livestock, horses have their own particularity: high single value, high welfare requirement, sensitive and easy to stress, large difference in body size and other livestock, and the current market products cannot meet the automatic measurement of horse body size. There are a few horse body size measurement technologies using three-dimensional visual recognition abroad, but they need to reconstruct three-dimensional based on multi-view camera data, which is difficult to set up and requires high investment. Moreover, untrained horses are sensitive and difficult to control, and the current three-dimensional visual measurement scheme is mainly aimed at docile livestock, which usually needs to use a restraint pen for assistance, and there is no appropriate conditional posture in horse measurement. With the increasing demand for precise horse breeding and fine feeding, how to realize the automatic measurement of the body size of various horses in a non-restraint and simple environment has become a problem to be solved. SUMMARY
[0004] In view of the deficiencies of the prior art, the purpose of the application is to provide a horse body size portable measurement method based on a single-view RGB-D camera, which realizes the functions of automatically judging the standard measurement posture and completing the automatic measurement of the body size of the horse in the case of free activity, and improves the measurement efficiency and accuracy.
[0005] The first aspect of the application provides a horse body size portable measurement method based on a single-view RGB-D camera, comprising: S1, obtaining a target region based on a segmentation model, and judging whether the target region is within a field of view range; S2, in the case that the target region is within the field of view range, confirming a target key point in the key points output by a key point model, and confirming the posture of the target region based on the target key point; S3, in the case of confirming the posture of the target region, calculating a starting measurement point according to the target key points of a preset number of frames confirmed, wherein the target key points include a plurality of target key 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 point, wherein the different attribute measurement points include a body height measurement point, a body length measurement point, 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 the ground point relative to the target region and the body height measurement point, and determining a body length value according to the distance of the front chest measurement point and the hip end measurement point on a two-dimensional plane; S6, obtaining the contour endpoints of the chest and the pipe according to the chest circumference and the pipe circumference measurement 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 pipe circumference length.
[0006] Further, the target region is obtained based on the segmentation model, including: inputting the RGB image and the Depth image of the target image into the segmentation model to obtain the target region; wherein, determining whether the target region is within the field of view range includes: determining whether the target region is completely within the field of view range according to whether the detection box of the target horse is within 95% of the center of the field of view; the target key point includes 11 key points, wherein, the posture of the target region is confirmed based on the target key point, including: determining that less than or equal to two key points in the target key point are occluded; determining that the depth difference between the target key points is less than a preset difference value; determining whether the target inclination degree is within a preset range according to a first angle between a first distance vector and an xy plane in a three-dimensional space and a second angle between a second distance vector and the xy plane in the three-dimensional space; determining whether the target forelimb two-leg angle is greater than a preset threshold according to a third angle between a third distance vector and a fourth distance vector in the xy plane in the three-dimensional space.
[0007] Further, the starting measurement point is calculated according to the target key point of the confirmed preset number of frames, including: obtaining a first key point and a second key point of a foreleg region in the target key point; and taking average coordinates of the first key point and the second key point as coordinates of the first starting measurement point.
[0008] Further, it also includes: obtaining a fourth key point and a fifth key point of a hind leg region in the target key point; and taking an average of coordinate points of the fourth key point and the fifth key point as coordinates of the second starting measurement point.
[0009] Further, different attribute measurement points are determined according to the starting measurement point and the contour edge side measurement point, including: directionally searching the first starting measurement point based on a first preset angle to determine a first intersection coordinate of the first starting measurement point and a boundary contour, and taking an average 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 measurement point, and searching in a direction from the contour edge side measurement point to the first starting measurement point to obtain an edge three-dimensional coordinate point, and taking the edge three-dimensional coordinate point as the body height measurement point.
[0010] Further, the method further comprises: searching for the first starting measurement point based on a second preset angle, determining a second intersection point coordinate of the first starting measurement point and the boundary contour, and taking an average value of a preset number of the second intersection point coordinates as the profile edge side measurement point; searching from a position of a preset number of pixel values outside the profile edge side measurement point and along a direction from the profile edge side measurement point to the first starting measurement point, obtaining an edge three-dimensional coordinate point, and taking the edge three-dimensional coordinate point as the prothorax measurement point; searching for the second starting measurement point based on a third preset angle, determining a third intersection point coordinate of the second starting measurement point and the boundary contour, and taking an average value of a preset number of the third intersection point coordinates as the profile edge side measurement point; searching from a position of a preset number of pixel values outside the profile edge side measurement point and along a direction from the profile edge side measurement point to the second starting measurement point, obtaining an edge three-dimensional coordinate point, and taking the edge three-dimensional coordinate point as the end of the abdomen measurement point; and determining the body length measurement point according to the prothorax measurement point and the end of the abdomen measurement point.
[0011] Further, the different attribute measurement points further comprise a chest circumference measurement point and a girth measurement point, wherein the first starting measurement point is searched based on a fourth preset angle, a first target intersection point of the first starting measurement point and the boundary contour is determined, a second target intersection point of a perpendicular line of the first target intersection point and the boundary contour is determined, an average value of the first target intersection point and the second target intersection point is taken as the chest circumference measurement point, a horizontal line is drawn from the seventh key point as a starting point based on a vector direction of the sixth key point and the seventh key point, and an X value difference between two points is determined; a girth measurement position is determined according to the vector direction and the X value difference, and the girth measurement point is determined based on the girth measurement position.
[0012] Further, the body height value is determined according to the ground points and the body height measurement point relative to the target region, and the body length value is determined according to a distance of the prothorax measurement point and the end of the abdomen measurement point on a two-dimensional plane, comprising: determining Y values of a plurality of the ground points, and taking an average value of the Y values of the plurality of the ground points as a ground height value; taking a difference value between the ground height value and a Y value of the body height measurement point as the body height value; determining a first three-dimensional coordinate of the prothorax measurement point and a second three-dimensional coordinate of the end of the abdomen measurement point; and taking a distance of the first three-dimensional coordinate and the second three-dimensional coordinate projected to the two-dimensional plane as the body length value.
[0013] In a second aspect, the present application provides a horse body size portable measurement system based on a single-view RGB-D camera, comprising: a first judging module configured to obtain a target region based on a segmentation model and judge whether the target region is within a field of view; a posture confirming module configured to, in a case where it is judged that the target region is within the field of view, confirm a target key point from key points output by a key point model and confirm a posture of the target region based on the target key point; a first calculating module configured to, in a case where the posture of the target region is confirmed, calculate a starting measurement point according to the target key points of a preset number of frames that are confirmed, wherein the target key points comprise a plurality of target key points, and the starting measurement point comprises a first starting measurement point and a second starting measurement point; a first determining module configured to determine different attribute measurement points according to the starting measurement point and a contour edge side measurement point, wherein the different attribute measurement points comprise a body height measurement point and a body length measurement point, and the body length measurement point comprises a front chest measurement point and a hip end measurement point; a second determining module configured to determine a body height value according to a ground point relative to the target region and the body height measurement point, and determine a body length value according to a distance of the front chest measurement point and the hip end measurement point on a two-dimensional plane; a second calculating module configured to obtain contour endpoints of a chest and a tube according to chest circumference and tube circumference measurement points respectively, fit a target smooth curve according to a point set between the endpoints, calculate a first length of the target smooth curve and a first height difference of the endpoints of the target smooth curve, take a sum of the first length and twice the first height difference as a chest circumference length, and take a sum of the first length and twice the first height difference as a tube circumference length.
[0014] In a third aspect, the present application provides an electronic device, comprising: at least one processor; and a memory communicatively connected with 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 to enable the at least one processor to perform the method in any one of the first aspect.
[0015] In a fourth aspect, the present application provides a non-transitory computer readable storage medium storing computer instructions, wherein the computer instructions are used to enable the computer to perform the method in any one of the first aspect.
[0016] The present application has the following advantages:
[0017] The horse body size portable measurement method and system based on a single-view RGB-D camera according to the present application, based on a segmentation model, a target region is obtained, and it is judged whether the target region is within the field of view range; in the case that the target region is within the field of view range, the target key points are confirmed among the key points output by the key point model, and the posture of the target region is confirmed based on the target key points; in the case that the posture of the target region is confirmed, the starting measurement points are calculated according to the target key points of the confirmed preset number of frames, 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; different attribute measurement points are determined according to the starting measurement points and the contour edge side measurement points, wherein the different attribute measurement points include a body height measurement point, a body length measurement point, the body length measurement point includes a front chest measurement point and a hip end measurement point; the body height value is determined according to the ground point and the body height measurement point relative to the target region, and the body length value is determined according to the distance between the front chest measurement point and the hip end measurement point in the two-dimensional plane; the contour endpoints of the chest and the tube are obtained according to the chest circumference and the 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 is calculated, and the first height difference of the endpoints of the target smooth curve is 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 the horse size, and improves the measurement efficiency and accuracy. BRIEF DESCRIPTION OF DRAWINGS
[0018] The accompanying drawings are included to provide a further understanding of the application and are incorporated in and constitute a part of this specification, illustrate embodiments of the application and together with the description serve to explain the principles of the application. In the drawings:
[0019] Fig. 1 is a flowchart of a horse body size portable measurement method based on a single-view RGB-D camera according to an embodiment of the present application;
[0020] Fig. 2 is a flowchart of a horse body size portable measurement method based on a single-view RGB-D camera according to an embodiment of the present application;
[0021] Fig. 3 is a schematic diagram of determining target key points according to an embodiment of the present application;
[0022] Fig. 4 is a structural block diagram of a horse body size portable measurement system based on a single-view RGB-D camera according to an embodiment of the present application;
[0023] Fig. 5 is a structural block diagram of an electronic device according to an embodiment of the present application;
[0024] Fig. 6 is a schematic diagram of a field measurement scene according to an embodiment of the present application. DETAILED DESCRIPTION
[0025] In order to better understand the technical solutions in the embodiments of the present application, the technical solutions of the present application will be clearly and completely described below with reference to the drawings. Obviously, the described embodiments are only a part of the embodiments of the present application, rather than all the embodiments of the present application. It should be understood that these descriptions are only exemplary, and are not intended to limit the scope of the present application. Based on the embodiments of the present application, all other embodiments obtained by those of ordinary skill in the art without creative labor should fall within the scope of protection of the present application.
[0026] In addition, in the following description, the description of well-known structures and techniques is omitted to avoid unnecessary confusion of the concepts disclosed in the present application.
[0027] In the description of the present application, it should be noted that, unless otherwise explicitly specified and limited, the orientation or positional relationship indicated by the terms "center", "upper", "lower", "left", "right", "vertical", "horizontal", "inner", "outer" and the like is based on the orientation or positional relationship shown in the drawings, and is only for the convenience of describing the present application and simplifying the description, and therefore cannot be understood as indicating or implying that the device or element referred to must have a particular orientation, be constructed and operated in a particular orientation, and therefore cannot be understood as limiting the present application. In addition, the terms "first", "second", "third" are only for description purposes and cannot be understood as indicating or implying relative importance. The terms "mounting", "connecting", "connecting" should be broadly understood, for example, it can be fixedly connected, or it can be detachably connected, or integrally connected; it can be mechanically connected, or it can be electrically connected; it can be directly connected, or it can be indirectly connected through an intermediate medium, or it can be the communication between two elements. For those of ordinary skill in the art, the specific meaning of the above terms in the present application can be understood according to the specific circumstances.
[0028] The exemplary embodiments will be described in detail below with reference to the accompanying drawings. When the following description refers to the drawings, the same numbers in different drawings represent the same or similar elements unless otherwise indicated. The implementations described in the following exemplary embodiments are not intended to represent all implementations consistent with the present application. Rather, they are merely examples of methods and systems consistent with some aspects of the present application as detailed in the appended claims.
[0029] The present application proposes a single-view RGB-D camera-based portable measurement method and system for horse body length, and related equipment. Specifically, the single-view RGB-D camera-based portable measurement method and system for horse body length of the embodiments of the present application are described below with reference to the accompanying drawings.
[0030] FIG. 1 is a flowchart of a single-view RGB-D camera-based portable horse body measurement method according to an embodiment of the present application. It should be noted that the single-view RGB-D camera-based portable horse body measurement method according to an embodiment of the present application can be applied to a single-view RGB-D camera-based portable horse body measurement system according to an embodiment of the present application. The single-view RGB-D camera-based portable horse body measurement system can be configured on an electronic device or in a server. The present application does not limit this.
[0031] As shown in FIG. 1, the single-view RGB-D camera-based portable horse body measurement method includes the following steps.
[0032] S110, obtaining a target region based on a segmentation model and determining whether the target region is within a field of view.
[0033] In an embodiment of the present application, 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 a horse.
[0034] In an embodiment of the present application, whether the target region is completely within the field of view is determined according to whether the detection frame of the target region is within a position within 95% of the field of view.
[0035] S120, in the case where it is determined that the target region is within the field of view, confirming a target key point from key points output by a key point model and confirming a posture of the target region based on the target key point.
[0036] In an embodiment of the present application, in the case where it is determined that the target region is within the field of view, all key points in the target region, i.e., all key points of the horse, can be obtained based on the key point model, and then a target feature point is determined from all the key points based on the key point model, and then the target key point is confirmed from the target feature point.
[0037] The target feature point can be understood as a point position representing a feature of the horse.
[0038] The target key point can be understood as a valuable point in the target feature point, for example, the target key point includes but is not limited to an eye key point, a leg key point, etc. The target key point includes 11 key points.
[0039] In the embodiment of the present application, the implementation manner of posture confirmation of the target region based on the target key points is: determining that less than or equal to two key points in 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 degree is within a preset range according to a first included angle between a first distance vector in the target region and an xy plane in a three-dimensional space and a second included angle between a second distance vector and the xy plane in the three-dimensional space; and determining whether the target forelimb two-leg included angle is greater than a preset threshold value according to a third included angle between a third distance vector and a fourth distance vector in the target region and the xy plane in the three-dimensional space. The specific implementation manner can refer to subsequent embodiments.
[0040] S130, in the case of posture confirmation of the target region, 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 target key points, and the starting measurement point includes a first starting measurement point and a second starting measurement point.
[0041] In the embodiment of the present application, the first key point and the second key point of the foreleg region in the target key points are obtained; and the average coordinates of the first key point and the second key point are taken as the coordinates of the first starting measurement point.
[0042] In the embodiment of the present application, the fourth key point and the fifth key point of the hind leg region in the target key points are obtained; and the average of the coordinates of the fourth key point and the fifth key point is taken as the coordinates of the second starting measurement point. The specific implementation manner can refer to subsequent embodiments.
[0043] S140, determining different attribute measurement points according to the starting measurement point and the contour edge side measurement point, wherein the different attribute measurement points include a body height measurement point, a body length measurement point, and the body length measurement point includes a front chest measurement point and a hip end measurement point.
[0044] In the embodiment of the present application, in the case of obtaining the starting measurement point, the contour edge side measurement point can be determined by searching in the direction of the starting measurement point based on a preset angle, 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 manner can refer to subsequent embodiments.
[0045] S150, determining a body height value according to the ground point relative to the target region and the body height measurement point, and determining a body length value according to the distance between the front chest measurement point and the hip end measurement point in the two-dimensional plane.
[0046] In the embodiment of the present application, the Y values of the plurality of ground points are determined, and the average of the Y values of the plurality of ground points is taken as a ground height value; a difference between the ground height value and the Y value of the body height measuring point is taken as a body height value; 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 a distance between the first three-dimensional coordinates and the second three-dimensional coordinates projected onto a two-dimensional plane is taken as a body length value. The specific implementation manner can refer to subsequent embodiments.
[0047] In S160, the contour endpoints of the chest and the tube are obtained according to the chest circumference and the tube circumference measuring points respectively, a 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, and the sum of the first length and twice 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.
[0048] According to the horse size portable measurement method based on a single-view RGB-D camera according to the embodiment of the present application, the target region is obtained based on the segmentation model, and it is judged whether the target region is within the field of view range; in the case that the target region is within the field of view range, the target key points are confirmed from the key points output by the key point model, and the posture of the target region is confirmed based on the target key points; in the case that the posture of the target region is confirmed, the starting measuring points are calculated according to the target key points of the preset number of frames confirmed, wherein the target key points include a plurality of target key points, and the starting measuring points include a first starting measuring point and a second starting measuring point; different attribute measuring points are determined according to the starting measuring points and the contour edge side measuring points, wherein the different attribute measuring points include a body height measuring point and a body length measuring point, and the body length measuring point includes a front chest measuring point and a hip end measuring point; a body height value is determined according to the ground points relative to the target region and the body height measuring point, and a body length value is determined according to the distance between the front chest measuring point and the hip end measuring point on a two-dimensional plane; contour endpoints of the chest and the tube are obtained according to the chest circumference and the tube circumference measuring points respectively, a 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; and 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 the horse size, and improves the measurement efficiency and accuracy.
[0049] In order for those skilled in the art to more easily understand the present application, FIG. 2 is a horse size portable measurement method based on a single-view RGB-D camera according to a specific embodiment of the present application, as shown in FIG. 2, the horse size portable measurement method based on a single-view RGB-D camera includes:
[0050] In S210, the target region is obtained based on the segmentation model, and it is judged whether the target region is within the field of view range.
[0051] In the embodiments of the present application, the RGB image and the Depth image of the target image are input into the segmentation model to obtain the target region.
[0052] For example, (1) Data preparation and preprocessing can be performed first: Data collection: obtaining high-quality RGB images and corresponding depth maps is the premise of achieving accurate segmentation. This is usually done through devices equipped with depth sensors such as Kinect or Asus Xtion Pro Live. For specific application scenarios such as horse image segmentation, it is necessary to ensure that the data set covers horse images in different poses and different scenes. Data alignment: since RGB images and depth maps come from different sensors, they need to be aligned in the preprocessing stage to ensure their consistency in spatial position. This usually involves image registration techniques, including but not limited to feature point matching, transformation matrix calculation, etc. Data augmentation: to improve the generalization ability of the model, the training data is usually augmented, 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 the appropriate segmentation model according to the 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 can be used as the basic framework. These models have good spatial down-sampling and up-sampling structures, which can effectively capture the context 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 (decision layer fusion) and intermediate fusion (feature layer fusion). Among them, intermediate fusion strategies, such as fusing RGB and depth features through cross-modal attention mechanisms, have been proven to be more effective in utilizing information from both modalities. Model optimization: to further improve model performance, consider using a multi-task learning framework to simultaneously learn depth estimation and semantic segmentation tasks. This method can to some extent alleviate the impact of depth data noise and promote the model to learn more discriminative feature representations; (3) Then train the strategy and optimize: loss function design: for semantic segmentation tasks, common loss functions include cross-entropy loss and Dice loss. When dealing with 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: appropriate optimization algorithms can accelerate model convergence and improve performance. Common optimizers include Adam, RMSprop, etc. For models with multi-modal input, using optimizers 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. Optimal hyperparameter combinations can be found through grid search, random search or Bayesian optimization methods.(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 test: deploy the trained model to the actual application scene. Feedback iteration: according to the feedback in the actual application, further optimize the model and training strategy. For example, collect more challenging samples for difficult sample training to improve the robustness of the model.
[0053] In summary, effectively fusing RGB and depth images and inputting them into the segmentation model is an effective way to achieve high-accuracy target region 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.
[0054] In an embodiment of the present application, whether the target region is complete within the field of view is determined according to whether the detection frame of the target region is within 95% of the field of view.
[0055] S220, in the case where the target region is within the field of view, confirming the target key point among the key points output by the key point model.
[0056] In an embodiment of the present application, the implementation of step S220 can refer to the implementation of step S120 described above, and the present application will not be repeated here.
[0057] In an embodiment of the present application, the camera data stream (RGB+depth, 10 frames per second*2) is transmitted frame by frame into the key point model and the segmentation model, and the contour and the key point are optimized, and the output inference result includes the key point, the key point confidence, and the contour. Example: 10 frames of data need to be processed per second, considering using batch processing instead of single frame processing. Design a buffer, collect a certain number of frames each time (for example, process 2 frames each time), and then send these frames as a batch into the model; compress and crop the image, and only keep the region of interest (horse_boxx). Store each frame of model result as an array in the form of [ID, [key point], [confidence], [contour]] in a fixed order, which improves the calculation efficiency.
[0058] S230, confirming the pose of the target region based on the target key point.
[0059] In embodiments of the present application, the target key points can be understood as valuable points in the target feature points, for example, as shown in FIG. 3, 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.
[0060] In embodiments of the present application, it is determined that less than or equal to two key points in the target key points are occluded; it is determined that the depth difference between the target key points is less than a preset difference value; it is determined whether the target inclination degree is within a preset range according to a first angle between a first distance vector and an xy plane in a three-dimensional space and a second angle between a second distance vector and the xy plane in the three-dimensional space in the target region; it is determined whether the target forelimb two leg angles are greater than a preset threshold value according to a third angle between a third distance vector and a fourth distance vector in the xy plane in the three-dimensional space in the target region.
[0061] In embodiments of the present application, the first distance vector can be understood as a vector connecting the key point neck and the key point tail; the second distance vector can be understood as a vector connecting the 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 a vector connecting the key point left_front_leg_1 and the key point left_front_leg_2, representing the left foreleg of the horse; and the fourth distance vector can be understood as a vector connecting the key point left_front_leg_1 and the key point right_front_leg_1, the projection angle of the vector in the xy plane represents the degree of bifurcation of the leg of the horse.
[0062] For example, the posture confirmation needs to meet the following conditions: A, only less than or equal to two depth points in the 11 key points are occluded; B, the depth value deviation of all key points is less than 0.5 m; C, the angles of the 1-2 vectors of (“neck”, “tail”) and (“left_front_leg_1”, “left_back_leg_1”) with the xy plane are less than 10°; D, the angles of the 3-4 vectors of (“left_front_leg_1”, “left_front_leg_2”) and (“left_back_leg_1”, “left_back_leg_2”) with the 7-8 vector projection to the xy plane are less than 15°.
[0063] In an embodiment of the present application, whether it meets the standard posture requirements is judged by the confidence of the key points, the depth relationship between the camera and the horse, and the angle between the two sets of key points, until 3 frames that meet the requirements are found in succession, and the next 10 frames of data are saved in the hard disk, and only the 10 frames of data are saved in the memory. Examples: a. Design a function that maintains a sliding window with a window size of at least 3 frames of input data. When new frame input data arrives and is processed, update the window and analyze the new window data. Only when all frames in the window meet the posture confirmation standard, save the 3 frames and the subsequent 7 frames totaling 10 frames of depth and color data in the hard disk and memory. b. Before confirmation, cache the data in memory instead of directly writing to the hard disk, and write in bulk after confirmation; use numpy arrays to store frame data. c. Use np.diff() to calculate the depth value difference between each two consecutive key points, and use np.max() to get the maximum difference value in each frame, and select frames with a fluctuation of less than 0.5 meters.
[0064] S240, in the case of posture confirmation 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 target key points, and the starting measurement point includes a first starting measurement point and a second starting measurement point.
[0065] In an embodiment of the present application, 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 taken as the coordinates of the first starting measurement point. For example, as shown in FIG. 3, the first key point is neck, and the second key point is left_front_leg_1.
[0066] In an embodiment of the present application, the fourth key point and the fifth key point of the back leg region in the target key point are obtained; and the average of the coordinates of the fourth key point and the fifth key point is taken as the coordinates of the second starting measurement point. For example, as shown in FIG. 3, the fourth key point is tail, and the fifth key point is left_back_leg_1.
[0067] S250, determining a body height measurement point according to the first starting measurement point and the contour edge side measurement point.
[0068] In an embodiment of the present application, in the case of calculating the first starting measurement point, the first starting measurement point is searched in a direction based on a first preset angle, the first intersection coordinates of the first starting measurement point and the boundary contour are determined, and the average of a preset number of first intersection coordinates is taken as the contour edge side measurement point; starting from a position that is a preset number of pixel values outside the contour edge side measurement point, and searching in a direction from the contour edge side measurement point to the first starting measurement point, an edge three-dimensional coordinate point is obtained, and the edge three-dimensional coordinate point is taken as the body height measurement point.
[0069] For example, the first starting measurement point is P1, and P1 is searched along two angles (325° and 345°) to search for the intersection points of the contour; when the horse enters from right to left, P1 is searched along two angles (15° and 35°) to search for the intersection points of the contour, and the average value of the intersection points is taken as the contour edge side measurement point. Then, 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 most edge three-dimensional coordinate point, that is, H1 in FIG. 3 is taken as the body height measurement point.
[0070] In S260, the body length measurement point is determined according to the second starting measurement point and the contour edge side measurement point.
[0071] In the embodiment of the present application, the body length measurement point includes the withers measurement point and the hip end measurement point.
[0072] In the embodiment of the present application, the first starting measurement point is directionally searched based on the second preset angle, the second intersection point coordinates of the first starting measurement point and the boundary contour are determined, and the average value of a preset number of second intersection point coordinates is taken 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 and searching in the direction from the contour edge side measurement point to the first starting measurement point, the edge three-dimensional coordinate point is obtained, and the edge three-dimensional coordinate point is taken as the withers measurement point; the second starting measurement point is directionally searched based on the third preset angle, the third intersection point coordinates of the second starting measurement point and the boundary contour are determined, and the average value of a preset number of third intersection point coordinates is taken 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 and searching in the direction from the contour edge side measurement point to the second starting measurement point, the edge three-dimensional coordinate point is obtained, and the edge three-dimensional coordinate point is taken as the hip end measurement point; and the body length measurement point is determined according to the withers measurement point and the hip end measurement point.
[0073] For example, when the horse enters from left to right, the first starting measurement point P1 is searched along two angles (30° and 75°) to search for the intersection points of the contour; when the horse enters from right to left, the first starting measurement point P1 is searched along two angles (225° and 245°) to search for the intersection points of the contour, and the average value is taken as the contour edge side measurement point, and then 20 pixels on the vector from the contour edge side measurement point to P1 are searched inward (in the opposite direction of the vector) to obtain the most edge effective depth value point. That is, L1 in FIG. 3 is taken as the withers measurement point.
[0074] For example, when the horse enters from left to right, the second starting measurement point is searched along two angles (285° and 330°) to search for the intersection point of the contour; when the horse enters from right to left, the second starting measurement point is searched along two angles (115° and 135°) to search for the intersection point of the contour, and the average value is taken as the contour edge side measurement point, and the most edge effective depth value point is searched inward (in the opposite direction of the vector) from the contour edge side measurement point to P1 vector by 20 pixels. That is, L2 in FIG. 3 is taken as the hip end measurement point.
[0075] In an embodiment of the present application, the first starting measurement point is directionally searched based on the fourth preset angle, the first target intersection point of the first starting measurement point and the boundary contour is determined, and the second target intersection point of the perpendicular line and the boundary contour is determined with the first target intersection point as the perpendicular line; the average value of the first target intersection point and the second target intersection point is taken as the chest circumference measurement point; and the X value difference between two points is determined with the seventh key point as the starting point to make a horizontal line based on the vector direction of the sixth key point and the seventh key point; the 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.
[0076] For example, when the horse enters from left to right, the intersection point of the contour is searched along 320 degrees, that is, one angle, from the first starting measurement point P1, another intersection point is determined in the direction perpendicular to the intersection point after the intersection point is determined, and the average value of the two intersection points is taken as the chest circumference measurement point, that is, B1 in FIG. 3 is taken as the chest circumference measurement point; when the horse enters from right to left, the intersection point of the contour is searched along 40°, that is, one angle, from the first starting measurement point P1, another intersection point is determined in the direction perpendicular to the intersection point after the intersection point is determined, and the average value of the two intersection points is taken as the chest circumference point, that is, B1 in FIG. 3 is taken as the chest circumference measurement point.
[0077] For example, as shown in FIG. 3, left_front_leg_2 is taken as the sixth key point, left_back_leg_3 is taken as the seventh key point, the vector direction of the sixth key point to the seventh key point is defined, iteration is performed along every two pixels, 200 depth values are taken at each pixel point, small parts are clustered and taken out, intersection points at both ends are obtained, and the distance value of the two intersection points is calculated. The average value of the two intersection points with the smallest distance is taken as the tube circumference measurement point, that is, T1 in FIG. 3 is taken as the tube circumference measurement point.
[0078] S270, the body height value is determined according to the ground point and the body height measurement point of the relative target area.
[0079] In an embodiment of the present application, in the case of determining the body height measurement point, the Y values of a plurality of ground points are determined, the average value of the Y values of the plurality of ground points is taken as the ground height value, and the difference value between the ground height value and the Y value of the body height measurement point is taken as the body height value.
[0080] For example, ground height calculation: as shown in FIG. 3, based on the center point of the quadrilateral with the four limb joint points of left_front_leg_2, right_front_leg_2, left_back_leg_2 and right_back_leg_2 as endpoints, a rectangle with a length of 160 and a width of 90 is taken out, the height of all points is calculated by using the intrinsic parameters and the depth data, the extreme values are filtered out, and the average value is taken as the ground height Dy (only calculated once in 10 frames). Then the height value Hy of the H1 measuring point is calculated, and the body height is Hy-Dy.
[0081] S280, determining the body length value according to the distance between the front chest measuring point and the hip end measuring point in the two-dimensional plane.
[0082] In an embodiment of the present application, in the case of determining the front chest measuring point and the hip end measuring point, 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 to the two-dimensional plane is taken as the body length value.
[0083] S290, calculating the chest circumference length and the girth length.
[0084] In an embodiment of the present application, in the case of determining the chest circumference measuring point and the girth measuring point, a target smooth curve is fitted according to the end points of the horse profile; a first length of the target smooth curve is calculated, and a first height difference of the end points of the target smooth curve (the height difference is considered as a half of the visual blind area part of the horse chest circumference or girth profile) is calculated; twice the sum of the first length and the first height difference is taken as the chest circumference length; and twice the sum of the first length and the first height difference is taken as the girth length.
[0085] For example, based on the upper and lower end points of the horse profile obtained by the chest circumference measurement, all the coordinates and the corresponding depth values on the connecting line are taken out, all of them are converted into three-dimensional coordinates, the extreme values (profile expansion) possibly appearing at the two ends are filtered out, these points are projected onto the YZ plane, a smooth curve is fitted, the curve length and the height difference of the end points of the fitted curve are calculated, and the curve length plus twice the height difference is taken as the chest circumference length.
[0086] The left and right end points of the girth measuring point are taken out, the extreme values possibly appearing at the two ends are filtered out, these points are projected onto the XZ plane, a smooth curve is fitted, the curve length and the height difference of the end points of the fitted curve are calculated, and the curve length plus twice the height difference is taken as the girth length.
[0087] In an embodiment of the present application, the effectiveness of the method provided by the present application is verified by measuring the body size of 120 horses in a certain scale horse farm. During the measurement process, a total of 254 depth data segments were taken, totaling more than 12,000 frames. Through the posture confirmation module, the number of individuals meeting the standard measurement posture was 90. According to statistics, the average artificial measurement speed of docile horses is 180 seconds / horse, and the average measurement speed of untrained horses is more than 300 seconds / horse. Among them, the automatic measurement speed in the present application is 15-30 seconds / horse, and the need for hand-selected point assisted correction of body length and body height measurement is 30-50 seconds / horse. Compared with the Baoding column measurement and artificial measurement, the time for animal pacification, 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 application and the hand-selected point cloud are compared with the artificial measurement results, and it is found that the error of the automatic measurement method of the present application is generally smaller in each index, especially the average absolute error of body height and body length is 2.57 cm and 3.26 cm, and the average absolute percentage error is 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 girth and chest circumference is established based on the body size data of 1057 medium and small horses accumulated in the early stage. As shown in FIG. 6, in the scenario of delineating a simple measurement site, a 20TOPS computing device can carry the computing program described in the present application, and in single-view calculation, the average absolute error of chest circumference and girth is controlled at 2.19% and 7.51%. Under the same error requirement, compared with the multi-camera fusion and calculation method, the camera cost is reduced by 75%, the computing power requirement of the computing device is reduced by 50%, and the practicality and convenience are greatly improved.
[0088] Table 1
[0089] The horse body size portable measurement method based on single-view RGB-D camera according to the embodiment of the present application can accurately capture the details of the target area by combining the segmentation model of RGB image and Depth image, and improve the accuracy of segmentation. The feature points are further accurately positioned by using the key point model, which ensures the accuracy of the measurement data. The whole process from data acquisition, preprocessing, segmentation, feature point recognition to size measurement can be automatically completed, which greatly improves the efficiency and reduces the need for manual intervention. This technical solution is not only suitable for size measurement of horses, but also can be extended to size measurement of other animals or objects, and has wide application prospect. Compared with the traditional manual measurement method, the automatic image processing and analysis technology greatly reduces the measurement error caused by human factors, improves the objectivity and repeatability of the measurement, and realizes the fast, accurate and non-contact measurement of the size of the target object.
[0090] Through the description of the above embodiments, those skilled in the art can clearly understand that the method according to the above embodiments can be realized by means of software on a general hardware platform as necessary, and of course can also be realized by hardware, but in many cases the former is a better embodiment. Based on such understanding, the technical solutions of the present application can be embodied in the form of a software product in essence or the part of the prior art that contributes to the present application, and the computer software product is stored in a storage medium (such as a ROM / RAM, a magnetic disk, or an optical disk), and includes a plurality of instructions for causing a terminal device (which can be a mobile phone, a computer, a server, or a network device) to execute the method of each embodiment of the present application.
[0091] According to an aspect of the embodiment of the present application, a single-view RGB-D camera-based horse body measurement system is also provided. FIG. 4 is a structural block diagram of the single-view RGB-D camera-based horse body measurement system according to the embodiment of the present application. As shown in FIG. 4, the single-view RGB-D camera-based horse body measurement system comprises:
[0092] The first determining module 410 is configured to acquire a target region based on the segmentation model, and determine whether the target region is within a field of view range.
[0093] The posture confirmation module 420 is configured to, in a case where it is determined that the target region is within the field of view range, confirm a target key point from the key points output by the key point model, and perform posture confirmation on the target region based on the target key point.
[0094] The first calculating module 430 is configured to, in a case where posture confirmation is performed on the target region, calculate a starting measurement point according to the target key points of a preset number of frames that are confirmed, wherein the target key points comprise a plurality of target key points, and the starting measurement point comprises a first starting measurement point and a second starting measurement point.
[0095] The first determining module 440 is configured to determine different attribute measurement points according to the starting measurement point and the contour edge side measurement point, wherein the different attribute measurement points comprise a body height measurement point and a body length measurement point, and the body length measurement point comprises a front chest measurement point and a hip end measurement point.
[0096] The second determining module 450 is configured to determine a body height value according to a ground point relative to the target region and the body height measurement point, and determine a body length value according to a distance of the front chest measurement point and the hip end measurement point in a two-dimensional plane.
[0097] The second calculation module 460 is configured to obtain contour endpoints of the chest and the tube according to chest and tube measuring points respectively, fit a target smooth curve according to point sets between the endpoints, calculate a first length of the target smooth curve, and a first height difference of endpoints of the target smooth curve, take a sum of the first length and twice the first height difference as a chest circumference length, and take a sum of the first length and twice the first height difference as a tube circumference length.
[0098] According to the horse size portable measurement system based on a single-view RGB-D camera, the target region is obtained based on the segmentation model, and it is judged whether the target region is within the field of view range; in the case that the target region is within the field of view range, the target key points are confirmed from the key points output by the key point model, and the posture of the target region is confirmed based on the target key points; in the case that the posture of the target region is confirmed, the starting measurement points are calculated according to the target key points of the confirmed preset number of frames, 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; different attribute measurement points are determined according to the starting measurement points and the contour edge side measurement points, wherein the different attribute measurement points include a body height measurement point, a body length measurement point, the body length measurement point includes a front chest measurement point and a hip end measurement point; a body height value is determined according to the ground point and the body height measurement point relative to the target region, and a body length value is determined according to the distance between the front chest measurement point and the hip end measurement point in a two-dimensional plane; contour endpoints of the chest and the tube are obtained according to chest and tube measuring points respectively, a target smooth curve is fitted according to point sets between the endpoints; a first length of the target smooth curve is calculated, and a first height difference of endpoints of the target smooth curve is calculated; a sum of the first length and twice the first height difference is taken as a chest circumference length; a sum of the first length and twice the first height difference is taken as a tube circumference length. Thus, the automatic measurement of the horse size is realized, and the measurement efficiency and accuracy are improved.
[0099] Optionally, the first judgment module 410 is specifically configured to input the RGB image and the Depth image of the target image into the segmentation model to obtain the target region; judge whether the target region is complete within the field of view range according to whether the detection box of the target horse is within a position within 95% of the field of view center; the target key points include 11 key points, wherein the posture confirmation module 420 is specifically configured to determine that less than or equal to two key points in the target key points are occluded; determine that a depth difference between the target key points is less than a preset difference value; judge whether the target inclination degree is within a preset range according to a first included angle between a first distance vector and an xy plane in a three-dimensional space and a second included angle between a second distance vector and the xy plane in the three-dimensional space in the target region; judge whether the target front leg two-leg included angle is greater than a preset threshold value according to a third included angle between a third distance vector and a fourth distance vector in the xy plane in the three-dimensional space in the target region.
[0100] Optionally, the first computing module 430 is specifically configured to acquire a first key point and a second key point of a front leg region in the target key points; and take average coordinates of the first key point and the second key point as coordinates of the first starting measurement point.
[0101] Optionally, the first computing module 430 is specifically configured to acquire a fourth key point and a fifth key point of a back leg region in the target key points; and take average of the coordinates of the fourth key point and the fifth key point as coordinates of the second starting measurement point.
[0102] Optionally, the first determining module 440 is specifically configured to perform direction search on the first starting measurement point based on a first preset angle, determine first intersection point coordinates of the first starting measurement point and a boundary contour, and take average of a preset number of the first intersection point coordinates as the contour edge side measurement point; start searching from a position of a preset number of pixel values outside the contour edge side measurement point, and search in a direction from the contour edge side measurement point to the first starting measurement point, to acquire an edge three-dimensional coordinate point, and take the edge three-dimensional coordinate point as the body height measurement point.
[0103] Optionally, the first determining module 440 is specifically configured to perform direction search on the first starting measurement point based on a second preset angle, determine second intersection point coordinates of the first starting measurement point and a boundary contour, and take average of a preset number of the second intersection point coordinates as the contour edge side measurement point; start searching from a position of a preset number of pixel values outside the contour edge side measurement point, and search in a direction from the contour edge side measurement point to the first starting measurement point, to acquire an edge three-dimensional coordinate point, and take the edge three-dimensional coordinate point as the front chest measurement point; perform direction search on the second starting measurement point based on a third preset angle, determine third intersection point coordinates of the second starting measurement point and a boundary contour, and take average of a preset number of the third intersection point coordinates as the contour edge side measurement point; start searching from a position of a preset number of pixel values outside the contour edge side measurement point, and search in a direction from the contour edge side measurement point to the second starting measurement point, to acquire an edge three-dimensional coordinate point, and take the edge three-dimensional coordinate point as the hip end measurement point; and determine the body length measurement point according to the front chest measurement point and the hip end measurement point.
[0104] Optionally, the different attribute measuring points further include a bust measuring point and a girth measuring point, wherein the first starting measuring point is directionally searched based on a fourth preset angle, a first target intersection point between the first starting measuring point and the boundary contour is determined, a second target intersection point between a perpendicular line of the first target intersection point and the boundary contour is determined, an average value of the first target intersection point and the second target intersection point is taken as the bust measuring point, a seventh key point is taken as a starting point to make a horizontal line based on a vector direction of a sixth key point and the seventh key point, an X value difference between two points is determined, a girth measuring position is determined according to the vector direction and the X value difference, and the girth measuring position is used to determine the girth measuring point.
[0105] Optionally, the second calculation module 460 is specifically configured to determine Y values of the plurality of ground points, take an average value of the Y values of the plurality of ground points as a ground height value, take a difference between the ground height value and a Y value of the body height measuring point as the body height value, determine a first three-dimensional coordinate of the front chest measuring point and a second three-dimensional coordinate of the hip end measuring point, and take a distance between the first three-dimensional coordinate and the second three-dimensional coordinate projected onto the two-dimensional plane as the body length value.
[0106] According to an aspect of an embodiment of the present application, an electronic device is provided.
[0107] FIG. 5 is a structural schematic diagram of an electronic device according to an embodiment of the present application. As shown in FIG. 5, the electronic device can include one or more (only one is shown in FIG. 5) processors 102 (the processor 102 can include but is not limited to a microprocessor unit (MPU) or a programmable logic device (PLD)) and a memory 104 for storing data. In an exemplary embodiment, the electronic device can further include a transmission device 106 for communication function and an input / output device 108. Those skilled in the art can understand that the structure shown in FIG. 5 is only schematic, and does not limit the structure of the terminal device. For example, the terminal device can include more or fewer components than those shown in FIG. 5, or have different configurations with the same or more functions than those shown in FIG. 5.
[0108] The memory 104 can be used to store computer programs, such as software programs of application software and modules, such as the computer program corresponding to the method for measuring horse body size based on a single-view RGB-D camera according to the embodiments of the present application. The processor 102 can execute various functions and data processing, i.e., implement the above method, by running the computer program stored in the memory 104. The memory 104 can include a high-speed random access memory, and can further include a non-volatile memory, such as one or more magnetic storage devices, flash memories, or other non-volatile solid-state memories. In some examples, the memory 104 can further include a memory remotely arranged with respect to the processor 102, which can be connected to the terminal device through a network. Examples of the above network include, but are not limited to, the Internet, an intranet, a local area network, a mobile communication network, and a combination thereof.
[0109] The transmission device 106 is used to receive or send data via a network. The specific examples of the above network can include a wireless network provided by a communication provider of a switching device. In one example, the transmission device 106 includes a network adapter (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 in a wireless manner.
[0110] The present application provides a computer readable storage medium, which stores a computer program capable of being loaded and executed by a processor to implement the method for measuring horse body size based on a single-view RGB-D camera according to the first aspect.
[0111] The applicant of the present application has made a detailed description and explanation of the embodiments of the present application with reference to the drawings. However, those skilled in the art should understand that the above embodiments are only preferred embodiments of the present application, and the detailed description is only for the purpose of helping the reader to better understand the spirit of the present application, and is not a limitation on the protection scope of the present application. On the contrary, any improvement or modification made on the basis of the spirit of the present application should fall within the protection scope of the present application.
[0112] In addition, each functional unit in each embodiment of the present application can be integrated in one processing module, or each unit can be physically present separately, or two or more units can be integrated in one module. The above integrated module can be realized in the form of hardware or in the form of a software functional module. When the integrated module is realized in the form of a software functional module and sold or used as an independent product, it can also be stored in a computer readable storage medium.
[0113] The storage medium mentioned above can be a read-only memory, a magnetic disk or an optical disk, etc. Although the embodiments of the present application have been shown and described above, it should be understood that the above embodiments are exemplary and should not be construed as limiting the present application, and those skilled in the art can make changes, modifications, replacements and variations to the above embodiments within the scope of the present application.
[0114] Finally, it should be noted that the above embodiments are only used to illustrate the technical solutions of the embodiments of the present application, and are not intended to limit the present application. Although the present application has been described in detail with reference to the foregoing embodiments, those skilled in the art should understand that the technical solutions recorded in the foregoing embodiments can still be modified, or some technical features can be replaced 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 application, and any changes or replacements that can be easily thought of by those skilled in the art within the technical scope disclosed by the present application should be covered within the protection scope of the present application.
Claims
1. A horse body size portable measurement method based on a single-view RGB-D camera, characterized in that, The method comprises the following steps: S1, obtaining a target region based on a segmentation model, and determining whether the target region is within a field of view range; S2, in the case that the target region is within the field of view range, confirming a target key point from key points output by a key point model, and confirming a posture of the target region based on the target key point; S3, in the case that the posture of the target region is confirmed, calculating a starting measurement point according to the target key points of a preset number of frames confirmed, wherein the target key points include a plurality of target key 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 a contour edge side measurement point, 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 region and the body height measurement point, and determining a body length value according to a distance of the front chest measurement point and the hip end measurement point on a two-dimensional plane; S6, obtaining contour endpoints of a chest and a tube according to chest circumference and tube circumference measurement points, respectively, fitting a target smooth curve according to a 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, and taking a sum of the first length and twice the first height difference as a chest circumference length and a tube circumference length.
2. The single-view RGB-D camera based horse body size portable measurement method according to claim 1, characterized in that, Obtaining a target region based on a segmentation model comprises: inputting an RGB image and a depth image of a target image into the segmentation model to obtain the target region; wherein Determining whether the target region is within a field of view range comprises: determining whether the target region is completely within the field of view range according to whether a detection box of a target horse is within a position within 95% of a field of view center; The target key point includes 11 key points, wherein confirming a posture of the target region based on the target key point comprises: determining that less than or equal to two key points in the target key point are occluded; determining that a depth difference between the target key points is less than a preset difference value; determining whether the target inclination degree is within a preset range according to a first included angle of a first distance vector and a second distance vector with an xy plane in a three-dimensional space in the target region; determining whether a target forelimb two-leg included angle is greater than a preset threshold value according to a third included angle of a third distance vector and a fourth distance vector with the xy plane in the three-dimensional space in the target region.
3. The single-view RGB-D camera based horse body size portable measurement method according to claim 1, characterized in that, Calculating a starting measurement point according to the target key points of a preset number of frames confirmed comprises: obtaining a first key point and a second key point of a foreleg region in the target key point; taking average coordinates of the first key point and the second key point as coordinates of the first starting measurement point.
4. The single-view RGB-D camera based horse body size portable measurement method according to claim 3, characterized in that, Further comprising: obtaining a fourth key point and a fifth key point of a hind leg region in the target key point; taking average of the coordinates of the fourth key point and the fifth key point as coordinates of the second starting measurement point.
5. The monocular RGB-D camera based horse body size portable measurement method according to claim 1, characterized in that, According to the starting measurement point and the profile edge side measurement point, different attribute measurement points are determined, including: The first starting measurement point is searched in a direction based on a first preset angle, a first intersection coordinate of the first starting measurement point and a boundary profile is determined, and an average value of a preset number of the first intersection coordinates is taken as the profile edge side measurement point; Based on a position of a preset number of pixel values outside the profile edge side measurement point, searching is performed in a direction from the profile edge side measurement point to the first starting measurement point, an edge three-dimensional coordinate point is obtained, and the edge three-dimensional coordinate point is taken as the body height measurement point.
6. The monocular RGB-D camera based horse body size portable measurement method according to claim 5, characterized in that, Further comprising: The first starting measurement point is searched in a direction based on a second preset angle, a second intersection coordinate of the first starting measurement point and a boundary profile is determined, and an average value of a preset number of the second intersection coordinates is taken as the profile edge side measurement point; Based on a position of a preset number of pixel values outside the profile edge side measurement point, searching is performed in a direction from the profile edge side measurement point to the first starting measurement point, an edge three-dimensional coordinate point is obtained, and the edge three-dimensional coordinate point is taken as the front chest measurement point; The second starting measurement point is searched in a direction based on a third preset angle, a third intersection coordinate of the second starting measurement point and a boundary profile is determined, and an average value of a preset number of the third intersection coordinates is taken as the profile edge side measurement point; Based on a position of a preset number of pixel values outside the profile edge side measurement point, searching is performed in a direction from the profile edge side measurement point to the second starting measurement point, an edge three-dimensional coordinate point is obtained, and the edge three-dimensional coordinate point is taken as the hip end measurement point; The body length measurement point is determined according to the front chest measurement point and the hip end measurement point.
7. The monocular RGB-D camera based horse body size portable measurement method according to claim 3, characterized in that, The different attribute measurement points further include a chest circumference measurement point and a girth measurement point, wherein The first starting measurement point is searched in a direction based on a fourth preset angle, a first target intersection of the first starting measurement point and a boundary profile is determined, a perpendicular line is determined with the first target intersection as a vertical line, and a second target intersection of the perpendicular line and the boundary profile is determined; An average value of the first target intersection and the second target intersection is taken as the chest circumference measurement point; and Based on a vector direction of the sixth key point and the seventh key point, a horizontal line is drawn with the seventh key point as a starting point, and an X value difference between two points is determined; A girth measurement position is determined according to the vector direction and the X value difference, and the girth measurement point is determined based on the girth measurement position.
8. The monocular RGB-D camera based horse body size portable measurement method according to claim 1, characterized in that, A body height value is determined according to a ground point relative to the target region and the body height measurement point, and a body length value is determined according to a distance of the front chest measurement point and the hip end measurement point on a two-dimensional plane, including: Y values of a plurality of the ground points are determined, and an average value of the Y values of the plurality of the ground points is taken as a ground height value; A difference value between the ground height value and a Y value of the body height measurement point is taken as the body height value; First three-dimensional coordinates of the front chest measurement point and second three-dimensional coordinates of the hip end measurement point are determined; A distance of the first three-dimensional coordinates and the second three-dimensional coordinates projected to the two-dimensional plane is taken as the body length value.
9. A horse body size portable measurement system based on monocular RGB-D camera, characterized in that, Including: The first determining module is configured to acquire a target region based on the segmentation model and determine whether the target region is within a field of view range. The posture confirming module is configured to, in a case where it is determined that the target region is within the field of view range, confirm a target key point from the key points output by the key point model, and confirm a posture of the target region based on the target key point. The first calculating module is configured to, in a case where the posture of the target region is confirmed, calculate a starting measurement point according to the target key points of a preset number of frames that are confirmed, wherein the target key points include a plurality of target key points, and the starting measurement point includes a first starting measurement point and a second starting measurement point. The first determining module is configured to determine different attribute measurement points according to the starting measurement point and a contour edge side measurement point, 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. The second determining module is configured to determine a body height value according to a ground point relative to the target region and the body height measurement point, and determine a body length value according to a distance of the front chest measurement point and the hip end measurement point on a two-dimensional plane. The second calculating module is configured to acquire contour endpoints of a chest and a tube according to chest circumference and tube circumference measurement points, respectively, fit a target smooth curve according to a point set between the endpoints, calculate a first length of the target smooth curve and a first height difference of the endpoints of the target smooth curve, take a sum of the first length and twice the first height difference as a chest circumference length, and take a sum of the first length and twice the first height difference as a tube circumference length.
10. An electronic device, comprising: The apparatus comprises: at least one processor; and a memory connected with the at least one processor in communication; wherein the memory stores instructions executable 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 of any one of claims 1 to 8.
Citation Information
Patent Citations
Horse body measurement system and data correction method based on 3D
CN108805980A
Horse body ruler measurement method based on deep learning and image processing
CN110782467A
Method and device for measuring bending body size of pig body, equipment and medium
CN113344898A
Horse body ruler portable measurement method and system based on single-view RGB-D camera
CN119359782A
Pose determination method, apparatus, and device, storage medium, chip and product
WO2021098545A1