Face image color spectrum correction method and system based on real-time ambient light monitoring

By using real-time ambient light monitoring and facial skin segmentation, combined with the spectral absorption characteristics of melanin and hemoglobin, and calculating the incident angle for cosine correction, the problem of biological pigment differences and three-dimensional geometric relationships in facial image color correction is solved, achieving high-precision color correction results.

CN122156029APending Publication Date: 2026-06-05LUSTER LIGHTWAVE CO LTD +1

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
LUSTER LIGHTWAVE CO LTD
Filing Date
2026-05-06
Publication Date
2026-06-05

AI Technical Summary

Technical Problem

Existing facial image color correction methods cannot adapt to the differences in biopigmentation in different areas of facial skin, and do not fully consider the relationship between ambient light and facial three-dimensional geometry, resulting in insufficient color correction accuracy.

Method used

By acquiring multi-channel irradiance data through real-time ambient light monitoring, facial skin zones are divided. Combining the spectral absorption characteristics of melanin and hemoglobin, the incident angle is calculated and cosine correction is performed to conduct refined color compensation. Spatial transition weights are constructed to achieve regional color correction.

Benefits of technology

It improves the accuracy and reliability of color reproduction in facial images, eliminates the interference of ambient light conditions on color, and ensures the visual naturalness of the corrected images.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN122156029A_ABST
    Figure CN122156029A_ABST
Patent Text Reader

Abstract

The application provides a face image chroma correction method and system based on real-time ambient light monitoring, relates to the technical field of face image processing, and comprises the following steps: acquiring multi-channel irradiance data of an ambient light monitoring device and an initial face image of an image acquisition device; dividing a face region into multiple skin sub-regions according to a face geometric relationship, and reading chroma values of pixels in each sub-region; selecting corresponding channel irradiance from the irradiance data according to the spectral absorption characteristics of melanin and hemoglobin; calculating the incidence angle of the ambient light incidence direction relative to the normal of each sub-region surface by using the relative spatial position parameters, and performing cosine correction to obtain corrected irradiance; determining chroma compensation values according to the distribution characteristics of melanin and hemoglobin in each sub-region, combining the corrected irradiance and the chroma values, adjusting the pixel chroma values, and outputting a corrected image, so that the interference of ambient light on the color of the face image can be effectively eliminated, and the accuracy of face image color restoration can be improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This application relates to the field of facial image processing technology, and in particular to a method and system for facial image chromatographic correction based on real-time ambient light monitoring. Background Technology

[0002] The color accuracy of facial images is crucial in numerous fields, including medical dermatology diagnosis, cosmetic skincare assessment, facial recognition, and liveness detection. Facial skin color is influenced by both the skin's biological characteristics and external ambient lighting conditions. Melanin and hemoglobin are the two main pigment components determining skin color; melanin primarily affects the skin's lightness and darkness, while hemoglobin mainly influences the skin's red hue. Under standard white light, image acquisition devices can accurately capture the true color of the skin. However, in real-world applications, the spectral composition of ambient light often differs significantly from that of standard white light. For example, warm-toned indoor lighting lacks short-wavelength blue light, while cool-toned fluorescent lamps have a stronger short-wavelength component and a weaker red light component. This spectral difference causes the facial color recorded by the image acquisition device to deviate from the true color of the skin.

[0003] Existing image color correction techniques mainly include white balance-based global correction methods and color mapping methods based on color charts. White balance-based methods typically assume the presence of a grayscale reference in the scene or use a gray world assumption to uniformly compensate the color temperature of the entire image. This global correction strategy struggles to adapt to the differences in biological pigment distribution across different areas of facial skin. For example, the lips have a higher hemoglobin content, while the forehead has a relatively uniform melanin distribution, resulting in color deviations in localized areas of the corrected facial image. While color chart-based methods can establish relatively accurate color mapping relationships, they require placing a standard color chart in the frame during each shot, making them inconvenient and unsuitable for most everyday scenarios. Furthermore, neither of these methods adequately considers the impact of the geometric relationship between the ambient light incident direction and the three-dimensional curved surface of the face on the actual amount of light received in each area. The protrusions and depressions of the face cause differences in the intensity of light received in different areas, a factor neglected in existing methods, further reducing the accuracy of color correction.

[0004] Therefore, there is an urgent need to propose a facial image color calibration method that can sense the spectral characteristics of ambient light in real time and combine the distribution of facial skin biopigments with the three-dimensional geometric structure of the face for refined color compensation, so as to improve the accuracy and reliability of facial image color restoration. Summary of the Invention

[0005] The purpose of this application is to provide a facial image color calibration method and system based on real-time ambient light monitoring, in order to solve the problems that existing facial image color calibration methods cannot adapt to the differences in biopigmentation in different areas of facial skin and lack consideration of the relationship between ambient light and facial three-dimensional geometry.

[0006] To address the aforementioned technical problems, in a first aspect, this application provides a facial image chromatographic correction method based on real-time ambient light monitoring, comprising: Acquire ambient irradiance data containing multiple channels output by the ambient light monitoring device, and an initial image containing the facial region output by the image acquisition device; In the initial image, the facial region is divided into multiple facial skin zones based on facial geometry. Read the chromaticity value of each pixel in the facial skin region in the preset chromaticity space; Based on the spectral absorption characteristics of melanin and hemoglobin in facial skin, channel irradiance corresponding to the spectral absorption bands of melanin and hemoglobin is selected from the environmental irradiance data. The relative spatial position parameters between the ambient light monitoring device and the image acquisition device are obtained, and the incident angle of the ambient light incident direction relative to the surface normal of each facial skin partition is calculated based on the relative spatial position parameters. The channel irradiance is cosine corrected using the incident angle to obtain the corrected irradiance for each facial skin zone. Based on the distribution characteristics of melanin and hemoglobin content in each facial skin region, and in combination with the corrected irradiance and the chromaticity value, a chromaticity compensation value is determined for each facial skin region. Based on the chromaticity compensation value, the chromaticity values ​​of the pixels within the corresponding facial skin region are adjusted to output a corrected image.

[0007] Optionally, adjusting the chromaticity values ​​of pixels within the corresponding facial skin region based on the chromaticity compensation value to output a corrected image includes: Obtain the Euclidean distance value between the location of a single pixel within each facial skin partition and the geometric center of the facial skin partition; Spatial transition weights are constructed based on the Euclidean distance values. For pixels with larger Euclidean distance values, the corresponding spatial transition weights are smaller. Multiply the chromaticity compensation value corresponding to the facial skin partition by the spatial transition weight corresponding to the pixel to obtain the actual correction value of the pixel; The original chromaticity value of the pixel is added to the actual correction value to obtain the corrected chromaticity value; The corrected chromaticity values ​​are converted from the numerical representation format of the preset chromaticity space back to the image display format of the initial image, and all pixels containing the corrected chromaticity values ​​are stitched together to reconstruct a corrected image for output.

[0008] Optionally, the step of acquiring the relative spatial position parameters between the ambient light monitoring device and the image acquisition device, and calculating the incident angle of the ambient light incident direction relative to the surface normal of each facial skin partition based on the relative spatial position parameters, includes: Key pixels of facial contour are extracted from the initial image. Based on the correspondence between the two-dimensional plane coordinates of the key pixels of facial contour and the preset depth information, a three-dimensional spatial structure of the face containing three-dimensional coordinates is constructed. Based on the facial three-dimensional spatial structure, calculate the outward direction vector at the center coordinate point of the surface of each facial skin partition, and use it as the surface normal vector of the facial skin partition. Using the spatial translation and spatial rotation values ​​contained in the relative spatial position parameters, the three-dimensional spatial coordinates of the ambient light monitoring device are transformed to the three-dimensional coordinate system of the image acquisition device to obtain the ambient light reference coordinates; In the three-dimensional coordinate system, the ambient light reference coordinates are connected to the center coordinates of each facial skin zone to form an ambient light incident direction vector pointing from the ambient light reference coordinates to the facial skin zone; Calculate the spatial angle between the ambient light incident direction vector and the surface normal vector of the corresponding facial skin region, and use the spatial angle as the incident angle.

