Color correction method and device, electronic equipment and computer readable storage medium

By identifying the dominant components of melanin and hemoglobin and adjusting the color correction matrix, the problem of existing technologies being unable to adapt to different skin tone types is solved, achieving a more accurate and natural color correction effect.

CN121414641APending Publication Date: 2026-01-27LUXSHARE PRECISION TECH(NANJING) CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202511517092.5
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2025-10-22
Publication Date
2026-01-27

AI Technical Summary

Technical Problem

Existing color correction methods cannot adapt to users with different skin tones, resulting in color distortion.

Method used

By obtaining the melanin-dominant and hemoglobin-dominant components in the target face image, the skin color type is determined, and the color correction matrix is ​​adjusted according to the skin color type to generate a target color correction matrix for correction.

Benefits of technology

It achieves adaptive correction for different skin tones, improving the accuracy and naturalness of color correction.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN121414641A_ABST
    Figure CN121414641A_ABST
Patent Text Reader

Abstract

The invention provides a color correction method and apparatus, an electronic device and a computer readable storage medium. The method comprises the steps of obtaining a target face image; determining a melanin dominant component and a hemoglobin dominant component in the target face image; determining a skin color type corresponding to the target face image according to the melanin dominant component and the hemoglobin dominant component; determining a correction parameter corresponding to the skin color type; correcting a preset color correction matrix through the correction parameter to obtain a target color correction matrix; and correcting the target face image through the target color correction matrix. The melanin dominant component and the hemoglobin dominant component in the target face image are determined, so that the skin color features of the user in the target face image are determined, the specific skin color type is determined, the color correction matrix is adjusted according to the skin color type, and then correction is performed through the target color correction matrix, so that the color correction accuracy is improved. And different skin color types can be adapted.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention relates to the field of image processing, and more particularly to a color correction method, apparatus, electronic device, and computer-readable storage medium. Background Technology

[0002] Traditional CCM (Color Correction Matrix) is often optimized for a single skin tone, which leads to color distortion when applied to different skin types, making it impossible to apply to users with different skin tones simultaneously. Summary of the Invention

[0003] The main objective of this invention is to provide a color correction method, apparatus, electronic device, and computer-readable storage medium, aiming to solve the problem that existing color correction methods cannot be applied to users with different skin tones.

[0004] To achieve the above objectives, the present invention provides a color correction method, the method comprising the following steps: Acquire the target face image; The dominant melanin component and the dominant hemoglobin component in the target face image are determined. The skin color type corresponding to the target face image is determined based on the melanin-dominant component and the hemoglobin-dominant component. Determine the correction parameters corresponding to the skin color type; The preset color correction matrix is ​​corrected using the correction parameters to obtain the target color correction matrix; The target face image is corrected using the target color correction matrix.

[0005] Optionally, determining the dominant melanin component and the dominant hemoglobin component in the target face image includes: For each pixel in the target face image, calculate the spectral reflectance curve corresponding to that pixel; A preset skin optical model is obtained, and the spectral reflectance curve is substituted into the preset skin optical model to obtain the melanin concentration and hemoglobin concentration corresponding to the pixel. The melanin dominant component is obtained by calculating the average melanin concentration corresponding to each pixel. The dominant hemoglobin component is obtained by calculating the average hemoglobin concentration corresponding to each pixel.

[0006] Optionally, determining the skin color type corresponding to the target face image based on the melanin-dominant component and the hemoglobin-dominant component includes: Calculate the concentration ratio of the melanin-dominant component to the hemoglobin-dominant component; The concentration ratio is used as the skin color type.

[0007] Optionally, determining the correction parameters corresponding to the skin color type includes: Obtain the preset probability vector corresponding to the preset skin color, and obtain the concentration ratio corresponding to the skin color type, wherein the preset probability vector includes the preset confidence level corresponding to different main skin colors; For each of the main skin colors in the preset probability vector, the target confidence level is obtained by subtracting the concentration ratio from the preset confidence level corresponding to the main skin color. Generate a target probability vector containing the target confidence scores corresponding to each main skin color; The target probability vector is used as the correction parameter.

[0008] Optionally, the step of correcting the preset color correction matrix using the correction parameters to obtain the target color correction matrix includes: Obtain the target probability vector from the correction parameters, and determine the confidence levels of multiple targets in the target probability vector; The preset color correction matrix is ​​multiplied by the target confidence level to obtain multiple sub-matrices; The target color correction matrix is ​​obtained by adding the multiple sub-matrices together.

