Image processing method, device, electronic device and storage medium

By using a three-dimensional mesh model to calculate the displacement vectors of 3D key points and mapping them to a 2D plane, the problem of inaccurate image deformation in the existing technology is solved, a higher-precision face shaping effect is achieved, and the user experience is improved.

CN112330824BActive Publication Date: 2024-08-23GUANGDONG OPPO MOBILE TELECOMMUNICATIONS CORP LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202011241111.3
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2018-05-31
Publication Date
2024-08-23
Estimated Expiration
2038-05-31

AI Technical Summary

Technical Problem

Existing facial image reshaping technology is based on 2D plane images, resulting in inaccurate image deformation and low quantification, making it impossible to achieve high-precision deformation effects.

Method used

A three-dimensional mesh model is used to obtain the shaping parameters, the displacement vectors of the 3D key points are calculated, and mapped to a 2D plane. The image is linearly stretched after 3D shaping to achieve more accurate face shaping.

Benefits of technology

The accuracy of image deformation is improved, the user experience is improved, and more accurate face shaping results are obtained.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN112330824B
    Figure CN112330824B
Patent Text Reader

Abstract

The present application discloses an image processing method, device, electronic device and storage medium. The method includes: obtaining the shaping parameters of the target object face three-dimensional mesh model set in advance; based on the shaping parameters of the face three-dimensional mesh model, calculating the displacement vector of each 3D key point in the face three-dimensional mesh model in three-dimensional space; for each key point, mapping the 3D displacement vector of each key point to a two-dimensional plane to obtain the displacement vector of each key point on the two-dimensional plane; according to the face three-dimensional mesh model and the displacement vector of each key point on the two-dimensional plane, generating the face image of the target object after 3D shaping. This method can obtain more accurate face shaping results, improve the accuracy of image deformation, and enhance the user experience.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the field of image processing technology, and in particular to an image processing method, device, electronic device and computer-readable storage medium. Background Art

[0002] Existing facial image reshaping technologies are usually based on 2D plane images, and the pixels on the plane images are shifted. In related technologies, there are two mainstream methods used to achieve facial image reshaping: one is to define the pixel displacement range, set the displacement weight for each pixel in the range, and then shift each pixel in a certain direction; the other is to divide the 2D plane image into multiple triangles, and shift each triangle vertex in the required direction, and then linearly stretch the inside of the changed triangle to obtain the deformed image.

[0003] However, the current problem is that both of the above methods obtain 2D key points of the face from the 2D plane image, and set displacement variables based on the 2D key points. The displacement variables are the relative values ​​of the key points on the plane image. Due to the low degree of quantization, the image deformation is not accurate enough. Summary of the invention

[0004] The purpose of this application is to solve one of the above-mentioned technical problems at least to a certain extent.

[0005] Therefore, the first purpose of the present application is to propose an image processing method, which can obtain more accurate face reshaping results, improve the accuracy of image deformation, and enhance the user experience.

[0006] The second objective of the present application is to provide an image processing device.

[0007] The third objective of the present application is to provide an electronic device.

[0008] A fourth objective of the present application is to provide a computer-readable storage medium.

[0009] To achieve the above-mentioned objectives, the image processing method proposed in the first aspect of the present application includes: obtaining pre-set shaping parameters on a three-dimensional mesh model of a target object's face; based on the shaping parameters on the three-dimensional mesh model of the face, calculating the displacement vectors of each 3D key point in the three-dimensional mesh model of the face in three-dimensional space; for each key point, mapping the 3D displacement vector of each key point to a two-dimensional plane to obtain the displacement vector of each key point on the two-dimensional plane; and generating a face image of the target object after 3D shaping based on the three-dimensional mesh model of the face and the displacement vector of each key point on the two-dimensional plane.