[0009] Optionally, the step of using the incident angle to perform cosine correction on the channel irradiance to obtain the corrected irradiance corresponding to each facial skin region includes: Calculate the cosine value of the incident angle corresponding to each facial skin region; The surface curvature undulation index of each facial skin partition in the three-dimensional spatial structure of the face is obtained, and the surface curvature undulation index is used to characterize the degree of curvature of the physical surface of the facial skin partition. Combining the preset light spatial diffuse reflection attenuation rules, an exponential attenuation factor is constructed using the surface curvature undulation index. The exponential attenuation factor is multiplied by the cosine value to obtain the light attenuation coefficient specific to each facial skin zone. The selected melanin-corresponding channel irradiance and hemoglobin-corresponding channel irradiance are multiplied by the light attenuation coefficient specific to each facial skin region to calculate the melanin-corrected irradiance and hemoglobin-corrected irradiance for each facial skin region. The melanin-corrected irradiance and the hemoglobin-corrected irradiance of the facial skin region are combined to form the corrected irradiance corresponding to the facial skin region.

[0010] Optionally, determining a chromaticity compensation value for each facial skin zone based on the distribution characteristics of melanin and hemoglobin content within each facial skin zone, combined with the corrected irradiance and the chromaticity value, includes: Retrieve the pre-defined baseline melanin concentration percentage and baseline hemoglobin concentration percentage for each of the aforementioned facial skin zones; The chromaticity value of each pixel in each facial skin region is decomposed into a luminance component representing the skin's base color and a red-blue chromaticity component representing the skin's color cast. Calculate the first difference ratio between the melanin-corrected irradiance and the reference irradiance of the corresponding band under a standard white light source, and the second difference ratio between the hemoglobin-corrected irradiance and the reference irradiance of the corresponding band under a standard white light source. The brightness component is multiplied by the product of the melanin base concentration ratio and the first correction coefficient to calculate the brightness shift caused by the lack of melanin absorption band in the current ambient light. The correction coefficient is equal to 1 minus the first difference ratio. The red and blue color components are multiplied by the product of the basic concentration ratio of hemoglobin and the second correction coefficient to calculate the color shift caused by the absence of the current ambient light in the hemoglobin absorption band. The second correction coefficient is equal to 1 minus the second difference ratio. The brightness offset and the color offset are combined to form the chromaticity compensation value corresponding to the facial skin zone.

[0011] Optionally, the step of selecting channel irradiance corresponding to the spectral absorption bands of melanin and hemoglobin respectively from the environmental irradiance data based on the spectral absorption characteristics of melanin and hemoglobin includes: Obtain the light absorption distribution curves of melanin and hemoglobin within a continuous wavelength range; In the melanin light absorption distribution curve and the hemoglobin light absorption distribution curve, wavelength ranges with absorbance values ​​greater than a preset absorption threshold are extracted respectively as the high absorption wavelength ranges of melanin and hemoglobin. Obtain the center photosensitive wavelength and photosensitive span range corresponding to each of the multiple channels in the environmental irradiance data; Determine whether the central photosensitive wavelength and the range of photosensitive span of each channel fall completely within the high absorption wavelength range of melanin or the high absorption wavelength range of hemoglobin. The irradiance recorded by the channel whose coverage range falls within the high absorption wavelength range of melanin is extracted as the channel irradiance corresponding to melanin, and the irradiance recorded by the channel whose coverage range falls within the high absorption wavelength range of hemoglobin is extracted as the channel irradiance corresponding to hemoglobin.

[0012] Optionally, the plurality of facial skin regions include: lip region, periorbital region, cheek region, and forehead region.

[0013] Secondly, this application provides a facial image chromatographic correction system based on real-time ambient light monitoring, comprising: The acquisition module is used to acquire ambient irradiance data containing multiple channels output by the ambient light monitoring device, and an initial image containing the facial region output by the image acquisition device; A segmentation module is used to divide the facial region into multiple facial skin partitions in the initial image based on facial geometric relationships. The reading module is used to read the chromaticity value of each pixel in the facial skin partition in a preset chromaticity space; The selection module is used to select the channel irradiance corresponding to the spectral absorption bands of melanin and hemoglobin respectively from the environmental irradiance data based on the spectral absorption characteristics of melanin and hemoglobin in facial skin. The calculation module is used to obtain the relative spatial position parameters between the ambient light monitoring device and the image acquisition device, and calculate the incident angle of the ambient light incident direction relative to the surface normal of each facial skin partition based on the relative spatial position parameters. The correction module is used to perform cosine correction on the channel irradiance using the incident angle to obtain the corrected irradiance corresponding to each facial skin zone. The determination module is used to determine a chromaticity compensation value for each facial skin zone based on the distribution characteristics of melanin and hemoglobin content within each facial skin zone, combined with the corrected irradiance and the chromaticity value. The output module is used to adjust the chromaticity values ​​of pixels within the corresponding facial skin region according to the chromaticity compensation value, so as to output a corrected image.

[0014] Thirdly, this application provides an electronic device, comprising: Memory, used to store computer programs; A processor, configured to execute the computer program to implement the steps of the facial image chromatographic correction method based on real-time ambient light monitoring as described in the first aspect above.

[0015] Fourthly, this application provides a computer-readable storage medium storing a computer program that, when executed by a processor, can implement the steps of the facial image chromatographic correction method based on real-time ambient light monitoring as described in the first aspect above.

[0016] As can be seen from the above technical solutions, the present invention has the following advantages: This invention acquires multi-channel ambient irradiance data in real time through an ambient light monitoring device, accurately sensing the spectral composition characteristics of the current ambient light. This provides a real-time, objective lighting reference for subsequent color correction, avoiding the uncertainty of traditional white balance methods that rely on scene assumptions. Simultaneously, this invention divides the facial region into multiple skin zones and performs chromaticity compensation calculations based on the distribution characteristics of melanin and hemoglobin within each zone, achieving refined regional-level color correction and effectively solving the problem that global correction strategies cannot adapt to the differences in biopigmentation across different facial regions. Furthermore, this invention constructs a three-dimensional facial spatial structure and calculates the incident angle of ambient light relative to the surface normal of each zone, applying cosine correction to the channel irradiance. This fully considers the influence of facial surface geometry on the actual amount of light received in each region, further improving the accuracy of color correction. Finally, a spatial transition weight mechanism achieves a smooth transition between adjacent zones, avoiding color abrupt changes at zone boundaries and ensuring the visual naturalness of the corrected image. In summary, this invention effectively eliminates the interference of different ambient light conditions on facial image colors, significantly improving the accuracy and reliability of facial image color reproduction. Attached Figure Description

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

[0018] Figure 1 A schematic flowchart of a facial image chromatographic correction method based on real-time ambient light monitoring provided in this application embodiment; Figure 2 A schematic diagram of facial skin partitioning for a facial image chromatographic correction method based on real-time ambient light monitoring, provided in an embodiment of this application; Figure 3 A schematic diagram of the incident angle of ambient light for a facial image chromatographic correction method based on real-time ambient light monitoring provided in an embodiment of this application; Figure 4A schematic diagram illustrating the calculation of the three-dimensional spatial structure of the face and the incident angle for another facial image chromatographic correction method based on real-time ambient light monitoring provided in this application embodiment; Figure 5 A flowchart illustrating the calculation of chromaticity compensation values ​​and the output of corrected images for another facial image chromaticity correction method based on real-time ambient light monitoring, provided in an embodiment of this application. Figure 6 This is a schematic diagram of a facial image chromatography correction system based on real-time ambient light monitoring, provided as an embodiment of this application. Detailed Implementation

[0019] This invention provides a facial image color calibration method and system based on real-time ambient light monitoring. It solves the technical problems of existing facial image color calibration methods, where global calibration strategies cannot adapt to differences in biopigmentation across different areas of facial skin and lack consideration of the relationship between ambient light and facial three-dimensional geometry. This invention can be applied to applications requiring high-precision facial color information, such as medical dermatology diagnosis, cosmetic skincare evaluation, and facial recognition and liveness detection.

[0020] To make the objectives, technical solutions, and advantages of the embodiments of the present invention clearer, 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, 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] The core of this application is to provide a facial image chromatographic correction method based on real-time ambient light monitoring, and a flowchart of one specific implementation is shown below. Figure 1 As shown, the method includes: S101. Acquire ambient irradiance data containing multiple channels output by the ambient light monitoring device, and an initial image containing the facial region output by the image acquisition device.

[0022] Among them, ambient light monitoring equipment is a sensor device with multi-channel spectral sensing capability, which can measure the light radiation intensity of different wavelengths in the current environment in real time. Each channel corresponds to a specific central photosensitive wavelength and photosensitive span. The output ambient irradiance data is the light radiation irradiance value of each channel within its corresponding wavelength range, and the unit is usually 1600 ppm. Ambient light monitoring equipment can be a standalone spectroradiometer or a multi-channel light sensor module integrated into a smartphone or professional image acquisition device.

