A face image highlight removal method and system based on regional hierarchical processing

By using a regional hierarchical processing method, a facial target region mask is generated and converted to the LAB color space. Overexposed and near-overexposed regions are divided, and pixel values ​​are updated using statistical feature values ​​and dynamic adjustment coefficients. This solves the problems of inaccurate highlight removal and high computational cost in existing technologies, and achieves efficient and accurate highlight restoration.

CN122115275APending Publication Date: 2026-05-29FUJIAN JIEYUXING TECH CO LTD

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
FUJIAN JIEYUXING TECH CO LTD
Filing Date
2026-01-12
Publication Date
2026-05-29

AI Technical Summary

Technical Problem

Existing methods for removing highlights from facial images struggle to intelligently distinguish the degree of highlight, leading to over-processing of detailed areas or blurring of textures during highlight removal. Furthermore, deep learning-based methods have high computational overhead, making them unsuitable for mobile devices or real-time systems.

Method used

A regional hierarchical processing method is adopted. By generating a face target region mask, converting it to the LAB color space, dividing overexposed and near-overexposed regions, filling and filtering with statistical feature values, and updating pixel values ​​with dynamic adjustment coefficients, a gradual and smooth transition in the highlight region is achieved.

Benefits of technology

It improves the accuracy of highlight positioning and restoration, maintains the consistency and naturalness of facial skin tone, avoids loss of detail and blurring of texture, and is suitable for mobile terminals and real-time systems.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN122115275A_ABST
    Figure CN122115275A_ABST
Patent Text Reader

Abstract

The present application relates to a kind of high light removal method and system of face image based on regional hierarchical processing, belong to digital image processing technical field.It includes the following steps: obtaining face image and generating face target area mask, image is converted from RGB color space to LAB color space in limited area, and overexposure and near overexposure area are divided based on brightness threshold value;Fill in repair is carried out to overexposure area using the statistical characteristics of near overexposure area on brightness and color difference channel;Further generate highlight area mask according to brightness distribution, calculate dynamic adjustment coefficient, and adaptively update brightness and color difference channel in highlight area, finally the repair result is converted back to RGB color space and output, effectively remove the high light of face and keep natural skin color.The present application can effectively retain face details and color consistency while suppressing overexposure highlight, improve the naturalness and robustness of the result of removing highlight.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention relates to a method and system for removing highlights from face images based on region-level processing, belonging to the field of digital image processing technology. Background Technology

[0002] With the rapid development of smart terminal devices and computer vision technology, facial images are widely collected and used in applications such as identity authentication, video conferencing, facial recognition, and image enhancement. However, in actual shooting processes, due to complex lighting conditions, uneven light source intensity, and the specular reflection characteristics of oil and sweat on the surface of facial skin, obvious highlights or even overexposure can easily occur in local areas of the face (such as the forehead, bridge of the nose, and tip of the nose).

[0003] The aforementioned highlight areas typically exhibit brightness values ​​approaching or reaching the sensor's saturation limit, resulting in severe loss of brightness details, accompanied by color distortion and missing texture information. This not only affects the subjective visual quality of the image but also adversely impacts subsequent face image-based analysis and processing (such as feature extraction and recognition matching). Therefore, effectively removing and correcting highlight areas in face images has become an important research topic in the field of digital image processing. Existing face highlight removal methods mainly include global brightness compression, local threshold suppression, and image enhancement methods based on learning models. Processing methods based on global or fixed thresholds often fail to distinguish between highlight areas of different degrees, easily causing overprocessing of areas where details still remain, leading to unnatural skin tones or blurred textures. Methods that only suppress local areas often fail to ensure the naturalness of brightness and color transitions between highlight areas and surrounding normal areas. Furthermore, while some deep learning-based highlight removal methods have certain effects in specific scenarios, they typically rely on complex model structures and large amounts of training data, resulting in high computational costs and making them unsuitable for deployment on mobile terminals or real-time systems.

[0004] Therefore, there is an urgent need for a method that can intelligently distinguish the degree of highlight and apply targeted processing to optimally balance texture preservation and naturalness while removing highlights. Summary of the Invention

[0005] To address the problems existing in the prior art, this invention proposes a method and system for removing highlights from face images based on region-level processing.