[0009] Optionally, correcting the target face image using the target color correction matrix includes: Identify the rosy region in the target face image; For the rosy pixels within the rosy region, determine the hemoglobin concentration of the dominant hemoglobin component in the rosy pixels; Determine the red compensation value corresponding to the hemoglobin concentration, wherein the red compensation value is positively correlated with the hemoglobin concentration. The red channel parameters of the target color correction matrix are compensated using the red compensation value to obtain a rosy color correction matrix; The rosy pixels are corrected using the rosy color correction matrix.

[0010] Optionally, acquiring the target face image includes: Acquire the target corrected image; Face detection is performed on the target correction image to obtain the face regions in the target correction image; The face region is segmented to obtain a face segmentation mask; Generate the target face image containing the face region and the face segmentation mask.

[0011] To achieve the above objectives, the present invention also provides a color correction device, the color correction device comprising: The first acquisition module is used to acquire the target face image; The first determining module is used to determine the melanin-dominant component and the hemoglobin-dominant component in the target face image; The second determining module is used to determine the skin color type corresponding to the target face image based on the melanin dominant component and the hemoglobin dominant component. The third determining module is used to determine the correction parameters corresponding to the skin color type; The first correction module is used to correct the preset color correction matrix using the correction parameters to obtain the target color correction matrix; The second correction module is used to correct the target face image using the target color correction matrix.

[0012] To achieve the above objectives, the present invention also provides an electronic device, the electronic device including a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the computer program, when executed by the processor, implements the steps of the color correction method as described above.

[0013] To achieve the above objectives, the present invention also provides a computer-readable storage medium storing a computer program that, when executed by a processor, implements the steps of the color correction method as described above.

[0014] This invention proposes a color correction method, apparatus, electronic device, and computer-readable storage medium. The method involves acquiring a target face image; determining the dominant melanin and hemoglobin components in the target face image; determining the skin tone type corresponding to the target face image based on the dominant melanin and hemoglobin components; determining correction parameters corresponding to the skin tone type; correcting a preset color correction matrix using the correction parameters to obtain a target color correction matrix; and correcting the target face image using the target color correction matrix. By determining the dominant melanin and hemoglobin components in the target face image, the skin tone characteristics of the user in the target face image are clarified, thereby determining the specific skin tone type. After adjusting the color correction matrix based on the skin tone type, and then correcting it using the target color correction matrix, it can adapt to different skin tone types. Attached Figure Description

[0015] The accompanying drawings, which are incorporated in and form part of this specification, illustrate embodiments consistent with the invention and, together with the description, serve to explain the principles of the invention.

[0016] To more clearly illustrate the technical solutions in the embodiments of the present invention or the prior art, the drawings used in the description of the embodiments or the prior art will be briefly introduced below. Obviously, for those skilled in the art, other drawings can be obtained based on these drawings without creative effort.

[0017] Figure 1 This is a flowchart illustrating the first embodiment of the color correction method of the present invention; Figure 2 This is a schematic diagram of the module structure of the electronic device of the present invention. Detailed Implementation

[0018] It should be understood that the specific embodiments described herein are merely illustrative of the invention and are not intended to limit the invention. To enable those skilled in the art to better understand the present application, the technical solutions in the embodiments of the present application will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only a part of the embodiments of the present application, and not all of them. Based on the embodiments in this application, all other embodiments obtained by those skilled in the art without creative effort should fall within the scope of protection of this application.

[0019] This invention provides a color correction method, referring to... Figure 1 , Figure 1 This is a flowchart illustrating the first embodiment of the color correction method of the present invention. The method includes the following steps: Step S10: Obtain the target face image; The target face image is an image containing a face that needs color correction.

[0020] The specific method for acquiring the target face image can be set based on actual needs. For example, when a user takes a photo or video with a camera, the source image captured by the camera is the target correction image, and the part of the target correction image where the face area is located is the target face image.

[0021] Step S20: Determine the dominant melanin component and the dominant hemoglobin component in the target face image; The melanin-dominant component is the component in the target face image that reflects the concentration and distribution of melanin in the skin.

[0022] The dominant component of hemoglobin is the component in the target face image that reflects the concentration and distribution of hemoglobin in the skin.

[0023] It is understandable that differences in skin color are mainly determined by the content and ratio of melanin and hemoglobin in the skin. Therefore, by determining the dominant components of melanin and hemoglobin, it is possible to determine the skin characteristics of the user in the target face image. For example, when melanin is high and hemoglobin is low, the skin color appears as dark brown or brownish-black; when melanin is moderate and hemoglobin is high, the skin color appears as yellowish-brown; and when melanin is low and hemoglobin concentration is moderate, the skin color appears as white with a reddish tint.

[0024] The specific methods for determining the dominant components of melanin and hemoglobin can be set based on actual needs.

