A method, device, electronic device and medium for generating a three-dimensional face model
By gradually iteratively calculating translation, rotation and PCA coefficients, and adjusting the 3DMM average model, the problem of inconsistent generation of three-dimensional face models in the existing technology is solved, and the matching degree and detail accuracy between the model and the actual face are improved.
Patent Information
- Application Number
- CN201910707899.3
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2019-08-01
- Publication Date
- 2024-09-06
- Estimated Expiration
- 2039-08-01
AI Technical Summary
When the existing technology generates a three-dimensional face model, the lack of a gradual process leads to detail problems, such as cheeks being squashed, eyes overlapping, and eyelid details lost, resulting in the generated three-dimensional face model being inconsistent with the actual face and having low accuracy.
The target PCA coefficients are obtained through stepwise iterative calculations. First, the translation variables from the 3D reconstruction model to the 3DMM average model are calculated. Then the rotation variables are calculated. Finally, the translation, rotation and PCA coefficients are calculated. These coefficients are used to adjust the 3DMM average model to generate a 3D face model. Ensure accuracy for each unknown quantity.
The consistency between the 3D face model and the actual face is improved, detail errors are reduced, and the generated 3D face model is closer to the actual face, which is suitable for subsequent processing such as the customization of avatars and facial accessories.
Smart Images

