WO2020249076A1 - 一种人脸校正方法及电子设备 - Google Patents

一种人脸校正方法及电子设备 Download PDF

Info

Publication number
WO2020249076A1
WO2020249076A1 PCT/CN2020/095787 CN2020095787W WO2020249076A1 WO 2020249076 A1 WO2020249076 A1 WO 2020249076A1 CN 2020095787 W CN2020095787 W CN 2020095787W WO 2020249076 A1 WO2020249076 A1 WO 2020249076A1
Authority
WO
WIPO (PCT)
Prior art keywords
face
image
electronic device
orientation
camera
Prior art date
Application number
PCT/CN2020/095787
Other languages
English (en)
French (fr)
Inventor
王利强
丁欣
姜永涛
卢恒惠
周恒�
何剑兰
Original Assignee
华为技术有限公司
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by 华为技术有限公司 filed Critical 华为技术有限公司
Publication of WO2020249076A1 publication Critical patent/WO2020249076A1/zh

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06TIMAGE DATA PROCESSING OR GENERATION, IN GENERAL
    • G06T3/00Geometric image transformations in the plane of the image
    • G06T3/02Affine transformations
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06TIMAGE DATA PROCESSING OR GENERATION, IN GENERAL
    • G06T17/00Three dimensional [3D] modelling, e.g. data description of 3D objects
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06TIMAGE DATA PROCESSING OR GENERATION, IN GENERAL
    • G06T3/00Geometric image transformations in the plane of the image
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06TIMAGE DATA PROCESSING OR GENERATION, IN GENERAL
    • G06T3/00Geometric image transformations in the plane of the image
    • G06T3/04Context-preserving transformations, e.g. by using an importance map
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06TIMAGE DATA PROCESSING OR GENERATION, IN GENERAL
    • G06T5/00Image enhancement or restoration
    • G06T5/50Image enhancement or restoration using two or more images, e.g. averaging or subtraction
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06TIMAGE DATA PROCESSING OR GENERATION, IN GENERAL
    • G06T2207/00Indexing scheme for image analysis or image enhancement
    • G06T2207/20Special algorithmic details
    • G06T2207/20036Morphological image processing
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06TIMAGE DATA PROCESSING OR GENERATION, IN GENERAL
    • G06T2207/00Indexing scheme for image analysis or image enhancement
    • G06T2207/30Subject of image; Context of image processing
    • G06T2207/30196Human being; Person
    • G06T2207/30201Face