[0025] Step S30: Determine the skin color type corresponding to the target face image based on the melanin-dominant component and the hemoglobin-dominant component; Skin color type is used to indicate the skin color characteristics of a target face image; skin color type can indicate specific skin color, such as black, brown, yellow, white, etc., or it can indicate skin color related parameter characteristics, such as parameters that reflect the overall skin color characteristics obtained by combining the melanin dominant component and the hemoglobin dominant component.

[0026] Step S40: Determine the correction parameters corresponding to the skin tone type; Step S50: Correct the preset color correction matrix using correction parameters to obtain the target color correction matrix; The preset color correction matrix is ​​a pre-set color correction matrix for a specific skin tone. The specific skin tone for which the preset color correction matrix is ​​applied can be set according to actual needs. It should be noted that since different skin tones have different color tone variations, such as black being the darkest, followed by brown, yellow being lighter, and white being the lightest, in order to achieve a consistent correction direction for the preset color correction matrix, it can be set to the darkest or lightest skin tone. For example, if the preset color correction matrix is ​​set to black, then all skin tones will be corrected based on the preset color correction matrix, and the correction will be uniformly achieved by reducing compensation. If the preset color correction matrix is ​​set to white, then all skin tones will be corrected based on the preset color correction matrix, and the correction will be uniformly achieved by increasing compensation.

[0027] The correction parameters are parameters used to correct the preset color correction matrix based on the actual skin tone type.

[0028] When performing correction, the color correction matrix is ​​multiplied by the pixel value to correct the pixel. By setting correction parameters to correct the preset color correction matrix, it is possible to perform skin tone type-based correction on the pixel after correction by the preset color correction matrix. In other words, the target color correction matrix obtained based on the correction parameters can achieve skin tone type-based correction of the pixel.

[0029] The specific correction parameters can be set based on the difference between the skin type and the skin type targeted by the preset color correction matrix.

[0030] Step S60: Correct the target face image using the target color correction matrix.

[0031] After obtaining the target color correction matrix, the target face image can be corrected using the target color correction matrix, so that the target face image can be corrected based on the actual skin color type, thereby ensuring that the correction effect of the target face image can meet the correction requirements of the user's skin color type in the target face image.

[0032] This embodiment determines the dominant melanin and hemoglobin components in the target face image to clarify the user's skin color characteristics in the target face image, thereby determining the specific skin color type. After adjusting the color correction matrix according to the skin color type, it is then corrected by the target color correction matrix to adapt to different skin color types.

[0033] Furthermore, in the second embodiment of the color correction method of the present invention based on the first embodiment, step S20 includes the following steps: Step S21: For each pixel in the target face image, calculate the spectral reflectance curve corresponding to the pixel; Step S22: Obtain a preset skin optical model and substitute the spectral reflectance curve into the preset skin optical model to obtain the melanin concentration and hemoglobin concentration corresponding to the pixel. Step S23: Calculate the average melanin concentration of each pixel to obtain the dominant melanin component. Step S24: Calculate the average value of the hemoglobin concentration corresponding to each pixel to obtain the dominant hemoglobin component.

[0034] The spectral reflectance curve is a function of the reflectance of the object's surface corresponding to a pixel to light of various wavelengths as a function of wavelength. The spectral reflectance curve characterizes the physical properties of pixel color; the specific method for obtaining the spectral reflectance curve can be set according to actual needs, such as Wiener estimation or the pseudo-inverse method.

[0035] A preset skin optical model is used to indicate the correspondence between spectral reflectance, the standard reflectance spectral base of melanin, the standard reflectance spectral base of hemoglobin, and the reflectance base of the depigmented skin matrix at different concentrations; for example:

[0036] Where R(λ) is the spectral reflectance curve; Rm(λ) is the standard reflectance spectral base of melanin; Rh(λ) is the standard reflectance spectral base of hemoglobin; R0(λ) is the reflectance base of the non-pigmented skin matrix; α is the melanin concentration; and β is the hemoglobin concentration.

[0037] Where Rm(λ), Rh(λ), and R0(λ) are known quantities, and since there is a certain correlation between the values ​​of melanin concentration and hemoglobin concentration, for example, the values ​​of melanin concentration and hemoglobin concentration can be calculated by the "optimal ratio" algorithm. The "optimal ratio" algorithm can be a linear least squares method. Therefore, after obtaining the spectral reflectance curve, the corresponding melanin concentration and hemoglobin concentration can be obtained by substituting the spectral reflectance curve into the preset skin optical model.

[0038] It is understandable that the target face image contains multiple pixels. For each pixel, the spectral reflectance curve of that pixel is obtained, and the melanin concentration and hemoglobin concentration corresponding to that pixel are calculated based on the spectral reflectance curve.

[0039] Melanin concentration is the relative amount of melanin in the skin corresponding to a pixel; melanin concentration reflects the skin's ability to absorb light. The higher the melanin concentration, the darker the skin tone; it tends to be more brownish-yellow in color.