[0010] To achieve the above-mentioned purpose, the image processing device proposed in the second aspect of the embodiment of the present application includes: a shaping parameter acquisition module, which is used to obtain a preset shaping parameter on a three-dimensional mesh model of a target object's face; a calculation module, which is used to calculate the displacement vector of each 3D key point in the three-dimensional mesh model of the face in three-dimensional space based on the shaping parameter on the three-dimensional mesh model of the face; a displacement vector mapping module, which is used to map the 3D displacement vector of each key point to a two-dimensional plane for each key point, so as to obtain the displacement vector of each key point on the two-dimensional plane; and a shaping image generation module, which is used to generate a face image of the target object after 3D shaping according to the three-dimensional mesh model of the face and the displacement vector of each key point on the two-dimensional plane.

[0011] To achieve the above-mentioned purpose, the electronic device proposed in the third aspect embodiment of the present application includes: a memory, a processor, and a computer program stored in the memory and executable on the processor. When the processor executes the program, the image processing method described in the first aspect embodiment of the present application is implemented.

[0012] In order to achieve the above-mentioned purpose, the non-temporary computer-readable storage medium proposed in the fourth aspect embodiment of the present application has a computer program stored thereon, and when the program is executed by the processor, the image processing method described in the first aspect embodiment of the present application is implemented.

[0013] According to the image processing method, device, electronic device and storage medium of the embodiment of the present application, the 3D displacement vector of the 3D key point of the face can be obtained by setting the shaping parameters on the 3D mesh model of the face, and the mapping relationship of the 3D key point displacement vector to the 2D plane can be calculated according to the orientation angle of the face on the image, so as to obtain the displacement vector on the 2D plane and calculate the new key point of the face, and finally the image can be linearly stretched according to the mesh structure of the 3D key point to obtain the shaping result of the face. That is, the displacement of the pixel points on the face image is quantified based on the 3D mesh model of the face, the displacement amount on the 3D mesh model is first set, and then the 3D to 2D direction mapping is performed to obtain the quantized pixel displacement amount on the 2D image, so as to obtain a more accurate face shaping result, improve the accuracy of image deformation, and enhance the user experience.

[0014] Additional aspects and advantages of the present application will be given in part in the description below, and in part will become apparent from the description below, or will be learned through the practice of the present application. BRIEF DESCRIPTION OF THE DRAWINGS

[0015] The above and / or additional aspects and advantages of the present application will become apparent and easily understood from the following description of the embodiments in conjunction with the accompanying drawings, in which:

[0016] Figure 1 is a flowchart of an image processing method according to an embodiment of the present application;

[0017] Figure 2 is a flow chart of a method for establishing a three-dimensional mesh model of a human face according to an embodiment of the present application;

[0018] Figure 3 is a flowchart of an image processing method according to a specific embodiment of the present application;

[0019] Figure 4 is a structural schematic diagram of an image processing device according to an embodiment of the present application;

[0020] Figure 5 is a structural schematic diagram of an image processing device according to a specific embodiment of the present application;

[0021] Figure 6 is a structural schematic diagram of an image processing device according to another specific embodiment of the present application;

[0022] Figure 7 It is a schematic diagram of the structure of an electronic device according to an embodiment of the present application. DETAILED DESCRIPTION

[0023] The embodiments of the present application are described in detail below, and examples of the embodiments are shown in the accompanying drawings, wherein the same or similar reference numerals throughout represent the same or similar elements or elements having the same or similar functions. The embodiments described below with reference to the accompanying drawings are exemplary and are intended to be used to explain the present application, and should not be construed as limiting the present application.

[0024] The following describes an image processing method, an apparatus, an electronic device, and a computer-readable storage medium according to embodiments of the present application with reference to the accompanying drawings.

[0025] Figure 1 : is a flowchart of an image processing method according to an embodiment of the present application. It should be noted that the image processing method of the embodiment of the present application can be applied to the image processing device of the embodiment of the present application, and the image processing device can be configured on the electronic device of the embodiment of the present application. Among them, the electronic device can be a mobile terminal, such as a mobile phone, a tablet computer, a personal digital assistant, and other hardware devices with various operating systems.