Definitions

  • This application relates to the field of image processing, and in particular to a face correction method and electronic equipment.
  • user 1 uses a desktop computer to conduct a video conference with user 2. There is a certain angle and distance between the display screen of the desktop computer and the camera.
  • user 1 uses a Huawei laptop to conduct video chat with user 2.
  • the camera of Huawei notebook computer is a hidden design, located below the display screen ( Figure 2 is only to indicate the location of the camera, not the actual setting of the camera).
  • Figure 1 or Figure 2 in the video process of user 1 and user 2, if user 1 looks at the display screen, that is, his face or line of sight is not facing the camera, then the face of user 1 in the video captured by the camera Or the line of sight is not facing the display. In this way, user 2 will see user 1 looking elsewhere in the video screen.
  • user 1 in the video picture that user 2 sees, user 1’s face is facing upwards, and his eyes are upwards, and there is no eye contact with himself. This will cause unnatural communication and reduce communication efficiency.
  • the embodiments of the present application provide a face correction method and electronic device, which solves the problem that if the user does not look at the camera but at the display screen when there is a certain angle or distance between the display screen and the camera, the other party can see In the video, the person looks away and has no eye contact with himself, which leads to unnatural communication and low communication efficiency.
  • an embodiment of the present application provides a face correction method.
  • the method may include: an electronic device acquires a first 2D image, and the orientation of the face in the first 2D image is perpendicular to the vertical line of the display screen of the electronic device Non-parallel, that is, the face in the first 2D image is not facing the display screen of the electronic device; the electronic device obtains a 3D face model, and the orientation of the face in the 3D face model is the same as when the camera captures the first 2D image
  • the orientation of the user’s face relative to the camera is the same, and the face in the 3D face model is not directly facing the display screen;
  • the electronic device performs face orientation correction on the 3D face in the 3D face model, and the corrected 3D face
  • the orientation of the face in the model is parallel to the vertical line of the display screen, that is to say, the face face in the corrected 3D face model is facing the display screen; the electronic device projects the corrected 3D face model to obtain 2D Face image, the orientation of the face
  • the face correction method obtaineds the original 2D image and the 3D face model, and reprojects the 3D face in the 3D face model to obtain the 2D face image.
  • face affine transformation or perspective transformation
  • the face is realized Correction of orientation.
  • the person in the video screen watched by the peer user will not look away, and will feel that there is eye contact between the person in the video screen and himself, making the communication more natural and improving communication efficiency.
  • this fusion method has a small amount of calculation and does not need to occupy a lot of resources.
  • the above-mentioned electronic device may further include the above-mentioned camera, and there is at least one of the following relationships between the camera and the display screen: the orientation of the camera is different from the orientation of the display screen of the electronic device , There is a distance between the camera and the display screen; the electronic device acquiring the first 2D image may include: the electronic device collects an image sequence through the camera, and the image sequence includes the first 2D image.
  • the 2D image whose face is not facing the display screen can be corrected by the method provided in this embodiment for face correction or sight line correction. Correct the face and line of sight to make communication more natural.
  • the foregoing camera may be a 2D camera; the electronic device obtains a 3D face model, which may specifically include: the electronic device performs a human based on the first 2D image. Face 3D reconstruction to obtain a 3D face model. If the above-mentioned camera is a 3D camera, the 3D face model can be directly obtained through the 3D camera. If the aforementioned camera is a 2D camera, 3D face reconstruction can be performed according to the 2D image captured by the camera to obtain a 3D face model.
  • the foregoing electronic device performs 3D face reconstruction according to the first 2D image to obtain a 3D face model, which may specifically include: A 2D image is detected to obtain the contours of the face and the position of the feature points.
  • the feature points can include the feature points at the corresponding positions of the eyebrows, eyes, nose and mouth of the face; the electronic device is based on the contours and features of the face 3D reconstruction of the face is performed on the position of the point to obtain a 3D face model.
  • face detection on the first 2D image
  • the contour of the face and the location of the feature points can be obtained.
  • 3D reconstruction of the human face can be realized to obtain a 3D human face model.
  • the foregoing electronic device performs facial orientation correction on the 3D face in the 3D face model, which may specifically include: the electronic device obtains the orientation of the camera The included angle with the orientation of the display screen; the electronic device performs facial orientation correction on the 3D face in the 3D face model according to the included angle between the orientation of the camera and the orientation of the display screen. Correcting the face orientation of the 3D face in the 3D face model according to the angle between the orientation of the camera and the display screen can make the 3D face in the corrected 3D face model face the display screen.
  • the electronic device projects the corrected 3D face model to obtain a 2D face image, which may specifically include: the electronic device performs correction The latter 3D face model is projected to obtain a face projection image; the electronic device corrects the angle and direction of the 3D face rotation when correcting the face orientation of the 3D face in the 3D face model. Adjust the face position to obtain a 2D face image. By modulating the position of the face in the obtained face projection image, the user's line of sight direction can be further corrected, making communication more natural and further improving communication efficiency.
  • the method may further include: the electronic device detects the 2D face image to obtain the 2D face image The position of the control point of the image, the position of the feature point of the face and the contour of the face; where the control point may include the feature point at at least one of the following positions: the feature point at the corresponding position of the forehead of the face, The feature point at the corresponding position of the neck; in the contour of the face, the feature point at the corresponding position of the chin of the face is the feature point at the corresponding position of the 2D face image, except for the contour of the face, the corresponding position of the chin
  • the feature point at is the feature point at the corresponding position of the first 2D image; in addition, when the first 2D image is detected, the location of the feature point of the first 2D image can also be obtained; the electronic device uses the feature point in the 2D face image
  • the face image is the target, and the affin
  • it may include: the position of the feature point of the face and the control point of the electronic device according to the 2D face image, And the contour of the face, the face image in the 2D face image is divided into regions to obtain multiple first area blocks; the electronic device controls the position of the face and face feature points in the first 2D image The position and the contour of the face are divided into areas of the face image in the first 2D image to obtain multiple second area blocks; wherein, the multiple first area blocks correspond to the multiple second area blocks one-to-one , The position of the control point of the first 2D image is obtained by detecting the first 2D image; the electronic device takes each first area block in the 2D face image as a target, and performs a check on each second area block in the first 2D image.
  • the area block undergoes affine transformation. Due to the single detection of facial contours and feature points at the corresponding positions of eyebrows, eyes, nose and mouth, the contour area obtained is limited. On the basis of these feature points, further adding feature points at at least one of the forehead and neck is used to identify the face contour area to protect the first 2D image from deforming the face (such as the above affine transformation) The contours of the face will not change at the time.
  • the method may further include: Corrosion processing is performed on the facial mask of the face; the above electronic device fuses the first 2D image after affine transformation with the 2D face image according to the face mask of the 2D face image to obtain a second 2D image, Specifically, it may include: the electronic device fuses the first 2D image after affine transformation and the 2D face image according to the face mask of the 2D face image after the corrosion process, to obtain the second 2D image.
  • the face mask of the generated 2D face image can be corroded and optimized to reduce the mask area of the face, and then the face mask after the corrosion optimization is used for seamless image Splicing and fusion.
  • the method may further include: the electronic device covers the corresponding area of the first 2D image with the second 2D image In the image, generate a corrected image. In this way, background information can be protected more truthfully.
  • an embodiment of the present application provides an electronic device.
  • the electronic device may include: a processor, a memory, and a display screen; the processor, the memory, and the display screen are coupled, and the memory may be used to store computer program code.
  • the computer program code includes a computer Instruction, when the computer instruction is executed by the electronic device, the electronic device is caused to perform the following operations: acquire a first 2D image, the orientation of the face in the first 2D image is not parallel to the vertical line of the display screen; acquire a 3D face model , The orientation of the face in the 3D face model is the same as the orientation of the user’s face relative to the camera when the camera captures the first 2D image; the 3D face in the 3D face model is corrected for face orientation, and the corrected 3D person The orientation of the face in the face model is parallel to the vertical line of the display screen; the corrected 3D face model is projected to obtain a 2D face image, and the orientation of the face in the 2D face image is parallel to the vertical line of the display screen ;
  • the electronic device may further include the above-mentioned camera, and there is at least one of the following relationships between the camera and the display: the orientation of the camera is different from the orientation of the display, and the difference between the camera and the display There is a distance between them; the foregoing acquisition of the first 2D image may specifically be: acquiring an image sequence through a camera, and the image sequence includes the first 2D image.
  • the foregoing camera may be a 2D camera; the foregoing acquisition of the 3D face model may specifically be: performing face 3D reconstruction according to the first 2D image, Obtain a 3D face model.
  • the foregoing 3D face reconstruction based on the first 2D image to obtain a 3D face model may specifically be: detecting the first 2D image , Obtain the contour of the face and the location of the feature points.
  • the feature points include the feature points at the corresponding positions of the eyebrows, eyes, nose and mouth of the face; 3D reconstruction of the face is performed according to the contour of the face and the location of the feature points, Obtain a 3D face model.
  • the above-mentioned performing face orientation correction on the 3D face in the 3D face model may specifically be: acquiring the orientation of the camera and the orientation of the display screen According to the angle between the orientation of the camera and the orientation of the display screen, the face orientation correction is performed on the 3D face in the 3D face model.
  • the above-mentioned projection of the corrected 3D face model to obtain a 2D face image may specifically be: the corrected 3D face The model is projected to obtain the face projection image; according to the angle and direction of the 3D face rotation when correcting the face orientation of the 3D face in the 3D face model, the face position in the face projection image is adjusted to obtain 2D Face image.
  • the electronic device when the computer instruction is executed by the electronic device, the electronic device is also caused to perform the following operations: detect the 2D face image and obtain the 2D face The position of the control point of the image, the position of the feature point of the face and the contour of the face; where the control point may include the feature point at at least one of the following positions: the feature point at the corresponding position of the forehead of the face, The feature point at the corresponding position of the neck; in the contour of the face, the feature point at the corresponding position of the chin of the face is the feature point at the corresponding position of the 2D face image, except for the contour of the face, the corresponding position of the chin
  • the feature point at is the feature point at the corresponding position of the first 2D image; the above-mentioned takes the face image in the 2D face image as the target, and performs affine transformation on the face image in the first 2D image, which can be specifically : According to the position of the facial feature
  • the electronic device when the computer instruction is executed by the electronic device, the electronic device is also caused to perform the following operations: perform the following operations on the face mask of the 2D face image Corrosion processing; according to the face mask of the 2D face image, the first 2D image after affine transformation and the 2D face image are merged to obtain the second 2D image, which can be specifically: For the face mask of the 2D face image, the first 2D image after affine transformation and the 2D face image are merged to obtain the second 2D image.
  • the electronic device when the computer instruction is executed by the electronic device, the electronic device is also caused to perform the following operations: cover the corresponding area of the first 2D image with the second 2D image In the image, generate a corrected image.
  • an embodiment of the present application provides a computer-readable storage medium, which may include: computer software instructions; when the computer software instructions run in an electronic device, the electronic device executes the same as the first aspect Or the face correction method described in any one of the possible implementation manners of the first aspect.
  • the embodiments of the present application provide a computer program product, which when the computer program product runs on a computer, causes the computer to execute the first aspect of the claim or any one of the possible implementation manners of the first aspect.
  • the embodiments of the present application provide a chip system, which is applied to an electronic device; the chip system includes an interface circuit and a processor; the interface circuit and the processor are interconnected by wires; the interface circuit is used to receive data from the memory of the electronic device Signal and send a signal to the processor, the signal includes a computer instruction stored in the memory; when the processor executes the computer instruction, the chip system executes the first aspect or any one of the possible implementation manners of the first aspect Face correction method.
  • an embodiment of the present application provides a device that has the function of implementing the behavior of the electronic device in the method of the first aspect.
  • the function can be realized by hardware, or by hardware executing corresponding software.
  • the hardware or software includes one or more modules corresponding to the above functions, for example, acquisition unit or module, correction unit or module, projection unit or module, transformation unit or module, generation unit or module, fusion unit or module, etc.
  • GUI graphical user interface
  • the graphical user interface is stored in an electronic device, and the electronic device includes a display, a memory, one or more processors; one or more A processor is used to execute one or more computer programs stored in the memory
  • the graphical user interface includes: a GUI displayed on the display, the GUI includes a video screen, and the video screen includes the face of the first user, The face of the first user faces the display screen, the video image is transmitted to the electronic device by other electronic devices (such as the second electronic device), the second electronic device includes a display screen and a camera, and the second electronic device
  • the orientation of the camera is different from the orientation of the display screen, and there is a distance between the camera and the display screen.
  • FIG. 1 is a schematic diagram of a video scene provided by an embodiment of the application
  • FIG. 2 is a schematic diagram of another video scene provided by an embodiment of the application.
  • Fig. 3 is a schematic diagram of a video picture provided by the prior art
  • FIG. 5 is a schematic structural diagram of an electronic device provided by an embodiment of this application.
  • FIG. 6 is a schematic flowchart of a face correction method provided by an embodiment of this application.
  • FIG. 7 is a schematic flowchart of another face correction method provided by an embodiment of the application.
  • FIG. 8 is a schematic diagram of a video screen provided by an embodiment of the application.
  • FIG. 9 is a schematic diagram of image processing provided by an embodiment of the application.
  • FIG. 10 is a schematic diagram of another image processing provided by an embodiment of the application.
  • FIG. 11 is a schematic diagram of still another image processing provided by an embodiment of this application.
  • FIG. 12 is a schematic diagram of still another image processing provided by an embodiment of this application.
  • FIG. 13 is a schematic diagram of still another image processing provided by an embodiment of this application.
  • FIG. 14 is a schematic diagram of still another image processing provided by an embodiment of this application.
  • FIG. 15 is a schematic diagram of another image processing provided by an embodiment of this application.
  • FIG. 16 is a schematic diagram of another image processing provided by an embodiment of this application.
  • FIG. 17 is a schematic diagram of still another image processing provided by an embodiment of this application.
  • FIG. 18 is a schematic diagram of another video screen provided by an embodiment of the application.
  • FIG. 19 is a schematic diagram of the composition of an electronic device provided by an embodiment of the application.
  • Solution 1 Configure the device with a three-dimensions (3D) camera.
  • the device uses a 3D camera to collect the user's 3D model and two-dimension (2D) images (the 2D image collected by the 3D camera can be called the original 2D image).
  • the 3D face in the 3D model is corrected for face orientation and sight orientation, and the corrected 3D model is projected to obtain a corrected 2D image.
  • the corrected 2D image and the original 2D image are seamlessly merged through an iterative energy optimization method to obtain a 2D image with the face and the line of sight facing the display screen.
  • Solution 2 In the user video process, based on the 2D image (such as the original 2D image) collected by the device's 2D camera, perform 3D reconstruction of the human head and neck in the original 2D image to create a 3D head and neck model. Correct the face orientation and sight orientation of the 3D face in the 3D head and neck model, project the corrected 3D head and neck model to obtain a corrected 2D image, and extract the face edges in the image contour. Finally, it is also possible to seamlessly merge the corrected 2D image with the original 2D image through the energy iteration optimization method according to the extracted face edge contour, to obtain a 2D image with the face and the line of sight facing the display screen.
  • the 2D image such as the original 2D image
  • the device's 2D camera perform 3D reconstruction of the human head and neck in the original 2D image to create a 3D head and neck model. Correct the face orientation and sight orientation of the 3D face in the 3D head and neck model, project the corrected 3D head and neck model to obtain a corrected 2D image,
  • the embodiment of the present application provides a face correction method, which can be applied to electronic devices.
  • the electronic device can obtain the original 2D image and the 3D face model.
  • the face of the person in the original 2D image is not facing the display screen of the electronic device.
  • the face orientation of the face in the 3D face model is not directly facing the display screen.
  • the electronic device may perform face orientation correction on the 3D face in the 3D face model, so that the face orientation of the face in the corrected 3D face model faces the display screen.
  • the corrected 3D face model is projected to obtain a 2D face image. Since the orientation of the face in the corrected 3D face model is directly facing the display screen, the orientation of the face in the projected 2D face image is also facing the display screen.
  • the electronic device can target the face image in the 2D face image, perform affine transformation on the face image in the original 2D image, and generate a face mask of the 2D face image. . Finally, according to the face mask of the 2D face image, the original 2D image after affine transformation and the 2D face image are merged to obtain a 2D image with the face facing the display screen.
  • the 3D face in the obtained 3D face model is corrected and then reprojected to obtain the 2D face image.
  • the correction of the face orientation is realized.
  • the person in the video screen watched by the peer user will not look away, and feel that there is eye contact between the person in the video screen and himself, making the communication more natural and improving communication efficiency.
  • this fusion method has a small amount of calculation and does not need to occupy a lot of resources.
  • FIG. 4 is a schematic diagram of a system architecture that can apply the aforementioned face correction method according to an embodiment of the application.
  • the system architecture may include at least two electronic devices: for example, a first electronic device 401 and a second electronic device 402.
  • the first electronic device 401 can be used as an end of a call to communicate with the second electronic device 402. For example, one or more users 1 can talk with one or more users 2 of the second electronic device 402 through the first electronic device 401.
  • the call in this embodiment may refer to a video call or a video conference. Therefore, the first electronic device 401 includes at least a camera and a display screen, and the second electronic device 402 also includes at least a camera and a display screen. In addition, the first electronic device 401 and the second electronic device 402 may also include a receiver (or speaker), a microphone, and the like.
  • the camera can be used to capture image sequences during a call.
  • the display screen can be used to display images during the call, such as the image sequence sent by the peer device of the call, or the image sequence collected by itself.
  • the earpiece (or speaker) is used to play the voice during a call.
  • the microphone is used to collect the voice during the call.
  • the first electronic device 401 or the second electronic device 402 may not include a camera, but a camera is connected.
  • the orientation of the camera and the display screen is different, there is a distance between the camera and the display.
  • the camera of the electronic device can be a 2D camera or a 3D camera.
  • the orientation of the camera of the first electronic device 401 is different from the orientation of the display screen it includes, and there is a distance between the camera and the display screen. Then, the image sequence collected by the first electronic device 401 will include a 2D image whose face is not facing the display screen. In this embodiment, the first electronic device 401 may perform face correction on this type of 2D image, and send the corrected 2D image to the second electronic device 402, so that one or more users 2 can view the face on the second electronic device 402. In the video picture seen on the display screen of 402, there will be no problem of one or more users 1 looking elsewhere.
  • the first electronic device 401 may also send an image sequence containing a 2D image of a human face whose face is not facing the display screen to the second electronic device 402, and the second electronic device 402 performs processing on such images.
  • the face is corrected so that in the video picture seen by one or more users 2 on the display screen of the second electronic device 402, there will be no problem of one or more users 1 looking elsewhere.
  • the second electronic device 402 may also have at least one of the following relationships between the camera and the display screen: the orientation of the camera and the orientation of the display screen included in the camera are different, and there is a distance between the camera and the display screen. Then the second electronic device 402 can perform face correction on the collected 2D image containing the face and the face is not facing the display screen, or the first electronic device 401 can perform the human face correction on this type of image. For face correction, the embodiment of the application does not specifically limit it here.
  • the orientation of the camera and the orientation of the display screen included in the camera are different, and the camera There is a distance between its display screen, the second electronic device 402 does not have this situation, and the first electronic device 401 performs face correction on a 2D image containing a human face that is not facing the display screen as an example.
  • This embodiment provides The method of face correction is introduced in detail.
  • the electronic devices described in the embodiments of the present application may be mobile phones, tablet computers, desktops, laptops, handheld computers, notebook computers (such as Huawei laptops), desktop computers, ultra-mobile personal computers (UMPC), netbooks, and cellular phones, personal digital assistants (PDAs), augmented reality (AR) ⁇ virtual reality Virtual reality (VR) devices, televisions, and other devices that include or are connected to a display screen and a camera, the embodiment of the present application does not impose special restrictions on the specific form of the device.
  • PDAs personal digital assistants
  • AR augmented reality
  • VR virtual reality Virtual reality
  • the aforementioned first electronic device 401 and the second electronic device 402 may be the same type of electronic device, for example, the first electronic device 401 and the second electronic device 402 are both laptop computers. In some other embodiments, the first electronic device 401 and the second electronic device 402 may be different types of electronic devices.
  • the first electronic device 401 is a Huawei laptop computer
  • the second electronic device 402 is a desktop computer (as shown in FIG. 5 Shown in).
  • FIG. 5 is a schematic structural diagram of an electronic device provided by an embodiment of this application.
  • the structures of the first electronic device 401 and the second electronic device 402 may be as shown in FIG. 5.
  • the electronic device may include a processor 110, an external memory interface 120, an internal memory 121, a universal serial bus (USB) interface 130, a charging management module 140, a power management module 141, and a battery 142, Antenna 1, antenna 2, mobile communication module 150, wireless communication module 160, audio module 170, speaker 170A, receiver 170B, microphone 170C, earphone interface 170D, sensor module 180, button 190, motor 191, indicator 192, camera 193, A display screen 194, and a subscriber identification module (SIM) card interface 195, etc.
  • SIM subscriber identification module
  • the sensor module 180 may include a pressure sensor 180A, a gyroscope sensor 180B, an air pressure sensor 180C, a magnetic sensor 180D, an acceleration sensor 180E, a distance sensor 180F, a proximity sensor 180G, a fingerprint sensor 180H, a temperature sensor 180J, a touch sensor 180K, and the environment Light sensor 180L, bone conduction sensor 180M, etc.
  • the structure illustrated in this embodiment does not constitute a specific limitation on the electronic device.
  • the electronic device may include more or fewer components than shown, or combine certain components, or split certain components, or arrange different components.
  • the illustrated components can be implemented in hardware, software, or a combination of software and hardware.
  • the processor 110 may include one or more processing units.
  • the processor 110 may include an application processor (AP), a modem processor, a graphics processing unit (GPU), and an image signal processor. (image signal processor, ISP), controller, memory, video codec, digital signal processor (digital signal processor, DSP), baseband processor, neural network processor (neural-network processing unit, NPU), etc. one or more.
  • AP application processor
  • modem processor graphics processing unit
  • GPU graphics processing unit
  • image signal processor image signal processor
  • ISP image signal processor
  • controller memory
  • video codec digital signal processor
  • DSP digital signal processor
  • baseband processor baseband processor
  • neural network processor neural-network processing unit
  • the controller can be the nerve center and command center of the electronic device.
  • the controller can generate operation control signals according to the instruction operation code and timing signals to complete the control of fetching and executing instructions.
  • a memory may also be provided in the processor 110 to store instructions and data.
  • the memory in the processor 110 is a cache memory.
  • the memory can store instructions or data that the processor 110 has just used or cyclically used. If the processor 110 needs to use the instruction or data again, it can be directly called from the memory. Repeated accesses are avoided, the waiting time of the processor 110 is reduced, and the efficiency of the system is improved.
  • the processor 110 may include one or more interfaces.
  • Interfaces may include integrated circuit (I2C) interfaces, integrated circuit built-in audio (inter-integrated circuit sound, I2S) interfaces, pulse code modulation (PCM) interfaces, universal asynchronous transmitters and receivers One or more of receiver/transmitter (UART) interface, mobile industry processor interface (MIPI), general-purpose input/output (GPIO) interface, SIM interface, USB interface, etc.
  • I2C integrated circuit
  • I2S integrated circuit built-in audio
  • PCM pulse code modulation
  • UART receiver/transmitter
  • MIPI mobile industry processor interface
  • GPIO general-purpose input/output
  • SIM interface SIM interface
  • USB interface etc.
  • the charging management module 140 is used to receive charging input from the charger.
  • the charger can be a wireless charger or a wired charger.
  • the charging management module 140 may receive the charging input of the wired charger through the USB interface 130.
  • the charging management module 140 may receive the wireless charging input through the wireless charging coil of the electronic device. While the charging management module 140 charges the battery 142, it can also supply power to the electronic device through the power management module 141.
  • the power management module 141 is used to connect the battery 142, the charging management module 140 and the processor 110.
  • the power management module 141 receives input from the battery 142 and the charging management module 140, and supplies power to the processor 110, the internal memory 121, the external memory, the display screen 194, the camera 193, and the wireless communication module 160.
  • the power management module 141 can also be used to monitor parameters such as battery capacity, battery cycle times, and battery health status (leakage, impedance).
  • the power management module 141 may also be provided in the processor 110.
  • the power management module 141 and the charging management module 140 may also be provided in the same device.
  • the wireless communication function of the electronic device can be realized by the antenna 1, the antenna 2, the mobile communication module 150, the wireless communication module 160, the modem processor, and the baseband processor.
  • the antenna 1 and the antenna 2 are used to transmit and receive electromagnetic wave signals.
  • Each antenna in an electronic device can be used to cover a single or multiple communication frequency bands. Different antennas can also be reused to improve antenna utilization.
  • antenna 1 can be multiplexed as a diversity antenna of a wireless local area network.
  • the antenna can be used in combination with a tuning switch.
  • the mobile communication module 150 can provide wireless communication solutions including 2G/3G/4G/5G and the like applied to electronic devices.
  • the mobile communication module 150 may include at least one filter, switch, power amplifier, low noise amplifier (LNA), etc.
  • the mobile communication module 150 can receive electromagnetic waves by the antenna 1, and perform processing such as filtering, amplifying and transmitting the received electromagnetic waves to the modem processor for demodulation.
  • the mobile communication module 150 can also amplify the signal modulated by the modem processor, and convert it into electromagnetic waves for radiation via the antenna 1.
  • at least part of the functional modules of the mobile communication module 150 may be provided in the processor 110.
  • at least part of the functional modules of the mobile communication module 150 and at least part of the modules of the processor 110 may be provided in the same device.
  • the modem processor may include a modulator and a demodulator.
  • the modulator is used to modulate the low frequency baseband signal to be sent into a medium and high frequency signal.
  • the demodulator is used to demodulate the received electromagnetic wave signal into a low-frequency baseband signal. Then the demodulator transmits the demodulated low-frequency baseband signal to the baseband processor for processing.
  • the low-frequency baseband signal is processed by the baseband processor and then passed to the application processor.
  • the application processor outputs a sound signal through an audio device (not limited to the speaker 170A, the receiver 170B, etc.), or displays an image or video through the display screen 194.
  • the modem processor may be an independent device.
  • the modem processor may be independent of the processor 110 and be provided in the same device as the mobile communication module 150 or other functional modules.
  • the wireless communication module 160 can provide applications on electronic devices including wireless local area networks (WLAN) (such as wireless fidelity (Wi-Fi) networks), bluetooth (BT), and global navigation satellite systems. (global navigation satellite system, GNSS), frequency modulation (frequency modulation, FM), near field communication technology (near field communication, NFC), infrared technology (infrared, IR) and other wireless communication solutions.
  • WLAN wireless local area networks
  • BT Bluetooth
  • GNSS global navigation satellite system
  • frequency modulation frequency modulation, FM
  • NFC near field communication technology
  • infrared technology infrared, IR
  • the wireless communication module 160 may be one or more devices integrating at least one communication processing module.
  • the wireless communication module 160 receives electromagnetic waves via the antenna 2, frequency modulates and filters the electromagnetic wave signals, and sends the processed signals to the processor 110.
  • the wireless communication module 160 can also receive the signal to be sent from the processor 110, perform frequency modulation, amplify it, and convert it into electromagnetic wave radiation via the antenna 2.
  • the antenna 1 of the electronic device is coupled with the mobile communication module 150, and the antenna 2 is coupled with the wireless communication module 160, so that the electronic device can communicate with the network and other devices through wireless communication technology.
  • the electronic device may conduct a video call or video conference with other electronic devices through the antenna 1 and the mobile communication module 150.
  • the wireless communication technologies may include global system for mobile communications (GSM), general packet radio service (GPRS), code division multiple access (CDMA), broadband Code division multiple access (wideband code division multiple access, WCDMA), time-division code division multiple access (TD-SCDMA), long term evolution (LTE), BT, GNSS, WLAN, NFC , FM, IR technology, etc. one or more.
  • the GNSS may include global positioning system (GPS), global navigation satellite system (GLONASS), Beidou navigation satellite system (BDS), quasi-zenith satellite system (quasi -zenith satellite system, QZSS), satellite-based augmentation system (satellite-based augmentation systems, SBAS), etc., one or more.
  • GPS global positioning system
  • GLONASS global navigation satellite system
  • BDS Beidou navigation satellite system
  • QZSS quasi-zenith satellite system
  • QZSS quasi-zenith satellite system
  • SBAS satellite-based augmentation system
  • the electronic device realizes the display function through GPU, display screen 194, and application processor.
  • the GPU is a microprocessor for image processing, connected to the display 194 and the application processor.
  • the GPU is used to perform mathematical and geometric calculations for graphics rendering.
  • the processor 110 may include one or more GPUs, which execute program instructions to generate or change display information.
  • the display screen 194 is used to display images, videos, etc.
  • the display screen 194 includes a display panel.
  • the display panel can adopt liquid crystal display (LCD), organic light-emitting diode (OLED), active-matrix organic light-emitting diode or active-matrix organic light-emitting diode (active-matrix organic light-emitting diode).
  • LCD liquid crystal display
  • OLED organic light-emitting diode
  • active-matrix organic light-emitting diode active-matrix organic light-emitting diode
  • emitting diode AMOLED, flexible light-emitting diode (FLED), Miniled, MicroLed, Micro-oLed, quantum dot light-emitting diode (QLED), etc.
  • the electronic device may include 1 or N display screens 194, and N is a positive integer greater than 1.
  • the display screen 194 may display a video answering interface, or a video reminder interface, or a video call interface (such as Including the image sequence sent by the peer device and the image sequence collected by this device).
  • Electronic equipment can realize shooting functions through ISP, camera 193, video codec, GPU, display 194, and application processor.
  • the ISP is used to process the data fed back from the camera 193. For example, when taking a picture, the shutter is opened, the light is transmitted to the photosensitive element of the camera through the lens, the light signal is converted into an electrical signal, and the photosensitive element of the camera transfers the electrical signal to the ISP for processing and is converted into an image visible to the naked eye.
  • ISP can also optimize the image noise, brightness, and skin color. ISP can also optimize the exposure, color temperature and other parameters of the shooting scene.
  • the ISP may be provided in the camera 193.
  • the camera 193 is used to capture still images or videos.
  • the camera 193 may be used to capture an image sequence during a video call or a video conference.
  • the object generates an optical image through the lens and projects it to the photosensitive element.
  • the photosensitive element may be a charge coupled device (CCD) or a complementary metal-oxide-semiconductor (CMOS) phototransistor.
  • CMOS complementary metal-oxide-semiconductor
  • the photosensitive element converts the optical signal into an electrical signal, and then transmits the electrical signal to the ISP to convert it into a digital image signal.
  • ISP outputs digital image signals to DSP for processing.
  • DSP converts digital image signals into standard RGB, YUV and other formats.
  • the electronic device may include 1 or N cameras 193, and N is a positive integer greater than 1.
  • the camera 193 may be a normal 2D camera or a 3D camera.
  • the camera 193 may be installed in the electronic device in a hidden manner, or may not be installed in a hidden manner, and this embodiment does not make specific limitations here.
  • the orientation of the camera 193 is different from the orientation of the display screen 194, and there is a distance between the camera 193 and the display screen 194 .
  • the image sequence collected by the camera 193 there may be 2D images whose face orientation of the user is not directly facing the display screen.
  • Digital signal processors are used to process digital signals. In addition to digital image signals, they can also process other digital signals. For example, when the electronic device selects the frequency point, the digital signal processor is used to perform Fourier transform on the frequency point energy.
  • Video codecs are used to compress or decompress digital video.
  • the electronic device can support one or more video codecs.
  • the electronic device can play or record videos in a variety of encoding formats, such as: moving picture experts group (MPEG) 1, MPEG2, MPEG3, MPEG4, etc.
  • MPEG moving picture experts group
  • NPU is a neural-network (NN) computing processor.
  • NN neural-network
  • NPU can realize the intelligent cognition of electronic devices and other applications, such as: image recognition, face recognition, voice recognition, text understanding, etc.
  • the external memory interface 120 may be used to connect an external memory card, such as a Micro SD card, to expand the storage capacity of the electronic device.
  • the external memory card communicates with the processor 110 through the external memory interface 120 to realize the data storage function. For example, save music, video and other files in an external memory card.
  • the internal memory 121 may be used to store computer executable program code, where the executable program code includes instructions.
  • the processor 110 executes various functional applications and data processing of the electronic device by running instructions stored in the internal memory 121.
  • the processor 110 may perform face correction on the 2D image whose face orientation is not facing the display screen in the acquired image sequence by executing instructions stored in the internal memory 121, so as to make the correction In the latter image, the face faces the display screen, so that the user in the video screen watched by the user on the call will not look away. In this way, the user on the opposite end of the call can feel that there is eye contact between the person in the video screen and himself, which makes the communication more natural and improves communication efficiency.
  • the processor 110 may perform three-dimensional face reconstruction, face rotation correction, and seamless face fusion by executing instructions stored in the internal memory 121.
  • the internal memory 121 may include a storage program area and a storage data area.
  • the storage program area can store an operating system, at least one application program (such as a sound playback function, an image playback function, etc.) required by at least one function.
  • the data storage area can store data (such as audio data, phone book, etc.) created during the use of the electronic device.
  • the internal memory 121 may include a high-speed random access memory, and may also include a non-volatile memory, such as at least one magnetic disk storage device, a flash memory device, a universal flash storage (UFS), etc.
  • the internal memory 121 can also be used to store the image sequence collected by the camera 193, the 2D face image obtained by the processor 110, the 3D face model, the deformed 2D image, and so on.
  • the electronic device can implement audio functions through the audio module 170, the speaker 170A, the receiver 170B, the microphone 170C, the earphone interface 170D, and the application processor. For example, call, music playback, recording, etc.
  • the audio module 170 is used to convert digital audio information into an analog audio signal for output, and is also used to convert an analog audio input into a digital audio signal.
  • the audio module 170 can also be used to encode and decode audio signals.
  • the audio module 170 may be provided in the processor 110, or part of the functional modules of the audio module 170 may be provided in the processor 110.
  • the speaker 170A also called a “speaker” is used to convert audio electrical signals into sound signals.
  • the electronic device can listen to music through the speaker 170A, or listen to a hands-free call.
  • the receiver 170B also called “earpiece” is used to convert audio electrical signals into sound signals.
  • the electronic device answers a call or voice message, it can receive the voice by bringing the receiver 170B close to the human ear.
  • the microphone 170C also called “microphone”, “microphone”, is used to convert sound signals into electrical signals.
  • the user can approach the microphone 170C through the mouth to make a sound, and input the sound signal into the microphone 170C.
  • the electronic device may be provided with at least one microphone 170C.
  • the electronic device may be provided with two microphones 170C, which can realize noise reduction function in addition to collecting sound signals.
  • the electronic device may also be provided with three, four or more microphones 170C to collect sound signals, reduce noise, identify sound sources, and realize directional recording functions.
  • the earphone interface 170D is used to connect wired earphones.
  • the earphone interface 170D may be a USB interface 130, or a 3.5mm open mobile terminal platform (OMTP) standard interface, or a cellular telecommunications industry association (cellular telecommunications industry association of the USA, CTIA) standard interface.
  • OMTP open mobile terminal platform
  • CTIA cellular telecommunications industry association
  • the pressure sensor 180A is used to sense the pressure signal and can convert the pressure signal into an electrical signal.
  • the pressure sensor 180A may be provided on the display screen 194.
  • the capacitive pressure sensor may include at least two parallel plates with conductive material. When a force is applied to the pressure sensor 180A, the capacitance between the electrodes changes. The electronic device determines the strength of the pressure based on the change in capacitance. When a touch operation acts on the display screen 194, the electronic device detects the intensity of the touch operation according to the pressure sensor 180A. The electronic device may also calculate the touched position based on the detection signal of the pressure sensor 180A.
  • touch operations that act on the same touch location but have different touch operation strengths may correspond to different operation instructions. For example: when a touch operation whose intensity is less than the first pressure threshold is applied to the short message application icon, an instruction to view the short message is executed. When a touch operation with a touch operation intensity greater than or equal to the first pressure threshold acts on the short message application icon, an instruction to create a new short message is executed.
  • the gyro sensor 180B can be used to determine the movement posture of the electronic device.
  • the angular velocity of the electronic device around three axes ie, x, y, and z axes
  • the gyro sensor 180B can be used for image stabilization.
  • the gyroscope sensor 180B detects the angle of the shake of the electronic device, calculates the distance that the lens module needs to compensate according to the angle, and allows the lens to counteract the shake of the electronic device through a reverse movement to achieve anti-shake.
  • the gyro sensor 180B can also be used for navigation and somatosensory game scenes.
  • the air pressure sensor 180C is used to measure air pressure.
  • the electronic device calculates the altitude based on the air pressure value measured by the air pressure sensor 180C to assist positioning and navigation.
  • the magnetic sensor 180D includes a Hall sensor.
  • the electronic device can use the magnetic sensor 180D to detect the opening and closing of the flip holster.
  • the electronic device when the electronic device is a flip machine, the electronic device can detect the opening and closing of the flip according to the magnetic sensor 180D.
  • features such as automatic unlocking of the flip cover are set.
  • the acceleration sensor 180E can detect the magnitude of the acceleration of the electronic device in various directions (generally three-axis).
  • the magnitude and direction of gravity can be detected when the electronic device is stationary. It can also be used to identify the posture of electronic devices, and used in applications such as horizontal and vertical screen switching, pedometers, etc.
  • Distance sensor 180F used to measure distance.
  • Electronic equipment can measure distance through infrared or laser.
  • the electronic device may use the distance sensor 180F to measure the distance to achieve fast focusing.
  • the proximity light sensor 180G may include, for example, a light emitting diode (LED) and a light detector such as a photodiode.
  • the light emitting diode may be an infrared light emitting diode.
  • the electronic device emits infrared light through the light-emitting diode.
  • Electronic devices use photodiodes to detect infrared reflected light from nearby objects. When sufficient reflected light is detected, it can be determined that there is an object near the electronic device. When insufficient reflected light is detected, the electronic device can determine that there is no object near the electronic device.
  • the electronic device can use the proximity light sensor 180G to detect that the user holds the electronic device close to the ear to talk, so as to automatically turn off the screen to save power.
  • the proximity light sensor 180G can also be used in leather case mode, and the pocket mode will automatically unlock and lock the screen.
  • the ambient light sensor 180L is used to sense the brightness of the ambient light.
  • the electronic device can adaptively adjust the brightness of the display screen 194 according to the perceived brightness of the ambient light.
  • the ambient light sensor 180L can also be used to automatically adjust the white balance when taking pictures.
  • the ambient light sensor 180L can also cooperate with the proximity light sensor 180G to detect whether the electronic device is in the pocket to prevent accidental touch.
  • the fingerprint sensor 180H is used to collect fingerprints. Electronic devices can use the collected fingerprint characteristics to unlock fingerprints, access application locks, take photos with fingerprints, and answer calls with fingerprints.
  • the temperature sensor 180J is used to detect temperature.
  • the electronic device uses the temperature detected by the temperature sensor 180J to execute the temperature processing strategy. For example, when the temperature reported by the temperature sensor 180J exceeds a threshold value, the electronic device executes to reduce the performance of the processor located near the temperature sensor 180J, so as to reduce power consumption and implement thermal protection.
  • the electronic device when the temperature is lower than another threshold, the electronic device heats the battery 142 to avoid abnormal shutdown of the electronic device due to low temperature.
  • the electronic device boosts the output voltage of the battery 142 to avoid abnormal shutdown caused by low temperature.
  • Touch sensor 180K also called “touch panel”.
  • the touch sensor 180K may be disposed on the display screen 194, and the touch screen is composed of the touch sensor 180K and the display screen 194, which is also called a “touch screen”.
  • the touch sensor 180K is used to detect touch operations acting on or near it.
  • the touch sensor can pass the detected touch operation to the application processor to determine the type of touch event.
  • the visual output related to the touch operation can be provided through the display screen 194.
  • the touch sensor 180K may also be disposed on the surface of the electronic device, which is different from the position of the display screen 194.
  • the bone conduction sensor 180M can acquire vibration signals.
  • the bone conduction sensor 180M can obtain the vibration signal of the vibrating bone mass of the human voice.
  • the bone conduction sensor 180M can also contact the human pulse and receive the blood pressure pulse signal.
  • the bone conduction sensor 180M may also be provided in the earphone, combined with the bone conduction earphone.
  • the audio module 170 can parse the voice signal based on the vibration signal of the vibrating bone block of the voice obtained by the bone conduction sensor 180M, and realize the voice function.
  • the application processor can analyze the heart rate information based on the blood pressure beating signal obtained by the bone conduction sensor 180M, and realize the heart rate detection function.
  • the button 190 includes a power button, a volume button, and so on.
  • the button 190 may be a mechanical button. It can also be a touch button.
  • the electronic device can receive key input and generate key signal input related to user settings and function control of the electronic device.
  • the motor 191 can generate vibration prompts.
  • the motor 191 can be used for incoming call vibration notification, and can also be used for touch vibration feedback.
  • touch operations applied to different applications can correspond to different vibration feedback effects.
  • Acting on touch operations in different areas of the display screen 194, the motor 191 can also correspond to different vibration feedback effects.
  • Different application scenarios for example: time reminding, receiving information, alarm clock, games, etc.
  • the touch vibration feedback effect can also support customization.
  • the indicator 192 may be an indicator light, which may be used to indicate the charging status, power change, or to indicate messages, missed calls, notifications, and so on.
  • the SIM card interface 195 is used to connect to the SIM card.
  • the SIM card can be inserted into the SIM card interface 195 or pulled out from the SIM card interface 195 to achieve contact and separation with the electronic device.
  • the electronic device can support 1 or N SIM card interfaces, and N is a positive integer greater than 1.
  • the SIM card interface 195 can support Nano SIM cards, Micro SIM cards, SIM cards, etc.
  • the same SIM card interface 195 can insert multiple cards at the same time. The types of the multiple cards can be the same or different.
  • the SIM card interface 195 can also be compatible with different types of SIM cards.
  • the SIM card interface 195 may also be compatible with external memory cards.
  • the electronic device interacts with the network through the SIM card to realize functions such as call and data communication.
  • the electronic device adopts eSIM, that is, an embedded SIM card.
  • the eSIM card can be embedded in the electronic device and cannot be separated from the electronic device.
  • FIG. 6 is a schematic flowchart of a face correction method provided by an embodiment of the application. As shown in Figure 6, the method may include:
  • the electronic device acquires a first 2D image, and the orientation of the human face in the first 2D image is not parallel to the vertical line of the display screen of the electronic device.
  • the electronic device may collect an image sequence through its own camera, or receive an image sequence from another electronic device, and the image sequence includes the above-mentioned first 2D image.
  • the electronic device collects the above-mentioned first 2D image through its own camera, and the camera is a 2D camera as an example.
  • the camera is a 2D camera as an example.
  • the user’s face is not facing the camera, but facing other places, such as facing the display screen, there will be faces in the image sequence collected by the electronic device through the camera.
  • a 2D image whose orientation is not parallel to the vertical line of the display screen of the electronic device. In other words, a 2D image whose face orientation of the user is not directly facing the display screen is collected, that is, the first 2D image described above.
  • the electronic device acquires a 3D face model, where the orientation of the face in the 3D face model is the same as the orientation of the user's face relative to the camera when the camera captures the first 2D image.
  • the face of the face in the 3D face model is not directly facing the display screen.
  • the 3D face model may be obtained by the electronic device by performing 3D face reconstruction according to the captured first 2D image. If the camera of the electronic device is a 3D camera, the 3D face model can be directly captured by the 3D camera.
  • the electronic device performs face orientation correction on the 3D face in the 3D face model, and the orientation of the face in the corrected 3D face model is parallel to the vertical line of the display screen.
  • the electronic device can perform face orientation correction on the 3D face in the acquired 3D face model, so that the orientation of the face in the corrected 3D face model is parallel to the vertical line of the display screen, that is, the corrected 3D face The face of the face in the face model is facing the display screen.
  • the electronic device projects the corrected 3D face model to obtain a 2D face image, where the orientation of the face in the 2D face image is parallel to the vertical line of the display screen.
  • the electronic device projects the obtained corrected 3D face model to obtain a 2D face image corresponding to the corrected 3D face model. Since the orientation of the face in the corrected 3D face model is parallel to the vertical line of the display screen, the orientation of the face in the obtained 2D face image is also parallel to the vertical line of the display screen, that is, the obtained The face of the face in the 2D face image is facing the display.
  • the electronic device takes the face image in the 2D face image as a target, and performs affine transformation on the face image in the first 2D image.
  • affine transformation may refer to geometrically transforming a vector space into another vector space by performing a linear transformation followed by a translation transformation.
  • the face image in the first 2D image is subjected to affine transformation, so that the face contour after the affine transformation can be compared with the corrected face profile.
  • the contours of the face in the image that is, the 2D face image
  • the other facial features images are close to the corrected image.
  • the electronic device generates a face mask of the 2D face image.
  • the mask can also be called a mask or a binarized mask.
  • the electronic device can set the pixel value of the pixel in the contour to 255 (appearing as white) according to the contour of the face in the 2D face image, and set the pixel value of the pixel outside the contour to 0 ( Appears as black) to obtain the face mask of the 2D face image.
  • the electronic device fuses the first 2D image after affine transformation with the 2D face image according to the mask of the face of the 2D face image to obtain a second 2D image, in which the face of the person is The orientation of the part is parallel to the vertical line of the display screen.
  • the electronic device After the electronic device obtains the 2D face image with the face facing the display screen, it can use the face image in the 2D face image as a target to compare the face face in the original 2D image (ie, the first 2D image).
  • the image undergoes affine transformation. It can also generate a face mask of a 2D face image.
  • the electronic device fuses the original 2D image after affine transformation and the 2D face image to obtain a 2D image with the face facing the display screen, namely
  • the above-mentioned second 2D image, the second 2D image may only include a face image.
  • the electronic device may also cover the second 2D image to the corresponding area of the original 2D image to obtain a 2D image including the background image.
  • the face correction method In the face correction method provided by the embodiment of the present application, after acquiring the original 2D image and the 3D face model, the 3D face in the obtained 3D face model is corrected and then reprojected to obtain the 2D face image.
  • the correction of the face orientation is realized.
  • the person in the video screen watched by the peer user will not look away, and will feel that there is eye contact between the person in the video screen and himself, making the communication more natural and improving communication efficiency.
  • this fusion method has a small amount of calculation and does not need to occupy a lot of resources.
  • FIG. 7 is a schematic flowchart of a face correction method provided by an embodiment of the application.
  • the electronic device is a Huawei laptop as an example. Please refer to Figure 2.
  • the camera adopts a hidden setting method, which is located on the keyboard and below the display screen. In other words, the orientation of the camera is different from the orientation of the display.
  • the camera is an ordinary 2D camera as an example. In this way, during a video conference after a user (such as user 1) uses a Huawei laptop to have a video chat with other users (such as user 2), if user 1 faces toward the display screen instead of the camera, user 2 will appear.
  • the embodiment of the present application provides a face correction method to perform face correction on the collected image.
  • the method may include:
  • the Huawei laptop obtains a first 2D image from the foregoing image sequence.
  • the orientation of the face in the first 2D image is not parallel to the vertical line of the display screen of the Huawei notebook computer, that is, the orientation of the face and face is not directly facing the display screen.
  • an image sequence can be collected through the camera of the Huawei laptop computer. If in the video process, user 1’s face is not facing the camera, but facing other places, such as facing the computer’s display screen, then there will be differences between the face’s face and the display screen in the image sequence collected by the camera.
  • the Huawei laptop can capture these images from the acquired image sequence, that is, obtain the first 2D image. For example, the first captured 2D image is shown in FIG. 8. It can be seen from FIG.
  • FIG. 8 that the face of user 1 in the first 2D image is not directly facing the display screen. It should be noted that FIG. 8 is only to reflect the relationship between the face orientation of the user 1 in the captured 2D image and the display screen. In actual video chats or video conferences, the image will not be displayed on the display screen.
  • the embodiment of the present application can implement 3D face reconstruction by performing the following S703-S704.
  • the Huawei laptop detects the first 2D image, and obtains the contour of the face and the position of the feature point.
  • the feature points may include feature points at the corresponding positions of the eyebrows, eyes, nose, and mouth of a human face.
  • the 2D image collected by the camera usually includes not only the human face, but also some background.
  • the Huawei notebook computer can use a face detection algorithm to remove the background area in the image to obtain an image including the facial skin of the human face.
  • the first 2D image is shown in FIG. 8.
  • the Huawei laptop can remove the background area in the image to obtain the first 2D image including the human face shown in (a) in FIG. 9 (this image may also be referred to as a headshot of a human face).
  • the Huawei laptop can use image processing technology and face detection algorithms to perform face detection on the first 2D image shown in (a) in FIG. 9.
  • the profile of the face in the first 2D image can be obtained by combining the 68 feature point distributions of the face shown in (b) in Figure 9, and the eyebrows, eyes, nose, and eyebrows in the face can be located.
  • the position of the feature point at the corresponding position of the mouth For example, the contours of the human face and the positions of the feature points in the acquired first 2D image are shown as the black dots in (c) in FIG. 9.
  • the background area may not be removed, but the 2D image including the background area collected by the camera may be directly detected to obtain the contours of the face and the positions of the feature points, which is not specifically limited in this embodiment.
  • the Huawei notebook computer performs face 3D reconstruction according to the contour of the face and the position of the feature points to obtain a 3D face model.
  • the orientation of the face in the 3D face model is the same as the orientation of the face relative to the camera when the camera of the Huawei notebook captures the first 2D image, that is, the orientation of the face in the 3D face model is not directly facing the display screen.
  • the line of sight in the 3D face model is not directly facing the display screen.
  • the detected contours of the face can be combined with The feature points at the corresponding positions of the eyebrows, eyes, nose, and mouth correspond one-to-one with the feature points in the known 3D face model (as shown in (d) in FIG. 9).
  • 3D reconstruction technology such as 3D Morphable Models (3DMM) technology, combined with facial expressions identified by facial features , Fitting the contour of the face shape, and calculating the face pose to obtain the above-mentioned 3D face model.
  • 3DMM 3D Morphable Models
  • the 3D face model may be as shown in (e) in FIG. 9, which corresponds to the first 2D image. As shown in Fig. 9(e), it can be seen that the orientation of the face in the 3D face model is not directly facing the display screen, and the direction of the line of sight is not facing the display screen.
  • the Huawei notebook computer performs face orientation correction on the 3D face in the 3D face model, and the orientation of the face in the corrected 3D face model is parallel to the vertical line of the display screen.
  • a Huawei notebook computer can obtain the angle between the orientation of the camera and the orientation of the display screen. According to the obtained angle between the orientation of the camera and the orientation of the display screen, the face orientation of the 3D face in the 3D face model can be corrected so that the orientation of the face in the corrected 3D face model is the same as
  • the vertical lines of the display screen are parallel, that is, the face of the face faces the display screen, that is, the purpose of face correction is achieved.
  • the camera is located below the display screen, and the angle between the direction of the camera and the direction of the display screen is 15 degrees.
  • the 3D face in the 3D face model as shown in Figure 10(a) Rotate down to correct 15 degrees.
  • the corrected 3D face model is shown in Figure 10(b). It can be seen that by correcting the orientation of the face, the face in the corrected 3D face model can be made to face the display screen. In addition, by correcting the direction of the face of the person, the direction of the user's line of sight can also be corrected.
  • the 2D face image is the image after face correction, that is, the 2D face image.
  • the orientation of the face in the face image is parallel to the vertical line of the display screen. In other words, the face of the face in the 2D face image is facing the display screen.
  • the above 2D face image can be obtained by executing the following S706-S707.
  • the Huawei notebook computer projects the corrected 3D face model to obtain a face projection image.
  • the corrected 3D face model shown in (a) in FIG. 11 can be projected to obtain the face projection image shown in (b) in FIG. 11.
  • the Huawei notebook computer adjusts the position of the face in the projection image of the face according to the direction of the angle of rotation of the 3D face when correcting the face orientation of the 3D face in the 3D face model to obtain a 2D face image.
  • the Huawei notebook computer can perform the rotation angle and direction when correcting the face orientation of the 3D face in the 3D face model in S705, and perform the correction of the face in the face projection image shown in (b) in Figure 11
  • the position is adjusted.
  • the Huawei notebook computer rotates the 3D face in the 3D face model downward by 15 degrees in the S705, and the Huawei notebook computer can be based on the size of the head of user 1 and the angle and direction of the rotation of the 3D face Estimate the distance and direction to move. Then, according to the estimated distance and direction, the position of the face in the face projection image shown in (a) of FIG. 12 is adjusted.
  • the position of the face in the face projection image shown in Figure 12 (a) can be moved downward, and the moving distance is equal to the estimated distance to obtain a 2D face image, as shown in Figure 12 (b) Show. In this way, the sight direction of the user 1 can be further corrected.
  • the Huawei laptop detects the 2D face image, and obtains the position of the control point of the 2D face image, the position of the feature point of the face and the contour of the face.
  • control point may include a feature point at at least one of the following locations: a feature point at a location corresponding to the forehead of a human face, and a feature point at a location corresponding to the human neck. Due to the single detection of facial contours and feature points at the corresponding positions of eyebrows, eyes, nose and mouth, the contour area obtained is limited. Therefore, in this embodiment, on the basis of these feature points, feature points at at least one of the forehead and neck can be further added to identify the contour area of the face to protect the original image (ie, the first 2D Image) When the face is deformed, the contour of the face will not change. For example, take the example of adding feature points at the corresponding position of the forehead of a human face.
  • the feature points at the corresponding positions of the forehead in the 2D face image shown in (b) in FIG. 12 may be as shown in (b) in FIG. 13.
  • the feature point at the corresponding position of the face chin is the feature point at the corresponding position of the 2D face image, and the contour of the face except the chin corresponding to the face
  • the feature point at the location is the feature point at the corresponding location of the first 2D image.
  • other feature points located at the edge of the face contour are replaced by the feature points at the corresponding positions of the first 2D image.
  • the Huawei laptop takes the face facial image in the 2D face image as a target, and performs affine transformation on the face facial image in the first 2D image.
  • the Huawei notebook computer can compare the position of the facial feature points of the 2D face image, the position of the control point, and the contour of the face in the 2D face image shown in Figure 13 (b).
  • the face image is divided into regions to obtain multiple first region blocks.
  • the face image in the first 2D image is regionalized Divide to obtain multiple second area blocks.
  • the plurality of first area blocks correspond to the plurality of second area blocks one to one.
  • the 2D face image shown in (b) in FIG. 13 may be triangular meshing. Division method.
  • a part of the first area block is shown. That is to say, after triangulating the face image of the 2D face image shown in Figure 13 (b), it can at least include the first area block shown in Figure 13 (d) 1', the first area block 2', the first area block 3', the first area block 4', the first area block 5', the first area block 6', the first area block 7'and other first area blocks.
  • a part of the second area block is shown.
  • the first 2D face facial image shown in Figure 13 (a) may at least include the second region block 1 shown in Figure 13 (c) , Second area block 2, second area block 3, second area block 4, second area block 5, second area block 6, second area block 7, and other second area blocks.
  • the first area block 1'corresponds to the second area block 1 the first area block 2'corresponds to the second area block 2
  • Affine transformation can refer to geometrically transforming a vector space into another vector space by performing a linear transformation and then a translation transformation.
  • Huawei laptops can target each first area block in the 2D face image, and perform affine transformation on each corresponding second area block in the first 2D image, so that each second area in the first 2D image Align with each first area in the 2D face image.
  • the second area block 1 can be affine transformed with the first area block 1'as the target, and the second area block 2'can be used as the target for the second area block 1'.
  • Area block 2 performs affine transformation, and so on, until all the area blocks are traversed.
  • the face contour after affine transformation can be made consistent with the face contour in the corrected image (ie 2D face image), other facial features images are close to the corrected image, and the original image (ie the first image) can be protected.
  • the contour of the face in the 2D image) makes the image of other areas except the inner area of the face and the chin in the original image without distortion.
  • the first 2D image is as shown in (b) in FIG. 14 Show.
  • the face image in the 2D face image can also be used as the target, and perspective transformation is performed on the face image in the first 2D image, which is not limited in this embodiment. .
  • the Huawei laptop fuses the first 2D image after the affine transformation and the 2D face image to obtain a second 2D image.
  • the orientation of the face is parallel to the vertical line of the display screen.
  • the Huawei notebook computer can establish a face mask of the 2D face image based on the position of the facial feature point of the 2D face image, the position of the control point, and the contour of the face. Then, according to the mask of the human face, the first 2D image after the affine transformation and the 2D human face image are seamlessly spliced and merged to obtain a fused human face image, such as a second 2D image. In this way, it is possible to reduce the difficulty of seamless splicing and fusion processing caused by obvious changes in the edge texture or illumination of the face. In addition, you can first perform corrosion optimization processing on the facial mask of the generated 2D face image to reduce the mask area of the face, and then use the facial mask after the corrosion optimization to perform the image processing. Seamless splicing and fusion.
  • a Huawei laptop can set the pixel value of the pixel in the contour of the face of the 2D face image to 255 based on the contour of the face of the 2D face image, and set the value of the 2D face image
  • the pixel value of the pixel outside the contour is set to 0 to obtain the face mask of the 2D face image (or called the binarization mask).
  • the face mask of the generated 2D face image is shown in (a) in FIG. 15.
  • the mask can be corroded. Corrosion treatment is a process of eliminating boundary points and shrinking the boundary to the inside. In this way, a reduced face mask can be obtained after the etching process, as shown in (b) in Figure 15.
  • the Huawei laptop can use the face mask shown in Figure 15 (b) to convert the first 2D image shown in Figure 16 (a) after affine transformation and
  • the 2D face image shown in (b) in FIG. 16 is seamlessly spliced and fused to obtain the fused face image shown in (c) in FIG. 16, which is called a second 2D image.
  • the Laplace pyramid fusion algorithm can be used to perform affine transformation on the first 2D image and the 2D face.
  • the images are seamlessly stitched and merged.
  • the Poisson fusion algorithm can be used to seamlessly merge and merge the first 2D image and the 2D face image after the affine transformation.
  • other fusion algorithms can also be used for image fusion, and the embodiment of the present application does not specifically limit it here.
  • the Huawei laptop computer uses the second 2D image to cover the image in the area corresponding to the first 2D image to generate a corrected image.
  • the Huawei laptop can copy the second 2D image to the original 2D image, that is, the corresponding area of the first 2D image, to obtain a corrected image, which includes a background image and a face image.
  • a corrected image which includes a background image and a face image.
  • the Huawei laptop can send the image to user 2's electronic device. If user 2 uses a desktop computer to make a video with user 1, then the video screen watched by user 2 can be as shown in FIG. 18. It can be seen that in the video screen that user 2 sees at this time, user 1 looks at him and makes eye contact with him.
  • the desktop computer used by user 2 also has at least one of the following relationships between the camera and the display: there is a distance between the camera and the display, and the orientation of the camera is different from the orientation of the display, the desktop computer can also Correct the images in the captured image sequence including user 2 whose face orientation and the display screen are not directly opposite, and then send the corrected image sequence to user 1’s Huawei laptop so that user 1 can see the video screen User 2 looks at himself and makes eye contact with himself, making communication more natural and efficient.
  • the face correction method provided by the embodiment of the present application performs 3D face reconstruction on the original 2D image, corrects the 3D face in the obtained 3D face model, and reprojects the 2D face image to obtain the 2D face image.
  • the correction of the face orientation is realized.
  • the person in the video screen watched by the peer user will not look away, and will feel that there is eye contact between the person in the video screen and himself, making the communication more natural and improving the communication efficiency.
  • this fusion method has a small amount of calculation and does not need to occupy a lot of resources.
  • the method of this embodiment can effectively protect the contour of the human face, and can also effectively protect the background information.
  • the electronic device includes hardware structures and/or software modules corresponding to each function.
  • the present application can be implemented in the form of hardware or a combination of hardware and computer software. Whether a certain function is executed by hardware or computer software-driven hardware depends on the specific application and design constraint conditions of the technical solution. Professionals and technicians can use different methods for each specific application to implement the described functions, but such implementation should not be considered beyond the scope of this application.
  • the embodiment of the present application may divide the electronic device into functional modules according to the foregoing method examples.
  • each functional module may be divided corresponding to each function, or two or more functions may be integrated into one processing module.
  • the above-mentioned integrated modules can be implemented in the form of hardware or software functional modules. It should be noted that the division of modules in the embodiments of the present application is illustrative, and is only a logical function division, and there may be other division methods in actual implementation.
  • FIG. 19 is a schematic diagram of the composition of an electronic device provided by an embodiment of the application.
  • the electronic device may include: an acquisition unit 1901, a correction unit 1902, a projection unit 1903, a transformation unit 1904, a generation unit 1905, and a fusion unit 1906.
  • the acquiring unit 1901 is configured to acquire a first 2D image in which the orientation of the human face is not parallel to the vertical line of the display screen of the electronic device.
  • the acquiring unit 1901 is also configured to acquire a 3D face model, where the orientation of the face in the 3D face model is the same as the orientation of the user's face relative to the camera when the camera captures the first 2D image.
  • the correction unit 1902 is configured to perform face orientation correction on the 3D face in the 3D face model obtained by the acquiring unit 1901, and the face orientation in the corrected 3D face model is parallel to the vertical line of the display screen.
  • the projection unit 1903 is configured to project the 3D face model corrected by the correction unit 1902 to obtain a 2D face image in which the orientation of the face face is parallel to the vertical line of the display screen.
  • the transformation unit 1904 is configured to take the face image in the 2D face image obtained by the projection unit 1903 as a target, and perform affine transformation on the face image in the first 2D image obtained by the obtaining unit 1901.
  • the generating unit 1905 is configured to generate a face mask of the 2D face image obtained by the projection unit 1903.
  • the fusion unit 1906 is configured to fuse the first 2D image after affine transformation performed by the transformation unit 1904 and the 2D face image obtained by the projection unit 1903 according to the face mask of the 2D face image generated by the generation unit 1905, A second 2D image is obtained, in which the orientation of the human face is parallel to the vertical line of the display screen.
  • the electronic device may include the aforementioned camera, and at least one of the following relationships exists between the camera and the display screen: the orientation of the camera is different from the orientation of the display screen of the electronic device, and there is a distance between the camera and the display screen.
  • the acquiring unit 1901 is specifically configured to acquire an image sequence through a camera, and the image sequence includes the first 2D image.
  • the aforementioned camera may be a 2D camera; the acquiring unit 1901 acquires a 3D face model, which is specifically used to: perform 3D face reconstruction according to the first 2D image to obtain a 3D face model. At this time, the unit can be called a reconstruction unit.
  • the obtaining unit 1901 performs 3D reconstruction of the face according to the first 2D image, and obtains the 3D face model specifically for: detecting the first 2D image, obtaining the contour of the face and the position of the feature point, the feature point includes Feature points at the corresponding positions of the eyebrows, eyes, nose and mouth of the face; 3D reconstruction of the face is performed according to the contour of the face and the position of the feature points to obtain a 3D face model.
  • correction unit 1902 is specifically configured to: obtain the angle between the orientation of the camera and the orientation of the display screen; perform face orientation correction on the 3D face in the 3D face model according to the angle between the orientation of the camera and the orientation of the display screen .
  • the projection unit 1903 is specifically used for: projecting the corrected 3D face model to obtain a face projection image; according to the angle and direction of the 3D face rotation when correcting the face orientation of the 3D face in the 3D face model , To adjust the face position in the face projection image to obtain a 2D face image.
  • the electronic device may further include a detection unit for detecting the 2D face image, and acquiring the position of the control point of the 2D face image, the position of the feature point of the face and the contour of the face.
  • the control points include the feature points at at least one of the following positions: the feature point at the corresponding position of the forehead of the human face, the control point at the corresponding position of the human neck; in the contour of the human face, the corresponding position of the chin of the human face.
  • the feature point of is the feature point at the corresponding position of the 2D face image
  • the feature point at the corresponding position of the chin of the face in the contour of the face is the feature point at the corresponding position of the first 2D image.
  • the transformation unit 1904 is specifically configured to: according to the position of the facial feature points of the 2D face image, the position of the control point, and the contour of the face, the face image in the 2D face image is divided into regions, Obtain a plurality of first region blocks; according to the position of the facial feature point of the first 2D image, the position of the control point, and the contour of the face, the facial image in the first 2D image is divided into regions, Obtain multiple second area blocks, multiple first area blocks correspond to multiple second area blocks one-to-one, the position of the control point of the first 2D image is obtained by detecting the first 2D image; take the 2D face image Each first area block in is the target, and each corresponding second area block in the first 2D image is subjected to affine transformation.
  • the above-mentioned generating unit 1905 is also used to perform corrosion processing on the face mask of the 2D face image.
  • the fusion unit 1906 is specifically configured to fuse the first 2D image after affine transformation and the 2D face image according to the face mask of the 2D face image after the erosion process to obtain the second 2D image.
  • the generating unit 1905 is further configured to cover the image in the region corresponding to the first 2D image with the second 2D image to generate a corrected image.
  • the electronic device may include: a display screen; one or more processors; a memory; a camera (such as a 2D camera). The orientation of the display and the camera are different, and/or there is a distance between the display and the camera.
  • the above devices can be connected through one or more communication buses.
  • One or more computer program codes are stored in the foregoing memory, and the one or more computer program codes include computer instructions.
  • One or more processors are used to execute the computer instructions and can be used to implement the embodiment shown in FIG. 6 or FIG. Behavioral functions of electronic devices in the middle.
  • the display screen can be used to display content according to instructions from one or more processors, such as displaying images during a video conference or video chat.
  • FIG. 6 or FIG. 7 shows the various steps performed by the electronic device in the embodiment.
  • FIG. 6 Another embodiments of the present application also provide a computer program product, which when the computer program product runs on a computer, causes the computer to execute each step performed by the electronic device in the embodiment shown in FIG. 6 or FIG. 7.
  • the electronic device includes a display screen and a camera (such as a 2D camera). Moreover, the orientation of the display screen and the orientation of the camera are different, and/or there is a distance between the display screen and the camera.
  • the chip system includes an interface circuit and a processor; the interface circuit and the processor are interconnected by wires; the interface circuit is used to receive signals from the memory of the electronic device and send signals to the processor.
  • the signals include computer instructions stored in the memory; when the processor executes When the computer is instructed, the chip system executes each step performed by the electronic device in the embodiment shown in FIG. 6 or FIG. 7.
  • the electronic device, computer readable storage medium, computer program product, and chip system provided by the embodiments of the present application can execute the actions of the electronic device in the method embodiment corresponding to FIG. 6 or FIG. 7, and the implementation principles and technical effects are similar. No longer.
  • the disclosed device and method may be implemented in other ways.
  • the device embodiments described above are merely illustrative.
  • the division of the modules or units is only a logical function division.
  • there may be other division methods for example, multiple units or components may be It can be combined or integrated into another device, or some features can be omitted or not implemented.
  • the displayed or discussed mutual coupling or direct coupling or communication connection may be indirect coupling or communication connection through some interfaces, devices or units, and may be in electrical, mechanical or other forms.
  • the units described as separate parts may or may not be physically separate.
  • the parts displayed as units may be one physical unit or multiple physical units, that is, they may be located in one place, or they may be distributed to multiple different places. . Some or all of the units may be selected according to actual needs to achieve the objectives of the solutions of the embodiments.
  • each unit in each embodiment of the present application may be integrated into one processing unit, or each unit may exist alone physically, or two or more units may be integrated into one unit.
  • the above-mentioned integrated unit can be implemented in the form of hardware or software functional unit.
  • the integrated unit is implemented in the form of a software functional unit and sold or used as an independent product, it can be stored in a readable storage medium.
  • the technical solutions of the embodiments of the present application are essentially or the part that contributes to the prior art, or all or part of the technical solutions can be embodied in the form of software products, which are stored in a storage medium.
  • a device which may be a single-chip microcomputer, a chip, etc.
  • a processor processor
  • the aforementioned storage media include: U disk, mobile hard disk, read-only memory (Read-Only Memory, ROM), random access memory (Random Access Memory, RAM), magnetic disk or optical disk and other media that can store program code .