[0023] The image acquisition device is a camera with visible light imaging capabilities, used to capture initial images containing the facial area. These initial images are raw image data that have not yet undergone spectral correction; their color information is affected by the current ambient light spectral composition and may deviate from the true color of facial skin under standard white light.

[0024] It should be noted that the relative spatial positions of the ambient light monitoring device and the image acquisition device are known or calibrable, meaning that a definite relative spatial position parameter relationship exists between them. In one embodiment, the ambient light monitoring device and the image acquisition device can be integrated into the same terminal device, in which case their relative spatial position parameters are calibrated at the factory. In another embodiment, they are independent devices, and their relative spatial position relationship is determined through pre-calibration or real-time positioning.

[0025] S102. In the initial image, the facial region is divided into multiple facial skin zones according to facial geometry.

[0026] Among them, facial geometric relationships refer to the spatial positions and topological connections between facial feature points identified based on facial keypoint detection technology. Facial keypoint detection algorithms, such as deep learning-based facial keypoint detection networks, locate the coordinates of key pixels in areas such as eyebrows, eyes, nose, lips, and jawline in the initial image, and then delineate different facial skin zones based on the distribution of these key points.

[0027] In a preferred embodiment, the plurality of facial skin zones include: a lip zone, an periorbital zone, a cheek zone, and a forehead zone. The lip zone is defined by key points of the lip contour; this area has a high hemoglobin content and a pronounced red hue. The periorbital zone is defined by key points of the eyes and surrounding area; this area has thinner skin, a denser blood vessel distribution, and its color is significantly influenced by hemoglobin. The cheek zone is located on both sides of the face, has a relatively large area, and its color is determined by the combined effect of melanin and hemoglobin. The forehead zone is located on the upper part of the face; the skin is relatively flat, and melanin is distributed more evenly.

[0028] Figure 2 A schematic diagram of facial skin partitioning is shown, indicating the location and extent of the lip, periorbital, cheek, and forehead partitions. The purpose of partitioning the facial skin is to enable differentiated color compensation based on the unique pigment distribution characteristics of each partition, achieving refined, region-level color correction.

[0029] S103. Read the chromaticity value of each pixel in the facial skin partition in the preset chromaticity space.

[0030] The preset color space is a color representation space adapted to the characteristics of human visual perception, such as the CIE Lab color space or the CIE Luv color space. In the CIE Lab color space, the L channel represents luminance, the a channel represents the red-green color opposite dimension, and the b channel represents the yellow-blue color opposite dimension. After converting the initial image from its original color format to the preset color space, the chromaticity values ​​of each pixel in each facial skin region are read, providing the basic data for subsequent chromaticity compensation calculations.

[0031] It should be noted that the statistical characteristics of the chromaticity values ​​of all pixels within the same facial skin region will be used as the input parameter for the chromaticity compensation calculation of that region. In one implementation, the average chromaticity values ​​of all pixels within each facial skin region can be taken as the representative chromaticity value of that region for subsequent calculations.

[0032] S104. Based on the spectral absorption characteristics of melanin and hemoglobin in facial skin, select the channel irradiance corresponding to the spectral absorption band of melanin and the spectral absorption band of hemoglobin respectively from the environmental irradiance data.

[0033] It's important to note that the color of facial skin is essentially determined by the selective absorption of light of different wavelengths by the skin tissue. Melanin and hemoglobin are the two main light-absorbing pigments in facial skin, each exhibiting significant absorption characteristics in different spectral bands. Melanin's spectral absorption characteristics show strong absorption in the short-wavelength range from ultraviolet to visible light, with its absorbance decreasing monotonically with increasing wavelength, and the strongest absorption occurring in the 300nm to 500nm range. Hemoglobin's spectral absorption characteristics exhibit a distinct bimodal structure. Oxyhemoglobin has two significant absorption peaks around approximately 540nm and 576nm, corresponding to the Q-band electronic transition absorption characteristics of oxyhemoglobin; deoxyhemoglobin exhibits a single absorption peak around approximately 555nm. Variations in the irradiance of ambient light in these specific absorption bands directly affect the color of facial skin in images. Therefore, accurately selecting the ambient light channel irradiance corresponding to the absorption bands of the two pigments mentioned above is a prerequisite for subsequent color compensation calculations.

[0034] Furthermore, S104 specifically includes: S41. Obtain the light absorption distribution curves of melanin and hemoglobin within a continuous wavelength range.

[0035] The melanin light absorption distribution curve is a continuous function curve plotted with wavelength on the horizontal axis and the molar absorptivity or relative absorbance of melanin on the vertical axis. This curve reflects the variation of melanin's absorption intensity of different wavelengths of light with wavelength. Similarly, the hemoglobin light absorption distribution curve reflects the variation of hemoglobin's absorption intensity of different wavelengths of light with wavelength. Both of these light absorption distribution curves can be obtained from existing experimental measurement databases in the field of spectroscopy, such as the tissue optical parameter database published by the Oregon Medical Laser Center, or they can be obtained through prior experimental measurements and stored in the system.

[0036] In one implementation, the wavelength coverage of the two curves is from 300nm to 800nm, and the wavelength resolution is not less than 5nm, to ensure the accuracy of subsequent band matching.

[0037] S42. From the light absorption distribution curve of melanin and the light absorption distribution curve of hemoglobin, extract the wavelength ranges with absorbance values ​​greater than the preset absorption threshold, respectively, as the high absorption wavelength ranges of melanin and hemoglobin.

[0038] The preset absorption threshold is a pre-set absorbance threshold value used to distinguish between high absorption regions and low absorption regions.

[0039] For melanin, the preset absorption threshold can be set to 1.5 times its absorbance value at 550 nm; wavelengths above this threshold are considered the high absorption wavelength range for melanin. For hemoglobin, the preset absorption threshold can be set to twice its average absorbance value in the flat region between 600 nm and 700 nm; wavelengths above this threshold are considered the high absorption wavelength range for hemoglobin. This threshold screening mechanism automatically identifies the wavelength ranges where the absorption of the two pigments is most significant, eliminating interference from weak absorption bands in subsequent calculations.

[0040] In a typical scenario, after threshold screening, the high absorption wavelength range of melanin is 350nm to 480nm, and the high absorption wavelength range of hemoglobin is 520nm to 590nm.

[0041] S43. Obtain the center photosensitive wavelength and photosensitive span range corresponding to each of the multiple channels in the environmental irradiance data.

[0042] Each photosensitive channel of the ambient light monitoring device has specific spectral response characteristics. The central photosensitive wavelength is the wavelength value corresponding to the peak value of the spectral response function of that channel, and the photosensitive span is the wavelength range covered by the full width at half maximum (FWHM) of the spectral response function of that channel. The central photosensitive wavelength and the photosensitive span together determine the actual spectral range sensed by that channel.

[0043] For example, if a channel has a center photosensitive wavelength of 440nm and a photosensitive span of 20nm, then the actual wavelength range sensed by that channel is 430nm to 450nm. These channel parameters are already provided in the factory calibration data of the ambient light monitoring equipment and can be read directly.

[0044] S44. Determine whether the numerical range covered by the center photosensitive wavelength and photosensitive span of each channel completely falls within the high absorption wavelength range of the melanin or the high absorption wavelength range of the hemoglobin.

[0045] The specific execution method of the judgment process is as follows: For each channel, calculate the lower limit and upper limit of the photosensitive wavelength of the channel; if the lower limit of the photosensitive wavelength of the channel is not less than the lower boundary of the high absorption wavelength range of melanin, and the upper limit of the photosensitive wavelength of the channel is not greater than the upper boundary of the high absorption wavelength range of melanin, then the channel is determined to fall completely into the high absorption wavelength range of melanin; similarly, the same judgment is made for the high absorption wavelength range of hemoglobin.

[0046] The strict criteria of complete inclusion are used to ensure that the selected channel irradiance data can accurately represent the ambient light energy of the corresponding pigment's high absorption band, and to avoid interference from low absorption band energy introduced due to the channel's photosensitive range exceeding the high absorption range.

[0047] S45. Extract the irradiance recorded by the channel whose coverage range falls within the high absorption wavelength range of melanin as the channel irradiance corresponding to melanin, and extract the irradiance recorded by the channel whose coverage range falls within the high absorption wavelength range of hemoglobin as the channel irradiance corresponding to hemoglobin.

[0048] When multiple channels fall into the same high absorption wavelength range, the irradiance records of these channels are weighted and averaged to obtain the comprehensive channel irradiance corresponding to the pigment. The weight is proportional to the pigment absorbance at the center photosensitive wavelength of each channel, so that the stronger absorption bands have a larger contribution to the comprehensive irradiance, thereby more accurately reflecting the energy distribution of ambient light in the key absorption band of the pigment.