[0026] like Figure 1 As shown, the image processing method may include:

[0027] S110, obtaining preset shaping parameters on the three-dimensional mesh model of the target object's face.

[0028] Specifically, the shaping parameters on the target object's face 3D mesh model may be pre-set. As an example, the shaping parameters on the face 3D mesh model may be set in the following manner: obtaining a pre-established target object's face 3D mesh model, receiving an editing operation of the target object on the face 3D mesh model, and determining the shaping parameters on the face 3D mesh model according to the editing operation.

[0029] Optionally, before reshaping the target object's facial image, the target object's facial three-dimensional mesh model can be obtained first. At this time, the target object can edit the facial three-dimensional mesh model according to his or her own needs and preferences. For example, the facial three-dimensional mesh model can be subjected to operations such as face slimming, nose augmentation, cheekbone reduction, and chin padding. When receiving the target object's editing operation on his or her own facial three-dimensional mesh model, the reshaping parameters on the facial three-dimensional mesh model can be determined according to the editing operation. The reshaping parameters may include but are not limited to the pixels to be processed and the displacement variables to be moved for the pixels to be processed. For example, taking the editing operation as a face slimming operation as an example, according to the face slimming operation, it is determined which pixels on the facial three-dimensional mesh model need to be processed and where these pixels need to be moved.

[0030] In one embodiment of the present application, Figure 2 As shown, the three-dimensional face mesh model of the target object can be pre-established by the following steps:

[0031] S210, acquiring multiple frames of images of the target object;

[0032] S220, constructing a three-dimensional face model of the target object according to the multiple frames of images;

[0033] S230, based on the mesh information of the three-dimensional face model, extracting a plurality of 3D key points on the face contour from the mesh information;

[0034] For example, based on the mesh information of the three-dimensional face model, 296 3D key points on the face contour may be extracted from the mesh information.

[0035] S240, generating multiple 3D key points inside the face and multiple 3D key points outside the face contour based on the multiple 3D key points on the face contour based on an interpolation algorithm;

[0036] S250, establishing a three-dimensional mesh model of the face of the target object according to a plurality of 3D key points on the face contour, a plurality of 3D key points inside the face, and a plurality of 3D key points outside the face contour.

[0037] For example, based on multiple 3D key points on the face contour, 33 3D key points inside the face and 8 3D key points outside the face contour can be interpolated, and a new 3D mesh model, namely the 3D mesh model of the target object's face, can be constructed based on these 3D key points.

[0038] Therefore, the target object edits its own three-dimensional face mesh model in advance, and the reshaping parameters on the three-dimensional face mesh model can be determined according to the editing operation. In this way, when the planar image of the target object is reshaped, the reshaping parameters on the pre-set three-dimensional face mesh model can be obtained, and then the planar image of the target object can be reshaped based on the reshaping parameters.

[0039] S120, based on the shaping parameters on the three-dimensional face mesh model, calculating the displacement vector of each 3D key point in the three-dimensional face mesh model in the three-dimensional space.

[0040] For example, taking the face slimming operation performed on the three-dimensional face mesh model as an example, the plastic surgery parameters corresponding to the face slimming operation can be determined. For example, the plastic surgery parameters can be information such as which pixels on the three-dimensional face mesh model need to be processed and where these pixels need to be moved. In this way, the displacement vectors of each 3D key point in the three-dimensional face mesh model in the three-dimensional space can be calculated based on the plastic surgery parameters.

[0041] S130, for each key point, mapping the 3D displacement vector of each key point to a two-dimensional plane to obtain the displacement vector of each key point on the two-dimensional plane.

[0042] Optionally, the face orientation angle on the two-dimensional plane is determined, and the mapping relationship between the 3D displacement vector of each key point to the two-dimensional plane is calculated based on the face orientation angle on the two-dimensional plane, and the displacement vector of each key point on the two-dimensional plane is determined based on the mapping relationship.