[0006] The technical solution of the present invention is as follows: On the one hand, this invention proposes a method for highlight removal of face images based on region-level processing, including the following steps: Acquire the face image to be processed and generate a face target region mask; use the face target region mask as a constraint to determine the face target region in the face image; The image data within the target area of ​​the face is converted from the RGB color space to the LAB color space, and the luminance channel and A and B chrominance channels are separated. Based on preset overexposure and near-overexposure thresholds, the facial target area is divided into overexposed and near-overexposed regions. Statistical feature values ​​of the near-overexposed region in the luminance channel and A and B chroma channels are calculated. These statistical feature values ​​are used to fill the pixel values ​​in the overexposed region, followed by filtering to obtain a preliminary face restoration image. Based on the distribution characteristics of the luminance channel in the preliminary face restoration image, a highlight threshold and a near-highlight threshold are defined to determine the highlight region. Dynamic adjustment coefficients are calculated and used to update the values ​​of each pixel in the highlight region in the luminance channel and A and B chroma channels, resulting in the final restored image in the LAB color space. The final repaired image is converted to the RGB color space, and the resulting image with de-highlighting is output.

[0007] Preferably, the method divides the facial target region into overexposed regions and near-overexposed regions based on preset overexposure thresholds and near-overexposure thresholds, specifically as follows: Set two brightness channel thresholds, including an overexposure threshold. and near overexposure threshold The relationship between the overexposure threshold and the near-overexposure threshold satisfies the following condition: ; Within the target facial region, based on overexposure and near-overexposure thresholds, overexposure region masks and near-overexposure region masks are defined, expressed by the following formula: ; ; In the formula, Indicates the mask for overexposed areas. Indicates the mask for near-overexposed areas. Indicates the overexposure threshold. Indicates the near overexposure threshold. Represents the pixels within the target area of ​​the face. The brightness channel value; The overexposed area and the near-overexposed area are determined by using the overexposed area mask and the near-overexposed area mask as constraints.

[0008] Preferably, the statistical characteristic value is the arithmetic mean or median.

[0009] Preferably, the method uses the arithmetic mean as a statistical feature value to fill the pixel values ​​in the overexposed area and performs filtering to obtain a preliminary face restoration image, specifically: Within the near-overexposed region, the mean values ​​of the pixels in the near-overexposed region are calculated in the luminance channel and the A and B chrominance channels, respectively, expressed by the formula: ; ; ; In the formula, Indicates pixels in the near-overexposed area The average value of the brightness channel, Indicates pixels in the near-overexposed area The mean value of the A chroma channel, Indicates pixels in the near-overexposed area The mean value of the B chroma channel, This indicates the number of pixels in the near-overexposed area. Represents the pixels within the target area of ​​the face. The brightness channel value, Represents the pixels within the target area of ​​the face. The A chromaticity channel value, Represents the pixels within the target area of ​​the face. The B chromaticity channel, Indicates the mask for near-overexposed areas; The average value of the pixels in the nearly overexposed area across all channels is used to fill each pixel in the overexposed area, expressed by the formula: ; ; ; In the formula, Indicates pixels in the overexposed area The filled luminance channel value, Indicates pixels in the overexposed area The A chroma channel values ​​after filling Indicates pixels in the overexposed area The filled B chroma channel value Indicates the mask for overexposed areas; After filling the overexposed areas with pixels, smoothing filters are applied to each channel value to obtain a preliminary face restoration image, expressed by the formula: ; ; ; In the formula, This indicates the initial restoration of facial image pixels. The brightness channel value, This indicates the initial restoration of facial image pixels. The A chromaticity channel value, This indicates the initial restoration of facial image pixels. The B chromaticity channel value, This indicates a Gaussian filter or a bilateral filter operator.

[0010] Preferably, the method defines a highlight threshold and a near-highlight threshold to determine the highlight region based on the distribution characteristics of the brightness channels in the preliminary face restoration image, specifically as follows: Preliminary restoration of facial image pixels Luminance channel value Statistical analysis was performed, and a brightness histogram was constructed, expressed by the formula: ; In the formula, Represents the brightness histogram. Indicates an indicator function, Indicates brightness level, This indicates the initial restoration of facial image pixels. The brightness channel value, Represents a mask for the target area of ​​a face; Based on the statistical analysis results of the brightness histogram, the threshold is determined by taking the corresponding percentiles, expressed by the formula: ; ; In the formula, Indicates the highlight threshold. Indicates the near-highlight threshold. The first digit representing the brightness distribution Percentile function The first digit representing the brightness distribution Percentile function; where the relationship between the highlight threshold and the near-highlight threshold satisfies ; Within the target facial region, a highlight region mask and a near-highlight region mask are defined based on the highlight threshold and the near-highlight threshold, expressed by the following formula: ; ; In the formula, This represents the highlight area mask. Indicates the mask for the near-highlight region; The highlight region and the near-highlight region are determined by using the highlight region mask and the near-highlight region mask as constraints.

