Image detection and processing method and device, electronic equipment and storage medium

By performing region segmentation and brightness edge detection on facial images, the degree of unevenness in face detection is quantified, solving the problem of low accuracy in uneven face detection and improving the accuracy of image processing and imaging quality.

CN120997239APending Publication Date: 2025-11-21BEIJING XIAOMI MOBILE SOFTWARE CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202410628309.9
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-05-20
Publication Date
2025-11-21

AI Technical Summary

Technical Problem

In existing technologies, the detection accuracy of face images with varying degrees of brightness is poor, and the false detection rate is high, resulting in poor image quality and affecting the accuracy of subsequent image processing tasks.

Method used

By dividing the face image into regions, determining the brightness edge based on the brightness parameters of each region, and using the length and gradient information of the brightness edge to detect faces with varying degrees of brightness, the degree of such faces is quantified, reducing the risk of misjudgment.

Benefits of technology

This improved the accuracy and effectiveness of detecting faces with varying degrees of brightness, providing an objective and accurate data foundation for subsequent image processing and enhancing image quality.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN120997239A_ABST
    Figure CN120997239A_ABST
Patent Text Reader

Abstract

The invention provides an image detection and processing method and device, electronic equipment and a storage medium, and the image detection method comprises the steps: carrying out the region division of a human face image, carrying out the edge detection according to the brightness parameter of each region, determining the brightness edge of the boundary between a bright region and a dark region, carrying out the objective quantification of the yin-yang face degree of each brightness edge, and obtaining a face detection result; compared with a traditional scheme in which the yin-yang face detection result is determined according to the brightness average value of the partitions, the method has the advantages that the misjudgment risk is reduced, the yin-yang face detection effect and precision are effectively improved, an objective and accurate data basis is provided for subsequent image processing, the yin-yang face image optimization effect is improved, and the imaging quality is improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This disclosure relates to the field of image processing technology, specifically to an image detection and processing method, apparatus, electronic device, and storage medium. Background Technology

[0002] In digital image processing tasks, high-quality images are fundamental to improving processing results. "Uneven lighting" refers to the problem of excessive contrast between bright and dark areas in facial images captured when uneven lighting, such as side lighting or top lighting, illuminates the face. This results in poor image quality and significantly impacts the reuse of facial images.

[0003] In related technologies, the average brightness of the face region is usually calculated by dividing the face region into zones to determine whether there is a problem of uneven brightness in the face. However, this method has poor detection accuracy and a high false detection rate, resulting in poor image quality of the face. Summary of the Invention

[0004] To improve the detection effect and accuracy of images with uneven color and thus improve the imaging quality of facial images, this disclosure provides an image detection method and apparatus, an image processing method and apparatus, an electronic device, and a storage medium.

[0005] In a first aspect, embodiments of this disclosure provide an image detection method, including:

[0006] The acquired face image is divided into multiple regions, and the brightness parameters of each region are determined based on the pixel brightness.

[0007] Based on the brightness parameters of each region, at least one brightness edge is determined on the face image, where the brightness edge represents the boundary edge between bright and dark areas on the face image;

[0008] Based on the length information and / or gradient information of the brightness edge, the corresponding light-and-dark face detection result is determined for each brightness edge, and the light-and-dark face detection result represents the degree of light-and-dark face corresponding to the brightness edge.

[0009] In some implementations, dividing the acquired face image into multiple regions and determining the brightness parameter of each region based on pixel brightness includes:

[0010] The face image is processed into a grid based on a preset grid size to obtain a grid image corresponding to the face image, wherein the grid image includes multiple grid regions;

[0011] For each grid region in the grid image, the brightness parameter corresponding to the grid region is determined based on the average brightness of the pixels included in the grid region.

[0012] In some implementations, determining the brightness parameter corresponding to each grid region in the grid image based on the average brightness of the pixels included in the grid region includes:

[0013] In response to the face image size being greater than or equal to a preset size threshold, the average brightness of the pixels included in each grid region is determined as the brightness parameter corresponding to the grid region.

[0014] In some implementations, determining the brightness parameter corresponding to each grid region in the grid image based on the average brightness of the pixels included in the grid region includes:

[0015] In response to the fact that the size of the face image is less than a preset size threshold, the average brightness of the pixels included in each grid region is determined;

[0016] Based on a preset weight matrix and the average brightness of each grid region, the brightness parameter corresponding to each grid region is determined, wherein the weight value of the edge element in the preset weight matrix is ​​less than the weight value of the middle element.

[0017] In some implementations, determining the brightness parameter corresponding to each grid region based on a preset weight matrix and the average brightness of each grid region includes:

[0018] Based on the size of the grid image, the preset weight matrix is ​​interpolated to obtain a weight matrix of the same size as the grid image;

[0019] For each grid region, the brightness parameter corresponding to the grid region is obtained by multiplying the average brightness value corresponding to the grid region and the weight value in the weight matrix.

[0020] In some implementations, determining at least one brightness edge on the face image based on the brightness parameters of each region includes:

[0021] Based on the brightness parameters of each region, a brightness mask map corresponding to the face image is obtained;

[0022] Edge detection is performed on the brightness mask to obtain at least one candidate brightness edge included in the brightness mask;

[0023] Based on the pixel lengths included in the candidate brightness edges, determine the length information of each candidate brightness edge;

[0024] Based on the brightness difference between the pixels in the first region and the pixels in the second region around the candidate brightness edge, the gradient information of each candidate brightness edge is determined, wherein the pixels in the first region and the pixels in the second region are located on both sides of the candidate brightness edge, respectively.

[0025] Based on the length and gradient information of each candidate brightness edge, at least one brightness edge is determined from the candidate brightness edges.

[0026] In some implementations, determining the corresponding yin-yang face detection result for each luminance edge based on the length information and / or gradient information of the luminance edge includes:

[0027] The length weight corresponding to the brightness edge is determined based on the length information of the brightness edge;

[0028] The gradient weight corresponding to the brightness edge is determined based on the gradient information of the brightness edge;

[0029] The detection result of the yin-yang face corresponding to the brightness edge is determined based on the product of the length weight and the gradient weight.

[0030] In some implementations, determining the length weight corresponding to the luminance edge based on the length information of the luminance edge includes:

[0031] In response to the fact that the length information of the brightness edge is less than the diagonal length of the face image, the ratio of the length information to the diagonal length is determined as the length weight of the brightness edge;

[0032] In response to the length information of the brightness edge being greater than or equal to the diagonal length of the face image, a first value is determined as the length weight of the brightness edge.

[0033] In some implementations, determining the gradient weight corresponding to the brightness edge based on the gradient information of the brightness edge includes:

[0034] The ratio of the gradient information to the second value is determined as the gradient weight of the brightness edge.

[0035] In some embodiments, the image detection method of this disclosure further includes:

[0036] Acquire an image to be processed, the image to be processed including at least one human face;

[0037] Face detection is performed on the image to be processed to obtain occlusion information and pose information of each face;

[0038] Based on the occlusion information and the pose information, a target face is determined from at least one face included in the image to be processed;

[0039] The target face is cropped to obtain the face image.

[0040] Secondly, this disclosure provides an image processing method, including:

[0041] Obtain a face image to be processed and the result of the two-tone face detection of the face image, wherein the result of the two-tone face detection is obtained by the method described in any embodiment of the first aspect;

[0042] Based on the results of the two-tone face detection, the adjustment parameters for each brightness edge on the face image are determined;

[0043] The face image is processed based on the adjustment parameters of each brightness edge to obtain the target image.

[0044] Thirdly, embodiments of this disclosure provide an image detection apparatus, including:

[0045] The region segmentation module is configured to divide the acquired face image into multiple regions and determine the brightness parameters of each region based on pixel brightness.

[0046] An edge detection module is configured to determine at least one luminance edge on the face image based on the luminance parameters of each region, the luminance edge representing the boundary edge between bright and dark areas on the face image;

