Portrait processing method, device, electronic device and readable storage medium

By registering and fusing the portrait images captured by the camera, the highlight area of ​​the portrait face is quickly removed, which solves the problem of low highlight area removal efficiency in the existing technology and achieves efficient image processing.

CN112053389BActive Publication Date: 2024-10-29YUANLI TUXIN (CHONGQING) TECHNOLOGY CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202010742109.8
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2020-07-28
Publication Date
2024-10-29
Estimated Expiration
2040-07-28

AI Technical Summary

Technical Problem

When taking portraits with the existing technology, it is difficult to quickly remove the highlight area of ​​the human face, which affects the image quality, and requires manual processing through photo editing software, which is inefficient.

Method used

By acquiring portrait images taken by the first camera and the second camera, the registration algorithm is used to register the images. When the highlight areas do not overlap, the non-highlight areas of the second camera are merged with the highlight areas of the first camera to remove Highlight area, or fill color features around the highlight area to remove the highlight area.

Benefits of technology

It improves the efficiency and accuracy of removing highlight areas on portrait faces, reduces the reliance on manual intervention in image processing, and improves image quality.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN112053389B_ABST
    Figure CN112053389B_ABST
Patent Text Reader

Abstract

The present application provides a portrait processing method, device, electronic device and readable storage medium, which relate to the field of computer image technology. The method includes: obtaining a first image containing a target portrait taken by a first camera, and a second image containing a target portrait taken by a second camera; registering the first image and the second image by a registration algorithm; when there is a highlight area in the facial area of ​​the portrait in the first image, and the highlight area does not overlap in the registered first image and the second image, the image area corresponding to the position of the highlight area in the second image is fused with the highlight area in the first image to obtain a fused target image, based on which the highlight area of ​​the face of the person in the image can be quickly removed to improve the efficiency of removing the highlight area in the facial area.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

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

[0002] Taking a picture is also called photography or photographing. It generally refers to the process of exposing a photosensitive medium through light reflected from an object. When you need to take a picture of a person, you can use a camera to take a picture of the person and get an image of the person. In the process of taking a picture, it is easy for the oily or other reflections on the face to cause a highlight area on the face in the captured image, which affects the quality of the image. At present, it is usually necessary to manually remove the highlight area on the face of the person in the image through photo editing software, which is inefficient in obtaining the finished image. Summary of the invention

[0003] The present application provides a portrait processing method, device, electronic device and readable storage medium, which can improve the problem of low efficiency in removing highlight areas of a person's face in an image.

[0004] In order to achieve the above purpose, the technical solutions provided in the embodiments of the present application are as follows:

[0005] In a first aspect, an embodiment of the present application provides a method for processing a portrait, the method comprising:

[0006] Acquire a first image including a target person's portrait taken by a first camera, and a second image including the target person's portrait taken by a second camera;

[0007] Registering the first image and the second image by using a registration algorithm;

[0008] When there is a highlight area in the portrait facial area in the first image, and the highlight area does not overlap in the first image and the second image after registration, the image area corresponding to the position of the highlight area in the second image is fused with the highlight area in the first image to obtain a fused target image.

[0009] In the above-mentioned embodiment, by capturing images containing a target portrait with the first camera and the second camera, images of the portrait's face at different viewing angles can be obtained, and then the highlight area in the first image is fused with the non-highlight area in the second image corresponding to the highlight area in the first image to obtain a target image with the highlight area removed. Based on this, the highlight area of ​​the person's face in the first image can be quickly removed to improve the efficiency of removing the highlight area in the facial area.

[0010] In combination with the first aspect, in some optional implementations, the method further includes:

[0011] When there are highlight areas in the portrait facial areas in both the first image and the second image, and the highlight areas overlap in the first image and the second image after registration, and the overlapping highlight areas are in the forehead area or cheek area of ​​the portrait facial area, the corresponding highlight areas in the first image are filled in the forehead area or cheek area based on the color features of the image area within a set range around the highlight area to obtain a target image.

[0012] In the above-mentioned embodiment, when the highlight areas overlap in the first image and the second image, and the overlapping highlight areas are in the forehead area or cheek area of ​​the portrait facial area, at this time, the highlight area can be removed by filling the corresponding highlight area with the color features of the image area surrounding the highlight area.

[0013] In combination with the first aspect, in some optional implementations, before fusing the image area corresponding to the position of the highlight area in the second image with the highlight area in the first image to obtain a fused target image, the method further includes:

[0014] Determine a portrait facial region from the first image and the second image;

[0015] Determine whether there is an area in the portrait facial area whose brightness is greater than or equal to a preset threshold, wherein, when there is an area whose brightness is greater than or equal to the preset threshold, determine that the highlight area exists in the first image and the second image.

[0016] In the above-mentioned implementation, by identifying and judging the brightness in the portrait face region, it is possible to quickly and accurately judge whether there is a highlight region in the portrait face region.

[0017] In combination with the first aspect, in some optional implementations, determining whether there is an image region in the portrait facial region whose brightness is greater than or equal to a preset threshold includes:

[0018] Performing grayscale processing on the image region of the portrait face area to obtain a grayscale image region;