[0011] Preferably, the dynamic adjustment coefficient is expressed by the formula: ; In the formula, Indicates the dynamic adjustment coefficient. This represents the slope adjustment factor. Represents pixels in the near-highlight region The average value of the brightness channel, Represents pixels within the highlight area The brightness value; Among them, the slope adjustment factor This is a configurable constant used to adjust the dynamic adjustment coefficient. The sensitivity to changes in brightness allows the intensity adjustment to adapt to the overexposure of pixels.

[0012] Preferably, the method uses dynamic adjustment coefficients to update the values ​​of each pixel in the highlight region in the luminance channel and the A and B chrominance channels, specifically as follows: The luminance channel and A and B chroma channels in the highlight area are simultaneously compressed towards the corresponding near-highlight reference values. The degree of compression is dynamically adjusted by a coefficient. Control, expressed as a formula: ; ; ; In the formula, This indicates the initial restoration of facial image pixels. Compressed luminance channel values, This indicates the initial restoration of facial image pixels. Compressed A chroma channel values, This indicates the initial restoration of facial image pixels. Compressed B chroma channel values, Represents pixels in the near-highlight region The mean value of the A chroma channel, Represents pixels in the near-highlight region The mean value of the B chroma channel, This indicates the initial restoration of facial image pixels. The A chromaticity channel value, This indicates the initial restoration of facial image pixels. The B chromaticity channel value; Based on the luminance and A and B chroma channel values ​​of the preliminarily restored face image after compression, a complete channel value update rule is constructed, expressed by the formula: ; ; ; In the formula, This indicates the initial restoration of facial image pixels. Dynamically adaptive adjustment of the brightness channel value. This indicates the initial restoration of facial image pixels. The dynamically adaptively adjusted A chromaticity channel value. This indicates the initial restoration of facial image pixels. The dynamically adaptively adjusted B chromaticity channel value This represents the mask for the highlight area.

[0013] On the other hand, the present invention also proposes a face image highlight removal system based on region hierarchical processing, comprising the following modules: Target region determination module: acquires the face image to be processed, generates a face target region mask; and determines the face target region in the face image based on the face target region mask as a constraint. Color conversion module: Converts image data within the target area of ​​the face from RGB color space to LAB color space, and separates the luminance channel and A and B chrominance channels; Overexposure repair and highlight adjustment module: Based on preset overexposure thresholds and near-overexposure thresholds, the target area of ​​the face is divided into overexposed areas and near-overexposed areas; the statistical feature values ​​of the near-overexposed areas in the luminance channel and A and B chroma channels are calculated, and the pixel values ​​in the overexposed areas are filled with the statistical feature values ​​and filtered to obtain a preliminary face repair image; according to the distribution characteristics of the luminance channel in the preliminary face repair image, a highlight threshold and a near-highlight threshold are defined to determine the highlight areas; a dynamic adjustment coefficient is calculated, and the values ​​of each pixel in the highlight areas in the luminance channel and A and B chroma channels are updated using the dynamic adjustment coefficient to obtain the final repair image in the LAB color space; Output module: Converts the final repaired image to RGB color space and outputs the de-highlighted image.

[0014] In another aspect, the present invention also proposes an electronic device, including a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor executes the program to implement the method as described in any embodiment of the present invention.

[0015] In another aspect, the present invention also proposes a computer-readable storage medium having a computer program stored thereon, which, when executed by a processor, implements the method described in any embodiment of the present invention.

[0016] The present invention has the following beneficial effects: (1) This invention is a method and system for removing highlights from face images based on region-level processing. By generating a mask of the face target region, highlight detection and repair are performed only within the limited face region. The image is converted from the RGB color space to the LAB color space, and the luminance channel and color difference channel are separated, so that the highlights are mainly concentrated in the luminance channel for processing, thereby avoiding unnecessary interference with skin color information during the highlight removal process. This technical feature effectively reduces the influence of background and non-skin color regions on highlight judgment, improves the accuracy of highlight localization and repair, and ensures the consistency and naturalness of the face skin color.

[0017] (2) This invention is a method and system for removing highlights from face images based on region-level hierarchical processing. By setting overexposure thresholds and near-overexposure thresholds, the face region is further divided into overexposure region masks and near-overexposure region masks. The statistical characteristic values ​​of the near-overexposure region in the brightness and color difference channels are used to fill and repair the overexposure region. At the same time, filtering is combined to eliminate abrupt boundaries of the filling. This hierarchical repair strategy avoids the detail loss problem caused by directly compressing the overexposure region in traditional methods, achieves stable repair of severely overexposure regions, and improves the performance of the repair results in terms of structural continuity and visual smoothness.