Landscapes

  • Physics & Mathematics (AREA)
  • Engineering & Computer Science (AREA)
  • General Physics & Mathematics (AREA)
  • Theoretical Computer Science (AREA)
  • Computer Graphics (AREA)
  • Geometry (AREA)
  • Software Systems (AREA)
  • Image Processing (AREA)
  • Controls And Circuits For Display Device (AREA)
  • Image Analysis (AREA)

Abstract

一种人脸校正方法及电子设备,涉及图像处理领域,使得视频时沟通更自然,提高了沟通效率。具体为:获取原2D图像和3D人脸模型,原2D图像和3D人脸模型中人脸面部并未正对显示屏;对3D人脸模型中的3D人脸进行面部朝向校正,校正后的3D人脸模型中人脸面部正对显示屏;对校正后的3D人脸模型进行投影获得2D人脸图像;以该2D人脸图像中的人脸面部图像为目标,对原2D图像中的人脸面部图像进行仿射变换;根据2D人脸图像的人脸面部的掩码,将进行仿射变换后的原2D图像和2D人脸图像进行融合获得人脸面部正对显示屏的2D图像。

Description

一种人脸校正方法及电子设备
本申请要求在2019年6月14日提交中国国家知识产权局、申请号为201910514753.7的中国专利申请的优先权,发明名称为“一种人脸校正方法及电子设备”的中国专利申请的优先权,其全部内容通过引用结合在本申请中。
技术领域
本申请涉及图像处理领域,尤其涉及一种人脸校正方法及电子设备。
背景技术
随着移动互联网的发展,视频会议和视频聊天的应用越来越广泛。在进行视频会议或视频聊天的过程中,如果视频双方能够进行眼神交互,则能给视频参与者带来良好的交流体验。一般而言,在进行视频会议或视频聊天时,只有在视频参与者的面部和视线朝向摄像头时,对方才会觉得视频画面中的人与自己存在眼神交互。如果视频参与者面部或视线朝向的是显示屏,而不是摄像头,则对方会觉得该视频参与者眼睛看向别处,与自己并没有眼神交流。
例如,如图1所示,用户1利用台式电脑与用户2进行视频会议。该台式电脑的显示屏与摄像头之间存在一定的角度和距离。又例如,如图2所示,用户1利用华为笔记本电脑与用户2进行视频聊天。华为笔记本电脑的摄像头为隐藏式设计,位于显示屏的下方(图2中仅是为了示意出摄像头的位置,不表示摄像头的实际设置方式)。结合图1或图2,在用户1与用户2视频的过程中,如果用户1看向显示屏,也即其面部或视线并未朝向摄像头,那么该摄像头采集到的视频画面中用户1的面部或视线朝向并未正对显示屏。这样,用户2在视频画面中会看到用户1看向别处。例如,如图3所示,用户2看到的视频画面中,用户1的面部朝上,眼睛向上看,与自己并没有进行眼神交流。这会导致沟通不自然,降低沟通效率。
发明内容
本申请实施例提供一种人脸校正方法及电子设备,解决了在显示屏与摄像头之间存在一定的角度或距离时,如果用户未看向摄像头而是看向显示屏,使得对方看到的视频画面中人看向别处,与自己没有眼神交流,导致沟通不自然,沟通效率低下的问题。
为了达到上述目的,本申请实施例采用如下技术方案:
第一方面,本申请实施例提供一种人脸校正方法,该方法可以包括:电子设备获取第一2D图像,该第一2D图像中的人脸面部的朝向与电子设备的显示屏的垂线不平行,即第一2D图像中的人脸面部并未正对电子设备的显示屏;电子设备获取3D人脸模型,该3D人脸模型中人脸面部的朝向与摄像头捕获第一2D图像时用户人脸相对于摄像头的朝向相同,该3D人脸模型中人脸面部也并未正对显示屏;电子设备对3D人脸模型中的3D人脸进行面部朝向校正,校正后的3D人脸模型中人脸面部的朝向与显示屏的垂线平行,也就是说,校正后的3D人脸模型中人脸面部正对显示屏;电子设备对校正后的3D人脸模型进行投影,获得2D人脸图像,该2D人脸图像中人脸面部的朝向与显示屏的垂线平行,即该2D人脸图像中人脸面部针正对显示屏;电子设备以2D人脸图像中的人脸面部图像为目标,对第一2D图像中的人脸面部图像进行仿射变换(或透视变换);电子设备生成2D人脸图像的人脸面部的掩码(mask);电子设备根据2D人脸图像的人脸面 部的mask,将进行仿射变换后的第一2D图像和2D人脸图像进行融合,获得第二2D图像,该第二2D图像中人脸面部的朝向与显示屏的垂线平行,即该第二2D图像中人脸面部正对显示屏。
本申请实施例提供的人脸校正方法,获取原2D图像和3D人脸模型,通过对3D人脸模型中的3D人脸进行校正后重新投影得到2D人脸图像。另外,通过对原2D图像进行人脸仿射变换(或透视变换),并基于人脸掩码对进行仿射变换后的原2D图像和2D人脸图像进行无缝融合,实现了对人脸朝向的校正。使得对端用户观看到的视频画面中的人不会看向别处,会觉得视频画面中的人与自己存在眼神交流,使得沟通更自然,提高沟通效率。且这种融合方法计算量小,无需占用很多资源。
结合第一方面,在一种可能的实现方式中,上述电子设备还可包括上述摄像头,该摄像头和显示屏之间存在以下至少一种关系:该摄像头的朝向与电子设备的显示屏的朝向不同,摄像头与显示屏之间存在距离;上述电子设备获取第一2D图像,可以包括:电子设备通过摄像头采集图像序列,该图像序列中包括第一2D图像。在用户利用电子设备与其他用户视频时,对于摄像头采集到的图像序列中,用户面部朝向不是正对显示屏的2D图像可以通过本实施例提供的方法进行人脸校正或视线校正,还可同时进行人脸和视线的校正,使得沟通更自然。
结合第一方面或上述可能的实现方式,在另一种可能的实现方式中,上述摄像头可以为2D摄像头;电子设备获取3D人脸模型,具体的可以包括:电子设备根据第一2D图像进行人脸3D重建,获得3D人脸模型。如果上述摄像头是3D摄像头,则可直接通过3D摄像头获取3D人脸模型。如果上述摄像头是2D摄像头,则可以根据摄像头捕获的2D图像进行人脸3D重建,获得3D人脸模型。
结合第一方面或上述可能的实现方式,在另一种可能的实现方式中,上述电子设备根据第一2D图像进行人脸3D重建,获得3D人脸模型,具体的可以包括:电子设备对第一2D图像进行检测,获取人脸面部的轮廓和特征点的位置,该特征点可以包括人脸的眉毛,眼睛,鼻子及嘴巴对应位置处的特征点;电子设备根据人脸面部的轮廓和特征点的位置进行人脸3D重建,获得3D人脸模型。通过对第一2D图像进行人脸检测,可获得人脸面部的轮廓和特征点的位置。根据人脸面部轮廓和特征点可实现人脸3D重建,获得3D人脸模型。
结合第一方面或上述可能的实现方式,在另一种可能的实现方式中,上述电子设备对3D人脸模型中的3D人脸进行面部朝向校正,具体的可以包括:电子设备获取摄像头的朝向与显示屏的朝向的夹角;电子设备根据摄像头的朝向与显示屏的朝向的夹角,对3D人脸模型中的3D人脸进行面部朝向校正。根据摄像头与显示屏的朝向的夹角对3D人脸模型中的3D人脸的面部朝向进行校正,可使得校正后的3D人脸模型中的3D人脸正对显示屏。
结合第一方面或上述可能的实现方式,在另一种可能的实现方式中,上述电子设备对校正后的3D人脸模型进行投影,获得2D人脸图像,具体的可以包括:电子设备对校正后的3D人脸模型进行投影,获得人脸投影图像;电子设备根据校正3D人脸模型中3D人脸的面部朝向时对3D人脸旋转的角度和方向,对人脸投影图像的中的人脸位置进行调整,获得2D人脸图像。通过对获得的人脸投影图像中人脸位置的调制,可进一步的对用户的视线朝向进行校正,使得沟通更自然,进一步的提高沟通效率。
结合第一方面或上述可能的实现方式,在另一种可能的实现方式中,在上述获得2D 人脸图像之后,该方法还可以包括:电子设备对2D人脸图像进行检测,获取2D人脸图像的控制点的位置,人脸面部的特征点的位置以及人脸面部的轮廓;其中,控制点可以包括以下至少一个位置处的特征点:人脸的额头对应位置处的特征点,人的颈部对应位置处的特征点;在人脸面部的轮廓中,人脸下巴对应位置处的特征点是2D人脸图像对应位置处的特征点,人脸面部的轮廓中除人脸下巴对应位置处的特征点是第一2D图像对应位置处的特征点;另外,对上述第一2D图像的检测时,也可以获得第一2D图像的特征点的位置;电子设备以2D人脸图像中的人脸面部图像为目标,对第一2D图像中的人脸面部图像进行仿射变换,具体的可以包括:电子设备根据2D人脸图像的人脸面部的特征点的位置,控制点的位置,以及人脸面部的轮廓,对2D人脸图像中的人脸面部图像进行区域划分,得到多个第一区域块;电子设备根据第一2D图像的人脸面部的特征点的位置,控制点的位置,以及人脸面部的轮廓,对第一2D图像中的人脸面部图像进行区域划分,得到多个第二区域块;其中,多个第一区域块与多个第二区域块一一对应,第一2D图像的控制点的位置是对第一2D图像进行检测得到的;电子设备以2D人脸图像中每个第一区域块为目标,对第一2D图像中对应的每个第二区域块进行仿射变换。由于单检测人脸轮廓和眉毛、眼睛、鼻子及嘴巴对应位置处的特征点,获得的轮廓区域有限。通过在这些特征点的基础上,进一步的增加额头和颈部中至少一个位置处的特征点,用于识别人脸轮廓区域,以保护第一2D图像在人脸变形(如上述仿射变换)时人脸轮廓不会变化。
结合第一方面或上述可能的实现方式,在另一种可能的实现方式中,在上述生成2D人脸图像的人脸面部的掩码之后,该方法还可以包括:电子设备对2D人脸图像的人脸面部的mask进行腐蚀处理;上述电子设备根据2D人脸图像的人脸面部的mask,将进行仿射变换后的第一2D图像和2D人脸图像进行融合,获得第二2D图像,具体的可以包括:电子设备根据腐蚀处理后的2D人脸图像的人脸面部的mask,将进行仿射变换后的第一2D图像和2D人脸图像进行融合,获得第二2D图像。可以通过对生成的2D人脸图像的人脸面部的掩码进行腐蚀优化处理,以缩小人脸面部的掩码面积,然后,再利用进行腐蚀优化后的人脸面部掩码进行图像的无缝拼接融合。
结合第一方面或上述可能的实现方式,在另一种可能的实现方式中,在上述获得第二2D图像后,该方法还可以包括:电子设备用第二2D图像覆盖第一2D图像对应区域中的图像,生成校正后的图像。这样,可以较真实的保护背景信息。
第二方面,本申请实施例提供一种电子设备,该电子设备可以包括:处理器,存储器和显示屏;处理器,存储器以及显示屏耦合,存储器可用于存储计算机程序代码,计算机程序代码包括计算机指令,当计算机指令被电子设备执行时,使得电子设备执行如下操作:获取第一2D图像,该第一2D图像中的人脸面部的朝向与显示屏的垂线不平行;获取3D人脸模型,该3D人脸模型中人脸面部的朝向与摄像头捕获第一2D图像时用户人脸相对于摄像头的朝向相同;对3D人脸模型中的3D人脸进行面部朝向校正,校正后的3D人脸模型中人脸面部的朝向与显示屏的垂线平行;对校正后的3D人脸模型进行投影,获得2D人脸图像,2D人脸图像中人脸面部的朝向与显示屏的垂线平行;以2D人脸图像中的人脸面部图像为目标,对第一2D图像中的人脸面部图像进行仿射变换;生成2D人脸图像的人脸面部的掩码(mask);根据2D人脸图像的人脸面部的mask,将进行仿射变换后的第一2D图像和2D人脸图像进行融合,获得第二2D图像,第二2D图像中人脸面部的朝向与显示屏的垂线平行。
结合第二方面,在一种可能的实现方式中,电子设备还可包括上述摄像头,摄像头 和显示屏之间存在以下至少一种关系:摄像头的朝向与显示屏的朝向不同,摄像头与显示屏之间存在距离;上述获取第一2D图像,具体可以为:通过摄像头采集图像序列,图像序列中包括第一2D图像。
结合第二方面或上述可能的实现方式,在另一种可能的实现方式中,上述摄像头可以为2D摄像头;上述获取3D人脸模型,具体可以为:根据第一2D图像进行人脸3D重建,获得3D人脸模型。
结合第二方面或上述可能的实现方式,在另一种可能的实现方式中,上述根据第一2D图像进行人脸3D重建,获得3D人脸模型,具体可以为:对第一2D图像进行检测,获取人脸面部的轮廓和特征点的位置,特征点包括人脸的眉毛,眼睛,鼻子及嘴巴对应位置处的特征点;根据人脸面部的轮廓和特征点的位置进行人脸3D重建,获得3D人脸模型。
结合第二方面或上述可能的实现方式,在另一种可能的实现方式中,上述对3D人脸模型中的3D人脸进行面部朝向校正,具体可以为:获取摄像头的朝向与显示屏的朝向的夹角;根据摄像头的朝向与显示屏的朝向的夹角,对3D人脸模型中的3D人脸进行面部朝向校正。
结合第二方面或上述可能的实现方式,在另一种可能的实现方式中,上述对校正后的3D人脸模型进行投影,获得2D人脸图像,具体可以为:对校正后的3D人脸模型进行投影,获得人脸投影图像;根据校正3D人脸模型中3D人脸的面部朝向时对3D人脸旋转的角度和方向,对人脸投影图像的中的人脸位置进行调整,获得2D人脸图像。
结合第二方面或上述可能的实现方式,在另一种可能的实现方式中,当计算机指令被电子设备执行时,还使得电子设备执行如下操作:对2D人脸图像进行检测,获取2D人脸图像的控制点的位置,人脸面部的特征点的位置以及人脸面部的轮廓;其中,控制点可以包括以下至少一个位置处的特征点:人脸的额头对应位置处的特征点,人的颈部对应位置处的特征点;在人脸面部的轮廓中,人脸下巴对应位置处的特征点是2D人脸图像对应位置处的特征点,人脸面部的轮廓中除人脸下巴对应位置处的特征点是第一2D图像对应位置处的特征点;上述以2D人脸图像中的人脸面部图像为目标,对第一2D图像中的人脸面部图像进行仿射变换,具体可以为:根据2D人脸图像的人脸面部的特征点的位置,控制点的位置,以及人脸面部的轮廓,对2D人脸图像中的人脸面部图像进行区域划分,得到多个第一区域块;根据第一2D图像的人脸面部的特征点的位置,控制点的位置,以及人脸面部的轮廓,对第一2D图像中的人脸面部图像进行区域划分,得到多个第二区域块,多个第一区域块与多个第二区域块一一对应,第一2D图像的控制点的位置是对第一2D图像进行检测得到的;以2D人脸图像中每个第一区域块为目标,对第一2D图像中对应的每个第二区域块进行仿射变换。
结合第二方面或上述可能的实现方式,在另一种可能的实现方式中,当计算机指令被电子设备执行时,还使得电子设备执行如下操作:对2D人脸图像的人脸面部的mask进行腐蚀处理;上述根据2D人脸图像的人脸面部的mask,将进行仿射变换后的第一2D图像和2D人脸图像进行融合,获得第二2D图像,具体可以为:根据腐蚀处理后的2D人脸图像的人脸面部的mask,将进行仿射变换后的第一2D图像和2D人脸图像进行融合,获得第二2D图像。
结合第二方面或上述可能的实现方式,在另一种可能的实现方式中,当计算机指令被电子设备执行时,还使得电子设备执行如下操作:用第二2D图像覆盖第一2D图像对 应区域中的图像,生成校正后的图像。
第三方面,本申请实施例提供一种计算机可读存储介质,该计算机可读存储介质可以包括:计算机软件指令;当计算机软件指令在电子设备中运行时,使得该电子设备执行如第一方面或第一方面的可能实现方式中任一项所述的人脸校正方法。
第四方面,本申请实施例提供一种计算机程序产品,当该计算机程序产品在计算机上运行时,使得该计算机执行如权利要求第一方面或第一方面的可能的实现方式中任一项所述的人脸校正方法。
第五方面,本申请实施例提供一种芯片系统,该芯片系统应用于电子设备;芯片系统包括接口电路和处理器;接口电路和处理器通过线路互联;接口电路用于从电子设备的存储器接收信号,并向处理器发送信号,信号包括存储器中存储的计算机指令;当处理器执行该计算机指令时,芯片系统执行如第一方面或第一方面的可能的实现方式中任一项所述的人脸校正方法。
第六方面,本申请实施例提供一种装置,该装置具有实现上述第一方面的方法中电子设备行为的功能。功能可以通过硬件实现,也可以通过硬件执行相应的软件实现。硬件或软件包括一个或多个与上述功能相对应的模块,例如,获取单元或模块,校正单元或模块,投影单元或模块,变换单元或模块,生成单元或模块,融合单元或模块等。
第七方面,本申请实施例提供一种图形用户界面(graphical user interface,GUI),该图形用户界面存储在电子设备中,该电子设备包括显示器、存储器、一个或多个处理器;一个或多个处理器用于执行存储在存储器中的一个或多个计算机程序,该图形用户界面包括:显示在所述显示器上的GUI,该GUI包括视频画面,该视频画面中包括第一用户的人脸,该第一用户的人脸朝向正对显示屏,该视频画面是其他电子设备(如称为第二电子设备)传输给该电子设备的,第二电子设备包括显示屏和摄像头,且第二电子设备的显示屏和摄像头之间存在以下至少一种关系:摄像头的朝向与显示屏的朝向不同,摄像头与显示屏之间存在距离。
应当理解的是,本申请中对技术特征、技术方案、有益效果或类似语言的描述并不是暗示在任意的单个实施例中可以实现所有的特点和优点。相反,可以理解的是对于特征或有益效果的描述意味着在至少一个实施例中包括特定的技术特征、技术方案或有益效果。因此,本说明书中对于技术特征、技术方案或有益效果的描述并不一定是指相同的实施例。进而,还可以任何适当的方式组合本实施例中所描述的技术特征、技术方案和有益效果。本领域技术人员将会理解,无需特定实施例的一个或多个特定的技术特征、技术方案或有益效果即可实现实施例。在其他实施例中,还可在没有体现所有实施例的特定实施例中识别出额外的技术特征和有益效果。
附图说明
图1为本申请实施例提供的一种视频场景示意图;
图2为本申请实施例提供的另一种视频场景示意图;
图3为现有技术提供的一种视频画面示意图;
图4为本申请实施例提供的一种系统架构的组成示意图;
图5为本申请实施例提供的一种电子设备的结构示意图;
图6为本申请实施例提供的一种人脸校正方法的流程示意图;
图7为本申请实施例提供的另一种人脸校正方法的流程示意图;
图8为本申请实施例提供的一种视频画面示意图;
图9为本申请实施例提供的一种图像的处理示意图;
图10为本申请实施例提供的另一种图像的处理示意图;
图11为本申请实施例提供的又一种图像的处理示意图;
图12为本申请实施例提供的又一种图像的处理示意图;
图13为本申请实施例提供的又一种图像的处理示意图;
图14为本申请实施例提供的又一种图像的处理示意图;
图15为本申请实施例提供的又一种图像的处理示意图;
图16为本申请实施例提供的又一种图像的处理示意图;
图17为本申请实施例提供的又一种图像的处理示意图;
图18为本申请实施例提供的另一种视频画面示意图;
图19为本申请实施例提供的一种电子设备的组成示意图。
具体实施方式
为了解决在显示屏与摄像头之间存在一定的角度或距离时,如果用户未看向摄像头而是看向显示屏,使得对方看到的视频画面中人看向别处,与自己没有眼神交流,导致沟通不自然,沟通效率低下的问题。现有技术提出了两种方案,以对视频画面中用户的面部朝向和视线朝向进行校正。
方案1:通过给设备配置三维(three dimensions,3D)摄像头。在用户视频过程中,该设备利用3D摄像头采集用户的3D模型和二维(two dimension,2D)图像(可将3D摄像头采集到的2D图像称为原2D图像)。然后,对3D模型中的3D人脸进行面部朝向和视线朝向的校正,将校正后的3D模型进行投影得到校正后的2D图像。提取校正后的2D图像中的人脸边缘轮廓。最后,根据提取的人脸边缘轮廓,将校正后的2D图像与原2D图像通过能量迭代优化方式进行无缝融合,以得到面部和视线朝向正对显示屏的2D图像。
方案2:在用户视频过程中,基于设备的2D摄像头采集的2D图像(如称为原2D图像),对原2D图像中人体的头部和颈部进行3D重建,建立3D头部和颈部模型。对3D头部和颈部模型中的3D人脸进行面部朝向和视线朝向的校正,将校正后的3D头部和颈部模型进行投影得到校正后的2D图像,并提取该图像中人脸边缘轮廓。最后,也可以根据提取的人脸边缘轮廓,将校正后的2D图像与原2D图像通过能量迭代优化方式进行无缝融合,得到面部和视线朝向正对显示屏的2D图像。
通过上述方案1或方案2的处理,将最终处理得到的2D图像发送视频对端的设备,对方看到的视频画面中则不会出现视频画面中的人与自己没有进行眼神交流的现象。但是,上述方案1和方案2均是通过能量迭代优化的方式进行图像的无缝融合的,而这种方式的计算量较大,需要占用较多资源。
本申请实施例提供一种人脸校正方法,该方法可以应用于电子设备。在本实施例提供的方法中,电子设备可以获取原2D图像和3D人脸模型。该原2D图像中的人脸面部朝向不是正对电子设备的显示屏的。3D人脸模型中人脸面部朝向也不是正对显示屏的。电子设备可以对该3D人脸模型中的3D人脸进行面部朝向校正,使得校正后的3D人脸模型中人脸面部的朝向正对显示屏。然后对校正后的3D人脸模型进行投影,以获得2D人脸图像。由于校正后的3D人脸模型中人脸面部的朝向正对显示屏,因此投影得到的2D人脸图像中脸面部的朝向也是正对显示屏的。然后,电子设备可以以该2D人脸图像中的人脸面部图像为目标,对原2D图像中的人脸面部图像进行仿射变换,并生成2D人脸图像 的人脸面部掩码(mask)。最后,根据该2D人脸图像的人脸面部的mask,将进行仿射变换后的原2D图像和2D人脸图像进行融合,以获得人脸面部的朝向正对显示屏的2D图像。
这样,在获取到原2D图像和3D人脸模型后,通过对得到的3D人脸模型中的3D人脸进行校正后重新投影得到2D人脸图像。另外,通过对原2D图像进行人脸仿射变换,并基于人脸掩码对进行仿射变换后的原2D图像和2D人脸图像进行无缝融合,实现了对人脸朝向的校正。使得对端用户观看到的视频画面中的人不会看向别处,觉得视频画面中的人与自己存在眼神交流,使得沟通更自然,提高沟通效率。且这种融合方法计算量小,无需占用很多资源。
下面将结合附图对本申请实施例的实施方式进行详细描述。
图4为本申请实施例提供的一种可以应用上述人脸校正方法的系统架构示意图。如图4所示,该系统架构可以包括至少两个电子设备:例如,第一电子设备401和第二电子设备402。
第一电子设备401可以作为通话的一端,与第二电子设备402进行通话。例如,一个或多个用户1可通过第一电子设备401与第二电子设备402的一个或多个用户2进行通话。
其中,本实施例中的通话可以是指视频通话,或视频会议。因此,第一电子设备401至少包括摄像头和显示屏,第二电子设备402也至少包括摄像头和显示屏。另外,第一电子设备401和第二电子设备402还可以包括听筒(或喇叭),话筒等。摄像头可用于采集通话过程中的图像序列。显示屏可用于显示通话过程中的图像,如通话对端设备发送的图像序列,自身采集到的图像序列。听筒(或喇叭)用于播放通话过程中的语音。话筒用于采集通话过程中的语音。当然,第一电子设备401或第二电子设备402也可以不包括摄像头,而是连接有摄像头。
需要说明的是,在本申请实施例中,第一电子设备401和第二电子设备402中至少存在一个电子设备的摄像头和显示屏之间存在以下至少一种关系:摄像头的朝向与显示屏的朝向不同,摄像头与显示屏之间存在距离。也就是说,至少存在一个电子设备采集到的图像序列中包括人脸面部朝向不是正对其显示屏的2D图像。该电子设备的摄像头可以是2D摄像头,也可以是3D摄像头。
例如,第一电子设备401的摄像头的朝向与其包括的显示屏的朝向不同,且其摄像头与其显示屏之间存在距离。那么,第一电子设备401采集到的图像序列中会包含人脸面部朝向不是正对显示屏的2D图像。在本实施例中,可以由第一电子设备401对这类2D图像进行人脸校正,并将校正后的2D图像发送给第二电子设备402,以便一个或多个用户2在第二电子设备402的显示屏上看到的视频画面中,不会存在一个或多个用户1看向别处的问题出现。在其他一些实施例中,第一电子设备401也可以将包含人脸面部朝向不是正对显示屏的2D图像的图像序列发送给第二电子设备402,由第二电子设备402对这类图像进行人脸校正,以便一个或多个用户2在第二电子设备402的显示屏上看到的视频画面中,不会存在一个或多个用户1看向别处的问题出现。
当然,第二电子设备402也可能存在其摄像头和显示屏之间存在以下至少一种关系:摄像头的朝向与其包括的显示屏的朝向不同,摄像头与其显示屏之间存在距离的情况。那么对其采集到的包含人脸面部朝向不是正对显示屏的2D图像,可以由第二电子设备402对这类图像进行人脸校正,也可以由第一电子设备401对这类图像进行人脸校正, 本申请实施例在此并不做具体限制。
需要说明的是,为了便于描述,在本申请以下实施例中,以第一电子设备401的摄像头和显示屏之间存在以下至少一种关系:摄像头的朝向与其包括的显示屏的朝向不同,摄像头与其显示屏之间存在距离,第二电子设备402不存在该情况,且由第一电子设备401对包含人脸面部朝向不是正对显示屏的2D图像进行人脸校正为例,对本实施例提供的人脸校正方法进行详细介绍。
示例性的,本申请实施例中所述的电子设备(如上述第一电子设备401,第二电子设备402)可以是手机、平板电脑、桌面型、膝上型、手持计算机、笔记本电脑(如华为笔记本电脑)、台式电脑、超级移动个人计算机(ultra-mobile personal computer,UMPC)、上网本,以及蜂窝电话、个人数字助理(personal digital assistant,PDA)、增强现实(augmented reality,AR)\虚拟现实(virtual reality,VR)设备、电视机等包括或连接有显示屏和摄像头的设备,本申请实施例对该设备的具体形态不作特殊限制。
另外,在一些实施例中,上述第一电子设备401和第二电子设备402可以为相同类型的电子设备,如第一电子设备401和第二电子设备402均为笔记本电脑。在其他一些实施例中,上述第一电子设备401和第二电子设备402可以为不同类型的电子设备,如第一电子设备401为华为笔记本电脑,第二电子设备402为台式电脑(如图5中所示)。
请参考图5,为本申请实施例提供的一种电子设备的结构示意图。上述第一电子设备401,第二电子设备402的结构可以如图5所示。
如图5所示,电子设备可以包括处理器110,外部存储器接口120,内部存储器121,通用串行总线(universal serial bus,USB)接口130,充电管理模块140,电源管理模块141,电池142,天线1,天线2,移动通信模块150,无线通信模块160,音频模块170,扬声器170A,受话器170B,麦克风170C,耳机接口170D,传感器模块180,按键190,马达191,指示器192,摄像头193,显示屏194,以及用户标识模块(subscriber identification module,SIM)卡接口195等。其中,传感器模块180可以包括压力传感器180A,陀螺仪传感器180B,气压传感器180C,磁传感器180D,加速度传感器180E,距离传感器180F,接近光传感器180G,指纹传感器180H,温度传感器180J,触摸传感器180K,环境光传感器180L,骨传导传感器180M等。
可以理解的是,本实施例示意的结构并不构成对电子设备的具体限定。在另一些实施例中,电子设备可以包括比图示更多或更少的部件,或者组合某些部件,或者拆分某些部件,或者不同的部件布置。图示的部件可以以硬件,软件或软件和硬件的组合实现。
处理器110可以包括一个或多个处理单元,例如:处理器110可以包括应用处理器(application processor,AP),调制解调处理器,图形处理器(graphics processing unit,GPU),图像信号处理器(image signal processor,ISP),控制器,存储器,视频编解码器,数字信号处理器(digital signal processor,DSP),基带处理器,神经网络处理器(neural-network processing unit,NPU)等中的一个或多个。其中,不同的处理单元可以是独立的器件,也可以集成在一个或多个处理器中。
控制器可以是电子设备的神经中枢和指挥中心。控制器可以根据指令操作码和时序信号,产生操作控制信号,完成取指令和执行指令的控制。
处理器110中还可以设置存储器,用于存储指令和数据。在一些实施例中,处理器110中的存储器为高速缓冲存储器。该存储器可以保存处理器110刚用过或循环使用的 指令或数据。如果处理器110需要再次使用该指令或数据,可从所述存储器中直接调用。避免了重复存取,减少了处理器110的等待时间,因而提高了系统的效率。
在一些实施例中,处理器110可以包括一个或多个接口。接口可以包括集成电路(inter-integrated circuit,I2C)接口,集成电路内置音频(inter-integrated circuit sound,I2S)接口,脉冲编码调制(pulse code modulation,PCM)接口,通用异步收发传输器(universal asynchronous receiver/transmitter,UART)接口,移动产业处理器接口(mobile industry processor interface,MIPI),通用输入输出(general-purpose input/output,GPIO)接口,SIM接口,USB接口等中的一个或多个。
充电管理模块140用于从充电器接收充电输入。其中,充电器可以是无线充电器,也可以是有线充电器。在一些有线充电的实施例中,充电管理模块140可以通过USB接口130接收有线充电器的充电输入。在一些无线充电的实施例中,充电管理模块140可以通过电子设备的无线充电线圈接收无线充电输入。充电管理模块140为电池142充电的同时,还可以通过电源管理模块141为电子设备供电。
电源管理模块141用于连接电池142,充电管理模块140与处理器110。电源管理模块141接收电池142,充电管理模块140的输入,为处理器110,内部存储器121,外部存储器,显示屏194,摄像头193,和无线通信模块160等供电。电源管理模块141还可以用于监测电池容量,电池循环次数,电池健康状态(漏电,阻抗)等参数。在其他一些实施例中,电源管理模块141也可以设置于处理器110中。在另一些实施例中,电源管理模块141和充电管理模块140也可以设置于同一个器件中。
电子设备的无线通信功能可以通过天线1,天线2,移动通信模块150,无线通信模块160,调制解调处理器以及基带处理器等实现。
天线1和天线2用于发射和接收电磁波信号。电子设备中的每个天线可用于覆盖单个或多个通信频带。不同的天线还可以复用,以提高天线的利用率。例如:可以将天线1复用为无线局域网的分集天线。在另外一些实施例中,天线可以和调谐开关结合使用。
移动通信模块150可以提供应用在电子设备上的包括2G/3G/4G/5G等无线通信的解决方案。移动通信模块150可以包括至少一个滤波器,开关,功率放大器,低噪声放大器(low noise amplifier,LNA)等。移动通信模块150可以由天线1接收电磁波,并对接收的电磁波进行滤波,放大等处理,传送至调制解调处理器进行解调。移动通信模块150还可以对经调制解调处理器调制后的信号放大,经天线1转为电磁波辐射出去。在一些实施例中,移动通信模块150的至少部分功能模块可以被设置于处理器110中。在一些实施例中,移动通信模块150的至少部分功能模块可以与处理器110的至少部分模块被设置在同一个器件中。
调制解调处理器可以包括调制器和解调器。其中,调制器用于将待发送的低频基带信号调制成中高频信号。解调器用于将接收的电磁波信号解调为低频基带信号。随后解调器将解调得到的低频基带信号传送至基带处理器处理。低频基带信号经基带处理器处理后,被传递给应用处理器。应用处理器通过音频设备(不限于扬声器170A,受话器170B等)输出声音信号,或通过显示屏194显示图像或视频。在一些实施例中,调制解调处理器可以是独立的器件。在另一些实施例中,调制解调处理器可以独立于处理器110,与移动通信模块150或其他功能模块设置在同一个器件中。
无线通信模块160可以提供应用在电子设备上的包括无线局域网(wireless local area networks,WLAN)(如无线保真(wireless fidelity,Wi-Fi)网络),蓝牙(bluetooth, BT),全球导航卫星系统(global navigation satellite system,GNSS),调频(frequency modulation,FM),近距离无线通信技术(near field communication,NFC),红外技术(infrared,IR)等无线通信的解决方案。无线通信模块160可以是集成至少一个通信处理模块的一个或多个器件。无线通信模块160经由天线2接收电磁波,将电磁波信号调频以及滤波处理,将处理后的信号发送到处理器110。无线通信模块160还可以从处理器110接收待发送的信号,对其进行调频,放大,经天线2转为电磁波辐射出去。
在一些实施例中,电子设备的天线1和移动通信模块150耦合,天线2和无线通信模块160耦合,使得电子设备可以通过无线通信技术与网络以及其他设备通信。例如,电子设备可以通过天线1和移动通信模块150与其他电子设备进行视频通话或视频会议。所述无线通信技术可以包括全球移动通讯系统(global system for mobile communications,GSM),通用分组无线服务(general packet radio service,GPRS),码分多址接入(code division multiple access,CDMA),宽带码分多址(wideband code division multiple access,WCDMA),时分码分多址(time-division code division multiple access,TD-SCDMA),长期演进(long term evolution,LTE),BT,GNSS,WLAN,NFC,FM,IR技术等中的一个或多个。所述GNSS可以包括全球卫星定位系统(global positioning system,GPS),全球导航卫星系统(global navigation satellite system,GLONASS),北斗卫星导航系统(beidou navigation satellite system,BDS),准天顶卫星系统(quasi-zenith satellite system,QZSS),星基增强系统(satellite based augmentation systems,SBAS)等中的一个或多个。
电子设备通过GPU,显示屏194,以及应用处理器等实现显示功能。GPU为图像处理的微处理器,连接显示屏194和应用处理器。GPU用于执行数学和几何计算,用于图形渲染。处理器110可包括一个或多个GPU,其执行程序指令以生成或改变显示信息。
显示屏194用于显示图像,视频等。显示屏194包括显示面板。显示面板可以采用液晶显示屏(liquid crystal display,LCD),有机发光二极管(organic light-emitting diode,OLED),有源矩阵有机发光二极体或主动矩阵有机发光二极体(active-matrix organic light emitting diode,AMOLED),柔性发光二极管(flex light-emitting diode,FLED),Miniled,MicroLed,Micro-oLed,量子点发光二极管(quantum dot light emitting diodes,QLED)等。在一些实施例中,电子设备可以包括1个或N个显示屏194,N为大于1的正整数。例如,在本申请实施例中,在用户利用电子设备与其他电子设备的用户进行视频通话或视频会议的过程中,显示屏194可以显示视频接听界面,或视频提醒界面,或视频通话界面(如包括对端设备发送的图像序列,本设备采集到的图像序列)。
电子设备可以通过ISP,摄像头193,视频编解码器,GPU,显示屏194以及应用处理器等实现拍摄功能。
ISP用于处理摄像头193反馈的数据。例如,拍照时,打开快门,光线通过镜头被传递到摄像头感光元件上,光信号转换为电信号,摄像头感光元件将所述电信号传递给ISP处理,转化为肉眼可见的图像。ISP还可以对图像的噪点,亮度,肤色进行算法优化。ISP还可以对拍摄场景的曝光,色温等参数优化。在一些实施例中,ISP可以设置在摄像头193中。
摄像头193用于捕获静态图像或视频。例如,在本申请实施例中,摄像头193可用于采集视频通话或视频会议过程中的图像序列。物体通过镜头生成光学图像投射到感光元件。感光元件可以是电荷耦合器件(charge coupled device,CCD)或互补金属氧化 物半导体(complementary metal-oxide-semiconductor,CMOS)光电晶体管。感光元件把光信号转换成电信号,之后将电信号传递给ISP转换成数字图像信号。ISP将数字图像信号输出到DSP加工处理。DSP将数字图像信号转换成标准的RGB,YUV等格式的图像信号。在一些实施例中,电子设备可以包括1个或N个摄像头193,N为大于1的正整数。在本实施例中,该摄像头193可以是普通的2D摄像头,也可以是3D摄像头。该摄像头193可以采用隐藏式方式设置在电子设备中,也可以不采用隐藏式方式设置,本实施例在此不做具体限制。
需要说明的是,在本申请实施例中,该摄像头193和显示屏194之间存在以下至少一种关系:摄像头193的朝向与显示屏194的朝向不同,摄像头193与显示屏194之间存在距离。这样,摄像头193采集到的图像序列中可能存在用户的面部朝向并不是正对显示屏的2D图像。
数字信号处理器用于处理数字信号,除了可以处理数字图像信号,还可以处理其他数字信号。例如,当电子设备在频点选择时,数字信号处理器用于对频点能量进行傅里叶变换等。
视频编解码器用于对数字视频压缩或解压缩。电子设备可以支持一种或多种视频编解码器。这样,电子设备可以播放或录制多种编码格式的视频,例如:动态图像专家组(moving picture experts group,MPEG)1,MPEG2,MPEG3,MPEG4等。
NPU为神经网络(neural-network,NN)计算处理器,通过借鉴生物神经网络结构,例如借鉴人脑神经元之间传递模式,对输入信息快速处理,还可以不断的自学习。通过NPU可以实现电子设备的智能认知等应用,例如:图像识别,人脸识别,语音识别,文本理解等。
外部存储器接口120可以用于连接外部存储卡,例如Micro SD卡,实现扩展电子设备的存储能力。外部存储卡通过外部存储器接口120与处理器110通信,实现数据存储功能。例如将音乐,视频等文件保存在外部存储卡中。
内部存储器121可以用于存储计算机可执行程序代码,所述可执行程序代码包括指令。处理器110通过运行存储在内部存储器121的指令,从而执行电子设备的各种功能应用以及数据处理。例如,在本申请实施例中,处理器110可以通过执行存储在内部存储器121中的指令,将采集到的图像序列中面部朝向并不是正对显示屏的2D图像进行人脸校正,以使得校正后的图像中面部朝向正对显示屏,以便通话对端用户观看到的视频画面中的用户不会看向别处。这样通话对端用户能够觉得视频画面中的人与自己存在眼神交流,使得沟通更自然,提高沟通效率。例如,处理器110可以通过执行存储在内部存储器121中的指令,进行人脸三维重建,人脸旋转校正,人脸无缝融合等处理。内部存储器121可以包括存储程序区和存储数据区。其中,存储程序区可存储操作系统,至少一个功能所需的应用程序(比如声音播放功能,图像播放功能等)等。存储数据区可存储电子设备使用过程中所创建的数据(比如音频数据,电话本等)等。此外,内部存储器121可以包括高速随机存取存储器,还可以包括非易失性存储器,例如至少一个磁盘存储器件,闪存器件,通用闪存存储器(universal flash storage,UFS)等。在本实施例中,内部存储器121还可用于存储摄像头193采集到的图像序列,处理器110得到的2D人脸图像,3D人脸模型以及变形后的2D图像等。
电子设备可以通过音频模块170,扬声器170A,受话器170B,麦克风170C,耳机接口170D,以及应用处理器等实现音频功能。例如通话,音乐播放,录音等。
音频模块170用于将数字音频信息转换成模拟音频信号输出,也用于将模拟音频输入转换为数字音频信号。音频模块170还可以用于对音频信号编码和解码。在一些实施例中,音频模块170可以设置于处理器110中,或将音频模块170的部分功能模块设置于处理器110中。
扬声器170A,也称“喇叭”,用于将音频电信号转换为声音信号。电子设备可以通过扬声器170A收听音乐,或收听免提通话。
受话器170B,也称“听筒”,用于将音频电信号转换成声音信号。当电子设备接听电话或语音信息时,可以通过将受话器170B靠近人耳接听语音。
麦克风170C,也称“话筒”,“传声器”,用于将声音信号转换为电信号。当拨打电话或发送语音信息或需要通过语音助手触发电子设备执行某些功能时,用户可以通过人嘴靠近麦克风170C发声,将声音信号输入到麦克风170C。电子设备可以设置至少一个麦克风170C。在另一些实施例中,电子设备可以设置两个麦克风170C,除了采集声音信号,还可以实现降噪功能。在另一些实施例中,电子设备还可以设置三个,四个或更多麦克风170C,实现采集声音信号,降噪,还可以识别声音来源,实现定向录音功能等。
耳机接口170D用于连接有线耳机。耳机接口170D可以是USB接口130,也可以是3.5mm的开放移动电子设备平台(open mobile terminal platform,OMTP)标准接口,美国蜂窝电信工业协会(cellular telecommunications industry association of the USA,CTIA)标准接口。
压力传感器180A用于感受压力信号,可以将压力信号转换成电信号。在一些实施例中,压力传感器180A可以设置于显示屏194。压力传感器180A的种类很多,如电阻式压力传感器,电感式压力传感器,电容式压力传感器等。电容式压力传感器可以是包括至少两个具有导电材料的平行板。当有力作用于压力传感器180A,电极之间的电容改变。电子设备根据电容的变化确定压力的强度。当有触摸操作作用于显示屏194,电子设备根据压力传感器180A检测所述触摸操作强度。电子设备也可以根据压力传感器180A的检测信号计算触摸的位置。在一些实施例中,作用于相同触摸位置,但不同触摸操作强度的触摸操作,可以对应不同的操作指令。例如:当有触摸操作强度小于第一压力阈值的触摸操作作用于短消息应用图标时,执行查看短消息的指令。当有触摸操作强度大于或等于第一压力阈值的触摸操作作用于短消息应用图标时,执行新建短消息的指令。
陀螺仪传感器180B可以用于确定电子设备的运动姿态。在一些实施例中,可以通过陀螺仪传感器180B确定电子设备围绕三个轴(即,x,y和z轴)的角速度。陀螺仪传感器180B可以用于拍摄防抖。示例性的,当按下快门,陀螺仪传感器180B检测电子设备抖动的角度,根据角度计算出镜头模组需要补偿的距离,让镜头通过反向运动抵消电子设备的抖动,实现防抖。陀螺仪传感器180B还可以用于导航,体感游戏场景。
气压传感器180C用于测量气压。在一些实施例中,电子设备通过气压传感器180C测得的气压值计算海拔高度,辅助定位和导航。
磁传感器180D包括霍尔传感器。电子设备可以利用磁传感器180D检测翻盖皮套的开合。在一些实施例中,当电子设备是翻盖机时,电子设备可以根据磁传感器180D检测翻盖的开合。进而根据检测到的皮套的开合状态或翻盖的开合状态,设置翻盖自动解锁等特性。
加速度传感器180E可检测电子设备在各个方向上(一般为三轴)加速度的大小。当电子设备静止时可检测出重力的大小及方向。还可以用于识别电子设备姿态,应用于横 竖屏切换,计步器等应用。
距离传感器180F,用于测量距离。电子设备可以通过红外或激光测量距离。在一些实施例中,拍摄场景,电子设备可以利用距离传感器180F测距以实现快速对焦。
接近光传感器180G可以包括例如发光二极管(LED)和光检测器,例如光电二极管。发光二极管可以是红外发光二极管。电子设备通过发光二极管向外发射红外光。电子设备使用光电二极管检测来自附近物体的红外反射光。当检测到充分的反射光时,可以确定电子设备附近有物体。当检测到不充分的反射光时,电子设备可以确定电子设备附近没有物体。电子设备可以利用接近光传感器180G检测用户手持电子设备贴近耳朵通话,以便自动熄灭屏幕达到省电的目的。接近光传感器180G也可用于皮套模式,口袋模式自动解锁与锁屏。
环境光传感器180L用于感知环境光亮度。电子设备可以根据感知的环境光亮度自适应调节显示屏194亮度。环境光传感器180L也可用于拍照时自动调节白平衡。环境光传感器180L还可以与接近光传感器180G配合,检测电子设备是否在口袋里,以防误触。
指纹传感器180H用于采集指纹。电子设备可以利用采集的指纹特性实现指纹解锁,访问应用锁,指纹拍照,指纹接听来电等。
温度传感器180J用于检测温度。在一些实施例中,电子设备利用温度传感器180J检测的温度,执行温度处理策略。例如,当温度传感器180J上报的温度超过阈值,电子设备执行降低位于温度传感器180J附近的处理器的性能,以便降低功耗实施热保护。在另一些实施例中,当温度低于另一阈值时,电子设备对电池142加热,以避免低温导致电子设备异常关机。在其他一些实施例中,当温度低于又一阈值时,电子设备对电池142的输出电压执行升压,以避免低温导致的异常关机。
触摸传感器180K,也称“触控面板”。触摸传感器180K可以设置于显示屏194,由触摸传感器180K与显示屏194组成触摸屏,也称“触控屏”。触摸传感器180K用于检测作用于其上或附近的触摸操作。触摸传感器可以将检测到的触摸操作传递给应用处理器,以确定触摸事件类型。可以通过显示屏194提供与触摸操作相关的视觉输出。在另一些实施例中,触摸传感器180K也可以设置于电子设备的表面,与显示屏194所处的位置不同。
骨传导传感器180M可以获取振动信号。在一些实施例中,骨传导传感器180M可以获取人体声部振动骨块的振动信号。骨传导传感器180M也可以接触人体脉搏,接收血压跳动信号。在一些实施例中,骨传导传感器180M也可以设置于耳机中,结合成骨传导耳机。音频模块170可以基于所述骨传导传感器180M获取的声部振动骨块的振动信号,解析出语音信号,实现语音功能。应用处理器可以基于所述骨传导传感器180M获取的血压跳动信号解析心率信息,实现心率检测功能。
按键190包括开机键,音量键等。按键190可以是机械按键。也可以是触摸式按键。电子设备可以接收按键输入,产生与电子设备的用户设置以及功能控制有关的键信号输入。
马达191可以产生振动提示。马达191可以用于来电振动提示,也可以用于触摸振动反馈。例如,作用于不同应用(例如拍照,音频播放等)的触摸操作,可以对应不同的振动反馈效果。作用于显示屏194不同区域的触摸操作,马达191也可对应不同的振动反馈效果。不同的应用场景(例如:时间提醒,接收信息,闹钟,游戏等)也可以对应不同的振动反馈效果。触摸振动反馈效果还可以支持自定义。
指示器192可以是指示灯,可以用于指示充电状态,电量变化,也可以用于指示消息,未接来电,通知等。
SIM卡接口195用于连接SIM卡。SIM卡可以通过插入SIM卡接口195,或从SIM卡接口195拔出,实现和电子设备的接触和分离。电子设备可以支持1个或N个SIM卡接口,N为大于1的正整数。SIM卡接口195可以支持Nano SIM卡,Micro SIM卡,SIM卡等。同一个SIM卡接口195可以同时插入多张卡。所述多张卡的类型可以相同,也可以不同。SIM卡接口195也可以兼容不同类型的SIM卡。SIM卡接口195也可以兼容外部存储卡。电子设备通过SIM卡和网络交互,实现通话以及数据通信等功能。在一些实施例中,电子设备采用eSIM,即:嵌入式SIM卡。eSIM卡可以嵌在电子设备中,不能和电子设备分离。
以下实施例中的方法均可以在具有上述硬件结构的电子设备中实现。
图6为本申请实施例提供的一种人脸校正方法的流程示意图。如图6所示,该方法可以包括:
S601、电子设备获取第一2D图像,该第一2D图像中的人脸面部的朝向与电子设备的显示屏的垂线不平行。
示例性的,电子设备可以通过自身的摄像头采集图像序列,或者接收来自其他电子设备的图像序列,该图像序列中包括上述第一2D图像。
其中,以电子设备是通过自身的摄像头采集到上述第一2D图像,该摄像头为2D摄像头为例。在该电子设备的摄像头和显示屏之间存在以下至少一种关系:摄像头与其包括的显示屏之间存在距离,摄像头的朝向与其包括的显示屏的朝向不同时,在用户使用该电子设备与其他用户进行视频聊天或视频会议的过程中,如果用户的面部并未朝向摄像头,而是朝向其他地方,如朝向显示屏时,该电子设备通过摄像头采集到的图像序列中,便会存在人脸面部的朝向与电子设备的显示屏的垂线不平行的2D图像。也就是说,采集到用户的面部朝向并未正对显示屏的2D图像,即上述第一2D图像。
S602、电子设备获取3D人脸模型,该3D人脸模型中人脸面部的朝向与摄像头捕获第一2D图像时用户人脸相对于该摄像头的朝向相同。
其中,3D人脸模型中人脸面部也并未正对显示屏。如果电子设备包括的摄像头是2D摄像头,则该3D人脸模型可由电子设备根据捕获的第一2D图像进行人脸3D重建获得。如果电子设备的摄像头是3D摄像头,则该3D人脸模型可直接由3D摄像头捕获得到。
S603、电子设备对3D人脸模型中的3D人脸进行面部朝向校正,校正后的3D人脸模型中人脸面部的朝向与显示屏的垂线平行。
电子设备可对获取的3D人脸模型中的3D人脸进行面部朝向校正,以使得校正后的3D人脸模型中人脸面部的朝向与显示屏的垂线平行,即,使得校正后的3D人脸模型中人脸面部正对显示屏。
S604、电子设备对校正后的3D人脸模型进行投影获得2D人脸图像,该2D人脸图像中人脸面部的朝向与显示屏的垂线平行。
电子设备将获得的校正后的3D人脸模型进行投影,便可获得校正后的3D人脸模型对应的2D人脸图像。由于校正后的3D人脸模型中人脸面部的朝向与显示屏的垂线平行,因此,获得的2D人脸图像中人脸面部的朝向与显示屏的垂线也是平行的,即,获得的2D人脸图像中人脸面部正对显示屏。
S605、电子设备以2D人脸图像中的人脸面部图像为目标,对第一2D图像中的人脸 面部图像进行仿射变换。
其中,仿射变换(或者称为仿射映射)可以是指,在几何上将一个向量空间进行一次线性变换并接上一个平移变换,变换为另一个向量空间。在本实施例中,通过以2D人脸图像中的人脸面部图像为目标,对第一2D图像中的人脸面部图像进行仿射变换,可使得仿射变换后的人脸轮廓与校正后的图像(即2D人脸图像)中的人脸轮廓一致,其他五官图像接近校正后的图像。
S606、电子设备生成2D人脸图像的人脸面部的掩码(mask)。
其中,掩码也可以称为掩膜,或二值化掩膜。例如,电子设备可以根据2D人脸图像中人脸面部的轮廓,将该轮廓内的像素点的像素值置为255(呈现为白色),将该轮廓外的像素点的像素值置为0(呈现为黑色),以获得该2D人脸图像的人脸面部的掩码。
S607、电子设备根据2D人脸图像的人脸面部的掩码,将进行仿射变换后的第一2D图像和2D人脸图像进行融合,获得第二2D图像,该第二2D图像中人脸面部的朝向与显示屏的垂线平行。
电子设备在获得人脸面部朝向正对显示屏的2D人脸图像后,可以该2D人脸图像中的人脸面部图像为目标,对原2D图像(即第一2D图像)中的人脸面部图像进行仿射变换。并可生成2D人脸图像的人脸面部掩码。电子设备根据该2D人脸图像的人脸面部的掩码,将进行仿射变换后的原2D图像和2D人脸图像进行融合,以获得人脸面部的朝向正对显示屏的2D图像,即上述第二2D图像,该第二2D图像可仅包括人脸面部图像。另外,电子设备还可以将该第二2D图像覆盖到原2D图像的对应区域,以获得包括背景图像的2D图像。
本申请实施例提供的人脸校正方法,在获取到原2D图像和3D人脸模型后,通过对得到的3D人脸模型中的3D人脸进行校正后重新投影得到2D人脸图像。另外,通过对原2D图像进行人脸仿射变换,并基于人脸掩码对进行仿射变换后的原2D图像和2D人脸图像进行无缝融合,实现了对人脸朝向的校正。使得对端用户观看到的视频画面中的人不会看向别处,会觉得视频画面中的人与自己存在眼神交流,使得沟通更自然,提高沟通效率。且这种融合方法计算量小,无需占用很多资源。
图7为本申请实施例提供的一种人脸校正方法的流程示意图。在该实施例中,以电子设备为华为笔记本电脑为例。请参考图2,在华为笔记本电脑的设计中,摄像头采用隐藏式设置的方式,其位于键盘上,处于显示屏的下方。也就是说,摄像头的朝向与显示屏的朝向不同。且本实施例以该摄像头是普通的2D摄像头为例进行介绍。这样,在用户(如用户1)利用华为笔记本电脑与其他用户(如用户2)进行视频聊天后视频会议的过程中,如果用户1面部或视线朝向显示屏,而非摄像头,则会出现用户2看到的视频画面中用户1眼睛看向别处,如朝上看的情况,与自己没有眼神交流。为了避免这种情况出现,本申请实施例提供一种人脸校正方法,以对采集到的这种图像进行人脸校正。如图7所示,该方法可以包括:
S701、华为笔记本电脑通过摄像头采集图像序列。
S702、华为笔记本电脑从上述图像序列中获取第一2D图像。
其中,上述第一2D图像中的人脸面部的朝向与华为笔记本电脑的显示屏的垂线不平行,即人脸面部朝向不是正对显示屏。
例如,在用户1使用华为笔记本电脑与用户2进行视频聊天或视频会议的过程中,可以通过华为笔记本电脑的摄像头采集图像序列。如果在视频过程中,用户1的面部并 未朝向该摄像头,而是朝向其他地方,如朝向电脑的显示屏,那么通过摄像头采集的图像序列中,便会存在人脸面部的朝向与显示屏的垂线不平行的2D图像,也就是说,存在用户的面部朝向并未正对显示屏的2D图像,即上述第一2D图像。华为笔记本电脑可从采集到的图像序列中捕获这些图像,即获取该第一2D图像。如,捕获到的第一2D图像如图8所示。由图8可以看到的是,该第一2D图像中用户1的面部朝向并未正对显示屏。需要说明的是,图8仅是为了体现捕获到的2D图像中用户1的面部朝向与显示屏的关系,在实际视频聊天或视频会议中,并不会在显示屏上显示该图像。
另外,由于采集图像序列的摄像头为普通2D摄像头,如果直接对采集到的2D图像进行人脸校正,则会由于缺乏三维深度信息,导致校正后的图像只能是进行轮廓形状近似改变,并不能改变用户的视线朝向。而往往在用户的面部朝向不是正对显示屏时,其视线朝向也并未正对摄像头,因此,也要对视线朝向进行校正。对视线朝向进行校正,则需要利用用户的3D人脸模型来实现。因此,本申请实施例可以通过执行如下S703-S704来实现3D人脸重建。
S703、华为笔记本电脑对第一2D图像进行检测,获取人脸面部的轮廓和特征点的位置。
其中,特征点可以包括人脸的眉毛,眼睛,鼻子及嘴巴对应位置处的特征点。
示例性的,在用户1进行视频聊天或视频会议的过程中,摄像头采集到的2D图像中通常除了包括人脸面部外,还会包括一些背景。在本实施例中,华为笔记本电脑在捕获到第一2D图像后,可以利用人脸检测算法将该图像中的背景区域去除,以获得包括人脸面部皮肤的图像。例如,第一2D图像如图8所示。华为笔记本电脑可以将该图像中的背景区域去除,以获得图9中的(a)所示的包括人脸面部的第一2D图像(该图像也可以称为人脸大头照)。通过基于对去除背景后的人脸大头照进行后续处理,可以节省后续处理的复杂度,提高人脸校正的效率。
之后,华为笔记本电脑可以利用图像处理技术和人脸检测算法,对图9中的(a)所示的第一2D图像进行人脸检测。例如,可以结合图9中的(b)所示的人脸68个特征点分布情况,获得该第一2D图像中人脸面部的轮廓,并定位出该人脸面部中眉毛、眼睛、鼻子及嘴巴对应位置处的特征点的位置。如,获取到的第一2D图像中人脸面部的轮廓和特征点的位置如图9中的(c)的黑色圆点所示。当然,也可以不去除背景区域,而是直接对摄像头采集到的包括背景区域的2D图像进行检测,以获得人脸面部的轮廓和特征点的位置,本实施例在此不做具体限制。
S704、华为笔记本电脑根据人脸面部的轮廓和特征点的位置进行人脸3D重建,获得3D人脸模型。
其中,3D人脸模型中人脸面部的朝向与华为笔记本的摄像头捕获第一2D图像时人脸相对于摄像头的朝向相同,即3D人脸模型中人脸面部的朝向并未正对显示屏。另外,3D人脸模型中的视线朝向也并未正对显示屏。
在获取到第一2D图像中人脸面部的轮廓,并定位出该人脸面部中眉毛、眼睛、鼻子及嘴巴对应位置处的特征点的位置之后,可以将检测出的人脸面部的轮廓和眉毛、眼睛、鼻子及嘴巴对应位置处的特征点,与已知的3D人脸模型(如图9中的(d)所示)中的特征点一一对应。然后,根据人脸识别后的第一2D图像和已知的3D人脸模型,采用3D重建技术,如三维可变形模型(3D Morphable Models,3DMM)技术,结合人脸特征识别出的人脸表情,拟合人脸形状轮廓,计算人脸姿态,以获得上述3D人脸模型,该3D人 脸模型可如图9中的(e)所示,其与第一2D图像对应。如图9中的(e)所示,可以看到的是,该3D人脸模型中人脸面部的朝向并未正对显示屏,视线朝向也并未正对显示屏。
S705、华为笔记本电脑对3D人脸模型中的3D人脸进行面部朝向校正,校正后的3D人脸模型中人脸面部的朝向与显示屏的垂线平行。
示例性的,华为笔记本电脑可以获取摄像头的朝向与显示屏的朝向之间的夹角。根据获得的摄像头的朝向与显示屏的朝向之间的夹角,可以对3D人脸模型中的3D人脸进行面部朝向校正,以使得校正后的3D人脸模型中的人脸面部的朝向与显示屏的垂线平行,即人脸面部的朝向正对显示屏,也就是说,达到人脸校正的目的。例如,摄像头位于显示屏的下方,且摄像头的朝向与显示屏的朝向之间的夹角为15度。可以依据3D人脸模型中的3D人脸的当前姿态和摄像头的朝向与显示屏的朝向之间的夹角,将如图10中的(a)所示的3D人脸模型中的3D人脸向下旋转校正15度。如,校正后的3D人脸模型如图10中的(b)所示。可以看到的是,通过人脸面部朝向的校正,可使得校正后的3D人脸模型中的人脸面部正对显示屏。另外,通过对人脸面部朝向的校正,也可以对用户视线的朝向进行校正。
华为笔记本电脑在获得校正后的3D人脸模型后,可对校正后的3D人脸模型进行投影,以获得2D人脸图像,该2D人脸图像是进行人脸校正后的图像,即该2D人脸图像中人脸面部的朝向与显示屏的垂线平行。也就是说,该2D人脸图像中人脸面部的朝向正对显示屏。为了确保原图,即第一2D图像在进行人脸变形时人脸轮廓不会变化,在本实施例中,可以通过执行以下S706-S707获得上述2D人脸图像。
S706、华为笔记本电脑对校正后的3D人脸模型进行投影,获得人脸投影图像。
例如,结合图11,可以将图11中的(a)所示的校正后的3D人脸模型进行投影,获得图11中的(b)所示的人脸投影图像。
S707、华为笔记本电脑根据校正3D人脸模型中3D人脸的面部朝向时对3D人脸旋转的角度的方向,对上述人脸投影图像的中的人脸位置进行调整,获得2D人脸图像。
示例性的,华为笔记本电脑可以根据S705中对3D人脸模型中3D人脸的面部朝向校正时旋转的角度和方向,对图11中的(b)所示的人脸投影图像中的人脸位置进行调整。例如,结合图12,华为笔记本电脑在S705中对3D人脸模型中3D人脸向下旋转了15度,则华为笔记本电脑可以根据用户1头部的大小和3D人脸的旋转的角度和方向估算出需要移动的距离和方向。然后,根据估算出的距离和方向,将图12中的(a)所示人脸投影图像中的人脸位置进行调整。如可将图12中的(a)所示人脸投影图像中的人脸位置向下移动,移动距离等于估算出的距离,以得到的2D人脸图像,如图12中的(b)所示。这样,可以进一步的对用户1的视线朝向进行校正。
S708、华为笔记本电脑对2D人脸图像进行检测,获取2D人脸图像的控制点的位置,人脸面部的特征点的位置以及人脸面部的轮廓。
其中,该控制点可以包括以下至少一个位置处的特征点:人脸的额头对应位置处的特征点,人的颈部对应位置处的特征点。由于单检测人脸轮廓和眉毛、眼睛、鼻子及嘴巴对应位置处的特征点,获得的轮廓区域有限。因此,在本实施例中,在这些特征点的基础上,可以进一步的增加额头和颈部中至少一个位置处的特征点,用于识别人脸轮廓区域,以保护原图(即第一2D图像)在人脸变形时人脸轮廓不会变化。例如,以增加人脸的额头对应位置处的特征点为例。图12中的(b)所示的2D人脸图像中额头对应位置处的特征点可如图13中的(b)所示。
并且,为了保护人脸轮廓,对于获得的人脸面部的轮廓中,人脸下巴对应位置处的特征点是2D人脸图像对应位置处的特征点,人脸面部的轮廓中除人脸下巴对应位置处的特征点是第一2D图像对应位置处的特征点。也就是说,除下巴对应位置处的特征点外,将位于人脸轮廓边缘的其他特征点由第一2D图像对应位置处的特征点代替。
S709、华为笔记本电脑以2D人脸图像中的人脸面部图像为目标,对第一2D图像中的人脸面部图像进行仿射变换。
其中,华为笔记本电脑可以根据图13中的(b)所示的2D人脸图像的人脸面部的特征点的位置,控制点的位置,以及人脸面部的轮廓,对2D人脸图像中的人脸面部图像进行区域划分,得到多个第一区域块。根据图13中的(a)所示的第一2D图像的人脸面部的特征点的位置,控制点的位置,以及人脸面部的轮廓,对第一2D图像中的人脸面部图像进行区域划分,得到多个第二区域块。其中,多个第一区域块与多个第二区域块一一对应。其中,对图13中的(a)所示的第一2D图像和图13中的(b)所示的2D人脸图像的人脸面部图像进行区域划分采用的方式可以是三角网格化的划分方式。例如,如图13中的(d)所示,示出了部分第一区域块。也就是说,对图13中的(b)所示的2D人脸图像的人脸面部图像进行三角网格化划分后,至少可包括图13中的(d)所示的:第一区域块1'、第一区域块2'、第一区域块3'、第一区域块4'、第一区域块5'、第一区域块6'、第一区域块7'等第一区域块。如图13中的(c)所示,示出了部分第二区域块。也就是说,对图13中的(a)所示的第一2D图像人脸面部图像进行三角网格化划分后,至少可包括图13中的(c)所示的:第二区域块1、第二区域块2、第二区域块3、第二区域块4、第二区域块5、第二区域块6、第二区域块7等第二区域块。其中,如图13中的(c)和(d)所示,第一区域块1'与第二区域块1对应,第一区域块2'与第二区域块2对应,第一区域块3'与第二区域块3对应,第一区域块4'与第二区域块4对应,第一区域块5'与第二区域块5对应,第一区域块6'与第二区域块6对应,第一区域块7'与第二区域块7对应。
仿射变换(或者称为仿射映射)可以是指,在几何上将一个向量空间进行一次线性变换并接上一个平移变换,变换为另一个向量空间。华为笔记本电脑可以以2D人脸图像中每个第一区域块为目标,对第一2D图像中对应的每个第二区域块进行仿射变换,使得第一2D图像中的每个第二区域与2D人脸图像中的每个第一区域对齐。例如,结合图13中的(c)和(d)所示,可以以第一区域块1'为目标对第二区域块1进行仿射变换,以第一区域块2'为目标对第二区域块2进行仿射变换,依次类推,直到遍历完所有的区域块。这样,可使得仿射变换后的人脸轮廓与校正后的图像(即2D人脸图像)中的人脸轮廓一致,其他五官图像接近校正后的图像,且还可保护原图(即第一2D图像)中的人脸轮廓,使得原图中除人脸内部区域和下巴外其他区域图像无形变现象。例如,将图14中的(a)所示的第一2D图像,以2D人脸图像中的人脸面部图像为目标进行仿射变换后的第一2D图像如图14中的(b)所示。需要说明的是,在本实施例中,还可以2D人脸图像中的人脸面部图像为目标,对第一2D图像中的人脸面部图像进行透视变换等,本实施例在此不做限制。
S710、华为笔记本电脑生成2D人脸图像的人脸面部的掩码。
S711、华为笔记本电脑根据2D人脸图像的人脸面部的掩码,将进行仿射变换后的第一2D图像和2D人脸图像进行融合,获得第二2D图像,该第二2D图像中人脸面部的朝向与所述显示屏的垂线平行。
其中,华为笔记本电脑可以基于2D人脸图像的人脸面部的特征点的位置,控制点的位置,以及人脸面部的轮廓建立该2D人脸图像的人脸面部的掩码。然后根据该人脸面部的掩码,将进行仿射变换后的第一2D图像和2D人脸图像进行无缝拼接融合,以获得融合后的人脸图像,如称为第二2D图像。这样,可以降低人脸边缘纹理或光照变化明显导致的无缝拼接融合处理较困难的问题。另外,还可以先对生成的2D人脸图像的人脸面部的掩码进行腐蚀优化处理,以缩小人脸面部的掩码面积,然后,利用进行腐蚀优化后的人脸面部掩码进行图像的无缝拼接融合。
例如,结合图15,华为笔记本电脑可以基于2D人脸图像的人脸面部的轮廓,将2D人脸图像的人脸面部的轮廓内的像素点的像素值置为255,将2D人脸图像的该轮廓外的像素点的像素值置为0,以获得该2D人脸图像的人脸面部的掩码(或者称为二值化掩膜)。生成的2D人脸图像的人脸面部的掩码如图15中的(a)所示。可以对该掩码进行腐蚀处理。腐蚀处理是一种消除边界点,使边界向内部收缩的过程。这样经腐蚀处理后可得到缩小的人脸面部的掩码,如图15中的(b)所示。然后,结合图16,华为笔记本电脑可以根据图15中的(b)所示的人脸面部的掩码,将图16中的(a)所示的进行仿射变换后的第一2D图像和图16中的(b)所示的2D人脸图像进行无缝拼接融合,以获得图16中的(c)所示的融合后的人脸图像,如称为第二2D图像。
需要说明的是,在本实施例中,在3D人脸的旋转角度较小、无光照变化时,可使用拉普拉斯金字塔融合算法对进行仿射变换后的第一2D图像和2D人脸图像进行无缝拼接融合。在3D人脸的旋转角度较大或光照变化明显时,可使用泊松融合算法对进行仿射变换后的第一2D图像和2D人脸图像进行无缝拼接融合。当然,也可以采用其他的融合算法进行图像的融合,本申请实施例在此并不做具体限制。
S712、华为笔记本电脑用第二2D图像覆盖第一2D图像对应区域中的图像,生成校正后的图像。
华为笔记本电脑可以将该第二2D图像复制到原2D图像,即第一2D图像的对应区域,以获得校正后的图像,该图像包括背景图像和人脸图像。例如,结合图17,用图17中的(a)所示的融合后的人脸图像,即第二2D图像,覆盖图17中的(b)所示的第一2D图像对应区域中的图像,便可获得图17中的(c)所示的校正后的图像。这样,可以较真实的保护背景信息。可以看到的是,在该图像中,用户1的人脸朝向和视线朝向均正对显示屏。华为笔记本电脑可以将该图像发送给用户2的电子设备。如用户2使用台式电脑与用户1进行视频,那么用户2观看到的视频画面可如图18所示。可以看到的是,用户2此时看到的视频画面中用户1眼睛看向自己,与自己有眼神交流。
当然,如果用户2使用的台式电脑也存在摄像头和显示屏之间存在以下至少一种关系:摄像头和显示屏之间存在距离,摄像头的朝向与显示屏的朝向不同的情况,该台式电脑也可以将采集到的包括用户2的图像序列中人脸朝向和显示屏不是正对的图像进行校正,然后将校正后的图像序列发送给用户1的华为笔记本电脑,以便用户1看到的视频画面中用户2眼睛看向自己,与自己有眼神交流,使得沟通更加自然,更加高效。
本申请实施例提供的人脸校正方法,通过对原2D图像进行人脸3D重建,并对得到的3D人脸模型中的3D人脸进行校正后重新投影得到2D人脸图像。另外,通过对原2D图像进行人脸仿射变换,并基于人脸掩码对进行仿射变换后的原2D图像和2D人脸图像进行无缝融合,实现了对人脸朝向的校正。使得对端用户观看到的视频画面中的人不会看向别处,会觉得视频画面中的人与自己存在眼神交流,使得沟通更自然,提高沟通效 率。且这种融合方法计算量小,无需占用很多资源。另外,采用本实施例的方法,可以有效的对人脸轮廓进行保护,还可以对背景信息进行有效保护。
上述主要从电子设备的角度对本申请实施例提供的方案进行了介绍。可以理解的是,电子设备为了实现上述功能,其包含了执行各个功能相应的硬件结构和/或软件模块。本领域技术人员应该很容易意识到,结合本文中所公开的实施例描述的各示例,本申请能够以硬件或硬件和计算机软件的结合形式来实现。某个功能究竟以硬件还是计算机软件驱动硬件的方式来执行,取决于技术方案的特定应用和设计约束条件。专业技术人员可以对每个特定的应用来使用不同方法来实现所描述的功能,但是这种实现不应认为超出本申请的范围。
本申请实施例可以根据上述方法示例对电子设备进行功能模块的划分,例如,可以对应各个功能划分各个功能模块,也可以将两个或两个以上的功能集成在一个处理模块中。上述集成的模块既可以采用硬件的形式实现,也可以采用软件功能模块的形式实现。需要说明的是,本申请实施例中对模块的划分是示意性的,仅仅为一种逻辑功能划分,实际实现时可以有另外的划分方式。
图19为本申请实施例提供的一种电子设备的组成示意图。如图19所示,该电子设备可以包括:获取单元1901,校正单元1902,投影单元1903,变换单元1904,生成单元1905和融合单元1906。
获取单元1901,用于获取第一2D图像,该第一2D图像中的人脸面部的朝向与电子设备的显示屏的垂线不平行。
获取单元1901,还用于获取3D人脸模型,该3D人脸模型中人脸面部的朝向与摄像头捕获第一2D图像时用户人脸相对于摄像头的朝向相同。
校正单元1902,用于对获取单元1901获得的3D人脸模型中的3D人脸进行面部朝向校正,校正后的3D人脸模型中人脸面部的朝向与显示屏的垂线平行。
投影单元1903,用于对校正单元1902校正后的3D人脸模型进行投影,获得2D人脸图像,该2D人脸图像中人脸面部的朝向与显示屏的垂线平行。
变换单元1904,用于以投影单元1903获得的2D人脸图像中的人脸面部图像为目标,对获取单元1901获取到的第一2D图像中的人脸面部图像进行仿射变换。
生成单元1905,用于生成投影单元1903获得的2D人脸图像的人脸面部的掩码(mask)。
融合单元1906,用于根据生成单元1905生成的2D人脸图像的人脸面部的mask,将变换单元1904进行仿射变换后的第一2D图像和投影单元1903获得的2D人脸图像进行融合,获得第二2D图像,该第二2D图像中人脸面部的朝向与显示屏的垂线平行。
进一步的,电子设备可以包括上述摄像头,该摄像头和显示屏之间存在以下至少一种关系:摄像头的朝向与电子设备的显示屏的朝向不同,摄像头与显示屏之间存在距离。获取单元1901,具体用于通过摄像头采集图像序列,该图像序列中包括第一2D图像。
进一步的,上述摄像头可以为2D摄像头;获取单元1901获取3D人脸模型,具体用于:根据第一2D图像进行人脸3D重建,获得3D人脸模型。此时,该单元可以称为重建单元。
进一步的,获取单元1901根据第一2D图像进行人脸3D重建,获得3D人脸模型具体用于:对第一2D图像进行检测,获取人脸面部的轮廓和特征点的位置,该特征点包括人脸的眉毛,眼睛,鼻子及嘴巴对应位置处的特征点;根据人脸面部的轮廓和特征点的 位置进行人脸3D重建,获得3D人脸模型。
进一步的,校正单元1902具体用于:获取摄像头的朝向与显示屏的朝向的夹角;根据摄像头的朝向与显示屏的朝向的夹角,对3D人脸模型中的3D人脸进行面部朝向校正。
进一步的,投影单元1903具体用于:对校正后的3D人脸模型进行投影,获得人脸投影图像;根据校正3D人脸模型中3D人脸的面部朝向时对3D人脸旋转的角度和方向,对人脸投影图像的中的人脸位置进行调整,获得2D人脸图像。
进一步的,该电子设备还可以包括:检测单元,用于对2D人脸图像进行检测,获取2D人脸图像的控制点的位置,人脸面部的特征点的位置以及人脸面部的轮廓。其中,控制点包括以下至少一个位置处的特征点:人脸的额头对应位置处的特征点,人的颈部对应位置处的控制点;在人脸面部的轮廓中,人脸下巴对应位置处的特征点是2D人脸图像对应位置处的特征点,人脸面部的轮廓中除人脸下巴对应位置处的特征点是第一2D图像对应位置处的特征点。
变换单元1904,具体用于:根据2D人脸图像的人脸面部的特征点的位置,控制点的位置,以及人脸面部的轮廓,对2D人脸图像中的人脸面部图像进行区域划分,得到多个第一区域块;根据第一2D图像的人脸面部的特征点的位置,控制点的位置,以及人脸面部的轮廓,对第一2D图像中的人脸面部图像进行区域划分,得到多个第二区域块,多个第一区域块与多个第二区域块一一对应,第一2D图像的控制点的位置是对第一2D图像进行检测得到的;以2D人脸图像中每个第一区域块为目标,对第一2D图像中对应的每个第二区域块进行仿射变换。
进一步的,上述生成单元1905,还用于对2D人脸图像的人脸面部的mask进行腐蚀处理。
融合单元1906,具体用于根据腐蚀处理后的2D人脸图像的人脸面部的mask,将进行仿射变换后的第一2D图像和2D人脸图像进行融合,获得第二2D图像。
进一步的,生成单元1905,还用于用第二2D图像覆盖第一2D图像对应区域中的图像,生成校正后的图像。
本申请另一些实施例还提供了一种电子设备,用于执行以上实施例中的方法,以实现上述实施例中电子设备的功能。该电子设备可以包括:显示屏;一个或多个处理器;存储器;摄像头(如2D摄像头)。显示屏的朝向和摄像头的朝向不同,和/或,显示屏和摄像头之间存在距离。上述各器件可以通过一个或多个通信总线连接。其中上述存储器中存储一个或多个计算机程序代码,该一个或多个计算机程序代码包括计算机指令,一个或多个处理器用于执行计算机指令,可以用于实现上述图6或图7所示实施例中电子设备的行为功能。显示屏可用于根据一个或多个处理器的指示进行内容的显示,如显示视频会议或视频聊天过程中的画面。
本申请另一些实施例还提供一种计算机可读存储介质,该计算机可读存储介质可包括计算机软件指令,当该计算机软件指令在电子设备上运行时,使得该电子设备执行上述图6或图7所示实施例中电子设备执行的各个步骤。
本申请另一些实施例还提供一种计算机程序产品,当该计算机程序产品在计算机上运行时,使得该计算机执行上述图6或图7所示实施例中电子设备执行的各个步骤。
本申请另一些实施例还提供一种芯片系统,该芯片系统可以应用于电子设备。该电子设备包括显示屏和摄像头(如2D摄像头)。且,显示屏的朝向和摄像头的朝向不同,和/或,显示屏和摄像头之间存在距离。芯片系统包括接口电路和处理器;接口电路和处 理器通过线路互联;接口电路用于从电子设备的存储器接收信号,并向处理器发送信号,信号包括存储器中存储的计算机指令;当处理器执行该计算机指令时,芯片系统执行如上述图6或图7所示实施例中电子设备执行的各个步骤。
本申请实施例提供的电子设备,计算机可读存储介质,计算机程序产品及芯片系统,可以执行上述图6或图7对应的方法实施例电子设备的动作,其实现原理和技术效果类似,在此不再赘述。
通过以上的实施方式的描述,所属领域的技术人员可以清楚地了解到,为描述的方便和简洁,仅以上述各功能模块的划分进行举例说明,实际应用中,可以根据需要而将上述功能分配由不同的功能模块完成,即将装置的内部结构划分成不同的功能模块,以完成以上描述的全部或者部分功能。
在本申请所提供的几个实施例中,应该理解到,所揭露的装置和方法,可以通过其它的方式实现。例如,以上所描述的装置实施例仅仅是示意性的,例如,所述模块或单元的划分,仅仅为一种逻辑功能划分,实际实现时可以有另外的划分方式,例如多个单元或组件可以结合或者可以集成到另一个装置,或一些特征可以忽略,或不执行。另一点,所显示或讨论的相互之间的耦合或直接耦合或通信连接可以是通过一些接口,装置或单元的间接耦合或通信连接,可以是电性,机械或其它的形式。
所述作为分离部件说明的单元可以是或者也可以不是物理上分开的,作为单元显示的部件可以是一个物理单元或多个物理单元,即可以位于一个地方,或者也可以分布到多个不同地方。可以根据实际的需要选择其中的部分或者全部单元来实现本实施例方案的目的。
另外,在本申请各个实施例中的各功能单元可以集成在一个处理单元中,也可以是各个单元单独物理存在,也可以两个或两个以上单元集成在一个单元中。上述集成的单元既可以采用硬件的形式实现,也可以采用软件功能单元的形式实现。
所述集成的单元如果以软件功能单元的形式实现并作为独立的产品销售或使用时,可以存储在一个可读取存储介质中。基于这样的理解,本申请实施例的技术方案本质上或者说对现有技术做出贡献的部分或者该技术方案的全部或部分可以以软件产品的形式体现出来,该软件产品存储在一个存储介质中,包括若干指令用以使得一个设备(可以是单片机,芯片等)或处理器(processor)执行本申请各个实施例所述方法的全部或部分步骤。而前述的存储介质包括:U盘、移动硬盘、只读存储器(Read-Only Memory,ROM)、随机存取存储器(Random Access Memory,RAM)、磁碟或者光盘等各种可以存储程序代码的介质。
以上所述,仅为本申请的具体实施方式,但本申请的保护范围并不局限于此,任何在本申请揭露的技术范围内的变化或替换,都应涵盖在本申请的保护范围之内。因此,本申请的保护范围应以所述权利要求的保护范围为准。

