Motion picture generation method and apparatus, and computer device, and storage medium
The present disclosure provides a motion image generation method and apparatus, and a computer device and a storage medium. The method includes: obtaining a pre-drawn target face model; selecting, from a basic face library, at least one basic face model that is matched with the target face model, and determining an initial face model based on skeleton parameters and a skin matrix which respectively correspond to the at least one basic face model; and iteratively adjusting the skeleton parameters of the initial face model based on the initial face model and the target face model to obtain reference skeleton parameters when an error between the initial face model and the target face model is smallest, wherein the reference skeleton parameters are used for producing and generating each frame of images when the target face model moves.
1 . A method for motion image generation, comprising:
obtaining a pre-drawn target face model;
selecting, from a basic face library, at least one basic face model that is matched with the target face model, and determining an initial face model based on skeleton parameters and a skin matrix which respectively correspond to the at least one basic face model; and
iteratively adjusting the skeleton parameters of the initial face model based on the initial face model and the target face model to obtain reference skeleton parameters in response to an error between the initial face model and the target face model being smallest,
wherein the reference skeleton parameters are used for producing and generating each frame of images in response to the target face model moves,
wherein selecting, from the basic face library, the at least one basic face model that is matched with the target face model comprises:
selecting, from the basic face library, a plurality of candidate face models that are matched with a facial form type of the target face model,
calculating error information between each candidate face model and the target face model based on position information of target points corresponding to the plurality of candidate face models and the target face model respectively, and
selecting, from the plurality of candidate face models, the at least one basic face model with the corresponding error information satisfying a preset condition.
2 . The method of claim 1 , wherein the target points comprise facial key points and model vertices; and wherein the calculating error information between each candidate face model and the target face model based on target point position information respectively corresponding to the plurality of candidate face models and the target face model comprises:
respectively calculating a first cumulative position error between each candidate face model and the target face model based on position information of a plurality of facial key points respectively corresponding to the plurality of candidate face models and the target face model and position information of a plurality of model vertices respectively corresponding to the plurality of candidate face models and the target face model, and using the first cumulative position error as the error information between the candidate face model and the target face model.
3 . The method of claim 1 , wherein the at least one basic face model comprises a plurality of basic face models, and determining an initial face model based on skeleton parameters and a skin matrix which respectively correspond to the plurality of basic face models comprises:
performing weighted summation on the skeleton parameters of the various basic face models based on first weight information respectively corresponding to the skeleton parameters of the various basic face models to obtain initial skeleton parameters of the initial face model;
and performing weighted summation on the skin matrixes of the various basic face models based on second weight information respectively corresponding to the skin matrixes of the various basic face models to obtain an initial skin matrix of the initial face model; and
determining the initial face model based on the initial skeleton parameters and the initial skin matrix.
4 . The method of claim 1 , wherein iteratively adjusting the skeleton parameters of the initial face model based on the initial face model and the target face model to obtain reference skeleton parameters in response to an error between the initial face model and the target face model being smallest comprises:
determining a second cumulative position error between the initial face model and the target face model based on position information of a plurality of model vertices respectively corresponding to the initial face model and the target face model; and
in response to the second cumulative position error does not satisfy an iteration cut-off condition, updating the skeleton parameters of the initial face model, and updating the initial face model based on the updated skeleton parameters, repeating, for the updated initial face model, the above step of determining the second cumulative position error until the determined second cumulative position error satisfies the iteration cut-off condition, and using the finally updated skeleton parameters as the reference skeleton parameters.
5 . The method of claim 4 , further comprising:
storing the initial face model finally updated into the basic face library in response to the iteration cut-off condition is satisfied.
6 . The method of claim 1 , wherein the method further comprises:
based on the reference skeleton parameters and a target skeleton parameter in response to the target face model corresponding to the target picture frame reaches a preset pose, generating a plurality of groups of transition skeleton parameters respectively corresponding to a plurality of intermediate image frames between an initial image frame corresponding to the reference skeleton parameters and the target image frame; and
generating, based on the reference skeleton parameters and the plurality of groups of transition skeleton parameters, each frame of images corresponding to the target face model reaches the preset pose.
7 . A computing device, comprising a processor, a memory, and a bus, wherein the memory comprises a non-transitory machine-readable medium storing instructions executable by the processor, wherein the instructions, when executed by the processor, cause the computing device to perform operations, the operations comprising:
obtaining a pre-drawn target face model;
selecting, from a basic face library, at least one basic face model that is matched with the target face model, and determining an initial face model based on skeleton parameters and a skin matrix which respectively correspond to the at least one basic face model; and
iteratively adjusting the skeleton parameters of the initial face model based on the initial face model and the target face model to obtain reference skeleton parameters in response to an error between the initial face model and the target face model being smallest,
wherein the reference skeleton parameters are used for producing and generating each frame of images in response to the target face model moves,
wherein selecting, from the basic face library, the at least one basic face model that is matched with the target face model comprises:
selecting, from the basic face library, a plurality of candidate face models that are matched with a facial form type of the target face model,
calculating error information between each candidate face model and the target face model based on position information of target points corresponding to the plurality of candidate face models and the target face model respectively, and
selecting, from the plurality of candidate face models, the at least one basic face model with the corresponding error information satisfying a preset condition.
8 . The computing device of claim 7 , wherein the target points comprise facial key points and model vertices; and wherein the calculating error information between each candidate face model and the target face model based on target point position information respectively corresponding to the plurality of candidate face models and the target face model comprises:
respectively calculating a first cumulative position error between each candidate face model and the target face model based on position information of a plurality of facial key points respectively corresponding to the plurality of candidate face models and the target face model and position information of a plurality of model vertices respectively corresponding to the plurality of candidate face models and the target face model, and using the first cumulative position error as the error information between the candidate face model and the target face model.
9 . The computing device of claim 7 , wherein the at least one basic face model comprises a plurality of basic face models, and the determining an initial face model based on skeleton parameters and a skin matrix which respectively correspond to the plurality of basic face models comprises:
performing weighted summation on the skeleton parameters of the various basic face models based on first weight information respectively corresponding to the skeleton parameters of the various basic face models to obtain initial skeleton parameters of the initial face model;
and performing weighted summation on the skin matrixes of the various basic face models based on second weight information respectively corresponding to the skin matrixes of the various basic face models to obtain an initial skin matrix of the initial face model; and
determining the initial face model based on the initial skeleton parameters and the initial skin matrix.
10 . The computing device of claim 7 , wherein the iteratively adjusting the skeleton parameters of the initial face model based on the initial face model and the target face model to obtain reference skeleton parameters in response to an error between the initial face model and the target face model being smallest comprises:
determining a second cumulative position error between the initial face model and the target face model based on position information of a plurality of model vertices respectively corresponding to the initial face model and the target face model; and
in response to the second cumulative position error does not satisfy an iteration cut-off condition, updating the skeleton parameters of the initial face model, and updating the initial face model based on the updated skeleton parameters, repeating, for the updated initial face model, the above step of determining the second cumulative position error until the determined second cumulative position error satisfies the iteration cut-off condition, and using the finally updated skeleton parameters as the reference skeleton parameters.
11 . The computing device of claim 10 , wherein the operations further comprise:
storing the initial face model finally updated into the basic face library in response to the iteration cut-off condition is satisfied.
12 . The computing device of claim 7 , wherein the operations further comprise:
based on the reference skeleton parameters and a target skeleton parameter in response to the target face model corresponding to the target picture frame reaches a preset pose, generating a plurality of groups of transition skeleton parameters respectively corresponding to a plurality of intermediate image frames between an initial image frame corresponding to the reference skeleton parameters and the target image frame; and
generating, based on the reference skeleton parameters and the plurality of groups of transition skeleton parameters, each frame of images corresponding to the target face model reaches the preset pose.
13 . A computer program product tangibly embodied on a non-transitory computer readable storage medium comprising instructions which, when executed by a computer, cause the computer to perform operations, the operations comprising:
obtaining a pre-drawn target face model;
selecting, from a basic face library, at least one basic face model that is matched with the target face model, and determining an initial face model based on skeleton parameters and a skin matrix which respectively correspond to the at least one basic face model; and
iteratively adjusting the skeleton parameters of the initial face model based on the initial face model and the target face model to obtain reference skeleton parameters in response to an error between the initial face model and the target face model being smallest,
wherein the reference skeleton parameters are used for producing and generating each frame of images in response to the target face model moves,
wherein selecting, from the basic face library, the at least one basic face model that is matched with the target face model comprises:
selecting, from the basic face library, a plurality of candidate face models that are matched with a facial form type of the target face model,
calculating error information between each candidate face model and the target face model based on position information of target points corresponding to the plurality of candidate face models and the target face model respectively, and
selecting, from the plurality of candidate face models, the at least one basic face model with the corresponding error information satisfying a preset condition.
14 . The computer program product tangibly embodied on the non-transitory computer readable storage medium of claim 13 , wherein the target points comprise facial key points and model vertices; and wherein the calculating error information between each candidate face model and the target face model based on target point position information respectively corresponding to the plurality of candidate face models and the target face model comprises:
respectively calculating a first cumulative position error between each candidate face model and the target face model based on position information of a plurality of facial key points respectively corresponding to the plurality of candidate face models and the target face model and position information of a plurality of model vertices respectively corresponding to the plurality of candidate face models and the target face model, and using the first cumulative position error as the error information between the candidate face model and the target face model.
15 . The computer program product tangibly embodied on the non-transitory computer readable storage medium of claim 13 , wherein the at least one basic face model comprises a plurality of basic face models, and the determining an initial face model based on skeleton parameters and a skin matrix which respectively correspond to the plurality of basic face models comprises:
performing weighted summation on the skeleton parameters of the various basic face models based on first weight information respectively corresponding to the skeleton parameters of the various basic face models to obtain initial skeleton parameters of the initial face model; and performing weighted summation on the skin matrixes of the various basic face models based on second weight information respectively corresponding to the skin matrixes of the various basic face models to obtain an initial skin matrix of the initial face model; and
determining the initial face model based on the initial skeleton parameters and the initial skin matrix.
16 . The computer program product tangibly embodied on the non-transitory computer readable storage medium of claim 13 , wherein the iteratively adjusting the skeleton parameters of the initial face model based on the initial face model and the target face model to obtain reference skeleton parameters in response to an error between the initial face model and the target face model being smallest comprises:
determining a second cumulative position error between the initial face model and the target face model based on position information of a plurality of model vertices respectively corresponding to the initial face model and the target face model; and
in response to the second cumulative position error does not satisfy an iteration cut-off condition, updating the skeleton parameters of the initial face model, and updating the initial face model based on the updated skeleton parameters, repeating, for the updated initial face model, the above step of determining the second cumulative position error until the determined second cumulative position error satisfies the iteration cut-off condition, and using the finally updated skeleton parameters as the reference skeleton parameters.
17 . The computer program product tangibly embodied on the non-transitory computer readable storage medium of claim 16 , the operations further comprising:
storing the initial face model finally updated into the basic face library in response to the iteration cut-off condition is satisfied.
18 . The computer program product tangibly embodied on the non-transitory computer readable storage medium of claim 13 , the operations further comprising:
based on the reference skeleton parameters and a target skeleton parameter in response to the target face model corresponding to the target picture frame reaches a preset pose, generating a plurality of groups of transition skeleton parameters respectively corresponding to a plurality of intermediate image frames between an initial image frame corresponding to the reference skeleton parameters and the target image frame; and
generating, based on the reference skeleton parameters and the plurality of groups of transition skeleton parameters, each frame of images corresponding to the target face model reaches the preset pose.