[0018] (3) This invention is a method and system for removing highlights from face images based on region-level processing. By further calculating the distribution characteristics of the brightness channel in the preliminary repaired face image, the highlight threshold and near-highlight threshold are determined. A dynamic adjustment coefficient that changes with pixel brightness is introduced to jointly update the brightness channel and color difference channel of the pixels in the highlight area, so that the highlight compression intensity matches the pixel overexposure degree. This technical feature avoids the problem of over-compression or under-compression caused by fixed parameter adjustment, and realizes a gradual and smooth transition in the highlight area, thereby effectively suppressing specular highlights while maximizing the preservation of facial texture details and real lighting levels. Attached Figure Description

[0019] Figure 1 This is a flowchart of the highlight removal method provided in Embodiment 1 of the present invention; Figure 2 This is a comparison diagram of the overexposed area and the near-overexposed area provided in Embodiment 1 of the present invention; Figure 3 This is a comparison image of the highlight area and the near-highlight area provided in Embodiment 1 of the present invention; Figure 4 This is a comparison image of a face before and after highlight removal, provided in Embodiment 1 of the present invention. Detailed Implementation

[0020] The technical solutions of the embodiments of the present invention will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of the present invention, and not all embodiments. Based on the embodiments of the present invention, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of the present invention.

[0021] It should be understood that the step numbers used in the text are for ease of description only and are not intended to limit the order in which the steps are performed.

[0022] It should be understood that the terminology used in this specification is for the purpose of describing particular embodiments only and is not intended to limit the invention. As used in this specification and the appended claims, the singular forms “a,” “an,” and “the” are intended to include the plural forms unless the context clearly indicates otherwise.

[0023] The terms “comprising” and “including” indicate the presence of the described feature, whole, step, operation, element and / or component, but do not exclude the presence or addition of one or more other features, wholes, steps, operations, elements, components and / or collections thereof.

[0024] The term “and / or” refers to any combination of one or more of the associated listed items, as well as all possible combinations, and includes these combinations.

[0025] Example 1: See Figure 1 This embodiment proposes a method for highlight removal of face images based on region-level processing, including the following steps: S100. Obtain the face image to be processed, and obtain the probability value of each pixel belonging to the face region through the face segmentation model, expressed by the formula: ; In the formula, Represents pixels The probability of belonging to a human portrait area. This represents a human face segmentation model. This represents the face image to be processed. The initial human face mask is obtained through thresholding, expressed by the formula: ; In the formula, This represents the initial human face mask. Indicates the segmentation probability threshold; Furthermore, the face bounding box is obtained using the face detector from the pre-defined Dlib library, and the face geometric mask is defined as follows: ; In the formula, Represents a geometric mask for a face; The initial portrait mask and the face geometric mask are logically fused to obtain the face target region mask, which is expressed by the formula: ; In the formula, Represents a mask for the target area of ​​a face; It should be noted that when When, it indicates the current pixel point It belongs to the facial target area, when Indicates the current pixel. It does not belong to the target area of ​​the face.

[0026] S200: Based on the RGB value of any pixel in the face image to be processed, and using the face target region mask as a spatial constraint, the RGB color space is mapped to the LAB color space using a preset color space conversion tool (such as the RGBToLab library), expressed by the formula: ; In the formula, This represents the face image to be processed in the LAB color space. Tools for representing color space conversion, The image of the face to be processed represents the RGB color space. The obtained LAB color space image of the face to be processed is expressed by the formula: ; In the formula, Represents the pixels of the face image to be processed. The brightness channel value, Represents the pixels of the face image to be processed. The A chromaticity channel value, Represents the pixels of the face image to be processed. The B chromaticity channel, This indicates the transpose operation.

[0027] Furthermore, channel separation is performed on the face image to be processed in the LAB color space to obtain the luminance channel values. A chromaticity channel value and the B-th chroma channel value ; To ensure that subsequent specular analysis applies only to the face region, a mask constraint is defined for the separated channels using a face target region mask, expressed as a formula: ; ; ; In the formula, Represents the pixels within the target area of ​​the face. The brightness channel value, This represents the number of pixels within the target area of ​​a face. The A chromaticity channel value, This represents the number of pixels within the target area of ​​a face. The B chromaticity channel value; It should be noted that when When, it indicates the current pixel point Participate in subsequent brightness statistics, threshold division, and dynamic adjustment operations, when Indicates the current pixel. I will not participate in subsequent operations.