[0043] That is to say, according to the face orientation angle on the two-dimensional plane image, the displacement vector of each 3D key point in the three-dimensional space can be projected onto the two-dimensional plane to obtain the projection vector of the 3D displacement vector of each key point on the two-dimensional plane. The projection vector is the displacement vector of the key point on the two-dimensional plane.

[0044] S140, generating a 3D reshaped face image of the target object according to the three-dimensional face mesh model and the displacement vector of each key point on the two-dimensional plane.

[0045] As an example, a deformed 3D key point on the plane image can be generated according to the displacement vector of each key point on the two-dimensional plane, and the plane image can be linearly stretched according to the three-dimensional face mesh model and the deformed 3D key point to obtain a face image of the target object after 3D reshaping.

[0046] That is to say, according to the displacement vector of each key point on the two-dimensional plane, the key point position of each key point on the plane image after deformation can be calculated, and according to the three-dimensional face mesh model and the key point position of each key point after deformation, the plane image is linearly stretched to obtain the face image of the target object after 3D plastic surgery.

[0047] According to the image processing method of the embodiment of the present application, the 3D displacement vector of the 3D key points of the face can be obtained by setting the shaping parameters on the 3D mesh model of the face, and the mapping relationship between the 3D key point displacement vector and the 2D plane is calculated according to the orientation angle of the face on the image, thereby obtaining the displacement vector on the 2D plane and calculating the new key points of the face, and finally the image is linearly stretched according to the mesh structure of the 3D key points to obtain the shaping result of the face. That is, the displacement of the pixel points on the face image is quantified based on the 3D mesh model of the face, first the displacement amount on the 3D mesh model is set, and then the 3D to 2D direction mapping is performed to obtain the quantified pixel displacement amount on the 2D image, thereby obtaining a more accurate face shaping result, improving the accuracy of image deformation, and enhancing the user experience.

[0048] Figure 3 It is a flowchart of an image processing method according to a specific embodiment of the present application.

[0049] In order to improve the user experience, the image processing method of the embodiment of the present application can be applied to the user selfie scene. For example, when it is detected that the user uses the selfie mode, the image displayed on the preview interface can be automatically reshaped. In this way, when it is detected that the user clicks the confirmation shooting button, the reshaped face image can be directly obtained. Specifically, Figure 3 As shown, the image processing method may include:

[0050] S310, when it is detected that the user uses the selfie mode, obtaining a preset shaping parameter on the three-dimensional mesh model of the user's face.

[0051] Specifically, the shaping parameters on the user's face 3D mesh model can be preset. As an example, the shaping parameters on the face 3D mesh model can be set in the following manner: obtaining a pre-established user's face 3D mesh model, receiving an editing operation of the user on the face 3D mesh model, and determining the shaping parameters on the face 3D mesh model according to the editing operation.

[0052] Optionally, before reshaping the user's facial image, the user's facial three-dimensional mesh model may be obtained first. At this point, the user may edit the facial three-dimensional mesh model according to his or her needs and preferences. For example, the facial three-dimensional mesh model may be subjected to operations such as face slimming, nose augmentation, cheekbone reduction, and chin padding. When receiving an editing operation from the user on his or her facial three-dimensional mesh model, the reshaping parameters on the facial three-dimensional mesh model may be determined based on the editing operation. The reshaping parameters may include, but are not limited to, pixels to be processed and displacement variables to be moved for the pixels to be processed. For example, taking the editing operation as a face slimming operation, information such as which pixels on the facial three-dimensional mesh model need to be processed and where these pixels need to be moved is determined based on the face slimming operation.

[0053] S320, based on the shaping parameters on the three-dimensional face mesh model, calculate the displacement vector of each 3D key point in the three-dimensional face mesh model in the three-dimensional space.

[0054] S330, for each key point, mapping the 3D displacement vector of each key point to a two-dimensional plane to obtain the displacement vector of each key point on the two-dimensional plane.

[0055] S340, generating a 3D reshaped face image of the user according to the three-dimensional face mesh model and the displacement vector of each key point on the two-dimensional plane.