[0040] Hemoglobin concentration is the relative amount of hemoglobin in the skin corresponding to a pixel; hemoglobin concentration reflects the degree of blood filling in the skin where the pixel is located, and the higher the hemoglobin concentration, the more rosy the skin color.

[0041] The melanin dominant component is obtained by averaging the melanin concentration of each pixel. Therefore, the melanin dominant component reflects the overall depth of the skin tone and the intensity of the brownish-yellow hue in the target face image; the higher the melanin dominant component, the darker the user's skin tone.

[0042] The hemoglobin dominant component is obtained from the average hemoglobin concentration of each pixel. Therefore, the hemoglobin dominant component reflects the overall rosiness of the skin tone in the target face image; the higher the hemoglobin dominant component, the more rosy the user's skin tone.

[0043] In this embodiment, the melanin concentration and hemoglobin concentration of a single pixel are determined, and then the melanin-dominant component and hemoglobin-dominant component are obtained based on the average concentration. This allows the melanin-dominant component and hemoglobin-dominant component to accurately reflect the actual skin color characteristics of the target face image, thereby improving the accuracy of subsequent correction.

[0044] Furthermore, in the third embodiment of the color correction method of the present invention based on the first embodiment, step S30 includes the following steps: Step S31: Calculate the concentration ratio of the melanin-dominant component to the hemoglobin-dominant component; Step S32: Use the concentration ratio as the skin color type.

[0045] The concentration ratio is the ratio of the dominant melanin component to the dominant hemoglobin component. Since the dominant melanin component indicates a darker skin tone, while the dominant hemoglobin component indicates a lighter skin tone, the concentration ratio reflects the balance between black and white skin. The higher the concentration ratio, the more melanin content exceeds hemoglobin content, and the skin tone is considered to be more black; the lower the concentration ratio, the more hemoglobin content exceeds melanin content, and the skin tone is considered to be more white. Therefore, the concentration ratio can indicate skin type.

[0046] Since the concentration ratio itself reflects the tendency towards black and white, using the concentration ratio as the skin color type allows the skin color type to directly reflect skin color characteristics without information loss during summarization, induction, or classification. In other embodiments, the corresponding skin color type can be determined by specifically classifying the concentration ratio, such as setting four skin color intervals: a concentration ratio in the (0.75, 1) interval corresponds to black skin; a concentration ratio in the (0.6, 0.75) interval corresponds to brown skin; a concentration ratio in the (0.4, 0.6) interval corresponds to yellow skin; and a concentration ratio in the (0.15, 0.4) interval corresponds to white skin. While this method can classify different skin tones, in practical applications, the skin color division is too definite, resulting in low precision in skin color details. In this embodiment, by using the concentration ratio as the skin color type, the most original color tendency can be preserved, thus accurately representing the skin color type and ensuring the accuracy of subsequent corrections.

[0047] Furthermore, in the fourth embodiment of the color correction method of the present invention based on the first embodiment, step S40 includes the following steps: Step S41: Obtain the preset probability vector corresponding to the preset skin color and obtain the concentration ratio corresponding to the skin color type. The preset probability vector includes the preset confidence level corresponding to different main skin colors. Step S42: For each main skin color in the preset probability vector, subtract the concentration ratio from the preset confidence level corresponding to the main skin color to obtain the target confidence level. Step S43: Generate a target probability vector containing the target confidence scores corresponding to each main skin color; Step S44: Use the target probability vector as the correction parameter.

[0048] The preset skin tone is the skin tone corresponding to the preset color correction matrix; the specific preset skin tone can be set according to actual needs.

[0049] The preset probability vector indicates the confidence level of a preset skin tone relative to multiple master skin tones. The master skin tone is the skin tone of a specific point. The master skin tone can be set based on actual needs, such as black, brown, yellow, or white. The preset probability vector contains the confidence levels corresponding to different master skin tones, such as Pv=[pv_black=0.875, pv_brown=0.7, pv_yellow=0.5, pv_white=0.375]; where Pv is the preset probability vector, pv_black is the preset confidence level corresponding to the black master skin tone, pv_brown is the preset confidence level corresponding to the brown master skin tone, pv_yellow is the preset confidence level corresponding to the yellow master skin tone, and pv_white is the preset confidence level corresponding to the white master skin tone. In this embodiment, the preset probability vector indicates the probability vector corresponding to the darkest skin tone. The concentration ratio indicates the black or white tendency of the skin tone. Therefore, by subtracting the concentration ratio from the preset probability vector, the target confidence level can be obtained.