[0028] S300, see also Figure 2 Based on the three channels constrained by the mask, the system performs overexposed and near-overexposed area segmentation and repair. Specifically: Set two brightness channel thresholds, including an overexposure threshold. and near overexposure threshold The relationship between the overexposure threshold and the near-overexposure threshold satisfies the following condition: ; For any satisfying pixels Define the overexposed area mask and the near-overexposed area mask, respectively, expressed by the formulas: ; ; In the formula, Indicates the mask for overexposed areas. Indicates the mask for near-overexposed areas. Indicates the overexposure threshold. Indicates the near overexposure threshold; It should be noted that, Indicates overexposed pixels that are saturated in brightness but lack detail. ; This refers to nearly overexposed pixels whose brightness is close to saturation but still retains valid information. .

[0029] Furthermore, using a data donation strategy, within the near-overexposed area, the average values ​​of neighboring near-overexposed pixels in the L, A, and B channels are calculated, expressed by the formula: ; ; ; In the formula, Indicates pixels in the near-overexposed area The average value of the brightness channel, Indicates pixels in the near-overexposed area The mean value of the A chroma channel, Indicates pixels in the near-overexposed area The mean value of the B chroma channel, This indicates the number of pixels in the near-overexposed area; The calculated mean value is filled into each pixel of the overexposed area, expressed by the formula: ; ; ; In the formula, Indicates pixels in the overexposed area The filled luminance channel value, Indicates pixels in the overexposed area The A chroma channel values ​​after filling Indicates pixels in the overexposed area The B chroma channel value after filling; Furthermore, to eliminate the brightness abrupt change between the overexposed area and the surrounding area, a smoothing filter is performed on the filled LAB channel, expressed by the formula: ; ; ; In the formula, This indicates the initial restoration of facial image pixels. The brightness channel value, This indicates the initial restoration of facial image pixels. The A chromaticity channel value, This indicates the initial restoration of facial image pixels. The B chromaticity channel value, This represents the Gaussian or bilateral filtering operator; S301, see also Figure 3 After completing the overexposure repair, the highlight and near-highlight areas are divided, specifically: Within the face area, preliminary restoration of image pixels is performed. Brightness channel Statistical analysis was performed, and a brightness histogram was constructed, expressed by the formula: ; In the formula, Represents the brightness histogram. Indicates an indicator function, Indicates brightness level; Based on the statistical analysis results of the brightness histogram, the threshold is determined by taking the corresponding percentiles, expressed by the formula: ; ; In the formula, Indicates the highlight threshold. Indicates the near-highlight threshold. The first digit representing the brightness distribution Percentile function The first digit representing the brightness distribution Percentile function; where the relationship between the highlight threshold and the near-highlight threshold satisfies ; For any satisfying pixels Define the highlight region mask and the near-highlight region mask, respectively, expressed by the formulas as follows: ; ; In the formula, This represents the highlight area mask. Indicates the mask for the near-highlight region; It should be noted that, Represents pixels This area belongs to the highlight region, which serves as the sole area for subsequent dynamic adjustments. Represents pixels It belongs to the near-highlight area. The near-highlight area has high brightness but still has image texture information. It does not directly participate in the subsequent brightness suppression operation, but is used as a reference area.

[0030] Furthermore, within the near-highlight region, the mean values ​​of neighboring near-highlight region pixels in the L, A, and B channels are calculated respectively. These mean values ​​are used as the convergence target for dynamic adjustment, expressed by the formula: ; ; ; In the formula, Represents pixels in the near-highlight region The average value of the brightness channel, Represents pixels in the near-highlight region The mean value of the A chroma channel, Represents pixels in the near-highlight region The mean value of the B chroma channel, This indicates the number of pixels in the near-highlight region.

[0031] S302, For any pixel within a highlight region Its brightness value is defined by the formula: ; In the formula, Represents pixels within the highlight area The brightness value; At the same time, define the dynamic adjustment coefficient. This can be expressed as a formula: ; In the formula, Indicates the dynamic adjustment coefficient. Indicates the slope adjustment factor; Among them, the slope adjustment factor This is a configurable constant used to adjust the dynamic adjustment coefficient. The sensitivity to changes in brightness allows the intensity adjustment to adapt to the overexposure of pixels.