[0047] The result determination module is configured to determine the yin-yang face detection result corresponding to each brightness edge based on the length information and / or gradient information of the brightness edge, wherein the yin-yang face detection result represents the degree of yin-yang face corresponding to the brightness edge.

[0048] In some implementations, the region partitioning module is configured to:

[0049] The face image is processed into a grid based on a preset grid size to obtain a grid image corresponding to the face image, wherein the grid image includes multiple grid regions;

[0050] For each grid region in the grid image, the brightness parameter corresponding to the grid region is determined based on the average brightness of the pixels included in the grid region.

[0051] In some implementations, the region partitioning module is configured to:

[0052] In response to the face image size being greater than or equal to a preset size threshold, the average brightness of the pixels included in each grid region is determined as the brightness parameter corresponding to the grid region.

[0053] In some implementations, the region partitioning module is configured to:

[0054] In response to the fact that the size of the face image is less than a preset size threshold, the average brightness of the pixels included in each grid region is determined;

[0055] Based on a preset weight matrix and the average brightness of each grid region, the brightness parameter corresponding to each grid region is determined, wherein the weight value of the edge element in the preset weight matrix is ​​less than the weight value of the middle element.

[0056] In some implementations, the region partitioning module is configured to:

[0057] Based on the size of the grid image, the preset weight matrix is ​​interpolated to obtain a weight matrix of the same size as the grid image;

[0058] For each grid region, the brightness parameter corresponding to the grid region is obtained by multiplying the average brightness value corresponding to the grid region and the weight value in the weight matrix.

[0059] In some implementations, the edge detection module is configured to:

[0060] Based on the brightness parameters of each region, a brightness mask map corresponding to the face image is obtained;

[0061] Edge detection is performed on the brightness mask to obtain at least one candidate brightness edge included in the brightness mask;

[0062] Based on the pixel lengths included in the candidate brightness edges, determine the length information of each candidate brightness edge;

[0063] Based on the brightness difference between the pixels in the first region and the pixels in the second region around the candidate brightness edge, the gradient information of each candidate brightness edge is determined, wherein the pixels in the first region and the pixels in the second region are located on both sides of the candidate brightness edge, respectively.

[0064] Based on the length and gradient information of each candidate brightness edge, at least one brightness edge is determined from the candidate brightness edges.

[0065] In some implementations, the result determination module is configured to:

[0066] The length weight corresponding to the brightness edge is determined based on the length information of the brightness edge;

[0067] The gradient weight corresponding to the brightness edge is determined based on the gradient information of the brightness edge;

[0068] The detection result of the yin-yang face corresponding to the brightness edge is determined based on the product of the length weight and the gradient weight.

[0069] In some implementations, the result determination module is configured to:

[0070] In response to the fact that the length information of the brightness edge is less than the diagonal length of the face image, the ratio of the length information to the diagonal length is determined as the length weight of the brightness edge;

[0071] In response to the length information of the brightness edge being greater than or equal to the diagonal length of the face image, a first value is determined as the length weight of the brightness edge.

[0072] In some implementations, the result determination module is configured to:

[0073] The ratio of the gradient information to the second value is determined as the gradient weight of the brightness edge.

[0074] In some implementations, the region partitioning module is configured to:

[0075] Acquire an image to be processed, the image to be processed including at least one human face;

[0076] Face detection is performed on the image to be processed to obtain occlusion information and pose information of each face;

[0077] Based on the occlusion information and the pose information, a target face is determined from at least one face included in the image to be processed;

[0078] The target face is cropped to obtain the face image.

[0079] Fourthly, embodiments of this disclosure provide an image processing apparatus, including:

[0080] The acquisition module is configured to acquire a face image to be processed and a two-tone face detection result of the face image, wherein the two-tone face detection result is obtained by the method described in any embodiment of the first aspect;

[0081] The parameter determination module is configured to determine the adjustment parameters for each brightness edge on the face image based on the results of the two-tone face detection.

[0082] The image processing module is configured to perform image processing on the face image based on adjustment parameters for each brightness edge to obtain the target image.

[0083] Fifthly, embodiments of this disclosure provide an electronic device, including:

[0084] processor; and

[0085] A memory storing computer instructions for causing a processor to perform the method described in either the first or second aspect.

[0086] In a sixth aspect, embodiments of this disclosure provide a storage medium storing computer instructions for causing a computer to perform the methods described in either the first or second aspect.

[0087] The image detection method of this disclosure divides a face image into regions, determines the brightness edges that separate bright and dark areas based on the brightness parameters of each region, and objectively quantifies the degree of unevenness in each brightness edge. Compared with the traditional method of determining the unevenness detection result based on the average brightness of the regions, this method reduces the risk of misjudgment, effectively improves the effect and accuracy of unevenness detection, and provides an objective and accurate data basis for subsequent image processing, thereby improving the optimization effect of unevenness images and improving the imaging quality. Attached Figure Description

[0088] To more clearly illustrate the technical solutions in the specific embodiments of this disclosure or the prior art, the drawings used in the description of the specific embodiments or the prior art will be briefly introduced below. Obviously, the drawings described below are some embodiments of this disclosure. For those skilled in the art, other drawings can be obtained from these drawings without creative effort.

[0089] Figure 1 This is a schematic diagram of a yin-yang face.

[0090] Figure 2 This is a flowchart of an image detection method according to some embodiments of the present disclosure.

[0091] Figure 3 This is a flowchart of an image detection method according to some embodiments of the present disclosure.

[0092] Figure 4 This is a schematic diagram of an image detection method according to some embodiments of this disclosure.

[0093] Figure 5 This is a schematic diagram of an image detection method according to some embodiments of this disclosure.

[0094] Figure 6 This is a flowchart of an image detection method according to some embodiments of the present disclosure.

[0095] Figure 7 This is a schematic diagram of an image detection method according to some embodiments of this disclosure.

[0096] Figure 8 This is a flowchart of an image detection method according to some embodiments of the present disclosure.

[0097] Figure 9 This is a flowchart of an image detection method according to some embodiments of the present disclosure.

[0098] Figure 10 This is a schematic diagram of an image detection method according to some embodiments of this disclosure.

[0099] Figure 11 This is a flowchart of an image detection method according to some embodiments of the present disclosure.

[0100] Figure 12 This is a schematic diagram of an image detection method according to some embodiments of this disclosure.

[0101] Figure 13 This is a schematic diagram of an image detection method according to some embodiments of this disclosure.

[0102] Figure 14 This is a flowchart of an image detection method according to some embodiments of the present disclosure.

[0103] Figure 15 This is a flowchart of an image processing method according to some embodiments of the present disclosure.

[0104] Figure 16 This is a structural block diagram of an image detection apparatus according to some embodiments of the present disclosure.

[0105] Figure 17 This is a structural block diagram of an image processing apparatus according to some embodiments of the present disclosure.

[0106] Figure 18 This is a structural block diagram of an electronic device according to some embodiments of the present disclosure. Detailed Implementation

[0107] The technical solutions of this disclosure will now be clearly and completely described with reference to the accompanying drawings. Obviously, the described embodiments are only a part of the embodiments of this disclosure, not all of them. All other embodiments obtained by those skilled in the art based on the embodiments of this disclosure without inventive effort are within the scope of protection of this disclosure. Furthermore, the technical features involved in the different embodiments of this disclosure described below can be combined with each other as long as they do not conflict with each other.

[0108] "Two-tone face" refers to the problem of excessive contrast between bright and dark areas in a facial image taken when uneven lighting, such as side lighting or top lighting, illuminates the face. For example... Figure 1As shown in (a), the light source is located on the left side of the face, resulting in excessive contrast between the bright area on the left and the dark area on the right in the captured image. For example... Figure 1 As shown in (b), the light source is located overhead, which causes the top and nose areas of the captured face image to be too bright while the rest of the face is too dark.