[0019] If there are pixels in the grayscale image area whose grayscale values ​​are greater than or equal to a preset grayscale threshold, and the pixels whose grayscale values ​​are greater than or equal to the preset grayscale threshold are connected, and the number of connected pixels is greater than or equal to a set number, it is determined that there is an image area in the portrait facial area whose brightness is greater than or equal to the preset threshold.

[0020] In combination with the first aspect, in some optional implementations, the method further includes:

[0021] When there is a highlight area in the facial area of ​​the portrait in the first image and the second image, and the highlight area overlaps with the mouth area in the first image and the second image after registration, the image area of ​​the highlight area in the first image is retained to obtain a target image.

[0022] In the above-mentioned embodiment, by retaining the highlight area overlapping the mouth area, it is possible to avoid removing the highlight of the area due to the highlight of the teeth when the mouth is opened, thereby improving the accuracy and reliability of removing the highlight area.

[0023] In conjunction with the first aspect, in some optional implementations, registering the first image and the second image using a registration algorithm includes:

[0024] Determine multiple groups of matching target facial feature points from the first image and the second image by using the registration algorithm, each group of target facial feature points including first facial feature points in the first image and second facial feature points in the second image;

[0025] Determine, based on a position of each of the first facial feature points in the first image and a position of each of the second facial feature points in the second image, a homography transformation matrix for aligning the second image with the first image;

[0026] The second image is registered and aligned according to the homography transformation matrix.

[0027] In the above implementation, a configuration algorithm is used to determine a homography transformation matrix for aligning the second image with the first image, and then the homography transformation matrix is ​​used to quickly and accurately register and align the second image.

[0028] In combination with the first aspect, in some optional implementations, determining multiple groups of matching target facial feature points from the first image and the second image by using the registration algorithm includes:

[0029] Determining matching facial feature points from the first image and the second image by using the registration algorithm;

[0030] Based on the similarity between the first facial feature points and the corresponding second facial feature points, a specified number of facial feature points with the greatest similarity are selected from the matched facial feature points as the target facial feature points.

[0031] In the above-mentioned embodiment, by selecting a specified number of groups of facial feature points with the greatest similarity as target facial feature points, and then using the target facial feature points to determine the homography transformation matrix, it is beneficial to improve the accuracy and reliability of the determined homography transformation matrix, thereby helping to improve the accuracy and reliability of the registration and alignment of the second image.

[0032] In combination with the first aspect, in some optional implementations, fusing the image area corresponding to the position of the highlight area in the second image with the highlight area in the first image to obtain a fused target image includes:

[0033] The highlight area in the first image is fused with the image area in the second image at a position corresponding to the highlight area in the first image to obtain a fused first image as the target image.

[0034] In the above-mentioned embodiment, the highlight area in the first image can be fused to obtain a target image with the highlight area removed, without manually removing the highlight area through photo editing software, which is beneficial to improving the efficiency of removing the highlight area in the portrait facial area.

[0035] In combination with the first aspect, in some optional implementations, the first camera and the second camera are cameras in an array camera.

[0036] In a second aspect, an embodiment of the present application further provides a portrait processing device, the device comprising:

[0037] An image acquisition unit, used to acquire a first image including a target person's portrait taken by a first camera, and a second image including the target person's portrait taken by a second camera;

[0038] A registration unit, configured to register the first image and the second image using a registration algorithm;

[0039] The image fusion unit is used to fuse the image area corresponding to the position of the highlight area in the second image with the highlight area in the first image when there is a highlight area in the portrait facial area in the first image and the highlight area does not overlap in the first image and the second image after registration, so as to obtain a fused target image.

[0040] In a third aspect, an embodiment of the present application further provides an electronic device, comprising a memory and a processor coupled to each other, wherein a computer program is stored in the memory, and when the computer program is executed by the processor, the electronic device executes the above method.

[0041] In a fourth aspect, an embodiment of the present application further provides a computer-readable storage medium, wherein a computer program is stored in the computer-readable storage medium. When the computer program is executed on a computer, the computer executes the above method. BRIEF DESCRIPTION OF THE DRAWINGS

[0042] In order to more clearly illustrate the technical solutions of the embodiments of the present application, the following is a brief introduction to the drawings required for use in the embodiments. It should be understood that the following drawings only illustrate certain embodiments of the present application and should not be regarded as limiting the scope. For those of ordinary skill in the art, other relevant drawings can be obtained based on these drawings without creative work.

[0043] Figure 1 A schematic diagram of the circuit structure of an electronic device provided in an embodiment of the present application.

[0044] Figure 2 A schematic diagram of the process flow of the portrait processing method provided in an embodiment of the present application.

[0045] Figure 3a A schematic diagram of a first portrait provided in an embodiment of the present application.

[0046] Figure 3b A schematic diagram of a second portrait provided in an embodiment of the present application.

[0047] Figure 3c A schematic diagram of a target portrait provided in an embodiment of the present application.

[0048] Figure 4 A functional device of the portrait processing device provided in the embodiment of the present application.

[0049] Icons: 10 - electronic device; 11 - processing module; 12 - storage module; 13 - array camera; 14 - first camera; 15 - second camera; 200 - portrait processing device; 210 - image acquisition unit; 220 - registration unit; 230 - image fusion unit. DETAILED DESCRIPTION

[0050] The technical solutions in the embodiments of the present application will be described below in conjunction with the accompanying drawings in the embodiments of the present application. It should be noted that the terms "first", "second" and the like are only used to distinguish descriptions and cannot be understood as indicating or implying relative importance.