[0056] As an example, according to the displacement vector of each key point on the two-dimensional plane, the deformed 3D key points on the plane image in the shooting preview interface can be generated, and the plane image can be linearly stretched according to the three-dimensional mesh model of the face and the deformed 3D key points to obtain the face image of the user after 3D plastic surgery.

[0057] S350: Displaying the user's face image after 3D plastic surgery on a shooting preview interface.

[0058] Optionally, after obtaining the user's facial image after 3D plastic surgery, the facial image can be displayed on the shooting preview interface, so that when it is detected that the user clicks the confirmation shooting button, the facial image after plastic surgery can be directly obtained.

[0059] According to the image processing method of the embodiment of the present application, when it is detected that the user uses the selfie mode, the image displayed on the preview interface can be automatically reshaped. In this way, when it is detected that the user clicks the confirm shooting button, the reshaped face image can be directly obtained, thereby improving the user's photo-taking experience.

[0060] It should be noted that, in one embodiment of the present application, the image processing method of the embodiment of the present application can also be applied to the scenario of performing reshaping processing on the plane image that has been captured. For example, the image processing method of the embodiment of the present application can be used to perform reshaping processing on the selfie image that the user has taken to obtain a selfie image after 3D reshaping.

[0061] Corresponding to the image processing methods provided in the above-mentioned embodiments, an embodiment of the present application also provides an image processing device. Since the image processing device provided in the embodiment of the present application corresponds to the image processing methods provided in the above-mentioned embodiments, the implementation methods of the aforementioned image processing methods are also applicable to the image processing device provided in this embodiment and will not be described in detail in this embodiment. Figure 4 FIG. 1 is a schematic diagram of the structure of an image processing device according to an embodiment of the present application. Figure 4 As shown, the image processing device 400 may include: a shaping parameter acquisition module 410 , a calculation module 420 , a displacement vector mapping module 430 and a shaping image generation module 440 .

[0062] Specifically, the shaping parameter acquisition module 410 is used to acquire the preset shaping parameters on the three-dimensional mesh model of the target object face.

[0063] The calculation module 420 is used to calculate the displacement vector of each 3D key point in the three-dimensional face mesh model in the three-dimensional space based on the shaping parameters on the three-dimensional face mesh model.

[0064] The displacement vector mapping module 430 is used to map the 3D displacement vector of each key point to a two-dimensional plane for each key point, so as to obtain the displacement vector of each key point on the two-dimensional plane. As an example, the displacement vector mapping module 430 can determine the face orientation angle on the two-dimensional plane, calculate the mapping relationship between the 3D displacement vector of each key point and the two-dimensional plane according to the face orientation angle on the two-dimensional plane, and determine the displacement vector of each key point on the two-dimensional plane according to the mapping relationship.

[0065] The reshaped image generation module 440 is used to generate a face image of the target object after 3D reshaping according to the three-dimensional face mesh model and the displacement vector of each key point on the two-dimensional plane. As an example, the reshaped image generation module 440 can generate a deformed 3D key point on the plane image according to the displacement vector of each key point on the two-dimensional plane, and linearly stretch the plane image according to the three-dimensional face mesh model and the deformed 3D key point to obtain the face image of the target object after 3D reshaping.

[0066] It should be noted that the shaping parameters on the target object face three-dimensional mesh model can be pre-set. Figure 5 As shown, the image processing device 400 may further include: a shaping parameter presetting module 450, which is used to pre-set shaping parameters on the target object face three-dimensional mesh model. Figure 5 As shown, the shaping parameter presetting module 450 may include: an acquisition unit 451, a receiving unit 452 and a determination unit 453. The acquisition unit 451 is used to acquire a pre-established three-dimensional face mesh model of the target object; the receiving unit 452 is used to receive an editing operation of the target object on the three-dimensional face mesh model; and the determination unit 453 is used to determine the shaping parameters on the three-dimensional face mesh model according to the editing operation.