[0109] pass Figure 1 As can be seen, the "half-lit face" problem results in poor image quality for faces, significantly impacting their reuse. For example, using a mobile phone camera, when shooting portraits, the half-lit face problem causes a loss of facial details, drastically reducing image quality and affecting user experience. Similarly, in smart vehicle products, when the system performs tasks such as driver fatigue monitoring and occupant monitoring, the half-lit face problem greatly affects the accuracy of facial image processing. Furthermore, in facial recognition scenarios, the half-lit face problem can lead to facial recognition errors, reducing accuracy.

[0110] Therefore, in digital image processing tasks, the detection and recognition of the "half-light face" problem in facial images has become a necessary means to improve image processing results. Related technologies generally determine the dark and bright areas of an image by dividing the face image into regions and calculating the average brightness, thereby determining whether the "half-light face" problem exists. However, this method has poor detection accuracy. For example, if the center of the face is too bright and the edges are too dark, after dividing the image based on the geometric center of the face, the average brightness of each region is relatively similar, causing the algorithm to misclassify it as a normal image, resulting in false positives and low detection accuracy.

[0111] Based on this, the present disclosure provides an image detection method and apparatus, an image processing method and apparatus, an electronic device, and a storage medium, aiming to improve the detection accuracy of the uneven face problem in human face images, while objectively quantifying the brightness of the uneven face, providing guidance for subsequent image processing, thereby improving the optimization effect of uneven face images and improving imaging quality.

[0112] In a first aspect, the present disclosure provides an image detection method that can be applied to an electronic device. The electronic device can be any type of device suitable for implementation, such as a smartphone, tablet computer, wearable device, smart cockpit system, facial recognition system, server, cloud platform, etc. The present disclosure does not limit this.

[0113] like Figure 2 As shown, in some embodiments, the image detection method of this disclosure includes:

[0114] S210. Divide the acquired face image into multiple regions and determine the brightness parameters of each region based on the pixel brightness.

[0115] In this embodiment of the disclosure, the face image can be an image captured by the image acquisition device of the electronic device, or it can be an image obtained by the electronic device through other devices.

[0116] For example, in one example, an electronic device is a smartphone, which includes a camera module that can capture facial images.

[0117] For example, in another example, an electronic device is a smart cockpit system, which has an onboard camera that can capture facial images.

[0118] For example, in another example, an electronic device, such as a personal computer, can receive facial images sent by other electronic devices or download facial images from the network.

[0119] In some implementations, the face image can be an image of a face region cropped from the image to be processed. For example, in a mobile phone selfie scenario, the image of a person taken by the mobile phone includes not only the person in the foreground but also the background area. Therefore, an image can be detected by a face recognition algorithm, and the face region can be cropped from the person image to obtain the face image. The embodiments described below will be further elaborated upon here.

[0120] In this embodiment of the disclosure, after obtaining a face image, the face image can first be divided into regions, thereby dividing the face image into multiple regions.

[0121] In some implementations, the face image can be meshed according to a preset grid size, thereby dividing the face image into an m*n grid image. The values ​​of m and n can be selected according to specific scenario requirements. The resulting grid image includes a total of m*n grid regions, each corresponding to a portion of the face image.

[0122] In this embodiment of the disclosure, after the face image is processed into a grid to obtain a grid image containing m*n grid regions, the brightness parameter corresponding to each grid region can be calculated separately.

[0123] It can be understood that in the grid image obtained by gridding a face image, each grid region includes a portion of the pixels on the face image. Therefore, the brightness parameter corresponding to each grid region can be determined based on the brightness value of the pixels contained in each grid region.

[0124] For example, in one example, for each grid region, the average pixel brightness in each grid region is calculated, and this average pixel brightness is used as the brightness parameter of that grid region. In another example, the average pixel brightness in each grid region can be calculated separately, and then the average brightness of each grid region can be adjusted based on a preset weight matrix to obtain the brightness parameter of each grid region. The embodiments described below will not be detailed here.

[0125] In summary, for m*n grid regions, the brightness parameters of each grid region can be calculated based on the pixel brightness, resulting in m*n brightness parameters. Each brightness parameter can reflect the image brightness of its corresponding region.

[0126] S220. Based on the brightness parameters of each region, determine at least one brightness edge on the face image.

[0127] It is worth noting that in this embodiment, after determining the brightness parameters of each region, the existence of a two-tone face problem is not determined directly based on the differences in brightness parameters of each region. This is because, as mentioned above, in some two-tone face scenarios, the brightness parameters of each region may be relatively close, which may lead to the two-tone face image being misjudged as a normal image.

[0128] Therefore, in this embodiment of the disclosure, after determining the brightness parameters of each region, edge detection can be performed based on these brightness parameters, thereby filtering out one or more brightness edges included in the image according to the brightness parameters of each region.

[0129] It is understood that the most prominent feature of a two-tone face scene is the clear boundary between the bright and dark areas. Therefore, in this embodiment, edge detection can be performed based on the brightness parameters of each region to detect these clearly defined edge regions, which are the brightness edges described in this disclosure.

[0130] It is understandable that for a two-tone face image, there may be multiple bright and dark areas on the image, and thus multiple boundary edges between the bright and dark areas. Therefore, the brightness edge determined based on the brightness parameters of each region may be one or multiple, and this disclosure does not limit this.

[0131] In some implementations, a luminance mask is first generated based on the luminance parameters of m*n grid regions. The size of the luminance mask is m*n, and the pixel values ​​are the aforementioned luminance parameters. After obtaining the luminance mask, an edge detection algorithm can be used to perform edge detection on the luminance mask to identify one or more luminance edges on the image. The following implementations will describe these features, but will not be detailed here.

[0132] In some implementations, considering the interference of small shadows on the face image caused by accessories (such as glasses, earrings, etc.) or other objects, when multiple brightness edges are obtained through screening, the length information and / or gradient information of the brightness edges can be further combined to further screen the multiple brightness edges, thereby removing some interfering shadows. This reduces the amount of computation and improves the detection accuracy. This disclosure will be described below.

[0133] S230. Based on the length information and / or gradient information of the brightness edge, determine the corresponding yin-yang face detection result for each brightness edge.

[0134] As mentioned above, each brightness edge corresponds to the boundary between the bright and dark areas on a face image. Therefore, the length and gradient information of the brightness edges can reflect the degree of unevenness in a face image.

[0135] It is understandable that for a certain brightness edge, its length information refers to the pixel length occupied by the brightness edge on the face image. The longer the length, the larger the range of the brightness edge on the face image, that is, the higher the degree of unevenness in the face.

[0136] Gradient information refers to the difference in brightness values ​​near the brightness edge, that is, the difference in brightness between bright and dark pixels. The larger the gradient information, the greater the difference in brightness between bright and dark areas near the brightness edge, which means the higher the degree of uneven brightness.

[0137] In some embodiments, for each luminance edge, the number of consecutive pixels within that luminance edge can be counted to obtain the corresponding length information. In some embodiments, for each luminance edge, the difference in luminance values ​​between the dark and bright pixels on either side of the luminance edge can be calculated to obtain the corresponding gradient information. These embodiments are described below and will not be detailed here.

[0138] In this embodiment of the disclosure, for each brightness edge, the degree of yin-yang face of the brightness edge can be quantified based on the length information and / or gradient information of the brightness edge, thereby obtaining the yin-yang face detection result corresponding to the brightness edge.

[0139] In some embodiments, for each brightness edge, the result of the face detection can be determined solely based on the length information of that brightness edge. In other embodiments, for each brightness edge, the result of the face detection can be determined solely based on the gradient information of that brightness edge. In still other embodiments, for each brightness edge, the result of the face detection can be determined by combining both the length information and the gradient information of that brightness edge, as described in the following embodiments of this disclosure.

[0140] As can be seen from the foregoing, in this embodiment of the present disclosure, for multiple brightness edges on a face image, the degree of uneven face can be quantified based on the length information and / or gradient information of each brightness edge to obtain the corresponding uneven face detection result, so that each brightness edge corresponds to its own uneven face detection result.