Claims (20)

  1. 一种人脸校正方法,其特征在于,所述方法包括:
    电子设备获取第一二维2D图像,所述第一2D图像中的人脸面部的朝向与所述电子设备的显示屏的垂线不平行;
    所述电子设备获取三维3D人脸模型,所述3D人脸模型中人脸面部的朝向与摄像头捕获所述第一2D图像时用户人脸相对于所述摄像头的朝向相同;
    所述电子设备对所述3D人脸模型中的3D人脸进行面部朝向校正,校正后的所述3D人脸模型中人脸面部的朝向与所述显示屏的垂线平行;
    所述电子设备对校正后的所述3D人脸模型进行投影,获得2D人脸图像,所述2D人脸图像中人脸面部的朝向与所述显示屏的垂线平行;
    所述电子设备以所述2D人脸图像中的人脸面部图像为目标,对所述第一2D图像中的人脸面部图像进行仿射变换;
    所述电子设备生成所述2D人脸图像的人脸面部的掩码mask;
    所述电子设备根据所述2D人脸图像的人脸面部的mask,将进行仿射变换后的第一2D图像和所述2D人脸图像进行融合,获得第二2D图像,所述第二2D图像中人脸面部的朝向与所述显示屏的垂线平行。
  2. 根据权利要求1所述的方法,其特征在于,所述电子设备还包括所述摄像头,所述摄像头和所述显示屏之间存在以下至少一种关系:所述摄像头的朝向与所述显示屏的朝向不同,所述摄像头与所述显示屏之间存在距离;
    所述电子设备获取第一二维2D图像,包括:
    所述电子设备通过所述摄像头采集图像序列,所述图像序列中包括所述第一2D图像。
  3. 根据权利要求1或2所述的方法,其特征在于,所述摄像头为2D摄像头,所述电子设备获取三维3D人脸模型,包括:
    所述电子设备根据所述第一2D图像进行人脸3D重建,获得所述3D人脸模型。
  4. 根据权利要求3所述的方法,其特征在于,所述电子设备根据所述第一2D图像进行人脸3D重建,获得所述3D人脸模型,包括:
    所述电子设备对所述第一2D图像进行检测,获取人脸面部的轮廓和特征点的位置,所述特征点包括人脸的眉毛,眼睛,鼻子及嘴巴对应位置处的特征点;
    所述电子设备根据所述人脸面部的轮廓和特征点的位置进行人脸3D重建,获得所述3D人脸模型。
  5. 根据权利要求1-4中任一项所述的方法,其特征在于,所述电子设备对所述3D人脸模型中的3D人脸进行面部朝向校正,包括:
    所述电子设备获取所述摄像头的朝向与所述显示屏的朝向的夹角;
    所述电子设备根据所述摄像头的朝向与所述显示屏的朝向的夹角,对所述3D人脸模型中的3D人脸进行面部朝向校正。
  6. 根据权利要求1-5中任一项所述的方法,其特征在于,所述电子设备对校正后的所述3D人脸模型进行投影,获得2D人脸图像,包括:
    所述电子设备对校正后的所述3D人脸模型进行投影,获得人脸投影图像;
    所述电子设备根据校正所述3D人脸模型中3D人脸的面部朝向时对3D人脸旋转的角度和方向,对所述人脸投影图像的中的人脸位置进行调整,获得所述2D人脸图像。
  7. 根据权利要求1-6中任一项所述的方法,其特征在于,在获得所述2D人脸图像之后,所述方法还包括:
    所述电子设备对所述2D人脸图像进行检测,获取所述2D人脸图像的控制点的位置,人脸面部的特征点的位置以及人脸面部的轮廓;其中,所述控制点包括以下至少一个位置处的特征点:人脸的额头对应位置处的特征点,人的颈部对应位置处的特征点;在所述人脸面部的轮廓中,人脸下巴对应位置处的特征点是所述2D人脸图像对应位置处的特征点,所述人脸面部的轮廓中除人脸下巴对应位置处的特征点是所述第一2D图像对应位置处的特征点;
    所述电子设备以所述2D人脸图像中的人脸面部图像为目标,对所述第一2D图像中的人脸面部图像进行仿射变换,包括:
    所述电子设备根据所述2D人脸图像的人脸面部的特征点的位置,控制点的位置,以及人脸面部的轮廓,对所述2D人脸图像中的人脸面部图像进行区域划分,得到多个第一区域块;
    所述电子设备根据所述第一2D图像的人脸面部的特征点的位置,控制点的位置,以及人脸面部的轮廓,对所述第一2D图像中的人脸面部图像进行区域划分,得到多个第二区域块,所述多个第一区域块与所述多个第二区域块一一对应,所述第一2D图像的控制点的位置是对所述第一2D图像进行检测得到的;
    所述电子设备以所述2D人脸图像中每个第一区域块为目标,对所述第一2D图像中对应的每个第二区域块进行仿射变换。
  8. 根据权利要求1-7中任一项所述的方法,其特征在于,在所述生成所述2D人脸图像的人脸面部的掩码mask之后,所述方法还包括:
    所述电子设备对所述2D人脸图像的人脸面部的mask进行腐蚀处理;
    所述电子设备根据所述2D人脸图像的人脸面部的mask,将进行仿射变换后的第一2D图像和所述2D人脸图像进行融合,获得第二2D图像,包括:
    所述电子设备根据腐蚀处理后的所述2D人脸图像的人脸面部的mask,将进行仿射变换后的第一2D图像和所述2D人脸图像进行融合,获得所述第二2D图像。
  9. 根据权利要求1-8中任一项所述的方法,其特征在于,在获得所述第二2D图像后,所述方法还包括:
    所述电子设备用所述第二2D图像覆盖所述第一2D图像对应区域中的图像,生成校正后的图像。
  10. 一种电子设备,其特征在于,所述电子设备包括:处理器,存储器和显示屏;所述处理器,所述存储器以及所述显示屏耦合,所述存储器用于存储计算机程序代码,所述计算机程序代码包括计算机指令,当所述计算机指令被所述电子设备执行时,使得所述电子设备执行如下操作:
    获取第一二维2D图像,所述第一2D图像中的人脸面部的朝向与所述显示屏的垂线不平行;
    获取三维3D人脸模型,所述3D人脸模型中人脸面部的朝向与摄像头捕获所述第一2D图像时用户人脸相对于所述摄像头的朝向相同;
    对所述3D人脸模型中的3D人脸进行面部朝向校正,校正后的所述3D人脸模型中人脸面部的朝向与所述显示屏的垂线平行;
    对校正后的所述3D人脸模型进行投影,获得2D人脸图像,所述2D人脸图像中人脸 面部的朝向与所述显示屏的垂线平行;
    以所述2D人脸图像中的人脸面部图像为目标,对所述第一2D图像中的人脸面部图像进行仿射变换;
    生成所述2D人脸图像的人脸面部的掩码mask;
    根据所述2D人脸图像的人脸面部的mask,将进行仿射变换后的第一2D图像和所述2D人脸图像进行融合,获得第二2D图像,所述第二2D图像中人脸面部的朝向与所述显示屏的垂线平行。
  11. 根据权利要求10所述的电子设备,其特征在于,所述电子设备还包括所述摄像头,所述摄像头和所述显示屏之间存在以下至少一种关系:所述摄像头的朝向与所述显示屏的朝向不同,所述摄像头与所述显示屏之间存在距离;
    所述获取第一二维2D图像,具体为:通过所述摄像头采集图像序列,所述图像序列中包括所述第一2D图像。
  12. 根据权利要求10或11所述的电子设备,其特征在于,所述摄像头为2D摄像头,所述获取三维3D人脸模型,具体为:根据所述第一2D图像进行人脸3D重建,获得所述3D人脸模型。
  13. 根据权利要求12所述的电子设备,其特征在于,所述根据所述第一2D图像进行人脸3D重建,获得所述3D人脸模型,具体为:
    对所述第一2D图像进行检测,获取人脸面部的轮廓和特征点的位置,所述特征点包括人脸的眉毛,眼睛,鼻子及嘴巴对应位置处的特征点;
    根据所述人脸面部的轮廓和特征点的位置进行人脸3D重建,获得所述3D人脸模型。
  14. 根据权利要求10-13中任一项所述的电子设备,其特征在于,所述对所述3D人脸模型中的3D人脸进行面部朝向校正,具体为:
    获取所述摄像头的朝向与所述显示屏的朝向的夹角;
    根据所述摄像头的朝向与所述显示屏的朝向的夹角,对所述3D人脸模型中的3D人脸进行面部朝向校正。
  15. 根据权利要求10-14中任一项所述的电子设备,其特征在于,所述对校正后的所述3D人脸模型进行投影,获得2D人脸图像,具体为:
    对校正后的所述3D人脸模型进行投影,获得人脸投影图像;
    根据校正所述3D人脸模型中3D人脸的面部朝向时对3D人脸旋转的角度和方向,对所述人脸投影图像的中的人脸位置进行调整,获得所述2D人脸图像。
  16. 根据权利要求10-15中任一项所述的电子设备,其特征在于,当所述计算机指令被所述电子设备执行时,还使得所述电子设备执行如下操作:
    对所述2D人脸图像进行检测,获取所述2D人脸图像的控制点的位置,人脸面部的特征点的位置以及人脸面部的轮廓;其中,所述控制点包括以下至少一个位置处的特征点:人脸的额头对应位置处的特征点,人的颈部对应位置处的特征点;在所述人脸面部的轮廓中,人脸下巴对应位置处的特征点是所述2D人脸图像对应位置处的特征点,所述人脸面部的轮廓中除人脸下巴对应位置处的特征点是所述第一2D图像对应位置处的特征点;
    所述以所述2D人脸图像中的人脸面部图像为目标,对所述第一2D图像中的人脸面部图像进行仿射变换,具体为:
    根据所述2D人脸图像的人脸面部的特征点的位置,控制点的位置,以及人脸面部的 轮廓,对所述2D人脸图像中的人脸面部图像进行区域划分,得到多个第一区域块;
    根据所述第一2D图像的人脸面部的特征点的位置,控制点的位置,以及人脸面部的轮廓,对所述第一2D图像中的人脸面部图像进行区域划分,得到多个第二区域块,所述多个第一区域块与所述多个第二区域块一一对应,所述第一2D图像的控制点的位置是对所述第一2D图像进行检测得到的;
    以所述2D人脸图像中每个第一区域块为目标,对所述第一2D图像中对应的每个第二区域块进行仿射变换。
  17. 根据权利要求10-16中任一项所述的电子设备,其特征在于,当所述计算机指令被所述电子设备执行时,还使得所述电子设备执行如下操作:
    对所述2D人脸图像的人脸面部的mask进行腐蚀处理;
    所述根据所述2D人脸图像的人脸面部的mask,将进行仿射变换后的第一2D图像和所述2D人脸图像进行融合,获得第二2D图像,具体为:根据腐蚀处理后的所述2D人脸图像的人脸面部的mask,将进行仿射变换后的第一2D图像和所述2D人脸图像进行融合,获得所述第二2D图像。
  18. 根据权利要求10-17中任一项所述的电子设备,其特征在于,当所述计算机指令被所述电子设备执行时,还使得所述电子设备执行如下操作:
    用所述第二2D图像覆盖所述第一2D图像对应区域中的图像,生成校正后的图像。
  19. 一种计算机可读存储介质,其特征在于,包括:计算机软件指令;
    当所述计算机软件指令在电子设备中运行时,使得所述电子设备执行如权利要求1至9中任一项所述的人脸校正方法。
  20. 一种计算机程序产品,其特征在于,当所述计算机程序产品在计算机上运行时,使得所述计算机执行如权利要求1至9中任一项所述的人脸校正方法。