[0067] It should also be noted that before reshaping the target object's facial image, the target object's facial three-dimensional mesh model can be obtained first. At this point, the target object can edit the facial three-dimensional mesh model according to his or her own needs and preferences. For example, the facial three-dimensional mesh model can be subjected to operations such as face slimming, nose augmentation, cheekbone reduction, and chin padding. When receiving the target object's editing operation on its own facial three-dimensional mesh model, the reshaping parameters on the facial three-dimensional mesh model can be determined according to the editing operation. Among them, the reshaping parameters may include but are not limited to the pixels to be processed, and the displacement variables to be moved by the pixels to be processed. For example, taking the editing operation as a face slimming operation as an example, according to the face slimming operation, it is determined which pixels on the facial three-dimensional mesh model need to be processed and where these pixels need to be moved.

[0068] Optionally, in one embodiment of the present application, Figure 6 As shown, the image processing device 400 may also include: a model pre-establishment module 460, which is used to pre-establish a three-dimensional mesh model of the face of the target object. Figure 6As shown, the model pre-building module 460 may include: an acquisition unit 461 , a first building unit 462 , an extraction unit 463 , a generation unit 464 and a second building unit 465 .

[0069] Among them, the acquisition unit 461 is used to acquire multiple frame images of the target object; the first establishment unit 462 is used to construct a three-dimensional face model of the target object based on the multiple frame images; the extraction unit 463 is used to extract multiple 3D key points on the face contour from the grid information of the three-dimensional face model; the generation unit 464 is used to generate multiple 3D key points inside the face and multiple 3D key points outside the face contour based on the multiple 3D key points on the face contour based on the interpolation algorithm; the second establishment unit 465 is used to establish the three-dimensional face mesh model of the target object based on the multiple 3D key points on the face contour, the multiple 3D key points inside the face and the multiple 3D key points outside the face contour.

[0070] According to the image processing device of the embodiment of the present application, the displacement of pixels on the face image can be quantified based on the three-dimensional face mesh model. First, the displacement on the three-dimensional mesh model is set, and then 3D to 2D mapping is performed to obtain the quantified pixel displacement on the 2D image, thereby obtaining a more accurate face plastic surgery result, improving the accuracy of image deformation, and enhancing the user experience.

[0071] In order to implement the above embodiments, the present application also proposes an electronic device.

[0072] Figure 7 is a schematic diagram of the structure of an electronic device according to an embodiment of the present application. Figure 7 As shown, the electronic device 700 may include: a memory 710, a processor 720, and a computer program 730 stored in the memory 710 and executable on the processor 720. When the processor 720 executes the program 730, the image processing method described in any of the above embodiments of the present application is implemented.

[0073] In order to implement the above embodiments, the present application also proposes a non-temporary computer-readable storage medium on which a computer program is stored. When the program is executed by a processor, the image processing method described in any of the above embodiments of the present application is implemented.

[0074] In the description of the present application, it should be understood that the terms "first" and "second" are used for descriptive purposes only and should not be understood as indicating or implying relative importance or implicitly indicating the number of technical features indicated. Thus, a feature defined as "first" or "second" may explicitly or implicitly include at least one of the features. In the description of the present application, "plurality" means at least two, such as two, three, etc., unless otherwise clearly and specifically defined.

[0075] In the description of this specification, the description with reference to the terms "one embodiment", "some embodiments", "example", "specific example", or "some examples" etc. means that the specific features, structures, materials or characteristics described in conjunction with the embodiment or example are included in at least one embodiment or example of the present application. In this specification, the schematic representations of the above terms do not necessarily refer to the same embodiment or example. Moreover, the specific features, structures, materials or characteristics described may be combined in any one or more embodiments or examples in a suitable manner. In addition, those skilled in the art may combine and combine the different embodiments or examples described in this specification and the features of the different embodiments or examples, without contradiction.