[0051] Please refer to Figure 1, an embodiment of the present application provides an electronic device 10, which can automatically remove the highlight area in the facial area of ​​a portrait in an image when corresponding conditions are met, without the need to manually remove the highlight area in the facial area of ​​the portrait through photo editing software. The highlight area in the facial area of ​​the portrait includes but is not limited to the oily area of ​​the face, the area of ​​the face formed by reflecting external light such as light and sunlight, the reflective area of ​​glasses, etc. Among them, the electronic device 10 may include a processing module 11 and a storage module 12, and the storage module 12 stores a computer program. When the computer program is executed by the processing module 11, the electronic device 10 can execute each step in the following portrait processing method.

[0052] In this embodiment, the electronic device 10 may further include other modules, for example, the electronic device 10 may further include an array camera 13. The array camera 13 may include a first camera 14 and a second camera 15. The first camera 14 and the second camera 15 may be understood as two cameras in the array camera 13, or two types of cameras in the array camera 13. For example, when the array camera 13 includes multiple cameras, the first camera 14 may be understood as one of the multiple cameras, and the second camera 15 may be understood as the remaining cameras in the multiple cameras except the first camera 14.

[0053] The processing module 11, the storage module 12 and the array camera 13 are electrically connected directly or indirectly to achieve data transmission or interaction. For example, these components can be electrically connected to each other through one or more communication buses or signal lines.

[0054] The electronic device 10 may be, but is not limited to, a smart phone, a personal computer (PC), a tablet computer, a personal digital assistant (PDA), etc.

[0055] Please refer to Figure 2 The embodiment of the present application also provides a portrait processing method, which can be applied to the above-mentioned electronic device 10, and each step in the method is executed or implemented by the electronic device 10. The method may include steps S110 to S130, as follows:

[0056] Step S110, acquiring a first image including a target person portrait taken by the first camera 14, and a second image including the target person portrait taken by the second camera 15;

[0057] Step S120, registering the first image and the second image using a registration algorithm;

[0058] Step S130, when there is a highlight area in the portrait facial area in the first image, and the highlight area does not overlap in the first image and the second image after registration, the image area corresponding to the position of the highlight area in the second image is fused with the highlight area in the first image to obtain a fused target image.

[0059] It can be understood that by shooting an image containing a target portrait with the first camera 14 and the second camera 15, images of the portrait face at different viewing angles can be obtained, and then the highlight area in the first image is fused with the image area in the second image corresponding to the highlight area in the first image to obtain a target image with the highlight area removed. Based on this, the highlight area of ​​the face of the person in the first image can be quickly removed to improve the efficiency of removing the highlight area in the facial area. It should be noted that the processing method for removing the highlight area in the second image is similar to the processing method for removing the highlight area in the first image.

[0060] The following is a detailed description of each step in the method:

[0061] In step S110, the image containing the target portrait captured by the first camera 14 is the first image. The image containing the target portrait captured by the second camera 15 is the second image. The target portrait can be understood as a portrait of the same person captured by the first camera 14 and the second camera 15. The number of target portraits contained in the first image and the second image can be determined according to actual conditions, and can be one, two, or more, etc., which is not specifically limited here.

[0062] The electronic device 10 can obtain a first image and a second image containing a target person obtained by photographing the person with the first camera 14 and the second camera 15. The first camera 14 and the second camera 15 are cameras in the array camera 13. The array camera 13 can be a module in the electronic device 10, or a module independent of the electronic device 10.

[0063] For example, the electronic device 10 is a smart phone, the first camera 14 and the second camera 15 are two cameras in the array camera 13 of the smart phone, or the first camera 14 and the second camera 15 are two types of cameras in the array camera 13 of the smart phone, for example, the first camera 14 is the main camera of the array camera 13 in the smart phone, and the second camera 15 is other cameras in the array camera 13 excluding the main camera. When performing highlight removal processing, highlight detection can be performed only on the image captured by the main camera, and when the image has a corresponding highlight area, the highlight area is removed to obtain the final target image.

[0064] If the array camera 13 is a module independent of the electronic device 10, when the array camera 13 captures an image of a person, a communication connection can be established between the electronic device 10 and the array camera 13, so that the electronic device 10 can obtain the first image captured by the first camera 14 and the second image captured by the second camera 15 from the array camera 13.

[0065] It is understandable that the time point at which the first camera 14 captures the first image is the same as or close to the time point at which the second camera 15 captures the second image. For example, the first camera 14 and the second camera 15 capture the person at the same time to obtain the first image and the second image, respectively. Alternatively, the first camera 14 and the second camera 15 capture the person successively within a specified time range to obtain the first image and the second image, respectively. The specified time range is a shorter time range to avoid a large difference in the content of the images captured by the first camera 14 and the second camera 15 due to a long time interval. For example, after the first camera 14 captures the first image, the second camera 15 captures the second image within the specified time range. The specified time range can be set according to actual conditions, for example, it can be 100 milliseconds, 1 second, 2 seconds, etc.

[0066] As an optional implementation, before step S120, the method can also use a face recognition algorithm to determine whether there is a portrait of the same face in the first image and the second image. Only when there is a portrait of the same face in the first image and the second image, the first image and the second image are determined to be valid images, and then step S120 is performed again. If there is no portrait of the same face in the first image and the second image, or there is no portrait of the face, the first image and the second image are determined to be invalid images. At this time, there is no need to continue step S120, and step S110 can be performed again to obtain new first images and second images taken by the first camera 14 and the second camera 15.

