WO2020252910A1 - Image distortion correction method, apparatus, electronic device and readable storage medium - Google Patents

Image distortion correction method, apparatus, electronic device and readable storage medium Download PDF

Info

Publication number
WO2020252910A1
WO2020252910A1 PCT/CN2019/102870 CN2019102870W WO2020252910A1 WO 2020252910 A1 WO2020252910 A1 WO 2020252910A1 CN 2019102870 W CN2019102870 W CN 2019102870W WO 2020252910 A1 WO2020252910 A1 WO 2020252910A1
Authority
WO
WIPO (PCT)
Prior art keywords
face
image
corrected
distortion correction
relative distance
Prior art date
Application number
PCT/CN2019/102870
Other languages
French (fr)
Chinese (zh)
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 WO2020252910A1 publication Critical patent/WO2020252910A1/en

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/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/80Geometric correction
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06TIMAGE DATA PROCESSING OR GENERATION, IN GENERAL
    • G06T2207/00Indexing scheme for image analysis or image enhancement
    • G06T2207/10Image acquisition modality
    • G06T2207/10004Still image; Photographic image
    • 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/20081Training; Learning
    • 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/20084Artificial neural networks [ANN]
    • 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 technical field of graphics and image processing, and in particular to an image distortion correction method, device, electronic equipment, and readable storage medium.
  • an electronic device such as a smart phone, a tablet computer, etc.
  • the front camera of an electronic device to take a self-portrait photo with multiple people is an important use scene in taking pictures.
  • the physical distance of the photographer from the lens usually cannot exceed the length of the arm, while the other people in the group photo do not have the physical limitation of hand-held electronic devices, and can freely choose a suitable location for shooting.
  • the photographer in the group photo is usually the person closest to the lens, which will cause the face of the photographer holding the electronic device to be distorted when multiple people take a group photo. This distortion will be more obvious when a group photo is taken.
  • the face of the photographer will look abnormal compared to other people, which will affect the shooting effect.
  • one of the objectives of the embodiments of the present application is to provide an image distortion correction method, device, electronic device, and readable storage medium, which can automatically recognize the face to be corrected for distortion correction in real time when multiple people take a selfie together. In order to optimize the shooting effect in the multi-person selfie photo scene.
  • the present application provides an electronic device, which may include one or more storage media and one or more processors in communication with the storage media.
  • One or more storage media stores machine executable instructions executable by the processor.
  • the processor executes the machine executable instructions to execute the image distortion correction method.
  • the present application also provides an image distortion correction method, which is applied to electronic equipment, and the method includes:
  • Distortion correction is performed on the face to be corrected according to the relative distance coefficient to obtain a target image after distortion correction.
  • the step of performing face recognition on the image to be corrected to obtain face frame information and face key points corresponding to at least two faces in the image to be corrected includes:
  • face recognition is performed on the frame of the image to be corrected through the face recognition model obtained in advance to obtain the face frame information corresponding to each face in the frame of the image to be corrected And key points of the face;
  • the face recognition model uses multiple training samples and the labeled data of each training sample to be obtained based on deep learning neural network training, where the labeled data of each training sample includes the face frame corresponding to each face in the training sample Key points of information and faces.
  • the method further includes:
  • the face image is rotated to the set position using the affine matrix.
  • the method further includes:
  • a pre-trained age estimation model is used to recognize the face image to obtain the face age in the face image;
  • the size of the face frame of the face image is corrected according to the age of the face in the face image.
  • the electronic device pre-stores the median of the face circumference corresponding to the age of each face, and the size of the face frame of the face image is performed according to the face age in the face image.
  • the corrective steps include:
  • the size of the face frame of the face image is corrected according to the face frame correction coefficient.
  • the step of determining the face to be corrected in the image to be corrected according to the face frame information corresponding to each recognized face, and calculating the relative distance coefficient between the face to be corrected and the camera lens include:
  • the face frame information corresponding to each face determine the face with the largest face frame area as the face to be corrected
  • the step of calculating the relative distance coefficient between the face to be corrected and the camera lens includes:
  • the relative distance coefficient between the face to be corrected and the camera lens is calculated according to the sum of the squared values of the difference.
  • the specific calculation formula is:
  • d is the relative distance coefficient between the face to be corrected and the camera lens
  • N is the number of faces
  • x i is the area of the ith face frame
  • r is the average area of the face frame corresponding to all faces.
  • the step of calculating the relative distance coefficient between the face to be corrected and the camera lens includes:
  • the relative distance coefficient between the face to be corrected and the camera lens is calculated according to the weight coefficients corresponding to the preset first ratio and second ratio, the first ratio and the second ratio, and the specific calculation formula is:
  • d is the relative distance coefficient between the face to be corrected and the camera lens
  • a max is the maximum number area corresponding to the face frame of the face other than the face to be corrected
  • a mid is the face to be corrected
  • K is a constant between 0 and 1
  • y is the face frame area of the face to be repaired.
  • the electronic device pre-stores a plurality of distortion correction parameters corresponding to preset distance coefficients, and the distortion correction is performed on the face to be corrected according to the relative distance coefficients to obtain the target image after the distortion correction.
  • the steps include:
  • the preset distance coefficient range including a first endpoint value and a second endpoint value, the first endpoint value is less than the second endpoint value;
  • the target distortion correction parameter is obtained by the following calculation formula:
  • z is the target distortion correction parameter
  • d is the relative distance coefficient between the face to be corrected and the camera lens
  • d 1 is the first endpoint value
  • d 2 is the second endpoint value
  • c 1 is the The distortion correction parameter corresponding to the first endpoint value
  • c 2 is the distortion correction parameter corresponding to the first endpoint value.
  • the step of performing distortion correction on the face to be corrected according to the target distortion correction parameter to obtain a target image after the distortion correction includes:
  • the face to be corrected is mapped to the adjusted face grid to obtain a target image after distortion correction.
  • the method further includes:
  • the step of determining the face to be corrected in the image to be corrected according to the face frame information corresponding to each recognized face includes:
  • the face frame information corresponding to each face it is determined that the face with the largest face frame area is the face to be corrected.
  • the step of calculating the relative distance coefficient between the face to be corrected and the camera lens includes:
  • the relative distance coefficient between the face to be corrected and the camera is calculated according to the area of the face frame of each face.
  • the method further includes:
  • the size of the face frame of each face image is corrected according to the face age corresponding to each face image.
  • the method further includes:
  • the face image is rotated to the set position using the affine matrix.
  • the present application also provides an image distortion correction device applied to electronic equipment, and the device includes:
  • a recognition module configured to perform face recognition on the image to be corrected, and obtain face frame information and face key points corresponding to at least two faces in the image to be corrected;
  • a calculation module configured to determine the face to be corrected in the image to be corrected according to the face frame information corresponding to each recognized face, and calculate the relative distance coefficient between the face to be corrected and the camera lens;
  • the distortion correction module is configured to perform distortion correction on the face to be corrected according to the relative distance coefficient to obtain a target image after distortion correction.
  • the present application also provides a readable storage medium having machine executable instructions stored on the readable storage medium, and the computer program can execute the steps of the above-mentioned image distortion correction method when the computer program is run by the processor.
  • the embodiment of the present application obtains face frame information and face key points corresponding to at least two faces in the image to be corrected by performing face recognition on the image to be corrected, and then according to the face corresponding to each recognized face
  • the frame information determines the face to be corrected in the image to be corrected, and calculates the relative distance coefficient between the face to be corrected and the camera lens, and then performs distortion correction on the face to be corrected according to the relative distance coefficient to obtain a target image after distortion correction.
  • FIG. 1 shows one of the schematic flowcharts of the image distortion correction method provided by the embodiment of the present application
  • FIG. 2 shows a schematic diagram of a face frame corresponding to a recognized face provided by an embodiment of the present application
  • FIG. 3 shows the second schematic flowchart of the image distortion correction method provided by the embodiment of the present application
  • FIG. 4 shows a schematic diagram of a photographing preview interface of an electronic device before image distortion correction provided by an embodiment of the present application
  • FIG. 5 shows a schematic diagram of a photographing preview interface of an electronic device after image distortion correction provided by an embodiment of the present application
  • FIG. 6 shows one of the schematic block diagrams of the functional modules of the image distortion correction device included in the electronic device provided by the embodiment of the present application
  • FIG. 7 shows the second schematic block diagram of the functional modules of the image distortion correction apparatus included in the electronic device provided by the embodiment of the present application.
  • the inventor of the present application has discovered through research that in a scene where multiple people are photographed together, the photographer will distort his face when he is close to the lens, the face area will be enlarged, and the other people in the group photo will be relative to the photographer. Usually the distance from the lens is farther, which will cause the distortion of the photographer's face area to be enlarged in the contrast.
  • Current distortion correction methods mostly use general face-lifting or head-shrinking schemes to reduce distortion, but they cannot automatically perform distortion processing on the photographers in the group photo in real-time for multi-person selfie photo scenes.
  • the inventor proposes the following technical solutions to solve or improve the above problems. It should be noted that the defects in the above solutions in the prior art are the results of the inventors after practice and careful study. Therefore, the discovery process of the above problems and the following embodiments of the application address the above problems.
  • the proposed solutions should all be contributions made by the inventor to the application in the process of invention and creation, and should not be understood as technical content known to those skilled in the art.
  • Figure 1 shows a schematic flow chart of an image distortion correction method provided by an embodiment of the present application. It should be understood that in other embodiments, the sequence of some steps of the image distortion correction method of this embodiment may not be specifically implemented as shown in Figure 1 and below. The order of the examples is limited, for example, they can be exchanged according to actual needs, or some of the steps can also be omitted or deleted. The detailed steps of the image distortion correction method are introduced as follows.
  • Step S110 Perform face recognition on the image to be corrected to obtain face frame information and face key points corresponding to at least two human faces in the image to be corrected.
  • Step S120 Determine the face to be corrected in the image to be corrected according to the face frame information corresponding to each recognized face, and calculate the relative distance coefficient between the face to be corrected and the camera lens.
  • Step S130 performing distortion correction on the face to be corrected according to the relative distance coefficient to obtain a target image after distortion correction.
  • this embodiment can automatically recognize the face to be corrected in real time when multiple people take a selfie together to correct the distortion based on the calculated relative distance coefficient between the face to be corrected and the camera lens, thereby optimizing the multi-person selfie scene The shooting effect.
  • step S110 after the camera start instruction is detected, the camera is turned on and the shooting preview interface is entered.
  • the manner of detecting the camera start instruction may be different.
  • the camera can be turned on when the camera control triggered by the photographer on the interactive interface is detected; for example, the camera can be turned on when the camera voice command sent by the photographer is received; for example, you can also When it is detected that the action of the photographer is consistent with the preset action of taking a picture, a camera start instruction is obtained.
  • the camera When the camera start instruction is detected, the camera is turned on and enters the shooting preview interface.
  • the shooting preview interface In the shooting preview interface, the image of the current shooting scene acquired by the camera can be displayed in real time.
  • the image to be corrected may be each frame of the image displayed in the shooting preview interface.
  • face recognition can be performed on the frame of the image to be corrected through the face recognition model obtained in advance to obtain each person in the frame of the image to be corrected.
  • the face recognition model can be obtained by training based on a deep learning neural network (for example, YOLO neural network, Fast-RCNN neural network, MTCNN neural network, etc.) using multiple training samples and label data of each training sample.
  • the labeled data of each training sample may include face frame information and face key points corresponding to each face in the training sample.
  • the face frame information corresponding to each face may include face ID information, coordinate information of the vertices of the face frame, width information and height information of the face frame, etc.
  • the key points of the face may include various parts of the face.
  • the feature points and the geometric relationship between each feature point may include face ID information, coordinate information of the vertices of the face frame, width information and height information of the face frame, etc.
  • FIG. 2 a schematic diagram of a face frame F corresponding to a recognized face is shown.
  • the face frame F covers the face area
  • the face frame information may include the width W, height H, and vertex coordinates Q of the face frame shown in Figure 2
  • the face frame F The area is the product of the width W and the height H of the face frame F.
  • the width W and height H of the face frame F are adaptively adjusted during the recognition process.
  • the vertex coordinate Q of the face frame F can be selected according to actual needs.
  • the vertex coordinate Q shown in FIG. 2 is the vertex coordinate of the upper right corner of the face frame.
  • the vertex coordinate Q of the face frame can also be selected. Select the vertex coordinates of the upper left corner, the vertex coordinates of the lower left corner, or the vertex coordinates of the lower right corner, or any combination of the foregoing, and this embodiment does not impose any limitation on this.
  • the face recognition model obtained through neural network training based on deep learning can identify the face frame information and face key points corresponding to each face in the image to be corrected, so as to facilitate subsequent use of the face corresponding to each face
  • the frame information and key points of the face are corrected for distortion.
  • the inventor also discovered in the process of research that usually in the video stream in the above-mentioned shooting preview interface, these faces may exist due to the deviation of the head of the subject, the camera shake, the relative position of the lens, etc. In the case of skew, the subsequent determination of the area of the face image will affect the distortion correction effect of the image.
  • a corresponding face image can be cropped according to the face frame information corresponding to the face.
  • the cropping area of the face can be determined according to the coordinate information of the vertices of the face frame corresponding to the face, the width information and the height information of the face frame, and then the corresponding face image can be cropped according to the determined cropping area.
  • the face image is rotated to the set position using the affine matrix.
  • the difference between each face key template point in the standard face template stored in advance and the face key point corresponding to the face can be used to calculate the rotation parameter for rotating the face image using the affine matrix,
  • the face key points corresponding to the face image are rotated to the corresponding positions determined according to the rotation parameters to obtain the face image after the straightening. In this way, it can be avoided that these faces may be skewed due to the deflection of the head of the subject, the camera shake, or the offset of the relative position of the lens.
  • the inventor also discovered in the process of research that usually when there are children in a group photo, due to the camera, the video stream in the above-mentioned shooting preview interface may cause the children to have a little distortion compared to other adults.
  • the actual image of the child is different from the real image, which affects the shooting effect.
  • a pre-trained age estimation model is used to recognize the face image, and the face image in the face image is obtained. Face age, and judge whether the face age in the face image is greater than the set age, if the face age in the face image is less than the set age, then the face age in the face image The size of the face frame of the face image is corrected.
  • the electronic device may pre-store the median of the face circumference corresponding to the age of each face, and then the face frame of the face image according to the face age in the face image
  • the size correction method can be as follows: First, obtain the first median of the face circumference corresponding to the age of the face in the face image and the second median of the face circumference corresponding to the set age Then, the face frame correction coefficient is calculated according to the first median and the second median, and finally the face frame size of the face image is corrected according to the face frame correction coefficient.
  • the face age in the face image is 10 years old as an example
  • the first median of the face circumference corresponding to 10 years old is b 1
  • the face circumference corresponding to 18 years old The first median of is b 2
  • the calculated face frame correction coefficient is b 1 /b 2 .
  • the method of correcting the size of the face frame of the face image according to the face frame correction coefficient may be: using the face frame correction coefficient b 1 /b 2 to respectively correct the face image of the face image.
  • the side length and area of the face frame are corrected.
  • the median face circumference corresponding to the age of each face can be obtained by collecting a large number of samples of different ages.
  • the specific data can be fine-tuned according to actual needs, which is not specifically limited in this embodiment.
  • step S120 as a possible implementation manner, according to the face frame information corresponding to each face, the face with the largest face frame area may be determined as the face to be corrected, and the face to be corrected may be calculated The relative distance coefficient between the face and the camera lens.
  • the average area of the face frame corresponding to all recognized faces can be calculated, and then the area of the face frame corresponding to each face can be calculated as compared with the average area. And finally calculate the relative distance coefficient between the face to be corrected and the camera lens according to the sum of the square difference values.
  • the specific calculation formula of the relative distance coefficient can be:
  • d is the relative distance coefficient between the face to be corrected and the camera lens
  • N is the number of faces
  • x i is the area of the ith face frame
  • r is the average area of the face frame corresponding to all faces.
  • the median area and the maximum number area corresponding to the face frame of the face other than the face to be corrected it is also possible to obtain the median area and the person whose face is to be corrected
  • the first ratio of the face frame area and the second ratio of the maximum number area to the face frame area of the face to be corrected and finally according to the weight coefficients corresponding to the preset first and second ratios, the The first ratio and the second ratio calculate a relative distance coefficient between the face to be corrected and the camera lens.
  • the specific calculation formula of the relative distance coefficient can be:
  • d is the relative distance coefficient between the face to be corrected and the camera lens
  • a max is the maximum number area corresponding to the face frame of the face other than the face to be corrected
  • a mid is the face to be corrected
  • K is a constant between 0 and 1
  • y is the face frame area of the face to be repaired.
  • the electronic device may pre-store a plurality of distortion correction parameters corresponding to preset distance coefficients, so that when the relative distance coefficient obtained in step S120 is a preset distance coefficient stored in advance, it can be directly obtained
  • the distortion correction parameter corresponding to the relative distance coefficient In a real scene, the relative distance coefficient obtained in step S120 is usually difficult to match the accurate preset distance coefficient. It is very difficult to collect all the distortion correction parameters corresponding to the preset distance coefficient. In addition, if the relative distance coefficient obtained in step S120 is matched with the distortion correction parameter corresponding to the similar preset distance coefficient, there will be a distortion correction error.
  • the preset distance coefficient range may include a first endpoint value and a second endpoint value, and the first endpoint value is smaller than the second endpoint value.
  • the corresponding target distortion correction parameter is calculated according to the first endpoint value, the first difference value, the second difference value, and the third difference value.
  • the target distortion correction parameter can be obtained by the following calculation formula:
  • z is the target distortion correction parameter
  • d is the relative distance coefficient between the face to be corrected and the camera lens
  • d 1 is the first endpoint value
  • d 2 is the second endpoint value
  • c 1 is the The distortion correction parameter corresponding to the first endpoint value
  • c 2 is the distortion correction parameter corresponding to the first endpoint value.
  • the target distortion correction parameter is:
  • the human face to be corrected may be subjected to distortion correction according to the target distortion correction parameter to obtain a target image after distortion correction.
  • first establish the face grid of the face to be corrected determine each constraint point in the face grid, and then calculate the face grid in the face grid according to the target distortion correction parameter
  • the constraint deformation variables of each constraint point are then adjusted according to the calculated constraint deformation variables of each constraint point to obtain the adjusted face grid, and the face to be corrected is mapped to the adjustment After the face grid, the target image after distortion correction is obtained.
  • the image distortion correction method provided in this embodiment may further include the following steps:
  • Step S140 Display each target image after distortion correction in the shooting preview interface in real time, and when a shooting instruction is detected, the target image currently displayed in the shooting preview interface is taken as the shooting image and stored in the shooting preview interface. Mentioned in electronic equipment.
  • each target image after distortion correction is displayed in the shooting preview interface in real time, so that the photographer can see the target image after distortion correction instead of the target image that has been distorted before taking a picture. Correct the image. Later, when you need to take a picture, you can press the shooting button, and when a shooting instruction is detected, the target image currently displayed in the shooting preview interface is used as the shooting image and stored in the electronic device.
  • face recognition can be performed on the image to be corrected first to obtain face frame information and face key points corresponding to at least two faces in the image to be corrected. Then, according to the face frame information corresponding to each recognized face, the face to be corrected in the image to be corrected is determined, and the relative distance coefficient between the face to be corrected and the camera lens is calculated. Then, distortion correction is performed on the face to be corrected according to the relative distance coefficient to obtain a target image after distortion correction.
  • the face frame area corresponding to the user is the largest, and the face image of the user is the image that needs to be corrected. Therefore, in this embodiment, it is possible to determine the face with the largest face frame area as the face to be corrected according to the face frame information corresponding to each face, and then calculate the relative distance between the face to be corrected and the camera lens coefficient.
  • the face to be corrected when correcting the face to be corrected, the face to be corrected needs to be corrected to the size of the other faces in the image to be corrected. Therefore, in the embodiment, it can be calculated according to the area of the face frame of each face The relative distance coefficient between the face to be corrected and the camera. For the specific calculation method of the distance coefficient, please refer to the preceding text, which will not be repeated here.
  • the face age corresponding to each face image in the image to be corrected can be identified first, and the face frame size of each face image is corrected according to the face age corresponding to each face image, and then Then perform the determination of the face to be corrected or the calculation of the relative distance coefficient. In this way, the influence of the size of the child's face on the subsequent determination of the face to be corrected and the calculation of the relative distance can be reduced.
  • the previous text for specific correction methods please refer to the previous text for specific correction methods, so I won't repeat them here.
  • the skew of the face image being photographed when self-calculating the size of the face frame may cause the calculation of the face frame size to be inaccurate, thereby affecting subsequent calculations
  • the corresponding face image is cut out according to the face frame information corresponding to the face; according to the person corresponding to the face Face key points, using an affine matrix to rotate the face image to a set position. In this way, the calculation results of the subsequent calculation steps based on the size of the face frame can be made more accurate.
  • the photographer in a multi-person photo scene in daily life, such as taking a group photo of people while traveling, usually the photographer holds the electronic device while the rest of the people choose a suitable location to take the photo.
  • the electronic device turns on the camera B4 and displays the shooting preview interface L.
  • the shooting preview interface L displays the real-time video stream of the group photo in the travel scene obtained by the camera B4 .
  • the photographer can also select the shooting mode button B2 to choose front camera or rear camera, but whether it is front camera or rear camera, the photographer is the person closest to the camera B4, which will cause the group to take a selfie
  • the face of the photographer (the face to be corrected) Face0 will be distorted. It can be seen from Figure 4 that this distortion will be more obvious when a group photo is taken.
  • the image distortion correction method provided in the embodiment of the present application is adopted, as shown in FIG. 5, the distortion of the face of the photographer's face after correction is obviously greatly improved. Therefore, each time the shooting preview interface L displays the video stream after distortion correction, thereby optimizing the shooting effect in the multi-person selfie photo scene.
  • the image currently displayed in the shooting preview interface L can be used as a shooting image and stored, and the just stored shooting image can also be viewed through the shooting image preview frame B3.
  • FIG. 6 shows a schematic diagram of an electronic device 100 provided by an embodiment of the present application.
  • the electronic device 100 may include a storage medium 110, a processor 120, and an image distortion correction device 130.
  • the processor 120 may be a general-purpose central processing unit (Central Processing Unit, CPU), a microprocessor, an application-specific integrated circuit (ASIC), or one or more for controlling the implementation of the foregoing methods
  • CPU Central Processing Unit
  • ASIC application-specific integrated circuit
  • the example provides an integrated circuit for program execution of the image distortion correction method.
  • the storage medium 110 may be ROM or other types of static storage devices that can store static information and instructions, RAM or other types of dynamic storage devices that can store information and instructions, or may be an electrically erasable programmable read-only memory (Electrically Erasable Programmable Read Only Memory). Programmable-Only Memory, EEPROM), CD-ROM (Compact disc Read-Only Memory, CD-ROM) or other optical disc storage, optical disc storage (including compact discs, laser discs, optical discs, digital versatile discs, Blu-ray discs, etc.), magnetic disks A storage medium or other magnetic storage device, or any other medium that can be used to carry or store desired program codes in the form of instructions or data structures and that can be accessed by a computer, but is not limited thereto.
  • EEPROM Electrically erasable programmable read-only memory
  • CD-ROM Compact disc Read-Only Memory
  • CD-ROM Compact disc Read-Only Memory
  • optical disc storage including compact discs, laser discs, optical discs, digital versatile discs, Blu
  • the storage medium 110 may exist independently and is connected to the processor 120 through a communication bus.
  • the storage medium 110 may also be integrated with the processor.
  • the storage medium 110 is configured to store application program codes for executing the solution of the present application, such as the image distortion correction device 130 shown in FIG. 5, and is controlled by the processor 120 to execute.
  • the processor 120 is configured to execute application program codes stored in the storage medium 110, such as the image distortion correction device 130, to execute the image distortion correction method of the foregoing method embodiment.
  • the present application may divide the image distortion correction device 130 into functional modules according to the foregoing method embodiments.
  • 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 this application is illustrative and only a logical function division, and there may be other division methods in actual implementation.
  • the image distortion correction device 130 shown in FIG. 6 is only a schematic diagram of the device.
  • the image distortion correction device 130 shown in FIG. 6 may include an identification module 131, a calculation module 132, and a distortion correction module 133. The functions of each functional module of the image distortion correction device 130 are respectively described in detail below.
  • the recognition module 131 is configured to perform face recognition on the image to be corrected to obtain face frame information and face key points corresponding to at least two human faces in the image to be corrected. It can be understood that the identification module 131 may be configured to execute the above step S110, and for the detailed implementation of the identification module 131, please refer to the content related to the above step S110.
  • the calculation module 132 is configured to determine the face to be corrected in the image to be corrected according to the face frame information corresponding to each recognized face, and to calculate the relative distance coefficient between the face to be corrected and the camera lens. It can be understood that the calculation module 132 may be configured to execute the foregoing step S120, and for the detailed implementation of the calculation module 132, refer to the foregoing content related to the step S120.
  • the distortion correction module 133 is configured to perform distortion correction on the face to be corrected according to the relative distance coefficient to obtain a target image after distortion correction. It can be understood that the distortion correction module 133 may be configured to execute the above-mentioned step S130, and for the detailed implementation of the distortion correction module 133, please refer to the above-mentioned content related to the step S130.
  • the image distortion correction device 130 may further include:
  • the display storage module 134 is configured to display each target image after distortion correction in the shooting preview interface in real time, and when a shooting instruction is detected, use the target image currently displayed in the shooting preview interface as the shooting image And stored in the electronic device 100. It can be understood that the display storage module 134 can be configured to execute the above step S140, and for the detailed implementation of the display storage module 134, please refer to the content related to the above step S140.
  • the image distortion correction device 130 provided by the embodiment of the present application is another implementation form of the image distortion correction method shown in FIG. 1 or FIG. 3, and the image distortion correction device 130 can be configured to execute the image distortion correction method shown in FIG. 1 or FIG.
  • the image distortion correction method provided by the embodiment therefore, the technical effect that can be obtained can refer to the above method embodiment, and it will not be repeated here.
  • an embodiment of the present application further provides a computer-readable storage medium having a computer program stored on the computer-readable storage medium, and the computer program is executed by a processor to execute the above-mentioned image distortion correction method A step of.
  • the storage medium can be a general storage medium, such as a portable disk, a hard disk, etc., and when the computer program on the storage medium is executed, the above-mentioned image distortion correction method can be executed.
  • These computer program instructions can be provided to the processor of a general-purpose computer, a special-purpose computer, an embedded processor, or other programmable data processing equipment to generate a machine, so that the instructions executed by the processor of the computer or other programmable data processing equipment are generated It is a device that realizes the functions specified in one process or multiple processes in the flowchart and/or one block or multiple blocks in the block diagram.
  • the embodiment of this application obtains the face frame information and face key points corresponding to at least two faces in the image to be corrected by performing face recognition on the image to be corrected, and then determines the face frame information corresponding to each recognized face. Correct the face to be corrected in the image, calculate the relative distance coefficient between the face to be corrected and the camera lens, and then perform distortion correction on the face to be corrected according to the relative distance coefficient to obtain the target image after distortion correction. In this way, it is possible to automatically recognize the face to be corrected for distortion correction in real-time when multiple people take a selfie together, thereby optimizing the shooting effect in a scene where multiple people take a selfie together.