[0076] Any process or method description in a flowchart or otherwise described herein may be understood to represent a module, segment or portion of code that includes one or more executable instructions for implementing the steps of a specific logical function or process, and the scope of the preferred embodiments of the present application includes alternative implementations in which functions may not be performed in the order shown or discussed, including performing functions in a substantially simultaneous manner or in the reverse order depending on the functions involved, which should be understood by technicians in the technical field to which the embodiments of the present application belong.

[0077] The logic and / or steps represented in the flowchart or otherwise described herein, for example, can be considered as an ordered list of executable instructions for implementing logical functions, and can be embodied in any computer-readable medium for use by an instruction execution system, device or apparatus (such as a computer-based system, a system including a processor, or other system that can fetch instructions from an instruction execution system, device or apparatus and execute the instructions), or in combination with these instruction execution systems, devices or apparatuses. For the purpose of this specification, "computer-readable medium" can be any device that can contain, store, communicate, propagate or transmit a program for use by an instruction execution system, device or apparatus, or in combination with these instruction execution systems, devices or apparatuses. More specific examples of computer-readable media (a non-exhaustive list) include the following: an electrical connection with one or more wires (electronic device), a portable computer disk box (magnetic device), a random access memory (RAM), a read-only memory (ROM), an erasable and programmable read-only memory (EPROM or flash memory), a fiber optic device, and a portable compact disk read-only memory (CDROM). In addition, the computer-readable medium may even be paper or other suitable medium on which the program is printed, since the program may be obtained electronically, for example, by optically scanning the paper or other medium and then editing, interpreting or processing in other suitable ways if necessary, and then stored in a computer memory.

[0078] It should be understood that the various parts of the present application can be implemented by hardware, software, firmware or a combination thereof. In the above-mentioned embodiments, multiple steps or methods can be implemented by software or firmware stored in a memory and executed by a suitable instruction execution system. For example, if implemented by hardware, as in another embodiment, it can be implemented by any one of the following technologies known in the art or their combination: a discrete logic circuit having a logic gate circuit for implementing a logic function for a data signal, a dedicated integrated circuit having a suitable combination of logic gate circuits, a programmable gate array (PGA), a field programmable gate array (FPGA), etc.

[0079] A person skilled in the art may understand that all or part of the steps in the method for implementing the above-mentioned embodiment may be completed by instructing related hardware through a program, and the program may be stored in a computer-readable storage medium, which, when executed, includes one or a combination of the steps of the method embodiment.

[0080] In addition, each functional unit in each embodiment of the present application may be integrated into a processing module, or each unit may exist physically separately, or two or more units may be integrated into one module. The above-mentioned integrated module may be implemented in the form of hardware or in the form of a software functional module. If the integrated module is implemented in the form of a software functional module and sold or used as an independent product, it may also be stored in a computer-readable storage medium.

[0081] The storage medium mentioned above may be a read-only memory, a magnetic disk or an optical disk, etc. Although the embodiments of the present application have been shown and described above, it can be understood that the above embodiments are exemplary and cannot be understood as limiting the present application. A person of ordinary skill in the art may change, modify, replace and modify the above embodiments within the scope of the present application.

Claims

1. An image processing method, characterized in that: The following steps are involved: In response to the operation on the three-dimensional face mesh model, obtaining a shaping parameter on the three-dimensional face mesh model; Calculating the displacement vector of each 3D key point in the 3D face mesh model in the 3D space based on the shaping parameters on the 3D face mesh model; Determine the face orientation angle on the two-dimensional plane image; For each key point, a mapping relationship between a 3D displacement vector of each key point and a two-dimensional plane is calculated according to a face orientation angle on the two-dimensional plane image; Determine a displacement vector of each key point on the two-dimensional plane according to the mapping relationship; Generating a face image after 3D shaping according to the three-dimensional face mesh model and the displacement vector of each key point on the two-dimensional plane, wherein generating a face image after 3D shaping according to the three-dimensional face mesh model and the displacement vector of each key point on the two-dimensional plane comprises: Generating a deformed 3D key point on the plane image according to the displacement vector of each key point on the two-dimensional plane; The plane image is linearly stretched according to the three-dimensional face mesh model and the deformed 3D key points to obtain a face image after 3D plastic surgery.