PCT/CN2020/095787 2019-06-14 2020-06-12 一种人脸校正方法及电子设备 WO2020249076A1 (zh)

Applications Claiming Priority (2)

Application Number Priority Date Filing Date Title
CN201910514753.7A CN112085647B (zh) 2019-06-14 2019-06-14 一种人脸校正方法及电子设备
CN201910514753.7 2019-06-14

Publications (1)

Publication Number Publication Date
WO2020249076A1 true WO2020249076A1 (zh) 2020-12-17

Family

ID=73733861

Family Applications (1)

Application Number Title Priority Date Filing Date
PCT/CN2020/095787 WO2020249076A1 (zh) 2019-06-14 2020-06-12 一种人脸校正方法及电子设备

Country Status (2)

Country Link
CN (1) CN112085647B (zh)
WO (1) WO2020249076A1 (zh)

Cited By (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN112927354A (zh) * 2021-02-25 2021-06-08 电子科技大学 基于实例分割的三维重建方法、系统、存储介质及终端
US20230045610A1 (en) * 2021-08-03 2023-02-09 Dell Products, L.P. Eye contact correction in a communication or collaboration session using a platform framework
CN116824026A (zh) * 2023-08-28 2023-09-29 华东交通大学 一种三维重建方法、装置、系统以及存储介质

Families Citing this family (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN113689361B (zh) * 2021-10-27 2022-02-22 深圳市慧鲤科技有限公司 图像处理方法及装置、电子设备和存储介质

Citations (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN104992417A (zh) * 2015-06-30 2015-10-21 上海交通大学 基于Kinect的人脸视频目光修正方法及系统
CN105763829A (zh) * 2014-12-18 2016-07-13 联想(北京)有限公司 一种图像处理方法及电子设备
CN105989577A (zh) * 2015-02-17 2016-10-05 中兴通讯股份有限公司 一种图像校正的方法和装置
CN106981078A (zh) * 2017-04-14 2017-07-25 广州视源电子科技股份有限公司 视线校正方法、装置、智能会议终端及存储介质
US20170262970A1 (en) * 2015-09-11 2017-09-14 Ke Chen Real-time face beautification features for video images
CN107392844A (zh) * 2017-07-27 2017-11-24 三星电子(中国)研发中心 一种修正人像视线的方法和设备

Family Cites Families (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
KR101977638B1 (ko) * 2012-02-29 2019-05-14 삼성전자주식회사 영상 내 사용자의 시선 보정 방법, 기계로 읽을 수 있는 저장 매체 및 통신 단말
CN108491775B (zh) * 2018-03-12 2021-04-23 维沃移动通信有限公司 一种图像修正方法及移动终端
CN109685740B (zh) * 2018-12-25 2023-08-11 努比亚技术有限公司 人脸校正的方法及装置、移动终端及计算机可读存储介质

Patent Citations (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN105763829A (zh) * 2014-12-18 2016-07-13 联想(北京)有限公司 一种图像处理方法及电子设备
CN105989577A (zh) * 2015-02-17 2016-10-05 中兴通讯股份有限公司 一种图像校正的方法和装置
CN104992417A (zh) * 2015-06-30 2015-10-21 上海交通大学 基于Kinect的人脸视频目光修正方法及系统
US20170262970A1 (en) * 2015-09-11 2017-09-14 Ke Chen Real-time face beautification features for video images
CN106981078A (zh) * 2017-04-14 2017-07-25 广州视源电子科技股份有限公司 视线校正方法、装置、智能会议终端及存储介质
CN107392844A (zh) * 2017-07-27 2017-11-24 三星电子(中国)研发中心 一种修正人像视线的方法和设备

Cited By (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN112927354A (zh) * 2021-02-25 2021-06-08 电子科技大学 基于实例分割的三维重建方法、系统、存储介质及终端
US20230045610A1 (en) * 2021-08-03 2023-02-09 Dell Products, L.P. Eye contact correction in a communication or collaboration session using a platform framework
CN116824026A (zh) * 2023-08-28 2023-09-29 华东交通大学 一种三维重建方法、装置、系统以及存储介质
CN116824026B (zh) * 2023-08-28 2024-01-09 华东交通大学 一种三维重建方法、装置、系统以及存储介质

Also Published As

Publication number Publication date
CN112085647A (zh) 2020-12-15
CN112085647B (zh) 2024-01-19

Similar Documents

Publication Publication Date Title
WO2020249076A1 (zh) 一种人脸校正方法及电子设备
US11782554B2 (en) Anti-mistouch method of curved screen and electronic device
WO2020192458A1 (zh) 一种图像处理的方法及头戴式显示设备
CN113422903B (zh) 拍摄模式切换方法、设备、存储介质
WO2021057277A1 (zh) 一种暗光下拍照的方法及电子设备
WO2020134877A1 (zh) 一种皮肤检测方法及电子设备
CN113810601B (zh) 终端的图像处理方法、装置和终端设备
CN110458902B (zh) 3d光照估计方法及电子设备
CN113741681B (zh) 一种图像校正方法与电子设备
WO2021104104A1 (zh) 一种高能效的显示处理方法及设备
WO2021164289A1 (zh) 人像处理方法和装置以及终端
CN113810600A (zh) 终端的图像处理方法、装置和终端设备
WO2021175266A1 (zh) 身份验证方法、装置和电子设备
EP4361954A1 (en) Object reconstruction method and related device
WO2020015144A1 (zh) 一种拍照方法及电子设备
CN114429495A (zh) 一种三维场景的重建方法和电子设备
EP4131063A1 (en) Eye bag detection method and device
US20210385890A1 (en) Augmented reality communication method and electronic device
CN113518189B (zh) 拍摄方法、系统、电子设备及存储介质
CN113781548A (zh) 多设备的位姿测量方法、电子设备及系统
CN113496477A (zh) 屏幕检测方法及电子设备
CN113850709A (zh) 图像变换方法和装置
CN115150542B (zh) 一种视频防抖方法及相关设备
WO2022033344A1 (zh) 视频防抖方法、终端设备和计算机可读存储介质
CN114302063B (zh) 一种拍摄方法及设备

Legal Events

Date Code Title Description
121 Ep: the epo has been informed by wipo that ep was designated in this application

Ref document number: 20823327

Country of ref document: EP

Kind code of ref document: A1

NENP Non-entry into the national phase

Ref country code: DE

122 Ep: pct application non-entry in european phase

Ref document number: 20823327

Country of ref document: EP

Kind code of ref document: A1