[0049] For example, suppose the ambient light monitoring device has 16 photosensitive channels covering a wavelength range of 350nm to 800nm, with each channel having a photosensitive span of 25nm. After setting a preset absorption threshold, the high absorption wavelength range of 350nm to 480nm is extracted from the melanin light absorption distribution curve, and the high absorption wavelength range of 520nm to 590nm is extracted from the hemoglobin light absorption distribution curve. Among the 16 channels, four channels with center photosensitive wavelengths of 380nm (photosensitive range 367.5nm to 392.5nm), 410nm (photosensitive range 397.5nm to 422.5nm), 440nm (photosensitive range 427.5nm to 452.5nm), and 470nm (photosensitive range 457.5nm to 482.5nm) completely fall within the 350nm to 480nm high absorption wavelength range of melanin. Their irradiance records are extracted as the channel irradiance corresponding to melanin, and the irradiance is calculated based on the center wavelength of each channel. The melanin comprehensive channel irradiance was obtained by weighting the absorbance of melanin at each center wavelength. The two channels with central photosensitive wavelengths of 540nm (photosensitive range 527.5nm to 552.5nm) and 560nm (photosensitive range 547.5nm to 572.5nm) fall completely within the high absorption wavelength range of hemoglobin from 520nm to 590nm. Their irradiance records were extracted as the channel irradiance corresponding to hemoglobin, and the hemoglobin comprehensive channel irradiance was obtained by weighting the absorbance of hemoglobin at the center wavelength of each channel.

[0050] This step uses a dual mechanism of threshold screening of light absorption distribution curves and strict matching of channel bands to automatically and accurately extract irradiance information closely related to the absorption characteristics of the two core pigments of facial skin from multi-channel environmental irradiance data. This provides high-quality input data for subsequent cosine correction and color compensation calculations, avoiding interference from irrelevant band irradiance.

[0051] S105. Obtain the relative spatial position parameters between the ambient light monitoring device and the image acquisition device, and calculate the incident angle of the ambient light incident direction relative to the surface normal of each facial skin partition based on the relative spatial position parameters.

[0052] It is important to note that the face is not a planar structure, but a three-dimensional surface with complex curved features. Different facial skin zones have different surface normal directions due to their varying spatial locations and orientations, resulting in significant differences in the effective light intensity received by each zone under the same ambient light source. Accurately calculating the angle between the incident direction of ambient light and the surface normal of each zone is the geometric basis for subsequent precise correction of the actual amount of light received by each zone. This step, by constructing the three-dimensional spatial structure of the face and performing coordinate system transformation, achieves the reasoning from two-dimensional image to three-dimensional geometry, providing precise angular parameters for cosine correction.

[0053] Furthermore, such as Figure 3 As shown, S105 specifically includes: S51. Extract key pixels of facial contour from the initial image, and construct a three-dimensional spatial structure of the face containing three-dimensional coordinates based on the correspondence between the two-dimensional planar coordinates of the key pixels of facial contour and the preset depth information.

[0054] Specifically, a facial keypoint detection algorithm is first used to locate 68 or more key facial pixels in the initial image. These keypoints cover areas such as eyebrows, eyes, nose, lips, and jawline contours. Each keypoint has two-dimensional pixel coordinates in the image coordinate system. A pre-defined depth information correspondence is established based on a three-dimensional deformable facial model, such as a 3DMM or FLAME model. These models use principal component analysis to statistically model large-scale three-dimensional facial scan data, establishing a regression mapping relationship between two-dimensional facial keypoint coordinates and three-dimensional facial shape parameters. The detected two-dimensional keypoint coordinates are input into this regression mapping model to obtain the three-dimensional spatial coordinates corresponding to each keypoint. Then, a three-dimensional mesh structure of the facial region, i.e., the three-dimensional spatial structure of the face, is constructed using triangular mesh interpolation. This three-dimensional mesh structure contains the x, y, and z three-dimensional coordinates of each point on the face, comprehensively describing the spatial morphology of the facial surface.

[0055] S52. Based on the three-dimensional spatial structure of the face, calculate the outward direction vector at the center coordinate point of the surface of each facial skin partition, and use it as the surface normal vector of the facial skin partition.

[0056] Specifically, for each facial skin region, the center coordinate point of the region's surface is first determined, which is the arithmetic mean of the coordinates of all 3D mesh vertices contained in the region. Then, triangular mesh faces within the neighborhood of the center coordinate point are extracted. The cross product of the two edge vectors of each face is used to obtain the normal vector of that face. Finally, the normal vectors of all neighboring face faces are weighted by their area and normalized to obtain the surface normal vector at the center coordinate point of the region's surface. This normal vector points outwards from the skin surface, reflecting the orientation characteristics of the region's surface in 3D space.

[0057] For example, the surface normal vector of the forehead region generally points forward and upward, the surface normal vector of the cheek region generally points to the side and front, and the surface normal vector of the lip region generally points directly forward or slightly downward.

[0058] S53. Using the spatial translation and spatial rotation values ​​contained in the relative spatial position parameters, the three-dimensional spatial coordinates of the ambient light monitoring device are transformed to the three-dimensional coordinate system of the image acquisition device to obtain the ambient light reference coordinates.

[0059] The relative spatial position parameters include rigid body transformation parameters with six degrees of freedom, among which the spatial translation values ​​include translation components along the x-axis, y-axis, and z-axis. , , The spatial rotation values ​​include rotation angles around the x-axis, y-axis, and z-axis. The coordinate transformation is achieved through a 4x4 homogeneous transformation matrix. After transforming the origin coordinates of the ambient light monitoring device in its own coordinate system through the rotation matrix R and the translation vector t, the three-dimensional spatial position of the device in the coordinate system of the image acquisition device is obtained, which is the ambient light reference coordinate.

[0060] In one implementation, when the ambient light monitoring device and the image acquisition device are integrated into the same terminal, the relative spatial position parameters are accurately measured and stored in the device firmware during the device's factory calibration stage using methods such as a checkerboard calibration board; when the two are independent devices, the relative spatial position parameters can be obtained in real time through visual calibration or inertial navigation positioning methods.

[0061] S54. In the three-dimensional coordinate system, connect the ambient light reference coordinates with the center coordinates of each facial skin partition surface to form an ambient light incident direction vector pointing from the ambient light reference coordinates to the facial skin partition.

[0062] Specifically, let the ambient light reference coordinates be... The surface center coordinates of the i-th facial skin region are Then the ambient light incident direction vector corresponding to this partition This vector is then normalized to a unit vector. The ambient light incident direction vector represents the direction in which ambient light propagates from the light source location to the surfaces of each facial region.

[0063] S55. Calculate the spatial angle between the ambient light incident direction vector and the surface normal vector of the corresponding facial skin region, and use the spatial angle as the incident angle.

[0064] The spatial angle is calculated using the dot product formula of two unit vectors: ,in Let be the surface normal vector of the i-th partition. The angle of incidence is denoted as .

[0065] The incident angle ranges from 0 to 90 degrees. When the incident angle is 0 degrees, it means that the light rays are incident perpendicularly to the skin surface along the normal direction, and the light intensity of this area is the greatest. When the incident angle is 90 degrees, it means that the light rays pass parallel to the skin surface, and this area is almost unlit.

[0066] In real-world facial scenes, the forehead area typically has a smaller angle of incidence because it faces the light source; the cheek side area typically has a larger angle of incidence because its surface is tilted. If the calculated angle exceeds 90 degrees, meaning the light source is behind that area, the angle of incidence is truncated to 90 degrees, indicating that the area is in shadow and receives zero light.

[0067] This step, through three-dimensional facial reconstruction and coordinate system transformation, accurately quantifies the geometric relationship of ambient light illumination on each part of the face, providing key angle parameters for subsequent cosine correction. This ensures that subsequent irradiance correction can fully reflect the modulation effect of the three-dimensional curved structure of the face on the local amount of light received.

[0068] S106. The channel irradiance is cosine corrected using the incident angle to obtain the corrected irradiance corresponding to each facial skin zone.

[0069] It should be noted that the channel irradiance selected in step S104 is the raw irradiance value measured by the ambient light monitoring device at its installation location. This raw value reflects the light radiation intensity of the ambient light in the direction normal to the sensor's photosensitive surface. However, due to the different surface orientations of different skin zones on the face, there is a geometric difference between the actual light intensity received and the sensor measurement value. According to Lambert's cosine law, the irradiance received by a diffuse surface is proportional to the cosine of the incident angle of the light.