[0141] In some implementations, after determining the detection results of the uneven face at each brightness edge in the image, the uneven face detection results can be sent to the subsequent algorithm for image optimization, thereby alleviating the uneven face problem and improving image quality.

[0142] It is understood that the two-tone face detection results of the present disclosure can intuitively reflect the degree of two-tone face on each brightness edge of the image. Therefore, when the algorithm performs image optimization processing, it can make targeted optimization adjustments to each brightness edge based on the two-tone face detection results, which greatly improves the efficiency and effect of image processing. This will be explained in the image processing method below.

[0143] As can be seen from the above, in this embodiment of the present disclosure, by dividing the face image into regions, edge detection is performed based on the brightness parameters of each region to determine the brightness edge that marks the boundary between the bright and dark areas, and the degree of unevenness of the face at each brightness edge is objectively quantified. Compared with the traditional solution that determines the unevenness detection result based on the average brightness of the regions, this reduces the risk of misjudgment, effectively improves the effect and accuracy of unevenness detection, and provides an objective and accurate data basis for subsequent image processing, thereby improving the optimization effect of unevenness images and improving the imaging quality.

[0144] like Figure 3 As shown, in some embodiments, the image detection method of this disclosure includes:

[0145] S310. Obtain the image to be processed.

[0146] In this embodiment of the disclosure, the image to be processed includes at least one human face, that is, the image to be processed is an image including a human face image acquired by an electronic device.

[0147] For example, in one embodiment, the electronic device is a smartphone. The image to be processed can be an image of a person captured by the smartphone's camera, thus the image to be processed includes not only the foreground person but also the background area. Furthermore, the image to be processed can include one face or multiple faces; this disclosure does not impose any limitations on this.

[0148] S320. Perform face detection on the image to be processed to obtain occlusion information and pose information for each face.

[0149] It is worth noting that in the embodiments of this disclosure, considering that in scenarios where the face is obscured (e.g., wearing a mask) or the face is turned at a large angle, the facial feature information in the image is severely lacking, which can easily lead to misjudgment.

[0150] For example, see one example. Figure 4 As shown in (a), when a user is wearing a black mask, the system may misidentify the area covered by the black mask as a dark area, thus misjudging a scene that does not actually have a two-tone face as a two-tone face, resulting in inaccurate detection.

[0151] For example, see another example. Figure 4 As shown in (b) and (c), when the user's face is turned at an excessive angle, a large number of the user's facial features are missing, making it difficult for the system to accurately detect the unevenness of the face region, resulting in inaccurate detection.

[0152] Therefore, in this embodiment of the present disclosure, before performing face detection on the face images included in the image to be processed, images with serious facial feature information such as face occlusion and excessive face deflection angle can be screened out to further improve the detection accuracy.

[0153] In some implementations, face detection can be performed on the image to be processed to determine the occlusion and pose information of each face in the image. Occlusion information indicates the degree of face occlusion, and pose information indicates the degree of face pose shift. Face detection algorithms can be understood and fully implemented by those skilled in the art by referring to relevant technologies, and will not be elaborated upon in this disclosure.

[0154] S330. Based on occlusion information and pose information, determine the target face from at least one face included in the image to be processed.

[0155] As can be seen from the foregoing, for each face in the image to be processed, the occlusion information represents the occlusion status of the face, and the pose information represents the pose deviation status of the face.

[0156] Therefore, in some implementations, occlusion thresholds and pose thresholds can be preset. The occlusion information of each face is then compared with the occlusion threshold. If the occlusion information is less than the occlusion threshold, the face is not occluded; otherwise, the face is occluded. Similarly, the pose information of each face is compared with the pose threshold. If the pose information is less than the pose threshold, the face deflection angle is small; otherwise, the face deflection angle is large.

[0157] It is understood that the specific values ​​of the occlusion threshold and the pose threshold can be selected based on the needs of the scenario, and this disclosure does not impose any restrictions on them.

[0158] In some implementations, among one or more faces in the image to be processed, if the occlusion information of a face is less than an occlusion threshold and its pose information is less than a pose threshold, it indicates that the face is neither occluded nor has a large deflection angle, and thus the face can be identified as a target face. The target face represents a face that can be subsequently detected for uneven face features. Conversely, if the occlusion information of a face is greater than or equal to the occlusion threshold, or the pose information is greater than or equal to the pose threshold, it indicates that the face has many missing facial features, which will introduce a large detection error, and thus the face can be filtered out.

[0159] S340. Crop the target face to obtain a face image.

[0160] In this embodiment of the disclosure, after determining the target face on the image to be processed, the target face can be cropped to retain only the face area, thereby obtaining the face image corresponding to the target face.

[0161] For example Figure 5 In the example, the image to be processed is as follows: Figure 5 As shown in (a), after image cropping of the target face in the image to be processed, the resulting face image can be as follows: Figure 5 As shown in (b).

[0162] As can be seen from the above, in this embodiment of the disclosure, by performing occlusion and pose detection on the face, facial images with missing facial features are screened out, thereby further improving the detection accuracy and effect.

[0163] like Figure 6 As shown, in some embodiments, the image detection method of this disclosure divides the acquired face image into multiple regions and determines the brightness parameter of each region based on pixel brightness, including:

[0164] S610. The face image is processed into a grid based on a preset grid size to obtain a grid image corresponding to the face image.

[0165] In this embodiment of the disclosure, a face image can be divided into regions based on the principle of gridding. For example, in one example, a face image can be divided as follows: Figure 5 As shown in (b), the resulting gridded image can be obtained as shown in [image description]. Figure 7 As shown.

[0166] exist Figure 7In the example, the number of grid regions in the grid image is m*n. The specific regions m and n can be determined by the size of a single grid, which is the preset grid size described in this disclosure. For example, a larger preset grid size means a larger size of a single grid, resulting in fewer grids in the grid image. Conversely, a smaller preset grid size means a smaller size of a single grid, resulting in more grids in the grid image.

[0167] In one example, the preset grid size can be 10 pixels * 10 pixels, meaning that each grid area contains 10 * 10 pixels.

[0168] S620. For each grid region in the grid image, determine the brightness parameter corresponding to the grid region based on the average brightness of the pixels included in the grid region.

[0169] See Figure 7 For example, a grid image may consist of m*n grid regions, each containing a certain number of pixels (e.g., 10*10). Therefore, in some implementations, for each grid region, the average brightness of all pixels within that region can be calculated, and the brightness parameter of that grid region can be determined based on this average brightness.

[0170] In some implementations, the average brightness of pixels within each grid region can be determined as the brightness parameter of the grid region.

[0171] In other implementations, considering that for smaller face images, the face edges may introduce more non-face pixels due to the small size of the face image itself. These non-face pixels are invalid pixels for detecting faces with varying brightness, thus introducing a large detection error. Therefore, before calculating the brightness parameters of each grid region, a classification discussion based on the size of the face image can be performed first.

[0172] Specifically, a preset size threshold for face images can be set in advance. The actual size of the face image is then compared with this preset size threshold. The comparison results include the following two categories:

[0173] 1) The size of the face image is greater than or equal to a preset size threshold.

[0174] This indicates that the face image is relatively large, resulting in fewer invalid pixels at the face edges and a smaller impact on detection accuracy. In this case, the average brightness of the pixels within each grid region can be directly used as the brightness parameter for that grid region.

[0175] by Figure 7 Taking the example shown, for each grid region, the average brightness of the pixels in each grid region is calculated to obtain the brightness parameter corresponding to each grid region.

[0176] 2) The size of the face image is smaller than the preset size threshold.

[0177] This indicates that the size of the face image is relatively small, which may introduce a large number of invalid pixels at the face edges, easily causing significant detection errors. In this case, a pre-configured weight matrix can be used to adjust the average brightness of each grid region to obtain the brightness parameter. The following section will combine... Figure 8 Please provide an explanation.