[0050] After correcting each preset confidence level based on the concentration ratio, multiple corresponding target confidence levels are obtained to obtain the target probability vector; for example, if the target probability vector is P=[ pv_black-a / b, pv_brown-a / b, pv_yellow-a / b, pv_white-a / b], then P=[ p_black, p_brown, p_yellow, p_white] is obtained; where P is the target probability vector; a is the melanin content; b is the hemoglobin content; p_black is the target confidence level corresponding to the black primary skin color, p_brown is the target confidence level corresponding to the brown primary skin color, p_yellow is the target confidence level corresponding to the yellow primary skin color, and p_white is the target confidence level corresponding to the white primary skin color.

[0051] The target probability vector indicates the probability vector obtained based on the difference between the actual skin color and the preset skin color. Therefore, the target probability vector can accurately reflect the difference that needs to be corrected, so that the preset skin color can be corrected to obtain the actual skin color.

[0052] Furthermore, in the fifth embodiment of the color correction method of the present invention based on the first embodiment of the present invention, step S50 includes the step... Step S51: Obtain the target probability vector in the correction parameters and determine the confidence levels of multiple targets in the target probability vector; Step S52: Multiply the preset color correction matrix by the target confidence level to obtain multiple sub-matrices; Step S53: Add the multiple sub-matrices together to obtain the target color correction matrix.

[0053] Multiple target confidence levels are confidence levels for different primary skin tones.

[0054] First, multiply the preset color correction matrix by each target confidence level to obtain multiple sub-matrices, such as:

[0055] Among them, CCM f Target color correction matrix; CCM old This is the preset target color correction matrix.

[0056] The target color correction matrix can be obtained by adding the four sub-matrices together.

[0057] In this application, target confidence levels corresponding to multiple skin color types are obtained, and the target confidence levels are multiplied with a preset color correction matrix to obtain the optimal matrix for the corresponding skin color type. Then, the sub-matrices are added together to obtain the target color correction matrix, so that the target color correction matrix is ​​fused based on the confidence levels of different skin color types to obtain the target color correction matrix that best meets the needs of the target face image.

[0058] Furthermore, in the sixth embodiment of the color correction method of the present invention based on the first embodiment, step S60 includes the following steps: Step S61: Determine the rosy region in the target face image; Step S62: For the rosy pixels within the rosy region, determine the hemoglobin concentration of the dominant hemoglobin component in the rosy pixels; Step S63: Determine the red compensation value corresponding to the hemoglobin concentration, wherein the red compensation value is positively correlated with the hemoglobin concentration; Step S64: The red channel parameters of the target color correction matrix are compensated using red compensation values ​​to obtain a rosy color correction matrix; Step S65: Correct the rosy pixels using the rosy color correction matrix.

[0059] A rosy area is a region on the face that has obvious rosy features, such as the cheeks; the rosy area can be specifically obtained by dividing the face into regions.

[0060] Color correction using a color correction matrix may result in overly uniform color, leading to issues such as a deathly white or sallow complexion. Therefore, in order to improve the naturalness of the corrected color and make the skin tone healthier, this embodiment enhances the redness of the rosy areas, thereby improving the rosiness of the face.

[0061] Reddish pixels are the pixels contained within a reddish area.

[0062] The red compensation value indicates the degree of enhancement to the red component of a pixel; the larger the red compensation value, the greater the enhancement to the red component. It can be understood that a higher hemoglobin concentration indicates a higher degree of redness for that pixel, therefore, enhancing it will achieve a more natural redness effect, thus requiring an increased red compensation value. Conversely, a lower hemoglobin concentration indicates a lower degree of redness for that pixel, therefore, enhancing it may lead to the enhancement of areas that shouldn't be reddish, thus requiring a decreased red compensation value.

[0063] Different parameters in the color correction matrix correspond to the correction of different color channels; the color correction matrix is ​​as follows:

[0064] Wherein, m11, m12, and m13 are red channel parameters, m21, m22, and m23 are green channel parameters, and m31, m32, and m33 are blue channel parameters; by adjusting the corresponding color channel parameters, the correction effect of the color can be adjusted; therefore, in this embodiment, the red channel of the target color correction matrix is ​​compensated, so that the rosy effect of the rosy pixels is further improved on the basis of accurately restoring skin color.

[0065] In this embodiment, by setting the red compensation value to be positively correlated with the hemoglobin concentration, a natural rosy enhancement effect can be achieved.

[0066] Furthermore, in the seventh embodiment of the color correction method of the present invention based on the first embodiment of the present invention, step S10 includes the following steps: Step S11: Obtain the target correction image; Step S12: Perform face detection on the target correction image to obtain the face region in the target correction image; Step S13: Perform region segmentation on the face region to obtain a face segmentation mask; Step S14: Generate a target face image containing the face region and a face segmentation mask.