[0070] Furthermore, the differences in surface curvature among different facial regions can lead to varying scattering and attenuation effects of light on surfaces with different degrees of curvature. Therefore, it is necessary to comprehensively consider both the incident angle and surface curvature when correcting the channel irradiance to accurately reproduce the actual effective illumination received by each region.

[0071] Furthermore, such as Figure 4 As shown, S106 specifically includes: S61. Calculate the cosine value of the incident angle corresponding to each facial skin region.

[0072] Specifically, for the i-th facial skin region, its incident angle is... The cosine value is According to Lambert's cosine law, the irradiance received at a point on an ideal diffuse surface is equal to the incident irradiance multiplied by the cosine of the incident angle, i.e. ,in The irradiance is the irradiance at perpendicular incidence. Let be the actual irradiance received by the i-th partition. The cosine value ranges from 0 to 1. hour, This indicates that the surface of that partition faces the light source and receives the maximum irradiance; when hour, This indicates that the surface of that partition is parallel to the light source and theoretically receives no radiation. Therefore, the cosine value directly reflects the relative light intensity received by each partition surface due to differences in orientation.

[0073] S62. Obtain the surface curvature undulation index of each facial skin region in the three-dimensional spatial structure of the face.

[0074] Among them, the surface curvature fluctuation index It is used to characterize the curvature of the physical surface of facial skin regions. The larger the value, the more drastic the curvature change of the region's surface.

[0075] Specifically, the surface curvature undulation index is calculated as follows: In the three-dimensional spatial structure of the face, for all triangular mesh faces contained in the i-th facial skin region, the discrete Gaussian curvature and discrete average curvature at the vertices of each face are calculated. Then, the arithmetic mean of the absolute values ​​of the Gaussian curvatures of all vertices in the region is taken to obtain the surface curvature undulation index of the region. The cheek and forehead areas typically have relatively flat surfaces with small curvature undulation indices, usually ranging from 0.01 to 0.05. In contrast, areas such as the sides of the nose, the periorbital region, and the perilipal region have larger surface protrusions or depressions, resulting in greater curvature variations and larger curvature undulation indices, typically ranging from 0.1 to 0.5. Surface curvature undulation indices reflect the microscopic geometric complexity of the surface of a given area. Areas with greater curvature exhibit more significant diffuse reflection and self-shading effects on their surface, leading to further attenuation of effective light reception compared to an ideal plane.

[0076] S63. Combining the preset light spatial diffuse reflection attenuation rule, an exponential attenuation factor is constructed using the surface curvature undulation index. The exponential attenuation factor is multiplied by the cosine value to obtain the light attenuation coefficient specific to each facial skin zone.

[0077] The pre-defined spatial diffuse reflection attenuation rule states that as the skin surface becomes more curved, the dispersion of the micro-surface normal direction increases, leading to a more dispersed distribution of effective reflection and absorption of light in that area, thus weakening the selective absorption effect of pigments on light. This attenuation rule can be mathematically modeled using an exponential function.

[0078] The formula for calculating the exponential decay factor is as follows: ,in These are preset attenuation adjustment parameters used to control the sensitivity of curvature to the effect of light attenuation. The value range is usually from 1.0 to 5.0, and can be calibrated and adjusted according to the actual application scenario. Let be the surface curvature undulation index of the i-th partition. When the surface is flat... Approaching 0, A value close to 1 indicates that the curvature does not produce additional attenuation; when the surface curvature is large... A value significantly less than 1 indicates that curvature causes a significant reduction in illumination.

[0079] Finally, the formula for calculating the light attenuation coefficient is: The light attenuation coefficient takes into account both the incident angle and the surface curvature on the actual amount of light received, so that the corrected irradiance value can more realistically reflect the actual lighting conditions of each facial area under the current ambient light conditions.

[0080] S64. Multiply the selected melanin-corresponding channel irradiance and hemoglobin-corresponding channel irradiance by the light attenuation coefficient specific to each facial skin region to calculate the melanin-corrected irradiance and hemoglobin-corrected irradiance for each facial skin region.

[0081] Specifically, let the channel irradiance corresponding to melanin be... The irradiance of the channel corresponding to hemoglobin is The light attenuation coefficient of the i-th facial skin region is Then the melanin-corrected irradiance of this partition is Hemoglobin-corrected irradiance is Melanin-corrected irradiance reflects the actual light radiation intensity reaching the high absorption band of melanin in the i-th zone under current ambient light conditions, taking into account the incident angle and surface curvature; similarly, hemoglobin-corrected irradiance reflects the actual light radiation intensity in the high absorption band of hemoglobin. Different zones exhibit varying corrected irradiance under the same ambient light due to differences in incident angle and surface curvature. This difference is the geometric reason for the different degrees of color deviation in different areas of the face.

[0082] S65. The melanin-corrected irradiance and the hemoglobin-corrected irradiance of the facial skin region are combined to form the corrected irradiance corresponding to the facial skin region.

[0083] The corrected irradiance is a data pair containing two components: the first is the melanin-corrected irradiance, and the second is the hemoglobin-corrected irradiance. These two components correspond to the light response of the two core pigments in facial skin, respectively. This data pair will serve as input parameters for subsequent chromaticity compensation calculations, used to calculate the melanin-related luminance shift and the hemoglobin-related color shift, respectively.

[0084] This step precisely quantifies the actual irradiance level of each facial zone when ambient light reaches it through a dual adjustment mechanism of cosine correction and exponential decay factor. Compared to using the raw irradiance measured by ambient light monitoring equipment for chromaticity compensation, the corrected irradiance output in this step fully reflects the modulation effect of the three-dimensional geometry of the face on the local light received, making the subsequent chromaticity compensation calculation more consistent with the real lighting conditions of each zone, and effectively avoiding the problems of insufficient or over-compensation caused by ignoring the differences in incident angle and surface curvature.

[0085] S107. Based on the distribution characteristics of melanin and hemoglobin content in each facial skin region, and in combination with the corrected irradiance and the chromaticity value, determine a chromaticity compensation value for each facial skin region.

[0086] It should be noted that the corrected irradiance output in step S106 reflects the actual light energy reaching each zone after correction for the incident angle and surface curvature, while the chromaticity value read in step S103 reflects the colors of each zone recorded by the image acquisition device under the current ambient light conditions. When the ambient light spectrum deviates from the standard white light source, the selective absorption effect of pigments on specific wavelengths of light changes, causing the colors recorded in the image to deviate from the true skin color. The core idea of ​​this step is: by comparing the difference between the corrected irradiance and the reference irradiance under the standard white light source, and combining prior knowledge of the pigment concentration distribution in each zone, the chromaticity shift caused by the deviation of the ambient light spectrum is quantitatively calculated and used as a chromaticity compensation value for subsequent correction.

[0087] Furthermore, such as Figure 5 As shown, S107 specifically includes: S71. Retrieve the pre-set base concentration percentage of melanin and base concentration percentage of hemoglobin for each of the facial skin zones.

[0088] Baseline melanin concentration percentage It is a dimensionless parameter ranging from 0 to 1, representing the weight of melanin's contribution to overall color representation in this facial skin region; the percentage of basal hemoglobin concentration. Similarly, this represents the contribution weight of hemoglobin. These two parameters are prior parameters derived from statistical analysis of facial skin histology and optical parameter measurements across a large population, reflecting the relative differences in the content of the two pigment components in different facial regions.

[0089] Specifically, in a typical parameter setting, the basal hemoglobin concentration in the lip region is 0.65, and the basal melanin concentration is 0.15; in the periorbital region, the basal hemoglobin concentration is 0.45, and the basal melanin concentration is 0.30; in the cheek region, the basal hemoglobin concentration is 0.35, and the basal melanin concentration is 0.40; and in the forehead region, the basal hemoglobin concentration is 0.20, and the basal melanin concentration is 0.55. These parameter values ​​reflect the physiological fact that the lip region has a higher hemoglobin concentration due to its rich blood supply, while the forehead region has a higher melanin concentration due to greater sunlight exposure. It should be noted that the above parameters can be adjusted according to different races, skin colors, and application scenarios, and can also be personalized for specific individuals using spectral reflectance measurement methods.

[0090] S72. Decompose the chromaticity value of each pixel in the facial skin partition into a luminance component representing the skin's base color and a red-blue chromaticity component representing the skin's color cast.