Figure CN110415341B
Abstract
Description
Technical Field
[0001] The present application relates to the field of 3D modeling technology, and in particular to a method, device, electronic device and computer-readable storage medium for generating a three-dimensional face model. Background Art
[0002] Compared with two-dimensional plane models, three-dimensional models have more spatial information, higher operability and restoration. The three-dimensional face model based on actual face information is one of the most widely used.
[0003] The three-dimensional face model constructed through 3D modeling technology can not only be used to identify identity information and build a virtual image based on the actual image of the person, but also has very rich plasticity and has very broad application value in many aspects.
[0004] The basis of building a 3D face model based on actual face information is to restore the actual face information as much as possible and obtain a 3D face model with the same detailed information as the actual face. However, under the existing relevant technologies, because the optimal solution lacks a gradual process in the early iteration process, it is easy to cause the generated 3D face model to have details such as cheeks being flattened, eyes overlapping, and eyelid details missing. The generated 3D face model is not consistent with the actual face and has low accuracy, which is not conducive to any subsequent processing operations based on the premise of high consistency, such as creating exclusive facial accessories for the corresponding user based on the 3D face model.
[0005] Therefore, how to improve the above technical defects and provide a three-dimensional face model generation solution with fewer detail errors, closer to the actual face and higher consistency is an urgent problem to be solved by technical personnel in this field. Summary of the invention
[0006] In view of this, the present application provides a method, device, electronic device and computer-readable storage medium for generating a three-dimensional face model, aiming to reduce the detail problems that arise when restoring actual facial information to a three-dimensional face model and improve the consistency between the three-dimensional face model and the actual face.
[0007] To achieve the above-mentioned purpose, the first aspect of the present application provides a method for generating a three-dimensional face model, the method comprising:
[0008] Calculate the translation variable from the three-dimensional reconstructed model to the 3DMM average model through a first iterative formula to obtain a converged first translation variable;
[0009] The translation variable and the rotation variable from the three-dimensional reconstructed model to the 3DMM average model are calculated simultaneously by a second iterative formula to obtain a converged second translation variable and a first rotation variable; wherein the initial value of the translation variable when the second iterative formula is used for the first iteration is the first translation variable;
[0010] The translation variable, rotation variable and PCA weighted coefficient of the three-dimensional reconstructed model to the 3DMM average model are calculated simultaneously by the third iterative formula to obtain the converged target PCA coefficient; wherein the initial value of the translation variable when the first iteration is performed by the third iterative formula is the second translation variable, and the initial value of the rotation variable is the first rotation variable;
[0011] The target PCA coefficients are used to adjust the 3DMM average model to obtain a three-dimensional face model.
[0012] To achieve the above-mentioned purpose, the second aspect of the present application provides a device for generating a three-dimensional face model, the device comprising:
[0013] A translation variable iterative calculation unit, used for calculating the translation variable from the three-dimensional reconstruction model to the 3DMM average model through a first iterative formula to obtain a converged first translation variable;
[0014] A translation and rotation variable iterative calculation unit, used for simultaneously calculating the translation variable and the rotation variable from the three-dimensional reconstructed model to the 3DMM average model through a second iterative formula, and obtaining a converged second translation variable and a first rotation variable; wherein the initial value of the translation variable when the second iterative formula is used for the first iteration is the first translation variable;
[0015] A translation, rotation and PCA coefficient iterative calculation unit, used to simultaneously calculate the translation variable, rotation variable and PCA weighted coefficient from the three-dimensional reconstructed model to the 3DMM average model through a third iterative formula to obtain a converged target PCA coefficient; wherein the initial value of the translation variable when the first iteration is performed through the third iterative formula is the second translation variable, and the initial value of the rotation variable is the first rotation variable;
[0016] The three-dimensional face model obtaining unit is used to adjust the 3DMM average model using the target PCA coefficient to obtain a three-dimensional face model.
[0017] To achieve the above-mentioned purpose, the third aspect of the present application provides an electronic device, which includes a processor and a memory; wherein the memory is used to store a computer program, and the computer program is loaded and executed by the processor to implement the method for generating a three-dimensional face model as described above.
[0018] To achieve the above-mentioned objectives, the fourth aspect of the present application provides a storage medium, in which computer executable instructions are stored. When the computer executable instructions are loaded and executed by a processor, the method for generating a three-dimensional face model as described above is implemented.
[0019] It can be seen from the above scheme that the present application provides a method for generating a three-dimensional face model, including: calculating the translation variable from the three-dimensional reconstructed model to the 3DMM average model through a first iterative formula to obtain the first translation variable after convergence; calculating the translation variable and rotation variable from the three-dimensional reconstructed model to the 3DMM average model through a second iterative formula to obtain the second translation variable and the first rotation variable after convergence; wherein, the initial value of the translation variable when the second iterative formula is used for the first iteration is the first translation variable; calculating the translation variable, rotation variable and PCA weighting coefficient from the three-dimensional reconstructed model to the 3DMM average model through a third iterative formula to obtain the target PCA coefficient after convergence; wherein, the initial value of the translation variable when the third iterative formula is used for the first iteration is the second translation variable, and the initial value of the rotation variable is the first rotation variable; adjusting the 3DMM average model using the PCA coefficient to obtain a three-dimensional face model.
[0020] According to the method for generating a three-dimensional face model provided by the present application, it can be seen that the present application uses a progressive method to iterate and calculate the target PCA coefficient step by step. The first, second and third iterative formulas have one (translation variable), two (translation variable and rotation variable) and three (translation variable, rotation variable and PCA coefficient) unknown quantities, respectively. The first translation variable obtained when the first iterative formula is iterated to convergence will be used as the initial value of the translation variable in the second iterative formula for subsequent iterations. Correspondingly, the second translation variable and the first rotation variable obtained when the second iterative formula is iterated to convergence will be used as the initial value of the translation variable and the initial value of the rotation variable in the third iterative formula for subsequent iterations. Compared with the method of directly iterating three unknown quantities at the same time through one iterative formula, the iterative methods of the first two iterative formulas on the translation variable and the translation & rotation variable make the translation variable and the rotation variable as accurate as possible, and serve as a basis to help determine the iteration direction of other unknown quantities, which can eliminate as many detail problems as possible for the subsequently generated three-dimensional face model caused by inaccurate initial values, and improve the consistency between the three-dimensional face model and the actual face.
[0021] The present application also provides a device, an electronic device and a computer-readable storage medium corresponding to the above-mentioned method for generating a three-dimensional face model, which can also achieve the above-mentioned technical effects.
[0022] It should be understood that the foregoing general description and the following detailed description are exemplary only and are not restrictive of the present application. BRIEF DESCRIPTION OF THE DRAWINGS
[0023] In order to more clearly illustrate the embodiments of the present application or the technical solutions in the prior art, the drawings required for use in the embodiments or the description of the prior art will be briefly introduced below. Obviously, the drawings described below are only embodiments of the present application. For ordinary technicians in this field, other drawings can be obtained based on the provided drawings without paying any creative work.
[0024] Figure 1 An architecture diagram of a system for generating a three-dimensional face model provided in an embodiment of the present application;
[0025] Figure 2 A timing diagram of a method for generating a three-dimensional face model provided in an embodiment of the present application;
[0026] Figure 3 A flowchart of a method for rendering a three-dimensional face model according to skin color parameters of various parts of the face provided in an embodiment of the present application;
[0027] Figure 4 A flowchart of a method for adjusting a three-dimensional face model provided in an embodiment of the present application;
[0028] Figure 5 A schematic diagram of the model effect transformation for preliminarily registering a three-dimensional reconstructed model to a 3DMM average model provided in an embodiment of the present application;
[0029] Figure 6 The embodiment of the present application provides Figure 5 Schematic diagram of the model effect transformation based on the results and re-registration based only on the translation variable;
[0030] Figure 7 The embodiment of the present application provides Figure 6 Schematic diagram of the model effect transformation based on the results and the re-registration based on the translation variables and rotation variables;
[0031] Figure 8 The embodiment of the present application provides Figure 7 Schematic diagram of the model effect transformation based on the results and the re-registration based on the translation variables, rotation variables and PCA coefficients;
[0032] Fig. 9 The initial 3DMM average model provided in the embodiment of the present application is Figure 8 Schematic diagram of model effect comparison between results;
[0033] Fig.10 A schematic diagram showing a comparison of model effects between a 3D face model processed according to the prior art and a 3D face model processed according to the present application provided in an embodiment of the present application;
[0034] Fig.11 A structural block diagram of a device for generating a three-dimensional face model provided in an embodiment of the present application;
[0035] Fig.12 A schematic diagram of the structure of an electronic device provided in an embodiment of the present application;
[0036] Reference numerals:
[0037] 10. Face information collector 20. Three-dimensional face model generator 30. Display. DETAILED DESCRIPTION
[0038] The present application provides a method, device, electronic device and computer-readable storage medium for generating a three-dimensional face model, aiming to reduce detail problems that occur when actual face information is restored to a three-dimensional face model and improve the consistency between the three-dimensional face model and the actual face.
[0039] In order to make the purpose, technical scheme and advantages of the embodiments of the present application clearer, the technical scheme in the embodiments of the present application will be clearly and completely described below in conjunction with the drawings in the embodiments of the present application. Obviously, the described embodiments are part of the embodiments of the present application, not all of the embodiments. Based on the embodiments in the present application, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of this application.
[0040] To facilitate understanding of the method for generating a three-dimensional face model provided by the present application, the system in which it is located is introduced below, so as to facilitate understanding of the method in combination with the operations performed by each execution subject in the system. Figure 1 As shown, the three-dimensional face model generation system includes: a face information collector 10, a three-dimensional face model generator 20, and a display 30. Data connections for transmitting data are established between the face information collector 10 and the three-dimensional face model generator 20, and between the three-dimensional face model generator 20 and the display 30.
[0041] The face information collector 10 is used to collect the face information of the actual user through a scanner or camera set thereon, and to establish a three-dimensional reconstruction model based on the collected face information. The face information collector 10 sends the established three-dimensional reconstruction model to the three-dimensional face model generator 20, so that the three-dimensional face model generator 20 performs registration based on the received three-dimensional reconstruction model and the 3DMM (3D Morphable Models, three-dimensional transformation model) average model (here refers to the average model calculated based on the face model database of a unified topological structure composed of many users, which has a high reference in the topological structure of the three-dimensional face model), and adjusts the 3DMM average model according to the user's actual facial details contained in the three-dimensional reconstruction model to obtain a three-dimensional face model consistent with the actual user's face. Finally, the three-dimensional face model generator 20 presents the generated three-dimensional face model to the user through the display 30. The generated three-dimensional face model can also be used in many other aspects, such as building a user's virtual image based on it, helping the user customize corresponding facial accessories based on it, etc.
[0042] Among them, the face information collector 10 can be set far away from the three-dimensional face model generator 20. The face information collector 10 is set in a place that is easy for users to access, and the number can be set in multiples. Since the three-dimensional face model generator 20 is responsible for the registration operation, the required computing power can be provided by the provider of the service (i.e., the three-dimensional face model generation service) in its own computer room or data center for maintenance and updating and upgrading. The three-dimensional face model generator 20 can be specifically manifested as a single processor or server, or a cluster composed of multiple processors or servers. The display 30 can include the display screen of the terminal held by the user whose face information is collected, or it can be displayed on the terminal display screen of the service provider, or it can be displayed on any display device authorized by the corresponding user, and it is not specifically limited here.
[0043] Based on the above system, this application provides a timing diagram of a method for generating a three-dimensional face model, see Figure 2 , Figure 2 The operations performed by each execution entity are described in the following steps:
[0044] S101: the face information collector 10 sends the 3D reconstruction model to the 3D face model generator 20;
[0045] The face information collector 10 obtains the facial information of the user's face placed in its own scanning area through a scanner or other sensor that can obtain the user's facial information, and transforms the facial information into multiple feature points that can describe the facial detail information through its own built-in calculation logic, and finally constructs a three-dimensional reconstruction model through these feature points.
[0046] It should be noted that due to the differences in vertices and facets in the three-dimensional reconstruction of the face model (the vertices and facets obtained by scanning the user each time are different), the three-dimensional reconstruction model generated by the face information collector 10 cannot be directly used as an actual three-dimensional face model due to its inconsistent topological structure. Its advantage is that it contains the real facial details of the user. Therefore, the required three-dimensional face model will be obtained based on the topological structure provided by the 3DMM average model and combined with the real facial detail features contained in the three-dimensional reconstruction model.
[0047] S102: The 3D face model generator 20 calculates the translation variable from the 3D reconstruction model to the 3DMM average model through a first iterative formula to obtain a converged first translation variable;
[0048] Starting from this step, the 3D face model generator 20 starts to use a progressive method to iterate and calculate the unknown quantities required to align the 3D reconstruction model to the 3DMM average model. Among them, the key unknown quantities include 3: translation variables, rotation variables and PCA (Principal Component Analysis) coefficients. The progressive method means that it is not like the prior art that directly iterates the three unknown quantities at the same time through an iterative formula containing the above three unknown quantities, but it is based on the relationship between the three unknown quantities, iterating in sequence and step by step, so that the iterated values are closer to the actual values in this way, thereby making the generated 3D face model have fewer details and higher consistency with the actual face.
[0049] This step is the first step of the gradual iteration in an asymptotic manner, that is, firstly, the translation variable from the three-dimensional reconstructed model to the 3DMM average model is iteratively calculated through the first iterative formula to obtain the first translation variable after convergence. The reason why the translation variable is selected as the first unknown quantity to be iterated is that compared with the rotation variable and the PCA coefficient, the rotation variable is easier to determine and obtain a higher precision value based on the translation variable, while the PCA coefficient is based on the translation variable and the rotation variable. Based on the above reasons, the present application selects the translation variable as the first unknown quantity to be iterated.
[0050] The first iterative formula can be specifically expressed as the following formula:
[0051] ;
[0052] Among them, Represents a 3D coordinate point in the 3DMM average model. is the unknown translation variable to be solved in this step, They are The three components of the three-dimensional coordinates of . is the closest point on the corresponding 3D reconstructed model, yes The corresponding normal vector. The specific solution can be obtained by using Eigen (a C++ library that can be used for linear algebra, matrix, vector operations, etc.). It should be noted that the above formula can be used to solve It is actually the translation value from the 3DMM average model to the 3D reconstructed model. Therefore, after each iterative calculation is completed, it is necessary to use To update the 3D reconstruction model, and then perform the next iteration based on the updated 3D reconstruction model.
[0053] S103: The 3D face model generator 20 simultaneously calculates the translation variable and the rotation variable from the 3D reconstructed model to the 3DMM average model through a second iterative formula to obtain a converged second translation variable and a first rotation variable;
[0054] Based on S102, this step is the second step of the gradual iterative calculation, and the translation variables and rotation variables of the three-dimensional reconstructed model to the 3DMM average model are calculated simultaneously through the second iterative formula. It should be noted that the first translation variable obtained by iterating the first iterative formula to convergence in S102 will be used as the initial value of the translation variable in the second iterative formula to participate in subsequent iterations. In other words, through the iterative calculation of the first iterative formula, the translation variable becomes initially accurate, and the second iterative formula performs subsequent iterations based on the initially accurate translation variable. The initially accurate translation variable will provide the iteration direction as a basis to help obtain a more accurate rotation variable.
[0055] Of course, in the second iterative process, as the values obtained in each iteration are different, the three-dimensional reconstruction model needs to be continuously updated as in S102, and the translation variable will become more accurate in the continuous iteration process as the rotation variable is different.
[0056] The second iterative formula can be specifically expressed as the following formula:
[0057] ;
[0058] Among them, most of the variables in the formula have the same meaning as the variables in the first iteration formula in S102. This formula only adds one unknown quantity R (rotation variable). Respectively around The rotation angle of the axis.
[0059] S104: the 3D face model generator 20 simultaneously calculates the translation variable, rotation variable and PCA weighted coefficient of the 3D reconstruction model to the 3DMM average model through the third iterative formula to obtain the converged target PCA coefficient;
[0060] On the basis of S103, this step is the third step of the gradual iterative calculation, and the three-dimensional reconstructed model is simultaneously calculated as the translation variable, rotation variable and PCA coefficient of the 3DMM average model through the third iterative formula to obtain the converged target PCA coefficient. It should be noted that through the iterative calculation of the third iterative formula, the converged third translation variable, second rotation variable and target PCA coefficient will be obtained at the same time, but when the three-dimensional face model is obtained later, it is only necessary to adjust the 3DMM average model based on the PCA coefficient, and the translation variable and rotation variable are indispensable parameters for obtaining the PCA coefficient. In other words, in the third iterative formula, the role of the translation variable and the rotation variable participating in the iteration together is to obtain the target PCA coefficient.
[0061] The third iterative formula can be specifically expressed as the following formula:
[0062] ;
[0063] The first half of the formula is consistent with the formula in S103, and the second half is used to solve the PCA coefficient. is the i-th vertex on the 3DMM average model, is the PCA coefficient to be solved, K is the total number of coefficients, is the i-th value on the k-th eigenvector.
[0064] S105: The 3D face model generator 20 uses the target PCA coefficient to adjust the 3DMM average model to obtain a 3D face model;
[0065] On the basis of S104, this step aims to adjust the 3DMM average model by the 3D face model generator 20 using the target PCA coefficients obtained by iterative calculation, so as to obtain a 3D face model consistent with the actual face. According to the above steps, it can be seen that the three iterations of S102, S103 and S104 are all processes of aligning the 3D reconstruction model to the 3DMM average model, and the several unknown quantities calculated iteratively are all used to convert the actual face detail information contained in the 3D reconstruction model to the 3DMM average model. Therefore, the 3DMM average model is adjusted based on the target PCA coefficients obtained by the final calculation, so that the 3DMM average model with the available face topology is also consistent with the actual face in terms of face details, and the adjusted one is called a 3D face model.
[0066] Furthermore, since the spatial position of the initial 3D reconstruction model is far different from that of the 3DMM average model, if the required unknown quantities are directly iteratively calculated according to S102, S103 and S104, the accuracy of the iterated unknown quantities will be affected, and even the nearest point or nearest surface constraint method cannot be used for registration. Therefore, before executing S102, the two models can be roughly registered together (i.e., preliminary registration) using the matched feature points. Since this step is only to create a good basic condition for the subsequent iteration to calculate the accurate value, a preset distance range can be set to register one model to the preset distance range of another model, and the amount of calculation is relatively small.
[0067] Here is a way to achieve this goal through the characteristics of decentralization, see the following formula:
[0068] , ;
[0069] Among them, the first formula is the process of calculating the rotation variable, It is the vector formed by subtracting the mean value of all feature points from a feature point on the 3D reconstructed model. It is the vector formed by subtracting the feature point mean of all feature points from the corresponding feature point on the 3DMM average model. Finally, the rotation variable is calculated through SVD decomposition (Singular Value Decomposition, an important matrix decomposition in linear algebra) The second formula is used to calculate the translation variable ,in Represents the mean of the feature points on the 3DMM average model, Represents the mean value of feature points in 3D reconstruction.
[0070] S106 : The 3D face model generator 20 sends the 3D face model to the display 30 .
[0071] This step aims to enable the 3D face model generator 20 to send the generated 3D face model to the display 30 for display.
[0072] When generating a three-dimensional face model, the existing related technology also has a step of directly calculating the above three unknown quantities (translation variables, rotation variables, PCA coefficients) through an iterative method to obtain a converged optimal solution. However, unlike the progressive method provided by this application, the existing related technology does not go through steps S102 and S103, but directly enters step S104. It should be understood that in the method of calculating the optimal solution through iteration, the initial value of the unknown quantity is very important. A good and accurate initial value will be able to effectively provide the correct iteration direction, reduce the number and time required for iteration, and improve iteration efficiency. A poor and inaccurate initial value is just the opposite, and causes the iterated target PCA coefficient to be inaccurate, so that the three-dimensional face model generated based on the target PCA coefficient has detail problems and is inconsistent with the temporal face. Therefore, in order to solve this technical defect, the present application proposes a method of gradually iterating different unknown quantities in an incremental manner, so that the target PCA coefficient can obtain more accurate values more quickly based on relatively accurate translation variables and rotation variables, thereby eliminating the technical defects of the existing related technologies, eliminating the detail problems of the three-dimensional face model as much as possible, and improving the consistency between the three-dimensional face model and the actual face.
[0073] On the basis of the above embodiments, the present application further provides a specific implementation scheme for the iterative processes involved in S102, S103 and S104. Since the difference between S102 and S103 and S104 is only the number of unknown quantities, how S102 obtains the converged first translation variable through iteration is taken as an example to explain:
[0074] Two methods of obtaining the first translation variable are provided here: first, based on whether the difference between the translation variables of every two iterations is less than a preset difference, that is, judging whether the iteration has made the unknown quantity converge by judging whether the difference is less than the preset difference. Generally speaking, this is the normal method; second, considering that in actual situations, it is possible that due to an error in the iteration method, the difference has never been less than the preset difference, and it is possible that as the number of iterations increases, the difference gradually becomes greater than the preset difference. This is mostly caused by an error in the iteration direction. Therefore, in order to prevent infinite and erroneous iterations, a maximum number of iterations can be set in advance to limit the number of iterations that can be performed, and the translation variable of the last iteration that does not exceed the maximum number of iterations is determined as the first translation variable.
[0075] Furthermore, considering that the translation variable of the last iteration that does not exceed the preset maximum number of iterations may not be the closest to the preset difference, there may be a more suitable one in the previous iteration. It is also possible to record the translation variables of each previous iteration and select the translation variable whose difference is closest to the preset difference as the first translation variable by comparing the sizes.
[0076] It can be seen from the above that a suitable maximum number of iterations will effectively reduce invalid iteration operations, which is very critical. Therefore, this application also specifically provides a preferred method for obtaining the maximum number of iterations:
[0077] Obtain a preset number of sample users;
[0078] Obtain the number of iterations corresponding to each sample user obtaining their respective first translation variables, and use each iteration number as a training sample;
[0079] The maximum number of iterations is determined from the training samples through a machine learning algorithm.
[0080] This solution is based on a certain amount of sample data. Through the machine learning algorithm's ability to mine deep data features, it can better discover commonalities from the sample data, so that the maximum number of iterations based on this setting is more reasonable, and better achieve the purpose of reducing invalid iteration operations. Specifically, the machine learning algorithm includes various specific lower-level algorithms, such as being divided into supervised and unsupervised categories, each of which can be further subdivided into multiple categories. Depending on the actual application scenario, you can choose the most appropriate machine learning algorithm by yourself, and no specific restrictions are made here.
[0081] On the basis of the above embodiment, in order to facilitate users to browse the three-dimensional face model generated according to their own facial information, it is also possible to increase the collection of skin color parameters of various parts of the face when collecting facial information, so that after the three-dimensional face model of the gray model is generated through the above steps, the skin color parameters of the corresponding parts are used to perform real color rendering on the gray model, so that users can see a more intuitive three-dimensional face model.
[0082] A specific implementation method can be found in Figure 3 The flowchart shown:
[0083] S201: Obtain skin color parameters of various parts of the user's face;
[0084] S202: performing skin color rendering on corresponding parts of the three-dimensional face model using skin color parameters to obtain a rendered three-dimensional face model;
[0085] S203 displays the rendered three-dimensional face model.
[0086] On the basis of the above, in some application scenarios, users do not want to use facial information that is completely consistent with themselves to interact with other users, such as in communication applications based on virtual images. Therefore, the generated 3D face model can also be adjusted according to the actual needs of the user. It should be noted that this adjustment should be made on the basis of a consistent 3D face model, rather than obtaining a 3D face model that is inconsistent with the user's actual face from the beginning.
[0087] In actual situations, the 3D face model generator 20 can also achieve this requirement by following the following steps. Figure 4 The flowchart shown:
[0088] S301: receiving an incoming custom face model modification instruction;
[0089] S302: adjusting corresponding parts of the three-dimensional face model according to the custom face model modification instruction to obtain an adjusted custom three-dimensional face model.
[0090] Among them, the custom face model modification instruction can be sent by the user directly through the corresponding client, or it can be sent through other channels, such as through a display 30 set together with the face information collector 10 for displaying to the user, or an additional instruction input device set next to the display 30, etc.
[0091] In order to deepen the understanding of the solution of this application, based on the above content, this application also combines the following specifically constructed three-dimensional model to demonstrate the effect of the solution provided by this application:
[0092] First, the 3D reconstructed model with a far distance in spatial position is preliminarily aligned with the 3DMM average model, that is, the rotation variable R and translation variable T from the 3D reconstructed model to the 3DMM average model are calculated.
[0093] Step 2: Use the formula To calculate the rotation variable R, use the formula Calculate the translation variable T. The meaning of each character in the formula has been explained in part S105 and will not be repeated here. Figure 5 The following figure shows the effect after this step. Figure 5 The leftmost one is the 3D reconstructed model with feature points, the middle one is the 3DMM average model with feature points, and the rightmost one is the result of aligning the 3D reconstructed model to the 3DMM average model attachment using the above formula.
[0094] Step 3: After the calculation in the previous step, the 3D reconstructed model has been preliminarily aligned to the vicinity of the 3DMM average model. However, the number of feature points is small and the alignment result is not accurate enough. Therefore, we begin to gradually iterate different influencing parameters in an incremental manner. First, we use point-to-line constraints to iteratively calculate the translation variable T from the 3D reconstructed model to the 3DMM average model. The specific formula used is:
[0095] ;
[0096] Since T solved by the above formula is actually the translation from the 3DMM average model to the 3D reconstructed model, after each solution, -T needs to be used to update the 3D reconstructed model before the next iteration. Figure 6 Shown in Figure 5 Based on the results, 5 more iterations were performed in this step.
[0097] Step 4: Since only the translation variable T was calculated in the previous step, if the calculation of the rotation variable R is added when T is not calculated in place, the final calculation result will be affected. This step still uses the point-to-line constraint method to solve the translation variable T and the rotation variable R at the same time through the following formula:
[0098] ;
[0099] Different from the previous formula, only one rotation variable R is added to be solved. As in the previous step, after each iterative solution, the 3D reconstruction model is updated, and then the next iterative calculation is performed. Figure 7 Shown in Figure 6 Based on the results, 25 more iterations are performed in this step (the more parameters to be solved, the more iterations are usually required).
[0100] Step 5: Since the above steps are actually to align the 3D reconstruction model and the 3DMM model, they only change the relative position and do not deform the vertices of the 3DMM average model. Therefore, this step introduces the solution of the PCA coefficient based on the above steps. The target PCA coefficient solved by iteration can make the 3DMM average model with a standard topological structure more and more like the 3D reconstruction model with real facial details after adjustment. Calculate it using the following formula:
[0101] .
[0102] Figure 8 The final result after calculation in this step is shown, where Figure 8The left side shows the result of overlapping the final updated 3D reconstruction model and the 3DMM average model weighted by the target PCA coefficient. The middle one shows the result of displaying the final updated 3D reconstruction model separately after gridding. The right side shows the result of displaying the 3DMM average model weighted by the target PCA coefficient separately. In order to better show the changes and effects of the initial 3DMM average model after being processed by this solution, this embodiment also uses Fig. 9 shows the difference between the two, Fig. 9 The left side is the initial 3DMM average model, and the right side is Figure 8 The processed 3DMM average model on the right side can be used as a three-dimensional face model. It can be clearly seen that the processed 3DMM average model contains more real face detail information.
[0103] In order to show the difference and beneficial effect of the 3D face model obtained by this solution and the prior art, this embodiment also Fig.10 A comparison was made. Fig.10 The left side is a 3D face model obtained by processing in the existing non-progressive manner, and the right side is a 3D face model obtained by processing in the progressive manner according to the present application. Among them, the places where the details are obviously different are marked with black boxes. It can be clearly seen that compared with the model on the right, the double eyelid details of the model on the left are obviously lost, and noise points caused by the overlap of the eye parts appear.
[0104] Because the situation is complicated, it is impossible to list them one by one for explanation. Those skilled in the art should be aware that there may be many examples based on the basic method principles provided by this application combined with actual conditions, and all of them should be within the scope of protection of this application without sufficient creative work.
[0105] The following is an introduction to a three-dimensional face model generation device provided in an embodiment of the present application. The three-dimensional face model generation device described below and the three-dimensional face generation method described above can be referenced to each other. Fig.11 , Fig.11 A structural block diagram of a device for generating a three-dimensional face model provided in an embodiment of the present application, the device may include:
[0106] The translation variable iterative calculation unit 100 is used to calculate the translation variable from the three-dimensional reconstruction model to the 3DMM average model through a first iterative formula to obtain a converged first translation variable;
[0107] The translation and rotation variable iterative calculation unit 200 is used to simultaneously calculate the translation variable and the rotation variable from the three-dimensional reconstruction model to the 3DMM average model through the second iterative formula to obtain the converged second translation variable and the first rotation variable; wherein the initial value of the translation variable when the second iterative formula is used for the first iteration is the first translation variable;
[0108] The translation, rotation and PCA coefficient iterative calculation unit 300 is used to simultaneously calculate the translation variable, rotation variable and PCA weighted coefficient of the three-dimensional reconstruction model to the 3DMM average model through the third iterative formula to obtain the converged target PCA coefficient; wherein the initial value of the translation variable when the first iteration is performed through the third iterative formula is the second translation variable, and the initial value of the rotation variable is the first rotation variable;
[0109] The three-dimensional face model obtaining unit 400 is used to adjust the 3DMM average model using the target PCA coefficient to obtain a three-dimensional face model.
[0110] The translation variable iterative calculation unit 100 may include:
[0111] The iterative jump-out subunit based on the preset difference is used to determine the translation variable of the current iteration as the first translation variable when the translation variable difference between the current iteration and the previous iteration is less than the preset difference.
[0112] The translation variable iterative calculation unit 100 may include:
[0113] The iterative jump-out subunit based on a preset maximum number of iterations is used to determine the translation variable of the last iteration that does not exceed the preset maximum number of iterations as the first translation variable.
[0114] The preset maximum number of iterations required for executing the iterative jump sub-unit based on the preset maximum number of iterations can be pre-calculated by the following units:
[0115] A sample user acquisition unit, used to acquire a preset number of sample users;
[0116] A training sample acquisition unit, used to acquire the number of iterations corresponding to each sample user obtaining their respective first translation variables, and use each number of iterations as a training sample;
[0117] The machine learning algorithm application unit is used to determine a maximum number of iterations from training samples using a machine learning algorithm.
[0118] Based on the above embodiment, as a preferred implementation, it also includes:
[0119] Before calculating the translation variable from the three-dimensional reconstructed model to the 3DMM average model through the first iteration, the three-dimensional reconstructed model is aligned to within a preset distance of the 3DMM average model through the matched feature points.
[0120] Based on the above embodiment, as a preferred implementation, it also includes:
[0121] After obtaining the three-dimensional face model, obtain the skin color parameters of each part of the user's face;
[0122] Using skin color parameters to render skin color of corresponding parts of the three-dimensional face model, to obtain a rendered three-dimensional face model;
[0123] Display the rendered 3D face model.
[0124] Based on the above embodiment, as a preferred implementation, it also includes:
[0125] Receive the incoming custom face model modification instructions;
[0126] According to the custom face model modification instruction, corresponding parts of the three-dimensional face model are adjusted accordingly to obtain an adjusted custom three-dimensional face model.
[0127] Regarding the device in the above embodiment, the specific manner in which each module performs operations has been described in detail in the embodiment of the method, and will not be elaborated here.
[0128] The present application also provides a Fig.12 The electronic equipment shown, according to Fig.12 As can be seen from the structural diagram, the terminal device 900 may include a processor 901 and a memory 902 .
[0129] Optionally, the terminal device 900 may further include a communication interface 903 , an input unit 904 , a display 905 , and a communication bus 906 .
[0130] The processor 901 , the memory 902 , the communication interface 903 , the input unit 904 , and the display 905 all communicate with each other via the communication bus 906 .
[0131] In the embodiment of the present application, the processor 901 may be a central processing unit (CPU), an application specific integrated circuit, a digital signal processor, a readily available programmable gate array, or other programmable logic devices.
[0132] The processor 901 may call the program stored in the memory 902. Specifically, the processor may execute the steps in the embodiment of the method for generating a three-dimensional face model.
[0133] The memory 902 is used to store one or more programs. The program may include program code, and the program code includes computer operation instructions. In the embodiment of the present application, the memory at least stores a program for implementing the following functions:
[0134] Calculate the translation variable from the three-dimensional reconstructed model to the 3DMM average model through a first iterative formula to obtain a converged first translation variable;
[0135] The translation variable and the rotation variable of the three-dimensional reconstruction model to the 3DMM average model are calculated simultaneously by the second iterative formula to obtain the converged second translation variable and the first rotation variable; wherein the initial value of the translation variable when the second iterative formula is used for the first iteration is the first translation variable;
[0136] The translation variable, rotation variable and PCA weighted coefficient of the three-dimensional reconstructed model to the 3DMM average model are calculated simultaneously by the third iterative formula to obtain the converged target PCA coefficient; wherein the initial value of the translation variable when the third iterative formula is used for the first iteration is the second translation variable, and the initial value of the rotation variable is the first rotation variable;
[0137] The target PCA coefficients are used to adjust the 3DMM average model to obtain a 3D face model.
[0138] In one possible implementation, the memory 902 may include a program storage area and a data storage area, wherein the program storage area is used to store an operating system and application programs required for at least one function (such as a three-dimensional face model generation function); and the data storage area is used to store data created during the use of the computer.
[0139] In addition, the memory 902 may include a high-speed random access memory and may also include a non-volatile memory, such as at least one disk storage device or other volatile solid-state storage device.
[0140] The communication interface 903 may be an interface of a communication module, such as an interface of a GSM module.
[0141] The terminal device 900 provided in the embodiment of the present application may further include a display 905 and an input unit 904 and the like.
[0142] certainly, Fig.12 The structure of the terminal device shown does not constitute a limitation on the terminal device in the embodiment of the present application. In actual applications, the terminal device may include Fig.12 More or fewer components as shown, or combinations of certain components.
[0143] In another exemplary embodiment, a computer-readable storage medium including program instructions is also provided, and when the program instructions are executed by a processor, the following are implemented:
[0144] Calculate the translation variable from the three-dimensional reconstructed model to the 3DMM average model through a first iterative formula to obtain a converged first translation variable;
[0145] The translation variable and the rotation variable of the three-dimensional reconstruction model to the 3DMM average model are calculated simultaneously by the second iterative formula to obtain the converged second translation variable and the first rotation variable; wherein the initial value of the translation variable when the second iterative formula is used for the first iteration is the first translation variable;
[0146] The translation variable, rotation variable and PCA weighted coefficient of the three-dimensional reconstructed model to the 3DMM average model are calculated simultaneously by the third iterative formula to obtain the converged target PCA coefficient; wherein the initial value of the translation variable when the third iterative formula is used for the first iteration is the second translation variable, and the initial value of the rotation variable is the first rotation variable;
[0147] The target PCA coefficients are used to adjust the 3DMM average model to obtain a 3D face model.
[0148] The various embodiments in the specification are described in a progressive manner, and each embodiment focuses on the differences from other embodiments. The same and similar parts between the various embodiments can be referred to each other. For the system disclosed in the embodiment, since it corresponds to the method disclosed in the embodiment, the description is relatively simple, and the relevant parts can be referred to the method part description. It should be pointed out that for ordinary technicians in this technical field, without departing from the principles of this application, several improvements and modifications can be made to the present application, and these improvements and modifications also fall within the scope of protection of the claims of this application.
[0149] It should also be noted that, in this specification, relational terms such as first and second, etc. are only used to distinguish one entity or operation from another entity or operation, and do not necessarily require or imply any such actual relationship or order between these entities or operations. Moreover, the terms "comprise", "include" or any other variants thereof are intended to cover non-exclusive inclusion, so that a process, method, article or device including a series of elements includes not only those elements, but also other elements not explicitly listed, or also includes elements inherent to such process, method, article or device. In the absence of further restrictions, an element defined by the statement "comprises a ..." does not exclude the presence of other identical elements in the process, method, article or device including the element.
Claims
1. A method for generating a three-dimensional face model, characterized in that: include: Calculate the translation variable from the three-dimensional reconstructed model to the 3DMM average model through a first iterative formula to obtain a converged first translation variable; The translation variable and the rotation variable from the three-dimensional reconstructed model to the 3DMM average model are calculated simultaneously by a second iterative formula to obtain a converged second translation variable and a first rotation variable; wherein the initial value of the translation variable when the second iterative formula is used for the first iteration is the first translation variable; The translation variable, rotation variable and PCA weighted coefficient of the three-dimensional reconstructed model to the 3DMM average model are calculated simultaneously by the third iterative formula to obtain the converged target PCA coefficient; wherein the initial value of the translation variable when the first iteration is performed by the third iterative formula is the second translation variable, and the initial value of the rotation variable is the first rotation variable; The target PCA coefficients are used to adjust the 3DMM average model to obtain a three-dimensional face model.
2. The method for generating a three-dimensional face model according to claim 1, characterized in that: The translation variable from the three-dimensional reconstruction model to the 3DMM average model is calculated by the first iteration to obtain the converged first translation variable, including: When the difference in the translation variable between the current iteration and the previous iteration is less than a preset difference, the translation variable of the current iteration is determined as the first translation variable.
3. The method for generating a three-dimensional face model according to claim 1, characterized in that: The translation variable from the three-dimensional reconstruction model to the 3DMM average model is calculated by the first iteration to obtain the converged first translation variable, including: The translation variable of the last iteration that does not exceed a preset maximum number of iterations is determined as the first translation variable.
4. The method for generating a three-dimensional face model according to claim 3, characterized in that: The process of obtaining the preset maximum number of iterations includes: Obtain a preset number of sample users; Obtaining the number of iterations corresponding to each sample user obtaining the respective first translation variable, and using each of the number of iterations as a training sample; The preset maximum number of iterations is determined from the training samples through a machine learning algorithm.
5. The generation method according to claim 1, characterized in that: Before calculating the translation variable from the three-dimensional reconstructed model to the 3DMM average model through the first iteration, it also includes: The three-dimensional reconstructed model is aligned to within a preset distance of the 3DMM average model through matching feature points.
6. The generation method according to any one of claims 1 to 5, characterized in that: After obtaining the 3D face model, it also includes: Get skin color parameters of each part of the user's face; Using the skin color parameters to perform skin color rendering on corresponding parts of the three-dimensional face model to obtain a rendered three-dimensional face model; The rendered three-dimensional face model is displayed.
7. The generation method according to claim 6, characterized in that: Also includes: Receive the incoming custom face model modification instructions; According to the custom face model modification instruction, corresponding parts of the three-dimensional face model are adjusted accordingly to obtain an adjusted custom three-dimensional face model.
8. A device for generating a three-dimensional face model, characterized in that: include: A translation variable iterative calculation unit, used for calculating the translation variable from the three-dimensional reconstruction model to the 3DMM average model through a first iterative formula to obtain a converged first translation variable; A translation and rotation variable iterative calculation unit, used for simultaneously calculating the translation variable and the rotation variable from the three-dimensional reconstructed model to the 3DMM average model through a second iterative formula, and obtaining a converged second translation variable and a first rotation variable; wherein the initial value of the translation variable when the second iterative formula is used for the first iteration is the first translation variable; A translation, rotation and PCA coefficient iterative calculation unit, used to simultaneously calculate the translation variable, rotation variable and PCA weighted coefficient from the three-dimensional reconstructed model to the 3DMM average model through a third iterative formula to obtain a converged target PCA coefficient; wherein the initial value of the translation variable when the first iteration is performed through the third iterative formula is the second translation variable, and the initial value of the rotation variable is the first rotation variable; The three-dimensional face model obtaining unit is used to adjust the 3DMM average model using the target PCA coefficient to obtain a three-dimensional face model.
9. The device according to claim 8, characterized in that The translation variable iterative calculation unit comprises: The iterative jump-out subunit based on a preset difference is used to determine the translation variable of this iteration as the first translation variable when the translation variable difference between this iteration and the previous iteration is less than the preset difference.
10. The device according to claim 8, characterized in that The translation variable iterative calculation unit comprises: The iterative jump-out subunit based on a preset maximum number of iterations is used to determine the translation variable of the last iteration that does not exceed the preset maximum number of iterations as the first translation variable.
11. The device according to claim 10, characterized in that The preset maximum number of iterations required for executing the iterative jump subunit based on the preset maximum number of iterations is pre-calculated by the following units: A sample user acquisition unit, used to acquire a preset number of sample users; A training sample acquisition unit, used to acquire the number of iterations corresponding to each sample user obtaining the respective first translation variable, and use each of the number of iterations as a training sample; A machine learning algorithm application unit is used to determine the preset maximum number of iterations from the training samples through a machine learning algorithm.
12. An electronic device, characterized in that: The electronic device includes a processor and a memory; wherein the memory is used to store a computer program, and the computer program is loaded and executed by the processor to implement the method for generating a three-dimensional face model as described in any one of claims 1 to 7.
13. A storage medium, characterized in that: The storage medium stores computer executable instructions, and when the computer executable instructions are loaded and executed by the processor, the method for generating a three-dimensional face model as described in any one of claims 1 to 7 is implemented.
Citation Information
Patent Citations
Fast three-dimensional face recognition method for reducing expression influence
CN101315661A
3D face capturing method and equipment
CN101996416A
Geometric comparison method for models obtained through collaborative modelling of different software
CN105354396A
Human face three-dimensional model reconstruction method and apparatus
CN108062791A
Deep learning-based multiview face three-dimensional model reconstruction method
CN108510573A