[0178] like Figure 8 As shown, in some embodiments, the image detection method of this disclosure, in the process of determining the brightness parameters of a grid region, includes:

[0179] S810, In response to the face image size being smaller than a preset size threshold, determine the average brightness of the pixels included in each grid region.

[0180] In this example, if the size of the face image is smaller than a preset size threshold, it indicates that the size of the face image is small, which may introduce a large number of invalid pixels from the face edges, easily causing a large detection error.

[0181] In this case, similar to the previous method, the average brightness of the pixels within each grid region is first calculated based on the brightness value of the pixels within that region. For example, using... Figure 7 As shown in the example, for m*n grid regions, the average brightness values ​​of m*n are calculated respectively.

[0182] S820. Based on the preset weight matrix and the average brightness of each grid region, determine the brightness parameters corresponding to each grid region.

[0183] In this embodiment, a weight matrix can be pre-configured, which is the preset weight matrix described herein. The size of the preset weight matrix can be a*b, meaning it includes a*b elements. Each element represents a weight value, indicating the importance of the element's position. A larger weight value indicates greater importance. The values ​​of a, b, and the weight values ​​of each element can be selected based on the specific scenario, and this disclosure does not impose any restrictions on them.

[0184] It is worth noting that in the embodiments of this disclosure, in the case of small-sized face images, since face edges are prone to introducing more invalid pixels, for the preset weight matrix, the weight value of the edge elements of the matrix can be set to be less than the weight value of the middle elements, thereby weakening the influence of edge pixels and improving detection accuracy.

[0185] It is understandable that in the aforementioned S810, the average brightness of m*n grid regions is obtained. In order to adjust the average brightness of each grid region, a weight matrix of size m*n needs to be preset. Therefore, for a preset weight matrix of size a*b, a weight matrix of size m*n can be obtained through interpolation. The following section will combine... Figure 9 Please provide an explanation.

[0186] like Figure 9 As shown, in some embodiments, the image detection method of this disclosure, based on a preset weight matrix and the average brightness of each grid region, determines the brightness parameter of each grid region, including:

[0187] S821. Based on the size of the grid image, interpolate the preset weight matrix to obtain a weight matrix of the same size as the grid image.

[0188] S822. For each grid region, the brightness parameter corresponding to the grid region is obtained based on the product of the average brightness value of the grid region and the weight value in the weight matrix.

[0189] In some implementations, in conjunction with the foregoing Figure 7 For example, the grid image has dimensions m*n. See one example. Figure 10 As shown, the size of the preset weight matrix is ​​a*b. In order to adjust the size of the preset weight matrix to be the same as the size of the grid image, the preset weight matrix can be interpolated.

[0190] For example Figure 10 In the example, the original a*b size preset weight matrix is ​​transformed into an m*n size weight matrix through interpolation. The interpolation process can employ algorithms such as linear interpolation and bilinear interpolation, which can be understood and fully implemented by those skilled in the art upon reference to relevant technologies; therefore, this disclosure will not elaborate further.

[0191] After obtaining the interpolated weight matrix, which contains m*n elements, and the grid image, which also contains m*n elements, the weight value of each element in the weight matrix can be multiplied by the average brightness of the corresponding grid region in the grid image to obtain the brightness parameter corresponding to each grid region. For example... Figure 10 In the example, each weight value of the m*n size weight matrix can be compared with... Figure 7 By multiplying the average brightness of the corresponding grid regions in the example grid image one by one, the average brightness of the original grid regions can be adjusted to obtain the brightness parameter of each grid region.

[0192] It is understandable that, since the weight values ​​of the edge elements of the preset weight matrix are less than the weight values ​​of the middle elements, the average brightness of the edge grid region in the calculated brightness parameters of the grid image will be reduced, thereby weakening the influence of invalid pixels at the edges, reducing the error introduced by invalid pixels at the edges of the face, and improving the accuracy of subsequent face detection.

[0193] As can be seen from the above, in the case of a small-sized face image, the detection error caused by invalid pixels at the edge of the face is reduced based on a preset weight matrix, thereby further improving the detection accuracy and effect.

[0194] like Figure 11 As shown, in some embodiments, the image detection method of this disclosure, which determines the brightness edge based on the brightness parameters of each region, includes:

[0195] S1110. Based on the brightness parameters of each region, obtain the brightness mask map corresponding to the face image.

[0196] In this embodiment of the disclosure, after determining the brightness parameter of each grid region in the grid image, a brightness mask (mask) that uses the brightness parameter as pixel value can be generated based on the brightness parameter of each grid region.

[0197] For example, as mentioned above Figure 7 In the example grid image, the brightness parameter of each grid region is used as the pixel value. The resulting m*n size brightness mask can be found in [reference needed]. Figure 12 As shown, in the brightness mask, each pixel corresponds to a grid region in the grid image, and the pixel value is the brightness parameter of the grid region.

[0198] S1120. Perform edge detection on the luminance mask to obtain at least one candidate luminance edge included in the luminance mask.

[0199] As can be understood, a luminance mask is a grayscale image, and changes in grayscale reflect changes in brightness in the original face image. Therefore, in this embodiment, edge detection can be performed on the luminance mask, and one or more luminance edges on the resulting luminance mask represent the boundary edges between bright and dark areas in the original face image. Thus, edge detection using a luminance mask, compared to edge detection on the face image itself, significantly reduces computational load while maintaining good edge detection performance.

[0200] The edge detection algorithm can be understood and fully implemented by those skilled in the art by referring to relevant technologies, and will not be elaborated further in this disclosure.

[0201] In one example, for Figure 12 The brightness mask shown, after edge detection, yields brightness edges that can be referenced. Figure 13 As shown. In Figure 13 In the example, there are two brightness edges: one is the white edge at the top of the image, and the other is the white edge in the middle of the image.

[0202] Combination Figure 12 and Figure 13 As the example shows, the above process can filter out all the boundary edges between bright and dark areas in a face image, that is, obtain one or more brightness edges. However, considering that in some scenarios, brightness edges may be due to interference from small shadows formed by accessories (such as glasses, earrings, etc.) or other objects, in order to further filter out interference factors, the brightness edges obtained by the above edge detection can be used as candidate brightness edges, and then the candidate brightness edges can be further filtered.

[0203] S1130. Determine the length information of each candidate brightness edge based on the pixel length included in the candidate brightness edge.

[0204] S1140. Based on the brightness difference between the pixels in the first region and the pixels in the second region surrounding the candidate brightness edge, determine the gradient information of each candidate brightness edge.

[0205] In some implementations, the criteria for filtering candidate brightness edges include length information and gradient information.

[0206] It is understandable that for a certain candidate brightness edge, its length information refers to the pixel length occupied by the brightness edge on the face image. The longer the length, the larger the range of the brightness edge on the face image, that is, the higher the degree of unevenness in the face.

[0207] In some implementations, for each candidate luminance edge, the length information of each candidate luminance edge can be determined based on the pixel length it includes. For example... Figure 13 In the example, for the upper, approximately strip-shaped candidate brightness edge, the length information can be obtained by counting the number of the longest consecutive pixels within the candidate brightness edge. For the lower, approximately ring-shaped candidate brightness edge, the length information can be obtained by counting the number of the longest consecutive pixels within the ring. Those skilled in the art will understand this, and it will not be elaborated further in this disclosure.

[0208] Similarly, for a candidate brightness edge, its gradient information refers to the difference in brightness values ​​near the brightness edge, that is, the difference in brightness between bright and dark pixels. The larger the gradient information, the greater the difference in brightness between bright and dark areas near the brightness edge, that is, the higher the degree of uneven brightness.

[0209] In some implementations, for each candidate brightness edge, the gradient information of the candidate brightness edge can be determined based on the brightness difference between the pixels in the first region and the pixels in the second region near the candidate brightness edge.