[0091] Specifically, in the CIE Lab color space, the chromaticity value of each pixel consists of three channel values: the L channel value represents luminance, ranging from 0 to 100, where 0 is the darkest and 100 is the brightest; the a channel value represents the opposite dimension of red and green chromaticity, with positive values ​​leaning towards red and negative values ​​towards green; and the b channel value represents the opposite dimension of yellow and blue chromaticity, with positive values ​​leaning towards yellow and negative values ​​towards blue. In this step, the luminance component is taken as the average of the L channel values ​​of all pixels in the partition, reflecting the overall brightness of the skin in that partition; the red and blue chromaticity component is taken as the average of the a channel values ​​of all pixels in the partition, reflecting the overall red tone intensity of the skin in that partition. The a channel value is chosen as the representative of the red and blue chromaticity components because the absorption of hemoglobin mainly affects the red tone of the skin, which directly corresponds to the red-green dimension of the a channel in the CIE Lab color space. For the b channel value, since melanin absorption mainly affects the overall brightness of the skin rather than the yellow-blue tone, it is not included in the main compensation calculation in the simplified model of this step. However, in implementations requiring higher accuracy, the b channel value can be included in the extended compensation model.

[0092] S73. Calculate the first difference ratio between the melanin-corrected irradiance and the reference irradiance of the corresponding band under a standard white light source, and the second difference ratio between the hemoglobin-corrected irradiance and the reference irradiance of the corresponding band under a standard white light source.

[0093] The standard white light source refers to the D65 standard light source or its equivalent light source with a color temperature of 6500K. It has a known and relatively uniform irradiance distribution in all visible light bands. The reference irradiance of the corresponding band under the standard white light source is the standard data that has been measured in advance and stored in the system.

[0094] The formula for calculating the first difference ratio is as follows: ,in This is the reference irradiance of a standard white light source in the high absorption band of melanin. Let be the melanin-corrected irradiance for the i-th partition. The formula for calculating the second difference ratio is: ,in This is the reference irradiance of a standard white light source in the high absorption band of hemoglobin. The corrected irradiance for hemoglobin in the i-th partition.

[0095] When the first difference ratio is positive, it indicates that the irradiance of the current ambient light in the melanin absorption band is lower than that of the standard white light source. The absorption effect of melanin in this band is relatively weakened, resulting in a darker area in the image. When the first difference ratio is negative, it indicates that the irradiance of the current ambient light in this band is higher than that of the standard white light source, resulting in a brighter area in the image. The physical meaning of the second difference ratio is similar.

[0096] S74. Multiply the brightness component by the product of the melanin base concentration ratio and the first correction coefficient to calculate the brightness shift caused by the lack of melanin absorption band in the current ambient light.

[0097] Wherein, the first correction coefficient is equal to 1 minus the first difference ratio, i.e. The formula for calculating the brightness offset is: ,in Let be the luminance component of the i-th partition. This represents the percentage of basal melanin concentration in this region. This is the first difference ratio.

[0098] The physical meaning of brightness offset is that, due to the deviation of ambient light energy from the standard value in the high absorption band of melanin, the light absorption effect of melanin changes, thus causing the brightness of that area in the image to deviate from the true value. This offset is proportional to the luminance component, because areas with higher original brightness are more significantly affected by spectral deviation; and proportional to the proportion of basic melanin concentration, because areas with higher melanin content are more sensitive to changes in the corresponding spectral band.

[0099] when When the value is greater than 0, the ambient light has insufficient energy in the melanin absorption band, resulting in a positive brightness shift, indicating a need for compensation towards brighter areas; when... When the value is less than 0, the ambient light has excess energy in this band, and the brightness offset is negative, indicating that compensation is needed in the darker direction.

[0100] S75. Multiply the red and blue color components by the product of the basic concentration ratio of hemoglobin and the second correction coefficient to calculate the color shift caused by the lack of current ambient light in the hemoglobin absorption band.

[0101] Wherein, the second correction coefficient is equal to 1 minus the second difference ratio, i.e. The formula for calculating color offset is: ,in The red and blue color components of the i-th partition (mean value of channel a in CIELab chromaticity space). This represents the baseline hemoglobin concentration percentage for that region. The physical meaning of color shift is: because the energy of ambient light in the high absorption bands of hemoglobin (around 540nm and 576nm) deviates from the standard value, the selective absorption of light in this band by hemoglobin changes, causing the intensity of red tones in that region in the image to deviate from the true value. When the ambient light energy in the hemoglobin absorption bands is insufficient, the absorption of green light by hemoglobin decreases, and the red tones of the skin are weakened in the image, requiring positive compensation for red tones; conversely, negative compensation is needed. The lip region, with a hemoglobin concentration percentage as high as 0.65, is most sensitive to spectral changes in the hemoglobin absorption bands, and its color shift is usually the largest.

[0102] S76. The brightness offset and the color offset are combined numerically to form the chromaticity compensation value corresponding to the facial skin zone.

[0103] Specifically, the chromaticity compensation value is a two-dimensional vector containing a luminance compensation component and red-blue chromaticity compensation components, denoted as... .in, This is the brightness offset, used to compensate for the deviation of the brightness channel in the i-th partition; This is a color offset used to compensate for the deviation of the red and green color channels in the i-th partition. In extended embodiments requiring higher correction accuracy, the chromaticity compensation value can also include a compensation component from the b channel, forming a three-dimensional compensation vector. The magnitude and direction of the chromaticity compensation value vary depending on the pigment concentration distribution and geometric lighting conditions of each partition, reflecting the core advantage of this invention: refined, region-level chromaticity correction.

[0104] This step establishes a quantitative compensation model from the optical physics level to the color perception level by organically combining the spectral deviation of ambient light with the distribution characteristics of facial skin pigments. This model calculates chromaticity compensation values ​​for each facial skin region separately, fully considering the differences in pigment composition and geometric lighting conditions among different regions. It achieves precise regional-level color correction, fundamentally overcoming the limitations of traditional global correction methods that uniformly process all areas of the face.

[0105] S108. Adjust the chromaticity values ​​of the pixels in the corresponding facial skin region according to the chromaticity compensation value to output a corrected image.

[0106] It should be noted that step S107 determines a chromaticity compensation value for each facial skin region, but this compensation value is a uniform value calculated for the entire region. Applying this uniform compensation value directly to all pixels within a region would cause noticeable color jumps at the boundaries of adjacent regions, compromising the visual naturalness of the corrected image. To address this issue, this step introduces a spatial transition weighting mechanism based on Euclidean distance, ensuring that the chromaticity compensation of each region exhibits a gradual decay from the region's center to its edge, achieving a smooth transition of chromaticity compensation between adjacent regions. Simultaneously, for pixels at the region boundaries that are simultaneously affected by the chromaticity compensation of two or more adjacent regions, a weighted fusion mechanism ensures the continuity and consistency of color correction.

[0107] Furthermore, S108 specifically includes: S81. Obtain the Euclidean distance value between the location of a single pixel in each facial skin partition and the geometric center of the facial skin partition.

[0108] Specifically, for the i-th facial skin region, its geometric center is the arithmetic mean of the coordinates of all pixels in that region, denoted as . ,in and and are the mean x and y coordinates of all pixels within this partition, respectively. For any pixel p within this partition, its coordinates are . The Euclidean distance from the pixel to the geometric center of the partition is... This reflects the spatial location characteristics of the pixel within the partition. The closer a pixel is to the geometric center, the more representative its pigment distribution characteristics are to the typical pigment distribution of that partition, and therefore it should receive more chromaticity compensation. The farther a pixel is from the geometric center and the closer it is to the partition boundary, the more its pigment distribution characteristics gradually tend to the characteristics of the adjacent partition, and therefore the intensity of chromaticity compensation should gradually decrease.

[0109] S82. Construct spatial transition weights based on the Euclidean distance values.

[0110] Among them, the larger the Euclidean distance value of a pixel, the smaller the corresponding spatial transition weight.

[0111] Specifically, the spatial transition weights are constructed using a Gaussian decay function, and their calculation formula is as follows: ,in This represents the Euclidean distance from pixel p to the geometric center of the partition. Let be the scale parameter for the i-th partition. The area of ​​the partition is proportional to its equivalent radius, which is defined as the radius of the circle equivalent to the area of ​​the partition. ,in Let be the pixel area of ​​the i-th partition. This is an adjustment coefficient, typically ranging from 0.5 to 1.0, used to control the rate of weight decay. When When a smaller value is taken, the weight decays faster, and the chroma compensation is mainly concentrated in the central region of the partition; when When a larger value is taken, the weight decays more slowly, and the chroma compensation extends further to the edge of the partition.