[0032] Furthermore, the luminance channel and A and B chroma channels of the highlight pixel region are simultaneously compressed towards their corresponding near-highlight reference values. The degree of compression is dynamically adjusted by a coefficient. Control, expressed as a formula: ; ; ; In the formula, This indicates the initial restoration of facial image pixels. Compressed luminance channel values, This indicates the initial restoration of facial image pixels. Compressed A chroma channel values, This indicates the initial restoration of facial image pixels. Compressed B chroma channel values; Furthermore, based on the three channels of the compressed, preliminarily repaired face image, a complete channel update rule is obtained, expressed as a formula: ; ; ; In the formula, This indicates the initial restoration of facial image pixels. Dynamically adaptive adjustment of the brightness channel value. This indicates the initial restoration of facial image pixels. The dynamically adaptively adjusted A chromaticity channel value. This indicates the initial restoration of facial image pixels. The dynamically adaptively adjusted B chroma channel value.

[0033] S400, see also Figure 4 The three channels of the LAB model of the initially restored face image after dynamic adaptive adjustment were recombined to restore the pixel count. The complete color description in the LAB color space is expressed by the formula: ; In the formula, This represents the recombined LAB pixel vector; Based on the recombined LAB pixel vectors, the LAB color space is mapped to the RGB color space using a preset color space conversion tool, expressed by the formula: ; In the formula, This represents the recombined LAB pixel vector. Tools for color space conversion; Furthermore, the final processed image is composed of the output RGB values ​​of all pixels, expressed by the formula: ; In the formula, This represents the image after highlight removal.

[0034] Example 2: This embodiment proposes a face image highlight removal system based on region hierarchical processing, including the following modules: Target region determination module: acquires the face image to be processed, generates a face target region mask; and determines the face target region in the face image based on the face target region mask as a constraint. Color conversion module: Converts image data within the target area of ​​the face from RGB color space to LAB color space, and separates the luminance channel and A and B chrominance channels; Overexposure repair and highlight adjustment module: Based on preset overexposure thresholds and near-overexposure thresholds, the target area of ​​the face is divided into overexposed areas and near-overexposed areas; the statistical feature values ​​of the near-overexposed areas in the luminance channel and A and B chroma channels are calculated, and the pixel values ​​in the overexposed areas are filled with the statistical feature values ​​and filtered to obtain a preliminary face repair image; according to the distribution characteristics of the luminance channel in the preliminary face repair image, a highlight threshold and a near-highlight threshold are defined to determine the highlight areas; a dynamic adjustment coefficient is calculated, and the values ​​of each pixel in the highlight areas in the luminance channel and A and B chroma channels are updated using the dynamic adjustment coefficient to obtain the final repair image in the LAB color space; Output module: Converts the final repaired image to RGB color space and outputs the de-highlighted image.

[0035] Example 3: This embodiment proposes an electronic device, including a memory, a processor, and a computer program stored in the memory and executable on the processor. When the processor executes the program, it implements the method described in any embodiment of the present invention.

[0036] Example 4: This embodiment proposes a computer-readable storage medium storing a computer program thereon, which, when executed by a processor, implements the method described in any embodiment of the present invention.

[0037] In this application embodiment, "at least one" refers to one or more, and "more than one" refers to two or more. "And / or" describes the relationship between related objects, indicating that three relationships can exist. For example, A and / or B can represent the existence of A alone, A and B simultaneously, or B alone. A and B can be singular or plural. The character " / " generally indicates that the preceding and following related objects are in an "or" relationship. "At least one of the following" and similar expressions refer to any combination of these items, including any combination of singular or plural items. For example, at least one of a, b, and c can represent: a, b, c, a and b, a and c, b and c, or a and b and c, where a, b, and c can be single or multiple.

[0038] Those skilled in the art will recognize that the units and algorithm steps described in the embodiments disclosed herein can be implemented using electronic hardware, computer software, or a combination of electronic hardware and software. Whether these functions are implemented in hardware or software depends on the specific application and design constraints of the technical solution. Those skilled in the art can use different methods to implement the described functions for each specific application, but such implementation should not be considered beyond the scope of this application.

[0039] Those skilled in the art will understand that, for the sake of convenience and brevity, the specific working processes of the systems, devices, and units described above can be referred to the corresponding processes in the foregoing method embodiments, and will not be repeated here.

[0040] In the several embodiments provided in this application, any function, if implemented as a software functional unit and sold or used as an independent product, can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of this application, essentially, or the part that contributes to the prior art, or a part of the technical solution, can be embodied in the form of a software product. This computer software product is stored in a storage medium and includes several instructions to cause a computer device (which may be a personal computer, server, or network device, etc.) to execute all or part of the steps of the methods described in the various embodiments of this application. The aforementioned storage medium includes various media capable of storing program code, such as USB flash drives, portable hard drives, read-only memory (ROM), random access memory (RAM), magnetic disks, or optical disks.