[0210] Understandable, with Figure 13 Taking the candidate brightness edge at the top of the image as an example, it corresponds to the boundary edge between the bright and dark areas on the face image. The greater the difference in brightness between the bright and dark areas, the higher the degree of yin-yang face at the candidate brightness edge.

[0211] Therefore, in this embodiment of the present disclosure, for each candidate brightness edge, the brightness values ​​of the first region pixels and the second region pixels around the candidate brightness edge can be obtained first, wherein the first region pixels and the second region pixels are located on both sides of the candidate brightness edge, and thus the first region pixels and the second region pixels are pixels in the bright area and the dark area, respectively.

[0212] Then, a first average brightness value can be calculated based on the brightness value of the pixels in the first region, and a second average brightness value can be calculated based on the brightness value of the pixels in the second region. The difference between the first average brightness value and the second average brightness value is then determined as the gradient information of the candidate brightness edge.

[0213] In this embodiment, there is no limitation on the number of pixels in the first region and the second region. Those skilled in the art can select the appropriate number of pixels according to the specific needs of the scenario, and this disclosure will not elaborate further.

[0214] S1150. Based on the length information and gradient information of each candidate brightness edge, determine at least one brightness edge from the candidate brightness edges.

[0215] In this embodiment, a length threshold can be preset for the length information, and a gradient threshold can be preset for the gradient information. The length threshold represents the critical value for a candidate brightness edge to be a boundary edge between light and dark faces. If the length of the candidate brightness edge is less than this length threshold, it indicates that the candidate brightness edge is not a boundary edge between light and dark faces, and may be due to shadow interference. The gradient threshold represents the critical value for a candidate brightness edge to be a boundary edge between light and dark faces. If the gradient information of the candidate brightness edge is less than this gradient threshold, it indicates that the candidate brightness edge is not a boundary edge between light and dark faces, and may be due to shadow interference.

[0216] In some implementations, if the length information of the candidate brightness edge is greater than or equal to the length threshold, and the gradient information is greater than or equal to the gradient threshold, it indicates that the candidate brightness edge is a distinct edge of the yin-yang face, and thus the candidate brightness edge can be determined as the brightness edge that needs to be detected in the end.

[0217] As can be seen from the above, in this embodiment of the disclosure, by filtering the brightness edge based on the length information and gradient information of the brightness edge, the error caused by shadow interference due to ornaments and other objects is effectively reduced, and the detection accuracy is further improved.

[0218] like Figure 14 As shown, in some embodiments, the image detection method of this disclosure, which determines the detection result of a face with varying brightness at each edge, includes:

[0219] S1410. Determine the length weight corresponding to the brightness edge based on the length information of the brightness edge.

[0220] S1420. Determine the gradient weights corresponding to the brightness edges based on the gradient information of the brightness edges.

[0221] S1430. Based on the product of length weight and gradient weight, determine the detection result of the yin-yang face corresponding to the brightness edge.

[0222] In some implementations, taking a brightness edge as an example, the result of detecting a two-tone face at a brightness edge can be represented by two parts: a length weight and a gradient weight, as follows:

[0223] score = W l *W g (1)

[0224] In formula (1), score represents the result of detecting the two-tone face at the brightness edge, W l W represents the length weight. g This represents the gradient weights.

[0225] In some implementations, the length weight W l Represented as:

[0226]

[0227] In formula (2), length represents the length information of the brightness edge, and diagonal represents the diagonal length of the face image. Formula (2) means:

[0228] If the length of the brightness edge is less than the diagonal length of the face image, then the length weight W... l It equals the ratio of the length information (length) to the diagonal length (diagonal).

[0229] If the length of the brightness edge is greater than or equal to the diagonal length of the face image, then the length weight W l It equals the first value, which is 1 in the example of formula (2).

[0230] The length information of the brightness edge is obtained through the aforementioned Figure 11 The implementation method can calculate the length information (length) by substituting it into formula (2). The corresponding length weight W can then be calculated. l .

[0231] In some implementations, the gradient weight W g Represented as:

[0232] W g =gradient / 255 (3)

[0233] In formula (3), gradient represents the gradient information of the brightness edge, and 255 represents the maximum value of the pixel value range, which is the second value described in this disclosure.

[0234] In this embodiment of the disclosure, the gradient information of the brightness edge is obtained through the aforementioned... Figure 11 The gradient information can be calculated by substituting the gradient information into formula (3) to obtain the corresponding gradient weight W. g .

[0235] The length weight W of the brightness edge is calculated using the above formulas (2) and (3). l and gradient weights W g Then, the length weight W can be set. l and gradient weights W g Substituting into formula (1), the score of the light edge detection is obtained. The larger the score, the higher the degree of light edge lightness. Conversely, the smaller the score, the lower the degree of light edge lightness.

[0236] The above describes the process of determining the result of the two-tone face detection, using only one brightness edge as an example. When the face image includes multiple brightness edges, the above method is performed for each brightness edge to obtain the score of the two-tone face detection result corresponding to each brightness edge. This disclosure will not elaborate further on this.

[0237] As can be seen from the above, in this embodiment of the disclosure, the degree of unevenness of the brightness edge is objectively quantified by using length weight and gradient weight. This not only reflects whether there is an unevenness problem in the face image, but also quantifies the degree of unevenness, providing an objective and accurate data basis for subsequent image processing, thereby improving the optimization effect of unevenness images and improving imaging quality.

[0238] Secondly, this disclosure provides an image processing method that can be applied to an electronic device. The electronic device can be any type of device suitable for implementation, such as a smartphone, tablet computer, wearable device, smart cockpit system, facial recognition system, server, cloud platform, etc. This disclosure does not limit the scope of the method.

[0239] like Figure 15 As shown, in some embodiments, the image processing method of this disclosure includes:

[0240] S1510. Obtain the face image to be processed and the result of the two-tone face detection of the face image.

[0241] S1520. Based on the results of the two-tone face detection, determine the adjustment parameters for each brightness edge on the face image.

[0242] S1530. Perform image processing on the face image based on the adjustment parameters of each brightness edge to obtain the target image.

[0243] In this embodiment, the face image to be processed is the face image in the aforementioned embodiment, and the result of the face image detection is the result of the face detection obtained in the aforementioned embodiment. This disclosure will not elaborate further on this.

[0244] It is understood that the result of detecting uneven lighting at each brightness edge in a face image reflects the degree of uneven lighting at that brightness edge location, that is, the degree of brightness difference between the bright and dark areas. Therefore, in this embodiment of the present disclosure, when processing a face image, the corresponding adjustment parameters can be determined based on the result of detecting uneven lighting at the brightness edges. The adjustment parameters can be, for example, brightness adjustment parameters.

[0245] In some implementations, corresponding adjustment parameters can be pre-set for different light-light face detection results. Thus, for a given brightness edge, the appropriate adjustment parameters can be determined based on its corresponding light-light face detection result. After determining the adjustment parameters, the image brightness at that brightness edge location can be adjusted using these parameters.

[0246] The above example illustrates the brightness adjustment process using one brightness edge as an example. When a face image includes multiple brightness edges, the above method is executed sequentially to adjust the brightness of each brightness edge, thereby optimizing the image quality of the face image and obtaining the final target image.

[0247] As can be seen from the above, in this embodiment of the disclosure, by objectively quantifying the degree of yin-yang in a face image, an objective and accurate data basis is provided for image processing, thereby improving the optimization effect of yin-yang face images and improving imaging quality.

[0248] Thirdly, this disclosure provides an image detection device that can be applied to an electronic device. The electronic device can be any type of device suitable for implementation, such as a smartphone, tablet computer, wearable device, smart cockpit system, facial recognition system, server, cloud platform, etc. This disclosure does not limit the scope of the device.

[0249] like Figure 16 As shown, in some embodiments, the image detection apparatus of this disclosure includes:

[0250] The region segmentation module 10 is configured to divide the acquired face image into multiple regions and determine the brightness parameters of each region based on the pixel brightness.

