Color control methods, devices, electronic devices and computer-readable storage media
By determining the target color temperature of the face region and calculating the color temperature offset, the problem of inaccuracy in traditional color control is solved, achieving more accurate and stable image color control.
Patent Information
- Application Number
- CN202311127526.1
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2023-09-01
- Publication Date
- 2025-10-28
- Estimated Expiration
- 2043-09-01
AI Technical Summary
Traditional color control methods suffer from inaccurate color control.
The target color temperature of the face region is determined by using the first color temperature of the image and the second color temperature of the face region. The color temperature offset and the human eye visual offset are calculated, and finally the third color temperature is determined to control the color of the image.
It enables more accurate control of image colors, taking into account color stability and color settings that conform to human visual perception, reducing the complexity of user adjustments.
Smart Images

Figure CN119562041B_ABST
Abstract
Description
Technical Field
[0001] This application relates to the field of imaging technology, and in particular to a color control method, apparatus, electronic device, and computer-readable storage medium. Background Technology
[0002] With the development of imaging technology, shooting techniques have emerged. During the shooting process, the color information of the image is controlled by the ratio of the R (Red) channel, G (Green) channel, and B (Blue) channel, thereby capturing an image with accurate colors.
[0003] However, traditional color control methods suffer from inaccurate color control. Summary of the Invention
[0004] This application provides a color control method, apparatus, electronic device, computer-readable storage medium, and computer program product that can improve the accuracy of color control.
[0005] Firstly, this application provides a color control method. The method includes:
[0006] The target color temperature of the face region is determined based on the first color temperature of the image and the second color temperature of the face region in the image.
[0007] Based on the second color temperature and the target color temperature, a color temperature offset and a human visual offset are determined; the human visual offset is the offset in human vision when the color temperature of the image is adjusted from the second color temperature to the target color temperature.
[0008] A third color temperature is determined based on the first color temperature, the color temperature offset, and the human eye visual offset; the third color temperature is used to control the color of the image.
[0009] Secondly, this application also provides a color control device. The device includes:
[0010] The target color temperature determination module is used to determine the target color temperature of the face region based on the first color temperature of the image and the second color temperature of the face region in the image.
[0011] The offset determination module is used to determine the color temperature offset and the human visual offset based on the second color temperature and the target color temperature; the human visual offset is the offset in human vision when the color temperature of the image is adjusted from the second color temperature to the target color temperature.
[0012] The third color temperature determination module is used to determine a third color temperature based on the first color temperature, the color temperature offset, and the human eye visual offset; the third color temperature is used to control the color of the image.
[0013] Thirdly, this application also provides an electronic device. The electronic device includes a memory and a processor, the memory storing a computer program, and the processor executing the computer program to perform the following steps:
[0014] The target color temperature of the face region is determined based on the first color temperature of the image and the second color temperature of the face region in the image.
[0015] Based on the second color temperature and the target color temperature, a color temperature offset and a human visual offset are determined; the human visual offset is the offset in human vision when the color temperature of the image is adjusted from the second color temperature to the target color temperature.
[0016] A third color temperature is determined based on the first color temperature, the color temperature offset, and the human eye visual offset; the third color temperature is used to control the color of the image.
[0017] Fourthly, this application also provides a computer-readable storage medium. The computer-readable storage medium stores a computer program thereon, which, when executed by a processor, performs the following steps:
[0018] The target color temperature of the face region is determined based on the first color temperature of the image and the second color temperature of the face region in the image.
[0019] Based on the second color temperature and the target color temperature, a color temperature offset and a human visual offset are determined; the human visual offset is the offset in human vision when the color temperature of the image is adjusted from the second color temperature to the target color temperature.
[0020] A third color temperature is determined based on the first color temperature, the color temperature offset, and the human eye visual offset; the third color temperature is used to control the color of the image.
[0021] Fifthly, this application also provides a computer program product. The computer program product includes a computer program that, when executed by a processor, performs the following steps:
[0022] The target color temperature of the face region is determined based on the first color temperature of the image and the second color temperature of the face region in the image.
[0023] Based on the second color temperature and the target color temperature, a color temperature offset and a human visual offset are determined; the human visual offset is the offset in human vision when the color temperature of the image is adjusted from the second color temperature to the target color temperature.
[0024] A third color temperature is determined based on the first color temperature, the color temperature offset, and the human eye visual offset; the third color temperature is used to control the color of the image.
[0025] The aforementioned color control method, apparatus, electronic device, computer-readable storage medium, and computer program product, wherein the electronic device determines the target color temperature of a face region in the image based on a first color temperature of the image and a second color temperature of the face region in the image; and determines a color temperature offset and a human visual offset based on the second color temperature of the face region in the image and the target color temperature of the face region, wherein the human visual offset is the offset in human vision when the color temperature of the image is adjusted from the second color temperature to the target color temperature; therefore, based on the first color temperature, the color temperature offset, and the human visual offset, a third color temperature can be determined more accurately, thereby allowing for more accurate control of the image color using the third color temperature. Attached Figure Description
[0026] To more clearly illustrate the technical solutions in 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.
[0027] Figure 1 Here is a flowchart of a color control method in one embodiment;
[0028] Figure 2 A flowchart of a color control method in another embodiment;
[0029] Figure 3 This is a structural block diagram of a color control device in one embodiment;
[0030] Figure 4 This is a diagram of the internal structure of an electronic device in one embodiment. Detailed Implementation
[0031] To make the objectives, technical solutions, and advantages of this application clearer, the following detailed description is provided in conjunction with the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are merely illustrative and not intended to limit the scope of this application.
[0032] In one embodiment, such as Figure 1As shown, a color control method is provided. This embodiment illustrates the application of this method to an electronic device, which can be a terminal or a server. It is understood that this method can also be applied to a system including both a terminal and a server, and implemented through interaction between the terminal and the server. The terminal can be, but is not limited to, various personal computers, laptops, smartphones, tablets, IoT devices, and portable wearable devices. IoT devices can include smart speakers, smart TVs, smart air conditioners, smart in-vehicle devices, smart cars, etc. Portable wearable devices can include smartwatches, smart bracelets, head-mounted devices, etc. The server can be a standalone server or a server cluster consisting of multiple servers.
[0033] In this embodiment, the color control method includes the following steps:
[0034] Step S102: Determine the target color temperature of the face region based on the first color temperature of the image and the second color temperature of the face region in the image.
[0035] Here, the screen image is the image displayed on the screen of an electronic device. Optionally, the screen image can be an image of the entire screen displayed on the screen, i.e., a full-screen image, or it can be an image of a portion of the screen displayed on the screen.
[0036] Color temperature is a unit of measurement that indicates the color components contained in light. Theoretically, blackbody temperature refers to the color of an absolute blackbody after it has been heated from absolute zero (-273°C). When heated, a blackbody gradually changes from black to red, then to yellow, then to white, and finally emits blue light. When heated to a certain temperature, the spectral composition of the light emitted by the blackbody is called the color temperature at that temperature, and the unit of measurement is "K" (Kelvin).
[0037] The first color temperature is the color temperature of the image, the second color temperature is the color temperature of the face region, and the target color temperature is the desired color temperature of the face region determined based on the first and second color temperatures. The image may include one or more face regions, and each face region may include one or more faces.
[0038] Optionally, the electronic device estimates the color temperature of the image to determine a first color temperature; estimates the color temperature of the face region in the image to determine a second color temperature; and determines a target color temperature for the face region based on the first and second color temperatures.
[0039] In one implementation, the electronic device uses a color temperature estimation algorithm to estimate the color temperature of the image and determine a first color temperature of the image; it also uses a color temperature estimation algorithm to estimate the color temperature of the face region in the image and determine a second color temperature of the face region.
[0040] In another embodiment, the electronic device acquires a first correspondence between color information and color temperature for a screen image, and acquires a second correspondence between color and color temperature for a face region; it collects color information of the screen image, matches the color information of the screen image with the first correspondence, and determines the first color temperature corresponding to the color information of the screen image; it collects color information of the face region, matches the color information of the face region with the second correspondence, and determines the second color temperature corresponding to the color information of the face region.
[0041] Among them, the scene of the image can be determined based on the color information of the image, such as indoor scene, outdoor scene, sunny scene, cloudy scene, partly cloudy scene, night scene, sunset scene, front lighting scene, backlighting scene, high dynamic range scene or low dynamic range scene, etc.; the color temperature state of the face can be determined based on the color information of the face region, such as single color temperature, mixed color temperature, high color temperature, low color temperature or medium color temperature, etc.
[0042] If both the first and second correspondences are discrete data pairs, and the color information of the image or the color information of the face region does not match the corresponding discrete data pair, then linear interpolation can be performed using the fitted curve.
[0043] For example, in the first correspondence, the color information corresponding to a color temperature of 6500K is 1.0, and the color information corresponding to a color temperature of 5000K is 0.8. If the color information of the image is 0.95, then linear interpolation is performed using the fitted curve to determine the color information of the image as 6500*((0.95-0.8) / (1-0.8))+5500*((1-0.95) / (1-0.8))=6250.
[0044] The calibration method for the first correspondence includes: calibrating the color temperature information of the light source through a standard light source light box. For example, under the light source conditions of color temperatures of 7500K, 6500K, 5000K, 4100K, 4000K, 2800K, and 2300K, for each light source, the electronic device measures a gray card with 18% reflectivity captured by the camera sensor to obtain the corresponding color information (R / G / B), and establishes the first correspondence between the color temperature of the light source and the corresponding color information.
[0045] The second correspondence calibration method includes: calibrating the color temperature information of the light source through a standard light source light box. For example, under the light source states of color temperatures of 7500K, 6500K, 5000K, 4100K, 4000K, 2800K, and 2300K, for each light source, the electronic device measures the face image card captured by the camera sensor to obtain the corresponding color information (R / G / B) and establishes the second correspondence between the color temperature of the light source and the corresponding color information.
[0046] Understandably, electronic devices can obtain more facial color and distribution information, which can be used for accurate reproduction of facial colors and control and adjustment of facial color stability.
[0047] Step S104: Based on the second color temperature and the target color temperature, determine the color temperature offset and the human visual offset; the human visual offset is the offset in human vision when the color temperature of the image is adjusted from the second color temperature to the target color temperature.
[0048] Color temperature offset is the amount of offset in the face area from the second color temperature to the target color temperature. Human visual offset is the amount of visual offset that occurs when the color temperature of an image is adjusted from the second color temperature to the target color temperature. It's understandable that both the image and the face area are in the RGB color space. The first color temperature of the image is 6500K, the second color temperature of the face area is 3000K, and the target color temperature of the face area is 5000K. Within this coordinate system, the color temperature offset ΔCCT is 2000K. Extensive experiments with human vision and psychology have shown that after electronic devices convert both the image and face area from the RGB color space to the human visual space LMS, if the second color temperature of the face area is adjusted from 3000K to the target color temperature of 5000K, the human eye will perceive an adaptive color temperature adjustment of 150K. This 150K is the human visual offset, meaning that the color temperature of the face area appears to the human eye as 5150K, exceeding the target color temperature of 5000K. Therefore, when adjusting the color temperature, the human visual offset must be considered to more accurately control the image's color.
[0049] The human visual space LMS (Long, Short, Middle) is a color space represented by the responses of the three cones of the human eye, named for their responsivity (sensitivity) peaks at long, medium, and short wavelengths. Radiation in the visible light range, either directly from a light source or indirectly from a surface, produces color stimuli, which generate color values—color values—in the three cones of the human visual organ. In subsequent bodily processes, this is perceived as hue. The term "tristimulus" is used for the "stimulus" response of the color center, although the term is used for modified normalized valence. Each eye's color receptors have individual spectral sensitivities; during perception, it is shaped into a specific sensory impression in the nervous system. This applies to every eye, whether animal or human, and subsequently to the neural apparatus. Every person with normal color has three types of "color-sensitive" cones. These are the locations of the sensitivity maxima of what are called the L, M, and S cones.
[0050] Optionally, the electronic device performs difference processing on the second color temperature and the target color temperature to determine the color temperature offset. For example, if the second color temperature of the face area is 3000K and the target color temperature of the face area is 5000K, then the color temperature offset for adjusting the color temperature of the face area from the second color temperature to the target color temperature is ΔCCT = 2000K.
[0051] Alternatively, electronic devices can also use other methods, such as multiplying the target color temperature by an influence factor, and then performing a difference calculation on the product and the second color temperature to determine the color temperature offset; the method for determining the color temperature offset can be set as needed and is not limited here.
[0052] Optionally, the electronic device finds a second color temperature from the human eye's visual adaptation relationship and adjusts it to the target color temperature, resulting in a human eye visual offset.
[0053] Here, the human visual adaptation relationship refers to the correspondence between image color temperature adjustment and human visual offset. For example, the human visual adaptation relationship can be a lookup table of human visual offset.
[0054] Step S106: Determine the third color temperature based on the first color temperature, the color temperature offset, and the human eye visual offset; the third color temperature is used to control the color of the image.
[0055] The third color temperature is the final color temperature used to adjust the colors of the image.
[0056] Optionally, the electronic device adds the first color temperature, the color temperature offset, and the human visual offset to obtain the third color temperature, as shown in the following formula: CCT=CCT0+△CCT+△CCT-CS; where CCT is the third color temperature, CCT0 is the first color temperature, △CCT is the color temperature offset, and △CCT-CS is the human visual offset.
[0057] Alternatively, the electronic device may also use other implementation methods to determine the third color temperature, such as multiplying the color temperature offset and the human eye visual offset by a weighting coefficient and then adding the first color temperature to obtain the third color temperature; etc., without limitation.
[0058] Optionally, in photo mode, the electronic device can adjust the color of the image based on the third color temperature corresponding to the image, generating a new image. In video mode, the electronic device can adjust the color of subsequent image frames based on the third color temperature corresponding to the preceding image frame, generating a color-adjusted image in real time.
[0059] Optionally, the electronic device searches for the color compensation information corresponding to the third color temperature from the correspondence between color temperature and color compensation information, and uses the color compensation information to perform color compensation on the image to obtain the compensated target image, so as to achieve white balance in the face area of the target image.
[0060] The correspondence between color temperature and color compensation information includes at least two sets of discrete data pairs. If a discrete data pair is matched with the third color temperature from the correspondence, the color compensation information of that discrete data pair is used as the color compensation information corresponding to the third color temperature. If no discrete data pair is matched with the third color temperature from the correspondence, the at least two sets of discrete data pairs in the correspondence are interpolated to generate the color compensation information corresponding to the third color temperature. The color compensation information can be R / G / B compensation gain.
[0061] For example, if the third color temperature is 6300K and no discrete data pair is matched in the correspondence, then the two sets of discrete data pairs adjacent to the third color temperature in the correspondence are interpolated. That is, the discrete data pairs belonging to color temperature 6500K and the discrete data pairs belonging to color temperature 5000K in the correspondence are interpolated to obtain the color compensation information corresponding to the third color temperature.
[0062] The aforementioned color control method involves an electronic device determining a target color temperature for a face region based on a first color temperature of the image and a second color temperature of the face region within the image. Based on the second color temperature of the face region and the target color temperature, a color temperature offset and a visual offset are determined. This visual offset is the visual shift that occurs when the image's color temperature is adjusted from the second color temperature to the target color temperature. Therefore, based on the first color temperature, the color temperature offset, and the visual offset, a third color temperature can be determined more accurately, thereby enabling more precise control of the image's color.
[0063] Furthermore, the aforementioned color control method utilizes both the first color temperature of the image and the second color temperature of the face area within the image, taking into account the color temperature determination of both the image and the face area. This allows for a more visually pleasing color setting while maintaining color stability. Based on this third color temperature, the image's color can be controlled, meaning that the camera can more accurately reproduce the image's color information during shooting, while simultaneously ensuring both accuracy and stability.
[0064] Furthermore, when the user is taking a picture, the camera module of the electronic device can perform more accurate color reproduction in automatic mode, that is, control the color of the image based on the third color temperature, obtain a more comfortable and human eye-friendly color reproduction, and reduce the complexity of user adjustment.
[0065] In one embodiment, the electronic device may also determine the lighting position of the face area based on the first color temperature and the second color temperature, and adjust the third color temperature based on the lighting position to obtain a new third color temperature.
[0066] It is understandable that when the color temperature of the face area deviates significantly from the color temperature of the overall image, adjusting the color temperature of the face area would have a significant impact on the color temperature of the entire image, causing distortion. Therefore, electronic devices can adjust the third color temperature determined for the face area based on the lighting position of the face area.
[0067] For example, if the first color temperature of the image is 6500K and the second color temperature of the face area is 3000K, it can be determined that the lighting position of the face area is in the low color temperature area of the mixed color temperature environment; therefore, the electronic device can determine the offset of the lighting position to adjust the third color temperature and obtain a more accurate third color temperature.
[0068] In this embodiment, the electronic device distinguishes different lighting positions on the face area, which can avoid the difference in color perception between the face in shadow and in sunlight. That is, the human eye will adapt to the huge difference in color temperature between the light source and the shadow, but the difference will not be obvious to the human eye, so as to obtain a more accurate third color temperature, so as to keep the image adjusted with the new third color temperature consistent with the perception of the human eye.
[0069] Furthermore, by determining the brightness offset based on the lighting conditions of the face, we can avoid perceptual differences in the face under different lighting conditions. For example, we can avoid perceptual differences in the brightness of the face in shadow and in sunlight. In other words, the human eye will adapt to the brightness of the image. It can predict the brightness of the face in shadow, so the face will not be too bright; it can predict the brightness of the face in low light, so the face will not be too dark.
[0070] In one embodiment, determining the color temperature offset and the human visual offset based on the second color temperature and the target color temperature includes: performing difference processing on the second color temperature and the target color temperature to determine the color temperature offset; matching the second color temperature, the target color temperature, and the human visual adaptation relationship to determine the human visual offset; the human visual adaptation relationship is the correspondence between color temperature adjustment and human visual adaptation.
[0071] Optionally, the electronic device determines the visual offset corresponding to adjusting from the second color temperature to the target color temperature based on the human eye's visual adaptation relationship. The adjustment from the second color temperature to the target color temperature determines the direction of the color temperature adjustment.
[0072] For example, if the second color temperature is 2000K and the target color temperature is 5000K, then the color temperature adjustment direction from the second color temperature to the target color temperature is to increase from 2000K to 5000K; if the second color temperature is 5000K and the target color temperature is 2000K, then the color temperature adjustment direction from the second color temperature to the target color temperature is to increase from 5000K to 2000K.
[0073] Optionally, the electronic device calibrates the human visual adaptation relationship, including: the electronic device takes pictures of a gray card with 18% reflectance under at least two light sources to obtain images containing color information (R / G / B); the color temperatures of the light sources are 7500K, 6500K, 5000K, 4100K, 4000K, 2800K, and 2300K; at least two people pre-view the standard color information corresponding to the standard color temperature, and for each light source, perform color compensation on the captured image according to the state observed by the human eye, compensating the color of the image to the standard color information observed by the human eye; the difference between the human visual color temperature and the standard color temperature corresponding to the standard color information observed by the human eye, that is, the human visual offset corresponding to the adjustment of the color temperature of the light source to the standard color temperature; based on the human visual offset corresponding to the adjustment of the color temperature of each light source to the standard color temperature, the human visual adaptation relationship is calibrated.
[0074] The standard color temperature can be set as needed, such as 5000K, 4000K, etc.
[0075] For example, in a study of human visual psychology, a number of test subjects (e.g., 7-50 people) are selected to perform color reproduction calibration under different color temperature environments. For instance, with a light source of 7500K, at least two people pre-view the standard color information corresponding to a standard color temperature of 5000K. The captured image is then color-compensated according to the state observed by the human eye, adjusting the image's color to the standard color information observed by the human eye. That is, the color information observed by the human eye is compensated to the standard color information corresponding to 5000K observed by the human eye. If the color temperature corresponding to the standard color information observed by the human eye is 5500K, then 5500K - 5000K = 500K, indicating that the image color temperature is adjusted from 7500K to 5000K, and the human eye's visual offset is 500K.
[0076] Similarly, if the color temperature of the light source is 6500K and the standard color temperature is 5000K, the color temperature corresponding to the standard color information observed by the human eye is 5200K. This means that when the image color temperature is adjusted from 6500K to 5000K, the visual offset of the human eye is 200K. If the color temperature of the light source is 5000K and the standard color temperature is 5000K, the color temperature corresponding to the standard color information observed by the human eye is 5000K. This means that when the image color temperature is adjusted from 5000K to 5000K, the visual offset of the human eye is 0. If the color temperature of the light source is 4100K and the standard color temperature is 5000K, the color temperature corresponding to the standard color information observed by the human eye is 4800K. This means that when the image color temperature is adjusted from 4100K to 5000K, the visual offset of the human eye is 200K. If the color temperature of the light source is 4000K and the standard color temperature is 5000K, the standard color information observed by the human eye corresponds to a color temperature of 4700K. This means that when the image color temperature is adjusted from 4000K to 5000K, the visual offset for the human eye is 300K. If the color temperature of the light source is 2800K and the standard color temperature is 5000K, the standard color information observed by the human eye corresponds to a color temperature of 4200K. This means that when the image color temperature is adjusted from 2800K to 5000K, the visual offset for the human eye is 800K. If the color temperature of the light source is 2300K and the standard color temperature is 5000K, the standard color information observed by the human eye corresponds to a color temperature of 4000K. This means that when the image color temperature is adjusted from 2300K to 5000K, the visual offset for the human eye is 1000K.
[0077] In this embodiment, the electronic device performs difference processing on the second color temperature and the target color temperature to determine the color temperature offset; by matching the second color temperature, the target color temperature and the human eye's visual adaptive relationship, the human eye's visual offset can be determined more accurately, thereby determining the third color temperature more accurately and controlling the screen color more accurately.
[0078] In one embodiment, determining the target color temperature of a face region based on a first color temperature of the image and a second color temperature of the face region in the image includes: determining the degree of difference between the first color temperature and the second color temperature based on the first color temperature of the image and the second color temperature of the face region in the image; determining the target color temperature of the face region based on the degree of difference; the color temperature offset between the target color temperature and the second color temperature is negatively correlated with the degree of difference.
[0079] Optionally, the electronic device performs difference processing on the first color temperature of the image and the second color temperature of the face area in the image to obtain the difference between the first color temperature and the second color temperature; the difference represents the degree of difference between the first color temperature and the second color temperature, and the difference is positively correlated with the degree of difference.
[0080] Understandably, the greater the difference between the first and second color temperatures, the greater the difference between the overall color temperature of the image and the color temperature of the face area. If the color temperature offset between the target color temperature of the face area and the second color temperature is also greater, the final third color temperature will also be higher. The electronic device will then adjust the image color to a greater extent using this third color temperature, leading to distortion as the overall image, which is already significantly different from the face area, is also adjusted. Therefore, the greater the difference between the first and second color temperatures, the smaller the color temperature offset between the target color temperature and the second color temperature, meaning the determined target color temperature value is closer to the second color temperature value.
[0081] In this embodiment, the electronic device determines the degree of difference between the first color temperature and the second color temperature of the face area in the image. Then, based on the degree of difference, the target color temperature of the face area is determined so that the color temperature offset between the target color temperature and the second color temperature is negatively correlated with the degree of difference. This can avoid the problem of image distortion caused by adjusting the final image color, that is, more accurately determine the target color temperature and the final third color temperature.
[0082] In one embodiment, the method for determining the second color temperature of a face region in an image includes: detecting the skin color of the face region in the image; and determining the second color temperature of the face region based on the skin color and the color information of the face region.
[0083] It is understandable that different skin tones in a facial region result in different color temperatures for that region. Therefore, the second color temperature of a facial region can be determined more accurately by using the skin tone of that region.
[0084] Optionally, the electronic device detects the skin color of the face region in the image and determines the color temperature range corresponding to the skin color; it then uses a color temperature estimation algorithm to estimate the color temperature of the face region and determines a candidate color temperature for the face region; if the candidate color temperature is within the color temperature range corresponding to the skin color, it is used as the second color temperature of the face region; if the candidate color temperature is not within the color temperature range corresponding to the skin color, the color temperature of the face region is re-estimated until the candidate color temperature obtained from the color temperature estimation is within the color temperature range corresponding to the skin color, and then the candidate color temperature is used as the second color temperature of the face region.
[0085] In this embodiment, the electronic device detects the skin color of the face region in the image and can use skin color as an aid to estimate the color temperature of the face region, thereby more accurately determining the second color temperature of the face region.
[0086] In one embodiment, determining a third color temperature based on a first color temperature, a color temperature offset, and a human visual offset includes: determining a first weighting coefficient corresponding to the color temperature offset and a second weighting coefficient corresponding to the human visual offset; and determining the third color temperature based on the first color temperature, the color temperature offset and the corresponding first weighting coefficient, and the human visual offset and the corresponding second weighting coefficient.
[0087] The first weighting coefficient affects the magnitude of the color temperature shift, while the second weighting coefficient affects the visual shift in the human eye. Both the first and second weighting coefficients can be set as needed, and they can be the same or different.
[0088] Optionally, the electronic device multiplies the color temperature offset by the corresponding first weighting coefficient to obtain a first product, and multiplies the human visual offset by the corresponding second weighting coefficient to obtain a second product. The first color temperature, the first product, and the second product are then added together to obtain a third color temperature.
[0089] For example, if the first weighting coefficient and the second weighting coefficient are the same, the third color temperature can be calculated using the following formula: CCT=CCT0+a*(△CCT+△CCT-CS); where CCT is the third color temperature, CCT0 is the first color temperature, △CCT is the color temperature offset, △CCT-CS is the human eye visual offset, and a is the first weighting coefficient or the second weighting coefficient.
[0090] Optionally, the degree of difference between the first color temperature and the second color temperature is negatively correlated with the first weighting coefficient; the degree of difference between the first color temperature and the second color temperature is negatively correlated with the second weighting coefficient.
[0091] Understandably, the greater the difference between the first and second color temperatures, the greater the difference between the overall color temperature of the image and the color temperature of the face area. If the first or second weighting coefficient is larger, it will lead to a larger color temperature shift or a larger visual shift in the human eye, resulting in a larger final color temperature. The electronic device will then adjust the image color to a greater extent using this third color temperature, causing the overall image, which already differs significantly from the face area, to also adjust its color, leading to distortion. Therefore, the greater the difference between the first and second color temperatures, the smaller the first or second weighting coefficient should be.
[0092] Optionally, determining the first weighting coefficient corresponding to the color temperature offset and the second weighting coefficient corresponding to the human visual offset includes: determining the first weighting coefficient corresponding to the color temperature offset and the second weighting coefficient corresponding to the human visual offset based on at least one of the size of the face region in the image and the distance between the face region and the center of the image; the first weighting coefficient is positively correlated with the size and negatively correlated with the distance, the second weighting coefficient is positively correlated with the size and negatively correlated with the distance.
[0093] The size of the face region in the image can be divided into large face or small face, etc.; the distance between the face region and the center of the image can be small or large. A small distance indicates that the face region is in the center position, and a large distance indicates that the face region is in the edge position.
[0094] Optionally, the electronic device detects a face region in the image and obtains at least one of the size of the face region in the image and the distance between the face region and the center of the image. Based on at least one of the size of the face region in the image and the distance between the face region and the center of the image, it determines a first weighting coefficient corresponding to the color temperature offset and a second weighting coefficient corresponding to the human visual offset.
[0095] Optionally, the electronic device acquires a third correspondence between a first weighting coefficient and the size of the face region in the image, and the distance between the face region and the center of the image. In this third correspondence, the first weighting coefficient is positively correlated with the size and negatively correlated with the distance. If the electronic device detects the size of the face region in the image, it matches the size with the third correspondence to determine the first weighting coefficient corresponding to the size. If the electronic device detects the distance between the face region and the center of the image, it matches the distance with the third correspondence to determine the first weighting coefficient corresponding to the distance. If the electronic device detects both the size of the face region in the image and the distance between the face region and the center of the image, it matches the size and the distance with the third correspondence, and multiplies the sub-weighting coefficient corresponding to the size by the sub-weighting coefficient corresponding to the distance to obtain the first weighting coefficient corresponding to the size and the distance.
[0096] Optionally, the electronic device acquires a fourth correspondence between the second weighting coefficient and the size of the face region in the image, and the distance between the face region and the center of the image. In this fourth correspondence, the second weighting coefficient is positively correlated with the size and negatively correlated with the distance. If the electronic device detects the size of the face region in the image, it matches the size with the fourth correspondence to determine the second weighting coefficient corresponding to the size. If the electronic device detects the distance between the face region and the center of the image, it matches the distance with the fourth correspondence to determine the second weighting coefficient corresponding to the distance. If the electronic device detects both the size of the face region in the image and the distance between the face region and the center of the image, it matches the size and the distance with the fourth correspondence, and multiplies the sub-weighting coefficient corresponding to the size by the sub-weighting coefficient corresponding to the distance to obtain the second weighting coefficient corresponding to the size and the distance.
[0097] For example, for a face that is located in the center of the image and is relatively large, the first weight coefficient can be a = 0.95 * 1 * 1, where 0.95 is the sub-weight coefficient corresponding to the size, the first 1 is the sub-weight coefficient corresponding to the center position, and the second 1 indicates that there is only one face region in the image. If there are multiple face regions, the corresponding sub-weight coefficient will become smaller.
[0098] Optionally, if the image includes at least two face regions, then for each face region, the total offset of the face region is determined based on the color temperature offset of the face region and the corresponding first weighting coefficient, the human visual offset and the corresponding second weighting coefficient; and the third color temperature is determined based on the first color temperature and the total offset of the at least two face regions.
[0099] Optionally, for each face region, the electronic device multiplies the color temperature offset of the face region by the corresponding first weighting coefficient to obtain a first product, and multiplies the human visual offset by the corresponding second weighting coefficient to obtain a second product. The first product and the second product are added together to obtain the total offset of the face region. The total brightness offset of at least two face regions is averaged to obtain the averaged offset. The first color temperature is added to the averaged offset to determine the third color temperature.
[0100] For example, the image includes two face regions. The first face region is larger in size in the image, so both the first weight coefficient and the second weight coefficient of the face region are larger. The second face region is smaller in size in the image, so both the first weight coefficient and the second weight coefficient of the face region are smaller. For each face region, the electronic device multiplies the color temperature offset of the face region by the corresponding first weight coefficient to obtain a first product, and multiplies the human visual offset by the corresponding second weight coefficient to obtain a second product. Then, the first product and the second product are added together to obtain the total offset of the face region. Finally, the total offsets of the two face regions are averaged, and the first color temperature is added to the averaged offset to determine the third color temperature.
[0101] In this embodiment, the electronic device determines a first weighting coefficient corresponding to the color temperature offset and a second weighting coefficient corresponding to the human visual offset. Then, based on the first color temperature, the color temperature offset and its corresponding first weighting coefficient, and the human visual offset and its corresponding second weighting coefficient, the third color temperature can be accurately determined. Furthermore, the electronic device determines the first weighting coefficient corresponding to the color temperature offset and the second weighting coefficient corresponding to the human visual offset based on at least one of the size of the face region in the image and the distance between the face region and the center of the image. The first weighting coefficient is positively correlated with size and negatively correlated with distance; the second weighting coefficient is positively correlated with size and negatively correlated with distance. This allows for a more accurate determination of the first and second weighting coefficients, thereby more accurately determining the third color temperature.
[0102] In one embodiment, such as Figure 2 As shown, when an electronic device detects a face in an image, it statistically analyzes the R / G / B color information of the image and the face region. Based on the R / G / B color information of the image, it determines the R / G ratio and B / G ratio of the image and calculates the first color temperature of the image. For the face region, it determines the R / G ratio and B / G ratio, normalizes the pixels of the image, and calculates the second color temperature of the face region based on the normalized face region, its R / G ratio and B / G ratio, and a lookup table of skin color and color temperature ranges.
[0103] Understandably, electronic devices first normalize the pixels of the image, which makes the pixel data of the face area more concentrated after normalization, and can more accurately estimate the second color temperature of the face area.
[0104] The electronic device determines the target color temperature of the face region based on the first color temperature of the image and the second color temperature of the face region in the image; it determines the color temperature offset based on the second color temperature and the target color temperature of the face region; it finds the human visual offset from the second color temperature to the target color temperature from the human visual adaptation relationship; and it outputs the final third color temperature based on the first color temperature, the color temperature offset, and the human visual offset.
[0105] In one embodiment, another color control method is also provided, applied to an electronic device, comprising the following steps:
[0106] Step A1: Detect the skin color of the face area in the image.
[0107] Step A2: Determine the second color temperature of the face region based on skin color and color information of the face region.
[0108] Step A3: Determine the degree of difference between the first color temperature and the second color temperature based on the first color temperature and the second color temperature of the image.
[0109] Step A4: Determine the target color temperature for the face region based on the degree of difference; the color temperature offset between the target color temperature and the second color temperature is negatively correlated with the degree of difference.
[0110] Step A5: Perform a difference calculation on the second color temperature and the target color temperature to determine the color temperature offset.
[0111] Step A6: Match the second color temperature, the target color temperature, and the human visual adaptation relationship to determine the human visual offset. The human visual offset is the offset in human vision when the color temperature of the image is adjusted from the second color temperature to the target color temperature. The human visual adaptation relationship is the correspondence between color temperature adjustment and human visual adaptation.
[0112] Step A7: Based on at least one of the size of the face region in the image and the distance between the face region and the center of the image, determine a first weighting coefficient corresponding to the color temperature offset and a second weighting coefficient corresponding to the human visual offset; the first weighting coefficient is positively correlated with size and negatively correlated with distance, the second weighting coefficient is positively correlated with size and negatively correlated with distance; furthermore, the degree of difference between the first color temperature and the second color temperature is negatively correlated with the first weighting coefficient; the degree of difference between the first color temperature and the second color temperature is negatively correlated with the second weighting coefficient.
[0113] Step A8: Determine the third color temperature based on the first color temperature, the color temperature offset and the corresponding first weighting coefficient, and the human eye visual offset and the corresponding second weighting coefficient; the third color temperature is used to control the color of the image.
[0114] It should be understood that although the steps in the flowcharts of the embodiments described above are shown sequentially according to the arrows, these steps are not necessarily executed in the order indicated by the arrows. Unless explicitly stated herein, there is no strict order restriction on the execution of these steps, and they can be executed in other orders. Moreover, at least some steps in the flowcharts of the embodiments described above may include multiple steps or multiple stages. These steps or stages are not necessarily completed at the same time, but can be executed at different times. The execution order of these steps or stages is not necessarily sequential, but can be performed alternately or in turn with other steps or at least some of the steps or stages of other steps.
[0115] Based on the same inventive concept, this application also provides a color control device for implementing the color control method described above. The solution provided by this device is similar to the solution described in the above method; therefore, the specific limitations in one or more color control device embodiments provided below can be found in the limitations of the color control method described above, and will not be repeated here.
[0116] In one embodiment, such as Figure 3 As shown, a color control device is provided, including: a target color temperature determination module 302, an offset determination module 304, and a third color temperature determination module 306, wherein:
[0117] The target color temperature determination module 302 is used to determine the target color temperature of the face region based on the first color temperature of the image and the second color temperature of the face region in the image.
[0118] The offset determination module 304 is used to determine the color temperature offset and the human visual offset based on the second color temperature and the target color temperature; the human visual offset is the offset in human vision when the color temperature of the image is adjusted from the second color temperature to the target color temperature.
[0119] The third color temperature determination module 306 is used to determine the third color temperature based on the first color temperature, the color temperature offset, and the human eye visual offset; the third color temperature is used to control the color of the image.
[0120] The aforementioned color control device, based on the first color temperature of the image and the second color temperature of the face area in the image, determines the target color temperature of the face area; based on the second color temperature of the face area and the target color temperature of the face area, it determines the color temperature offset and the human visual offset, which is the offset in human vision when the color temperature of the image is adjusted from the second color temperature to the target color temperature; therefore, based on the first color temperature, the color temperature offset, and the human visual offset, the third color temperature can be determined more accurately, thereby enabling more accurate control of the image color.
[0121] In one embodiment, the offset determination module 304 is further configured to perform difference processing on the second color temperature and the target color temperature to determine the color temperature offset; and to match the correspondence between the second color temperature, the target color temperature and the human visual adaptation to determine the human visual offset; the human visual adaptation relationship is the correspondence between color temperature adjustment and human visual adaptation.
[0122] In one embodiment, the target color temperature determination module 302 is further configured to determine the degree of difference between the first color temperature and the second color temperature based on the first color temperature of the image and the second color temperature of the face region in the image; and determine the target color temperature of the face region according to the degree of difference; the color temperature offset between the target color temperature and the second color temperature is negatively correlated with the degree of difference.
[0123] In one embodiment, the above-mentioned device further includes a second color temperature determination module, which is used to detect the skin color of a face region in the image; and determine the second color temperature of the face region based on the skin color and the color information of the face region.
[0124] In one embodiment, the third color temperature determination module 306 is further configured to determine the first weighting coefficient corresponding to the color temperature offset and the second weighting coefficient corresponding to the human visual offset; and to determine the third color temperature based on the first color temperature, the color temperature offset and the corresponding first weighting coefficient, and the human visual offset and the corresponding second weighting coefficient.
[0125] In one embodiment, the third color temperature determination module 306 is further configured to determine a first weighting coefficient corresponding to the color temperature offset and a second weighting coefficient corresponding to the human eye visual offset based on at least one of the size of the face region in the image and the distance between the face region and the center of the image; the first weighting coefficient is positively correlated with the size and negatively correlated with the distance, the second weighting coefficient is positively correlated with the size and negatively correlated with the distance.
[0126] In one embodiment, the degree of difference between the first color temperature and the second color temperature is negatively correlated with the first weighting coefficient; the degree of difference between the first color temperature and the second color temperature is negatively correlated with the second weighting coefficient.
[0127] Each module in the aforementioned color control device can be implemented entirely or partially through software, hardware, or a combination thereof. These modules can be embedded in the processor of the electronic device in hardware form or independent of it, or stored in the memory of the electronic device in software form, so that the processor can call and execute the corresponding operations of each module.
[0128] In one embodiment, an electronic device is provided, which may be a terminal, and its internal structure diagram may be as follows: Figure 4 As shown, this electronic device includes a processor, memory, input / output interface, communication interface, display unit, and input device. The processor, memory, and input / output interface are connected via a system bus, and the communication interface, display unit, and input device are also connected to the system bus via the input / output interface. The processor provides computing and control capabilities. The memory includes a non-volatile storage medium and internal memory. The non-volatile storage medium stores the operating system and computer programs. The internal memory provides an environment for the operation of the operating system and computer programs in the non-volatile storage medium. The input / output interface is used for exchanging information between the processor and external devices. The communication interface is used for wired or wireless communication with external terminals; wireless communication can be achieved through Wi-Fi, mobile cellular networks, NFC (Near Field Communication), or other technologies. When the computer program is executed by the processor, it implements a color control method. The display unit is used to form a visually visible image and can be a display screen, a projection device, or a virtual reality imaging device. The display screen can be an LCD screen or an e-ink screen. The input device of the electronic device can be a touch layer covering the display screen, or buttons, trackballs, or touchpads set on the casing of the electronic device, or external keyboards, touchpads, or mice, etc.
[0129] Those skilled in the art will understand that Figure 4 The structure shown is merely a block diagram of a portion of the structure related to the present application and does not constitute a limitation on the electronic device to which the present application is applied. The specific electronic device may include more or fewer components than shown in the figure, or combine certain components, or have different component arrangements.
[0130] This application also provides a computer-readable storage medium. One or more non-volatile computer-readable storage media containing computer-executable instructions, which, when executed by one or more processors, cause the processors to perform the steps of a color control method.
[0131] This application also provides a computer program product containing instructions that, when run on a computer, cause the computer to execute a color control method.
[0132] It should be noted that the user information (including but not limited to user device information, user personal information, etc.) and data (including but not limited to data used for analysis, data stored, data displayed, etc.) involved in this application are all information and data authorized by the user or fully authorized by all parties, and the collection, use and processing of the relevant data must comply with relevant regulations.
[0133] Those skilled in the art will understand that all or part of the processes in the methods of the above embodiments can be implemented by a computer program instructing related hardware. The computer program can be stored in a non-volatile computer-readable storage medium, and when executed, it can include the processes of the embodiments of the above methods. Any references to memory, databases, or other media used in the embodiments provided in this application can include at least one of non-volatile and volatile memory. Non-volatile memory can include read-only memory (ROM), magnetic tape, floppy disk, flash memory, optical memory, high-density embedded non-volatile memory, resistive random access memory (ReRAM), magnetic random access memory (MRAM), ferroelectric random access memory (FRAM), phase change memory (PCM), graphene memory, etc. Volatile memory can include random access memory (RAM) or external cache memory, etc. By way of illustration and not limitation, RAM can take many forms, such as Static Random Access Memory (SRAM) or Dynamic Random Access Memory (DRAM). The databases involved in the embodiments provided in this application may include at least one type of relational database and non-relational database. Non-relational databases may include, but are not limited to, blockchain-based distributed databases. The processors involved in the embodiments provided in this application may be general-purpose processors, central processing units, graphics processing units, digital signal processors, programmable logic devices, quantum computing-based data processing logic devices, etc., and are not limited to these.
[0134] The technical features of the above embodiments can be combined in any way. For the sake of brevity, not all possible combinations of the technical features in the above embodiments are described. However, as long as there is no contradiction in the combination of these technical features, they should be considered to be within the scope of this specification.
[0135] The embodiments described above are merely illustrative of several implementation methods of this application, and while the descriptions are specific and detailed, they should not be construed as limiting the scope of this patent application. It should be noted that those skilled in the art can make various modifications and improvements without departing from the concept of this application, and these all fall within the protection scope of this application. Therefore, the protection scope of this application should be determined by the appended claims.
Claims
1. A color control method, characterized in that, include: The target color temperature of the face region is determined based on the first color temperature of the image and the second color temperature of the face region in the image. Based on the second color temperature and the target color temperature, a color temperature offset and a human visual offset are determined; the human visual offset is the offset in human vision when the color temperature of the image is adjusted from the second color temperature to the target color temperature. A third color temperature is determined based on the first color temperature, the color temperature offset, and the human eye visual offset; the third color temperature is used to control the color of the image.
2. The method according to claim 1, characterized in that, The step of determining the color temperature offset and the human visual offset based on the second color temperature and the target color temperature includes: The second color temperature and the target color temperature are compared to determine the color temperature offset. The second color temperature, the target color temperature, and the human visual adaptation relationship are matched to determine the human visual offset; the human visual adaptation relationship is the correspondence between color temperature adjustment and human visual adaptation.
3. The method according to claim 1, characterized in that, The determination of the target color temperature of the face region based on the first color temperature of the image and the second color temperature of the face region in the image includes: Based on the first color temperature of the image and the second color temperature of the face region in the image, determine the degree of difference between the first color temperature and the second color temperature; Based on the degree of difference, a target color temperature for the face region is determined; the color temperature offset between the target color temperature and the second color temperature is negatively correlated with the degree of difference.
4. The method according to claim 1, characterized in that, The method for determining the second color temperature of the facial region in the image includes: Detect the skin color of the face region in the image; Based on the skin color and the color information of the face region, a second color temperature of the face region is determined.
5. The method according to claim 1, characterized in that, The step of determining the third color temperature based on the first color temperature, the color temperature offset, and the human eye visual offset includes: Determine the first weighting coefficient corresponding to the color temperature offset and the second weighting coefficient corresponding to the human visual offset; The third color temperature is determined based on the first color temperature, the color temperature offset and the corresponding first weighting coefficient, and the human eye visual offset and the corresponding second weighting coefficient.
6. The method according to claim 5, characterized in that, Determining the first weighting coefficient corresponding to the color temperature offset and the second weighting coefficient corresponding to the human visual offset includes: Based on at least one of the size of the face region in the image and the distance between the face region and the center of the image, a first weighting coefficient corresponding to the color temperature offset and a second weighting coefficient corresponding to the human eye visual offset are determined; the first weighting coefficient is positively correlated with the size and negatively correlated with the distance, the second weighting coefficient is positively correlated with the size and negatively correlated with the distance.
7. The method according to claim 5, characterized in that, The degree of difference between the first color temperature and the second color temperature is negatively correlated with the first weighting coefficient; the degree of difference between the first color temperature and the second color temperature is negatively correlated with the second weighting coefficient.
8. A color control device, characterized in that, include: The target color temperature determination module is used to determine the target color temperature of the face region based on the first color temperature of the image and the second color temperature of the face region in the image. The offset determination module is used to determine the color temperature offset and the human visual offset based on the second color temperature and the target color temperature; the human visual offset is the offset in human vision when the color temperature of the image is adjusted from the second color temperature to the target color temperature. The third color temperature determination module is used to determine a third color temperature based on the first color temperature, the color temperature offset, and the human eye visual offset; the third color temperature is used to control the color of the image.
9. An electronic device comprising a memory and a processor, wherein the memory stores a computer program, characterized in that, When the computer program is executed by the processor, the processor performs the steps of the color control method as described in any one of claims 1 to 7.
10. A computer-readable storage medium having a computer program stored thereon, characterized in that, When the computer program is executed by a processor, it implements the steps of the method as described in any one of claims 1 to 7.
Citation Information
Patent Citations
White balance correction method based on skin color information and image processing device thereof
CN110392245A
Method and device for controlling white balance function of electronic device
US20200053332A1