Landscapes

  • Physics & Mathematics (AREA)
  • General Physics & Mathematics (AREA)
  • Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • Image Processing (AREA)
  • Studio Devices (AREA)

Abstract

An image distortion correction method, an apparatus, an electronic device and a readable storage medium, wherein the method comprises the steps of performing face recognition on an image to be corrected to obtain face frame information and face key points corresponding to at least two faces in the image to be corrected (S110), then determining a face to be corrected in the image to be corrected according to the face frame information corresponding to each recognized face, and calculating a relative distance coefficient between the face to be corrected and a camera lens (S120), and then performing distortion correction on the face to be corrected according to the relative distance coefficient to obtain a target image after the distortion correction (S130). The method can automatically recognize a face to be corrected and perform distortion correction in real-time when multiple people take a selfie together, thereby optimizing the shooting effect in a multi-person selfie scene.

Description

图像畸变修正方法、装置、电子设备及可读存储介质Image distortion correction method, device, electronic equipment and readable storage medium
相关申请的交叉引用Cross references to related applications
本申请要求于2019年06月17日提交中国专利局的申请号为2019105217671、名称为“图像畸变修正方法、装置、电子设备及可读存储介质”的中国专利申请的优先权,其全部内容通过引用结合在本申请中。This application claims the priority of a Chinese patent application filed with the Chinese Patent Office on June 17, 2019, with the application number 2019105217671, titled "Image Distortion Correction Method, Device, Electronic Equipment, and Readable Storage Medium", the entire content of which is approved The reference is incorporated in this application.
技术领域Technical field
本申请涉及图形图像处理技术领域,具体而言,涉及一种图像畸变修正方法、装置、电子设备及可读存储介质。This application relates to the technical field of graphics and image processing, and in particular to an image distortion correction method, device, electronic equipment, and readable storage medium.
背景技术Background technique
目前,使用电子设备(例如智能手机、平板电脑等)的前置摄像头进行多人自拍合照是拍照中的一个重要使用场景,该场景中拍摄者大多需要自己手持电子设备拍摄。然而,由于人体手臂长度的限制,拍摄者距离镜头的物理距离通常无法超过手臂的长度,而合照中的其他人员则没有手持电子设备的物理限制,可以自由活动选择合适的位置进行拍摄。此时,合照内的拍摄者通常是距离镜头最近的人,这样会导致多人自拍合照时,手持电子设备的拍摄者的脸部会发生畸变,这个畸变在多人合照时对比会更加明显,导致在多人自拍合照的场景中,拍摄者的脸部会相对其他人显得比较异常,影响拍摄效果。At present, using the front camera of an electronic device (such as a smart phone, a tablet computer, etc.) to take a self-portrait photo with multiple people is an important use scene in taking pictures. However, due to the limitation of the length of the human arm, the physical distance of the photographer from the lens usually cannot exceed the length of the arm, while the other people in the group photo do not have the physical limitation of hand-held electronic devices, and can freely choose a suitable location for shooting. At this time, the photographer in the group photo is usually the person closest to the lens, which will cause the face of the photographer holding the electronic device to be distorted when multiple people take a group photo. This distortion will be more obvious when a group photo is taken. As a result, in a scene where multiple people take a selfie together, the face of the photographer will look abnormal compared to other people, which will affect the shooting effect.
发明内容Summary of the invention
有鉴于此,本申请实施例的目的之一在于提供一种图像畸变修正方法、装置、电子设备及可读存储介质,能够在多人自拍合照时实时自动地识别待修正人脸进行畸变矫正,从而优化多人自拍合照场景中的拍摄效果。In view of this, one of the objectives of the embodiments of the present application is to provide an image distortion correction method, device, electronic device, and readable storage medium, which can automatically recognize the face to be corrected for distortion correction in real time when multiple people take a selfie together. In order to optimize the shooting effect in the multi-person selfie photo scene.
本申请提供一种电子设备,可以包括一个或多个存储介质和一个或多个与存储介质通信的处理器。一个或多个存储介质存储有处理器可执行的机器可执行指令。当电子设备运行时,处理器执行所述机器可执行指令,以执行图像畸变修正方法。The present application provides an electronic device, which may include one or more storage media and one or more processors in communication with the storage media. One or more storage media stores machine executable instructions executable by the processor. When the electronic device is running, the processor executes the machine executable instructions to execute the image distortion correction method.
本申请还提供一种图像畸变修正方法,应用于电子设备,所述方法包括:The present application also provides an image distortion correction method, which is applied to electronic equipment, and the method includes:
对待修正图像进行人脸识别,得到所述待修正图像中至少两个人脸对应的人脸框信息和人脸关键点;Performing face recognition on the image to be corrected to obtain face frame information and face key points corresponding to at least two faces in the image to be corrected;
根据识别到的每个人脸对应的人脸框信息确定所述待修正图像中的待修正人脸,并计算所述待修正人脸与摄像镜头的相对距离系数;Determine the face to be corrected in the image to be corrected according to the face frame information corresponding to each recognized face, and calculate the relative distance coefficient between the face to be corrected and the camera lens;
根据所述相对距离系数对所述待修正人脸进行畸变修正,得到畸变修正后的目标图像。Distortion correction is performed on the face to be corrected according to the relative distance coefficient to obtain a target image after distortion correction.
可选的,所述对待修正图像进行人脸识别,得到所述待修正图像中至少两个人脸对应的人脸框信息和人脸关键点的步骤,包括:Optionally, the step of performing face recognition on the image to be corrected to obtain face frame information and face key points corresponding to at least two faces in the image to be corrected includes:
在检测到相机开启指令后,开启摄像头并进入拍摄预览界面;After detecting the camera start command, turn on the camera and enter the shooting preview interface;
针对所述拍摄预览界面中的每帧待修正图像,通过预先训练得到的人脸识别模型对该帧待修正图像进行人脸识别,得到该帧待修正图像中每个人脸对应的人脸框信息和人脸关键点;For each frame of the image to be corrected in the shooting preview interface, face recognition is performed on the frame of the image to be corrected through the face recognition model obtained in advance to obtain the face frame information corresponding to each face in the frame of the image to be corrected And key points of the face;
其中,所述人脸识别模型利用多个训练样本和各个训练样本的标注数据基于深度学习的神经网络训练获得,其中,各个训练样本的标注数据包括该训练样本中各个人脸对应的人脸框信息和人脸关键点。Wherein, the face recognition model uses multiple training samples and the labeled data of each training sample to be obtained based on deep learning neural network training, where the labeled data of each training sample includes the face frame corresponding to each face in the training sample Key points of information and faces.
可选地,所述根据识别到的每个人脸对应的人脸框信息确定所述待修正图像中的待修正人脸,并计算所述待修正人脸与摄像镜头的相对距离系数的步骤之前,所述方法还包括:Optionally, before the step of determining the face to be corrected in the image to be corrected according to the face frame information corresponding to each recognized face, and calculating the relative distance coefficient between the face to be corrected and the camera lens , The method further includes:
针对每个人脸,根据该人脸对应的人脸框信息裁剪出对应的人脸图像;For each face, crop out the corresponding face image according to the face frame information corresponding to the face;
根据该人脸对应的人脸关键点,利用仿射矩阵将该人脸图像旋转到设定位置。According to the key points of the face corresponding to the face, the face image is rotated to the set position using the affine matrix.
可选地,所述方法还包括:Optionally, the method further includes:
针对旋转后的每个人脸图像,采用预先训练的年龄预估模型对该人脸图像进行识别,得到该人脸图像中的人脸年龄;For each face image after rotation, a pre-trained age estimation model is used to recognize the face image to obtain the face age in the face image;
判断该人脸图像中的人脸年龄是否大于设定年龄;Determine whether the age of the face in the face image is greater than the set age;
若该人脸图像中的人脸年龄小于设定年龄,则根据该人脸图像中的人脸年龄对该人脸图像的人脸框大小进行矫正。If the age of the face in the face image is less than the set age, the size of the face frame of the face image is corrected according to the age of the face in the face image.
可选地,所述电子设备中预先存储有每个人脸年龄对应的人脸周长的中位数,所述根据该人脸图像中的人脸年龄对该人脸图像的人脸框大小进行矫正的步骤,包括:Optionally, the electronic device pre-stores the median of the face circumference corresponding to the age of each face, and the size of the face frame of the face image is performed according to the face age in the face image. The corrective steps include:
获取该人脸图像中的人脸年龄对应的人脸周长的第一中位数以及所述设定年龄对应的人脸周长的第二中位数;Acquiring the first median of the face circumference corresponding to the age of the face in the face image and the second median of the face circumference corresponding to the set age;
根据所述第一中位数和所述第二中位数计算得到人脸框矫正系数;Calculating a face frame correction coefficient according to the first median and the second median;
根据所述人脸框矫正系数对该人脸图像的人脸框大小进行矫正。The size of the face frame of the face image is corrected according to the face frame correction coefficient.
可选地,所述根据识别到的每个人脸对应的人脸框信息确定所述待修正图像中的待修正人脸,并计算所述待修正人脸与摄像镜头的相对距离系数的步骤,包括:Optionally, the step of determining the face to be corrected in the image to be corrected according to the face frame information corresponding to each recognized face, and calculating the relative distance coefficient between the face to be corrected and the camera lens, include:
根据所述每个人脸对应的人脸框信息,确定人脸框面积最大的人脸为待修正人脸;According to the face frame information corresponding to each face, determine the face with the largest face frame area as the face to be corrected;
计算所述待修正人脸与摄像镜头的相对距离系数。Calculate the relative distance coefficient between the face to be corrected and the camera lens.
可选地,所述计算所述待修正人脸与摄像镜头的相对距离系数的步骤,包括:Optionally, the step of calculating the relative distance coefficient between the face to be corrected and the camera lens includes:
根据所述每个人脸对应的人脸框信息,计算识别到的所有人脸对应的人脸框的平均面积;Calculating the average area of the face frame corresponding to all recognized faces according to the face frame information corresponding to each face;
计算每个人脸对应的人脸框的面积与所述平均面积的差值平方值之和;Calculating the sum of the square value of the difference between the area of the face frame corresponding to each face and the average area;
根据所述差值平方值之和计算所述待修正人脸与摄像镜头的相对距离系数,具体计算 公式为:The relative distance coefficient between the face to be corrected and the camera lens is calculated according to the sum of the squared values of the difference. The specific calculation formula is:
Figure PCTCN2019102870-appb-000001
Figure PCTCN2019102870-appb-000001
其中,d为所述待修正人脸与摄像镜头的相对距离系数,N为人脸数量,x i为第i个人脸框的面积,r为所有人脸对应的人脸框的平均面积。 Where, d is the relative distance coefficient between the face to be corrected and the camera lens, N is the number of faces, x i is the area of the ith face frame, and r is the average area of the face frame corresponding to all faces.
可选地,所述计算所述待修正人脸与摄像镜头的相对距离系数的步骤,包括:Optionally, the step of calculating the relative distance coefficient between the face to be corrected and the camera lens includes:
获取所述待修正人脸之外的其它人脸的人脸框对应的中位数面积和最大数面积;Acquiring the median area and the maximum number area corresponding to the face frame of the face other than the face to be corrected;
计算所述中位数面积与所述待修正人脸的人脸框面积的第一比值以及所述最大数面积与所述待修正人脸的人脸框面积的第二比值;Calculating a first ratio of the median area to the face frame area of the face to be corrected and a second ratio of the maximum number area to the face frame area of the face to be corrected;
根据预设的第一比值和第二比值各自对应的权重系数、所述第一比值和所述第二比值计算所述待修正人脸与摄像镜头的相对距离系数,具体计算公式为:The relative distance coefficient between the face to be corrected and the camera lens is calculated according to the weight coefficients corresponding to the preset first ratio and second ratio, the first ratio and the second ratio, and the specific calculation formula is:
Figure PCTCN2019102870-appb-000002
Figure PCTCN2019102870-appb-000002
其中,d为所述待修正人脸与摄像镜头的相对距离系数,a max为所述待修正人脸之外的其它人脸的人脸框对应的最大数面积,a mid为所述待修正人脸之外的其它人脸的人脸框对应的中位数面积,K为0到1之间的常数,y为所述待修人脸的人脸框面积。 Where d is the relative distance coefficient between the face to be corrected and the camera lens, a max is the maximum number area corresponding to the face frame of the face other than the face to be corrected, and a mid is the face to be corrected The median area corresponding to the face frame of the face other than the face, K is a constant between 0 and 1, and y is the face frame area of the face to be repaired.
可选地,所述电子设备预先存储有多个预设距离系数对应的畸变修正参数,所述根据所述相对距离系数对所述待修正人脸进行畸变修正,得到畸变修正后的目标图像的步骤,包括:Optionally, the electronic device pre-stores a plurality of distortion correction parameters corresponding to preset distance coefficients, and the distortion correction is performed on the face to be corrected according to the relative distance coefficients to obtain the target image after the distortion correction. The steps include:
获取所述相对距离系数所在的预设距离系数范围,所述预设距离系数范围包括第一端点值和第二端点值,所述第一端点值小于所述第二端点值;Acquiring a preset distance coefficient range in which the relative distance coefficient is located, the preset distance coefficient range including a first endpoint value and a second endpoint value, the first endpoint value is less than the second endpoint value;
计算所述相对距离系数与所述第一端点值的第一差值、所述第二端点值与所述第一端点值的第二差值以及所述第二端点值对应的畸变修正参数与所述第一端点值对应的畸变修正参数的第三差值;Calculate the first difference between the relative distance coefficient and the first endpoint value, the second difference between the second endpoint value and the first endpoint value, and the distortion correction corresponding to the second endpoint value The third difference between the parameter and the distortion correction parameter corresponding to the first endpoint value;
根据所述第一端点值、所述第一差值、所述第二差值以及所述第三差值计算得到对应的目标畸变修正参数;Calculating corresponding target distortion correction parameters according to the first endpoint value, the first difference value, the second difference value, and the third difference value;
根据所述目标畸变修正参数对所述待修正人脸进行畸变修正,得到畸变修正后的目标图像;Performing distortion correction on the face to be corrected according to the target distortion correction parameter to obtain a target image after the distortion correction;
其中,所述目标畸变修正参数通过以下计算公式得到:Wherein, the target distortion correction parameter is obtained by the following calculation formula:
Figure PCTCN2019102870-appb-000003
Figure PCTCN2019102870-appb-000003
其中,z为目标畸变修正参数,d为所述待修正人脸与摄像镜头的相对距离系数,d 1为 所述第一端点值,d 2为所述第二端点值,c 1为所述第一端点值对应的畸变修正参数,c 2为所述第一端点值对应的畸变修正参数。 Where z is the target distortion correction parameter, d is the relative distance coefficient between the face to be corrected and the camera lens, d 1 is the first endpoint value, d 2 is the second endpoint value, and c 1 is the The distortion correction parameter corresponding to the first endpoint value, and c 2 is the distortion correction parameter corresponding to the first endpoint value.
可选的,所述根据所述目标畸变修正参数对所述待修正人脸进行畸变修正,得到畸变修正后的目标图像的步骤,包括:Optionally, the step of performing distortion correction on the face to be corrected according to the target distortion correction parameter to obtain a target image after the distortion correction includes:
建立所述待修正人脸的人脸网格,并确定所述人脸网格中的各个约束点;Establishing a face grid of the face to be corrected, and determining each constraint point in the face grid;
根据所述目标畸变修正参数计算所述人脸网格中的各个约束点的约束形变量;Calculating the constraint deformation variables of each constraint point in the face grid according to the target distortion correction parameter;
根据计算的各个约束点的约束形变量对各个约束点的坐标进行调整,得到调整后的人脸网格;Adjust the coordinates of each constraint point according to the calculated constraint deformation variables of each constraint point to obtain an adjusted face grid;
将所述待修正人脸映射到所述调整后的人脸网格,得到畸变修正后的目标图像。The face to be corrected is mapped to the adjusted face grid to obtain a target image after distortion correction.
可选地,所述方法还包括:Optionally, the method further includes:
将畸变修正后的每张目标图像实时显示在所述拍摄预览界面中,并在检测到拍摄指令时,将当前显示在所述拍摄预览界面中的目标图像作为拍摄图像并存储在所述电子设备中。Display each target image after distortion correction in the shooting preview interface in real time, and when a shooting instruction is detected, use the target image currently displayed in the shooting preview interface as a shooting image and store it in the electronic device in.
可选地,所述根据识别到的每个人脸对应的人脸框信息确定所述待修正图像中的待修正人脸的步骤,包括:Optionally, the step of determining the face to be corrected in the image to be corrected according to the face frame information corresponding to each recognized face includes:
根据所述每个人脸对应的人脸框信息,确定人脸框面积最大的人脸为待修正人脸。According to the face frame information corresponding to each face, it is determined that the face with the largest face frame area is the face to be corrected.
可选地,所述计算所述待修正人脸与摄像镜头的相对距离系数的步骤,包括:Optionally, the step of calculating the relative distance coefficient between the face to be corrected and the camera lens includes:
根据各人脸的人脸框的面积计算所述待修正人脸与摄像头的相对距离系数。The relative distance coefficient between the face to be corrected and the camera is calculated according to the area of the face frame of each face.
可选地,所述确定人脸框面积最大的人脸为待修正人脸之前,所述方法还包括:Optionally, before the determining that the face with the largest face frame area is the face to be corrected, the method further includes:
识别所述待修正图像中各人脸图像对应的人脸年龄;Identifying the age of the face corresponding to each face image in the image to be corrected;
根据各人脸图像对应的人脸年龄对各人脸图像的人脸框大小进行矫正。The size of the face frame of each face image is corrected according to the face age corresponding to each face image.
可选地,所述根据识别到的每个人脸对应的人脸框信息确定所述待修正图像中的待修正人脸,并计算所述待修正人脸与摄像镜头的相对距离系数的步骤之前,所述方法还包括:Optionally, before the step of determining the face to be corrected in the image to be corrected according to the face frame information corresponding to each recognized face, and calculating the relative distance coefficient between the face to be corrected and the camera lens , The method further includes:
针对每个人脸,根据该人脸对应的人脸框信息裁剪出对应的人脸图像;For each face, crop out the corresponding face image according to the face frame information corresponding to the face;
根据该人脸对应的人脸关键点,利用仿射矩阵将该人脸图像旋转到设定位置。According to the key points of the face corresponding to the face, the face image is rotated to the set position using the affine matrix.
本申请还提供一种图像畸变修正装置,应用于电子设备,所述装置包括:The present application also provides an image distortion correction device applied to electronic equipment, and the device includes:
识别模块,配置成对待修正图像进行人脸识别,得到所述待修正图像中至少两个人脸对应的人脸框信息和人脸关键点;A recognition module configured to perform face recognition on the image to be corrected, and obtain face frame information and face key points corresponding to at least two faces in the image to be corrected;
计算模块,配置成根据识别到的每个人脸对应的人脸框信息确定所述待修正图像中的待修正人脸,并计算所述待修正人脸与摄像镜头的相对距离系数;A calculation module, configured to determine the face to be corrected in the image to be corrected according to the face frame information corresponding to each recognized face, and calculate the relative distance coefficient between the face to be corrected and the camera lens;
畸变修正模块,配置成根据所述相对距离系数对所述待修正人脸进行畸变修正,得到畸变修正后的目标图像。The distortion correction module is configured to perform distortion correction on the face to be corrected according to the relative distance coefficient to obtain a target image after distortion correction.
本申请还提供一种可读存储介质,该可读存储介质上存储有机器可执行指令,该计算 机程序被处理器运行时可以执行上述的图像畸变修正方法的步骤。The present application also provides a readable storage medium having machine executable instructions stored on the readable storage medium, and the computer program can execute the steps of the above-mentioned image distortion correction method when the computer program is run by the processor.
基于上述内容,本申请实施例通过对待修正图像进行人脸识别,得到待修正图像中至少两个人脸对应的人脸框信息和人脸关键点,然后根据识别到的每个人脸对应的人脸框信息确定待修正图像中的待修正人脸,并计算待修正人脸与摄像镜头的相对距离系数,之后根据相对距离系数对待修正人脸进行畸变修正,得到畸变修正后的目标图像。如此,能够在多人自拍合照时实时自动地识别待修正人脸进行畸变矫正,从而优化多人自拍合照场景中的拍摄效果。Based on the foregoing, the embodiment of the present application obtains face frame information and face key points corresponding to at least two faces in the image to be corrected by performing face recognition on the image to be corrected, and then according to the face corresponding to each recognized face The frame information determines the face to be corrected in the image to be corrected, and calculates the relative distance coefficient between the face to be corrected and the camera lens, and then performs distortion correction on the face to be corrected according to the relative distance coefficient to obtain a target image after distortion correction. In this way, it is possible to automatically recognize the face to be corrected for distortion correction in real-time when multiple people take a selfie together, thereby optimizing the shooting effect in a scene where multiple people take a selfie together.
附图说明Description of the drawings
为了更清楚地说明本申请实施例的技术方案,下面将对实施例中所需要使用的附图作简单地介绍,应当理解,以下附图仅示出了本申请的某些实施例,因此不应被看作是对范围的限定,对于本领域普通技术人员来讲,在不付出创造性劳动的前提下,还可以根据这些附图获得其他相关的附图。In order to more clearly describe the technical solutions of the embodiments of the present application, the following will briefly introduce the drawings that need to be used in the embodiments. It should be understood that the following drawings only show certain embodiments of the present application and therefore do not It should be regarded as a limitation of the scope. For those of ordinary skill in the art, other related drawings can be obtained based on these drawings without creative work.
图1示出了本申请实施例所提供的图像畸变修正方法的流程示意图之一;FIG. 1 shows one of the schematic flowcharts of the image distortion correction method provided by the embodiment of the present application;
图2示出了本申请实施例所提供的识别到的人脸对应的人脸框的示意图;FIG. 2 shows a schematic diagram of a face frame corresponding to a recognized face provided by an embodiment of the present application;
图3示出了本申请实施例所提供的图像畸变修正方法的流程示意图之二;FIG. 3 shows the second schematic flowchart of the image distortion correction method provided by the embodiment of the present application;
图4示出了本申请实施例所提供的图像畸变修正之前的电子设备的拍摄预览界面示意图;4 shows a schematic diagram of a photographing preview interface of an electronic device before image distortion correction provided by an embodiment of the present application;
图5示出了本申请实施例所提供的图像畸变修正之后的电子设备的拍摄预览界面示意图;FIG. 5 shows a schematic diagram of a photographing preview interface of an electronic device after image distortion correction provided by an embodiment of the present application;
图6示出了本申请实施例所提供的电子设备包括的图像畸变修正装置的功能模块示意框图之一;FIG. 6 shows one of the schematic block diagrams of the functional modules of the image distortion correction device included in the electronic device provided by the embodiment of the present application;
图7示出了本申请实施例所提供的电子设备包括的图像畸变修正装置的功能模块示意框图之二。FIG. 7 shows the second schematic block diagram of the functional modules of the image distortion correction apparatus included in the electronic device provided by the embodiment of the present application.
具体实施方式Detailed ways
为使本申请实施例的目的、技术方案和优点更加清楚,下面将结合本申请实施例中的附图,对本申请实施例中的技术方案进行清楚、完整地描述,应当理解,本申请中附图仅起到说明和描述的目的,并不用于限定本申请的保护范围。另外,应当理解,示意性的附图并未按实物比例绘制。本申请中使用的流程图示出了根据本申请实施例的一些实施例实现的操作。应该理解,流程图的操作可以不按顺序实现,没有逻辑的上下文关系的步骤可以反转顺序或者同时实施。此外,本领域技术人员在本申请内容的指引下,可以向流程图添加一个或多个其他操作,也可以从流程图中移除一个或多个操作。In order to make the purpose, technical solutions and advantages of the embodiments of this application clearer, the technical solutions in the embodiments of this application will be described clearly and completely in conjunction with the drawings in the embodiments of this application. It should be understood that this application is attached The drawings are only for the purpose of illustration and description, and are not used to limit the protection scope of this application. In addition, it should be understood that the schematic drawings are not drawn to scale. The flowchart used in this application shows operations implemented according to some embodiments of the embodiments of this application. It should be understood that the operations of the flowchart may be implemented out of order, and steps without logical context may be reversed in order or implemented at the same time. In addition, under the guidance of the content of this application, those skilled in the art can add one or more other operations to the flowchart, or remove one or more operations from the flowchart.
另外,所描述的实施例仅仅是本申请一部分实施例,而不是全部的实施例。通常在此 处附图中描述和示出的本申请实施例的组件可以以各种不同的配置来布置和设计。因此,以下对在附图中提供的本申请的实施例的详细描述并非旨在限制要求保护的本申请的范围,而是仅仅表示本申请的选定实施例。基于本申请的实施例,本领域技术人员在没有做出创造性劳动的前提下所获得的所有其他实施例,都属于本申请保护的范围。In addition, the described embodiments are only a part of the embodiments of the present application, rather than all the embodiments. The components of the embodiments of the present application generally described and shown in the drawings herein can be arranged and designed in various different configurations. Therefore, the following detailed description of the embodiments of the present application provided in the accompanying drawings is not intended to limit the scope of the claimed application, but merely represents selected embodiments of the present application. Based on the embodiments of the present application, all other embodiments obtained by those skilled in the art without creative work shall fall within the protection scope of the present application.
本申请发明人经过研究发现,在多人合拍的场景中,拍摄者在距离镜头较近时会使自身的脸部产生畸变,脸部区域会被放大,而合照内的其他人相对于拍摄者通常距离镜头更远,这样会导致拍摄者的脸部区域被放大的畸变在对比中加深。当前的畸变修正方法,大都是采用通用的瘦脸或者头部缩小的方案,以减少畸变,但是无法针对多人自拍合照场景实时、自动对合照内的拍摄者进行畸变处理。The inventor of the present application has discovered through research that in a scene where multiple people are photographed together, the photographer will distort his face when he is close to the lens, the face area will be enlarged, and the other people in the group photo will be relative to the photographer. Usually the distance from the lens is farther, which will cause the distortion of the photographer's face area to be enlarged in the contrast. Current distortion correction methods mostly use general face-lifting or head-shrinking schemes to reduce distortion, but they cannot automatically perform distortion processing on the photographers in the group photo in real-time for multi-person selfie photo scenes.
为此,基于上述技术问题的发现,发明人提出下述技术方案以解决或者改善上述问题。需要注意的是,以上现有技术中的方案所存在的缺陷,均是发明人在经过实践并仔细研究后得出的结果,因此,上述问题的发现过程以及下文中本申请实施例针对上述问题所提出的解决方案,都应该是发明人在发明创造过程中对本申请做出的贡献,而不应当理解为本领域技术人员所公知的技术内容。To this end, based on the discovery of the above technical problems, the inventor proposes the following technical solutions to solve or improve the above problems. It should be noted that the defects in the above solutions in the prior art are the results of the inventors after practice and careful study. Therefore, the discovery process of the above problems and the following embodiments of the application address the above problems. The proposed solutions should all be contributions made by the inventor to the application in the process of invention and creation, and should not be understood as technical content known to those skilled in the art.
图1示出了本申请实施例提供的图像畸变修正方法的流程示意图,应当理解,在其它实施例中,本实施例的图像畸变修正方法其中部分步骤的顺序可以不以图1及以下具体实施例的顺序为限制,例如可以根据实际需要相互交换,或者其中的部分步骤也可以省略或删除。该图像畸变修正方法的详细步骤介绍如下。Figure 1 shows a schematic flow chart of an image distortion correction method provided by an embodiment of the present application. It should be understood that in other embodiments, the sequence of some steps of the image distortion correction method of this embodiment may not be specifically implemented as shown in Figure 1 and below. The order of the examples is limited, for example, they can be exchanged according to actual needs, or some of the steps can also be omitted or deleted. The detailed steps of the image distortion correction method are introduced as follows.
步骤S110,对待修正图像进行人脸识别,得到所述待修正图像中至少两个人脸对应的人脸框信息和人脸关键点。Step S110: Perform face recognition on the image to be corrected to obtain face frame information and face key points corresponding to at least two human faces in the image to be corrected.
步骤S120,根据识别到的每个人脸对应的人脸框信息确定所述待修正图像中的待修正人脸,并计算所述待修正人脸与摄像镜头的相对距离系数。Step S120: Determine the face to be corrected in the image to be corrected according to the face frame information corresponding to each recognized face, and calculate the relative distance coefficient between the face to be corrected and the camera lens.
步骤S130,根据所述相对距离系数对所述待修正人脸进行畸变修正,得到畸变修正后的目标图像。Step S130, performing distortion correction on the face to be corrected according to the relative distance coefficient to obtain a target image after distortion correction.
基于上述步骤,本实施例能够在多人自拍合照时实时自动地识别待修正人脸以对根据计算出的待修正人脸与摄像镜头的相对距离系数畸变矫正,从而优化多人自拍合照场景中的拍摄效果。Based on the above steps, this embodiment can automatically recognize the face to be corrected in real time when multiple people take a selfie together to correct the distortion based on the calculated relative distance coefficient between the face to be corrected and the camera lens, thereby optimizing the multi-person selfie scene The shooting effect.
作为一种可能的实施方式,针对步骤S110,在检测到相机开启指令后,开启摄像头并进入拍摄预览界面。As a possible implementation manner, for step S110, after the camera start instruction is detected, the camera is turned on and the shooting preview interface is entered.
其中,在不同的应用场景下,检测到相机开启指令的方式可以不同。例如,可以在检测到拍摄者在交互界面上触发的拍照控件时,得到相机开启指令;又例如,也可以在获取到拍摄者发送的拍照语音指令时,得到相机开启指令;又例如,也可以在检测到拍摄者的 动作与拍照预设动作一致时,得到相机开启指令等。Among them, in different application scenarios, the manner of detecting the camera start instruction may be different. For example, the camera can be turned on when the camera control triggered by the photographer on the interactive interface is detected; for example, the camera can be turned on when the camera voice command sent by the photographer is received; for example, you can also When it is detected that the action of the photographer is consistent with the preset action of taking a picture, a camera start instruction is obtained.
当检测到相机开启指令后,则开启摄像头并进入拍摄预览界面,在该拍摄预览界面中,可以实时显示由该摄像头所获取到的当前拍照场景的图像。When the camera start instruction is detected, the camera is turned on and enters the shooting preview interface. In the shooting preview interface, the image of the current shooting scene acquired by the camera can be displayed in real time.
为了便于拍摄者在拍摄预览阶段就可以实时看到畸变修正后的人脸效果,待修正图像可以是拍摄预览界面中展示的图像中的每一帧图像。在此基础上,可以针对所述拍摄预览界面中的每帧待修正图像,通过预先训练得到的人脸识别模型对该帧待修正图像进行人脸识别,以得到该帧待修正图像中每个人脸对应的人脸框信息和人脸关键点。In order to facilitate the photographer to see the face effect after distortion correction in real time during the shooting preview stage, the image to be corrected may be each frame of the image displayed in the shooting preview interface. On this basis, for each frame of the image to be corrected in the shooting preview interface, face recognition can be performed on the frame of the image to be corrected through the face recognition model obtained in advance to obtain each person in the frame of the image to be corrected The face frame information and key points of the face corresponding to the face.
可选地,所述人脸识别模型可以利用多个训练样本和各个训练样本的标注数据基于深度学习的神经网络(例如YOLO神经网络、Fast-RCNN神经网络、MTCNN神经网络等)训练获得。其中,各个训练样本的标注数据可以包括该训练样本中各个人脸对应的人脸框信息和人脸关键点。Optionally, the face recognition model can be obtained by training based on a deep learning neural network (for example, YOLO neural network, Fast-RCNN neural network, MTCNN neural network, etc.) using multiple training samples and label data of each training sample. The labeled data of each training sample may include face frame information and face key points corresponding to each face in the training sample.
作为一种示例,各个人脸对应的人脸框信息可以包括人脸ID信息、人脸框顶点的坐标信息、人脸框的宽度信息和高度信息等,人脸关键点可以包括人脸各个部位的特征点以及各个特征点之间的几何关系等。As an example, the face frame information corresponding to each face may include face ID information, coordinate information of the vertices of the face frame, width information and height information of the face frame, etc. The key points of the face may include various parts of the face. The feature points and the geometric relationship between each feature point.
例如,请结合参阅图2,示出了识别到的人脸对应的人脸框F的示意图。在图2中,人脸框F覆盖了人脸区域,人脸框信息可包括图2中所示的人脸框的宽度W、高度H以及人脸框的顶点坐标Q,人脸框F的面积则为人脸框F的宽度W和高度H的乘积。其中,针对不同大小的人脸,其人脸框F的宽度W和高度H在识别过程中会自适应地调整。此外,人脸框F的顶点坐标Q可以根据实际需求进行选择,例如图2示出的顶点坐标Q为人脸框的右上角的顶点坐标,在其它示例中,人脸框的顶点坐标Q也可以选择左上角的顶点坐标、左下角的顶点坐标或者右下角的顶点坐标,或者上述任意组合,本实施例对此不作任何限制。For example, referring to FIG. 2 in conjunction, a schematic diagram of a face frame F corresponding to a recognized face is shown. In Figure 2, the face frame F covers the face area, and the face frame information may include the width W, height H, and vertex coordinates Q of the face frame shown in Figure 2, and the face frame F The area is the product of the width W and the height H of the face frame F. Among them, for faces of different sizes, the width W and height H of the face frame F are adaptively adjusted during the recognition process. In addition, the vertex coordinate Q of the face frame F can be selected according to actual needs. For example, the vertex coordinate Q shown in FIG. 2 is the vertex coordinate of the upper right corner of the face frame. In other examples, the vertex coordinate Q of the face frame can also be selected. Select the vertex coordinates of the upper left corner, the vertex coordinates of the lower left corner, or the vertex coordinates of the lower right corner, or any combination of the foregoing, and this embodiment does not impose any limitation on this.
如此,通过基于深度学习的神经网络训练获得的人脸识别模型,可以识别到待修正图像中每个人脸对应的人脸框信息和人脸关键点,以便于后续利用每个人脸对应的人脸框信息和人脸关键点进行畸变矫正。In this way, the face recognition model obtained through neural network training based on deep learning can identify the face frame information and face key points corresponding to each face in the image to be corrected, so as to facilitate subsequent use of the face corresponding to each face The frame information and key points of the face are corrected for distortion.
发明人在研究过程中还发现,通常在上述拍摄预览界面中的视频流中,往往会由于被拍摄者的头部偏斜、镜头抖动、镜头相对位置偏移等情况,导致这些人脸可能存在偏斜的情况,后续人脸图像面积的确定,进而影响图像的畸变修正效果。The inventor also discovered in the process of research that usually in the video stream in the above-mentioned shooting preview interface, these faces may exist due to the deviation of the head of the subject, the camera shake, the relative position of the lens, etc. In the case of skew, the subsequent determination of the area of the face image will affect the distortion correction effect of the image.
基于此,作为一种可能的实施方式,在步骤S120之前,还可以针对每个人脸,根据该人脸对应的人脸框信息裁剪出对应的人脸图像。详细地,可以根据该人脸对应的人脸框顶点的坐标信息、人脸框的宽度信息和高度信息确定该人脸的裁剪区域,然后根据确定的裁剪区域裁剪出对应的人脸图像。Based on this, as a possible implementation manner, before step S120, for each face, a corresponding face image can be cropped according to the face frame information corresponding to the face. In detail, the cropping area of the face can be determined according to the coordinate information of the vertices of the face frame corresponding to the face, the width information and the height information of the face frame, and then the corresponding face image can be cropped according to the determined cropping area.
接着,再根据该人脸对应的人脸关键点,利用仿射矩阵将该人脸图像旋转到设定位置。详细地,可以通过预先存储的标准人脸模板中的各个人脸关键模板点与该人脸对应的人脸关键点之间的差异,计算使用仿射矩阵将该人脸图像旋转的旋转参数,然后将该人脸图像对应的人脸关键点旋转到根据旋转参数所确定的对应位置处,以得到摆正后的人脸图像。如此,可以避免在由于被拍摄者的头部偏斜、镜头抖动或者镜头相对位置偏移等情况导致这些人脸可能存在偏斜的情况。Then, according to the key points of the face corresponding to the face, the face image is rotated to the set position using the affine matrix. In detail, the difference between each face key template point in the standard face template stored in advance and the face key point corresponding to the face can be used to calculate the rotation parameter for rotating the face image using the affine matrix, Then, the face key points corresponding to the face image are rotated to the corresponding positions determined according to the rotation parameters to obtain the face image after the straightening. In this way, it can be avoided that these faces may be skewed due to the deflection of the head of the subject, the camera shake, or the offset of the relative position of the lens.
发明人在研究过程中还发现,通常当合照中存在儿童时,由于相机的原因,可能会导致儿童在上述拍摄预览界面中的视频流中相较于其他成年人而言会存在些许畸变,导致儿童的实际形象与真实形象存在差异,进而影响拍摄效果。The inventor also discovered in the process of research that usually when there are children in a group photo, due to the camera, the video stream in the above-mentioned shooting preview interface may cause the children to have a little distortion compared to other adults. The actual image of the child is different from the real image, which affects the shooting effect.
基于此,作为一种可能的实施方式,在前述描述的基础上,针对旋转后的每个人脸图像,采用预先训练的年龄预估模型对该人脸图像进行识别,得到该人脸图像中的人脸年龄,并判断该人脸图像中的人脸年龄是否大于设定年龄,若该人脸图像中的人脸年龄小于设定年龄,则根据该人脸图像中的人脸年龄对该人脸图像的人脸框大小进行矫正。Based on this, as a possible implementation manner, on the basis of the foregoing description, for each face image after rotation, a pre-trained age estimation model is used to recognize the face image, and the face image in the face image is obtained. Face age, and judge whether the face age in the face image is greater than the set age, if the face age in the face image is less than the set age, then the face age in the face image The size of the face frame of the face image is corrected.
详细地,作为一种示例,电子设备中可以预先存储有每个人脸年龄对应的人脸周长的中位数,则根据该人脸图像中的人脸年龄对该人脸图像的人脸框大小进行矫正的方式可以是:首先,获取该人脸图像中的人脸年龄对应的人脸周长的第一中位数以及所述设定年龄对应的人脸周长的第二中位数,然后根据所述第一中位数和所述第二中位数计算得到人脸框矫正系数,最后根据所述人脸框矫正系数对该人脸图像的人脸框大小进行矫正。In detail, as an example, the electronic device may pre-store the median of the face circumference corresponding to the age of each face, and then the face frame of the face image according to the face age in the face image The size correction method can be as follows: First, obtain the first median of the face circumference corresponding to the age of the face in the face image and the second median of the face circumference corresponding to the set age Then, the face frame correction coefficient is calculated according to the first median and the second median, and finally the face frame size of the face image is corrected according to the face frame correction coefficient.
以设定年龄为18岁,该人脸图像中的人脸年龄为10岁为例,假设10岁对应的人脸周长的第一中位数为b 1,18岁对应的人脸周长的第一中位数为b 2,那么计算得到的人脸框矫正系数则为b 1/b 2。在此基础上,根据所述人脸框矫正系数对该人脸图像的人脸框大小进行矫正的方式可以是:通过该人脸框矫正系数b 1/b 2分别对该人脸图像的人脸框的边长和面积进行矫正。 Taking the set age as 18 years old, the face age in the face image is 10 years old as an example, suppose the first median of the face circumference corresponding to 10 years old is b 1 , and the face circumference corresponding to 18 years old The first median of is b 2 , then the calculated face frame correction coefficient is b 1 /b 2 . On this basis, the method of correcting the size of the face frame of the face image according to the face frame correction coefficient may be: using the face frame correction coefficient b 1 /b 2 to respectively correct the face image of the face image. The side length and area of the face frame are corrected.
例如,针对该人脸图像的人脸框的矫正后的边长L 1,可以是该人脸图像的人脸框的原边长L 0与人脸框矫正系数b 1/b 2之间的商值,即L 1=L 0/(b 1/b 2); For example, the corrected side length L 1 of the face frame of the face image may be between the original side length L 0 of the face frame of the face image and the face frame correction coefficient b 1 /b 2 Quotient value, namely L 1 =L 0 /(b 1 /b 2 );
又例如,针对该人脸图像的人脸框的矫正后的面积S 1,可以是该人脸图像的人脸框的原面积S 0与人脸框矫正系数b 1/b 2的平方值之间的商值,即S 1=S 0/(b 1/b 2) 2For another example, the corrected area S 1 of the face frame of the face image may be the square value of the original area S 0 of the face frame of the face image and the face frame correction coefficient b 1 /b 2 The quotient between S 1 =S 0 /(b 1 /b 2 ) 2 .
值得说明的是,上述每个人脸年龄对应的人脸周长的中位数可以通过收集大量不同年龄的样本统计得到,具体数据可以根据实际需求进行微调,本实施例对此不作具体限制。It is worth noting that the median face circumference corresponding to the age of each face can be obtained by collecting a large number of samples of different ages. The specific data can be fine-tuned according to actual needs, which is not specifically limited in this embodiment.
如此,可以减少儿童在上述拍摄预览界面中的视频流中相较于其他成年人而言会存在的畸变程度。In this way, the degree of distortion that children may have in the video stream in the above-mentioned shooting preview interface compared to other adults can be reduced.
进一步地,针对步骤S120,作为一种可能的实施方式,可以根据所述每个人脸对应的 人脸框信息,确定人脸框面积最大的人脸为待修正人脸,并计算所述待修正人脸与摄像镜头的相对距离系数。Further, for step S120, as a possible implementation manner, according to the face frame information corresponding to each face, the face with the largest face frame area may be determined as the face to be corrected, and the face to be corrected may be calculated The relative distance coefficient between the face and the camera lens.
例如,可以根据所述每个人脸对应的人脸框信息,计算识别到的所有人脸对应的人脸框的平均面积,然后计算每个人脸对应的人脸框的面积与所述平均面积的差值平方值之和,最后根据所述差值平方值之和计算所述待修正人脸与摄像镜头的相对距离系数。在本示例中,该相对距离系数的具体计算公式可以为:For example, according to the face frame information corresponding to each face, the average area of the face frame corresponding to all recognized faces can be calculated, and then the area of the face frame corresponding to each face can be calculated as compared with the average area. And finally calculate the relative distance coefficient between the face to be corrected and the camera lens according to the sum of the square difference values. In this example, the specific calculation formula of the relative distance coefficient can be:
Figure PCTCN2019102870-appb-000004
Figure PCTCN2019102870-appb-000004
其中,d为所述待修正人脸与摄像镜头的相对距离系数,N为人脸数量,x i为第i个人脸框的面积,r为所有人脸对应的人脸框的平均面积。 Where, d is the relative distance coefficient between the face to be corrected and the camera lens, N is the number of faces, x i is the area of the ith face frame, and r is the average area of the face frame corresponding to all faces.
又例如,还可以获取所述待修正人脸之外的其它人脸的人脸框对应的中位数面积和最大数面积,并计算所述中位数面积与所述待修正人脸的人脸框面积的第一比值以及所述最大数面积与所述待修正人脸的人脸框面积的第二比值,最后根据预设的第一比值和第二比值各自对应的权重系数、所述第一比值和所述第二比值计算所述待修正人脸与摄像镜头的相对距离系数。在本示例中,该相对距离系数的具体计算公式可以为:For another example, it is also possible to obtain the median area and the maximum number area corresponding to the face frame of the face other than the face to be corrected, and calculate the median area and the person whose face is to be corrected The first ratio of the face frame area and the second ratio of the maximum number area to the face frame area of the face to be corrected, and finally according to the weight coefficients corresponding to the preset first and second ratios, the The first ratio and the second ratio calculate a relative distance coefficient between the face to be corrected and the camera lens. In this example, the specific calculation formula of the relative distance coefficient can be:
Figure PCTCN2019102870-appb-000005
Figure PCTCN2019102870-appb-000005
其中,d为所述待修正人脸与摄像镜头的相对距离系数,a max为所述待修正人脸之外的其它人脸的人脸框对应的最大数面积,a mid为所述待修正人脸之外的其它人脸的人脸框对应的中位数面积,K为0到1之间的常数,y为所述待修人脸的人脸框面积。 Where d is the relative distance coefficient between the face to be corrected and the camera lens, a max is the maximum number area corresponding to the face frame of the face other than the face to be corrected, and a mid is the face to be corrected The median area corresponding to the face frame of the face other than the face, K is a constant between 0 and 1, and y is the face frame area of the face to be repaired.
进一步地,针对步骤S130,电子设备可预先存储有多个预设距离系数对应的畸变修正参数,这样当步骤S120得到的相对距离系数为预先存储的某个预设距离系数时,可以直接获取到该相对距离系数对应的畸变修正参数。然而,在真实场景中,步骤S120得到的相对距离系数通常难以匹配到准确的预设距离系数,如果要收集到所有的预设距离系数对应的畸变修正参数是非常困难的,此外,如果将与步骤S120得到的相对距离系数与相近的预设距离系数对应的畸变修正参数进行匹配,则会存在畸变修正误差。Further, for step S130, the electronic device may pre-store a plurality of distortion correction parameters corresponding to preset distance coefficients, so that when the relative distance coefficient obtained in step S120 is a preset distance coefficient stored in advance, it can be directly obtained The distortion correction parameter corresponding to the relative distance coefficient. However, in a real scene, the relative distance coefficient obtained in step S120 is usually difficult to match the accurate preset distance coefficient. It is very difficult to collect all the distortion correction parameters corresponding to the preset distance coefficient. In addition, if the If the relative distance coefficient obtained in step S120 is matched with the distortion correction parameter corresponding to the similar preset distance coefficient, there will be a distortion correction error.
为此,发明人针对上述问题提出下述示例性的解决方案:For this reason, the inventor proposes the following exemplary solutions to the above problems:
首先,获取所述相对距离系数所在的预设距离系数范围,所述预设距离系数范围可以包括第一端点值和第二端点值,所述第一端点值小于所述第二端点值。First, obtain a preset distance coefficient range in which the relative distance coefficient is located. The preset distance coefficient range may include a first endpoint value and a second endpoint value, and the first endpoint value is smaller than the second endpoint value. .
接着,计算所述相对距离系数与所述第一端点值的第一差值、所述第二端点值与所述第一端点值的第二差值以及所述第二端点值对应的畸变修正参数与所述第一端点值对应的畸变修正参数的第三差值。Next, calculate the first difference between the relative distance coefficient and the first endpoint value, the second difference between the second endpoint value and the first endpoint value, and the corresponding value of the second endpoint The third difference between the distortion correction parameter and the distortion correction parameter corresponding to the first endpoint value.
最后,根据所述第一端点值、所述第一差值、所述第二差值以及所述第三差值计算得到对应的目标畸变修正参数。Finally, the corresponding target distortion correction parameter is calculated according to the first endpoint value, the first difference value, the second difference value, and the third difference value.
其中,所述目标畸变修正参数可以通过以下计算公式得到:Wherein, the target distortion correction parameter can be obtained by the following calculation formula:
Figure PCTCN2019102870-appb-000006
Figure PCTCN2019102870-appb-000006
其中,z为目标畸变修正参数,d为所述待修正人脸与摄像镜头的相对距离系数,d 1为所述第一端点值,d 2为所述第二端点值,c 1为所述第一端点值对应的畸变修正参数,c 2为所述第一端点值对应的畸变修正参数。 Where z is the target distortion correction parameter, d is the relative distance coefficient between the face to be corrected and the camera lens, d 1 is the first endpoint value, d 2 is the second endpoint value, and c 1 is the The distortion correction parameter corresponding to the first endpoint value, and c 2 is the distortion correction parameter corresponding to the first endpoint value.
例如,假设预设距离系数0.15对应的畸变修正参数为0.3,预设距离系数0.20对应的畸变修正参数为0.5,通过上述步骤S120计算得到的相对距离系数为0.17,那么目标畸变修正参数则为:For example, assuming that the distortion correction parameter corresponding to the preset distance coefficient of 0.15 is 0.3, the distortion correction parameter corresponding to the preset distance coefficient of 0.20 is 0.5, and the relative distance coefficient calculated by the above step S120 is 0.17, then the target distortion correction parameter is:
Figure PCTCN2019102870-appb-000007
Figure PCTCN2019102870-appb-000007
如此,通过上述方案,可以得到更为准确的目标畸变修正参数,从而降低畸变修正值的误差,并且无需花费大量时间成本收集所有的预设距离系数对应的畸变修正参数。In this way, through the above solution, more accurate target distortion correction parameters can be obtained, thereby reducing the error of the distortion correction value, and there is no need to spend a lot of time and cost to collect all the distortion correction parameters corresponding to the preset distance coefficients.
在上述基础上,则可以额根据所述目标畸变修正参数对所述待修正人脸进行畸变修正,得到畸变修正后的目标图像。Based on the foregoing, the human face to be corrected may be subjected to distortion correction according to the target distortion correction parameter to obtain a target image after distortion correction.
作为一种示例,首先建立所述待修正人脸的人脸网格,并确定所述人脸网格中的各个约束点,然后根据所述目标畸变修正参数计算所述人脸网格中的各个约束点的约束形变量,之后根据计算的各个约束点的约束形变量对各个约束点的坐标进行调整,得到调整后的人脸网格,并将所述待修正人脸映射到所述调整后的人脸网格,得到畸变修正后的目标图像。As an example, first establish the face grid of the face to be corrected, determine each constraint point in the face grid, and then calculate the face grid in the face grid according to the target distortion correction parameter The constraint deformation variables of each constraint point are then adjusted according to the calculated constraint deformation variables of each constraint point to obtain the adjusted face grid, and the face to be corrected is mapped to the adjustment After the face grid, the target image after distortion correction is obtained.
进一步地,请结合参阅图3,在步骤S130之后,本实施例提供的图像畸变修正方法还可以包括如下步骤:Further, referring to FIG. 3, after step S130, the image distortion correction method provided in this embodiment may further include the following steps:
步骤S140,将畸变修正后的每张目标图像实时显示在所述拍摄预览界面中,并在检测到拍摄指令时,将当前显示在所述拍摄预览界面中的目标图像作为拍摄图像并存储在所述电子设备中。Step S140: Display each target image after distortion correction in the shooting preview interface in real time, and when a shooting instruction is detected, the target image currently displayed in the shooting preview interface is taken as the shooting image and stored in the shooting preview interface. Mentioned in electronic equipment.
在本实施例中,通过将畸变修正后的每张目标图像实时显示在所述拍摄预览界面中,这样拍摄者在还未拍照时即可看到畸变修正后的目标图像而不是发生畸变的待修正图像。之后在需要拍照的时候,可以按下拍摄按钮,当在检测到拍摄指令时,将当前显示在所述拍摄预览界面中的目标图像作为拍摄图像并存储在所述电子设备中。In this embodiment, each target image after distortion correction is displayed in the shooting preview interface in real time, so that the photographer can see the target image after distortion correction instead of the target image that has been distorted before taking a picture. Correct the image. Later, when you need to take a picture, you can press the shooting button, and when a shooting instruction is detected, the target image currently displayed in the shooting preview interface is used as the shooting image and stored in the electronic device.
换句话说,在本实施例中,可以先对待修正图像进行人脸识别,得到所述待修正图像中至少两个人脸对应的人脸框信息和人脸关键点。接着根据识别到的每个人脸对应的人脸框信息,确定所述待修正图像中的待修正人脸,并计算所述待修正人脸与摄像镜头的相对距离系数。然后根据所述相对距离系数对所述待修正人脸进行畸变修正,得到畸变修正后 的目标图像。In other words, in this embodiment, face recognition can be performed on the image to be corrected first to obtain face frame information and face key points corresponding to at least two faces in the image to be corrected. Then, according to the face frame information corresponding to each recognized face, the face to be corrected in the image to be corrected is determined, and the relative distance coefficient between the face to be corrected and the camera lens is calculated. Then, distortion correction is performed on the face to be corrected according to the relative distance coefficient to obtain a target image after distortion correction.
可选地,由于在多人自拍场景中,通常手持拍照的用户离摄像头最近,该用户对应的人脸框面积最大,该用户的人脸图像也就是需要进行修正的图像。因此在本实施例中可以根据所述每个人脸对应的人脸框信息,确定人脸框面积最大的人脸为待修正人脸,然后再计算所述待修正人脸与摄像镜头的相对距离系数。Optionally, since in a multi-person selfie scene, usually the user holding the camera is closest to the camera, the face frame area corresponding to the user is the largest, and the face image of the user is the image that needs to be corrected. Therefore, in this embodiment, it is possible to determine the face with the largest face frame area as the face to be corrected according to the face frame information corresponding to each face, and then calculate the relative distance between the face to be corrected and the camera lens coefficient.
可选地,在对待修正人脸进行矫正时,需要将待修正人脸矫正至于待修正图像中其他人脸差不多的大小,因此在实施例中,可以根据各人脸的人脸框的面积计算所述待修正人脸与摄像头的相对距离系数。其中,所述距离系数的具体计算方式请参见前文,在此不再赘述。Optionally, when correcting the face to be corrected, the face to be corrected needs to be corrected to the size of the other faces in the image to be corrected. Therefore, in the embodiment, it can be calculated according to the area of the face frame of each face The relative distance coefficient between the face to be corrected and the camera. For the specific calculation method of the distance coefficient, please refer to the preceding text, which will not be repeated here.
可选地,由于儿童的脸通常比成年人小,在相同距离下儿童的人脸图像的面积会小于成年人的人脸图像的面积,这可能会导致后续根据人脸图像面积进行待修正人脸识别或者相对距离系数计算时,计算结果不准确。因此在本实施例中,可以先识别所述待修正图像中各人脸图像对应的人脸年龄,根据各人脸图像对应的人脸年龄对各人脸图像的人脸框大小进行矫正,然后再执行待修正人脸确定或相对距离系数的计算。如此,可以减少儿童脸部大小的因素对后续待修正人脸的确定和相对距离的计算准确的影响。其中,具体矫正方式请参见前文,在此不再赘述。Optionally, since the face of a child is usually smaller than that of an adult, the area of the child’s face image will be smaller than the area of the adult’s face image at the same distance, which may lead to subsequent corrections based on the face image area. When calculating face recognition or relative distance coefficient, the calculation result is not accurate. Therefore, in this embodiment, the face age corresponding to each face image in the image to be corrected can be identified first, and the face frame size of each face image is corrected according to the face age corresponding to each face image, and then Then perform the determination of the face to be corrected or the calculation of the relative distance coefficient. In this way, the influence of the size of the child's face on the subsequent determination of the face to be corrected and the calculation of the relative distance can be reduced. Among them, please refer to the previous text for specific correction methods, so I won't repeat them here.
可选地,由于自计算人脸框大小时,被拍摄中的人脸图像偏斜可能导致人脸框大小计算不准确,进而影响后续计算,因此在本实施例中,在得到所述待修正图像中至少两个人脸对应的人脸框信息和人脸关键点后,先针对每个人脸,根据该人脸对应的人脸框信息裁剪出对应的人脸图像;根据该人脸对应的人脸关键点,利用仿射矩阵将该人脸图像旋转到设定位置。如此,可以使后续根据人脸框大小进行计算的各个步骤的计算结果更为准确。Optionally, since the skew of the face image being photographed when self-calculating the size of the face frame may cause the calculation of the face frame size to be inaccurate, thereby affecting subsequent calculations, in this embodiment, after obtaining the to-be-corrected After the face frame information and face key points corresponding to at least two faces in the image, for each face, the corresponding face image is cut out according to the face frame information corresponding to the face; according to the person corresponding to the face Face key points, using an affine matrix to rotate the face image to a set position. In this way, the calculation results of the subsequent calculation steps based on the size of the face frame can be made more accurate.
为了更清楚地描述本申请图像畸变修正方法的有益效果,下面结合其在具体应用场景中的实施过程进行举例,举例说明如下:In order to more clearly describe the beneficial effects of the image distortion correction method of the present application, the following examples are given in conjunction with the implementation process in specific application scenarios. Examples are as follows:
作为一种示例,在日常生活中的多人拍照场景下,比如旅游时拍摄人物合照,通常拍摄者手持电子设备,其余人员则选择合适的位置进行拍摄。如图4所示,拍摄人员打开电子设备的相机应用后,电子设备开启摄像头B4并展示拍摄预览界面L,拍摄预览界面L中则显示该摄像头B4实时获取到的该旅游场景下的合照视频流,拍摄人员还可以选择拍摄模式按钮B2选择前置拍照或者后置拍照,但是不管是前置拍照还是后置拍照,拍摄者都是距离摄像头B4最近的人,这样会导致该多人自拍合照的场景中,该拍摄者的脸部(待修正人脸)Face0会发生畸变,从图4中可以看出这个畸变在多人合照时对比会更加明显。As an example, in a multi-person photo scene in daily life, such as taking a group photo of people while traveling, usually the photographer holds the electronic device while the rest of the people choose a suitable location to take the photo. As shown in Figure 4, after the photographer opens the camera application of the electronic device, the electronic device turns on the camera B4 and displays the shooting preview interface L. The shooting preview interface L displays the real-time video stream of the group photo in the travel scene obtained by the camera B4 , The photographer can also select the shooting mode button B2 to choose front camera or rear camera, but whether it is front camera or rear camera, the photographer is the person closest to the camera B4, which will cause the group to take a selfie In the scene, the face of the photographer (the face to be corrected) Face0 will be distorted. It can be seen from Figure 4 that this distortion will be more obvious when a group photo is taken.
如果采用本申请实施例提供的图像畸变修正方法,如图5所示,那么该拍摄者的脸部修正后的人脸Face1的畸变明显得到了极大改善。由此,每次拍摄预览界面L所显示的都 是畸变修正后的视频流,从而优化多人自拍合照场景中的拍摄效果。If the image distortion correction method provided in the embodiment of the present application is adopted, as shown in FIG. 5, the distortion of the face of the photographer's face after correction is obviously greatly improved. Therefore, each time the shooting preview interface L displays the video stream after distortion correction, thereby optimizing the shooting effect in the multi-person selfie photo scene.
在此基础上,拍摄者按下拍摄按钮B1后,则可以将当前显示在拍摄预览界面L中的图像作为拍摄图像并进行存储,并且还可以通过拍摄图像预览框B3查看刚存储的拍摄图像。On this basis, after the photographer presses the shooting button B1, the image currently displayed in the shooting preview interface L can be used as a shooting image and stored, and the just stored shooting image can also be viewed through the shooting image preview frame B3.
图6示出了本申请实施例提供的电子设备100的示意图,本实施例中,该电子设备100可以包括存储介质110、处理器120以及图像畸变修正装置130。FIG. 6 shows a schematic diagram of an electronic device 100 provided by an embodiment of the present application. In this embodiment, the electronic device 100 may include a storage medium 110, a processor 120, and an image distortion correction device 130.
其中,处理器120可以是一个通用的中央处理器(Central Processing Unit,CPU),微处理器,特定应用集成电路(Application-Specific Integrated Circuit,ASIC),或一个或多个用于控制上述方法实施例提供的图像畸变修正方法的程序执行的集成电路。The processor 120 may be a general-purpose central processing unit (Central Processing Unit, CPU), a microprocessor, an application-specific integrated circuit (ASIC), or one or more for controlling the implementation of the foregoing methods The example provides an integrated circuit for program execution of the image distortion correction method.
存储介质110可以是ROM或可存储静态信息和指令的其他类型的静态存储设备,RAM或者可存储信息和指令的其他类型的动态存储设备,也可以是电可擦可编程只读存储器(Electrically Erasable Programmable-Only Memory,EEPROM)、只读光盘(Compact disc Read-Only Memory,CD-ROM)或其他光盘存储、光碟存储(包括压缩光碟、激光碟、光碟、数字通用光碟、蓝光光碟等)、磁盘存储介质或者其他磁存储设备、或者能够用于携带或存储具有指令或数据结构形式的期望的程序代码并能够由计算机存取的任何其他介质,但不限于此。存储介质110可以是独立存在,通过通信总线与处理器120相连接。存储介质110也可以和处理器集成在一起。其中,存储介质110构造成存储执行本申请方案的应用程序代码,例如图5中所示的图像畸变修正装置130,并由处理器120来控制执行。处理器120构造成执行存储介质110中存储的应用程序代码,例如图像畸变修正装置130,以执行上述方法实施例的图像畸变修正方法。The storage medium 110 may be ROM or other types of static storage devices that can store static information and instructions, RAM or other types of dynamic storage devices that can store information and instructions, or may be an electrically erasable programmable read-only memory (Electrically Erasable Programmable Read Only Memory). Programmable-Only Memory, EEPROM), CD-ROM (Compact disc Read-Only Memory, CD-ROM) or other optical disc storage, optical disc storage (including compact discs, laser discs, optical discs, digital versatile discs, Blu-ray discs, etc.), magnetic disks A storage medium or other magnetic storage device, or any other medium that can be used to carry or store desired program codes in the form of instructions or data structures and that can be accessed by a computer, but is not limited thereto. The storage medium 110 may exist independently and is connected to the processor 120 through a communication bus. The storage medium 110 may also be integrated with the processor. The storage medium 110 is configured to store application program codes for executing the solution of the present application, such as the image distortion correction device 130 shown in FIG. 5, and is controlled by the processor 120 to execute. The processor 120 is configured to execute application program codes stored in the storage medium 110, such as the image distortion correction device 130, to execute the image distortion correction method of the foregoing method embodiment.
本申请可以根据上述方法实施例对图像畸变修正装置130进行功能模块的划分,例如,可以对应各个功能划分各个功能模块,也可以将两个或两个以上的功能集成在一个处理模块中。上述集成的模块既可以采用硬件的形式实现,也可以采用软件功能模块的形式实现。需要说明的是,本申请中对模块的划分是示意性的,仅仅为一种逻辑功能划分,实际实现时可以有另外的划分方式。比如,在采用对应各个功能划分各个功能模块的情况下,图6示出的图像畸变修正装置130只是一种装置示意图。例如,图6示出的图像畸变修正装置130可包括识别模块131、计算模块132以及畸变修正模块133。下面分别对该图像畸变修正装置130的各个功能模块的功能进行详细阐述。The present application may divide the image distortion correction device 130 into functional modules according to the foregoing method embodiments. For example, 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 this application is illustrative and only a logical function division, and there may be other division methods in actual implementation. For example, in the case of dividing each functional module corresponding to each function, the image distortion correction device 130 shown in FIG. 6 is only a schematic diagram of the device. For example, the image distortion correction device 130 shown in FIG. 6 may include an identification module 131, a calculation module 132, and a distortion correction module 133. The functions of each functional module of the image distortion correction device 130 are respectively described in detail below.
识别模块131,配置成对待修正图像进行人脸识别,得到所述待修正图像中至少两个人脸对应的人脸框信息和人脸关键点。可以理解,该识别模块131可以配置成执行上述步骤S110,关于该识别模块131的详细实现方式可以参照上述对步骤S110有关的内容。The recognition module 131 is configured to perform face recognition on the image to be corrected to obtain face frame information and face key points corresponding to at least two human faces in the image to be corrected. It can be understood that the identification module 131 may be configured to execute the above step S110, and for the detailed implementation of the identification module 131, please refer to the content related to the above step S110.
计算模块132,配置成根据识别到的每个人脸对应的人脸框信息确定所述待修正图像中的待修正人脸,并计算所述待修正人脸与摄像镜头的相对距离系数。可以理解,该计算模 块132可以配置成执行上述步骤S120,关于该计算模块132的详细实现方式可以参照上述对步骤S120有关的内容。The calculation module 132 is configured to determine the face to be corrected in the image to be corrected according to the face frame information corresponding to each recognized face, and to calculate the relative distance coefficient between the face to be corrected and the camera lens. It can be understood that the calculation module 132 may be configured to execute the foregoing step S120, and for the detailed implementation of the calculation module 132, refer to the foregoing content related to the step S120.
畸变修正模块133,配置成根据所述相对距离系数对所述待修正人脸进行畸变修正,得到畸变修正后的目标图像。可以理解,该畸变修正模块133可以配置成执行上述步骤S130,关于该畸变修正模块133的详细实现方式可以参照上述对步骤S130有关的内容。The distortion correction module 133 is configured to perform distortion correction on the face to be corrected according to the relative distance coefficient to obtain a target image after distortion correction. It can be understood that the distortion correction module 133 may be configured to execute the above-mentioned step S130, and for the detailed implementation of the distortion correction module 133, please refer to the above-mentioned content related to the step S130.
可选地,请参阅图7,该图像畸变修正装置130还可以包括:Optionally, referring to FIG. 7, the image distortion correction device 130 may further include:
显示存储模块134,配置成将畸变修正后的每张目标图像实时显示在所述拍摄预览界面中,并在检测到拍摄指令时,将当前显示在所述拍摄预览界面中的目标图像作为拍摄图像并存储在所述电子设备100中。可以理解,该显示存储模块134可以配置成执行上述步骤S140,关于该显示存储模块134的详细实现方式可以参照上述对步骤S140有关的内容。The display storage module 134 is configured to display each target image after distortion correction in the shooting preview interface in real time, and when a shooting instruction is detected, use the target image currently displayed in the shooting preview interface as the shooting image And stored in the electronic device 100. It can be understood that the display storage module 134 can be configured to execute the above step S140, and for the detailed implementation of the display storage module 134, please refer to the content related to the above step S140.
由于本申请实施例提供的图像畸变修正装置130是图1或者图3所示的图像畸变修正方法的另一种实现形式,且图像畸变修正装置130可配置成执行图1或者图3所示的实施例所提供的图像畸变修正方法,因此其所能获得的技术效果可参考上述方法实施例,在此不再赘述。Since the image distortion correction device 130 provided by the embodiment of the present application is another implementation form of the image distortion correction method shown in FIG. 1 or FIG. 3, and the image distortion correction device 130 can be configured to execute the image distortion correction method shown in FIG. 1 or FIG. The image distortion correction method provided by the embodiment, therefore, the technical effect that can be obtained can refer to the above method embodiment, and it will not be repeated here.
可选地,基于同一发明构思,本申请实施例还提供了一种计算机可读存储介质,该计算机可读存储介质上存储有计算机程序,该计算机程序被处理器运行时执行上述图像畸变修正方法的步骤。Optionally, based on the same inventive concept, an embodiment of the present application further provides a computer-readable storage medium having a computer program stored on the computer-readable storage medium, and the computer program is executed by a processor to execute the above-mentioned image distortion correction method A step of.
具体地,该存储介质能够为通用的存储介质,如移动磁盘、硬盘等,该存储介质上的计算机程序被运行时,能够执行上述图像畸变修正方法。Specifically, the storage medium can be a general storage medium, such as a portable disk, a hard disk, etc., and when the computer program on the storage medium is executed, the above-mentioned image distortion correction method can be executed.
本申请实施例是参照根据本申请实施例的方法、设备(如图6或者图7所示的电子设备100)、和计算机程序产品的流程图和/或方框图来描述的。应理解可由计算机程序指令实现流程图和/或方框图中的每一流程和/或方框、以及流程图和/或方框图中的流程和/或方框的结合。可提供这些计算机程序指令到通用计算机、专用计算机、嵌入式处理机或其他可编程数据处理设备的处理器以产生一个机器,使得通过计算机或其他可编程数据处理设备的处理器执行的指令产生用于实现在流程图一个流程或多个流程和/或方框图一个方框或多个方框中指定的功能的装置。The embodiments of the present application are described with reference to the flowcharts and/or block diagrams of the method, the device (the electronic device 100 shown in FIG. 6 or FIG. 7), and the computer program product according to the embodiments of the present application. It should be understood that each process and/or block in the flowchart and/or block diagram, and the combination of processes and/or blocks in the flowchart and/or block diagram can be implemented by computer program instructions. These computer program instructions can be provided to the processor of a general-purpose computer, a special-purpose computer, an embedded processor, or other programmable data processing equipment to generate a machine, so that the instructions executed by the processor of the computer or other programmable data processing equipment are generated It is a device that realizes the functions specified in one process or multiple processes in the flowchart and/or one block or multiple blocks in the block diagram.
尽管在此结合各实施例对本申请进行了描述,然而,在实施所要求保护的本申请过程中,本领域技术人员通过查看所述附图、公开内容、以及所附权利要求书,可理解并实现所述公开实施例的其他变化。在权利要求中,“包括”一词不排除其他组成部分或步骤,“一”或“一个”不排除多个的情况。单个处理器或其他单元可以实现权利要求中列举的若干项功能。相互不同的从属权利要求中记载了某些措施,但这并不表示这些措施不能组合起来产生良好的效果。Although the present application is described with reference to various embodiments, in the process of implementing the claimed application, those skilled in the art can understand and understand by viewing the drawings, the disclosure, and the appended claims. Implement other changes of the disclosed embodiment. In the claims, the word "comprising" does not exclude other components or steps, and "a" or "an" does not exclude a plurality. A single processor or other unit may implement several functions listed in the claims. Certain measures are described in mutually different dependent claims, but this does not mean that these measures cannot be combined to produce good results.
以上所述,仅为本申请的各种实施方式,但本申请的保护范围并不局限于此,任何熟悉本技术领域的技术人员在本申请揭露的技术范围内,可轻易想到变化或替换,都应涵盖在本申请的保护范围之内。因此,本申请的保护范围应所述以权利要求的保护范围为准。The above are only the various embodiments of the application, but the protection scope of the application is not limited thereto. Any person skilled in the art can easily think of changes or substitutions within the technical scope disclosed in the application. All should be covered within the scope of protection of this application. Therefore, the protection scope of this application shall be subject to the protection scope of the claims.
工业实用性Industrial applicability
本申请实施例通过对待修正图像进行人脸识别,得到待修正图像中至少两个人脸对应的人脸框信息和人脸关键点,然后根据识别到的每个人脸对应的人脸框信息确定待修正图像中的待修正人脸,并计算待修正人脸与摄像镜头的相对距离系数,之后根据相对距离系数对待修正人脸进行畸变修正,得到畸变修正后的目标图像。如此,能够在多人自拍合照时实时自动地识别待修正人脸进行畸变矫正,从而优化多人自拍合照场景中的拍摄效果。The embodiment of this application obtains the face frame information and face key points corresponding to at least two faces in the image to be corrected by performing face recognition on the image to be corrected, and then determines the face frame information corresponding to each recognized face. Correct the face to be corrected in the image, calculate the relative distance coefficient between the face to be corrected and the camera lens, and then perform distortion correction on the face to be corrected according to the relative distance coefficient to obtain the target image after distortion correction. In this way, it is possible to automatically recognize the face to be corrected for distortion correction in real-time when multiple people take a selfie together, thereby optimizing the shooting effect in a scene where multiple people take a selfie together.