[0251] Edge detection module 20 is configured to determine at least one luminance edge on the face image based on the luminance parameters of each region, the luminance edge representing the boundary edge between bright and dark areas on the face image;

[0252] The result determination module 30 is configured to determine the yin-yang face detection result corresponding to each brightness edge based on the length information and / or gradient information of the brightness edge, wherein the yin-yang face detection result represents the degree of yin-yang face corresponding to the brightness edge.

[0253] In some embodiments, the region division module 10 is configured to:

[0254] The face image is processed into a grid based on a preset grid size to obtain a grid image corresponding to the face image, wherein the grid image includes multiple grid regions;

[0255] For each grid region in the grid image, the brightness parameter corresponding to the grid region is determined based on the average brightness of the pixels included in the grid region.

[0256] In some embodiments, the region division module 10 is configured to:

[0257] In response to the face image size being greater than or equal to a preset size threshold, the average brightness of the pixels included in each grid region is determined as the brightness parameter corresponding to the grid region.

[0258] In some embodiments, the region division module 10 is configured to:

[0259] In response to the fact that the size of the face image is less than a preset size threshold, the average brightness of the pixels included in each grid region is determined;

[0260] Based on a preset weight matrix and the average brightness of each grid region, the brightness parameter corresponding to each grid region is determined, wherein the weight value of the edge element in the preset weight matrix is ​​less than the weight value of the middle element.

[0261] In some embodiments, the region division module 10 is configured to:

[0262] Based on the size of the grid image, the preset weight matrix is ​​interpolated to obtain a weight matrix of the same size as the grid image;

[0263] For each grid region, the brightness parameter corresponding to the grid region is obtained by multiplying the average brightness value corresponding to the grid region and the weight value in the weight matrix.

[0264] In some embodiments, the edge detection module 20 is configured to:

[0265] Based on the brightness parameters of each region, a brightness mask map corresponding to the face image is obtained;

[0266] Edge detection is performed on the brightness mask to obtain at least one candidate brightness edge included in the brightness mask;

[0267] Based on the pixel lengths included in the candidate brightness edges, determine the length information of each candidate brightness edge;

[0268] Based on the brightness difference between the pixels in the first region and the pixels in the second region around the candidate brightness edge, the gradient information of each candidate brightness edge is determined, wherein the pixels in the first region and the pixels in the second region are located on both sides of the candidate brightness edge, respectively.

[0269] Based on the length and gradient information of each candidate brightness edge, at least one brightness edge is determined from the candidate brightness edges.

[0270] In some implementations, the result determination module 30 is configured to:

[0271] The length weight corresponding to the brightness edge is determined based on the length information of the brightness edge;

[0272] The gradient weight corresponding to the brightness edge is determined based on the gradient information of the brightness edge;

[0273] The detection result of the yin-yang face corresponding to the brightness edge is determined based on the product of the length weight and the gradient weight.

[0274] In some implementations, the result determination module 30 is configured to:

[0275] In response to the fact that the length information of the brightness edge is less than the diagonal length of the face image, the ratio of the length information to the diagonal length is determined as the length weight of the brightness edge;

[0276] In response to the length information of the brightness edge being greater than or equal to the diagonal length of the face image, a first value is determined as the length weight of the brightness edge.

[0277] In some implementations, the result determination module 30 is configured to:

[0278] The ratio of the gradient information to the second value is determined as the gradient weight of the brightness edge.

[0279] In some embodiments, the region division module 10 is configured to:

[0280] Acquire an image to be processed, the image to be processed including at least one human face;

[0281] Face detection is performed on the image to be processed to obtain occlusion information and pose information of each face;

[0282] Based on the occlusion information and the pose information, a target face is determined from at least one face included in the image to be processed;

[0283] The target face is cropped to obtain the face image.

[0284] Fourthly, this disclosure provides an image processing apparatus that can be applied to an electronic device. The electronic device can be any type of device suitable for implementation, such as a smartphone, tablet computer, wearable device, smart cockpit system, facial recognition system, server, cloud platform, etc. This disclosure does not limit the scope of the application.

[0285] like Figure 17 As shown, in some embodiments, the image processing apparatus of this disclosure includes:

[0286] The acquisition module 40 is configured to acquire a face image to be processed and a two-tone face detection result of the face image, wherein the two-tone face detection result is obtained by the method of any of the above embodiments;

[0287] The parameter determination module 50 is configured to determine the adjustment parameters for each brightness edge on the face image based on the half-face detection results.

[0288] The image processing module 60 is configured to perform image processing on the face image based on adjustment parameters for each brightness edge to obtain a target image.

[0289] Fifthly, embodiments of this disclosure provide an electronic device, including:

[0290] processor; and

[0291] The memory stores computer instructions that cause the processor to perform the method described in any of the above embodiments.

[0292] Sixthly, embodiments of this disclosure provide a storage medium storing computer instructions for causing a computer to perform the methods described in any of the above embodiments.

[0293] Figure 18 The diagram illustrates the electronic device structure in some embodiments of this disclosure, which will be discussed below in conjunction with... Figure 18 Some embodiments of the electronic device described herein will be explained.

[0294] Reference Figure 18 The electronic device 1800 may include one or more of the following components: a processing component 1802, a memory 1804, a power supply component 1806, a multimedia component 1808, an audio component 1810, an input / output (I / O) interface 1812, a sensor component 1816, and a communication component 1818.

[0295] Processing component 1802 typically controls the overall operation of electronic device 1800, such as operations associated with display, telephone calls, data communication, camera operation, and recording operations. Processing component 1802 may include one or more processors 1820 to execute instructions. Furthermore, processing component 1802 may include one or more modules to facilitate interaction between processing component 1802 and other components. For example, processing component 1802 may include a multimedia module to facilitate interaction between multimedia component 1808 and processing component 1802. As another example, processing component 1802 may read executable instructions from memory to implement relevant functions of the electronic device.

[0296] Memory 1804 is configured to store various types of data to support the operation of electronic device 1800. Examples of this data include instructions for any application or method operating on electronic device 1800, contact data, phonebook data, messages, pictures, videos, etc. Memory 1804 can be implemented by any type of volatile or non-volatile storage device or a combination thereof, such as static random access memory (SRAM), electrically erasable programmable read-only memory (EEPROM), erasable programmable read-only memory (EPROM), programmable read-only memory (PROM), read-only memory (ROM), magnetic storage, flash memory, magnetic disk, or optical disk.

[0297] Power supply component 1806 provides power to various components of electronic device 1800. Power supply component 1806 may include a power management system, one or more power supplies, and other components associated with generating, managing, and distributing power to electronic device 1800.

[0298] The multimedia component 1808 includes a display screen that provides an output interface between the electronic device 1800 and the user. In some embodiments, the multimedia component 1808 includes a front-facing camera and / or a rear-facing camera. When the electronic device 1800 is in an operating mode, such as a shooting mode or a video mode, the front-facing camera and / or the rear-facing camera can receive external multimedia data. Each front-facing camera and rear-facing camera can be a fixed optical lens system or have focal length and optical zoom capabilities.

[0299] Audio component 1810 is configured to output and / or input audio signals. For example, audio component 1810 includes a microphone (MIC) configured to receive external audio signals when electronic device 1800 is in an operating mode, such as call mode, recording mode, and voice recognition mode. The received audio signals may be further stored in memory 1804 or transmitted via communication component 1818. In some embodiments, audio component 1810 also includes a speaker for outputting audio signals.

[0300] I / O interface 1812 provides an interface between processing component 1802 and peripheral interface modules, such as keyboards, click wheels, buttons, etc. These buttons may include, but are not limited to, home buttons, volume buttons, power buttons, and lock buttons.