[0067] Among them, judging whether the first image and the second image contain the same facial image by using a facial recognition algorithm is well known to those skilled in the art and will not be described in detail here.

[0068] It can be understood that when the first camera 14 and the second camera 15 are two cameras in the array camera 13 and take pictures at the same time, it means that the shooting angles of the first camera 14 and the second camera 15 are slightly different, and the contents of the first image and the second image obtained by shooting are almost the same. At this time, it is only necessary to determine whether there is a face in the first image or the second image. If there is a face in the determined image, it means that the first image and the second image contain the same face image.

[0069] In step S120, the registration algorithm may be, but is not limited to, a BF (Brute Force) algorithm, a SURF (Speeded Up Robust Features) algorithm, a SIFT (Scale-invariant Feature Transform) algorithm, etc. The registration algorithm may be selected according to actual conditions, and may be used to determine matching feature points in the first image and the second image. Matching feature points may be understood as pixel points of a point of the same object in reality in the first image and the second image, respectively. For example, the pixel points of the left eye corner of the same person in the first image and the second image, respectively, may be used as a set of matching feature points.

[0070] Since the shooting angles of the first camera 14 and the second camera 15 are different, and the hardware parameters of the first camera 14 and the second camera 15 may be different, the angles of view and sizes of the same object in the first image and the second image are different. In step S120, the first image and the second image are registered, which can be understood as taking the first image as a reference image, registering and aligning the second image with the first image, and in the registered second image, the portrait face area can overlap with the portrait face area in the first image; or taking the second image as a reference image, registering and aligning the first image with the second image, and in the registered first image, the portrait face area can overlap with the portrait face area in the first image.

[0071] In this embodiment, step S120 may include:

[0072] Determine multiple groups of matching target facial feature points from the first image and the second image by using the registration algorithm, each group of target facial feature points including first facial feature points in the first image and second facial feature points in the second image;

[0073] Determine, based on a position of each of the first facial feature points in the first image and a position of each of the second facial feature points in the second image, a homography transformation matrix for aligning the second image with the first image;

[0074] The second image is registered and aligned according to the homography transformation matrix.

[0075] In this embodiment, each group of matched feature points may include the matching degree or similarity between the first facial feature point and the second facial feature point. The matching degree or similarity can be expressed as a percentage of 0-100%, and the larger the percentage, the greater the matching degree or similarity. The electronic device 10 can determine the matched feature points from the first image and the second image through a registration algorithm. Among them, the matched target facial feature points can be all the matched facial feature points, or some of the matched facial feature points. The matched target facial feature points can be determined according to actual conditions.

[0076] After determining the matching target facial feature points in the first image and the second image, the electronic device 10 can obtain a homography transformation matrix for aligning the second image with the first image based on the position of the first facial feature point in each group of matching target facial feature points in the first image and the position of the second facial feature point in the second image. At this time, the first image is the reference image, and the second image is the image to be transformed. Understandably, the homography transformation matrix can be used to represent the conversion relationship between the pixel points of the portrait facial area in the second image and the pixel points of the portrait facial area in the first image. After obtaining the homography transformation matrix, the electronic device 10 can perform image registration and alignment on the second image based on the homography transformation matrix to register and align the second image to the first image. That is, by using the homography transformation matrix to perform image transformation on the entire second image (or only the portrait facial area in the second image), the transformed second image is obtained. Based on this, the portrait facial area in the transformed second image can overlap with the portrait facial area in the first image.

[0077] As an optional implementation, when the second image is a reference image and the first image is an image to be transformed, the electronic device 10 can obtain a homography transformation matrix for aligning the first image with the second image based on the position of the first facial feature point in the first image and the position of the second facial feature point in the second image in each group of matched target facial feature points after determining the matching target facial feature points in the first image. After obtaining the homography transformation matrix, the electronic device 10 can perform image registration and alignment on the first image based on the homography transformation matrix, that is, by using the homography transformation matrix to transform the entire first image (or only the portrait facial area in the first image), the transformed first image is obtained.

[0078] In this embodiment, by registering and aligning the first image and the second image, the portrait facial area in the first image and the portrait facial area in the second image can be overlapped, so that based on the overlapped images, the highlight area can be fused with the non-highlight area in the second image corresponding to the highlight area in the first image to remove the highlight area in the portrait facial area in the first image.

[0079] As an optional implementation, the step of determining multiple groups of matching target facial feature points from the first image and the second image by using the registration algorithm may include:

[0080] Determining matching facial feature points from the first image and the second image by using the registration algorithm;

[0081] Based on the similarity between the first facial feature points and the corresponding second facial feature points, a specified number of facial feature points with the greatest similarity are selected from the matched facial feature points as the target facial feature points.

[0082] Understandably, the electronic device 10 can determine some or all of the matching facial feature points from the first image and the second image, and then select a specified number of facial feature points with the greatest similarity from some or all of the matching facial feature points as target facial feature points. The specified number of groups can be understood as a percentage of the total number of groups, or as a specified number. The percentage of the total number of groups can be determined according to actual conditions, for example, it can be 20%, 30%, etc. The specified number can be determined according to actual conditions, for example, it can be 10, 100, 200, etc., which is not specifically limited here.