2. The image processing method according to claim 1, characterized in that: The shaping parameters on the three-dimensional face mesh model are pre-set in the following manner: Acquire the pre-established three-dimensional mesh model of the human face; Receiving an editing operation on the three-dimensional face mesh model; According to the editing operation, reshaping parameters on the three-dimensional face mesh model are determined.

3. The image processing method according to claim 2, characterized in that: The human face three-dimensional mesh model is established in the following manner: Acquire multiple frames of images; Constructing a three-dimensional face model according to the multiple frames of images; Based on the mesh information of the three-dimensional face model, extracting a plurality of 3D key points on the face contour from the mesh information; Based on an interpolation algorithm, generating multiple 3D key points inside the face and multiple 3D key points outside the face contour according to the multiple 3D key points on the face contour; The three-dimensional mesh model of the face is established according to a plurality of 3D key points on the face contour, a plurality of 3D key points inside the face, and a plurality of 3D key points outside the face contour.

4. An image processing device, characterized in that: include: A shaping parameter acquisition module, used for acquiring shaping parameters on the three-dimensional face mesh model in response to an operation on the three-dimensional face mesh model; A calculation module, used for calculating the displacement vector of each 3D key point in the three-dimensional face mesh model in the three-dimensional space based on the shaping parameters on the three-dimensional face mesh model; A displacement vector mapping module, used to determine the face orientation angle on the two-dimensional plane image, and for each key point, calculate the mapping relationship from the 3D displacement vector of each key point to the two-dimensional plane according to the face orientation angle on the two-dimensional plane image, and determine the displacement vector of each key point on the two-dimensional plane according to the mapping relationship; A reshaped image generation module is used to generate a face image after 3D reshaping according to the three-dimensional face mesh model and the displacement vector of each key point on the two-dimensional plane. The reshaped image generation module is specifically used to: generate deformed 3D key points on the plane image according to the displacement vector of each key point on the two-dimensional plane; linearly stretch the plane image according to the three-dimensional face mesh model and the deformed 3D key points to obtain a face image after 3D reshaping.

5. The image processing device according to claim 4, characterized in that The device also includes: A shaping parameter presetting module, used to pre-set shaping parameters on the three-dimensional face mesh model; Wherein, the shaping parameter presetting module includes: An acquisition unit, used for acquiring the pre-established three-dimensional mesh model of the human face; A receiving unit, configured to receive an editing operation on the three-dimensional face mesh model; A determination unit is used to determine the shaping parameters on the three-dimensional mesh model of the human face according to the editing operation.

6. The image processing device according to claim 5, characterized in that: The device also includes: A model pre-establishment module, used to pre-establish the three-dimensional mesh model of the human face; Wherein, the model pre-establishment module includes: An acquisition unit, used for acquiring multiple frames of images; A first building unit, used for building a three-dimensional face model according to the multiple frames of images; An extraction unit, configured to extract a plurality of 3D key points on a face contour from the mesh information of the three-dimensional face model based on the mesh information of the face; A generating unit, configured to generate a plurality of 3D key points inside the face and a plurality of 3D key points outside the face contour based on the plurality of 3D key points on the face contour based on an interpolation algorithm; The second establishing unit is used to establish the three-dimensional mesh model of the face according to multiple 3D key points on the face contour, multiple 3D key points inside the face and multiple 3D key points outside the face contour.

7. An electronic device, characterized in that: include: A memory, a processor, and a computer program stored in the memory and executable on the processor, wherein when the processor executes the program, the image processing method according to any one of claims 1 to 3 is implemented.

8. A non-transitory computer-readable storage medium having a computer program stored thereon, characterized in that: When the program is executed by a processor, the image processing method according to any one of claims 1 to 3 is implemented.