Claims (18)

  1. 一种图像畸变修正方法,其特征在于,应用于电子设备,所述方法包括:An image distortion correction method, characterized in that it is applied to an electronic device, and the method includes:
    对待修正图像进行人脸识别,得到所述待修正图像中至少两个人脸对应的人脸框信息和人脸关键点;Performing face recognition on the image to be corrected to obtain face frame information and face key points corresponding to at least two faces in the image to be corrected;
    根据识别到的每个人脸对应的人脸框信息,确定所述待修正图像中的待修正人脸,并计算所述待修正人脸与摄像镜头的相对距离系数;Determine the face to be corrected in the image to be corrected according to the face frame information corresponding to each recognized face, and calculate the relative distance coefficient between the face to be corrected and the camera lens;
    根据所述相对距离系数对所述待修正人脸进行畸变修正,得到畸变修正后的目标图像。Distortion correction is performed on the face to be corrected according to the relative distance coefficient to obtain a target image after distortion correction.
  2. 根据权利要求1所述的图像畸变修正方法,其特征在于,所述对待修正图像进行人脸识别,得到所述待修正图像中至少两个人脸对应的人脸框信息和人脸关键点的步骤,包括:The image distortion correction method according to claim 1, wherein the step of performing face recognition on the image to be corrected to obtain face frame information and face key points corresponding to at least two faces in the image to be corrected ,include:
    在检测到相机开启指令后,开启摄像头并进入拍摄预览界面;After detecting the camera start command, turn on the camera and enter the shooting preview interface;
    针对所述拍摄预览界面中的每帧待修正图像,通过预先训练得到的人脸识别模型对该帧待修正图像进行人脸识别,得到该帧待修正图像中每个人脸对应的人脸框信息和人脸关键点;For each frame of the image to be corrected in the shooting preview interface, face recognition is performed on the frame of the image to be corrected through the face recognition model obtained in advance to obtain the face frame information corresponding to each face in the frame of the image to be corrected And key points of the face;
    其中,所述人脸识别模型利用多个训练样本和各个训练样本的标注数据基于深度学习的神经网络训练获得,其中,各个训练样本的标注数据包括该训练样本中各个人脸对应的人脸框信息和人脸关键点。Wherein, the face recognition model uses multiple training samples and the labeled data of each training sample to be obtained based on deep learning neural network training, where the labeled data of each training sample includes the face frame corresponding to each face in the training sample Key points of information and faces.
  3. 根据权利要求1或2所述的图像畸变修正方法,其特征在于,所述根据识别到的每个人脸对应的人脸框信息确定所述待修正图像中的待修正人脸,并计算所述待修正人脸与摄像镜头的相对距离系数的步骤之前,所述方法还包括:The image distortion correction method according to claim 1 or 2, wherein the face frame information corresponding to each recognized face is used to determine the face to be corrected in the image to be corrected, and calculate the Before the step of correcting the relative distance coefficient between the face and the camera lens, the method further includes:
    针对每个人脸,根据该人脸对应的人脸框信息裁剪出对应的人脸图像;For each face, crop out the corresponding face image according to the face frame information corresponding to the face;
    根据该人脸对应的人脸关键点,利用仿射矩阵将该人脸图像旋转到设定位置。According to the key points of the face corresponding to the face, the face image is rotated to the set position using the affine matrix.
  4. 根据权利要求3所述的图像畸变修正方法,其特征在于,所述方法还包括:4. The image distortion correction method according to claim 3, wherein the method further comprises:
    针对旋转后的每个人脸图像,采用预先训练的年龄预估模型对该人脸图像进行识别,得到该人脸图像中的人脸年龄;For each face image after rotation, a pre-trained age estimation model is used to recognize the face image to obtain the face age in the face image;
    判断该人脸图像中的人脸年龄是否大于设定年龄;Determine whether the age of the face in the face image is greater than the set age;
    若该人脸图像中的人脸年龄小于设定年龄,则根据该人脸图像中的人脸年龄对该人脸图像的人脸框大小进行矫正。If the age of the face in the face image is less than the set age, the size of the face frame of the face image is corrected according to the age of the face in the face image.
  5. 根据权利要求4所述的图像畸变修正方法,其特征在于,所述电子设备中预先存储有每个人脸年龄对应的人脸周长的中位数,所述根据该人脸图像中的人脸年龄对该人脸图像的人脸框大小进行矫正的步骤,包括:The image distortion correction method according to claim 4, wherein the electronic device pre-stores the median of the face circumference corresponding to the age of each face, and the face image in the face image The steps to correct the size of the face frame of the face image by age include:
    获取该人脸图像中的人脸年龄对应的人脸周长的第一中位数以及所述设定年龄对应的人脸周长的第二中位数;Acquiring the first median of the face circumference corresponding to the age of the face in the face image and the second median of the face circumference corresponding to the set age;
    根据所述第一中位数和所述第二中位数计算得到人脸框矫正系数;Calculating a face frame correction coefficient according to the first median and the second median;
    根据所述人脸框矫正系数对该人脸图像的人脸框大小进行矫正。The size of the face frame of the face image is corrected according to the face frame correction coefficient.
  6. 根据权利要求1-5中任意一项所述的图像畸变修正方法,其特征在于,所述根据识别到的每个人脸对应的人脸框信息确定所述待修正图像中的待修正人脸,并计算所述待修正人脸与摄像镜头的相对距离系数的步骤,包括:The image distortion correction method according to any one of claims 1 to 5, wherein said determining the face to be corrected in the image to be corrected according to face frame information corresponding to each recognized face, And the step of calculating the relative distance coefficient between the face to be corrected and the camera lens includes:
    根据所述每个人脸对应的人脸框信息,确定人脸框面积最大的人脸为待修正人脸;According to the face frame information corresponding to each face, determine the face with the largest face frame area as the face to be corrected;
    计算所述待修正人脸与摄像镜头的相对距离系数。Calculate the relative distance coefficient between the face to be corrected and the camera lens.
  7. 根据权利要求6所述的图像畸变修正方法,其特征在于,所述计算所述待修正人脸与摄像镜头的相对距离系数的步骤,包括:8. The image distortion correction method according to claim 6, wherein the step of calculating the relative distance coefficient between the face to be corrected and the camera lens comprises:
    根据所述每个人脸对应的人脸框信息,计算识别到的所有人脸对应的人脸框的平均面积;Calculating the average area of the face frame corresponding to all recognized faces according to the face frame information corresponding to each face;
    计算每个人脸对应的人脸框的面积与所述平均面积的差值平方值之和;Calculating the sum of the square value of the difference between the area of the face frame corresponding to each face and the average area;
    根据所述差值平方值之和计算所述待修正人脸与摄像镜头的相对距离系数,具体计算公式为:The relative distance coefficient between the face to be corrected and the camera lens is calculated according to the sum of the squared values of the difference. The specific calculation formula is:
    Figure PCTCN2019102870-appb-100001
    Figure PCTCN2019102870-appb-100001
    其中,d为所述待修正人脸与摄像镜头的相对距离系数,N为人脸数量,x ix i为第i个人脸框的面积,r为所有人脸对应的人脸框的平均面积。 Where, d is the relative distance coefficient between the face to be corrected and the camera lens, N is the number of faces, x i x i is the area of the i-th face frame, and r is the average area of the face frame corresponding to all faces.
  8. 根据权利要求6所述的图像畸变修正方法,其特征在于,所述计算所述待修正人脸与摄像镜头的相对距离系数的步骤,包括:8. The image distortion correction method according to claim 6, wherein the step of calculating the relative distance coefficient between the face to be corrected and the camera lens comprises:
    获取所述待修正人脸之外的其它人脸的人脸框对应的中位数面积和最大数面积;Acquiring the median area and the maximum number area corresponding to the face frame of the face other than the face to be corrected;
    计算所述中位数面积与所述待修正人脸的人脸框面积的第一比值以及所述最大数面积与所述待修正人脸的人脸框面积的第二比值;Calculating a first ratio of the median area to the face frame area of the face to be corrected and a second ratio of the maximum number area to the face frame area of the face to be corrected;
    根据预设的第一比值和第二比值各自对应的权重系数、所述第一比值和所述第二比值计算所述待修正人脸与摄像镜头的相对距离系数,具体计算公式为:The relative distance coefficient between the face to be corrected and the camera lens is calculated according to the weight coefficients corresponding to the preset first ratio and second ratio, the first ratio and the second ratio, and the specific calculation formula is:
    Figure PCTCN2019102870-appb-100002
    Figure PCTCN2019102870-appb-100002
    其中,d为所述待修正人脸与摄像镜头的相对距离系数,a max为所述待修正人脸之外的其它人脸的人脸框对应的最大数面积,a mid为所述待修正人脸之外的其它人脸的人脸框对应的中位数面积,K为0到1之间的常数,y为所述待修人脸的人脸框面积。 Where d is the relative distance coefficient between the face to be corrected and the camera lens, a max is the maximum number area corresponding to the face frame of the face other than the face to be corrected, and a mid is the face to be corrected The median area corresponding to the face frame of the face other than the face, K is a constant between 0 and 1, and y is the face frame area of the face to be repaired.
  9. 根据权利要求1-8中任意一项所述的图像畸变修正方法,其特征在于,所述电子设备预先存储有多个预设距离系数对应的畸变修正参数,所述根据所述相对距离系数对所述待修正人脸进行畸变修正,得到畸变修正后的目标图像的步骤,包括:The image distortion correction method according to any one of claims 1-8, wherein the electronic device pre-stores a plurality of distortion correction parameters corresponding to preset distance coefficients, and the pair of distortion correction parameters according to the relative distance coefficients The step of performing distortion correction on the face to be corrected to obtain a target image after distortion correction includes:
    获取所述相对距离系数所在的预设距离系数范围,所述预设距离系数范围包括第一端点值和第二端点值,所述第一端点值小于所述第二端点值;Acquiring a preset distance coefficient range in which the relative distance coefficient is located, the preset distance coefficient range including a first endpoint value and a second endpoint value, the first endpoint value is less than the second endpoint value;
    计算所述相对距离系数与所述第一端点值的第一差值、所述第二端点值与所述第一端点值的第二差值以及所述第二端点值对应的畸变修正参数与所述第一端点值对应的畸变修正参数的第三差值;Calculate the first difference between the relative distance coefficient and the first endpoint value, the second difference between the second endpoint value and the first endpoint value, and the distortion correction corresponding to the second endpoint value The third difference between the parameter and the distortion correction parameter corresponding to the first endpoint value;
    根据所述第一端点值、所述第一差值、所述第二差值以及所述第三差值计算得到对应的目标畸变修正参数;Calculating corresponding target distortion correction parameters according to the first endpoint value, the first difference value, the second difference value, and the third difference value;
    根据所述目标畸变修正参数对所述待修正人脸进行畸变修正,得到畸变修正后的目标图像;Performing distortion correction on the face to be corrected according to the target distortion correction parameter to obtain a target image after the distortion correction;
    其中,所述目标畸变修正参数通过以下计算公式得到:Wherein, the target distortion correction parameter is obtained by the following calculation formula:
    Figure PCTCN2019102870-appb-100003
    Figure PCTCN2019102870-appb-100003
    其中,z为目标畸变修正参数,d为所述待修正人脸与摄像镜头的相对距离系数,d 1为所述第一端点值,d 2为所述第二端点值,c 1为所述第一端点值对应的畸变修正参数,c 2为所述第一端点值对应的畸变修正参数。 Where z is the target distortion correction parameter, d is the relative distance coefficient between the face to be corrected and the camera lens, d 1 is the first endpoint value, d 2 is the second endpoint value, and c 1 is the The distortion correction parameter corresponding to the first endpoint value, and c 2 is the distortion correction parameter corresponding to the first endpoint value.
  10. 根据权利要求9所述的图像畸变修正方法,其特征在于,所述根据所述目标畸变修正参数对所述待修正人脸进行畸变修正,得到畸变修正后的目标图像的步骤,包括:9. The image distortion correction method according to claim 9, wherein the step of performing distortion correction on the face to be corrected according to the target distortion correction parameter to obtain a target image after the distortion correction comprises:
    建立所述待修正人脸的人脸网格,并确定所述人脸网格中的各个约束点;Establishing a face grid of the face to be corrected, and determining each constraint point in the face grid;
    根据所述目标畸变修正参数计算所述人脸网格中的各个约束点的约束形变量;Calculating the constraint deformation variables of each constraint point in the face grid according to the target distortion correction parameter;
    根据计算的各个约束点的约束形变量对各个约束点的坐标进行调整,得到调整后的人脸网格;Adjust the coordinates of each constraint point according to the calculated constraint deformation variables of each constraint point to obtain an adjusted face grid;
    将所述待修正人脸映射到所述调整后的人脸网格,得到畸变修正后的目标图像。The face to be corrected is mapped to the adjusted face grid to obtain a target image after distortion correction.
  11. 根据权利要求2-10所述的图像畸变修正方法,其特征在于,所述方法还包括:11. The image distortion correction method according to claims 2-10, wherein the method further comprises:
    将畸变修正后的每张目标图像实时显示在所述拍摄预览界面中,并在检测到拍摄指令时,将当前显示在所述拍摄预览界面中的目标图像作为拍摄图像并存储在所述电子设备中。Display each target image after distortion correction in the shooting preview interface in real time, and when a shooting instruction is detected, use the target image currently displayed in the shooting preview interface as a shooting image and store it in the electronic device in.
  12. 根据权利要求1项所述的图像畸变修正方法,其特征在于,所述根据识别到的每个人脸对应的人脸框信息确定所述待修正图像中的待修正人脸的步骤,包括:The image distortion correction method according to claim 1, wherein the step of determining the face to be corrected in the image to be corrected according to the face frame information corresponding to each recognized face comprises:
    根据所述每个人脸对应的人脸框信息,确定人脸框面积最大的人脸为待修正人脸。According to the face frame information corresponding to each face, it is determined that the face with the largest face frame area is the face to be corrected.
  13. 根据权利要求12所述的图像畸变矫正方法,其特征在于,所述计算所述待修正人脸与摄像镜头的相对距离系数的步骤,包括:The image distortion correction method according to claim 12, wherein the step of calculating the relative distance coefficient between the face to be corrected and the camera lens comprises:
    根据各人脸的人脸框的面积计算所述待修正人脸与摄像头的相对距离系数。The relative distance coefficient between the face to be corrected and the camera is calculated according to the area of the face frame of each face.
  14. 根据权利要求12或13所述的图像畸变修正方法,其特征在于,所述确定人脸框面积最大的人脸为待修正人脸之前,所述方法还包括:The image distortion correction method according to claim 12 or 13, wherein before the determining that the face with the largest face frame area is the face to be corrected, the method further comprises:
    识别所述待修正图像中各人脸图像对应的人脸年龄;Identifying the age of the face corresponding to each face image in the image to be corrected;
    根据各人脸图像对应的人脸年龄对各人脸图像的人脸框大小进行矫正。The size of the face frame of each face image is corrected according to the face age corresponding to each face image.
  15. 根据权利要求12-14任意一项所述的图像畸变修正方法,其特征在于,所述根据识别到的每个人脸对应的人脸框信息确定所述待修正图像中的待修正人脸,并计算所述待修正人脸与摄像镜头的相对距离系数的步骤之前,所述方法还包括:The image distortion correction method according to any one of claims 12-14, wherein the face frame information corresponding to each recognized face is determined to determine the face to be corrected in the image to be corrected, and Before the step of calculating the relative distance coefficient between the face to be corrected and the camera lens, the method further includes:
    针对每个人脸,根据该人脸对应的人脸框信息裁剪出对应的人脸图像;For each face, crop out the corresponding face image according to the face frame information corresponding to the face;
    根据该人脸对应的人脸关键点,利用仿射矩阵将该人脸图像旋转到设定位置。According to the key points of the face corresponding to the face, the face image is rotated to the set position using the affine matrix.
  16. 一种图像畸变修正装置,其特征在于,应用于电子设备,所述装置包括:An image distortion correction device, characterized in that it is applied to electronic equipment, and the device includes:
    识别模块,配置成对待修正图像进行人脸识别,得到所述待修正图像中至少两个人脸对应的人脸框信息和人脸关键点;A recognition module configured to perform face recognition on the image to be corrected, and obtain face frame information and face key points corresponding to at least two faces in the image to be corrected;
    计算模块,配置成根据识别到的每个人脸对应的人脸框信息确定所述待修正图像中的待修正人脸,并计算所述待修正人脸与摄像镜头的相对距离系数;A calculation module, configured to determine the face to be corrected in the image to be corrected according to the face frame information corresponding to each recognized face, and calculate the relative distance coefficient between the face to be corrected and the camera lens;
    畸变修正模块,配置成根据所述相对距离系数对所述待修正人脸进行畸变修正,得到畸变修正后的目标图像。The distortion correction module is configured to perform distortion correction on the face to be corrected according to the relative distance coefficient to obtain a target image after distortion correction.
  17. 一种电子设备,其特征在于,所述电子设备包括一个或多个存储介质和一个或多个与存储介质通信的处理器,一个或多个存储介质存储有处理器可执行的机器可执行指令,当电子设备运行时,处理器执行所述机器可执行指令,以实现权利要求1-15中任意一项所述的图像畸变修正方法。An electronic device, characterized in that the electronic device includes one or more storage media and one or more processors in communication with the storage media, and the one or more storage media stores machine executable instructions executable by the processor When the electronic device is running, the processor executes the machine executable instructions to realize the image distortion correction method according to any one of claims 1-15.
  18. 一种可读存储介质,其特征在于,所述可读存储介质存储有机器可执行指令,所述机器可执行指令被执行时实现权利要求1-15中任意一项所述的图像畸变修正方法。A readable storage medium, wherein the readable storage medium stores machine-executable instructions, and the machine-executable instructions realize the image distortion correction method according to any one of claims 1-15 when executed .