[0083] For example, the electronic device 10 may select facial feature points corresponding to 30% of the groups with the greatest similarity from some or all of the matched facial feature points as target facial feature points.

[0084] In this embodiment, by selecting a specified number of groups of facial feature points with the greatest similarity as target facial feature points, and then using the target facial feature points to determine the homography transformation matrix, this is beneficial to improving the accuracy and reliability of the selected target facial feature points, and is beneficial to improving the accuracy and reliability of the determined homography transformation matrix, thereby helping to improve the accuracy and reliability of the registration and alignment of the second image.

[0085] In step S130, the highlight area in the first image is fused with the image area in the second image at a position corresponding to the highlight area in the first image to obtain a fused first image as the target image.

[0086] Understandably, when there is a highlight area in the face area of ​​the portrait in the first image, and the highlight area does not overlap in the first image and the second image after registration (for example, there is a highlight area in the face area of ​​the portrait in the first image, and there is no highlight area in the face area of ​​the portrait in the second image; or there are highlight areas in the face areas of the portrait in the first image and the second image, and there are non-overlapping highlight areas), then the highlight area in the highlight area of ​​the first image that does not overlap with the highlight area of ​​the second image is the target highlight area, and the image area corresponding to the target highlight area in the second image is the non-highlight area. At this time, the target highlight area in the first image can be fused by using the image area in the second image that corresponds to (or overlaps with) the position of the target highlight area, and the non-highlight area in the first image is retained, and the fused first image is the target image with the target highlight area removed. That is, the fused area is obtained by merging the area corresponding to the target highlight area in the second image with the target highlight area in the first image, and the fused area is used as the area portion in the target image corresponding to the target highlight area in the first image, and the non-highlight area in the first image is used as the area portion in the target image corresponding to the non-highlight area. If there are overlapping highlight areas in the first image and the second image, the overlapping highlight areas can be retained in the target image.

[0087] In this embodiment, the fusion method of the highlight area in the first image can be determined according to actual conditions. For example, the non-highlight area in the second image corresponding to the target highlight area in the first image can be fused to the target highlight area using Poisson fusion, or the fusion can be to replace the target highlight area in the first image with the non-highlight area corresponding to the target highlight area in the second image.

[0088] Please refer to Figure 3a , Figure 3b and Figure 3c ,in, Figure 3a It can be understood as the first image with highlight areas. Figure 3b It can be understood as the second image without highlight area. Figure 3c It can be understood as Figure 3a The target image is obtained after the first image is fused.

[0089] The electronic device 10 may determine the highlight area in the first image through step S230, such as Figure 3a In addition, the electronic device 10 may determine a non-highlight area corresponding to the highlight area in the second image, such as Figure 3b Then, using Figure 3b The non-highlight areas in the second image are shown blended Figure 3a The highlight area in the first image shown is obtained Figure 3cThe target image shown is used to remove the highlight area in the first image.

[0090] It should be noted that the size of the highlight area, the number of highlight areas, and the location of the highlight areas can all be determined based on actual conditions. Figure 3a , Figure 3b and Figure 3c The portrait facial region shown is an exemplary image.

[0091] Before step S130, the method may further include: determining a portrait facial area from the first image and the second image; judging whether there is an area in the portrait facial area whose brightness is greater than or equal to a preset threshold, wherein, when there is an area whose brightness is greater than or equal to the preset threshold, it is determined that the highlight area exists in the first image and the second image.

[0092] Understandably, the electronic device 10 can determine the portrait face area from the first image and the second image by using a face recognition algorithm. The method of determining the portrait face area is well known to those skilled in the art and will not be described in detail here. In addition, the electronic device 10 can identify the brightness of each pixel in the portrait face area in the first image and the second image.

[0093] In this embodiment, the electronic device 10 can determine the way in which the brightness in the first image and the second image is detected according to actual conditions. For example, the first image and the second image can be grayed out to obtain a grayscale image area. Then, the grayscale value of each pixel point in the first image and the second image after graying is calculated for the portrait face area. The grayscale value is usually a value between 0 and 255. The larger the grayscale value, the whiter the color and the greater the brightness. If there are pixels with grayscale values ​​greater than or equal to the preset grayscale threshold in the grayscale image area, and the pixels with grayscale values ​​greater than or equal to the preset grayscale threshold are connected, and the number of connected pixels is greater than or equal to the set number, it is determined that there is a image area with brightness greater than or equal to the preset threshold in the portrait face area. Among the pixels with brightness greater than or equal to the preset threshold, the image area formed by the interconnected pixels is the highlight area, and the preset grayscale threshold can be a value with a larger grayscale value according to actual conditions. For example, the preset grayscale threshold can be a value representing a grayscale value of 240.

[0094] In this embodiment, the brightness of the pixels in the image where the highlight area appears is usually large. The electronic device 10 detects the brightness of each pixel in the portrait facial area, and can quickly and accurately determine whether there is a highlight area in the portrait facial area. If there is a pixel whose brightness is greater than or equal to the preset grayscale threshold, and the pixels whose brightness is greater than or equal to the preset grayscale threshold are interconnected, and the number of pixels in the connected area is greater than the set number, it is determined that there is a highlight area in the portrait facial area. Among them, the set number can be determined according to the actual situation, and can be 30, 50, 100, etc., which is not specifically limited here.