[0041] The above description is merely an embodiment of the present invention and does not limit the patent scope of the present invention. Any equivalent structural or procedural transformations made based on the content of the present invention's specification and drawings, or direct or indirect applications in other related technical fields, are similarly included within the patent protection scope of the present invention.

Claims

1. A method for highlight removal in face images based on region-level hierarchical processing, characterized in that, Includes the following steps: Obtain the face image to be processed and generate a face target region mask; The face target region in the face image is determined by using the face target region mask as a constraint; The image data within the target area of ​​the face is converted from the RGB color space to the LAB color space, and the luminance channel and A and B chrominance channels are separated. Based on preset overexposure thresholds and near overexposure thresholds, the facial target area is divided into overexposure areas and near overexposure areas. Calculate the statistical feature values ​​of the near-overexposed area in the luminance channel and A and B chroma channels, use the statistical feature values ​​to fill the pixel values ​​in the overexposed area, and perform filtering to obtain the preliminary face restoration image; Based on the distribution characteristics of the brightness channels in the preliminary face restoration image, a highlight threshold and a near-highlight threshold are defined to determine the highlight region; Calculate the dynamic adjustment coefficients and use them to update the values ​​of each pixel in the highlight area in the luminance channel and A and B chroma channels to obtain the final restored image in the LAB color space. The final repaired image is converted to the RGB color space, and the resulting image with de-highlighting is output.

2. The method for removing highlights from face images based on region-level hierarchical processing according to claim 1, characterized in that, The method divides the facial target region into overexposed regions and near-overexposed regions based on preset overexposure thresholds and near-overexposure thresholds, specifically as follows: Set two brightness channel thresholds, including an overexposure threshold. and near overexposure threshold The relationship between the overexposure threshold and the near-overexposure threshold satisfies the following condition: ; Within the target facial region, based on overexposure and near-overexposure thresholds, overexposure region masks and near-overexposure region masks are defined, expressed by the following formula: ; ; In the formula, Indicates the mask for overexposed areas. Indicates the mask for near-overexposed areas. Indicates the overexposure threshold. Indicates the near overexposure threshold. Represents the pixels within the target area of ​​the face. The brightness channel value; The overexposed area and the near-overexposed area are determined by using the overexposed area mask and the near-overexposed area mask as constraints.

3. The method for removing highlights from face images based on region-level hierarchical processing according to claim 1, characterized in that, The statistical characteristic value is the arithmetic mean or median.

4. The method for removing highlights from face images based on region-level hierarchical processing according to claim 3, characterized in that, The method uses the arithmetic mean as a statistical feature value to fill the pixel values ​​in the overexposed area and performs filtering to obtain a preliminary face restoration image, specifically: Within the near-overexposed region, the mean values ​​of the pixels in the near-overexposed region are calculated in the luminance channel and the A and B chrominance channels, respectively, expressed by the formula: ; ; ; In the formula, Indicates pixels in the near-overexposed area The average value of the brightness channel, Indicates pixels in the near-overexposed area The mean value of the A chroma channel, Indicates pixels in the near-overexposed area The mean value of the B chroma channel, This indicates the number of pixels in the near-overexposed area. Represents the pixels within the target area of ​​the face. The brightness channel value, Represents the pixels within the target area of ​​the face. The A chroma channel value, Represents the pixels within the target area of ​​the face. The B chromaticity channel, Indicates the mask for near-overexposed areas; The average value of the pixels in the nearly overexposed area across all channels is used to fill each pixel in the overexposed area, expressed by the formula: ; ; ; In the formula, Indicates pixels in the overexposed area The filled luminance channel value, Indicates pixels in the overexposed area The A chroma channel values ​​after filling Indicates pixels in the overexposed area The filled B chroma channel value Indicates the mask for overexposed areas; After filling the overexposed areas with pixels, smoothing filters are applied to each channel value to obtain a preliminary face restoration image, expressed by the formula: ; ; ; In the formula, This indicates the initial restoration of facial image pixels. The brightness channel value, This indicates the initial restoration of facial image pixels. The A chromaticity channel value, This indicates the initial restoration of facial image pixels. The B chromaticity channel value, This indicates a Gaussian filter or a bilateral filter operator.