PCT/CN2019/102870 2019-06-17 2019-08-27 Image distortion correction method, apparatus, electronic device and readable storage medium WO2020252910A1 (en)

Applications Claiming Priority (2)

Application Number Priority Date Filing Date Title
CN201910521767.1A CN110232667B (en) 2019-06-17 2019-06-17 Image distortion correction method, device, electronic equipment and readable storage medium
CN201910521767.1 2019-06-17

Publications (1)

Publication Number Publication Date
WO2020252910A1 true WO2020252910A1 (en) 2020-12-24

Family

ID=67860030

Family Applications (1)

Application Number Title Priority Date Filing Date
PCT/CN2019/102870 WO2020252910A1 (en) 2019-06-17 2019-08-27 Image distortion correction method, apparatus, electronic device and readable storage medium

Country Status (2)

Country Link
CN (1) CN110232667B (en)
WO (1) WO2020252910A1 (en)

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN114120391A (en) * 2021-10-19 2022-03-01 哈尔滨理工大学 Multi-pose face recognition system and method thereof

Families Citing this family (14)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN110751602B (en) * 2019-09-20 2022-09-30 北京迈格威科技有限公司 Conformal distortion correction method and device based on face detection
CN111028161B (en) * 2019-11-22 2024-04-05 维沃移动通信有限公司 Image correction method and electronic equipment
CN111008947B (en) * 2019-12-09 2024-05-07 Oppo广东移动通信有限公司 Image processing method and device, terminal equipment and storage medium
CN111080545B (en) * 2019-12-09 2024-03-12 Oppo广东移动通信有限公司 Face distortion correction method, device, terminal equipment and storage medium
CN111105367B (en) * 2019-12-09 2023-07-18 Oppo广东移动通信有限公司 Face distortion correction method and device, electronic equipment and storage medium
CN111158563A (en) * 2019-12-11 2020-05-15 青岛海信移动通信技术股份有限公司 Electronic terminal and picture correction method
CN111325691B (en) * 2020-02-20 2023-11-10 Oppo广东移动通信有限公司 Image correction method, apparatus, electronic device, and computer-readable storage medium
CN111337142A (en) * 2020-04-07 2020-06-26 北京迈格威科技有限公司 Body temperature correction method and device and electronic equipment
CN113850726A (en) * 2020-06-28 2021-12-28 华为技术有限公司 Image transformation method and device
WO2022001630A1 (en) * 2020-06-29 2022-01-06 Guangdong Oppo Mobile Telecommunications Corp., Ltd. Method and system for capturing at least one smart media
CN112070021B (en) * 2020-09-09 2024-08-13 深圳数联天下智能科技有限公司 Ranging method, ranging system, equipment and storage medium based on face detection
CN112927183A (en) * 2021-01-13 2021-06-08 上海商米科技集团股份有限公司 Lens module detection method and system of specific image recognition equipment
CN113971827A (en) * 2021-10-27 2022-01-25 中国银行股份有限公司 Face recognition method and device
CN115937010B (en) * 2022-08-17 2023-10-27 北京字跳网络技术有限公司 Image processing method, device, equipment and medium

Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN103426149A (en) * 2013-07-24 2013-12-04 玉振明 Large-viewing-angle image distortion correction and processing method
US20160283780A1 (en) * 2015-03-25 2016-09-29 Alibaba Group Holding Limited Positioning feature points of human face edge
CN107358207A (en) * 2017-07-14 2017-11-17 重庆大学 A kind of method for correcting facial image
CN108470322A (en) * 2018-03-09 2018-08-31 北京小米移动软件有限公司 Handle the method, apparatus and readable storage medium storing program for executing of facial image
CN109543495A (en) * 2017-09-22 2019-03-29 中国移动通信有限公司研究院 A kind of face key point mask method, device, electronic equipment and storage medium