[0095] If there are pixels whose brightness is greater than or equal to the preset threshold, and the pixels whose brightness is greater than or equal to the preset threshold are connected to each other, and the number of pixels in the connected area is less than the set number, it means that there is no highlight area, or that the highlight area is small, and there is no need to remove the highlights at this time.

[0096] As an optional implementation, the method may further include: when there is a highlight area in the facial area of ​​the portrait in the first image and the second image, and the highlight area overlaps with the mouth area in the first image and the second image after alignment, retaining the image area of ​​the highlight area in the first image to obtain the target image.

[0097] Understandably, if the highlight area overlaps in the mouth area of ​​the first image and the second image, it usually means that the highlight area is the image area of ​​the teeth. In this case, the highlight area in the first image does not need to be removed. For example, when a person opens his mouth to show his teeth, the exposed teeth in the captured image may be determined by the electronic device 10 as a highlight area. In this case, the highlight area of ​​the teeth does not need to be removed. That is, the electronic device 10 can identify and determine the relative position of the highlight area in the facial area of ​​the portrait. For example, it can determine whether the position of the highlight area is in the forehead area, cheek area, mouth area, etc. The mouth area can be understood as the area within the lip contour area.

[0098] The method for determining the position of the highlight area may be as follows: after obtaining the face area of ​​the portrait, the face area of ​​the portrait may be automatically divided to obtain the forehead area, cheek area, mouth area and other areas, where the other areas are areas of the face area of ​​the portrait excluding the forehead area, cheek area and mouth area; then based on the position of the pixel points of the highlight area, determine whether the highlight area is located in the forehead area, cheek area and mouth area, and if the pixel points of the highlight area are located in the corresponding area, then the highlight area is in the area. For example, if the pixel points of the highlight area are located in the mouth area, then it is determined that the highlight area is located in the mouth area.

[0099] In this embodiment, by removing the highlight area in the mouth area, it is possible to avoid removing the highlight area due to the highlight caused by the teeth when the mouth is opened. By ignoring the highlight area in the mouth area, the accuracy and reliability of removing the highlight area can be improved.

[0100] As an optional implementation, the method may further include: when there are highlight areas in the portrait facial areas in both the first image and the second image, and the highlight areas overlap in the first image and the second image after registration, and the overlapping highlight areas are in the forehead area or cheek area of ​​the portrait facial area, filling the corresponding highlight area in the first image in the forehead area or cheek area based on the color features of the image area within a set range around the highlight area to obtain a target image.

[0101] It is understandable that the setting range can be set according to actual conditions, for example, it can be within a 5-pixel distance range around the highlight area in the forehead area or the cheek area. When the highlight area overlaps in the first image and the second image, and the overlapping highlight area is in the forehead area or the cheek area of ​​the portrait face area, at this time, the corresponding highlight area can be filled by using the color features of the image area around the highlight area to remove the highlight area. The color features may include the RGB value and texture features of the image area around the highlight area.

[0102] In this embodiment, after obtaining the target image, the method can also perform smoothing on the part of the image where the highlight area is fused, or perform smoothing on the filled highlight area to obtain the final target image. Based on this, the quality of the image after removing the highlight area can be improved.

[0103] Please refer to Figure 4 , the embodiment of the present application also provides a portrait processing device 200, which can be applied to the above-mentioned electronic device 10. The portrait processing device 200 can be used to execute or implement each step in the portrait processing method. The portrait processing device 200 includes at least one software function module that can be stored in the storage module 12 in the form of software or firmware (Firmware) or solidified in the operating system (OS) of the electronic device 10. The processing module 11 is used to execute the executable modules stored in the storage module 12, such as the software function modules and computer programs included in the portrait processing device 200. Among them, the portrait processing device 200 may include an image acquisition unit 210, a registration unit 220 and an image fusion unit 230.

[0104] The image acquisition unit 210 is used to acquire a first image including a target person's portrait taken by the first camera 14 , and a second image including the target person's portrait taken by the second camera 15 .

[0105] The registration unit 220 is configured to register the first image and the second image using a registration algorithm.

[0106] The image fusion unit 230 is used to fuse the image area corresponding to the position of the highlight area in the second image with the highlight area in the first image when there is a highlight area in the portrait facial area in the first image, and the highlight area does not overlap in the first image and the second image after registration, so as to obtain a fused target image.

[0107] Optionally, the portrait processing device 200 may further include an image filling unit, which is used to fill the corresponding highlight area in the first image in the forehead area or cheek area based on the color features of the image area within a set range around the highlight area in the cheek area when there are highlight areas in the portrait facial areas in both the first image and the second image, and the highlight areas overlap in the first image and the second image after registration, and the overlapping highlight areas are in the forehead area or cheek area of ​​the portrait facial area, so as to obtain a target image.

[0108] Optionally, the portrait processing device 200 may further include a face determination unit and a highlight judgment unit. Before the image fusion unit 230 fuses the image area corresponding to the position of the highlight area in the second image with the highlight area in the first image to obtain the fused target image, the face determination unit is used to determine the portrait face area from the first image and the second image; the highlight judgment unit is used to determine whether there is an image area with brightness greater than or equal to a preset threshold in the portrait face area, wherein when there is an image area with brightness greater than or equal to the preset threshold, it is determined that the highlight area exists in the first image and the second image.