5. The method for removing highlights from face images based on region-level hierarchical processing according to claim 1, characterized in that, The method defines a highlight threshold and a near-highlight threshold based on the distribution characteristics of the brightness channels in the preliminary face restoration image, and determines the highlight region, specifically as follows: Preliminary restoration of facial image pixels Luminance channel value Statistical analysis was performed, and a brightness histogram was constructed, expressed by the formula: ; In the formula, Represents the brightness histogram. Indicates an indicator function, Indicates brightness level, This indicates the initial restoration of facial image pixels. The brightness channel value, Represents the mask of the target facial region; Based on the statistical analysis results of the brightness histogram, the threshold is determined by taking the corresponding percentiles, expressed by the formula: ; ; In the formula, Indicates the highlight threshold. Indicates the near-highlight threshold. The first digit representing the brightness distribution Percentile function The first digit representing the brightness distribution Percentile function; where the relationship between the highlight threshold and the near-highlight threshold satisfies ; Within the target facial region, a highlight region mask and a near-highlight region mask are defined based on the highlight threshold and the near-highlight threshold, expressed by the following formula: ; ; In the formula, This represents the highlight area mask. Indicates the mask for the near-highlight region; The highlight region and the near-highlight region are determined by using the highlight region mask and the near-highlight region mask as constraints.

6. The method for removing highlights from face images based on region-level hierarchical processing according to claim 1, characterized in that, The dynamic adjustment coefficient is expressed by the formula: ; In the formula, Indicates the dynamic adjustment coefficient. This represents the slope adjustment factor. Represents pixels in the near-highlight region The average value of the brightness channel, Represents pixels within the highlight area The brightness value; Among them, the slope adjustment factor This is a configurable constant used to adjust the dynamic adjustment coefficient. The sensitivity to changes in brightness allows the intensity adjustment to adapt to the overexposure of pixels.

7. The method for removing highlights from face images based on region-level hierarchical processing according to claim 6, characterized in that, The method uses dynamic adjustment coefficients to update the values ​​of each pixel in the highlight region in the luminance channel and the A and B chrominance channels, specifically as follows: The luminance channel and A and B chroma channels in the highlight area are simultaneously compressed towards the corresponding near-highlight reference values. The degree of compression is dynamically adjusted by a coefficient. Control, expressed as a formula: ; ; ; In the formula, This indicates the initial restoration of facial image pixels. Compressed luminance channel values, This indicates the initial restoration of facial image pixels. Compressed A chroma channel values, This indicates the initial restoration of facial image pixels. Compressed B chroma channel values, Represents pixels in the near-highlight region The mean value of the A chroma channel, Represents pixels in the near-highlight region The mean value of the B chroma channel, This indicates the initial restoration of facial image pixels. The A chromaticity channel value, This indicates the initial restoration of facial image pixels. The B chromaticity channel value; Based on the luminance and A and B chroma channel values ​​of the preliminarily restored face image after compression, a complete channel value update rule is constructed, expressed by the formula: ; ; ; In the formula, This indicates the initial restoration of facial image pixels. Dynamically adaptive adjustment of the brightness channel value. This indicates the initial restoration of facial image pixels. The dynamically adaptively adjusted A chromaticity channel value This indicates the initial restoration of facial image pixels. The dynamically adaptively adjusted B chromaticity channel value This represents the mask for the highlight area.

8. A system for removing highlights from face images based on region-level hierarchical processing, characterized in that, Includes the following modules: Target region determination module: acquires the face image to be processed and generates a face target region mask; The face target region in the face image is determined by using the face target region mask as a constraint; Color conversion module: Converts image data within the target area of ​​the face from RGB color space to LAB color space, and separates the luminance channel and A and B chrominance channels; Overexposure repair and highlight adjustment module: Based on preset overexposure thresholds and near overexposure thresholds, the facial target area is divided into overexposure areas and near overexposure areas; Calculate the statistical feature values ​​of the near-overexposed area in the luminance channel and A and B chroma channels, use the statistical feature values ​​to fill the pixel values ​​in the overexposed area, and perform filtering to obtain the preliminary face restoration image; Based on the distribution characteristics of the brightness channels in the preliminary face restoration image, a highlight threshold and a near-highlight threshold are defined to determine the highlight region; Calculate the dynamic adjustment coefficients and use them to update the values ​​of each pixel in the highlight area in the luminance channel and A and B chroma channels to obtain the final restored image in the LAB color space. Output module: Converts the final repaired image to RGB color space and outputs the de-highlighted image.

9. An electronic device comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, characterized in that, When the processor executes the program, it implements the method as described in any one of claims 1 to 7.

10. A computer-readable storage medium having a computer program stored thereon, characterized in that, When the program is executed by the processor, it implements the method as described in any one of claims 1 to 7.