Family Cites Families (13)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN103208133B (en) * 2013-04-02 2015-08-19 浙江大学 The method of adjustment that in a kind of image, face is fat or thin
JP6389888B2 (en) * 2013-08-04 2018-09-12 アイズマッチ エルティーディー.EyesMatch Ltd. Virtualization device, system and method in mirror
CN105574006A (en) * 2014-10-10 2016-05-11 阿里巴巴集团控股有限公司 Method and device for establishing photographing template database and providing photographing recommendation information
KR102290301B1 (en) * 2015-05-06 2021-08-17 엘지전자 주식회사 Mobile terminal and method of controlling the same
CN105046657B (en) * 2015-06-23 2018-02-09 浙江大学 A kind of image stretch distortion self-adapting correction method
CN105550671A (en) * 2016-01-28 2016-05-04 北京麦芯科技有限公司 Face recognition method and device
CN105554403B (en) * 2016-02-29 2018-12-04 广东欧珀移动通信有限公司 Control method, control device and electronic device
CN106131409B (en) * 2016-07-12 2019-01-25 京东方科技集团股份有限公司 Image processing method and device
CN108021852A (en) * 2016-11-04 2018-05-11 株式会社理光 A kind of demographic method, passenger number statistical system and electronic equipment
CN107124543B (en) * 2017-02-20 2020-05-29 维沃移动通信有限公司 Shooting method and mobile terminal
CN107506693B (en) * 2017-07-24 2019-09-20 深圳市智美达科技股份有限公司 Distort face image correcting method, device, computer equipment and storage medium
CN108357269B (en) * 2018-04-12 2023-05-02 电子科技大学中山学院 Intelligent pen rack
CN109447072A (en) * 2018-11-08 2019-03-08 北京金山安全软件有限公司 Thumbnail clipping method and device, electronic equipment and readable storage medium

