System and method for human motion capture using RGB camera
By using RGB cameras and deep learning technology, combined with a bidirectional GRU network and a virtual character model processing module, it solves the problems of high cost and complex operation of existing motion capture equipment, and achieves efficient and accurate human body three-dimensional posture estimation and motion capture.
Patent Information
- Application Number
- CN202210084865.5
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2022-01-25
- Publication Date
- 2024-09-24
- Estimated Expiration
- 2042-01-25
AI Technical Summary
Existing motion capture equipment is mainly based on infrared light and inertia equipment. It has the problems of being expensive, complex to operate, and limited in applicable scenarios. It is difficult to effectively reduce the cost of obtaining three-dimensional posture data of the human skeleton and simplify the operation steps.
Using an RGB camera combined with deep learning and a bidirectional GRU network, the three-dimensional posture of the human body is obtained by constructing a posture feature extraction network and a bidirectional GRU network, and the virtual character model spatial positioning and posture redirection processing module is used to perform spatial positioning and posture redirection of the virtual character model. , to achieve human body motion capture.
It reduces hardware costs, simplifies operating steps, improves the anti-interference performance of the equipment, adapts to the motion capture needs of different venues, and achieves high-precision human body three-dimensional posture estimation and motion capture.
Smart Images

Figure CN114495274B
Abstract
Description
Technical Field
[0001] The present invention relates to the technical fields of motion capture, computer vision and human posture estimation, and in particular to a system and method for realizing human motion capture using an RGB camera. Background Art
[0002] In the production process of film, television, animation and game works, it is often necessary to use the three-dimensional posture data of the human skeleton to synthesize special effects. This kind of three-dimensional posture data is generally completed using motion capture equipment. At this stage, motion capture equipment is mainly based on infrared light motion capture equipment and inertia-based motion capture equipment. There are problems such as high price, complex operation and limited applicable scenarios. These problems greatly increase the cost of obtaining three-dimensional posture data of the human skeleton. In response to these problems, the market and users have put forward new requirements for motion capture equipment and methods, such as reducing hardware costs, simplifying operating steps, and improving the anti-interference performance of equipment to adapt to different venues. In recent years, artificial intelligence technology has developed rapidly, and solutions using artificial intelligence technology to solve computer vision problems have become increasingly mature, and related motion capture solutions have also emerged. After searching and consulting materials, motion capture solutions based on computer vision technology and deep learning technology can be divided into three categories:
[0003] The first category uses a three-dimensional computer vision method to obtain three-dimensional posture data of the human body and applies it to human motion capture. This type of method is based on the characteristic that three-dimensional vision can eliminate the uncertainty in the depth direction of the camera, establish a mathematical model of the image and the three-dimensional posture of the human body, and then use the estimated three-dimensional posture of the human body for human motion capture. This type of solution includes Chinese patent number CN110633005A, publication date: December 31, 2019, patent name: an optical markerless three-dimensional human motion capture method, which extracts two-dimensional coordinate information of human joints from two-dimensional joints of multi-angle human images, and uses the coordinate system conversion relationship and the two-dimensional information of joints to draw a human skeleton model in three-dimensional space. Chinese patent number CN112215928A, publication date: January 12, 2021, patent name: motion capture method and digital animation production method based on visual images, which obtains human motion images of multi-angle cameras, analyzes human motion images at different angles to obtain human joint coordinates, and calculates human joint coordinates at different angles to obtain three-dimensional joint coordinates. Chinese Patent Number: CN202110194157.2, Publication Date: June 4, 2021, Patent Name: A multi-RGB camera real-time human motion capture system that introduces a feedback mechanism. The method uses multiple industrial RGB cameras to capture human images, and uses multi-camera constraints to obtain the three-dimensional posture of the human body. The shape and posture parameters of the human linear skin model are adjusted through feedback mechanisms and image processing methods, but redirection of different skeletons is not performed, and it is not suitable for motion capture scenarios.
[0004] The second category uses deep learning methods to obtain the three-dimensional posture of the human body from a single image and applies it to the task of human motion capture. This type of method obtains the mapping relationship between the human body features or two-dimensional joint features in the image and the three-dimensional posture of the human body by constructing a neural network and training the neural network with a data set. This type of solution includes Chinese patent number CN202110786865.5, publication date: October 8, 2021, patent name: motion capture system and method, which can accurately detect and track multiple targets through sufficient multi-view scene information, effectively eliminate the influence of occlusion and scene range constraints, and provide more accurate motion data. Chinese patent number: CN202011279648.9, publication date: June 19, 2021, patent name: A method and system for correcting a digital twin model based on machine vision, which estimates the three-dimensional posture of a digital twin motion model based on image recognition and motion capture, and uses the digital twin motion model after posture estimation for human motion capture tasks.
[0005] The third category uses deep learning methods to obtain the three-dimensional posture of the human body from a continuous image sequence and is used for human motion capture tasks. This type of method simultaneously considers the human body posture information of a single frame image and the posture continuity characteristics in the image sequence to perform human motion capture tasks. This type of solution includes Chinese patent number CN109145788B, publication date: July 7, 2020, patent name: video-based posture data capture method and system, the method extracts the two-dimensional coordinate data of the human body contained in the video based on a neural network model, and determines the three-dimensional coordinate data corresponding to the two-dimensional coordinate data, and finally determines the corresponding three-dimensional coordinate data in the preset three-dimensional space. Chinese patent number: CN112215160A, publication date: January 12, 2021, patent name: a video three-dimensional human body posture estimation algorithm using long-term and short-term information fusion, the algorithm uses a convolutional neural network to obtain the human body two-dimensional skeleton posture coordinate sequence in the video, and then reconstructs and outputs the human body three-dimensional posture corresponding to the central frame of this sequence, and splices the human body three-dimensional posture to output the three-dimensional human body posture sequence corresponding to the video. Chinese Patent Number: CN202110240172.6, Publication Date: May 25, 2021, Patent Name: Monocular 3D human posture unsupervised learning method, system and medium. This method uses a bone length estimation network to obtain the human skeleton and applies an attention mechanism to fine-tune the skeleton, but does not redirect different skeletons. It is not suitable for motion capture scenarios. Summary of the invention
[0006] In order to solve the problems in the above scheme, the present invention proposes a system and method for human motion capture using an RGB camera. The system comprises:
[0007] The human body 3D posture estimation module is used to capture human body image sequences using an RGB camera and obtain human body 3D posture estimation data by building a posture feature extraction network and a bidirectional GRU network;
[0008] A virtual character model spatial positioning processing module is connected to the human body three-dimensional posture estimation module and is used to perform spatial positioning processing of the virtual character model through the human body three-dimensional posture estimation data and the virtual character skeleton data;
[0009] A virtual character model posture redirection processing module is connected to the human body three-dimensional posture estimation module and the virtual character model space positioning processing module, and is used to perform posture redirection processing of the virtual character model through the human body three-dimensional posture estimation data and the virtual character skeleton data; and
[0010] The human motion capture output module is connected to the virtual character model posture redirection processing module and is used to obtain the position and posture of the current character according to the acquired spatial positioning data and posture redirection data of the virtual character model.
[0011] The system also includes: an RGB camera, a light source, a cloud server and a terminal computer. The RGB camera is connected to the terminal computer and is responsible for collecting continuous human body images. The cloud server establishes a network connection with the terminal computer and is responsible for completing the human motion capture task. The terminal computer completes the interactive operation with the user.
[0012] To achieve the above object, the present invention also includes a method for capturing human motion using an RGB camera using the above system, the main feature of which is that it includes the following steps:
[0013] Step 1: constructing a model 1 for enabling the human body three-dimensional posture estimation module to obtain the feature data required for the current human body posture estimation task;
[0014] Step 2: constructing a second model for enabling the virtual character model space positioning processing module to obtain feature data required for the current virtual character model space positioning and the virtual character model posture redirection processing module posture redirection task;
[0015] Step 3: using the model 1 and the model 2 to be applied to the human motion capture output module to perform human motion capture processing;
[0016] Step 4: Build a human motion capture system platform based on the acquired human body 3D posture estimation data to display and process the human body posture data.
[0017] In step 1, model 1 is a human posture estimation model based on a deep learning method, whose input is an image sequence, and whose output is a human 3D posture sequence matching the input image sequence. The specific operation steps for obtaining model 1 are as follows:
[0018] Step 1-1: Use the residual block to build a posture feature extraction network, which is used to extract the spatial distribution feature vector of the specified human body two-dimensional posture from a single frame image; input T frame images into the existing human body two-dimensional posture detector in sequence to obtain the human body two-dimensional posture sequence of the T frame images, and perform z-score normalization on the human body two-dimensional posture to obtain a standardized human body two-dimensional posture sequence The standardized human body two-dimensional posture sequence The postures in the figure are sequentially input into the posture feature extraction network to obtain the two-dimensional posture spatial distribution feature vector of the human body;
[0019] Step 1-2: Build a bidirectional GRU network with a sequence length of T, input the two-dimensional human posture spatial distribution feature vector of the T-frame image obtained in step 1-1, the bidirectional GRU network is used to learn the temporal distribution characteristics of the human posture, and the bidirectional GRU network outputs the z-score standardized human posture depth value sequence of the T-frame image Wherein, Z represents the depth direction represented by the positive direction of the camera optical axis;
[0020] Step 1-3: The human body posture depth sequence obtained from step 1-2 Compare the depth of each posture with the standardized human 2D posture sequence The corresponding two-dimensional human body posture is vector spliced according to the following formula to obtain the output value of the model 1, that is, the three-dimensional human body posture sequence
[0021]
[0022] in, yes The estimated value of the t-th standardized human 3D posture in, and are the coordinates of the standardized two-dimensional posture of the human body, is the human body posture depth sequence The tth standardized human body 3D posture depth value;
[0023] Step 1-4: Construct the loss terms L1 and L2 of the model 1. The loss term L1 is the Euclidean distance between the estimated value and the true value of the human body 3D posture depth value sequence, which is used to constrain the learning of spatial distribution features. The loss term L2 is designed based on the constraint condition of posture synchronization change. It is assumed that the estimated value change of the human body 3D posture depth value of two adjacent frames is the same as the true value change, thereby constraining the learning of time distribution features. The two loss terms are shown in the following formulas:
[0024]
[0025]
[0026] Among them, T is the sequence length, N is the number of joint points, Represents the estimated value of the depth value of the joint point numbered j in the tth posture of the sequence, Indicates the true value of the depth value of the joint point numbered j in the tth frame of the sequence;
[0027] Step 1-5: Based on the steps 1-4, the loss function L of the model 1 is constructed. The loss function L is shown in the following formula:
[0028] L=αL1+βL2
[0029] Where α and β are hyperparameters of the loss function;
[0030] Step 1-6: Obtain a human three-dimensional pose data set known to technical personnel in this field, extract pairs of human two-dimensional poses and human three-dimensional poses as training samples from the training set in the human three-dimensional pose data set, and use the calculation formula of the loss function L to train the model one. After the training, obtain the parameter file of the model one and save it to the disk of the cloud server.
[0031] In step 2, model 2 is a two-stage nonlinear optimizer that combines a human skeleton kinematic model and a reliable joint point set, and is used for the virtual character model spatial positioning and posture redirection tasks. The specific steps for obtaining model 2 are as follows:
[0032] Step 2-1: Define the human skeleton matrix based on the skeleton topology 3D S is the joint concatenation vector composition, Represents the joint cascade vector from the parent joint numbered i to the child joint numbered j, taking the posture in the middle of the queue in the human 3D posture sequence output by the model 1 to construct the human skeleton matrix of the original skeleton 3D S, virtual character skeleton matrix 3DS′ is obtained by the virtual character model input by the user, and the virtual character model must conform to the Humanoid standard;
[0033] Step 2-2: According to the skeleton topology, the angles of adjacent bones of the original skeleton are calculated from the human skeleton matrix, and the bone angles of the virtual character skeleton are set to the bone angles corresponding to the original skeleton in turn, and the corresponding three-dimensional posture is calculated according to the target skeleton matrix;
[0034] Step 2-3: Use the neck joint, left shoulder joint, right shoulder joint, left hip joint and right hip joint as the reliable joint point set J, and use the reliable joint point set J to construct the objective function E1 of the first stage. This objective function is used to optimize the position vector r of the root joint of the virtual character skeleton in the camera coordinate system. First, apply forward kinematics to the joint angles of the virtual character skeleton to obtain the reliable joint point coordinates, and then transform all the reliable joint point coordinates to the camera coordinate system through the position vector r. Finally, construct the reprojection error, as shown in the following formula:
[0035] E1(r)=argmin||Π(F J ( 3D θ, 3D S)+r)- 2D J||
[0036] Where Π is the reprojection function, F J is the forward kinematics function applicable to J, 3D θ is the bone angle vector of the virtual character skeleton;
[0037] Step 2-4: Construct the objective function E2 of the second stage, which is used to optimize the posture of the virtual character skeleton. First, forward kinematics is applied to obtain the three-dimensional posture of the virtual character skeleton. Then, the three-dimensional position of the virtual character skeleton is obtained from the position vector of the root joint in the camera coordinate system. Finally, the reprojection error is constructed, as shown in the following formula:
[0038] E2( 3D θ)=argmin||Π(F( 3D θ, 3D S)+r)- 2D J|| 2
[0039] Step 2-5. Use the Levenberg-Marquardt nonlinear optimization algorithm to construct a two-stage optimizer with the objective function E1 and the objective function E2, where the quantity to be optimized is 3D θ and r.
[0040] In step 3, the detailed steps of constructing a human motion capture method using model 1 and model 2 are as follows:
[0041] Step 3-1: Construct an image queue Q with a length of T. Each time a frame of image is read, the image is added to the end of the image queue Q. If the length of the image queue exceeds T, the image at the head of the image queue Q is discarded.
[0042] Step 3-2: Use the existing human body 2D posture detector to obtain the human body 2D posture from the image at the end of the image queue Q, and convert the human body 2D posture 2D P t Store in temporary queue temp Q, if temp If the length of Q is greater than T, the 2D posture of the human body at the head of the team is discarded;
[0043] Step 3-3: Add the temporary queue of step 3-2 temp The human body 2D posture queue is constructed by subtracting the root joint coordinates from the human body 2D posture in Q Use z-score normalization method to obtain standardized human 2D posture queue And input the model 1 to obtain the corresponding human body three-dimensional posture depth value queue And obtain the standardized human 3D posture queue according to the following formula
[0044]
[0045] Step 3-4: According to the topological relationship of the human skeleton, obtain its skeleton matrix from the virtual character model 3D S′;
[0046] Step 3-5: 3D human body posture queue obtained in step 3-3 Constructing the human skeleton matrix 3D S, will 3D S is input into the model 2, and the virtual character skeleton matrix obtained in steps 3-4 is 3D S′ is input into the model 2, and the optimization result of the previous frame is taken as the initial value, that is, 3D θ t-1 and r t-1 ,like 3D θ t-1 and r t-1 If it does not exist, 3D θ t The initial value is the joint angle of T-Pose, r t The initial value is the vector value of 1 meter along the positive direction of the RGB camera optical axis, and the model 2 is run to obtain the redirected three-dimensional posture of the virtual character, which is located in the camera coordinate system.
[0047] In step 4, the detailed steps of constructing a human motion capture system using the constructed human 3D pose estimation method are as follows:
[0048] Step 4-1: Select an RGB camera with a resolution of no less than 720P, connect the RGB camera to the terminal computer, and establish a network connection between the terminal computer and the cloud server;
[0049] Step 4-2: The terminal computer reads the parameter configuration file of the RGB camera and uploads it to the cloud server;
[0050] Step 4-3: The terminal computer sequentially reads the images captured by the RGB camera and uploads them to the cloud server;
[0051] Step 4-4: the cloud server receives the image sent by the terminal computer, runs the human body three-dimensional posture estimation module and performs human body motion capture processing, obtains the virtual character three-dimensional posture corresponding to the human body in the image through the virtual character model space positioning processing module and the virtual character model posture redirection module, and sends it to the terminal computer through the human body motion capture output module;
[0052] Step 4-5: The terminal computer calls the local rendering engine according to the received virtual character posture data to display the posture data on the interactive interface.
[0053] Compared with the prior art, the system and method for human motion capture using an RGB camera of the present invention have the following outstanding technical effects:
[0054] 1. Model 1 can directly estimate the depth value of the human body's shutdown point coordinates in the camera coordinate system from the image sequence, and combine the human body's two-dimensional posture to obtain the human body's three-dimensional posture, which greatly reduces the difficulty of model training. A bidirectional GRU network and a loss function are used to smooth the human body's three-dimensional posture, and RGB cameras with a resolution of not less than 720P are easier to obtain than industrial cameras, reducing hardware costs.
[0055] 2. In the first stage of model 2, a reliable joint point set is used to design an optimizer to reduce the adverse effects of the estimation errors of the limb joint points on the estimation of the human skeleton position, thereby reducing the jitter of the human skeleton position in the direction of the optical axis of the RGB camera.
[0056] 3. The second stage of model 2 combines the Levenberg-Marquardt nonlinear optimization algorithm and human skeleton kinematics to design an optimizer, and performs skeleton redirection between two skeletons with different bone lengths. When building the optimizer, forward kinematics is used to determine the position of the target skeleton joint points. During iterative optimization, inverse kinematics is used to adjust the bone angles of the target skeleton to meet the conversion from the real human 3D posture to the virtual character 3D posture, which meets the requirements for human motion capture scenes known to people in this field. BRIEF DESCRIPTION OF THE DRAWINGS
[0057] Figure 1 It is a flow chart of the present invention using an RGB camera to capture human motion.
[0058] Figure 2 It is a schematic diagram of a model-posture feature extraction network and a bidirectional GRU network according to an embodiment of the present invention.
[0059] Figure 3 It is a schematic diagram of the topological relationship of human joints and the definition of joint point numbers according to the second embodiment of the present invention.
[0060] Figure 4 It is a schematic diagram of the third embodiment of the present invention for calculating the angle of the joint cascade vectors corresponding to the connected bones.
[0061] Figure 5 It is a schematic diagram of an application scenario of a human motion capture system according to a fourth embodiment of the present invention.
[0062] Figure 6 It is a schematic diagram of the camera optical center and the ground height of the RGB camera according to the fourth embodiment of the present invention. DETAILED DESCRIPTION
[0063] The present invention is further described in detail below in conjunction with the accompanying drawings and preferred embodiments, but the protection scope of the present invention is not limited to the following specific embodiments. Obviously, the described embodiments are only part of the embodiments of the present application, rather than all of the embodiments. Based on the embodiments in the present application, all other embodiments obtained by ordinary technicians in the field without making creative work should fall within the scope of protection of the present application.
[0064] Unless otherwise defined, all professional terms used below have the same meanings as those generally understood by those skilled in the art. The professional terms used herein are only for the purpose of describing specific embodiments and are not intended to limit the scope of protection of the present invention.
[0065] Embodiment 1:
[0066] The embodiment describes a specific method for obtaining model 1 and its model parameter file using a deep learning framework. This embodiment takes the Pytorch framework known to those in the field as an example, but the operation procedure of this embodiment is also applicable to other deep learning frameworks. The operation procedure is as follows:
[0067] (1) Build a posture feature extraction network and a bidirectional GRU network.
[0068] (2) The z-score normalization method is used to construct training and test sets from the human 3D pose dataset.
[0069] (3) Train and evaluate the performance of model 1 based on procedures (1) and (2).
[0070] The specific steps of the operation procedure (1) are as follows:
[0071] Step 1-1. According to Figure 2 The description of posture feature extraction network is constructed. The network consists of a linear layer as the input layer, followed by a series of residual blocks. The residual block consists of three linear layers, a BatchNorm layer and a Dropout layer in series. The activation function is the tanh function, and the residual connection method is direct parallel. The parameters of the Dropout layer refer to Table 1.
[0072] Step 1-2. According to Figure 2 Description: After the posture feature extraction network, two layers of bidirectional GRU structures are connected in series. The sequence length of the two layers of bidirectional GRU is set to T, which is consistent with the number of posture extraction branch networks. Finally, a linear layer is connected in series as the output layer of model one.
[0073] Table 1 Model 1 hyperparameter comparison table
[0074]
[0075] The specific steps of the operation procedure (2) are as follows:
[0076] Step 2-1. Obtain paired human 2D poses and human 3D poses from the human 3D pose dataset, subtract the coordinates of the hip joint, and obtain the human 2D pose relative to the hip joint. 2D P k and human body 3D posture 3D P k , k represents the kth data in the data set, and the joint point number of the human body 2D posture is as follows Figure 3 As shown;
[0077] Step 2-2. Use the z-score standardization method to standardize the human body's two-dimensional posture and three-dimensional posture to obtain the standardized human body two-dimensional posture and standardized human 3D posture The specific method of z-score standardization is shown in the following formula:
[0078]
[0079]
[0080] Where σ(*) represents the operation of standard deviation;
[0081] Step 2-3. Obtain the component along the positive direction of the RGB camera optical axis from T standardized human 3D postures, that is, [1,T], from T consecutive standardized human 2D poses and corresponding T Build a sample;
[0082] Step 2-4. According to step 2-1 to step 2-3, obtain a human body three-dimensional pose data set, use each sample in the training set and test set in the human body three-dimensional pose data set obtained by step 2-3, and use the Pytorch framework to write a sample loading method for the training set and test set.
[0083] The specific steps of the operation procedure (3) are as follows:
[0084] Step 3-1. Use the Pytorch framework to build a neural network optimizer using the stochastic gradient descent method. The optimizer hyperparameters are set according to Table 1.
[0085] Step 3-2. Obtain the training set sample loading method described in the operation procedure (2), use the training set to train model 1, and construct a loss function based on the Euclidean distance error of the joint points and the constraint condition of synchronous posture change. Since model 1 only estimates the three-dimensional posture of the human body and obtains its component along the positive direction of the RGB camera optical axis, the loss function degenerates from the Euclidean distance in three-dimensional space to a scalar distance:
[0086]
[0087]
[0088] L=αL1+βL2
[0089] Where T is the sequence length, N is the number of joint points, Represents the estimated value of the coordinates of the joint point numbered j along the RGB camera optical axis component in the t-th pose of the sequence, Indicates the true value of the coordinates of the joint point numbered j along the optical axis component of the RGB camera in the tth frame of the sequence. In this embodiment, N=15. α and β are hyperparameters of the loss function. The values are referenced in Table 1. During the training process, the convergence of the loss function is taken as the starting point, and the training is continued for 10 rounds. If the loss function still converges, the training is stopped, and the parameter file of model 1 is saved to the cloud server disk with the suffix ".pth";
[0090] Step 3-3. Use the Pytorch framework to load the model parameter file obtained in step 3-2, obtain the training set sample loading method described in operation procedure (2), and use the test set obtained in operation procedure (2) to evaluate the performance of model 1. The evaluation index is the average joint position error. The value of T should make the evaluation index the lowest. In this embodiment, when T=9, it has the lowest evaluation index. Therefore, in the embodiments described below, unless otherwise specified, the value of T is consistent with this embodiment.
[0091] Embodiment 2:
[0092] The embodiment describes a specific method for obtaining Model 2. This embodiment is built using Ceres, a nonlinear optimization function library known to those skilled in the art. However, this embodiment can also be operated using other nonlinear optimization function libraries. The difference in which function library is used is only in the different ways of writing the program code. The operation procedure is as follows:
[0093] (1) Construct the skeleton matrices of the human body and virtual character models respectively, and establish the forward kinematic relationship of the virtual character.
[0094] (2) Construct the optimizer for obtaining the position vector of the virtual character skeleton in the camera coordinate system in the first stage of model 2.
[0095] (3) Constructing Model 2 In the second stage, an optimizer is used to optimize the virtual character's posture using inverse kinematics.
[0096] The specific steps of the operation procedure (1) are as follows:
[0097] Step 1-1. Define the human skeleton matrix according to the relationship between joint cascade vectors and joint numbers in Table 2 3D S is the joint concatenation vector composition, Represents the joint cascade vector from the parent joint numbered i to the child joint numbered j;
[0098] Step 1-2. Obtain the intermediate posture of the human body 3D posture sequence output by model 1, and construct the human body skeleton matrix of the original skeleton according to the definition of the skeleton matrix in step 1-1 3D S;
[0099] Step 1-3. Obtain a virtual character model that meets the Humanoid standard, use a 3D rendering engine to parse the model's skeleton information, and construct the virtual character's skeleton matrix based on the definition of the skeleton matrix in step 1-1 3D S′.
[0100] Table 2 Joint cascade vector and joint comparison table
[0101]
[0102] The specific steps of the operation procedure (2) are as follows:
[0103] Step 2-1. The operation procedure (1) calculates the angle of each bone in the human skeleton according to the following formula, sets the bone angle of the virtual character to the angle of the human skeleton, and applies the forward kinematics of the human skeleton to obtain the three-dimensional posture of the virtual character;
[0104]
[0105] The above formula describes the joint cascade vector connected by joint number j and The method for calculating the bone angle θ is: Figure 4 Describes the calculation of the joint cascade vector and Schematic diagram of the angle between them;
[0106] Step 2-2. Use the neck joint, left shoulder joint, right shoulder joint, left hip joint and right hip joint as the reliable joint point set J, and use J to construct the objective function E1 based on the reprojection error, as shown in the following formula:
[0107] E1(r)=argmin||Π(F J ( 3D θ, 3D S)+r)- 2D J||
[0108] Where Π is the reprojection function, F J is the forward kinematics function applicable to J, 3D θ is the bone angle vector of the virtual character skeleton. This objective function is used to optimize the position vector r of the virtual character skeleton hip joint in the camera coordinate system;
[0109] Step 2-3. Based on the objective function constructed in step 2-2, a human position optimizer is constructed using the Levenberg-Marquardt nonlinear optimization algorithm known to those in the field. This optimizer is the first stage of model 2. The quantity to be optimized is the position vector r of the current frame, i.e., the tth frame. t , the initial value is the position vector of the previous frame, i.e. r t-1If the position vector at the previous moment does not exist or cannot be obtained, the position vector at 1 meter in the positive direction of the RGB camera optical axis is used as the initial value.
[0110] The specific steps of the operation procedure (3) are as follows:
[0111] Step 3-1. The optimizer constructed by the operation procedure (2) obtains the position vector of the hip joint of the virtual character skeleton in the camera coordinate system, and uses the position vector to transform the virtual character skeleton to the camera coordinate system to obtain the three-dimensional pose of the virtual character;
[0112] Step 3-2. Construct an objective function E2 as shown in the following formula, which is used to optimize the three-dimensional posture of the virtual character, and apply inverse kinematics to reduce the influence of the difference in bone length between the virtual character skeleton and the human skeleton on the position of the joint points after posture redirection:
[0113] E2( 3D θ)=argmin||Π(F( 3D θ, 3D S)+r)- 2D J|| 2
[0114] Where F is the forward kinematics function applicable to all joints, 3D θ is the bone angle vector of the virtual character skeleton. The quantity to be optimized by the optimizer is the virtual character 3D θ, the initial value is the bone angle vector constructed using the three-dimensional posture of the virtual character in step 3-1.
[0115] Step 3-3. Based on the objective function E2 described in step 3-2, a forward kinematics attitude optimizer is constructed using the Levenberg-Marquardt nonlinear optimization algorithm. The optimizer is the second stage of model 2.
[0116] Step 3-4. Construct a running program of model 2, which uses the operation program (1) to construct a skeleton matrix from the input three-dimensional human body posture and the virtual character model, and connects the optimizer described in the operation program (2) and the operation program (3) in series to obtain the three-dimensional posture of the virtual character;
[0117] Embodiment three:
[0118] The embodiment describes a method for constructing a human motion capture program using model one and model two. The specific operation procedure is as follows:
[0119] (1) Obtain model 1 and model 2, where model 1 needs to obtain its model parameter file.
[0120] (2) Use a human body posture 2D detector to obtain the 2D posture of the human body in the image.
[0121] (3) Input the two-dimensional posture sequence of the human body into model 1 to obtain the three-dimensional posture queue of the human body.
[0122] (4) Input the human body 3D posture sequence into Model 2 to obtain the 3D position and posture of the virtual character.
[0123] The specific steps of the operation procedure (1) are as follows:
[0124] Step 1-1. According to the operating procedure described in Example 1, the deep learning framework described in Example 1 is used to build the acquisition program of Model 1, and the training set and test set are constructed using the human body three-dimensional posture data set. The training and evaluation of Model 1 are performed according to the description of Example 1. After the training and evaluation, the model parameter file of Model 1 is obtained;
[0125] Step 1-2. According to the operating procedure described in Example 1, use the deep learning framework to build the operation program of Model 1;
[0126] Step 1-3. According to the operation procedure described in Example 2, use the nonlinear optimization function library to build the operation program of Model 2.
[0127] The specific steps of the operation procedure (2) are as follows:
[0128] Step 2-1. Construct image queue Q and standardized human 2D pose queue The capacities are all set to the T value of Example 1;
[0129] Step 2-2. Obtain a frame of image, perform mean filtering on the image, and place the filtered image directly at the end of the queue Q. If the queue length is greater than T, the image at the head of the queue is discarded to achieve rolling update of the queue. In this embodiment, unless otherwise specified, the value of T is consistent with that in the first embodiment, that is, T=9;
[0130] Step 2-3. Input the tail image of queue Q into the existing human body 2D posture detector, obtain the human body 2D posture in the tail image, and place the second human body 2D posture in the temporary queue temp At the end of queue Q, if its queue length is less than T, repeat steps 2-3 until the queue length is T; if the queue length is greater than T, discard the two-dimensional posture of the human body at the head of the queue to achieve rolling update of the queue.
[0131] The specific steps of the operating procedure (3) are as follows:
[0132] Step 3-1. Set the temporary queue temp Subtract the coordinates of the hip joint from the t-th frame pose in Q to get the corresponding two-dimensional pose of the human body 2D P t, and perform z-score normalization according to formula (1) to obtain the corresponding standardized human body two-dimensional posture Save it as the tail element to the standardized human 2D posture queue
[0133] Step 3-2. Standardize the human body 2D posture queue Input into model 1 to obtain the corresponding human body 3D posture depth value queue And obtain the standardized human 3D posture queue according to the following formula
[0134]
[0135] The specific steps of the operation procedure (4) are as follows:
[0136] Step 4-1. Load the virtual character model, use the 3D rendering engine to extract the skeleton information, and construct the skeleton matrix of the virtual character according to Table 1 3D S′;
[0137] Step 4-2. The standardized human body three-dimensional posture queue obtained by operation procedure (3) Constructing the skeleton matrix 3D S is input into model 2, and the RGB camera parameters and the virtual character skeleton matrix obtained in step 4-1 are 3D S′ is input to Model 2, which completes the human body posture redirection and skeleton positioning, and obtains the three-dimensional pose of the virtual character corresponding to the human body in the camera coordinate system.
[0138] Embodiment 4:
[0139] This embodiment describes the steps of building an RGB camera human motion capture system. The RGB camera can use industrial cameras and network cameras, and the lens resolution is not less than 720P. The specific operation procedures are as follows:
[0140] (1) Construct the human body 3D posture estimation module on the cloud server and deploy the model 1 in the module.
[0141] (2) Constructing the virtual character model spatial position positioning processing module and the virtual character model posture redirection module on the cloud server, and deploying the two optimizers of the model 2 in these two modules in turn.
[0142] (3) Establish communication between the RGB camera, terminal computer and cloud server.
[0143] (4) Build a human motion capture output module on the cloud server and send the three-dimensional posture data of the virtual character to the terminal computer.
[0144] The specific steps of the operation procedure (1) are as follows:
[0145] Step 1-1. Save the model parameter file obtained by training model 1 to the cloud server disk;
[0146] Step 1-2. According to the human body three-dimensional posture estimation method described in Example 3, write a program to run model one to build the human body three-dimensional posture estimation module, generate an executable file and save it to the cloud server disk, load the model parameter file of model one from the cloud server when running the program, and start the human body three-dimensional posture estimation module.
[0147] The specific steps of the operation procedure (2) are as follows:
[0148] Step 2-1. According to the human body three-dimensional posture estimation method described in Example 3, write the program of the first stage optimizer of model 2 to build a virtual character model spatial position positioning processing module;
[0149] Step 2-2. According to the human body three-dimensional posture estimation method described in Example 3, write a program for the second stage optimizer of Model 2 to build a virtual character model posture redirection module.
[0150] The specific steps of the operation procedure (3) are as follows:
[0151] Step 3-1. Connect the RGB camera to the terminal computer. If you use an industrial RGB camera, connect it according to its operating instructions. If you use a network RGB camera, connect it directly via a USB cable. Fix the RGB camera on a tripod placed on the ground. Figure 5 The RGB camera and light source are placed as shown, and the terminal computer is a PC at this time;
[0152] Step 3-2. Adjust the position and posture of the RGB camera so that the pitch angle of the positive direction of the optical axis is 0°±5°, and the height of the optical center from the ground is such that the RGB camera can capture a complete human image. Appropriate adjustments can be made according to the height of the human body. In this embodiment, the height is 1.25 meters. Figure 6 As shown;
[0153] Step 3-3. Adjust the height and angle of the light source so that the human body receives even illumination without shadows or highlights.
[0154] Step 3-4. Obtain the internal parameters of the RGB camera. If the parameters cannot be obtained directly from the nameplate or operating manual, obtain the internal parameters according to Zhang Zhengyou's camera calibration method. The reprojection error of the calibration result should be less than 0.01 pixel.
[0155] Step 3-5. Start the program described in the operating procedure (1) on the cloud server to establish a connection between the terminal computer and the cloud server.
[0156] The specific steps of the operation procedure (4) are as follows:
[0157] Step 4-1. Use a 3D rendering engine to build a human motion capture output module on the terminal computer;
[0158] Step 4-2. The terminal computer loads the virtual character model data, calculates the virtual character skeleton matrix, and sends the skeleton matrix to the cloud server;
[0159] Step 4-3. The terminal computer acquires an image from the RGB camera and sends it to the cloud server. The cloud server caches the image to the image queue and sequentially runs the human body three-dimensional posture estimation module, the virtual character model spatial position positioning processing module and the virtual character model posture redirection module described in Example 3. The program obtains the three-dimensional posture of the virtual character skeleton in the camera coordinate system from the image queue and the virtual character skeleton matrix obtained in step 2-4, and sends the three-dimensional posture to the terminal computer;
[0160] Step 4-4. The terminal computer receives the three-dimensional posture data of the virtual character sent by the cloud server in step 4-3, and runs the human motion capture output module to map the posture data to the virtual character and draw it to the interactive interface.
[0161] Compared with the prior art, the system and method for human motion capture using an RGB camera of the present invention have the following outstanding technical effects:
[0162] 1. Model 1 can directly estimate the depth value of the human joint coordinates in the camera coordinate system from the image sequence, and combine the human body's two-dimensional posture to obtain the human body's three-dimensional posture, which greatly reduces the difficulty of model training. A bidirectional GRU network and a loss function are used to smooth the human body's three-dimensional posture, and RGB cameras with a resolution of not less than 720P are easier to obtain than industrial cameras, reducing hardware costs.
[0163] 2. In the first stage of model 2, a reliable joint point set is used to design an optimizer to reduce the adverse effects of the estimation errors of the limb joint points on the estimation of the human skeleton position, thereby reducing the jitter of the human skeleton position in the direction of the optical axis of the RGB camera.
[0164] 3. The second stage of model 2 combines the Levenberg-Marquardt nonlinear optimization algorithm and human skeleton kinematics to design an optimizer, and performs skeleton redirection between two skeletons with different bone lengths. When building the optimizer, forward kinematics is used to determine the position of the target skeleton joint points. During iterative optimization, inverse kinematics is used to adjust the bone angles of the target skeleton to meet the conversion from the real human 3D posture to the virtual character 3D posture, which meets the requirements for human motion capture scenes known to people in this field.
[0165] In this specification, the present invention has been described with reference to specific embodiments thereof. However, it is apparent that various modifications and variations may be made without departing from the spirit and scope of the present invention. Therefore, the specification and drawings should be regarded as illustrative rather than restrictive.
Claims
1. A method for capturing human motion using an RGB camera, characterized in that: The following steps are involved: Step 1: constructing a model 1 for enabling the human body three-dimensional posture estimation module to obtain the feature data required for the current human body posture estimation task; Step 2: constructing a second model for enabling the virtual character model space positioning processing module to obtain the feature data required for the current virtual character model space positioning and the virtual character model posture redirection processing module to obtain the posture redirection task; Step 3: using the model 1 and the model 2 to be applied to the human motion capture output module to perform human motion capture processing; Step 4: Build a human motion capture system platform based on the acquired human body 3D posture estimation data to display and process the human body posture data; The specific operation steps of step 1 are as follows: Step 1-1: Use the residual block to build a posture feature extraction network, which is used to extract the spatial distribution feature vector of the specified human body two-dimensional posture from a single frame image; input T frame images into the existing human body two-dimensional posture detector in sequence to obtain the human body two-dimensional posture sequence of the T frame images, and perform z-score normalization on the human body two-dimensional posture to obtain a standardized human body two-dimensional posture sequence The standardized human body two-dimensional posture sequence The postures in the figure are sequentially input into the posture feature extraction network to obtain the two-dimensional posture spatial distribution feature vector of the human body; Step 1-2: Build a bidirectional GRU network with a sequence length of T, input the two-dimensional human posture spatial distribution feature vector of the T-frame image obtained in step 1-1, the bidirectional GRU network is used to learn the temporal distribution characteristics of the human posture, and the bidirectional GRU network outputs the z-score standardized human posture depth value sequence of the T-frame image Wherein, Z represents the depth direction represented by the positive direction of the camera optical axis; Step 1-3: The human body posture depth sequence obtained from step 1-2 Compare the depth of each posture with the standardized human 2D posture sequence The corresponding two-dimensional human body posture is vector spliced according to the following formula to obtain the output value of the model 1, that is, the three-dimensional human body posture sequence in, yes The estimated value of the t-th standardized human 3D posture in, and are the coordinates of the standardized two-dimensional posture of the human body, is the human body posture depth sequence The tth standardized human body 3D posture depth value; Step 1-4: Construct the loss terms L1 and L2 of the model 1. The loss term L1 is the Euclidean distance between the estimated value and the true value of the human body 3D posture depth value sequence, which is used to constrain the learning of spatial distribution features. The loss term L2 is designed based on the constraint condition of posture synchronization change. It is assumed that the estimated value change of the human body 3D posture depth value of two adjacent frames is the same as the true value change, thereby constraining the learning of time distribution features. The two loss terms are shown in the following formulas: Among them, T is the sequence length, N is the number of joint points, Represents the estimated value of the depth value of the joint point numbered j in the tth posture of the sequence, Indicates the true value of the depth value of the joint point numbered j in the tth frame of the sequence; Step 1-5: Based on the steps 1-4, the loss function L of the model 1 is constructed. The loss function L is shown in the following formula: L=αL1+βL2 Where α and β are hyperparameters of the loss function; Step 1-6: Obtain a human body three-dimensional pose data set, extract pairs of human body two-dimensional poses and human body three-dimensional poses from the training set in the human body three-dimensional pose data set as training samples, and use the calculation formula of the loss function L to train the model one, and after the training, obtain the parameter file of the model one and save it to the disk of the cloud server; The specific operation steps of step 2 are as follows: Step 2-1: Define the human skeleton matrix based on the skeleton topology 3D S is the joint concatenation vector composition, Represents the joint cascade vector from the parent joint numbered i to the child joint numbered j, taking the posture in the middle of the queue in the human 3D posture sequence output by the model 1 to construct the human skeleton matrix of the original skeleton 3D S, virtual character skeleton matrix 3D S ′ Obtained from the virtual character model input by the user, the virtual character model must comply with the Humanoid standard; Step 2-2: According to the skeleton topology, the angles of adjacent bones of the original skeleton are calculated from the human skeleton matrix, and the bone angles of the virtual character skeleton are set to the bone angles corresponding to the original skeleton in turn, and the corresponding three-dimensional posture is calculated according to the target skeleton matrix; Step 2-3: Use the neck joint, left shoulder joint, right shoulder joint, left hip joint and right hip joint as the reliable joint point set J, and use the reliable joint point set J to construct the objective function E1 of the first stage. This objective function is used to optimize the position vector r of the root joint of the virtual character skeleton in the camera coordinate system. First, apply forward kinematics to the joint angles of the virtual character skeleton to obtain the reliable joint point coordinates, and then transform all the reliable joint point coordinates to the camera coordinate system through the position vector r. Finally, construct the reprojection error, as shown in the following formula: E1(r)=argmin||Π(F J ( 3D i, 3D S)+r)- 2D J|| Where Π is the reprojection function, F J is the forward kinematics function applicable to J, 3D θ is the bone angle vector of the virtual character skeleton; Step 2-4: Construct the objective function E2 of the second stage, which is used to optimize the posture of the virtual character skeleton. First, forward kinematics is applied to obtain the three-dimensional posture of the virtual character skeleton. Then, the three-dimensional position of the virtual character skeleton is obtained from the position vector of the root joint in the camera coordinate system. Finally, the reprojection error is constructed, as shown in the following formula: E2( 3D θ)=argmin||Π(F( sD i, 3D S)+r)- 2D J|| 2 Step 2-5. Use the Levenberg-Marquardt nonlinear optimization algorithm to construct a two-stage optimizer with the objective function E1 and the objective function E2, where the quantity to be optimized is 3D θ and r; The specific steps in step 3 are as follows: Step 3-1: Construct an image queue Q with a length of T. Each time a frame of image is read, the image is added to the end of the image queue Q. If the length of the image queue exceeds T, the image at the head of the image queue Q is discarded. Step 3-2: Use the existing human body 2D posture detector to obtain the human body 2D posture from the image at the end of the image queue Q, and convert the human body 2D posture 2D P t Store in temporary queue temp Q, if temp If the length of Q is greater than T, the 2D posture of the human body at the head of the team is discarded; Step 3-3: Add the temporary queue of step 3-2 temp The human body 2D posture queue is constructed by subtracting the root joint coordinates from the human body 2D posture in Q Use z-score normalization method to obtain standardized human 2D posture queue And input the model 1 to obtain the corresponding human body three-dimensional posture depth value queue And obtain the standardized human 3D posture queue according to the following formula Step 3-4: According to the topological relationship of the human skeleton, obtain its skeleton matrix from the virtual character model 3D S ′ ; Step 3-5: 3D human body posture queue obtained in step 3-3 Constructing the human skeleton matrix 3D S, will 3D S is input into the model 2, and the virtual character skeleton matrix obtained in steps 3-4 is 3D S ′ Input into the model 2, and take the optimization result of the previous frame as the initial value, that is, 3D θ t-1 and r t-1 ,like 3D θ t-1 and r t-1 If it does not exist, 3D θ t The initial value is the joint angle of T-Pose, r t The initial value is the vector value of 1 meter along the positive direction of the RGB camera optical axis, and the model 2 is run to obtain the redirected three-dimensional posture of the virtual character, which is located in the camera coordinate system.
2. The method for capturing human motion using an RGB camera according to claim 1, wherein: The specific steps in step 4 are as follows: Step 4-1: Select an RGB camera with a resolution of no less than 720P, connect the RGB camera to the terminal computer, and establish a network connection between the terminal computer and the cloud server; Step 4-2: The terminal computer reads the parameter configuration file of the RGB camera and uploads it to the cloud server; Step 4-3: The terminal computer sequentially reads the images captured by the RGB camera and uploads them to the cloud server; Step 4-4: the cloud server receives the image sent by the terminal computer, runs the human body three-dimensional posture estimation module and performs human body motion capture processing, obtains the virtual character three-dimensional posture corresponding to the human body in the image through the virtual character model space positioning processing module and the virtual character model posture redirection module, and sends it to the terminal computer through the human body motion capture output module; Step 4-5: The terminal computer calls the local rendering engine according to the received virtual character posture data to display the posture data on the interactive interface.
3. A system for human motion capture using an RGB camera using the method of claim 1, characterized in that: The system comprises: The human body 3D posture estimation module is used to capture human body image sequences using an RGB camera and obtain human body 3D posture estimation data by building a posture feature extraction network and a bidirectional GRU network; A virtual character model spatial positioning processing module is connected to the human body three-dimensional posture estimation module and is used to perform spatial positioning processing of the virtual character model through the human body three-dimensional posture estimation data and the virtual character skeleton data; A virtual character model posture redirection processing module is connected to the human body three-dimensional posture estimation module and the virtual character model space positioning processing module, and is used to perform posture redirection processing of the virtual character model through the human body three-dimensional posture estimation data and the virtual character skeleton data; and The human motion capture output module is connected to the virtual character model posture redirection processing module and is used to obtain the position and posture of the current character according to the acquired spatial positioning data and posture redirection data of the virtual character model.