[0109] Optionally, the highlight judgment unit can also be used to: perform grayscale processing on the image area of ​​the portrait facial area to obtain a grayscale image area; if there are pixels in the grayscale image area whose grayscale values ​​are greater than or equal to a preset grayscale threshold, and the pixels whose grayscale values ​​are greater than or equal to the preset grayscale threshold are connected, and the number of connected pixels is greater than or equal to a set number, it is determined that there is an image area in the portrait facial area whose brightness is greater than or equal to the preset threshold.

[0110] Optionally, the portrait processing device 200 may further include a highlight judgment unit. The highlight judgment unit is used to retain the image area of ​​the highlight area in the first image to obtain the target image when there is a highlight area in the portrait facial area in the first image and the second image, and the highlight area overlaps in the mouth area in the first image and the second image after registration.

[0111] Optionally, the registration unit 220 is used to determine multiple groups of matching target facial feature points from the first image and the second image through the registration algorithm, each group of target facial feature points including first facial feature points in the first image and second facial feature points in the second image; based on the position of each first facial feature point in the first image and the position of each second facial feature point in the second image, determine the homography transformation matrix used to align the second image with the first image; and align the second image according to the homography transformation matrix.

[0112] Optionally, the registration unit 220 is also used to determine matching facial feature points from the first image and the second image through the registration algorithm; based on the similarity between the first facial feature points and the corresponding second facial feature points, select a specified number of groups of facial feature points with the greatest similarity from the matching facial feature points as the target facial feature points.

[0113] Optionally, the image fusion unit 230 may also be used to: fuse the highlight area in the first image through the image area in the second image at a position corresponding to the highlight area in the first image, to obtain a fused first image as the target image.

[0114] It should be noted that those skilled in the art can clearly understand that, for the convenience and brevity of description, the specific working processes of the electronic device 10 and the portrait processing device 200 described above can refer to the corresponding processes of each step in the aforementioned method, and will not be elaborated herein.

[0115] In this embodiment, the processing module 11 can be an integrated circuit chip with signal processing capabilities. The above-mentioned processing module 11 can be a general-purpose processor. For example, the processor can be a central processing unit (CPU), a graphics processing unit (GPU), a network processor (NP), etc.; it can also be a digital signal processor (DSP), an application specific integrated circuit (ASIC), a field programmable gate array (FPGA) or other programmable logic devices, discrete gates or transistor logic devices, discrete hardware components, which can implement or execute the disclosed methods, steps and logic block diagrams in the embodiments of this application.

[0116] The storage module 12 may be, but is not limited to, a random access memory, a read-only memory, a programmable read-only memory, an erasable programmable read-only memory, an electrically erasable programmable read-only memory, etc. In this embodiment, the storage module 12 may be used to store the first image, the second image, the target image, the registration algorithm, etc. Of course, the storage module 12 may also be used to store a program, and the processing module 11 executes the program after receiving the execution instruction.

[0117] The embodiment of the present application further provides a computer-readable storage medium. The computer-readable storage medium stores a computer program, and when the computer program is run on a computer, the computer executes the portrait processing method described in the above embodiment.

[0118] Through the description of the above implementation methods, technical personnel in this field can clearly understand that the present application can be implemented by hardware, and can also be implemented by means of software plus a necessary general hardware platform. Based on such an understanding, the technical solution of the present application can be embodied in the form of a software product, which can be stored in a non-volatile storage medium (which can be a CD-ROM, a USB flash drive, a mobile hard disk, etc.), including a number of instructions for enabling a computer device (which can be a personal computer, a server, or a network device, etc.) to execute the methods described in each implementation scenario of the present application.

[0119] In summary, the present application provides a portrait processing method, device, electronic device and readable storage medium. The method includes: obtaining a first image including a target portrait taken by a first camera, and a second image including a target portrait taken by a second camera; registering the first image and the second image by a registration algorithm; when there is a highlight area in the facial area of ​​the portrait in the first image, and the highlight area does not overlap in the registered first image and the second image, the image area corresponding to the position of the highlight area in the second image is fused with the highlight area in the first image to obtain a fused target image. In this scheme, by taking images including the target portrait by the first camera and the second camera, images of the portrait face at different viewing angles can be obtained, and then the highlight area in the first image is fused with the non-highlight image area in the second image corresponding to the highlight area of ​​the first image to obtain a target image with the highlight area removed. Based on this, the highlight area of ​​the face of the person in the first image can be quickly removed to improve the efficiency of removing the highlight area in the facial area.

[0120] In the embodiments provided in the present application, it should be understood that the disclosed device, system and method can also be implemented in other ways. The above-described device, system and method embodiments are merely schematic, for example, the flowchart and block diagram in the accompanying drawings show the possible architecture, function and operation of the system, method and computer program product according to the multiple embodiments of the present application. In this regard, each box in the flowchart or block diagram can represent a part of a module, a program segment or a code, and a part of the module, program segment or code contains one or more executable instructions for implementing the specified logical function. It should also be noted that each box in the block diagram and / or the flowchart, and the combination of the boxes in the block diagram and / or the flowchart can be implemented by a dedicated hardware-based system that performs the specified function or action, or can be implemented by a combination of dedicated hardware and computer instructions. In addition, each functional module in each embodiment of the present application can be integrated together to form an independent part, or each module can exist separately, or two or more modules can be integrated to form an independent part.