Patent Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN103426149A (en) * 2013-07-24 2013-12-04 玉振明 Large-viewing-angle image distortion correction and processing method
US20160283780A1 (en) * 2015-03-25 2016-09-29 Alibaba Group Holding Limited Positioning feature points of human face edge
CN107358207A (en) * 2017-07-14 2017-11-17 重庆大学 A kind of method for correcting facial image
CN109543495A (en) * 2017-09-22 2019-03-29 中国移动通信有限公司研究院 A kind of face key point mask method, device, electronic equipment and storage medium
CN108470322A (en) * 2018-03-09 2018-08-31 北京小米移动软件有限公司 Handle the method, apparatus and readable storage medium storing program for executing of facial image

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN114120391A (en) * 2021-10-19 2022-03-01 哈尔滨理工大学 Multi-pose face recognition system and method thereof

Also Published As

Publication number Publication date
CN110232667B (en) 2021-06-04
CN110232667A (en) 2019-09-13

Similar Documents

Publication Publication Date Title
WO2020252910A1 (en) Image distortion correction method, apparatus, electronic device and readable storage medium
WO2019085786A1 (en) Image processing method and device, electronic device and computer-readable storage medium
US10674069B2 (en) Method and apparatus for blurring preview picture and storage medium
CN101216883B (en) A photography method and device
US7356254B2 (en) Image processing method, apparatus, and program
CN105046657B (en) A kind of image stretch distortion self-adapting correction method
US8350955B2 (en) Digital photographing apparatus, method of controlling the digital photographing apparatus, and recording medium having recorded thereon a program for executing the method
US8577099B2 (en) Method, apparatus, and program for detecting facial characteristic points
US20180359415A1 (en) Panoramic video processing method and device and non-transitory computer-readable medium
US11283987B2 (en) Focus region display method and apparatus, and storage medium
US20050243350A1 (en) Image processing method, apparatus, and program
CN108810406B (en) Portrait light effect processing method, device, terminal and computer readable storage medium
JP2005303991A (en) Imaging device, imaging method, and imaging program
JP4515208B2 (en) Image processing method, apparatus, and program
WO2021008205A1 (en) Image processing
JP2006139369A (en) Image processing method and apparatus, and program
CN110781712B (en) Human head space positioning method based on human face detection and recognition
WO2022042669A1 (en) Image processing method, apparatus, device, and storage medium
CN116152121B (en) Curved surface screen generating method and correcting method based on distortion parameters
JP7110899B2 (en) Image processing device, image processing method, and image processing program
JP2009251634A (en) Image processor, image processing method, and program
WO2022127491A1 (en) Image processing method and device, and storage medium and terminal
US11763509B2 (en) Frame calibration for robust video synthesis
CN114049250B (en) Method, device and medium for correcting face pose of certificate photo
WO2024146165A1 (en) Human eye positioning method and apparatus, and computing device and storage medium

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: 19933452

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: 19933452

Country of ref document: EP

Kind code of ref document: A1

122 Ep: pct application non-entry in european phase

Ref document number: 19933452

Country of ref document: EP

Kind code of ref document: A1

32PN Ep: public notification in the ep bulletin as address of the adressee cannot be established

Free format text: NOTING OF LOSS OF RIGHTS PURSUANT TO RULE 112(1) EPC (EPO FORM 1205A DATED 22.06.2022)

122 Ep: pct application non-entry in european phase

Ref document number: 19933452

Country of ref document: EP

Kind code of ref document: A1