[0067] The target correction image is the source image acquired by the camera; the specific type of the target correction image can be set according to actual needs, such as RAW data, JPEG data, etc.

[0068] Face detection involves detecting facial regions in a target corrected image; the specific detection method can be set according to actual needs, such as using a convolutional neural network to achieve face detection.

[0069] To improve face detection performance, image enhancement operations can be performed on the target calibrated image. The specific type of image enhancement operation can be set according to actual needs, such as basic linearization, which converts the target calibrated image into linear RGB values ​​to eliminate the nonlinear processing effects of the ISP (Image Signal Processor) front-end acquisition, providing accurate physical quantities for determining the spectral reflectance curve. Specific basic linearization operations can be set according to actual needs, such as black level correction, lens shading correction, white balance gain, and de-mosaic. Black level correction removes the fixed offset caused by dark current from the camera sensor; lens shading correction compensates for the brightness attenuation at the lens edges by using a gain map that gradually increases from the center of the target calibrated image; white balance gain normalizes the RGB channels to a white reference; and de-mosaic interpolates a single-channel image in Bayer mode to obtain an RGB three-channel image.

[0070] After obtaining the face region, in order to facilitate subsequent analysis and clarify the skin region, the face region is further segmented to obtain a face segmentation mask; the face segmentation mask is used to indicate specific areas of the face, such as skin, eyebrows, lips, and eyes.

[0071] By combining the face region with the face segmentation mask to obtain the target face image, the specific location of the face region can be clearly defined, allowing subsequent focus on skin location to determine skin color type and improve correction accuracy.

[0072] It should be noted that, for the sake of simplicity, the foregoing method embodiments are all described as a series of actions. However, those skilled in the art should understand that this application is not limited to the described order of actions, as some steps may be performed in other orders or simultaneously according to this application. Furthermore, those skilled in the art should also understand that the embodiments described in the specification are preferred embodiments, and the actions and modules involved are not necessarily essential to this application.

[0073] Through the above description of the embodiments, those skilled in the art can clearly understand that the methods according to the above embodiments can be implemented by means of software plus necessary general-purpose hardware platforms. Of course, they can also be implemented by hardware, but in many cases the former is a better implementation method. Based on this understanding, the technical solution of this application, in essence, or the part that contributes to the prior art, can be embodied in the form of a software product. This computer software product is stored in a storage medium (such as ROM / RAM, magnetic disk, optical disk), and includes several instructions to cause a terminal device (which may be a mobile phone, computer, server, or network device, etc.) to execute the methods described in the various embodiments of this application.

[0074] This application also provides a color correction apparatus for implementing the above-described color correction method, the color correction apparatus comprising: The first acquisition module is used to acquire the target face image; The first determining module is used to determine the dominant melanin component and the dominant hemoglobin component in the target face image; The second determining module is used to determine the skin color type corresponding to the target face image based on the melanin dominant component and the hemoglobin dominant component. The third determination module is used to determine the correction parameters corresponding to the skin color type; The first correction module is used to correct the preset color correction matrix using correction parameters to obtain the target color correction matrix; The second correction module is used to correct the target face image using the target color correction matrix.

[0075] This color correction device determines the dominant melanin and hemoglobin components in the target face image to clarify the user's skin color characteristics in the target face image, thereby determining the specific skin color type. After adjusting the color correction matrix according to the skin color type, it is then corrected by the target color correction matrix to adapt to different skin color types.

[0076] It should be noted that the first acquisition module in this embodiment can be used to execute step S10 in this application embodiment, the first determination module in this embodiment can be used to execute step S20 in this application embodiment, the second determination module in this embodiment can be used to execute step S30 in this application embodiment, the third determination module in this embodiment can be used to execute step S40 in this application embodiment, the first correction module in this embodiment can be used to execute step S50 in this application embodiment, and the second correction module in this embodiment can be used to execute step S60 in this application embodiment.

[0077] Furthermore, the first determining module includes: The first calculation unit is used to calculate the spectral reflectance curve corresponding to each pixel in the target face image; The first acquisition unit is used to acquire a preset skin optical model and substitute the spectral reflectance curve into the preset skin optical model to obtain the melanin concentration and hemoglobin concentration corresponding to the pixel. The second calculation unit is used to calculate the average melanin concentration of each pixel to obtain the dominant melanin component. The third calculation unit is used to calculate the average value of the hemoglobin concentration corresponding to each pixel to obtain the dominant hemoglobin component.

[0078] Furthermore, the second determining module includes: The fourth calculation unit is used to calculate the concentration ratio of the melanin-dominant component to the hemoglobin-dominant component; The first execution unit is used to determine the concentration ratio as the skin color type.