[0301] Sensor assembly 1816 includes one or more sensors for providing state assessments of various aspects of electronic device 1800. For example, sensor assembly 1816 may detect the on / off state of electronic device 1800, the relative positioning of components such as the display and keypad of electronic device 1800, changes in position of electronic device 1800 or a component of electronic device 1800, the presence or absence of user contact with electronic device 1800, the orientation or acceleration / deceleration of electronic device 1800, and temperature changes of electronic device 1800. Sensor assembly 1816 may include a proximity sensor configured to detect the presence of nearby objects without any physical contact. Sensor assembly 1816 may also include a light sensor, such as a CMOS or CCD image sensor, for use in imaging applications. In some embodiments, sensor assembly 1816 may also include an accelerometer, gyroscope, magnetometer, pressure sensor, or temperature sensor.

[0302] Communication component 1818 is configured to facilitate wired or wireless communication between electronic device 1800 and other devices. Electronic device 1800 can access wireless networks based on communication standards, such as Wi-Fi, 2G, 3G, 4G, 5G, or 6G, or combinations thereof. In one exemplary embodiment, communication component 1818 receives broadcast signals or broadcast-related information from an external broadcast management system via a broadcast channel. In one exemplary embodiment, communication component 1818 also includes a near-field communication (NFC) module to facilitate short-range communication. For example, the NFC module may be implemented based on radio frequency identification (RFID) technology, Infrared Data Association (IrDA) technology, ultra-wideband (UWB) technology, Bluetooth (BT) technology, and other technologies.

[0303] In an exemplary embodiment, the electronic device 1800 may be implemented by one or more application-specific integrated circuits (ASICs), digital signal processors (DSPs), digital signal processing devices (DSPDs), programmable logic devices (PLDs), field-programmable gate arrays (FPGAs), controllers, microcontrollers, microprocessors, or other electronic components.

[0304] Obviously, the above embodiments are merely examples for clear illustration and are not intended to limit the embodiments. Those skilled in the art will recognize that other variations or modifications can be made based on the above description. It is neither necessary nor possible to exhaustively list all embodiments here. However, obvious variations or modifications derived therefrom are still within the scope of protection of this disclosure.

Claims

1. An image detection method, characterized in that, include: The acquired face image is divided into multiple regions, and the brightness parameters of each region are determined based on the pixel brightness. Based on the brightness parameters of each region, at least one brightness edge is determined on the face image, where the brightness edge represents the boundary edge between bright and dark areas on the face image; Based on the length information and / or gradient information of the brightness edge, the corresponding light-and-dark face detection result is determined for each brightness edge, and the light-and-dark face detection result represents the degree of light-and-dark face corresponding to the brightness edge.

2. The method according to claim 1, characterized in that, The step of dividing the acquired face image into multiple regions and determining the brightness parameter of each region based on pixel brightness includes: The face image is processed into a grid based on a preset grid size to obtain a grid image corresponding to the face image, wherein the grid image includes multiple grid regions; For each grid region in the grid image, the brightness parameter corresponding to the grid region is determined based on the average brightness of the pixels included in the grid region.

3. The method according to claim 2, characterized in that, For each grid region in the grid image, determining the brightness parameter corresponding to the grid region based on the average brightness of the pixels included in the grid region includes: In response to the face image size being greater than or equal to a preset size threshold, the average brightness of the pixels included in each grid region is determined as the brightness parameter corresponding to the grid region.

4. The method according to claim 2, characterized in that, For each grid region in the grid image, determining the brightness parameter corresponding to the grid region based on the average brightness of the pixels included in the grid region includes: In response to the fact that the size of the face image is less than a preset size threshold, the average brightness of the pixels included in each grid region is determined; Based on a preset weight matrix and the average brightness of each grid region, the brightness parameter corresponding to each grid region is determined, wherein the weight value of the edge element in the preset weight matrix is ​​less than the weight value of the middle element.

5. The method according to claim 4, characterized in that, The step of determining the brightness parameter corresponding to each grid region based on a preset weight matrix and the average brightness of each grid region includes: Based on the size of the grid image, the preset weight matrix is ​​interpolated to obtain a weight matrix of the same size as the grid image; For each grid region, the brightness parameter corresponding to the grid region is obtained by multiplying the average brightness value corresponding to the grid region and the weight value in the weight matrix.

6. The method according to any one of claims 1 to 5, characterized in that, Determining at least one brightness edge on the face image based on the brightness parameters of each region includes: Based on the brightness parameters of each region, a brightness mask map corresponding to the face image is obtained; Edge detection is performed on the brightness mask to obtain at least one candidate brightness edge included in the brightness mask; Based on the pixel lengths included in the candidate brightness edges, determine the length information of each candidate brightness edge; Based on the brightness difference between the pixels in the first region and the pixels in the second region around the candidate brightness edge, the gradient information of each candidate brightness edge is determined, wherein the pixels in the first region and the pixels in the second region are located on both sides of the candidate brightness edge, respectively. Based on the length and gradient information of each candidate brightness edge, at least one brightness edge is determined from the candidate brightness edges.

7. The method according to claim 1, characterized in that, The step of determining the corresponding yin-yang face detection result for each brightness edge based on the length information and / or gradient information of the brightness edge includes: The length weight corresponding to the brightness edge is determined based on the length information of the brightness edge; The gradient weight corresponding to the brightness edge is determined based on the gradient information of the brightness edge; The detection result of the yin-yang face corresponding to the brightness edge is determined based on the product of the length weight and the gradient weight.

8. The method according to claim 7, characterized in that, Determining the length weight corresponding to the brightness edge based on the length information of the brightness edge includes: In response to the fact that the length information of the brightness edge is less than the diagonal length of the face image, the ratio of the length information to the diagonal length is determined as the length weight of the brightness edge; In response to the length information of the brightness edge being greater than or equal to the diagonal length of the face image, a first value is determined as the length weight of the brightness edge.

9. The method according to claim 7, characterized in that, Determining the gradient weight corresponding to the brightness edge based on the gradient information of the brightness edge includes: The ratio of the gradient information to the second value is determined as the gradient weight of the brightness edge.

10. The method according to claim 1, characterized in that, Also includes: Acquire an image to be processed, the image to be processed including at least one human face; Face detection is performed on the image to be processed to obtain occlusion information and pose information of each face; Based on the occlusion information and the pose information, a target face is determined from at least one face included in the image to be processed; The target face is cropped to obtain the face image.

11. An image processing method, characterized in that, include: Obtain a face image to be processed and the result of detecting two-tone faces in the face image, wherein the result of detecting two-tone faces is obtained by the method according to any one of claims 1 to 10; Based on the results of the two-tone face detection, the adjustment parameters for each brightness edge on the face image are determined; The face image is processed based on the adjustment parameters of each brightness edge to obtain the target image.

12. An image detection device, characterized in that, include: The region segmentation module is configured to divide the acquired face image into multiple regions and determine the brightness parameters of each region based on pixel brightness. An edge detection module is configured to determine at least one luminance edge on the face image based on the luminance parameters of each region, the luminance edge representing the boundary edge between bright and dark areas on the face image; The result determination module is configured to determine the yin-yang face detection result corresponding to each brightness edge based on the length information and / or gradient information of the brightness edge, wherein the yin-yang face detection result represents the degree of yin-yang face corresponding to the brightness edge.

13. An image processing apparatus, characterized in that, include: The acquisition module is configured to acquire a face image to be processed and a two-tone face detection result of the face image, wherein the two-tone face detection result is obtained by the method described in any one of claims 1 to 10; The parameter determination module is configured to determine the adjustment parameters for each brightness edge on the face image based on the results of the two-tone face detection. The image processing module is configured to perform image processing on the face image based on adjustment parameters for each brightness edge to obtain the target image.

14. An electronic device, characterized in that, include: processor; and A memory storing computer instructions for causing a processor to perform the method according to any one of claims 1 to 10, or to perform the method according to claim 11.

15. A storage medium, characterized in that, The computer contains computer instructions for causing the computer to perform the method according to any one of claims 1 to 10, or to perform the method according to claim 11.