A real-time height measurement method based on key point detection
Patent Information
- Application Number
- CN202410396566.4
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2024-04-03
- Publication Date
- 2026-10-20
- Estimated Expiration
- 2044-04-03
AI Technical Summary
[0006]然而,现有的基于计算机视觉的身高测量方法仍面临诸多挑战
[0062]1.该基于关键点检测的实时身高测量方法,实现非接触式与自动化,避免物理接触,减少因接触而产生的误差,同时提高测量的便捷性,整个过程自动化,无需人工操作,大大提高测量效率。
Smart Images

Figure CN118229996B_ABST
Abstract
Description
Technical Field
[0001] This invention belongs to the field of computer vision technology, and in particular relates to a real-time height measurement method based on key point detection. Background Technology
[0002] Height, as an important physiological indicator of the human body, is of significant importance in monitoring growth and development and assessing health status. Furthermore, in social settings such as recruitment and sports talent selection, height is a key parameter for evaluating an individual's overall qualities. At the same time, accurately and quickly obtaining human height information is particularly important in fields such as medical diagnosis, sports competition, clothing design, ergonomics, and daily life.
[0003] However, in certain special circumstances, such as emergency rescue, self-service physical examinations, or large-scale events, direct height measurement may be difficult to achieve. Furthermore, in some regions, measuring equipment may be unavailable or expensive, which also limits the widespread adoption and application of height measurement. Therefore, developing a real-time, rapid, and economical height measurement method and device has significant practical importance and application value.
[0004] Traditional height measurement methods primarily rely on physical measuring tools, such as height rulers, height measuring instruments, and optical technologies like laser rangefinders. While these methods can provide relatively accurate measurements, they have significant shortcomings in terms of ease of operation, adaptability to different measurement environments, and degree of automation. The use of physical measuring tools is often limited, especially outdoors or in special environments such as sports competitions or public safety monitoring.
[0005] With the rapid development of computer vision and image processing technologies, image or video-based height measurement methods have gradually gained attention. These methods capture and analyze individual image or video data to extract key information and then measure height. Compared with traditional physical measurement methods, height measurement methods based on computer vision technology have the advantages of being non-contact, easy to operate, and capable of automatically and quickly processing large amounts of data, adapting to various measurement environments.
[0006] However, existing computer vision-based height measurement methods still face many challenges. First, regarding real-time performance, the complex preprocessing, feature extraction, and model calculations required for image or video data involve a significant amount of computation, often resulting in slow processing speeds and inadequate real-time feedback. Second, in terms of speed, the consumption of computational resources and limitations of hardware devices also affect the efficiency and widespread adoption of height measurement, especially in the processing of high-resolution images or high-definition videos, where the computational load increases further. In some cases, such as mobile devices or embedded systems, hardware resource limitations can further exacerbate the challenges in real-time performance and speed, placing higher demands on hardware performance. Summary of the Invention
[0007] The purpose of this invention is to provide a real-time height measurement method based on key point detection to solve the technical problems mentioned in the background section.
[0008] To achieve the above objectives, the specific technical solution of the real-time height measurement method based on key point detection of the present invention is as follows:
[0009] A real-time height measurement method based on key point detection includes the following steps:
[0010] Step S10: Calibrate the monocular camera to obtain its intrinsic and extrinsic parameters;
[0011] Step S20: Acquire real-time video of the human body to be measured;
[0012] Step S30: Preprocess the video;
[0013] Step S40: Use MediaPipe to perform pose recognition and face detection on the preprocessed image containing the human body to obtain key points of the human body and face;
[0014] Step S50: Calculate the pixel value of the human body height based on the key points;
[0015] Step S60: Use the ranging module to obtain the distance between the human body and the camera in real time;
[0016] Step S70: Calculate the actual height of the human body based on the pixel value of the human body height, combined with the camera's intrinsic parameters and the distance between the human body and the camera.
[0017] Furthermore, step S10 specifically includes:
[0018] Step S10-1: Prepare a two-dimensional black and white checkerboard calibration plate and keep the calibration plate flat.
[0019] Step S10-2: Place the calibration board within the shooting range of the monocular camera and take multiple shots from different angles and distances;
[0020] Step S10-3: Use the OpenCV library to process the captured calibration board image and extract the coordinates of the black and white square corner points on the calibration board.
[0021] Step S10-4: According to Zhang Zhengyou's calibration method, calculate the initial values of the camera's intrinsic and extrinsic parameters through the homography matrix, estimate the distortion coefficients using the nonlinear least squares method, and optimize the parameters using the maximum likelihood estimation method.
[0022] Step S10-5: Obtain the intrinsic and extrinsic parameters of the monocular camera. The intrinsic parameters include the camera's focal length, principal point coordinates, distortion coefficients, etc., while the extrinsic parameters include the rotation matrix and translation vector, which describe the camera's position and orientation in the world coordinate system.
[0023] Furthermore, step S20 specifically includes:
[0024] Place the monocular camera horizontally and face it directly at the human body, so that the front-back direction of the human body is consistent with the direction of the camera's line of sight.
[0025] Furthermore, step S30 specifically includes:
[0026] Step S30-1: Process the video in frames;
[0027] Step S30-2: Apply median filtering to each frame of the image to remove noise while preserving the details and edge information of the image;
[0028] Step S30-3: Perform distortion correction processing on the filtered image;
[0029] Step S30-4: Convert the distortion-free image to Red, Green, Blue (RGB) format.
[0030] Furthermore, step S40 specifically includes:
[0031] Step S40-A1: Initialize the MediaPipe Pose model, which has been trained to perform pose recognition tasks;
[0032] Step S40-A2: Load the preprocessed real-time video frame image containing the human body;
[0033] Step S40-A3: The MediaPipe Pose model processes the input image, applies deep learning models and computer vision algorithms to detect key points in the image, and evaluates the positions of 33 reference points for human pose.
[0034] Step S40-A4: Return the coordinates of the key points of the human posture and draw the identified key points on the image.
[0035] Furthermore, step S40 also includes:
[0036] Step S40-B1: Load the pre-trained Face Mesh model from MediaPipe to identify and locate key points on the face;
[0037] Step S40-B2: Load the preprocessed real-time video frame image containing the face;
[0038] Step S40-B3: Pass the preprocessed image to the Face Mesh model for inference, detect faces in the image, and locate the positions of key points;
[0039] Step S40-B4: Return the coordinates of the facial key points and draw the detected facial key points on the image.
[0040] Furthermore, step S50 specifically includes:
[0041] Step S50-1: Based on the human posture key points obtained by MediaPipe posture recognition, extract the coordinates of the key points of the left heel and right heel;
[0042] Step S50-2: Extract the coordinates of key points for the brow bone and nose tip based on the facial key points obtained from MediaPipe face detection;
[0043] Step S50-3: Calculate the vertical pixel distance from the brow bone to the tip of the nose. According to the facial aesthetics of "three courts and five eyes", the pixel value of the middle court is 1 / 3 of the total length of the face.
[0044] Step S50-4: Calculate the vertical pixel distance from the tip of the nose to the lower point of the left and right heels, ensuring that the obtained vertical distance is the larger one, i.e., the vertical distance from the tip of the nose to the ground.
[0045] Step S50-5: Sum the vertical pixel distance from the tip of the nose to the ground with twice the pixel value of the midface to obtain the pixel value of the human height.
[0046] Furthermore, step S60 specifically includes:
[0047] Align the ranging module with the monocular camera and place it facing the human body, then return the measured distance between the human body and the camera.
[0048] Furthermore, step S70 specifically includes:
[0049] Extract the focal length from the intrinsic parameter information obtained from the monocular camera calibration;
[0050] According to the principle of similar triangles, the following relationship exists:
[0051]
[0052] The actual height of a person can be calculated using the following formula.
[0053]
[0054] Among them, h r h represents the actual height of a person. pd represents the pixel value of human height, f represents the distance between the human body and the camera measured by the ranging module, c represents the focal length of the monocular camera, and c represents the height correction coefficient.
[0055] A real-time height measurement device based on key point detection includes:
[0056] The camera module uses a calibrated monocular camera to acquire real-time video of the human body to be measured and transmit the video to the processing terminal.
[0057] The ranging module is used to obtain the distance between the human body and the camera in real time and transmit the distance information to the processing terminal;
[0058] The processing terminal is used to preprocess the video, use MediaPipe to perform pose recognition and face detection on the preprocessed image, obtain human body and facial key points, calculate the pixel value of human body height based on the key points, and calculate the actual height of the human body by combining the distance information transmitted by the ranging module.
[0059] The first display module is used to display human body videos in real time and show the key point drawing results of posture recognition and face detection;
[0060] The second display module is used to display the actual height value of the human body calculated by the processing terminal in real time.
[0061] The real-time height measurement method based on key point detection of the present invention has the following advantages:
[0062] 1. This real-time height measurement method based on key point detection achieves non-contact and automated measurement, avoids physical contact, reduces errors caused by contact, and improves the convenience of measurement. The entire process is automated and requires no manual operation, greatly improving measurement efficiency.
[0063] 2. This real-time height measurement method based on key point detection is flexible and real-time. Compared with fixed height measurement equipment, this method is not limited by the site. Due to the efficiency of MediaPipe, face and human body key point detection can be performed in real time, thereby obtaining height data quickly in real time.
[0064] 3. This real-time height measurement method based on key point detection can display facial and human body key points, as well as the actual height value, on the display module in real time, making the measurement results more intuitive and easier to understand. Through a visual interface, users can interact to obtain more accurate measurement results.
[0065] 4. This real-time height measurement method based on key point detection is not limited by venue, equipment or personnel skills, and is applicable to various scenarios and groups, including children, the elderly, and people with disabilities, and has wide adaptability. Attached Figure Description
[0066] Figure 1 This is a flowchart of a real-time height measurement method based on key point detection provided in an embodiment of the present invention.
[0067] Figure 2 This is a diagram of a chessboard calibration board for a monocular camera in one embodiment of the present invention.
[0068] Figure 3 This is a schematic diagram of key points of posture recognition and face detection in one embodiment of the present invention.
[0069] Figure 4 This is a schematic diagram illustrating the calculation of human height pixel values in one embodiment of the present invention.
[0070] Figure 5 This is a schematic diagram of the coordinate system of a camera imaging system in one embodiment of the present invention.
[0071] Figure 6 This is a schematic diagram illustrating the principle of calculating the actual height of a human body in one embodiment of the present invention.
[0072] Figure 7 This is a structural diagram of a real-time height measurement device based on key point detection provided in an embodiment of the present invention.
[0073] The markings in the diagram are as follows: 100, camera module; 200, ranging module; 300, processing terminal; 400, first display module; 500, second display module. Detailed Implementation
[0074] To better understand the purpose, structure, and function of this invention, the following detailed description of a real-time height measurement method based on key point detection, in conjunction with the accompanying drawings, is provided.
[0075] Reference Figure 1 This embodiment provides a height measurement method, including the following steps:
[0076] S10: Calibrate the monocular camera to obtain its intrinsic and extrinsic parameters;
[0077] Specifically, the Zhang Zhengyou calibration method is used to establish the correspondence between the object's coordinates in the three-dimensional world and on the imaging plane. Utilizing... Figure 2 The checkerboard calibration board shown was placed within the field of view of a monocular camera, and multiple images were taken from different angles and distances. The images were then processed using the OpenCV library to extract the coordinates of the corner points of the black and white squares on the calibration board. The point in the 3D world coordinate system is defined as M = [XYZ]. T Its homogeneous coordinates are The pixel coordinates of a 2D camera plane are m = [uv]. T Its homogeneous coordinates are The relationship between a real-world 3D coordinate point and its projection point on the image is:
[0078]
[0079] Where s represents the scale factor and A represents the intrinsic parameter matrix of the monocular camera;
[0080]
[0081] f x and f y c represents the focal length of the camera on the x and y axes. x and c y R represents the coordinates of the optical center in the image coordinate system, and R and t represent the rotation and translation matrices, respectively, collectively referred to as the camera's extrinsic parameters. i Represents the column vector of R.
[0082] Assuming the world coordinate system lies on the checkerboard plane, and the checkerboard plane is located on the plane where Z=0, then the homography relationship between the checkerboard calibration plate plane and the image plane can be expressed as:
[0083]
[0084] Right now:
[0085]
[0086] To simplify the calculation, a homogeneous matrix H = λA[r1 r2 t] is introduced, where λ is any non-zero constant, and H is the homography matrix with 8 unknowns, which are solved using the acquired chessboard calibration board images and extracted corner point information. Then, the properties of the rotation matrix R are used to establish constraint equations for the intrinsic parameter matrix A and the extrinsic parameters R and t. By solving these constraint equations, the camera's intrinsic parameter matrix A and the corresponding extrinsic parameters R and t for each image can be obtained. Maximum likelihood estimation is then used to iteratively optimize the parameter accuracy.
[0087] To more accurately describe the imaging process of a monocular camera, the effect of distortion needs to be considered. Using multiple images of the chessboard calibration board, the distortion coefficients are calculated using the least squares method. The distortion correction formula is as follows:
[0088] x corrected =x(1+k1r) 2 +k2r 4 +k3r 6 )+2p1xy+p2(r 2 +2x 2 (4)
[0089] y corrected =y(1+k1r) 2 +k2r 4 +k3r 6 )+2p2xy+p1(r 2 +2y 2 (5)
[0090] Where (x, y) represents the coordinates of the distorted image, and r represents the distance from point (x, y) to the center of the image. corrected y corrected ) are the corrected coordinates, with coefficients k1, k2 and k3 describing radial distortion and coefficients p1 and p2 describing tangential distortion.
[0091] By combining intrinsic and extrinsic parameters and distortion coefficients, the maximum likelihood method is used, and the LM algorithm is applied iteratively to find the optimal solution, thereby further improving the accuracy of parameter estimation.
[0092] S20: Acquire real-time video of the human body to be measured;
[0093] Specifically, when measuring height, a monocular camera is used to acquire real-time video of the person being measured, which is then placed horizontally with the camera facing the person to simplify the calculation process and improve accuracy.
[0094] S30: Preprocess the video;
[0095] Specifically, using the OpenCV library, the acquired real-time video of the human body to be measured is segmented into frames to obtain video images. Then, median filtering is used to remove noise and smooth the image. For each pixel in the image, the pixel value is replaced by the median of its neighboring pixels, calculated using the following formula:
[0096] g(x, y)=Median{f(xk, yl), (k, l∈W)} (5)
[0097] Where g(x, y) represents the pixel value at point (x, y) in the median-filtered image, f(xk, yl) represents the pixel value at point (xk, yl) in the original image, and k and l are offsets relative to the current point (x, y). W represents a two-dimensional template or window used to define the neighborhood range around the current pixel. In this way, median filtering can effectively eliminate noise in the image, especially salt-and-pepper noise, while preserving the edge information of the image.
[0098] For a point (x, y) in the median-filtered image, the normalized camera coordinates (x, y) after image distortion correction can be obtained using formulas (4) and (5). corrected y correctedThen, the intrinsic parameter matrix A of the monocular camera is used to transform the corrected coordinates to the image coordinate system, which is achieved by the following formula:
[0099] u′=f x ·x corrected +c x (6)
[0100] v′=f y ·y corrected +c y (7)
[0101] By iterating through each pixel in the filtered image and repeating the distortion correction and coordinate transformation process described above, we obtain an image with distortion eliminated. Each pixel has undergone precise correction and transformation, thereby eliminating pixel position shifts caused by lens distortion.
[0102] Convert the distortion-free BGR image to an RGB image:
[0103] Value(B,G,R)→Value(R,G,B)
[0104] Here, Value(B, G, R) represents the pixel value in BGR format, and Value(R, G, B) represents the pixel value in RGB format. This process is a rearrangement of the three color channels.
[0105] S40: Use MediaPipe to perform pose recognition and face detection on the preprocessed image containing the human body, and obtain key points of the human body and face, such as... Figure 3 As shown;
[0106] Specifically, MediaPipe is used to obtain keypoints from preprocessed images containing human figures, including:
[0107] S401: Use MediaPipe for pose recognition to obtain human key points;
[0108] The MediaPipe Pose model is initialized. This pre-trained model performs pose recognition tasks, extracting features from pre-processed images containing human figures using a convolutional neural network. It learns and extracts useful features for pose recognition from the original image through a series of convolutional layers, pooling layers, and non-linear activation functions. Based on feature extraction, the Pose model performs human pose estimation, identifying and labeling 33 key points of the human body, such as... Figure 3 As shown in (a).
[0109] S402: Use MediaPipe to perform face detection and obtain facial key points;
[0110] The pre-trained Face Mesh model from MediaPipe is loaded to identify and locate facial keypoints. MediaPipe first uses the BlazeFace face detector to locate the face region in the pre-processed image; its ultra-real-time performance allows it to accurately focus on the facial region. Once the face region is located, Face Mesh uses computer vision algorithms to extract feature information of that region, including edges, color, and texture. A template image containing the location information of the facial keypoints is used. By matching this template with the feature information of the input image, the system can determine the precise location of the facial keypoints. Simultaneously, Face Mesh uses methods such as normalized cross-correlation to calculate the matching degree, ensuring accurate keypoint localization. Once the facial keypoints are determined, they can be drawn, such as... Figure 3 As shown in (b).
[0111] S50: Calculates the pixel value of human height based on key points;
[0112] Specifically, in step S40, the coordinates of key points on the human body and face are obtained, and these key points are plotted in the image. The MediaPipe Pose model performs pose recognition to obtain human body key point information and extracts the pixel coordinates (u) of the left heel. left_heel v left_heel ) and the pixel coordinates of the right heel (u right_heel v right_heel Face detection is performed using MediaPipe's FaceMesh model to obtain facial landmark information and extract the pixel coordinates of the nose tip (u). nose v nose ) and brow bone pixel coordinates (u brow bone v brow bone ).
[0113] Reference Figure 4 According to the facial aesthetics principle of "three courts and five eyes," the three courts refer to the proportions of the face's length, dividing the face into three equal parts: from the hairline to the brow bone, from the brow bone to the tip of the nose, and from the tip of the nose to the chin, each accounting for one-third of the face's length. Specifically, the upper court refers to the distance from the hairline to the brow bone, i.e., the length of the forehead; the middle court refers to the distance from the brow bone to the base of the nose; and the lower court refers to the distance from the base of the nose to the chin. Ideally, the three courts and five eyes should be evenly spaced to conform to aesthetic standards, which helps determine the height and distance of the eyebrows, as well as the horizontal and vertical proportions of the face.
[0114] The pixel value h1 of the midface, which is 1 / 3 of the total face length, is calculated using the coordinates of the tip of the nose and the brow bone. The calculation formula is as follows:
[0115] h1 = v nose -v brow bone (8)
[0116] Furthermore, the distance h2 from the tip of the nose to the hairline can be calculated, which is the sum of the distances of the midface and upper face, and also 2 / 3 of the total length of the face. According to the facial aesthetics of "three courts and five eyes," it can be approximately considered to be twice the distance of the midface. The calculation formula is as follows:
[0117] h2 = 2 × h1
[0118] Simultaneously, the distance h5 between the nose tip coordinates and the left and right heel coordinates is calculated, and the lowest point of the body is considered to be the lowest point between the left and right heels. The calculation formula is as follows:
[0119] h3 = v left_heel -v nose (9)
[0120] h4 = v right_heel -v nose (10)
[0121] h5 = max(h3, h4) (11)
[0122] Where h3 represents the vertical pixel distance from the left heel to the tip of the nose, and h4 represents the vertical pixel distance from the right heel to the tip of the nose.
[0123] Based on the distance value obtained above, the pixel value h of the human height can be calculated. p The calculation formula is:
[0124] h p =h2+h5 (12)
[0125] S60: Uses a ranging module to obtain the distance between the human body and the camera in real time;
[0126] Specifically, the ranging module is placed horizontally and facing the human body, while being aligned with the monocular camera to measure the actual distance from the human body to the monocular camera in real time, and the measured distance value d is returned.
[0127] S70: Calculates the actual height of a person based on the pixel value of their height, combined with camera internal parameters and the distance between the person and the camera;
[0128] Specifically, based on the principles of camera imaging geometry, the relationship between three-dimensional coordinates in the world coordinate system and two-dimensional coordinates in the pixel coordinate system can be obtained, such as... Figure 5 As shown. The intrinsic and extrinsic parameter information of the monocular camera calibration obtained in step S10 is extracted. When calculating height, only the vertical distance in the y-direction is used; therefore, only the focal length f in the y-direction of the monocular camera needs to be extracted. y Based on the principle of pinhole imaging, the similar triangle method is used as shown in the following formula:
[0129]
[0130] Then, calculate the actual height of the human body, as shown in the diagram. Figure 6 As shown, the calculation formula is as follows:
[0131]
[0132] Among them, h r h represents the actual height of a person. p The pixel value represents the human body height, d represents the distance between the human body and the camera measured by the ranging module, and f represents the distance between the human body and the camera. y y represents the focal length of the monocular camera in the y-direction, and c represents the height correction factor.
[0133] It should be noted that the height correction coefficient c in the formula is obtained through experiments. Multiple sets of tests were conducted on people of different ages, genders, heights, and body types, and the optimal height correction coefficient c was obtained by fitting using the least squares method.
[0134] Reference Figure 7 This embodiment also provides a height measuring device, including:
[0135] The camera module 100 uses a calibrated monocular camera to acquire real-time video of the human body to be measured and transmit the video to the processing terminal. It should be noted that the specific method has been described in detail in steps S10 and S20 of the above embodiment of the real-time height measurement method based on key point detection, so it will not be repeated here.
[0136] The ranging module 200 is used to acquire the distance between the human body and the camera in real time and transmit the distance information to the processing terminal. It should be noted that the specific method has been described in detail in step S60 of the above embodiment of the real-time height measurement method based on key point detection, so it will not be repeated here.
[0137] The processing terminal 300 is used to preprocess the video, perform pose recognition and face detection on the preprocessed image using MediaPipe, obtain human body and facial key points, calculate the pixel value of human height based on the key points, and calculate the actual height of the human body by combining the distance information transmitted by the ranging module. It should be noted that the specific method has been described in detail in steps S30, S40, S50 and S70 of the above embodiment of the real-time height measurement method based on key point detection, so it will not be repeated here.
[0138] The first display module 400 is used to display human body video in real time and show the key point drawing results of posture recognition and face detection. It should be noted that the specific method has been described in detail in step S40 of the above embodiment of the real-time height measurement method based on key point detection, so it will not be repeated here.
[0139] The second display module 500 is used to display the actual height value of the human body calculated by the processing terminal in real time. It should be noted that the specific method has been described in detail in step S70 of the above embodiment of the real-time height measurement method based on key point detection, and therefore will not be repeated here.
[0140] It is understood that the present invention has been described through some embodiments, and those skilled in the art will recognize that various changes or equivalent substitutions can be made to these features and embodiments without departing from the spirit and scope of the invention. Furthermore, under the teachings of the present invention, these features and embodiments can be modified to adapt to specific situations and materials without departing from the spirit and scope of the invention. Therefore, the present invention is not limited to the specific embodiments disclosed herein, and all embodiments falling within the scope of the claims of this application are within the protection scope of the present invention.
Claims
1. A real-time height measurement method based on key point detection, characterized in that, Includes the following steps: Step S10: Calibrate the monocular camera to obtain its intrinsic and extrinsic parameters; Step S20: Acquire real-time video of the human body to be measured; Step S30: Preprocess the video; Step S40: Use MediaPipe to perform pose recognition and face detection on the preprocessed image containing the human body to obtain key points of the human body and face; Step S50: Calculate the pixel value of the human body height based on the key points; Step S50 specifically includes: Step S50-1: Based on the human posture key points obtained by MediaPipe posture recognition, extract the coordinates of the key points of the left heel and right heel; Step S50-2: Extract the coordinates of key points for the brow bone and nose tip based on the facial key points obtained from MediaPipe face detection; Step S50-3: Calculate the vertical pixel distance from the brow bone to the tip of the nose. According to the facial aesthetics of "three courts and five eyes", the pixel value of the middle court is 1 / 3 of the total length of the face. Step S50-4: Calculate the vertical pixel distance from the tip of the nose to the lower point of the left and right heels, ensuring that the obtained vertical distance is the larger one, i.e., the vertical distance from the tip of the nose to the ground. Step S50-5: Sum the vertical pixel distance from the tip of the nose to the ground with twice the pixel value of the midface to obtain the pixel value of the human height. Step S60: Use the ranging module to obtain the distance between the human body and the camera in real time; Step S70: Calculate the actual height of the human body based on the pixel value of the human body height, combined with the camera's intrinsic parameters and the distance between the human body and the camera.
2. The real-time height measurement method based on key point detection according to claim 1, characterized in that, Step S10 specifically includes: Step S10-1: Prepare a two-dimensional black and white checkerboard calibration plate and keep the calibration plate flat. Step S10-2: Place the calibration board within the shooting range of the monocular camera and take multiple shots from different angles and distances; Step S10-3: Use the OpenCV library to process the captured calibration board image and extract the coordinates of the black and white square corner points on the calibration board. Step S10-4: According to Zhang Zhengyou's calibration method, calculate the initial values of the camera's intrinsic and extrinsic parameters through the homography matrix, estimate the distortion coefficients using the nonlinear least squares method, and optimize the parameters using the maximum likelihood estimation method. Step S10-5: Obtain the intrinsic and extrinsic parameters of the monocular camera. The intrinsic parameters include the camera's focal length, principal point coordinates, and distortion coefficients. The extrinsic parameters include the rotation matrix and translation vector, which describe the camera's position and orientation in the world coordinate system.
3. The real-time height measurement method based on key point detection according to claim 1, characterized in that, Step S20 specifically includes: Place the monocular camera horizontally and face it directly at the human body, so that the front-back direction of the human body is consistent with the direction of the camera's line of sight.
4. The real-time height measurement method based on key point detection according to claim 1, characterized in that, Step S30 specifically includes: Step S30-1: Process the video in frames; Step S30-2: Apply median filtering to each frame of the image to remove noise while preserving the details and edge information of the image; Step S30-3: Perform distortion correction processing on the filtered image; Step S30-4: Convert the distortion-free image to red-green-blue format.
5. The real-time height measurement method based on key point detection according to claim 1, characterized in that, Step S40 specifically includes: Step S40-A1: Initialize the MediaPipe Pose model, which has been trained to perform pose recognition tasks; Step S40-A2: Load the preprocessed real-time video frame image containing the human body; Step S40-A3: The MediaPipe Pose model processes the input image, applies deep learning models and computer vision algorithms to detect key points in the image, and evaluates the positions of 33 reference points for human pose. Step S40-A4: Return the coordinates of the key points of the human posture and draw the identified key points on the image.
6. The real-time height measurement method based on key point detection according to claim 1, characterized in that, Step S40 further includes: Step S40-B1: Load the pre-trained Face Mesh model from MediaPipe to identify and locate key points on the face; Step S40-B2: Load the preprocessed real-time video frame image containing the face; Step S40-B3: Pass the preprocessed image to the Face Mesh model for inference, detect faces in the image, and locate the positions of key points; Step S40-B4: Return the coordinates of the facial key points and draw the detected facial key points on the image.
7. The real-time height measurement method based on key point detection according to claim 1, characterized in that, Step S60 specifically includes: Align the ranging module with the monocular camera and place it facing the human body, then return the measured distance between the human body and the camera.
8. The real-time height measurement method based on key point detection according to claim 1, characterized in that, Step S70 specifically includes: Extract the focal length from the intrinsic parameter information obtained from the monocular camera calibration; According to the principle of similar triangles, the following relationship exists: ; The actual height of a person can be calculated using the following formula: ; in, Indicates the actual height of the human body. Represents the pixel value of human height. This indicates the distance between the human body and the camera, as measured by the ranging module. This indicates the focal length of a monocular camera. This indicates the height correction factor.
9. A real-time height measurement device based on key point detection, characterized in that, include: The camera module uses a calibrated monocular camera to acquire real-time video of the human body to be measured and transmit the video to the processing terminal. The ranging module is used to obtain the distance between the human body and the camera in real time and transmit the distance information to the processing terminal; The processing terminal is used to preprocess the video, use MediaPipe to perform pose recognition and face detection on the preprocessed image, obtain human body and facial key points, calculate the pixel value of human body height based on the key points, and calculate the actual height of the human body by combining the distance information transmitted by the ranging module. The processing terminal is specifically used to calculate the pixel value of human height according to the following method: Based on the human posture key points obtained by MediaPipe posture recognition, extract the coordinates of key points of the left heel and right heel; Based on the facial landmarks obtained from MediaPipe face detection, extract the coordinates of the key points of the brow bone and the tip of the nose. Calculate the vertical pixel distance from the brow bone to the tip of the nose. According to the facial aesthetics of "three courts and five eyes", the pixel value of the middle court is used, which accounts for 1 / 3 of the total length of the face. Calculate the vertical pixel distance from the tip of the nose to the lower point of the left and right heels, ensuring that the obtained vertical distance is the larger vertical distance, i.e., the vertical distance from the tip of the nose to the ground. The pixel value of human height is obtained by summing the vertical pixel distance from the tip of the nose to the ground with twice the pixel value of the midface. The first display module is used to display human body videos in real time and show the key point drawing results of posture recognition and face detection; The second display module is used to display the actual height value of the human body calculated by the processing terminal in real time.