[0079] Furthermore, the third determining module includes: The second acquisition unit is used to acquire the preset probability vector corresponding to the preset skin color and to acquire the concentration ratio corresponding to the skin color type. The preset probability vector includes the preset confidence level corresponding to different main skin colors. The fourth calculation unit is used to subtract the concentration ratio from the preset confidence level corresponding to each main skin color in the preset probability vector to obtain the target confidence level. The first generation unit is used to generate a target probability vector containing the target confidence scores corresponding to each main skin color. The second execution unit is used to take the target probability vector as a correction parameter.

[0080] Furthermore, the first calibration module includes: The third acquisition unit is used to acquire the target probability vector in the correction parameters and determine the confidence levels of multiple targets in the target probability vector. The fifth calculation unit is used to multiply the preset color correction matrix by the target confidence level to obtain multiple sub-matrices; The third execution unit is used to add multiple sub-matrices together to obtain the target color correction matrix.

[0081] Furthermore, the second correction module includes: The first determining unit is used to determine the rosy region in the target face image; The second determining unit is used to determine the hemoglobin concentration of the dominant hemoglobin component in the rosy pixels within the rosy region. The third determining unit is used to determine the red compensation value corresponding to the hemoglobin concentration, wherein the red compensation value is positively correlated with the hemoglobin concentration. The first compensation unit is used to compensate the red channel parameters of the target color correction matrix with red compensation values ​​to obtain a rosy color correction matrix. The first correction unit is used to correct rosy pixels using a rosy color correction matrix.

[0082] Furthermore, the first acquisition module includes: The fourth acquisition unit is used to acquire the target correction image; The first detection unit is used to perform face detection on the target correction image to obtain the face region in the target correction image; The second detection unit is used to perform region segmentation on the face area to obtain a face segmentation mask; The second generation unit is used to generate a target face image that includes the face region and the face segmentation mask.

[0083] Reference Figure 2 In terms of hardware structure, the electronic device may include components such as a communication module 10, a memory 20, and a processor 30. In the electronic device, the processor 30 is connected to both the memory 20 and the communication module 10. The memory 20 stores a computer program, which is executed by the processor 30. When the computer program is executed, it implements the steps of the above-described method embodiments.

[0084] The communication module 10 can connect to external communication devices via a network. The communication module 10 can receive requests from external communication devices and can also send requests, instructions, and information to external communication devices. External communication devices can be other electronic devices, servers, or IoT devices, such as televisions, etc.

[0085] The memory 20 can be used to store software programs and various data. The memory 20 may primarily include a program storage area and a data storage area. The program storage area may store the operating system, at least one application program required for a function (such as determining the dominant melanin and hemoglobin components in a target facial image), etc.; the data storage area may include a database, and may store data or information created based on system usage. Furthermore, the memory 20 may include high-speed random access memory, and may also include non-volatile memory, such as at least one disk storage device, flash memory device, or other volatile solid-state storage device.

[0086] The processor 30 is the control center of the electronic device. It connects various parts of the electronic device via various interfaces and lines. By running or executing software programs and / or modules stored in the memory 20, and by calling data stored in the memory 20, it performs various functions and processes data, thereby providing overall monitoring of the electronic device. The processor 30 may include one or more processing units; optionally, the processor 30 may integrate an application processor and a modem processor. The application processor mainly handles the operating system, user interface, and applications, while the modem processor mainly handles wireless communication. It is understood that the modem processor may not be integrated into the processor 30.

[0087] although Figure 2 Not shown, but the above electronic device may also include a circuit control module for connecting to a power supply to ensure the normal operation of other components. Those skilled in the art will understand that... Figure 2 The electronic device structure shown does not constitute a limitation on the electronic device and may include more or fewer components than shown, or combine certain components, or have different component arrangements.

[0088] The present invention also proposes a computer-readable storage medium having a computer program stored thereon. The computer-readable storage medium may be... Figure 2 The memory 20 in the electronic device may be at least one of ROM (Read-Only Memory) / RAM (Random Access Memory), magnetic disk, optical disk, etc. The computer-readable storage medium includes several instructions to cause a terminal device with a processor (which may be a television, automobile, mobile phone, computer, server, terminal, or network device, etc.) to execute the methods described in the various embodiments of the present invention.

[0089] In this invention, the terms "first," "second," "third," "fourth," and "fifth" are used for descriptive purposes only and should not be construed as indicating or implying relative importance. Those skilled in the art can understand the specific meaning of the above terms in this invention according to the specific circumstances.