[0112] The Gaussian decay function was chosen based on the following considerations: the Gaussian function has smooth and infinitely differentiable properties, which ensures the continuity and smoothness of the spatial transition weights throughout the entire partition, avoiding weight jumps or discontinuities at any location. When the pixel is located at the geometric center of the partition, , This indicates that the pixel receives full chromaticity compensation for that partition; when the pixel moves away from the geometric center and approaches the partition boundary... A value close to 0 indicates that the pixel is almost unaffected by the chromaticity compensation of that partition.

[0113] S83. Multiply the chromaticity compensation value corresponding to the facial skin partition by the spatial transition weight corresponding to the pixel to obtain the actual correction value of the pixel.

[0114] Specifically, for pixel p in the i-th partition, the formula for calculating its actual correction value is as follows: ,in Let be the chroma compensation value for the i-th partition. This represents the spatial transition weight for the pixel. Pixels located near the center of a partition have a spatial transition weight close to 1, receiving nearly full chroma compensation; pixels located at the edge of a partition have a spatial transition weight significantly less than 1, receiving significantly attenuated chroma compensation. For pixels located in the overlapping boundary region of multiple partitions, the actual correction values ​​from each relevant partition need to be normalized according to their weights and then summed. The specific formula is as follows: The summation iterates through all partitions that affect the pixel. This normalization fusion mechanism ensures a smooth transition and continuity of chroma compensation at partition boundaries.

[0115] S84. Add the original chromaticity value of the pixel to the actual correction value to obtain the corrected chromaticity value.

[0116] Specifically, for pixel p, its original chromaticity value in the CIE Lab chromaticity space is The actual correction value is The corrected chromaticity value is: , , In the basic model, the b channel remains unchanged, while in the extended model it can be corrected synchronously.

[0117] It should be noted that the corrected chromaticity values ​​need to be truncated: the L channel values ​​are truncated to the range of 0 to 100, and the a channel values ​​are truncated to the range of -128 to 127, to ensure that the corrected chromaticity values ​​do not exceed the valid numerical range of the CIE Lab chromaticity space and to avoid overflow errors during subsequent color space conversion.

[0118] S85. Convert the corrected chromaticity value from the numerical expression format of the preset chromaticity space back to the image display format of the initial image, and reconstruct the corrected image output by stitching together all pixels containing the corrected chromaticity value.

[0119] Specifically, firstly, the corrected CIE Lab chromaticity values... The CIE XYZ tristimulus values ​​are calculated according to the CIE Lab to CIE XYZ inverse standard transform formula. Then, the tristimulus values ​​are converted into R, G, and B channel values ​​in the sRGB color space through the CIE XYZ to sRGB linear transformation matrix and gamma correction function.

[0120] During the conversion process, the sRGB linear transformation matrix is ​​defined based on the D65 reference white point, which is consistent with the color temperature of the standard white light source, ensuring the accuracy of the color conversion.

[0121] Finally, the converted RGB values ​​of all pixels are reassembled according to the spatial arrangement of the original image to form a corrected image with the same resolution and pixel layout as the initial image. The colors of each region of the facial area in the corrected image have been differentially compensated for the spectral deviation of the current ambient light, enabling a more realistic reproduction of the original colors of facial skin under standard white light. Background pixels outside the facial area in the initial image are not subjected to chromaticity compensation and their original colors are preserved.

[0122] This step, through a spatial transition weighting mechanism and a multi-zone fusion strategy, ensures the accuracy of color correction within each zone while achieving a smooth transition in chromaticity compensation between zones, thus guaranteeing the overall visual naturalness and color continuity of the corrected image. The Gaussian decay characteristic of the spatial transition weights results in a soft, gradual transition effect for chromaticity compensation in space, completely eliminating potential color banding at zone boundaries and ensuring a natural and smooth perception of the corrected image by the human eye.

[0123] For example, in one specific implementation scenario, a user takes a facial image using a smartphone equipped with a multi-channel spectral sensor in a warm-toned indoor lighting environment. The ambient light monitoring module detects that the current ambient light irradiance in the short-wavelength band (420nm to 480nm) is only 60% of that of a standard white light source, while the irradiance in the long-wavelength band (580nm to 620nm) is 110% of that of a standard white light source. After facial key point detection, four zones are defined: lips, periorbital area, cheeks, and forehead. The surface normal vectors of each zone are calculated based on the 3D facial model, and the incident angle of each zone is calculated by combining the relative position of the light sensor and the camera. After cosine correction, the forehead zone, due to its relatively flat surface and orientation towards the light source, has a corrected irradiance close to the original ambient irradiance value; while the cheek side zone, due to its larger incident angle, has a reduced corrected irradiance. In the color compensation calculation, due to insufficient short-wavelength ambient light, the luminance components of each region received positive luminance compensation. The forehead region, with its higher melanin concentration, received a larger luminance compensation; the lip region, with its higher hemoglobin concentration and ambient light close to the standard value within the 540nm to 576nm range, showed a smaller color shift. The final corrected image effectively restored the true colors of the face under standard lighting conditions.

[0124] Figure 6 This is a schematic diagram illustrating a specific implementation of a facial image chromatography correction system based on real-time ambient light monitoring, as provided in this application. (Refer to...) Figure 6 The system may include: The acquisition module 61 is used to acquire ambient irradiance data containing multiple channels output by the ambient light monitoring device, and an initial image containing a facial region output by the image acquisition device; The segmentation module 62 is used to divide the facial region into multiple facial skin partitions in the initial image based on facial geometric relationships. Reading module 63 is used to read the chromaticity value of each pixel in the facial skin partition in a preset chromaticity space; The selection module 64 is used to select, based on the spectral absorption characteristics of melanin and hemoglobin in facial skin, the channel irradiance corresponding to the spectral absorption bands of melanin and hemoglobin respectively from the environmental irradiance data. The calculation module 65 is used to obtain the relative spatial position parameters between the ambient light monitoring device and the image acquisition device, and calculate the incident angle of the ambient light incident direction relative to the surface normal of each facial skin partition based on the relative spatial position parameters. The correction module 66 is used to perform cosine correction on the channel irradiance using the incident angle to obtain the corrected irradiance corresponding to each facial skin zone. The determination module 67 is used to determine a chromaticity compensation value for each facial skin zone based on the distribution characteristics of melanin and hemoglobin content in each facial skin zone, combined with the corrected irradiance and the chromaticity value. The output module 68 is used to adjust the chromaticity value of the pixels in the corresponding facial skin partition according to the chromaticity compensation value, so as to output a corrected image.

[0125] The facial image chromatographic correction system based on real-time ambient light monitoring in this application embodiment is used to implement the aforementioned facial image chromatographic correction method based on real-time ambient light monitoring. Therefore, the specific implementation of the facial image chromatographic correction system based on real-time ambient light monitoring can be found in the embodiment section of the facial image chromatographic correction method based on real-time ambient light monitoring above. The specific implementation can be referred to the description of the corresponding embodiments, and will not be repeated here.

[0126] This application also provides an electronic device, comprising: a memory for storing a computer program; and a processor for executing the computer program to implement the steps of the facial image chromatographic correction method based on real-time ambient light monitoring described above.

[0127] This application also provides a computer-readable storage medium storing a computer program that, when executed by a processor, implements the steps of any of the above-described facial image chromatographic correction methods based on real-time ambient light monitoring.

[0128] In one exemplary embodiment, the aforementioned computer-readable storage medium may include, but is not limited to, various media capable of storing computer programs, such as USB flash drives, read-only memory, random access memory, portable hard drives, magnetic disks, or optical disks.

[0129] Embodiments of the present invention also provide a computer program product, which includes a computer program that, when executed by a processor, implements the steps in any of the embodiments of the facial image chromatographic correction method based on real-time ambient light monitoring.

[0130] Those skilled in the art will further recognize that the units and algorithm steps of the various examples described in conjunction with the embodiments disclosed herein can be implemented in electronic hardware, computer software, or a combination of both. To clearly illustrate the interchangeability of hardware and software, the components and steps of the various examples have been generally described in terms of functionality in the foregoing description. 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 implementations should not be considered beyond the scope of this invention.

[0131] The foregoing has provided a detailed description of a facial image chromatographic correction method and system based on real-time ambient light monitoring, as provided in this application. Specific examples have been used to illustrate the principles and implementation methods of this application. The descriptions of the embodiments above are merely for the purpose of helping to understand the method and its core ideas. It should be noted that those skilled in the art can make various improvements and modifications to this application without departing from its principles, and these improvements and modifications also fall within the protection scope of this application.

Claims