[0121] The above description is only the preferred embodiment of the present application and is not intended to limit the present application. For those skilled in the art, the present application may have various modifications and variations. Any modification, equivalent replacement, improvement, etc. made within the spirit and principle of the present application shall be included in the protection scope of the present application.

Claims

1. A portrait processing method, It is characterized in that The method comprises: Acquire a first image including a target person's portrait taken by a first camera, and a second image including the target person's portrait taken by a second camera; the time point at which the first camera takes the first image is the same as the time point at which the second camera takes the second image, or is within a specified time range; Registering the first image and the second image by using a registration algorithm; When there is a highlight region in the face region of the portrait in the first image, and the highlight region does not overlap in the first image and the second image after registration, fusing an image region in the second image corresponding to the position of the highlight region with the highlight region in the first image to obtain a fused target image; When there are highlight areas in both the first image and the second image, and the highlight areas overlap in the first image and the second image after registration, and the overlapping highlight areas are in the forehead area or the cheek area of ​​the portrait face area, the corresponding highlight area in the first image is filled in the forehead area or the cheek area based on the color features of the image area within a set range around the highlight area, to obtain a target image; When there is a highlight area in the facial area of ​​the portrait in the first image and the second image, and the highlight area overlaps with the mouth area in the first image and the second image after registration, the image area of ​​the highlight area in the first image is retained to obtain a target image.

2. The method according to claim 1, It is characterized in that Before fusing the image area corresponding to the position of the highlight area in the second image with the highlight area in the first image to obtain a fused target image, the method further includes: Determine a portrait facial region from the first image and the second image; Determine whether there is an area in the portrait facial area whose brightness is greater than or equal to a preset threshold, wherein, when there is an area whose brightness is greater than or equal to the preset threshold, determine that the highlight area exists in the first image and the second image.

3. The method according to claim 2, It is characterized in that Determining whether there is an image region in the portrait facial region whose brightness is greater than or equal to a preset threshold comprises: Performing grayscale processing on the image region of the portrait face area to obtain a grayscale image region; If there are pixels in the grayscale image area whose grayscale values ​​are greater than or equal to a preset grayscale threshold, and the pixels whose grayscale values ​​are greater than or equal to the preset grayscale threshold are connected, and the number of connected pixels is greater than or equal to a set number, it is determined that there is an image area in the portrait facial area whose brightness is greater than or equal to the preset threshold.

4. The method according to claim 1, It is characterized in that Registering the first image and the second image by using a registration algorithm includes: Determine multiple groups of matching target facial feature points from the first image and the second image by using the registration algorithm, each group of target facial feature points including first facial feature points in the first image and second facial feature points in the second image; Determine, based on a position of each of the first facial feature points in the first image and a position of each of the second facial feature points in the second image, a homography transformation matrix for aligning the second image with the first image; The second image is registered and aligned according to the homography transformation matrix.

5. The method according to claim 4, It is characterized in that Determining a plurality of groups of matching target facial feature points from the first image and the second image by using the registration algorithm includes: Determining matching facial feature points from the first image and the second image by using the registration algorithm; Based on the similarity between the first facial feature points and the corresponding second facial feature points, a specified number of facial feature points with the greatest similarity are selected from the matched facial feature points as the target facial feature points.

6. The method according to claim 1, It is characterized in that The step of fusing the image area corresponding to the position of the highlight area in the second image with the highlight area in the first image to obtain a fused target image includes: The highlight area in the first image is fused with the image area in the second image at a position corresponding to the highlight area in the first image to obtain a fused first image as the target image.

7. The method according to any one of claims 1 and 6, It is characterized in that The first camera and the second camera are cameras in an array camera.

8. A portrait processing device, It is characterized in that The device comprises: An image acquisition unit, used to acquire a first image including a target person's portrait taken by a first camera, and a second image including the target person's portrait taken by a second camera; a time point when the first camera takes the first image is the same as a time point when the second camera takes the second image, or is within a specified time range; A registration unit, configured to register the first image and the second image using a registration algorithm; An image fusion unit is used to fuse a region corresponding to the position of the highlight region in the second image with the highlight region in the first image when there is a highlight region in the face region of the portrait in the first image and the second image after registration, so as to obtain a fused target image; when there are highlight regions in the face regions of the portraits in both the first image and the second image and the highlight regions overlap in the first image and the second image after registration, and the overlapping highlight regions are in the forehead region or cheek region of the face region of the portrait, fill the corresponding highlight region in the forehead region or cheek region with the color features of the region within a set range around the highlight region to obtain a target image; when there are highlight regions in the face regions of the portraits in the first image and the second image and the highlight regions overlap in the mouth regions of the first image and the second image after registration, retain the region of the highlight region in the first image to obtain a target image.

9. An electronic device, It is characterized in that The electronic device comprises a memory and a processor coupled to each other, wherein a computer program is stored in the memory, and when the computer program is executed by the processor, the electronic device executes the method according to any one of claims 1 to 7.

10. A computer-readable storage medium, It is characterized in that The readable storage medium stores a computer program, and when the computer program is executed on a computer, the computer is enabled to execute the method according to any one of claims 1 to 7.