[0090] In the description of this specification, the references to terms such as "one embodiment," "some embodiments," "example," "specific example," or "some examples," etc., indicate that a specific feature, structure, material, or characteristic described in connection with that embodiment or example is included in at least one embodiment or example of the present invention. In this specification, the illustrative expressions of the above terms do not necessarily refer to the same embodiment or example. Furthermore, the specific features, structures, materials, or characteristics described may be combined in any suitable manner in one or more embodiments or examples. Moreover, without contradiction, those skilled in the art can combine and integrate the different embodiments or examples described in this specification, as well as the features of different embodiments or examples.

[0091] Although embodiments of the present invention have been shown and described above, the scope of protection of the present invention is not limited thereto. It is understood that the above embodiments are exemplary and should not be construed as limiting the present invention. Those skilled in the art can make changes, modifications, and substitutions to the above embodiments within the scope of the present invention, and such changes, modifications, and substitutions should all be covered within the scope of protection of the present invention. Therefore, the scope of protection of the present invention should be determined by the scope of the claims.

Claims

1. A color correction method, characterized in that, The color correction method includes: Acquire the target face image; The dominant melanin component and the dominant hemoglobin component in the target face image are determined. The skin color type corresponding to the target face image is determined based on the melanin-dominant component and the hemoglobin-dominant component. Determine the correction parameters corresponding to the skin color type; The preset color correction matrix is ​​corrected using the correction parameters to obtain the target color correction matrix; The target face image is corrected using the target color correction matrix.

2. The color correction method as described in claim 1, characterized in that, The determination of the melanin-dominant component and the hemoglobin-dominant component in the target face image includes: For each pixel in the target face image, calculate the spectral reflectance curve corresponding to that pixel; A preset skin optical model is obtained, and the spectral reflectance curve is substituted into the preset skin optical model to obtain the melanin concentration and hemoglobin concentration corresponding to the pixel. The melanin dominant component is obtained by calculating the average melanin concentration corresponding to each pixel. The dominant hemoglobin component is obtained by calculating the average hemoglobin concentration corresponding to each pixel.

3. The color correction method as described in claim 1, characterized in that, The step of determining the skin color type corresponding to the target face image based on the dominant melanin component and the dominant hemoglobin component includes: Calculate the concentration ratio of the melanin-dominant component to the hemoglobin-dominant component; The concentration ratio is used as the skin color type.

4. The color correction method as described in claim 1, characterized in that, The step of determining the correction parameters corresponding to the skin color type includes: Obtain the preset probability vector corresponding to the preset skin color, and obtain the concentration ratio corresponding to the skin color type, wherein the preset probability vector includes the preset confidence level corresponding to different main skin colors; For each of the main skin colors in the preset probability vector, the target confidence level is obtained by subtracting the concentration ratio from the preset confidence level corresponding to the main skin color. Generate a target probability vector containing the target confidence scores corresponding to each main skin color; The target probability vector is used as the correction parameter.

5. The color correction method as described in claim 1, characterized in that, The step of correcting the preset color correction matrix using the correction parameters to obtain the target color correction matrix includes: Obtain the target probability vector from the correction parameters, and determine the confidence levels of multiple targets in the target probability vector; The preset color correction matrix is ​​multiplied by the target confidence level to obtain multiple sub-matrices; The target color correction matrix is ​​obtained by adding the multiple sub-matrices together.

6. The color correction method as described in claim 1, characterized in that, The step of correcting the target face image using the target color correction matrix includes: Identify the rosy region in the target face image; For the rosy pixels within the rosy region, determine the hemoglobin concentration of the dominant hemoglobin component in the rosy pixels; Determine the red compensation value corresponding to the hemoglobin concentration, wherein the red compensation value is positively correlated with the hemoglobin concentration. The red channel parameters of the target color correction matrix are compensated using the red compensation value to obtain a rosy color correction matrix; The rosy pixels are corrected using the rosy color correction matrix.

7. The color correction method as described in claim 1, characterized in that, The acquisition of the target face image includes: Acquire the target corrected image; Face detection is performed on the target correction image to obtain the face regions in the target correction image; The face region is segmented to obtain a face segmentation mask; Generate the target face image containing the face region and the face segmentation mask.

8. A color correction device, characterized in that, The color correction device includes: The first acquisition module is used to acquire the target face image; The first determining module is used to determine the melanin-dominant component and the hemoglobin-dominant component in the target face image; The second determining module is used to determine the skin color type corresponding to the target face image based on the melanin dominant component and the hemoglobin dominant component. The third determining module is used to determine the correction parameters corresponding to the skin color type; The first correction module is used to correct the preset color correction matrix using the correction parameters to obtain the target color correction matrix; The second correction module is used to correct the target face image using the target color correction matrix.

9. An electronic device, characterized in that, The electronic device includes a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the computer program, when executed by the processor, implements the steps of the color correction method 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, implements the steps of the color correction method as described in any one of claims 1 to 7.