1. A method for chromatographic correction of facial images based on real-time ambient light monitoring, characterized in that, include: Acquire ambient irradiance data containing multiple channels output by the ambient light monitoring device, and an initial image containing the facial region output by the image acquisition device; In the initial image, the facial region is divided into multiple facial skin zones based on facial geometry. Read the chromaticity value of each pixel in the facial skin region in the preset chromaticity space; Based on the spectral absorption characteristics of melanin and hemoglobin in facial skin, channel irradiance corresponding to the spectral absorption bands of melanin and hemoglobin is selected from the environmental irradiance data. The relative spatial position parameters between the ambient light monitoring device and the image acquisition device are obtained, and the incident angle of the ambient light incident direction relative to the surface normal of each facial skin partition is calculated based on the relative spatial position parameters. The channel irradiance is cosine corrected using the incident angle to obtain the corrected irradiance for each facial skin zone. Based on the distribution characteristics of melanin and hemoglobin content in each facial skin region, and in combination with the corrected irradiance and the chromaticity value, a chromaticity compensation value is determined for each facial skin region. Based on the chromaticity compensation value, the chromaticity values ​​of the pixels within the corresponding facial skin region are adjusted to output a corrected image.

2. The method according to claim 1, characterized in that, The step of adjusting the chromaticity values ​​of pixels within the corresponding facial skin region based on the chromaticity compensation value to output a corrected image includes: Obtain the Euclidean distance value between the location of a single pixel within each facial skin partition and the geometric center of the facial skin partition; Spatial transition weights are constructed based on the Euclidean distance values. For pixels with larger Euclidean distance values, the corresponding spatial transition weights are smaller. Multiply the chromaticity compensation value corresponding to the facial skin partition by the spatial transition weight corresponding to the pixel to obtain the actual correction value of the pixel; The original chromaticity value of the pixel is added to the actual correction value to obtain the corrected chromaticity value; The corrected chromaticity values ​​are converted from the numerical representation format of the preset chromaticity space back to the image display format of the initial image, and all pixels containing the corrected chromaticity values ​​are stitched together to reconstruct a corrected image for output.

3. The method according to claim 1, characterized in that, The step of acquiring the relative spatial position parameters between the ambient light monitoring device and the image acquisition device, and calculating the incident angle of the ambient light incident direction relative to the surface normal of each facial skin zone based on the relative spatial position parameters, includes: Key pixels of facial contour are extracted from the initial image. Based on the correspondence between the two-dimensional plane coordinates of the key pixels of facial contour and the preset depth information, a three-dimensional spatial structure of the face containing three-dimensional coordinates is constructed. Based on the facial three-dimensional spatial structure, calculate the outward direction vector at the center coordinate point of the surface of each facial skin partition, and use it as the surface normal vector of the facial skin partition. Using the spatial translation and spatial rotation values ​​contained in the relative spatial position parameters, the three-dimensional spatial coordinates of the ambient light monitoring device are transformed to the three-dimensional coordinate system of the image acquisition device to obtain the ambient light reference coordinates; In the three-dimensional coordinate system, the ambient light reference coordinates are connected to the center coordinates of each facial skin zone to form an ambient light incident direction vector pointing from the ambient light reference coordinates to the facial skin zone; Calculate the spatial angle between the ambient light incident direction vector and the surface normal vector of the corresponding facial skin region, and use the spatial angle as the incident angle.

4. The method according to claim 3, characterized in that, The step of applying cosine correction to the channel irradiance using the incident angle to obtain the corrected irradiance for each facial skin region includes: Calculate the cosine value of the incident angle corresponding to each facial skin region; The surface curvature undulation index of each facial skin partition in the three-dimensional spatial structure of the face is obtained, and the surface curvature undulation index is used to characterize the degree of curvature of the physical surface of the facial skin partition. Combining the preset light spatial diffuse reflection attenuation rules, an exponential attenuation factor is constructed using the surface curvature undulation index. The exponential attenuation factor is multiplied by the cosine value to obtain the light attenuation coefficient specific to each facial skin zone. The selected melanin-corresponding channel irradiance and hemoglobin-corresponding channel irradiance are multiplied by the light attenuation coefficient specific to each facial skin region to calculate the melanin-corrected irradiance and hemoglobin-corrected irradiance for each facial skin region. The melanin-corrected irradiance and the hemoglobin-corrected irradiance of the facial skin region are combined to form the corrected irradiance corresponding to the facial skin region.

5. The method according to claim 4, characterized in that, Based on the distribution characteristics of melanin and hemoglobin content within each facial skin region, and in conjunction with the corrected irradiance and the chromaticity value, a chromaticity compensation value is determined for each facial skin region, including: Retrieve the pre-defined baseline melanin concentration percentage and baseline hemoglobin concentration percentage for each of the aforementioned facial skin zones; The chromaticity value of each pixel in each facial skin region is decomposed into a luminance component representing the skin's base color and a red-blue chromaticity component representing the skin's color cast. Calculate the first difference ratio between the melanin-corrected irradiance and the reference irradiance of the corresponding band under a standard white light source, and the second difference ratio between the hemoglobin-corrected irradiance and the reference irradiance of the corresponding band under a standard white light source. The brightness component is multiplied by the product of the melanin base concentration ratio and the first correction coefficient to calculate the brightness shift caused by the lack of melanin absorption band in the current ambient light. The correction coefficient is equal to 1 minus the first difference ratio. The red and blue color components are multiplied by the product of the basic concentration ratio of hemoglobin and the second correction coefficient to calculate the color shift caused by the absence of the current ambient light in the hemoglobin absorption band. The second correction coefficient is equal to 1 minus the second difference ratio. The brightness offset and the color offset are combined to form the chromaticity compensation value corresponding to the facial skin zone.

6. The method according to claim 1, characterized in that, The step of selecting channel irradiance corresponding to the spectral absorption bands of melanin and hemoglobin from the environmental irradiance data, based on the spectral absorption characteristics of melanin and hemoglobin respectively, includes: Obtain the light absorption distribution curves of melanin and hemoglobin within a continuous wavelength range; In the melanin light absorption distribution curve and the hemoglobin light absorption distribution curve, wavelength ranges with absorbance values ​​greater than a preset absorption threshold are extracted respectively as the high absorption wavelength ranges of melanin and hemoglobin. Obtain the center photosensitive wavelength and photosensitive span range corresponding to each of the multiple channels in the environmental irradiance data; Determine whether the central photosensitive wavelength and the range of photosensitive span of each channel fall completely within the high absorption wavelength range of melanin or the high absorption wavelength range of hemoglobin. The irradiance recorded by the channel whose coverage range falls within the high absorption wavelength range of melanin is extracted as the channel irradiance corresponding to melanin, and the irradiance recorded by the channel whose coverage range falls within the high absorption wavelength range of hemoglobin is extracted as the channel irradiance corresponding to hemoglobin.

7. The method according to claim 1, characterized in that, The multiple facial skin zones include: lip zone, periorbital zone, cheek zone, and forehead zone.

8. A facial image chromatographic correction system based on real-time ambient light monitoring, characterized in that, include: The acquisition module is used to acquire ambient irradiance data containing multiple channels output by the ambient light monitoring device, and an initial image containing the facial region output by the image acquisition device; A segmentation module is used to divide the facial region into multiple facial skin partitions in the initial image based on facial geometric relationships. The reading module is used to read the chromaticity value of each pixel in the facial skin partition in a preset chromaticity space; The selection module is used to select the channel irradiance corresponding to the spectral absorption bands of melanin and hemoglobin respectively from the environmental irradiance data based on the spectral absorption characteristics of melanin and hemoglobin in facial skin. The calculation module is used to obtain the relative spatial position parameters between the ambient light monitoring device and the image acquisition device, and calculate the incident angle of the ambient light incident direction relative to the surface normal of each facial skin partition based on the relative spatial position parameters. The correction module is used to perform cosine correction on the channel irradiance using the incident angle to obtain the corrected irradiance corresponding to each facial skin zone. The determination module is used to determine a chromaticity compensation value for each facial skin zone based on the distribution characteristics of melanin and hemoglobin content within each facial skin zone, combined with the corrected irradiance and the chromaticity value. The output module is used to adjust the chromaticity values ​​of pixels within the corresponding facial skin region according to the chromaticity compensation value, so as to output a corrected image.

9. An electronic device, characterized in that, include: Memory, used to store computer programs; A processor, configured to execute the computer program to implement the steps of the facial image chromatographic correction method based on real-time ambient light monitoring as described in any one of claims 1 to 7.

10. A computer-readable storage medium, characterized in that, The computer-readable storage medium stores a computer program that, when executed by a processor, enables the facial image chromatographic correction method based on real-time ambient light monitoring as described in any one of claims 1 to 7.