Face pose estimation / 3D face reconstruction method, device and electronic equipment
By constructing a three-dimensional face model of a two-dimensional face image and combining the face shape and expression fitting algorithms, the problem of the robustness of the pose estimation of the three-dimensional average face model under large angles and exaggerated expressions is solved, and the pose estimation and three-dimensional face models are improved. Accuracy of face reconstruction.
Patent Information
- Application Number
- CN201810983040.0
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2018-08-27
- Publication Date
- 2024-10-22
- Estimated Expiration
- 2038-08-27
AI Technical Summary
In the existing technology, face pose estimation based on a three-dimensional average face model has poor robustness. Especially in the case of large angles and exaggerated expressions, the accuracy of pose estimation is reduced.
By constructing a three-dimensional face model corresponding to the two-dimensional face image, using the face shape fitting algorithm and expression fitting algorithm, combined with the three-dimensional face prior data, the face feature points and contour feature points are determined, and projection mapping and feature Vector fitting to generate a more accurate 3D face model for pose estimation.
It improves the robustness and accuracy of face pose estimation, especially in the case of large angles and exaggerated expressions, it can achieve higher pose estimation accuracy, and effectively improves the reconstruction accuracy of the three-dimensional face model.
Smart Images

Figure CN110866864B_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of image processing technology, and in particular to a method and device for estimating a facial posture, a method and device for reconstructing a three-dimensional face, and an electronic device. Background Art
[0002] Face pose estimation is a very hot issue in the computer field. It refers to determining the angle information of the face orientation based on the face image, that is, calculating three deflection angles based on the characteristics of the face image: pitch, yaw, and roll.
[0003] At present, there are many methods for face pose estimation, which can be divided into model-based methods, appearance-based methods, and classification-based methods. Among them, since the face pose obtained by the model-based method is a continuous value, the pose estimation accuracy is higher, so the model-based method has become a common method. The processing process of a typical model-based face pose estimation method is as follows. First, locate the coordinates of key points (feature points) on the two-dimensional face image to obtain two-dimensional key points, such as facial features, contours, etc.; then, construct a three-dimensional model of a neutral and expressionless average face, and extract three-dimensional key points with the same semantics as the two-dimensional key points from the three-dimensional model; next, according to the coordinate values of the two-dimensional key points, the coordinate values of the three-dimensional key points and the focal length of the camera, obtain the rotation matrix from the three-dimensional average face model to the two-dimensional face image; finally, determine the face pose of the two-dimensional face image according to the rotation matrix.
[0004] However, in the process of implementing the present invention, the inventors found that the prior art has at least the following problems: Since there are usually differences between the three-dimensional average face model and the two-dimensional face image, the accuracy of the pose estimation will be greatly reduced when estimating the pose of a face with large angles and exaggerated expressions. In summary, the prior art has the problem of poor robustness of pose estimation based on the three-dimensional average face model. Summary of the invention
[0005] The present application provides a method for estimating human face posture, so as to solve the problem of poor robustness of posture estimation based on a three-dimensional average face model in the prior art. The present application also provides a method and system for reconstructing a three-dimensional human face, and an electronic device.
[0006] The present application provides a method for estimating a face posture, comprising:
[0007] Obtain a two-dimensional face image to be processed;
[0008] Constructing a three-dimensional face model corresponding to the two-dimensional face image;
[0009] The facial posture of the two-dimensional facial image is determined according to the facial feature points of the three-dimensional facial model and the facial feature points of the two-dimensional facial image.
[0010] Optionally, constructing a three-dimensional face model corresponding to the two-dimensional face image includes:
[0011] A three-dimensional face model corresponding to the two-dimensional face image is constructed by a face shape fitting algorithm.
[0012] Optionally, the face shape fitting algorithm includes:
[0013] Determine a projection mapping matrix from the three-dimensional average face model to the two-dimensional face image according to the internal facial feature points of the two-dimensional face image and the internal facial feature points of the three-dimensional average face model;
[0014] Constructing a first three-dimensional face model corresponding to the two-dimensional face image according to the projection mapping matrix and the eigenvector of the three-dimensional eigenface space;
[0015] According to the facial contour feature points of the two-dimensional facial image, fitting the contour feature points of the first three-dimensional model;
[0016] If the error between the two-dimensional face image and the three-dimensional face model after the face contour feature points are fitted is less than a preset error, the three-dimensional face model after the face contour feature points are fitted is used as the three-dimensional face model.
[0017] Optionally, also include:
[0018] If the error is greater than or equal to a preset error, a three-dimensional face model corresponding to the two-dimensional face image is constructed based on the three-dimensional face model fitted with the face contour feature points.
[0019] Optionally, constructing the expression three-dimensional face model corresponding to the two-dimensional face image includes:
[0020] A three-dimensional face model corresponding to the two-dimensional face image is constructed through a face expression fitting algorithm.
[0021] Optionally, constructing a three-dimensional face model corresponding to the two-dimensional face image includes:
[0022] A three-dimensional face model corresponding to the two-dimensional face image is constructed through a face shape and expression fitting algorithm.
[0023] Optionally, the face shape and expression fitting algorithm includes:
[0024] Determine a projection mapping matrix from the three-dimensional average face model to the two-dimensional face image according to the internal facial feature points of the two-dimensional face image and the internal facial feature points of the three-dimensional average face model;
[0025] Constructing a first three-dimensional face model corresponding to the two-dimensional face image according to the projection mapping matrix and the eigenvector of the three-dimensional eigenface space;
[0026] According to the facial contour feature points of the two-dimensional facial image, fitting the contour feature points of the first three-dimensional model;
[0027] performing expression fitting on the three-dimensional face model after contour fitting according to the internal facial feature points of the two-dimensional face image and at least one expression base corresponding to the three-dimensional average face model;
[0028] If the error between the two-dimensional face image and the three-dimensional face model after expression fitting is less than a preset error, the three-dimensional face model after expression fitting is used as the three-dimensional face model.
[0029] Optionally, also include:
[0030] If the error is greater than or equal to a preset error, a three-dimensional face model corresponding to the two-dimensional face image is constructed according to the three-dimensional face model after expression fitting.
[0031] Optionally, constructing a first three-dimensional face model corresponding to the two-dimensional face image according to the projection mapping matrix and the eigenvector of the three-dimensional eigenface space includes:
[0032] The three-dimensional face shape parameters are determined by minimizing an energy function; wherein the energy function adopts the following formula:
[0033]
[0034] Among them, E represents the energy function, N represents the number of feature points inside the face, and y pro_2D,i represents the coordinate value of the two-dimensional internal feature point obtained by projecting the internal feature points of the three-dimensional average face model into the two-dimensional space through the projection mapping matrix, y i represents the coordinate values of the internal feature points of the face of the two-dimensional face image, represents the covariance matrix of the internal facial feature points of the two-dimensional facial image, and α represents the three-dimensional facial shape parameter.
[0035] Optionally, the coordinate values of the two-dimensional internal feature points obtained by projecting into the two-dimensional space are obtained by using the following formula:
[0036]
[0037] Among them, U represents a matrix composed of feature vectors corresponding to the internal feature points of the face of the three-dimensional average face model, P represents the projection mapping matrix, and V represents the vertex coordinate data semantically related to the corresponding internal feature points on the 3D average face.
[0038] Optionally, performing contour feature point fitting on the first three-dimensional model according to the facial contour feature points of the two-dimensional facial image includes:
[0039] Selecting, from the first three-dimensional face model, three-dimensional points corresponding to the face contour feature points of the two-dimensional face image as initial three-dimensional contour feature points;
[0040] Mapping the initial three-dimensional contour feature points to the two-dimensional face image through the projection mapping matrix;
[0041] By using a nearest neighbor matching algorithm, three-dimensional points corresponding to the mapped two-dimensional contour feature points are selected as facial contour feature points of the first three-dimensional face model.
[0042] Optionally, also include:
[0043] The three-dimensional average face model and the feature vector are determined according to the three-dimensional face model samples.
[0044] Optionally, also include:
[0045] At least one expression base corresponding to the three-dimensional average face model is determined according to the three-dimensional face model sample.
[0046] The present application also provides a three-dimensional face reconstruction method, comprising:
[0047] Obtain a two-dimensional face image to be processed;
[0048] Determine a projection mapping matrix from the three-dimensional average face model to the two-dimensional face image according to the internal facial feature points of the two-dimensional face image and the internal facial feature points of the three-dimensional average face model;
[0049] Constructing a first three-dimensional face model corresponding to the two-dimensional face image according to the projection mapping matrix and the eigenvector of the three-dimensional eigenface space;
[0050] According to the facial contour feature points of the two-dimensional facial image, fitting the contour feature points of the first three-dimensional facial model;
[0051] If the error between the two-dimensional face image and the fitted three-dimensional face model is less than a preset error, the fitted three-dimensional face model is used as the three-dimensional face model of the two-dimensional face image.
[0052] Optionally, after performing contour feature point fitting on the first three-dimensional face model according to the face contour feature points of the two-dimensional face image, the method further includes:
[0053] Expression fitting is performed on the three-dimensional face model after contour fitting according to the internal facial feature points of the two-dimensional face image and at least one expression base corresponding to the three-dimensional average face model.
[0054] Optionally, after constructing the first three-dimensional face model corresponding to the two-dimensional face image according to the projection mapping matrix and the eigenvector of the three-dimensional eigenface space, the method further includes:
[0055] performing expression fitting on the first three-dimensional human face model according to at least one expression base corresponding to the three-dimensional average face model;
[0056] The step of fitting the first three-dimensional face model with the face contour feature points according to the face contour feature points of the two-dimensional face image comprises:
[0057] According to the facial contour feature points of the two-dimensional facial image, contour feature point fitting is performed on the first three-dimensional facial model after expression fitting.
[0058] Optionally, constructing a first three-dimensional face model corresponding to the two-dimensional face image according to the projection mapping matrix and the eigenvector of the three-dimensional eigenface space includes:
[0059] The three-dimensional face shape parameters are determined by minimizing an energy function; wherein the energy function adopts the following formula:
[0060]
[0061] Among them, E represents the energy function, N represents the number of feature points inside the face, and y pro_2D,i represents the coordinate value of the two-dimensional internal feature point obtained by projecting the internal feature points of the three-dimensional average face model into the two-dimensional space through the projection mapping matrix, y i represents the coordinate values of the internal feature points of the face of the two-dimensional face image, represents the covariance matrix of the internal facial feature points of the two-dimensional facial image, and α represents the three-dimensional facial shape parameter.
[0062] Optionally, the coordinate values of the two-dimensional internal feature points obtained by projecting into the two-dimensional space are obtained by using the following formula:
[0063]
[0064] Among them, U represents a matrix composed of feature vectors corresponding to the internal feature points of the face of the three-dimensional average face model, P represents the projection mapping matrix, and V represents the vertex coordinate data semantically related to the corresponding internal feature points on the 3D average face.
[0065] Optionally, performing contour feature point fitting on the first three-dimensional model according to the facial contour feature points of the two-dimensional facial image includes:
[0066] Selecting, from the first three-dimensional face model, three-dimensional points corresponding to the face contour feature points of the two-dimensional face image as initial three-dimensional contour feature points;
[0067] Mapping the initial three-dimensional contour feature points to the two-dimensional face image through the projection mapping matrix;
[0068] By using a nearest neighbor matching algorithm, three-dimensional points corresponding to the mapped two-dimensional contour feature points are selected as facial contour feature points of the first three-dimensional face model.
[0069] Optionally, also include:
[0070] If the error is greater than or equal to a preset error, a three-dimensional face model corresponding to the two-dimensional face image is constructed according to the fitted three-dimensional face model.
[0071] Optionally, also include:
[0072] The three-dimensional average face model and the feature vector are determined according to the three-dimensional face model samples.
[0073] Optionally, also include:
[0074] At least one expression base corresponding to the three-dimensional average face model is determined according to the three-dimensional face model sample.
[0075] The present application also provides a face posture estimation device, comprising:
[0076] A two-dimensional face image acquisition unit, used to acquire a two-dimensional face image to be processed;
[0077] A three-dimensional face model construction unit, used to construct a three-dimensional face model corresponding to the two-dimensional face image;
[0078] The face posture determination unit is used to determine the face posture of the two-dimensional face image according to the face feature points of the three-dimensional face model and the face feature points of the two-dimensional face image.
[0079] Optionally, the three-dimensional face model construction unit is specifically used to construct a three-dimensional face model corresponding to the two-dimensional face image through a face shape fitting algorithm.
[0080] Optionally, the three-dimensional face model building unit includes:
[0081] A projection matrix determination subunit, used to determine a projection mapping matrix from the three-dimensional average face model to the two-dimensional face image according to the internal facial feature points of the two-dimensional face image and the internal facial feature points of the three-dimensional average face model;
[0082] A first model building subunit is used to build a first three-dimensional face model corresponding to the two-dimensional face image according to the projection mapping matrix and the eigenvector of the three-dimensional eigenface space;
[0083] A contour fitting subunit, used for fitting contour feature points of the first three-dimensional model according to the facial contour feature points of the two-dimensional facial image;
[0084] The second model determination subunit is used to use the three-dimensional face model after fitting the facial contour feature points as the three-dimensional face model if the error between the two-dimensional face image and the three-dimensional face model after fitting the facial contour feature points is less than a preset error.
[0085] Optionally, the three-dimensional face model building unit further includes:
[0086] The third model building subunit is used to build a three-dimensional face model corresponding to the two-dimensional face image based on the three-dimensional face model fitted with the face contour feature points if the error is greater than or equal to a preset error.
[0087] Optionally, the three-dimensional face model construction unit is specifically used to construct a three-dimensional face model corresponding to the two-dimensional face image through a facial expression fitting algorithm.
[0088] Optionally, the three-dimensional face model construction unit is specifically used to construct a three-dimensional face model corresponding to the two-dimensional face image through a face shape and expression fitting algorithm.
[0089] Optionally, the three-dimensional face model building unit includes:
[0090] A projection matrix determination subunit, used to determine a projection mapping matrix from the three-dimensional average face model to the two-dimensional face image according to the internal facial feature points of the two-dimensional face image and the internal facial feature points of the three-dimensional average face model;
[0091] A first model building subunit is used to build a first three-dimensional face model corresponding to the two-dimensional face image according to the projection mapping matrix and the eigenvector of the three-dimensional eigenface space;
[0092] A contour fitting subunit, used for fitting contour feature points of the first three-dimensional model according to the facial contour feature points of the two-dimensional facial image;
[0093] An expression fitting subunit, configured to perform expression fitting on the three-dimensional face model after contour fitting according to the internal facial feature points of the two-dimensional face image and at least one expression base corresponding to the three-dimensional average face model;
[0094] The second model determination subunit is used to use the three-dimensional face model after expression fitting as the three-dimensional face model if the error between the two-dimensional face image and the three-dimensional face model after expression fitting is less than a preset error.
[0095] Optionally, also include:
[0096] The third model building subunit is used to build a three-dimensional face model corresponding to the two-dimensional face image according to the three-dimensional face model after expression fitting if the error is greater than or equal to a preset error.
[0097] Optionally, the contour fitting subunit includes:
[0098] A first contour feature point selection subunit is used to select three-dimensional points corresponding to the face contour feature points of the two-dimensional face image from the first three-dimensional face model as initial three-dimensional contour feature points;
[0099] A contour feature point mapping subunit, used for mapping the initial three-dimensional contour feature points to the two-dimensional face image through the projection mapping matrix;
[0100] The second contour feature point selection subunit is used to select the three-dimensional points corresponding to the mapped two-dimensional contour feature points through the nearest neighbor matching algorithm as the face contour feature points of the first three-dimensional face model.
[0101] Optionally, also include:
[0102] The first priori data determination unit is used to determine the three-dimensional average face model and the feature vector according to the three-dimensional face model sample.
[0103] Optionally, also include:
[0104] The second prior data determination unit is used to determine at least one expression base corresponding to the three-dimensional average face model according to the three-dimensional face model sample.
[0105] The present application also provides a three-dimensional face reconstruction device, comprising:
[0106] A two-dimensional face image acquisition unit, used to acquire a two-dimensional face image to be processed;
[0107] A projection matrix determination subunit, used to determine a projection mapping matrix from the three-dimensional average face model to the two-dimensional face image according to the internal facial feature points of the two-dimensional face image and the internal facial feature points of the three-dimensional average face model;
[0108] A first model building subunit is used to build a first three-dimensional face model corresponding to the two-dimensional face image according to the projection mapping matrix and the eigenvector of the three-dimensional eigenface space;
[0109] A contour fitting subunit, configured to fit contour feature points of the first three-dimensional face model according to the face contour feature points of the two-dimensional face image;
[0110] The second model determination unit is used to use the fitted three-dimensional face model as the three-dimensional face model of the two-dimensional face image if the error between the two-dimensional face image and the fitted three-dimensional face model is less than a preset error.
[0111] Optionally, also include:
[0112] The first expression fitting unit is used to perform expression fitting on the three-dimensional face model after contour fitting according to the internal facial feature points of the two-dimensional face image and at least one expression base corresponding to the three-dimensional average face model.
[0113] Optionally, also include:
[0114] a second expression fitting unit, configured to perform expression fitting on the first three-dimensional human face model according to at least one expression base corresponding to the three-dimensional average face model;
[0115] The contour fitting subunit is specifically used to perform contour feature point fitting on the first three-dimensional face model after expression fitting according to the face contour feature points of the two-dimensional face image.
[0116] Optionally, the contour fitting subunit includes:
[0117] A first contour feature point selection subunit is used to select three-dimensional points corresponding to the face contour feature points of the two-dimensional face image from the first three-dimensional face model as initial three-dimensional contour feature points;
[0118] A contour feature point mapping subunit, used for mapping the initial three-dimensional contour feature points to the two-dimensional face image through the projection mapping matrix;
[0119] The second contour feature point selection subunit is used to select the three-dimensional points corresponding to the mapped two-dimensional contour feature points through the nearest neighbor matching algorithm as the face contour feature points of the first three-dimensional face model.
[0120] Optionally, also include:
[0121] The third model building subunit is used to build a three-dimensional face model corresponding to the two-dimensional face image according to the fitted three-dimensional face model if the error is greater than or equal to a preset error.
[0122] Optionally, also include:
[0123] The first priori data determination unit is used to determine the three-dimensional average face model and the feature vector according to the three-dimensional face model sample.
[0124] Optionally, also include:
[0125] The second prior data determination unit is used to determine at least one expression base corresponding to the three-dimensional average face model according to the three-dimensional face model sample.
[0126] The present application also provides an electronic device, comprising:
[0127] Processor; and
[0128] The memory is used to store a program for implementing a face posture estimation method. After the device is powered on and the program of the face posture estimation method is run through the processor, the following steps are performed: obtaining a two-dimensional face image to be processed; constructing a three-dimensional face model corresponding to the two-dimensional face image; and determining the face posture of the two-dimensional face image based on the face feature points of the three-dimensional face model and the face feature points of the two-dimensional face image.
[0129] The present application also provides an electronic device, comprising:
[0130] Processor; and
[0131] A memory is used to store a program for implementing a three-dimensional face reconstruction method. After the device is powered on and runs the program of the three-dimensional face reconstruction method through the processor, the following steps are performed: obtaining a two-dimensional face image to be processed; determining a projection mapping matrix from the three-dimensional average face model to the two-dimensional face image according to the internal facial feature points of the two-dimensional face image and the internal facial feature points of the three-dimensional average face model; constructing a first three-dimensional face model corresponding to the two-dimensional face image according to the projection mapping matrix and the feature vector of the three-dimensional feature face space; fitting the contour feature points of the first three-dimensional face model according to the facial contour feature points of the two-dimensional face image; if the error between the two-dimensional face image and the fitted three-dimensional face model is less than a preset error, using the fitted three-dimensional face model as the three-dimensional face model of the two-dimensional face image.
[0132] The present application also provides a computer-readable storage medium, wherein the computer-readable storage medium stores instructions, and when the computer-readable storage medium is run on a computer, the computer executes the above-mentioned various methods.
[0133] The present application also provides a computer program product comprising instructions, which, when executed on a computer, enables the computer to execute the above-mentioned various methods.
[0134] Compared with the prior art, this application has the following advantages:
[0135] The face posture estimation method provided in the embodiment of the present application obtains a two-dimensional face image to be processed, constructs a three-dimensional face model corresponding to the two-dimensional face image, and determines the face posture of the two-dimensional face image according to the face feature points of the three-dimensional face model and the face feature points of the two-dimensional face image. This processing method enables posture solution to be performed based on the three-dimensional face model corresponding to the two-dimensional face image, rather than only based on the three-dimensional average face model. Therefore, when performing posture estimation on a face with large angles and exaggerated expressions, a posture with higher accuracy can still be obtained. Therefore, the robustness of posture estimation can be effectively improved.
[0136] The three-dimensional face reconstruction method provided in the embodiment of the present application obtains a two-dimensional face image to be processed; determines a projection mapping matrix from the three-dimensional average face model to the two-dimensional face image according to the internal facial feature points of the two-dimensional face image and the internal facial feature points of the three-dimensional average face model; constructs a first three-dimensional face model corresponding to the two-dimensional face image according to the projection mapping matrix and the feature vector of the three-dimensional feature face space; performs contour feature point fitting on the first three-dimensional face model according to the facial contour feature points of the two-dimensional face image; if the error between the two-dimensional face image and the fitted three-dimensional face model is less than a preset error, the fitted three-dimensional face model is used as the three-dimensional face model of the two-dimensional face image; this processing method drives the fitting of the three-dimensional face model based on the three-dimensional face prior data, considers the combination of the internal facial feature points and the external contour feature points, and then iterates the fitting to minimize the error between the three-dimensional face model and the two-dimensional face image, restores the real face to the greatest extent, and the reconstructed three-dimensional face model conforms to the biological characteristics of the face; therefore, the reconstruction accuracy of the three-dimensional face model can be effectively improved. BRIEF DESCRIPTION OF THE DRAWINGS
[0137] Figure 1 is a flowchart of an embodiment of a method for estimating facial posture provided by the present application;
[0138] Figure 2 is a schematic diagram of a two-dimensional face image of an embodiment of a face pose estimation method provided by the present application;
[0139] Figure 3 is a face shape fitting flow chart of an embodiment of a face posture estimation method provided by the present application;
[0140] Figure 4 is a schematic diagram of a three-dimensional average face model of an embodiment of a face posture estimation method provided by the present application;
[0141] Figure 5 This is a specific flow chart of face shape fitting in an embodiment of a face posture estimation method provided by the present application;
[0142] Figure 6 is a flow chart of face shape and expression fitting of an embodiment of a face posture estimation method provided by the present application;
[0143] Figure 7 It is a schematic diagram of multiple expressions of a three-dimensional average face model of an embodiment of a face posture estimation method provided by the present application;
[0144] Figure 8 This is a specific flow chart of face shape and expression fitting of an embodiment of a face posture estimation method provided by the present application;
[0145] Fig. 9 is a schematic diagram of an embodiment of a face posture estimation device provided by the present application;
[0146] Fig.10 is a specific schematic diagram of an embodiment of a face posture estimation device provided by the present application;
[0147] Fig.11 is a schematic diagram of an embodiment of an electronic device provided by the present application;
[0148] Fig.12 is a flow chart of an embodiment of a three-dimensional face reconstruction method provided by the present application;
[0149] Fig.13 is a specific flow chart of an embodiment of a three-dimensional face reconstruction method provided by the present application;
[0150] Fig.14 is another specific flow chart of an embodiment of a three-dimensional face reconstruction method provided by the present application;
[0151] Fig.15 is a schematic diagram of an embodiment of a three-dimensional face reconstruction device provided by the present application;
[0152] Fig.16 It is a schematic diagram of an embodiment of an electronic device provided by the present application. DETAILED DESCRIPTION
[0153] Many specific details are described in the following description to facilitate a full understanding of the present application. However, the present application can be implemented in many other ways than those described herein, and those skilled in the art can make similar generalizations without violating the connotation of the present application, so the present application is not limited by the specific implementation disclosed below.
[0154] In this application, a method and device for estimating human face pose, a method and device for reconstructing three-dimensional human face, and an electronic device are provided. Human face pose estimation plays a very important role in three-dimensional spaces such as human face reconstruction and virtual try-on. For example, it can be applied in the fields of three-dimensional augmented reality stickers (AR stickers), three-dimensional face swapping, and three-dimensional AR glasses. They are described in detail one by one in the following embodiments.
[0155] First embodiment
[0156] Please refer to Figure 1 , which is a flowchart of an embodiment of a face pose estimation method provided by the present application. The execution subject of the method is a face pose estimation device, which is usually deployed on a server, but is not limited to a server, and can also be any device that can implement the face pose estimation method. A face pose estimation method provided by the present application includes:
[0157] Step S101: Obtain a two-dimensional face image to be processed.
[0158] The two-dimensional face image may be a two-dimensional face image captured by an image acquisition device such as a camera or a webcam. The two-dimensional face image includes a plurality of pixels, for example, Figure 2 The two-dimensional face image shown is 256*256 pixels.
[0159] Step S103: constructing a three-dimensional face model corresponding to the two-dimensional face image.
[0160] The face posture estimation method provided in the present application reconstructs a three-dimensional face model corresponding to a two-dimensional face image by introducing three-dimensional face reconstruction technology, and extracts feature points having the same semantic relationship as the two-dimensional face image in the three-dimensional face model, thereby solving the two-dimensional face posture.
[0161] In one example, a three-dimensional face model corresponding to the two-dimensional face image is constructed through a face shape fitting algorithm; this processing method allows a three-dimensional face model with a face angle similar to that corresponding to the two-dimensional face image to be constructed, so that when the face posture is estimated at a large angle, a higher accuracy posture can still be obtained; therefore, the robustness of the posture estimation can be effectively improved.
[0162] In another example, a three-dimensional face model corresponding to the two-dimensional face image is constructed through an expression fitting algorithm; this processing method allows a three-dimensional face model with a facial expression similar to that corresponding to the two-dimensional face image to be constructed, so that when the posture is estimated for exaggerated facial expressions, a higher accuracy posture can still be obtained; therefore, the robustness of posture estimation can be effectively improved.
[0163] In another example, a three-dimensional face model corresponding to the two-dimensional face image is constructed through a face and expression fitting algorithm; this processing method allows a three-dimensional face model to be constructed with facial expressions and facial angles similar to those corresponding to the two-dimensional face image, thereby enabling a higher degree of accuracy in posture estimation to be obtained when estimating the posture of a face with large angles and exaggerated expressions; therefore, the robustness of posture estimation can be effectively improved.
[0164] Step S105: determining the facial posture of the two-dimensional facial image according to the facial feature points of the three-dimensional facial model and the facial feature points of the two-dimensional facial image.
[0165] After reconstructing the three-dimensional face model corresponding to the two-dimensional face image through the above steps, the facial posture of the two-dimensional face image can be estimated based on the reconstructed three-dimensional face model. In this embodiment, the facial posture of the two-dimensional face image can be determined based on the facial feature points of the three-dimensional face model and the facial feature points of the two-dimensional face image.
[0166] The facial feature points can be obtained by analyzing the facial feature point positioning algorithm. Figure 1 The 66 facial feature points shown include 49 internal feature points and 17 contour feature points.
[0167] The facial feature point positioning algorithm includes but is not limited to the following categories: 1) optimization-based methods, such as ASM (Active Shape Model), AAM (Active Appreance Model) and CLM methods; 2) regression-based methods, such as cascaded pose regression, SDM, ESR and other methods; 3) deep learning-based methods, such as facial feature point positioning methods based on convolutional neural networks (CNN), deep autoencoders (DAE) and restricted Boltzmann machines (RBM).
[0168] In one example, the processing process of step S105 is as follows. First, the facial feature point location algorithm is used to locate the coordinates of the facial feature points on the two-dimensional face image to obtain the two-dimensional key points, and the three-dimensional key points with the same semantics as the two-dimensional key points are extracted from the reconstructed three-dimensional face model; then, according to the coordinate values of the two-dimensional key points, the coordinate values of the three-dimensional key points and the focal length of the camera, the rotation matrix from the reconstructed three-dimensional face model to the two-dimensional face image is obtained; finally, the facial posture of the two-dimensional face image is determined according to the rotation matrix.
[0169] Please refer to Figure 3 , which is a face fitting flow chart of a face posture estimation method embodiment provided in the present application. Since the face shape fitting algorithm adopted in the present embodiment is implemented based on three-dimensional face prior data, the three-dimensional face prior data and its generation process are first described below.
[0170] The three-dimensional human face prior data may include a three-dimensional average face model, a feature vector in a three-dimensional eigenface space, and a feature value of each three-dimensional human face model sample.
[0171] The three-dimensional average face model includes a three-dimensional average face model calculated based on multiple three-dimensional face model samples. Each three-dimensional face model sample can be converted into a multi-dimensional vector. After obtaining the vector set of the three-dimensional face model samples, the vectors in the vector set are traversed and accumulated, and then the average value is taken to obtain the three-dimensional average face model. Figure 4 The three-dimensional average face model of this embodiment is shown, which is a three-dimensional average face model with a neutral expression.
[0172] In one example, the three-dimensional face model sample is generated using the following steps: 1) obtaining multiple three-dimensional face data sets, for example, Surrey Face Model (SFM) and Basel Face model (BFM), etc., wherein the SurreyFace Model face data set includes 169 three-dimensional face models with neutral expressions, each model contains 3448 vertices, and the Basel Face model face data set includes 3D face models of 100 European males and 100 European females, each model contains 53215 vertices; 2) unifying model data with different numbers of vertices and different three-dimensional network topological structures into model data with the same number of vertices and the same three-dimensional network topological structure as a three-dimensional face model sample.
[0173] In this embodiment, a 3D face model sample is constructed based on SFM and BFM. Since neither SFM nor BFM provides the original 3D face model data, but only provides the files M, V, and E after feature compression by principal component analysis (PCA), where M represents the average face data, V represents the feature vector of the 3D feature face space, and E represents the feature value, and then the face is parameterized. Therefore, this embodiment first obtains the positive and negative standard deviations of the feature values by random sampling, and then calculates the standard deviations by formula S 3D =M+V*E new Reconstructing 3D face structure data: In this embodiment, 200 3D face structure data with neutral expressions are constructed from SFM, and 200 3D face structure data are constructed from BFM feature data.
[0174] Since the spatial scales of the three-dimensional model data corresponding to SFM and BFM are different, it is necessary to unify the dimensions of the two feature data. In this embodiment, the dimensions of the two feature data are adjusted to the three-dimensional average face scale of the SFM data set. The specific method can be to convert by solving the transformation matrix of the two models in three dimensions (x, y, z). The specific steps are as follows:
[0175] 1) In the two 3D average face models, 66 3D key index values related to the key location semantics of the 2D face image are obtained through tools (including facial feature point location algorithm);
[0176] 2) Using the Iterative Closest Point (ICP) algorithm, we can find 66 3D point pairs and set two datasets as P, Q, The spatial transformation parameters R (3*3 rotation matrix) and T (tx, ty, tz) between the two 3D point sets are solved. Assume that the two 3D face models are 3D points in the 3D space. The Euclidean distance between two sets of points can be expressed as The purpose of the coordinate normalization problem between the two models is to find the transformation matrices R and T between P and Q. (i=0,1,2…66), the optimal conversion parameters R and T are obtained by using the least square method, so that: Where N represents 66 key point information.
[0177] 3) The optimal transformation matrices R and T of the two groups of 3D models in the 3D space scale are obtained in the previous step. Now the parameters can be changed. In this embodiment, the scale of the 200 3D face models constructed based on BFM is converted to the scale of the SFM model.
[0178] 4) The three-dimensional model of the same spatial coordinate scale is obtained through step 3), but since the number of vertices of the two three-dimensional models is different, it is necessary to select 3448 vertex index values related to the SFM semantics from the 53215 vertices of BFM. The specific method is to compare the distance from each vertex on the SFM model to the vertex on the BFM, and record the index of the vertex with the smallest distance. In this way, 3348 vertex index values are obtained. The index value is used to segment the 200 three-dimensional face models on the BFM, so as to obtain a three-dimensional face model with the same number of vertices and the same network topology as the SFM three-dimensional data. At this point, 400 three-dimensional face model samples with neutral expressions are constructed.
[0179] After obtaining the three-dimensional face model samples, the three-dimensional average face model, eigenvectors and eigenvalues can be calculated by the dimensionality reduction algorithm. In this embodiment, the sample data is processed by dimensionality reduction through the PCA algorithm. The PCA algorithm points out that any specific face can be represented by a low-dimensional feature subspace and can be approximately reconstructed using this feature subspace. The features selected by the PCA algorithm maximize the differences between the three-dimensional face model samples, but also retain some unnecessary changes caused by lighting and facial expressions. The changes in the same person due to lighting may be greater than the changes between different people. Since the PCA algorithm implements the process of dimensionality reduction, it makes data processing easier and faster. In this embodiment, the specific method may include the following steps:
[0180] 1) Based on 400 3D face model samples with neutral expressions, the average face model of all models is calculated in is the three-dimensional average face model, S i is the three-dimensional average face model sample, N=400.
[0181] 2) Subtract the three-dimensional average face model from all models to obtain distance data: The principal component analysis method is used to compress the data of 400 3D face model samples with neutral expressions to obtain the covariance matrix C of the face shape. s , and the corresponding covariance matrix eigenvector s i (the corresponding eigenvalues are sorted by large and small) are represented by an orthogonal basis:
[0182] Among them, α=[α1,α2,......α m-1 ] T , the probability of parameter α σ i 2 is the face shape covariance matrix C s The characteristic value of .
[0183] At this point, the three-dimensional average face model composed of 400 three-dimensional face model samples is determined. The face shape feature vector set {s1, s2, .....s 3n}∈□ 3n and the corresponding eigenvalue set {σ s,1 ,σ s,2 ,....σ s,3n}, where n is the number of vertices of the expression 3D face model.
[0184] After obtaining the three-dimensional face prior data, the following Figure 3 The face shape fitting algorithm shown builds a three-dimensional face model corresponding to the two-dimensional face image.
[0185] Depend on Figure 3 It can be seen that in this embodiment, the face shape fitting algorithm includes the following steps:
[0186] Step S301: determining a projection mapping matrix from the three-dimensional average face model to the two-dimensional face image according to the internal facial feature points of the two-dimensional face image and the internal facial feature points of the three-dimensional average face model.
[0187] After obtaining the two-dimensional face image and the three-dimensional average face model, and after determining the internal facial feature points of the two-dimensional face image (hereinafter referred to as the two-dimensional internal feature points) and the internal facial feature points of the three-dimensional average face model (hereinafter referred to as the three-dimensional internal feature points) through a facial feature point location algorithm, the projection mapping matrix of the three-dimensional average face model to the two-dimensional face image can be determined based on the two-dimensional internal feature points and the three-dimensional internal feature points.
[0188] The internal feature points of the face refer to other feature points of the face excluding the feature points of the face contour, for example, some important feature points such as eyes, nose tip, corners of the mouth, eyebrows, etc.
[0189] The two-dimensional internal feature points and the three-dimensional internal feature points have the same semantics, that is, the two-dimensional internal feature points include feature points such as eyes, nose tip, mouth corners and eyebrows, and the three-dimensional internal feature points also include feature points at positions such as eyes, nose tip, mouth corners and eyebrows.
[0190] The projection mapping matrix can be represented by a mathematical expression P=K[R|T], where P is the projection mapping matrix, K is the camera internal parameter matrix, R is the rotation matrix, and T is the translation matrix. The projection mapping matrix can be used to project a three-dimensional face model into two dimensions to obtain a two-dimensional face image. The projection process includes transformations such as rotation, scaling, and deformation. The expressions of [R|T] and K are as follows:
[0191]
[0192] The projection mapping matrix can be determined by the following processing method:
[0193] Assume that the coordinates of the feature points of the two-dimensional face image are p i =(x i ,y i ), the feature points corresponding to the three-dimensional average face model are P i =(X i ,Y i ,Z i ), the corresponding relationship between the feature points of the two-dimensional face image and the feature points of the three-dimensional average face model is (p i ,P i )=(x i ,y i ,X i ,Y i ,Z i ) In this way, the projection mapping matrix between the two can be solved. Assume that the three rotation angles are roll, yaw, and pitch, then R = (r1, r2, r3) = R (roll) * R (yaw) * R (pitch),
[0194]
[0195] According to the camera imaging principle:
[0196] xi=f*(r*Pi+T1) / (r3*Pi+T3),yi=f*(r2*Pi+T2) / (e3*Pi+T3)
[0197] Where, T = (T1, T2, T3, T4);
[0198] Then, the following formula can be obtained from the perspective model: K*[R(roll, yaw, pitxch)*Pi+T], then the posture estimation at this time can be characterized as K is the known camera parameter, Pi is the feature point coordinates of the three-dimensional average face model, and the obtained two-dimensional image coordinates are pi. Since the coordinates obtained in this way are different from the coordinates of the key points of the face, the problem is transformed into the problem of finding the optimal solution:
[0199] (roll,yaw,pitch)=argmin{pi-Aq*[R(roll,yaw,pitch)*Pi+T]}(i=0,1,2..n)
[0200] The following is to use the least squares method to solve the formula to its optimal solution. In this embodiment, after setting multiple iterations, a relatively stable value can be basically reached, so that the rotation matrix R and the offset matrix T can be obtained, and the transformation relationship P from the three-dimensional coordinate point to the two-dimensional coordinate point can be obtained through transformation, that is, the projection mapping matrix.
[0201] Step S303: constructing a first three-dimensional face model corresponding to the two-dimensional face image according to the projection mapping matrix and the eigenvector of the three-dimensional eigenface space.
[0202] In the previous step, the projection mapping matrix P from the three-dimensional internal feature points to the two-dimensional internal feature points has been obtained. This step needs to use the projection mapping matrix and the feature vector to first fit a coarse three-dimensional face shape without considering the outer contour of the face, that is, the first three-dimensional face model.
[0203] In one example, step S303 can be implemented in the following manner: after obtaining the projection mapping matrix, the face shape parameter α can be fitted using the feature vector, which can be obtained by minimizing an energy function, and the energy function is shown as follows:
[0204]
[0205] Where N represents the number of internal feature points of the face (e.g. 49), y pro_2D,i represents the coordinate value of the two-dimensional internal feature point obtained by projecting the three-dimensional internal feature point into the two-dimensional space through the projection mapping matrix, y i represents the coordinate value of the two-dimensional internal feature point located by the facial feature point location algorithm, represents the covariance matrix of the two-dimensional internal feature points located by the facial feature point location algorithm, and α is the shape parameter that needs to be solved, also known as the shape coefficient.
[0206] In specific implementation, the shape parameter α can be solved in the following way: in the trained face shape data feature vector (the feature vector of the three-dimensional feature face space) {s1, s2, .....s 3n}(where n is the number of vertices of the 3D face model, s i The feature vector is a feature vector, and the feature vector with the same semantic information as the index value corresponding to the 49 three-dimensional internal feature points (the index value mainly includes a vector basis of 49*3 rows, each three rows represents a vertex coordinate, and corresponds to the serial number of the 3D vertex from 0 to 48) is obtained. The obtained feature vectors are formed into a new matrix U, and then the matrix U is mapped by the projection mapping matrix P. Where α is the coefficient to be solved, so that the three-dimensional internal feature points are converted to the coordinate points corresponding to the corresponding two-dimensional face image, and the error is calculated with the original two-dimensional internal feature points in the two-dimensional face image, and E is minimized. After obtaining α, the mathematical expression of the first three-dimensional face model is obtained as follows:
[0207] where s i Face shape feature vector, The average face data obtained through training
[0208] Step S305: performing contour feature point fitting on the first three-dimensional face model according to the face contour feature points of the two-dimensional face image.
[0209] After obtaining a rough first three-dimensional face model corresponding to the two-dimensional face image in the previous step, this step adds face contour information to the first three-dimensional face model to generate a more accurate three-dimensional face model.
[0210] In one example, step S305 may include the following sub-steps: 1) selecting from the first three-dimensional face model a three-dimensional point corresponding to (such as the closest) the facial contour feature point of the two-dimensional face image as an initial three-dimensional contour feature point; 2) mapping the initial three-dimensional contour feature point to the two-dimensional face image through the projection mapping matrix P; 3) selecting, through a nearest neighbor matching method (such as kdtree), the index value of the three-dimensional point corresponding to the mapped two-dimensional contour feature point, thereby obtaining the facial contour feature point of the first three-dimensional face model.
[0211] Step S307: If the error between the two-dimensional face image and the three-dimensional face model after the face contour feature points are fitted is less than a preset error, the three-dimensional face model after the face contour feature points are fitted is used as the three-dimensional face model.
[0212] The facial contour feature points of the first three-dimensional face model obtained in the previous step and the facial internal feature points of the first three-dimensional face model are reconnected to obtain the first three-dimensional face model with the facial contour feature points added; if the error between the two-dimensional face image and the three-dimensional face model after fitting the facial contour feature points is less than a preset error, the three-dimensional face model after fitting the facial contour feature points is used as the three-dimensional face model corresponding to the two-dimensional face image.
[0213] Please refer to Figure 5, which is a specific flow chart of face shape fitting of an embodiment of a face posture estimation method provided by the present application. If the error is greater than or equal to the preset error, then based on the three-dimensional face model after the face contour feature points are fitted, the above steps S301, S303, S305 and S307 are performed, that is: the three-dimensional average face model in these steps is replaced with the three-dimensional face model after the face contour feature points are fitted last time, and a new three-dimensional face model is formed each time. After repeating the above process for multiple times, the iteration is stopped when the error is less than the preset error, and the three-dimensional face model of the two-dimensional face image is reconstructed.
[0214] The above describes the face shape fitting algorithm that can be used in the method provided in this application, and the following describes the face expression fitting algorithm.
[0215] Please refer to Figure 6 , which is a flow chart of face shape and expression fitting of a face pose estimation method embodiment provided by the present application. Since the expression fitting algorithm adopted in this embodiment is implemented based on the expression base data included in the three-dimensional face prior data, the expression base data and its generation process are first described below.
[0216] In one example, for the 400 neutral expression 3D face model samples constructed above, another 46 expressions are constructed for each face, which is equivalent to constructing data of 400*47 3D face model samples, so that expression fitting data can be obtained. Figure 7 47 facial expression diagrams corresponding to a 3D face model sample of this embodiment are shown.
[0217] The expressions may be basic expressions, such as: anger, fear, disgust, annoyance, surprise, worry, happiness, hatred, sadness, etc.; or they may be compound expressions, such as: anger + disgust, anger + surprise, very angry, very disgust, very surprised, happiness + disgust, pleasure + surprise, sadness + anger, sadness + disgust, sadness + fear, sadness + surprise, etc.
[0218] In specific implementation, multiple expression construction methods of the prior art can be used to construct 3D face models of 46 other expressions for a 3D face model with a neutral expression. For example, the following expression construction method can be used to construct 3D face models of 46 expressions: by shape migration between triangular meshes between two sets of 3D models, it is not necessary for the source model and the target model to have the same number of vertices or triangles, or have the same connectivity; the user specifies a set of vertex labels to establish a correspondence between the triangles of the source model and the triangles of the target, and by calculating the mapping transformation matrix of the correspondence from the source model to the target model, and solving an optimization problem to transform the original model to the target shape.
[0219] After obtaining the 3D face model samples of 46 expressions, the difference data of the 46 expressions can be calculated, namely: the expression base. In specific implementation, the various expression bases X corresponding to the 3D average face model can be obtained by the following steps: 1) For each expression, the 3D average face model of the expression, also known as the average expression, is calculated based on the 400 3D face model samples corresponding to the expression, and 47 average expressions can be obtained, including the average expression corresponding to the neutral expression; 2) For each expression, the average expression of the expression is subtracted from each 3D face model sample of the expression, and the difference data of the 46 expressions is obtained. Among them G exp,j represents the difference data corresponding to the jth expression, N represents the number of 3D face model samples for each expression, such as 400, represents the average expression, S exp,i Represents the i-th 3D face model sample.
[0220] After obtaining various expression bases X corresponding to the three-dimensional average face model, the three-dimensional model S[i]=M+X[i] (i=0, 1, 2, ..n) of the average face with various expressions can be obtained by adding the three-dimensional average face model M and the expression base X. It should be noted that the expression base X is the same for each face.
[0221] Depend on Figure 6 It can be seen that in the above embodiment Figure 3 On the basis of the above, the step of expression fitting is added. After the first three-dimensional face model is obtained based on the 49 feature points inside the face, further expression fitting is performed based on the three-dimensional model. Because the two-dimensional face image can have any expression, and the three-dimensional model is expressionless, it is necessary to fit the expression. In this embodiment, the face shape and expression fitting process may include the following steps:
[0222] Step S601: determining a projection mapping matrix from the three-dimensional average face model to the two-dimensional face image according to the internal facial feature points of the two-dimensional face image and the internal facial feature points of the three-dimensional average face model.
[0223] Step S603: constructing a first three-dimensional face model corresponding to the two-dimensional face image according to the projection mapping matrix and the eigenvector of the three-dimensional eigenface space.
[0224] Step S605: performing contour feature point fitting on the first three-dimensional face model according to the face contour feature points of the two-dimensional face image.
[0225] Step S607: performing expression fitting on the three-dimensional face model after the contour feature points are fitted, according to the internal facial feature points of the two-dimensional face image and at least one expression base corresponding to the three-dimensional average face model.
[0226] In the previous step, 46 expression bases have been obtained. In this step, quadratic programming or non-negative minimum algorithm can be used to solve the fitting expression coefficients of the expression bases, and then the three-dimensional face model after expression fitting can be obtained. Its mathematical expression is as follows:
[0227] S exp_model =S model +G*a
[0228] in
[0229] Among them, S model represents the three-dimensional face model after the contour feature points are fitted, S exp_model represents the 3D face model after expression fitting, G represents the expression base, and a represents the fitting expression coefficient.
[0230] Please refer to Figure 8 , which is a specific flow chart of face shape and expression fitting of a face posture estimation method embodiment provided by the present application. Figure 8 It can be seen that in the above embodiment Figure 5 On this basis, an expression fitting step is added. After the first three-dimensional face model is obtained based on the 49 feature points inside the face, further expression fitting is performed based on the three-dimensional model. Because the two-dimensional face image can have any expression, and the three-dimensional model is expressionless, expression fitting is required.
[0231] Step S609: If the error between the two-dimensional face image and the three-dimensional face model after expression fitting is less than a preset error, the three-dimensional face model after expression fitting is used as the three-dimensional face model.
[0232] In one example, the method further includes the following steps: if the error is greater than or equal to a preset error, then constructing a three-dimensional face model corresponding to the two-dimensional face image based on the three-dimensional face model after expression fitting. That is, based on the three-dimensional face model after expression fitting, executing the above steps S601 to S609, that is, replacing the three-dimensional average face model in these steps with the three-dimensional face model after expression fitting constructed last time, forming a new three-dimensional face model each time, after repeating the above process for multiple times, the iteration is stopped when the error is less than the preset error, and the three-dimensional face model of the two-dimensional face image is reconstructed.
[0233] It can be seen from the above embodiments that the face posture estimation method provided in the embodiments of the present application obtains a two-dimensional face image to be processed, constructs a three-dimensional face model corresponding to the two-dimensional face image, and determines the face posture of the two-dimensional face image according to the face feature points of the three-dimensional face model and the face feature points of the two-dimensional face image; this processing method enables posture solution to be performed based on the three-dimensional face model corresponding to the two-dimensional face image, rather than only based on the three-dimensional average face model, so that when posture estimation is performed on the face with large angles and exaggerated expressions, a higher accuracy posture can still be obtained; therefore, the robustness of posture estimation can be effectively improved.
[0234] Second embodiment
[0235] In the above embodiment, a method for estimating a human face posture is provided, and correspondingly, the present application also provides a device for estimating a human face posture, which corresponds to the embodiment of the above method.
[0236] Please see Fig. 9 , which is a schematic diagram of an embodiment of the face pose estimation device of the present application. Since the device embodiment is basically similar to the method embodiment, the description is relatively simple, and the relevant parts can be referred to the partial description of the method embodiment. The device embodiment described below is only illustrative.
[0237] The present application further provides a face posture estimation device, comprising:
[0238] A two-dimensional face image acquisition unit 901, used to acquire a two-dimensional face image to be processed;
[0239] A three-dimensional face model building unit 903, used to build a three-dimensional face model corresponding to the two-dimensional face image;
[0240] The face posture determination unit 905 is used to determine the face posture of the two-dimensional face image according to the face feature points of the three-dimensional face model and the face feature points of the two-dimensional face image.
[0241] Optionally, the three-dimensional face model construction unit 903 is specifically configured to construct a three-dimensional face model corresponding to the two-dimensional face image by using a face shape fitting algorithm.
[0242] Optionally, the 3D face model building unit 903 includes:
[0243] A projection matrix determination subunit 9031 is used to determine a projection mapping matrix from the three-dimensional average face model to the two-dimensional face image according to the internal facial feature points of the two-dimensional face image and the internal facial feature points of the three-dimensional average face model;
[0244] A first model building subunit 9033 is used to build a first three-dimensional face model corresponding to the two-dimensional face image according to the projection mapping matrix and the eigenvector of the three-dimensional eigenface space;
[0245] A contour fitting subunit 9035 is used to fit contour feature points of the first three-dimensional model according to the facial contour feature points of the two-dimensional facial image;
[0246] The second model determination subunit 9037 is used to use the three-dimensional face model after fitting the facial contour feature points as the three-dimensional face model if the error between the two-dimensional face image and the three-dimensional face model after fitting the facial contour feature points is less than a preset error.
[0247] Optionally, the 3D face model building unit 903 further includes:
[0248] The third model building subunit is used to build a three-dimensional face model corresponding to the two-dimensional face image based on the three-dimensional face model fitted with the face contour feature points if the error is greater than or equal to a preset error.
[0249] Optionally, the three-dimensional face model construction unit 903 is specifically configured to construct a three-dimensional face model corresponding to the two-dimensional face image by using a facial expression fitting algorithm.
[0250] Optionally, the three-dimensional face model construction unit 903 is specifically used to construct a three-dimensional face model corresponding to the two-dimensional face image through a face shape and expression fitting algorithm.
[0251] Optionally, the 3D face model building unit 903 includes:
[0252] A projection matrix determination subunit, used to determine a projection mapping matrix from the three-dimensional average face model to the two-dimensional face image according to the internal facial feature points of the two-dimensional face image and the internal facial feature points of the three-dimensional average face model;
[0253] A first model building subunit is used to build a first three-dimensional face model corresponding to the two-dimensional face image according to the projection mapping matrix and the eigenvector of the three-dimensional eigenface space;
[0254] A contour fitting subunit, used for fitting contour feature points of the first three-dimensional model according to the facial contour feature points of the two-dimensional facial image;
[0255] An expression fitting subunit, configured to perform expression fitting on the three-dimensional face model after contour fitting according to the internal facial feature points of the two-dimensional face image and at least one expression base corresponding to the three-dimensional average face model;
[0256] The second model determination subunit is used to use the three-dimensional face model after expression fitting as the three-dimensional face model if the error between the two-dimensional face image and the three-dimensional face model after expression fitting is less than a preset error.
[0257] Optionally, also include:
[0258] The third model building subunit is used to build a three-dimensional face model corresponding to the two-dimensional face image according to the three-dimensional face model after expression fitting if the error is greater than or equal to a preset error.
[0259] Optionally, the contour fitting subunit includes:
[0260] A first contour feature point selection subunit is used to select three-dimensional points corresponding to the face contour feature points of the two-dimensional face image from the first three-dimensional face model as initial three-dimensional contour feature points;
[0261] A contour feature point mapping subunit, used for mapping the initial three-dimensional contour feature points to the two-dimensional face image through the projection mapping matrix;
[0262] The second contour feature point selection subunit is used to select the three-dimensional points corresponding to the mapped two-dimensional contour feature points through the nearest neighbor matching algorithm as the face contour feature points of the first three-dimensional face model.
[0263] Optionally, also include:
[0264] The first priori data determination unit is used to determine the three-dimensional average face model and the feature vector according to the three-dimensional face model sample.
[0265] Optionally, also include:
[0266] The second prior data determination unit is used to determine at least one expression base corresponding to the three-dimensional average face model according to the three-dimensional face model sample.
[0267] Third embodiment
[0268] Please refer to Fig.11 , which is a schematic diagram of an electronic device embodiment of the present application. Since the device embodiment is basically similar to the method embodiment, the description is relatively simple, and the relevant parts can be referred to the partial description of the method embodiment. The device embodiment described below is only illustrative.
[0269] An electronic device of this embodiment includes: a processor 1101 and a memory 1102; the memory is used to store a program for implementing a face posture estimation method. After the device is powered on and the program of the face posture estimation method is run through the processor, the following steps are performed: obtaining a two-dimensional face image to be processed; constructing a three-dimensional face model corresponding to the two-dimensional face image; and determining the face posture of the two-dimensional face image based on the face feature points of the three-dimensional face model and the face feature points of the two-dimensional face image.
[0270] Fourth embodiment
[0271] Corresponding to the above-mentioned face posture estimation method, the present application also provides a three-dimensional face reconstruction method, and the execution subject of the method includes a three-dimensional face reconstruction device.
[0272] Please refer to Fig.12 , which is a flow chart of an embodiment of a 3D face reconstruction method provided by the present application. The parts of this embodiment that are the same as those of the first embodiment are not repeated here. Please refer to the corresponding parts in the first embodiment. A 3D face reconstruction method provided by the present application includes:
[0273] Step S1200: Obtain a two-dimensional face image to be processed.
[0274] Step S1201: determining a projection mapping matrix from the three-dimensional average face model to the two-dimensional face image according to the internal facial feature points of the two-dimensional face image and the internal facial feature points of the three-dimensional average face model.
[0275] Step S1203: constructing a first three-dimensional face model corresponding to the two-dimensional face image according to the projection mapping matrix and the eigenvector of the three-dimensional eigenface space.
[0276] Step S1205: performing contour feature point fitting on the first three-dimensional face model according to the face contour feature points of the two-dimensional face image.
[0277] Step S1207: If the error between the two-dimensional face image and the fitted three-dimensional face model is less than a preset error, the fitted three-dimensional face model is used as the three-dimensional face model of the two-dimensional face image.
[0278] Depend on Fig.13 It can be seen that the method may further include the following steps:
[0279] Step S1301: If the error is greater than or equal to a preset error, constructing a three-dimensional face model corresponding to the two-dimensional face image according to the fitted three-dimensional face model.
[0280] Depend on Fig.14It can be seen that after fitting the contour feature points of the first three-dimensional face model according to the facial contour feature points of the two-dimensional face image, the following steps may also be included:
[0281] Step S1401: performing expression fitting on the three-dimensional face model after contour fitting according to the internal facial feature points of the two-dimensional face image and at least one expression base corresponding to the three-dimensional average face model.
[0282] In one example, after constructing the first three-dimensional face model corresponding to the two-dimensional face image according to the projection mapping matrix and the eigenvector of the three-dimensional eigenface space, the following steps may also be included: performing expression fitting on the first three-dimensional face model according to at least one expression base corresponding to the three-dimensional average face model; correspondingly, step S1205 may be implemented as follows: performing contour feature point fitting on the first three-dimensional face model after expression fitting according to the facial contour feature points of the two-dimensional face image.
[0283] In one example, the contour feature point fitting of the first three-dimensional model based on the facial contour feature points of the two-dimensional facial image may include the following sub-steps: 1) selecting three-dimensional points corresponding to the facial contour feature points of the two-dimensional facial image from the first three-dimensional facial model as initial three-dimensional contour feature points; 2) mapping the initial three-dimensional contour feature points to the two-dimensional facial image through the projection mapping matrix; 3) selecting three-dimensional points corresponding to the mapped two-dimensional contour feature points as facial contour feature points of the first three-dimensional facial model through a nearest neighbor matching algorithm.
[0284] In an example, the method may further include the following step: determining the three-dimensional average face model and the feature vector according to the three-dimensional face model sample.
[0285] In one example, the method may further include the following step: determining at least one expression base corresponding to the three-dimensional average face model based on the three-dimensional human face model sample.
[0286] It can be seen from the above embodiments that the three-dimensional face reconstruction method provided in the embodiments of the present application obtains a two-dimensional face image to be processed; determines a projection mapping matrix from the three-dimensional average face model to the two-dimensional face image according to the internal facial feature points of the two-dimensional face image and the internal facial feature points of the three-dimensional average face model; constructs a first three-dimensional face model corresponding to the two-dimensional face image according to the projection mapping matrix and the feature vector of the three-dimensional feature face space; performs contour feature point fitting on the first three-dimensional face model according to the facial contour feature points of the two-dimensional face image; if the error between the two-dimensional face image and the fitted three-dimensional face model is less than a preset error, the fitted three-dimensional face model is used as the three-dimensional face model of the two-dimensional face image; this processing method drives the fitting of the three-dimensional face model based on the three-dimensional face prior data, considers the combination of the internal feature points of the face and the external contour feature points, and then iterates the fitting to minimize the error between the three-dimensional face model and the two-dimensional face image, restores the real face to the greatest extent, and the reconstructed three-dimensional face model conforms to the biological characteristics of the face; therefore, the reconstruction accuracy of the three-dimensional face model can be effectively improved.
[0287] Fifth embodiment
[0288] In the above embodiment, a three-dimensional face reconstruction method is provided, and correspondingly, the present application also provides a three-dimensional face reconstruction device. The device corresponds to the embodiment of the above method.
[0289] Please see Fig.15 , which is a schematic diagram of an embodiment of the 3D face reconstruction device of the present application. Since the device embodiment is basically similar to the method embodiment, the description is relatively simple, and the relevant parts can be referred to the partial description of the method embodiment. The device embodiment described below is only illustrative.
[0290] The present application further provides a three-dimensional face reconstruction device, comprising:
[0291] A two-dimensional face image acquisition unit 1500 is used to acquire a two-dimensional face image to be processed;
[0292] A projection matrix determination subunit 1501 is used to determine a projection mapping matrix from the three-dimensional average face model to the two-dimensional face image according to the internal facial feature points of the two-dimensional face image and the internal facial feature points of the three-dimensional average face model;
[0293] A first model building subunit 1503 is used to build a first three-dimensional face model corresponding to the two-dimensional face image according to the projection mapping matrix and the eigenvector of the three-dimensional eigenface space;
[0294] A contour fitting subunit 1505 is used to fit contour feature points of the first three-dimensional face model according to the face contour feature points of the two-dimensional face image;
[0295] The second model determination unit 1507 is configured to use the fitted 3D face model as the 3D face model of the 2D face image if the error between the 2D face image and the fitted 3D face model is less than a preset error.
[0296] Optionally, also include:
[0297] The first expression fitting unit is used to perform expression fitting on the three-dimensional face model after contour fitting according to the internal facial feature points of the two-dimensional face image and at least one expression base corresponding to the three-dimensional average face model.
[0298] Optionally, also include:
[0299] a second expression fitting unit, configured to perform expression fitting on the first three-dimensional human face model according to at least one expression base corresponding to the three-dimensional average face model;
[0300] The contour fitting subunit is specifically used to perform contour feature point fitting on the first three-dimensional face model after expression fitting according to the face contour feature points of the two-dimensional face image.
[0301] Optionally, the contour fitting subunit 1505 includes:
[0302] A first contour feature point selection subunit is used to select three-dimensional points corresponding to the face contour feature points of the two-dimensional face image from the first three-dimensional face model as initial three-dimensional contour feature points;
[0303] A contour feature point mapping subunit, used for mapping the initial three-dimensional contour feature points to the two-dimensional face image through the projection mapping matrix;
[0304] The second contour feature point selection subunit is used to select the three-dimensional points corresponding to the mapped two-dimensional contour feature points through the nearest neighbor matching algorithm as the face contour feature points of the first three-dimensional face model.
[0305] Optionally, also include:
[0306] The third model building subunit is used to build a three-dimensional face model corresponding to the two-dimensional face image according to the fitted three-dimensional face model if the error is greater than or equal to a preset error.
[0307] Optionally, also include:
[0308] The first priori data determination unit is used to determine the three-dimensional average face model and the feature vector according to the three-dimensional face model sample.
[0309] Optionally, also include:
[0310] The second prior data determination unit is used to determine at least one expression base corresponding to the three-dimensional average face model according to the three-dimensional face model sample.
[0311] Sixth embodiment
[0312] Please refer to Fig.16 , which is a schematic diagram of an electronic device embodiment of the present application. Since the device embodiment is basically similar to the method embodiment, the description is relatively simple, and the relevant parts can be referred to the partial description of the method embodiment. The device embodiment described below is only illustrative.
[0313] An electronic device of this embodiment includes: a processor 1601 and a memory 1602; the memory is used to store a program for implementing a three-dimensional face reconstruction method. After the device is powered on and runs the program of the three-dimensional face reconstruction method through the processor, the following steps are performed: obtaining a two-dimensional face image to be processed; determining a projection mapping matrix from the three-dimensional average face model to the two-dimensional face image based on the internal facial feature points of the two-dimensional face image and the internal facial feature points of the three-dimensional average face model; constructing a first three-dimensional face model corresponding to the two-dimensional face image based on the projection mapping matrix and the feature vector of the three-dimensional feature face space; fitting the contour feature points of the first three-dimensional face model based on the facial contour feature points of the two-dimensional face image; if the error between the two-dimensional face image and the fitted three-dimensional face model is less than a preset error, using the fitted three-dimensional face model as the three-dimensional face model of the two-dimensional face image.
[0314] Although the present application is disclosed as above in the form of a preferred embodiment, it is not intended to limit the present application. Any technical personnel in this field may make possible changes and modifications without departing from the spirit and scope of the present application. Therefore, the scope of protection of the present application shall be based on the scope defined by the claims of the present application.
[0315] In a typical configuration, a computing device includes one or more processors (CPU), input / output interfaces, network interfaces, and memory.
[0316] The memory may include non-permanent storage in a computer-readable medium, random access memory (RAM) and / or non-volatile memory in the form of read-only memory (ROM) or flash RAM. The memory is an example of a computer-readable medium.
[0317] 1. Computer-readable media includes permanent and non-permanent, removable and non-removable media that can be used to store information by any method or technology. Information can be computer-readable instructions, data structures, program modules or other data. Examples of computer storage media include, but are not limited to, phase change memory (PRAM), static random access memory (SRAM), dynamic random access memory (DRAM), other types of random access memory (RAM), read-only memory (ROM), electrically erasable programmable read-only memory (EEPROM), flash memory or other memory technology, compact disk read-only memory (CD-ROM), digital versatile disk (DVD) or other optical storage, magnetic cassettes, magnetic tape magnetic disk storage or other magnetic storage devices or any other non-transmission media that can be used to store information that can be accessed by a computing device. As defined herein, computer-readable media does not include non-transitory media such as modulated data signals and carrier waves.
[0318] 2. Those skilled in the art should understand that the embodiments of the present application can be provided as methods, systems or computer program products. Therefore, the present application can take the form of a complete hardware embodiment, a complete software embodiment or an embodiment combining software and hardware. Moreover, the present application can take the form of a computer program product implemented on one or more computer-usable storage media (including but not limited to disk storage, CD-ROM, optical storage, etc.) containing computer-usable program code.
Claims
1. A method for estimating a face posture, characterized in that: include: Obtain a two-dimensional face image to be processed; Constructing a three-dimensional face model corresponding to the two-dimensional face image; the constructing of the three-dimensional face model corresponding to the two-dimensional face image includes: determining a projection mapping matrix from the three-dimensional average face model to the two-dimensional face image according to the internal facial feature points of the two-dimensional face image and the internal facial feature points of the three-dimensional average face model; constructing a first three-dimensional face model corresponding to the two-dimensional face image according to the projection mapping matrix and the eigenvector of the three-dimensional eigenface space; performing contour feature point fitting on the first three-dimensional face model according to the facial contour feature points of the two-dimensional face image; performing expression fitting on the three-dimensional face model after contour fitting according to the internal facial feature points of the two-dimensional face image and at least one expression base corresponding to the three-dimensional average face model; if the error between the two-dimensional face image and the three-dimensional face model after expression fitting is less than a preset error, using the three-dimensional face model after expression fitting as the three-dimensional face model; According to the facial feature points of the three-dimensional face model and the facial feature points of the two-dimensional face image, a rotation matrix from the reconstructed three-dimensional face model to the two-dimensional face image is obtained; and the facial posture of the two-dimensional face image is determined according to the rotation matrix, and the facial posture includes the angle information of the face orientation.
2. The method according to claim 1, characterized in that: The constructing of a three-dimensional face model corresponding to the two-dimensional face image includes: A three-dimensional face model corresponding to the two-dimensional face image is constructed by a face shape fitting algorithm.
3. The method according to claim 2, characterized in that The face shape fitting algorithm comprises: Determine a projection mapping matrix from the three-dimensional average face model to the two-dimensional face image according to the internal facial feature points of the two-dimensional face image and the internal facial feature points of the three-dimensional average face model; Constructing a first three-dimensional face model corresponding to the two-dimensional face image according to the projection mapping matrix and the eigenvector of the three-dimensional eigenface space; According to the facial contour feature points of the two-dimensional facial image, fitting the contour feature points of the first three-dimensional model; If the error between the two-dimensional face image and the three-dimensional face model after the face contour feature points are fitted is less than a preset error, the three-dimensional face model after the face contour feature points are fitted is used as the three-dimensional face model.
4. The method according to claim 3, characterized in that Also includes: If the error is greater than or equal to a preset error, a three-dimensional face model corresponding to the two-dimensional face image is constructed based on the three-dimensional face model fitted with the face contour feature points.
5. The method according to claim 1, characterized in that The constructing of the expression three-dimensional face model corresponding to the two-dimensional face image comprises: A three-dimensional face model corresponding to the two-dimensional face image is constructed through a face expression fitting algorithm.
6. The method according to claim 1, characterized in that The constructing of a three-dimensional face model corresponding to the two-dimensional face image includes: A three-dimensional face model corresponding to the two-dimensional face image is constructed through a face shape and expression fitting algorithm.
7. The method according to claim 1, characterized in that Also includes: If the error is greater than or equal to a preset error, a three-dimensional face model corresponding to the two-dimensional face image is constructed according to the three-dimensional face model after expression fitting.
8. The method according to claim 3 or 7, characterized in that: The step of fitting the first three-dimensional model with the facial contour feature points according to the facial contour feature points of the two-dimensional facial image comprises: Selecting, from the first three-dimensional face model, three-dimensional points corresponding to the face contour feature points of the two-dimensional face image as initial three-dimensional contour feature points; Mapping the initial three-dimensional contour feature points to the two-dimensional face image through the projection mapping matrix; By using a nearest neighbor matching algorithm, three-dimensional points corresponding to the mapped two-dimensional contour feature points are selected as facial contour feature points of the first three-dimensional face model.
9. The method according to claim 3 or 1, characterized in that: Also includes: The three-dimensional average face model and the feature vector are determined according to the three-dimensional face model sample.
10. The method according to claim 1, characterized in that Also includes: At least one expression base corresponding to the three-dimensional average face model is determined according to the three-dimensional face model sample.
11. A three-dimensional face reconstruction method, characterized in that: include: Obtain a two-dimensional face image to be processed; Determine a projection mapping matrix from the three-dimensional average face model to the two-dimensional face image according to the internal facial feature points of the two-dimensional face image and the internal facial feature points of the three-dimensional average face model; Constructing a first three-dimensional face model corresponding to the two-dimensional face image according to the projection mapping matrix and the eigenvector of the three-dimensional eigenface space; According to the facial contour feature points of the two-dimensional facial image, fitting the contour feature points of the first three-dimensional facial model; performing expression fitting on the three-dimensional face model after contour fitting according to the internal facial feature points of the two-dimensional face image and at least one expression base corresponding to the three-dimensional average face model; If the error between the two-dimensional face image and the fitted three-dimensional face model is less than a preset error, the fitted three-dimensional face model is used as the three-dimensional face model of the two-dimensional face image.
12. The method according to claim 11, characterized in that After constructing the first three-dimensional face model corresponding to the two-dimensional face image according to the projection mapping matrix and the eigenvector of the three-dimensional eigenface space, the method further includes: performing expression fitting on the first three-dimensional human face model according to at least one expression base corresponding to the three-dimensional average face model; The step of fitting the first three-dimensional face model with the face contour feature points according to the face contour feature points of the two-dimensional face image comprises: According to the facial contour feature points of the two-dimensional facial image, contour feature point fitting is performed on the first three-dimensional facial model after expression fitting.
13. The method according to claim 11, characterized in that The step of fitting the first three-dimensional face model with the face contour feature points according to the face contour feature points of the two-dimensional face image comprises: Selecting, from the first three-dimensional face model, three-dimensional points corresponding to the face contour feature points of the two-dimensional face image as initial three-dimensional contour feature points; Mapping the initial three-dimensional contour feature points to the two-dimensional face image through the projection mapping matrix; By using a nearest neighbor matching algorithm, three-dimensional points corresponding to the mapped two-dimensional contour feature points are selected as facial contour feature points of the first three-dimensional face model.
14. The method according to claim 11, characterized in that Also includes: If the error is greater than or equal to a preset error, a three-dimensional face model corresponding to the two-dimensional face image is constructed according to the fitted three-dimensional face model.
15. The method according to claim 11, characterized in that Also includes: The three-dimensional average face model and the feature vector are determined according to the three-dimensional face model sample.
16. The method according to claim 11 or 12, characterized in that: Also includes: At least one expression base corresponding to the three-dimensional average face model is determined according to the three-dimensional face model sample.
17. A face posture estimation device corresponding to the method of claim 1, characterized in that: include: A two-dimensional face image acquisition unit, used to acquire a two-dimensional face image to be processed; A three-dimensional face model construction unit, used to construct a three-dimensional face model corresponding to the two-dimensional face image; The face posture determination unit is used to determine the face posture of the two-dimensional face image according to the face feature points of the three-dimensional face model and the face feature points of the two-dimensional face image, wherein the face posture includes angle information of face orientation.
18. A 3D face reconstruction device corresponding to the method of claim 11, characterized in that: include: A two-dimensional face image acquisition unit, used to acquire a two-dimensional face image to be processed; A projection matrix determination subunit, used to determine a projection mapping matrix from the three-dimensional average face model to the two-dimensional face image according to the internal facial feature points of the two-dimensional face image and the internal facial feature points of the three-dimensional average face model; A first model building subunit is used to build a first three-dimensional face model corresponding to the two-dimensional face image according to the projection mapping matrix and the eigenvector of the three-dimensional eigenface space; A contour fitting subunit, configured to fit contour feature points of the first three-dimensional face model according to the face contour feature points of the two-dimensional face image; The second model determination unit is used to use the fitted three-dimensional face model as the three-dimensional face model of the two-dimensional face image if the error between the two-dimensional face image and the fitted three-dimensional face model is less than a preset error.
19. An electronic device corresponding to the method according to claim 1, characterized in that: include: processor; as well as The memory is used to store a program for implementing a face posture estimation method. After the device is powered on and the program of the face posture estimation method is run through the processor, the following steps are performed: obtaining a two-dimensional face image to be processed; constructing a three-dimensional face model corresponding to the two-dimensional face image; and determining the face posture of the two-dimensional face image according to the face feature points of the three-dimensional face model and the face feature points of the two-dimensional face image, wherein the face posture includes angle information of the face orientation.
20. An electronic device corresponding to the method according to claim 11, characterized in that: include: processor; as well as The memory is used to store a program for implementing the three-dimensional face reconstruction method. After the device is powered on and the program of the three-dimensional face reconstruction method is run through the processor, the following steps are performed: obtaining a two-dimensional face image to be processed; determining a projection mapping matrix from the three-dimensional average face model to the two-dimensional face image according to the internal facial feature points of the two-dimensional face image and the internal facial feature points of the three-dimensional average face model; A first three-dimensional face model corresponding to the two-dimensional face image is constructed according to the projection mapping matrix and the eigenvector of the three-dimensional eigenface space; contour feature points are fitted to the first three-dimensional face model according to the facial contour feature points of the two-dimensional face image; if the error between the two-dimensional face image and the fitted three-dimensional face model is less than a preset error, the fitted three-dimensional face model is used as the three-dimensional face model of the two-dimensional face image.
