CN115002437A - White balance processing method and device, and storage medium - Google Patents

White balance processing method and device, and storage medium Download PDF

Info

Publication number
CN115002437A
CN115002437A CN202110231613.6A CN202110231613A CN115002437A CN 115002437 A CN115002437 A CN 115002437A CN 202110231613 A CN202110231613 A CN 202110231613A CN 115002437 A CN115002437 A CN 115002437A
Authority
CN
China
Prior art keywords
color temperature
color
different
determining
category
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Pending
Application number
CN202110231613.6A
Other languages
Chinese (zh)
Inventor
林威丞
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Beijing Xiaomi Mobile Software Co Ltd
Original Assignee
Beijing Xiaomi Mobile Software Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Beijing Xiaomi Mobile Software Co Ltd filed Critical Beijing Xiaomi Mobile Software Co Ltd
Priority to CN202110231613.6A priority Critical patent/CN115002437A/en
Publication of CN115002437A publication Critical patent/CN115002437A/en
Pending legal-status Critical Current

Links

Images

Landscapes

  • Color Television Image Signal Generators (AREA)
  • Processing Of Color Television Signals (AREA)

Abstract

The disclosure relates to a white balance processing method and device and a storage medium. The method comprises the following steps: when a plurality of color temperature light sources exist in a shooting environment, acquiring color statistic points in different color temperature areas on a two-dimensional plane; determining weights of different color temperature areas according to the color statistic points in the different color temperature areas; determining a white balance gain value of the image to be processed based on the color statistic points in different color temperature areas and the weights of different color temperature areas; and carrying out white balance processing on the image to be processed based on the white balance gain value to obtain a processed image. The embodiment of the disclosure can obtain the accurate white balance gain value of the image to be processed under the scene of a plurality of color temperature light sources, so that the image to be processed shows the correct imaging color.

Description

White balance processing method and device, and storage medium
Technical Field
The present disclosure relates to the field of information processing technologies, and in particular, to a white balance processing method and apparatus, and a storage medium.
Background
The white balance function is a basic function in the image processing of the camera and is used for correcting color deviation of an image to be processed under different light sources. For example, the white balance function may determine a white balance gain corresponding to the light source, and adjust three primary colors of red, green, and blue of the image to be processed based on the white balance gain, so that a white object in the shooting scene appears white in the image to be processed.
When a plurality of color temperature light sources exist in a shooting environment, the existing white balance function can only estimate the color temperature of one light source as a basis for correcting the color cast of an image, and cannot be applied to a plurality of color temperature light source scenes, and even cannot determine the white balance gain value of an image to be processed under the plurality of color temperature light source scenes.
Disclosure of Invention
The disclosure provides a white balance processing method and device and a storage medium.
According to a first aspect of the embodiments of the present disclosure, there is provided a white balance processing method including:
when a plurality of color temperature light sources exist in a shooting environment, acquiring color statistic points in different color temperature areas on a two-dimensional plane;
determining weights of different color temperature areas according to the color statistic points in the different color temperature areas;
determining a white balance gain value of the image to be processed based on the color statistic points in different color temperature areas and the weights of different color temperature areas;
and carrying out white balance processing on the image to be processed based on the white balance gain value to obtain a processed image.
In some embodiments, the method further comprises:
segmenting and converting the image to be processed to obtain a plurality of color statistics values;
mapping the color statistic value to the two-dimensional plane to obtain a plurality of color statistic points;
and when a plurality of color statistical points are simultaneously positioned in different color temperature areas on the two-dimensional plane, determining that the shooting environment has a plurality of color temperature light sources.
In some embodiments, the determining weights of the different color temperature regions according to the color statistic points in the different color temperature regions includes:
determining the color temperature mixing degree of two color temperature areas in different color temperature areas based on the color statistic points in different color temperature areas;
determining color temperature category proportions of two color temperature areas in different color temperature areas based on the color statistic points in the different color temperature areas;
determining mixing category weights corresponding to the color temperature mixing degrees of two color temperature areas in different color temperature areas based on the color temperature mixing degree and preset adaptation parameters;
determining weights of different color temperature regions based on the color temperature category specific gravity and the mixed category weight.
In some embodiments, the different color temperature regions include: a first color temperature region, a second color temperature region and a third color temperature region;
the mixing degree of the color temperatures of two color temperature regions in the different color temperature regions comprises: a first and second color temperature mixedness of the first and second color temperature zones;
the determining the color temperature mixing degree of two color temperature areas in different color temperature areas based on the color statistic points located in different color temperature areas comprises:
when the first total number of the color counting points in the first color temperature area and the second total number of the color counting points in the second color temperature area are both preset total numbers, determining that the first color temperature mixing degree and the second color temperature mixing degree are preset mixing degrees;
when the first total number is greater than or equal to the second total number and neither the first total number nor the second total number is the preset total number, determining the first and second color temperature mixedness based on the first total number;
determining the first and second color temperature mixes based on the second total number when the first total number is less than the second total number.
In some embodiments, the method further comprises:
summing the first total number and the second total number to obtain a first summation value;
the determining the first and second color temperature mixes based on the first total number includes:
determining the first and second color temperature mixedness based on a ratio between twice the first total number and the first summation value;
said determining said first and second color temperature mixes based on said second total includes:
determining the first and second degrees of color temperature mixing based on a ratio between twice the second total and the first summation value.
In some embodiments, the different color temperature regions include: a first color temperature region, a second color temperature region and a third color temperature region;
the color temperature category proportions of two color temperature regions in the different color temperature regions comprise: a first and second color temperature category specific gravity of the first and second color temperature regions;
the determining of the color temperature category specific gravity of two color temperature regions in different color temperature regions based on the color statistic points located in different color temperature regions comprises:
summing the color statistical points in the first color temperature area and the color statistical points in the second color temperature area to obtain a second sum value;
summing the color statistic points in the first color temperature region, the color statistic points in the second color temperature region and the color statistic points in the third color temperature region to obtain a third sum value;
determining the first and second color temperature class ratios based on a ratio between the second summation value and the third summation value.
In some embodiments, the regions of different color temperatures include: a first color temperature region, a second color temperature region and a third color temperature region;
the color temperature mixing degree of the two color temperature regions includes: a first second color temperature mixing degree;
the mixed category weights comprise: a first color temperature class weight corresponding to the first color temperature and a second color temperature and a third color temperature class weight corresponding to the first color temperature and the second color temperature;
the determining the mixing class weights corresponding to the color temperature mixedness of two color temperature regions in different color temperature regions based on the color temperature mixedness and preset adaptation parameters comprises:
determining a first color temperature class weight corresponding to a first color temperature and a second color temperature based on a first color temperature mixing degree, a third color temperature adaptation parameter corresponding to the first color temperature and a first color temperature adaptation parameter corresponding to the first color temperature and a second color temperature in preset adaptation parameters;
determining a second color temperature class weight corresponding to the first and second color temperatures based on the first and second color temperature mixing degrees, a third color temperature adaptation parameter corresponding to the first and second color temperatures in preset adaptation parameters, and a second color temperature adaptation parameter corresponding to the first and second color temperatures in preset adaptation parameters;
and determining a third color temperature class weight corresponding to the first and second color temperatures based on a third color temperature adaptation parameter corresponding to the first and second color temperatures in preset adaptation parameters.
In some embodiments, the regions of different color temperatures include: a first color temperature region, a second color temperature region and a third color temperature region;
the mixed category weights include: a first color temperature class weight corresponding to a first second color temperature, a first color temperature class weight corresponding to a first third color temperature, and a first color temperature class weight corresponding to a second third color temperature;
the color temperature category weights include: a category specific gravity of the first second color temperature, a category specific gravity of the first third color temperature, and a category specific gravity of the second third color temperature;
the weights of the different color temperature regions include: a weight of the first color temperature zone;
the determining weights of different color temperature regions based on the color temperature category specific gravity and the mixed category weight comprises:
determining the weight of the first color temperature region based on the first color temperature category weight corresponding to the first color temperature, the first color temperature category weight corresponding to the second color temperature, the category specific gravity of the first color temperature and the category specific gravity of the second color temperature.
In some embodiments, the method further comprises:
acquiring a calibration area on the two-dimensional plane, wherein calibration points of different light sources on the two-dimensional plane are all in the calibration area;
dividing the calibration area according to the color temperatures of different light sources to obtain different color temperature areas;
the calibration area is the sum of areas with different color temperatures, and the areas with different color temperatures are not overlapped.
In some embodiments, the dividing the calibration area according to the color temperatures of different light sources to obtain different color temperature areas includes:
dividing an area where a calibration point of a light source located in a first color temperature range is located into first color temperature areas;
dividing the area where the calibration point of the light source in the second color temperature range is located into a second color temperature area;
dividing the area where the calibration point of the light source in the third color temperature range is located into a third color temperature area;
and the color temperature value in the first color temperature range, the color temperature value in the second color temperature range and the color temperature value in the third color temperature range are different.
In some embodiments, the white balance processing the image to be processed based on the white balance gain value to obtain a processed image includes:
and obtaining the processed image based on a first color gain value, a second color gain value and a third color gain value in the white balance gain and color components of the image to be processed under three different colors.
According to a second aspect of the embodiments of the present disclosure, there is provided a white balance processing apparatus including:
the device comprises a first acquisition module, a second acquisition module and a third acquisition module, wherein the first acquisition module is configured to acquire color statistic points in different color temperature areas on a two-dimensional plane when a plurality of color temperature light sources exist in a shooting environment;
the first determining module is configured to determine weights of different color temperature areas according to the color statistic points in the different color temperature areas;
the second determination module is configured to determine a white balance gain value of the image to be processed based on the color statistic points in different color temperature areas and the weights of different color temperature areas;
and the second acquisition module is configured to perform white balance processing on the image to be processed based on the white balance gain value to obtain a processed image.
In some embodiments, the apparatus further comprises:
the segmentation and conversion module is configured to segment and convert the image to be processed to obtain a plurality of color statistics values;
the third acquisition module is configured to map the color statistic value to the two-dimensional plane to obtain a plurality of color statistic points;
and the third determining module is configured to determine that the shooting environment has a plurality of color temperature light sources when a plurality of the color statistical points are simultaneously positioned in different color temperature areas on the two-dimensional plane.
In some embodiments, the first determining module comprises:
the first determining submodule is configured to determine the color temperature mixing degree of two color temperature areas in different color temperature areas based on the color statistic points located in the different color temperature areas;
the second determining submodule is configured to determine color temperature category proportions of two color temperature areas in different color temperature areas based on the color statistic points located in the different color temperature areas;
the third determining submodule is configured to determine mixing category weights corresponding to the color temperature mixing degrees of two color temperature areas in different color temperature areas based on the color temperature mixing degree and a preset adaptation parameter;
a fourth determination submodule configured to determine weights of different color temperature regions based on the color temperature category specific gravity and the mixed category weight.
In some embodiments, the different color temperature regions include: a first color temperature region, a second color temperature region and a third color temperature region;
the mixing degree of the color temperatures of two color temperature regions in the different color temperature regions comprises: a first and second color temperature mixing degrees in the first and second color temperature ranges;
the first determining submodule is further configured to determine that the first and second color temperature mixedness is a preset mixedness when a first total number of the color statistic points located in the first color temperature region and a second total number of the color statistic points located in the second color temperature region are both preset total numbers; when the first total number is greater than or equal to the second total number and neither the first total number nor the second total number is the preset total number, determining the first and second color temperature mixedness based on the first total number; determining the first and second color temperature mixes based on the second total number when the first total number is less than the second total number.
In some embodiments, the apparatus further comprises:
the fourth obtaining module is configured to sum the first total number and the second total number to obtain a first sum value;
the first determination submodule is further configured to determine the first second color temperature mixture degree based on a ratio between twice the first total number and the first summation value; determining the first and second degrees of color temperature mixing based on a ratio between twice the second total and the first summation value.
In some embodiments, the different color temperature regions include: a first color temperature region, a second color temperature region and a third color temperature region;
the color temperature category proportions of two color temperature regions in the different color temperature regions comprise: a first and second color temperature category specific gravity of the first and second color temperature regions;
the second determining submodule is further configured to sum the color statistical points located in the first color temperature region and the color statistical points located in the second color temperature region to obtain a second sum value; summing the color statistic points in the first color temperature region, the color statistic points in the second color temperature region and the color statistic points in the third color temperature region to obtain a third sum value; determining the first and second color temperature class ratios based on a ratio between the second summation value and the third summation value.
In some embodiments, the regions of different color temperatures include: a first color temperature region, a second color temperature region and a third color temperature region;
the color temperature mixing degree of the two color temperature regions includes: a first second color temperature mixing degree;
the mixed category weights comprise: a first color temperature class weight corresponding to the first color temperature and a second color temperature and a third color temperature class weight corresponding to the first color temperature and the second color temperature;
the third determining sub-module is further configured to determine a first color temperature category weight corresponding to the first and second color temperatures based on the first and second color temperature mixture degrees, a third color temperature adaptation parameter corresponding to the first and second color temperatures in preset adaptation parameters, and a first color temperature adaptation parameter corresponding to the first and second color temperatures in preset adaptation parameters; determining a second color temperature class weight corresponding to the first and second color temperatures based on the first and second color temperature mixing degrees, a third color temperature adaptation parameter corresponding to the first and second color temperatures in preset adaptation parameters, and a second color temperature adaptation parameter corresponding to the first and second color temperatures in preset adaptation parameters; and determining a third color temperature class weight corresponding to the first and second color temperatures based on a third color temperature adaptation parameter corresponding to the first and second color temperatures in preset adaptation parameters.
In some embodiments, the regions of different color temperatures include: a first color temperature region, a second color temperature region and a third color temperature region;
the mixed category weights include: a first color temperature category weight corresponding to a first second color temperature, a first color temperature category weight corresponding to a first third color temperature and a first color temperature category weight corresponding to a second third color temperature;
the color temperature category weights include: a category specific gravity of the first second color temperature, a category specific gravity of the first third color temperature, and a category specific gravity of the second third color temperature;
the weights for the different color temperature regions include: a weight of the first color temperature zone;
the fourth determination submodule is further configured to determine the weight of the first color temperature region based on a first color temperature category weight corresponding to the first and second color temperatures, a first color temperature category weight corresponding to the first and third color temperatures, a first color temperature category weight corresponding to the second and third color temperatures, a category specific gravity of the first and second color temperatures, a category specific gravity of the first and third color temperatures, and a category specific gravity of the second and third color temperatures.
In some embodiments, the apparatus further comprises:
a fifth obtaining module, configured to obtain a calibration region on the two-dimensional plane, where calibration points of different light sources on the two-dimensional plane are all in the calibration region;
the sixth acquisition module is configured to divide the calibration area according to the color temperatures of different light sources to obtain different color temperature areas;
the calibration area is the sum of areas with different color temperatures, and the areas with different color temperatures are not overlapped.
In some embodiments, the sixth obtaining module is further configured to divide an area where the calibration point of the light source located within the first color temperature range is located into a first color temperature area; dividing the area where the calibration point of the light source located in the second color temperature range is located into a second color temperature area; dividing the area where the calibration point of the light source in the third color temperature range is located into a third color temperature area; the color temperature value in the first color temperature range, the color temperature value in the second color temperature range and the color temperature value in the third color temperature range are different.
In some embodiments, the second obtaining module is further configured to obtain the processed image based on a first color gain value, a second color gain value, a third color gain value of the white balance gain, and color components of the image to be processed in three different colors.
According to a third aspect of the embodiments of the present disclosure, there is provided a white balance processing apparatus including at least: a processor and a memory for storing executable instructions operable on the processor, wherein:
the processor is configured to execute the executable instructions, and the executable instructions perform the steps in the white balance processing method provided in the first aspect.
According to a fourth aspect of embodiments of the present disclosure, there is provided a non-transitory computer-readable storage medium having stored therein computer-executable instructions that, when executed by a processor, implement the white balance processing method as provided in the first aspect above.
The technical scheme provided by the embodiment of the disclosure can have the following beneficial effects:
in the embodiment of the disclosure, when a plurality of color temperature light sources exist in a shooting environment, color statistic points in different color temperature areas are obtained; determining the weights of different color temperature regions based on the color statistic points in the different color temperature regions; and determining a white balance gain value of the image to be processed based on the color statistical points in the different color temperature regions and the weights of the different color temperature regions. Therefore, the white balance processing method provided by the embodiment of the disclosure can be suitable for a plurality of color temperature light sources in a shooting environment, and can also determine the white balance gain value based on different color statistic points and weights of different color temperature areas, so that the accurate white balance gain value of the image to be processed can be obtained in a plurality of color temperature light source scenes, and the image to be processed can show correct imaging color.
It is to be understood that both the foregoing general description and the following detailed description are exemplary and explanatory only and are not restrictive of the disclosure.
Drawings
The accompanying drawings, which are incorporated in and constitute a part of this specification, illustrate embodiments consistent with the present disclosure and together with the description, serve to explain the principles of the disclosure.
Fig. 1 is a first flowchart illustrating a white balance processing method according to an embodiment of the present disclosure.
FIG. 2 is a schematic diagram of a calibration region shown in an embodiment of the present disclosure.
Fig. 3 is a schematic diagram of a color temperature region divided according to an embodiment of the present disclosure.
Fig. 4 is a flowchart of a white balance processing method according to an embodiment of the present disclosure.
Fig. 5 is a flowchart of a white balance processing method according to an embodiment of the present disclosure.
Fig. 6 is a first white balance processing apparatus according to an embodiment of the present disclosure.
Fig. 7 is a second white balance processing apparatus according to an embodiment of the present disclosure.
Detailed Description
Reference will now be made in detail to the exemplary embodiments, examples of which are illustrated in the accompanying drawings. When the following description refers to the accompanying drawings, like numbers in different drawings represent the same or similar elements unless otherwise indicated. The implementations described in the exemplary embodiments below are not intended to represent all implementations consistent with the present disclosure. Rather, they are merely examples of apparatus and methods consistent with certain aspects of the present disclosure, as detailed in the appended claims.
Fig. 1 is a flowchart of a white balance processing method shown in an embodiment of the present disclosure, and as shown in fig. 1, the method is applied to a terminal device having a white balance processing function, and the terminal device executes the white balance processing method, which includes the following steps:
s101, when a plurality of color temperature light sources exist in a shooting environment, acquiring color statistic points in different color temperature areas on a two-dimensional plane;
s102, determining weights of different color temperature areas according to the color statistic points in the different color temperature areas;
s103, determining a white balance gain value of the image to be processed based on the color statistic points in different color temperature areas and the weights of different color temperature areas;
and S104, carrying out white balance processing on the image to be processed based on the white balance gain value to obtain a processed image.
The terminal device is a terminal device with a white balance function, the terminal device can be a wearable electronic device and a mobile terminal, the mobile terminal comprises a mobile phone, a notebook, a tablet computer or a single camera terminal, the wearable electronic device comprises a smart watch or a smart bracelet, and the embodiment of the disclosure is not limited.
The white balance processing method is suitable for scenes with a plurality of color temperature light sources in a shooting environment. For example, there are two or three different color temperature light sources in the shooting environment.
The color temperature is a physical quantity for evaluating the color of the light source. The object is illuminated by different color temperature light sources, the presented colors are different, and further the reflected spectrum of the object has deviation compared with the real color. For example, under irradiation of a low color temperature light source such as an indoor tungsten lamp, a white object looks yellowish-orange, and the object to be photographed becomes yellowish. For example, a white object looks bluish when illuminated by a high color temperature light source such as sky blue. The terminal equipment can correct the color deviation of the image to be processed in the shooting scene of the plurality of color temperature light sources by adopting a white balance processing method, so that the processed image shows correct imaging color.
In step S101, the light sources with different color temperatures may have different color temperatures. Light sources in a photographing environment may be classified into a first color temperature light source, a second color temperature light source, and a third color temperature light source. In the embodiment of the present disclosure, each of the first color temperature light source, the second color temperature light source, and the third color temperature light source may include one or more ambient light sources.
If the color temperature value of the first color temperature light source is greater than a preset first color temperature threshold value, the first color temperature light source can be called a high color temperature light source, and the color of the high color temperature light source is biased to blue; if the color temperature value of the third color temperature light source is smaller than the preset second color temperature threshold value, the third color temperature light source can be called a low color temperature light source, and the color of the low color temperature light source is biased to yellow; if the color temperature value of the second color temperature light source is between the preset first color temperature threshold value and the preset second color temperature threshold value, the second color temperature light source can be called as a medium color temperature light source, and the color of the medium color temperature light source is biased to white.
In the embodiment of the disclosure, in the calibration area of the two-dimensional plane, different color temperature areas can be divided on the calibration area according to the actual image color requirement. For example, two or more different color temperature regions may be divided. It should be noted that the different color temperature regions do not coincide, and the calibration points of the light sources with different color temperatures are located in the different color temperature regions. For example, the calibration point of the first color temperature light source may be located within the first color temperature region; the calibration point of the second color temperature light source can be positioned in the second color temperature area; the calibration point of the third color temperature light source may be located within the third color temperature region.
It should be noted that the calibration area may be an area surrounded by calibration points of different light sources in the shooting environment. As shown in fig. 2, the light source D75, the light source D65, the light source D50, the light source TL84, the light source CWF, the light source a, and the light source H in the shooting environment are located in the calibration area 11. As shown in fig. 3, the embodiment of the present disclosure may further divide the calibration area into a high color temperature area 12, a middle color temperature area 13, and a low color temperature area 14 according to the color temperature. The color temperature value of the light source with the calibration point positioned in the high color temperature area is greater than that of the light source with the calibration point positioned in the medium color temperature area; the color temperature value of the light source with the calibration point positioned in the middle color temperature area is larger than that of the light source with the calibration point positioned in the low color temperature area.
In the embodiment of the present disclosure, being located different color temperature regions on the two-dimensional plane can include being located three different color temperature regions on the two-dimensional plane, and these three different color temperature regions include first color temperature region, second color temperature region and third color temperature region, acquire the color statistics point that is located different color temperature regions on the two-dimensional plane, can include: the sum of the color statistic points in the first color temperature region, the sum of the color statistic points in the second color temperature region, and the sum of the color statistic points in the third color temperature region are obtained.
In step S102, the number of color temperature light sources in the shooting environment is associated with the color statistic points in different color temperature regions. For example, there are two different color temperature light sources in the shooting environment, and there are color statistical points in two color temperature areas on the corresponding two-dimensional plane. For another example, there are three different color temperature light sources in the shooting environment, and there are color statistic points in the three color temperature regions on the corresponding two-dimensional plane.
In the embodiment of the disclosure, the color temperature light sources in the shooting environment are different, and the corresponding color statistic points in different color temperature regions are different, so that the embodiment of the disclosure can more accurately determine the weights of different color temperature regions according to the color statistic points in different color temperature regions.
Determining the weights of different color temperature regions according to the color statistic points in the different color temperature regions, comprising the following steps: determining the weights of different color temperature regions by comparing the sums of the color statistic points in different color temperature regions; wherein comparing the sums of the color statistics points in different color temperature regions comprises: the difference between the sums of the color statistics points in different color temperature regions or the ratio of the sums of the color statistics points in different color temperature regions are compared, and the embodiments of the present disclosure are not limited.
In step S103, after determining the weights of the different color temperature regions, the terminal device may determine a white balance gain value of the image to be processed based on the color statistic points within the different color temperature regions and the weights of the different color temperature regions. Wherein, different colour temperature regions include first colour temperature region, second colour temperature region, third colour temperature region, and based on the color statistics point in the different colour temperature regions and the weight in different colour temperature regions, the white balance gain of pending image is determined, includes:
determining a color statistical average value under a multi-color temperature light source scene based on a product between the color statistical point of the first color temperature region and the weight of the first color temperature region, a product between the color statistical point of the second color temperature region and the weight of the second color temperature region, and a product between the color statistical point of the third color temperature region and the weight of the third color temperature region; and determining the white balance gain of the image to be processed based on the color statistical average value under the scene of the multicolor temperature light source.
The color statistical average value under the multi-color temperature light source scene is determined based on the product between the color statistical point of the first color temperature region and the weight of the first color temperature region, the product between the color statistical point of the second color temperature region and the weight of the second color temperature region, and the product between the color statistical point of the third color temperature region and the weight of the third color temperature region, and the color statistical average value comprises the following steps:
firstly, determining a plurality of color statistical values of the weighted image to be processed based on the product between the color statistical point of the first color temperature region and the weight of the first color temperature region, the product between the color statistical point of the second color temperature region and the weight of the second color temperature region, and the product between the color statistical point of the third color temperature region and the weight of the third color temperature region; and determining the color statistical average value under the scene of the multi-color temperature light source based on the average value of the plurality of color statistical values of the weighted image to be processed.
Taking RgBg as an example, a to-be-processed image is composed of a plurality of red, green, and blue (RGB) pixels. After determining the color statistic under the multi-color temperature light source scene, determining a first color gain value in the white balance gain, namely an R gain value, by adopting a formula (1a), and determining a second color gain value in the white balance gain, namely a G gain value, by adopting a formula (1 b); the third color gain value, i.e., the B gain value, in the white balance gain is determined using equation (1 c). Wherein, the color statistical average value under the scene of the multi-color temperature light source comprises that the color statistical average value of an Rg axis on a two-dimensional plane is Rg avg And the statistical average value of the colors of the Bg axis on the two-dimensional plane is Bg avg
R gain value is 1/Rg avg (1a)
G gain value 1.0 (1b)
Gain value of 1/Bg avg (1c)
That is to say, in the embodiment of the present disclosure, the white balance gain value of the image to be processed is not determined directly based on the color statistical points, but the weights corresponding to different color temperature regions in different shooting environments are different in consideration of the difference of the color statistical points in the different color temperature regions, so that a more accurate white balance gain value of the image to be processed can be obtained based on the difference of the weights.
In step S104, the terminal device may perform white balance processing on the image to be processed based on the white balance gain value of the image to be processed to obtain a processed image. The white balance gain includes: a first color gain value, a second color gain value, and a third color gain value.
In some embodiments, performing white balance processing on the image to be processed based on the white balance gain value to obtain a processed image includes: and obtaining the processed image based on a first color gain value, a second color gain value and a third color gain value in the white balance gain and color components of the image to be processed under three different colors.
In the embodiment of the present disclosure, the color components of the image to be processed in three different colors include: a color component in a first color, a color component in a second color, and a color component in a third color;
obtaining the processed image based on a first color gain value, a second color gain value, a third color gain value in the white balance gain and color components of the image to be processed under three different colors, including:
the processed image is obtained based on a product of the first color gain value and the color component in the first color, a product of the second color gain value and the color component in the second color, and a product of the third color gain value and the color component in the third color.
It can be understood that, on the premise of obtaining an accurate white balance gain value of the image to be processed, the terminal device corrects the color component of the image to be processed based on the accurate white balance gain value of the image to be processed, so that the image to be processed can show correct imaging color.
In the embodiment of the disclosure, when a plurality of color temperature light sources exist in a shooting environment, color statistic points in different color temperature areas are obtained; determining the weights of different color temperature regions based on the color statistic points in the different color temperature regions; and determining the white balance gain value of the image to be processed based on the color statistic points in the different color temperature regions and the weights of the different color temperature regions. Therefore, the white balance processing method provided by the embodiment of the disclosure can be suitable for a plurality of color temperature light sources in a shooting environment, and can also determine the white balance gain value based on different color statistic points and weights of different color temperature areas, so that the accurate white balance gain value of the image to be processed can be obtained in a plurality of color temperature light source scenes, and the image to be processed can show correct imaging color.
In some embodiments, the terminal device performs the white balance processing method further including:
segmenting and converting the image to be processed to obtain a plurality of color statistics values;
mapping the color statistic value to the two-dimensional plane to obtain a plurality of color statistic points;
and when the plurality of color statistical points are simultaneously positioned in different color temperature areas on the two-dimensional plane, determining that the shooting environment has a plurality of color temperature light sources.
In the embodiment of the present disclosure, the terminal device may determine that there are a plurality of color temperature light sources in the shooting environment before step S101.
The image to be processed is an original RAW image which is not subjected to color processing, and is original data obtained by converting a light source signal captured by a CMOS or CCD image sensor into a digital signal.
It should be noted that a to-be-processed image is composed of a plurality of red, green, and blue (RGB) pixels. Segmenting and converting an image to be processed to obtain a plurality of color statistics values, wherein the color statistics values comprise: the image to be processed is divided into a plurality of squares, the average of the components at R, G, B of each square is calculated, and the average of the R, G, B components of each square is converted into a two-dimensional color space, resulting in a plurality of color statistics.
Wherein the areas of the plurality of squares may be equal, the plurality of color spaces include UV (color part of YUV), CbCr (color part of YCbCr), or RgBg, which are not limited in the embodiments of the present disclosure.
Taking RgBg as an example, the image to be processed is divided and converted to obtain a plurality of color statistics values, wherein the color statistics value R g The color statistic B can be obtained by the formula (2a) g Can be expressed by formula (2 b). Wherein R is avg Represents the average value of the square under the R component, G avg Represents the average value of the square in the G component, B avg Represents the average of the squares under the B component.
R g =R avg /G avg (2a)
B g =B avg /G avg (2b)
In the embodiment of the disclosure, the color statistic is mapped to the two-dimensional plane to obtain a plurality of color statistic points, wherein the number of the color statistic points is the same as the number of the color statistic values of the square in the image to be processed.
Taking RgBg as an example, the abscissa of the rectangular coordinate system of RgBg in the two-dimensional plane can be R g The ordinate of the rectangular coordinate system of RgBg can be B g Thus, the color statistic of each square block is mapped to the two-dimensional plane of the RgBg, and a plurality of color statistic points can be obtained.
In some embodiments, the method for the terminal device to perform white balance processing further includes:
acquiring a calibration area on the two-dimensional plane, wherein calibration points of different light sources on the two-dimensional plane are all in the calibration area;
dividing the calibration area according to the color temperatures of different light sources to obtain different color temperature areas;
the calibration area is the sum of areas with different color temperatures, and the areas with different color temperatures are not overlapped.
In the embodiment of the disclosure, the calibration area may be an area surrounded by calibration points of different light sources on a two-dimensional plane in a shooting environment. The calibration region may be located in a region surrounded by two adjacent coordinate axes of the rectangular coordinate system in the two-dimensional plane. Taking the RgBg as an example, the calibration region may be located in a positive direction of an Rg coordinate axis and a positive direction of a Bg coordinate axis in the RgBg rectangular coordinate system.
In some embodiments, the dividing the calibration region according to the color temperatures of different light sources to obtain different color temperature regions includes:
dividing an area where a calibration point of a light source located in a first color temperature range is located into first color temperature areas;
dividing the area where the calibration point of the light source located in the second color temperature range is located into a second color temperature area;
dividing the area where the calibration point of the light source located in the third color temperature range is located into a third color temperature area;
and the color temperature value in the first color temperature range, the color temperature value in the second color temperature range and the color temperature value in the third color temperature range are different.
In the embodiment of the disclosure, the different color temperature regions include a first color temperature region, a second color temperature region and a third color temperature region, the first color temperature region may include calibration points of one or more light sources having color temperatures within the first color temperature range, the second color temperature region may include calibration points of one or more light sources having color temperatures within the second color temperature range, and the third color temperature region may include calibration points of one or more light sources having color temperatures within the third color temperature range.
It should be noted that the color temperature value in the first color temperature range is greater than the color temperature value in the second color temperature range, and the color temperature value in the second color temperature range is greater than the color temperature value in the third color temperature range. For example, the first color temperature region may include: the index points of three light sources of D75 (color temperature 7500 degree K), D65 (color temperature 6500 degree K) and D50 (color temperature 5000 degree K); the second color temperature light source may include: calibration points of two light sources CWF (color temperature 4100 DEG K) and TL84 (color temperature 4000 DEG K); the third color temperature light source may include: the index points of two light sources of A (color temperature 2850 DEG K) and H (color temperature 2300 DEG K).
In the embodiment of the present disclosure, after dividing the different color temperature regions, the terminal device may determine whether the plurality of color statistic points are simultaneously located in the different color temperature regions. When a plurality of color statistic points are simultaneously located in different color temperature areas, determining that a plurality of color temperature light sources exist in the shooting environment, comprising: when a plurality of color temperature statistical points are simultaneously positioned in two different color temperature areas, determining that two color temperature light sources exist in the shooting environment; when a plurality of color temperature statistical points are simultaneously located in three different color temperature areas, three color temperature light sources are determined to be in the shooting environment.
In the embodiment of the disclosure, the terminal device can determine whether there are multiple color temperature light sources in the shooting environment by judging whether multiple color temperature statistical points are located in different color temperature regions at the same time. Therefore, the detection of a plurality of color temperature light source scenes is simpler, complex calculation is not needed, and the efficiency of sensing the light sources with different color temperatures in the shooting environment can be improved.
In some embodiments, the determining weights of different color temperature regions according to the color statistic points in different color temperature regions includes:
determining the color temperature mixing degree of two color temperature areas in different color temperature areas based on the color statistic points in different color temperature areas;
determining color temperature category proportions of two color temperature areas in different color temperature areas based on the color statistic points in the different color temperature areas;
determining mixing class weights corresponding to the color temperature mixing degrees of two color temperature regions in different color temperature regions based on the color temperature mixing degree and preset adaptation parameters;
determining weights of different color temperature regions based on the color temperature category specific gravity and the mixed category weight.
In the embodiment of the disclosure, the color statistic points in the two color temperature regions can quantify the color temperature mixing degree of the two color temperature regions. The color temperature mixedness ranges from 0.0 to 1.0. The larger the value of the color temperature mixing degree of two color temperature areas in different color temperature areas is, the smaller the difference of the total number of corresponding color statistic points in different color temperature areas is, and the more obvious the situation that different color temperature light sources form mixed color temperature is.
It should be noted that, when the different color temperature regions include three different color temperature regions, the color temperature mixing degree of two color temperature regions in the three color temperature regions can be determined by the color statistic points in the three different color temperature regions. For example, the three color temperature regions include: a first color temperature region, a second color temperature region and a third color temperature region; the first color temperature region can be a high color temperature region, the second color temperature region can be a medium color temperature region, and the third color temperature region can be a low color temperature region, so that high and medium color temperature mixing degree, high and low color temperature mixing degree or medium and medium color temperature mixing degree can be obtained correspondingly.
In an embodiment of the present disclosure, the different color temperature regions include: a first color temperature region, a second color temperature region and a third color temperature region;
the color temperature mixing degree of two color temperature regions in the different color temperature regions comprises: a first and second color temperature mixedness of the first and second color temperature zones;
in the process of determining the color temperature mixing degree of two color temperature regions, the determining the color temperature mixing degree of two color temperature regions in different color temperature regions based on the color statistic points located in different color temperature regions includes:
when the first total number of the color counting points in the first color temperature area and the second total number of the color counting points in the second color temperature area are both preset total numbers, determining that the first color temperature mixing degree and the second color temperature mixing degree are preset mixing degrees;
when the first total number is larger than or equal to the second total number and neither the first total number nor the second total number is the preset total number, determining the first and second color temperature mixing degrees based on the first total number;
determining the first and second color temperature mixes based on the second total number when the first total number is less than the second total number.
In the embodiment of the present disclosure, the predetermined mixing degree may be determined according to a predetermined total number. For example, when the preset total number is set to 0, it indicates that there are no first color temperature light source corresponding to the first color temperature region and no second color temperature light source corresponding to the second color temperature region in the shooting environment, and the preset mixedness correspondence may be set to 0.0.
In an embodiment of the disclosure, determining the first and second color temperature mixedness based on the first total number when the first total number is greater than the second total number includes: determining a first second color temperature mixture based on a difference between the first total and the second total; alternatively, the first sum value obtained by summing the first sum and the second sum determines the first and second color temperature mixture degrees based on the first sum and the first sum value, and embodiments of the present disclosure are not limited.
It should be noted that, when the first color temperature region is a high color temperature region and the second color temperature region is a low color temperature region, the high and low color temperature mixing degree can be obtained correspondingly; when the first color temperature area is a medium color temperature area and the second color temperature area is a low color temperature area, the mixing degree of medium and low color temperatures can be correspondingly obtained; when the first color temperature region is a high color temperature region and the second color temperature region is a medium color temperature region, high and medium color temperature mixing degree can be obtained correspondingly.
That is, when the different color temperature regions include a high color temperature region, a low color temperature region, and a medium color temperature region, the embodiments of the present disclosure may determine a high-low color temperature mixing degree, a medium-low color temperature mixing degree, and a high-medium color temperature mixing degree based on the color statistic points in the high color temperature region, the color statistic points in the medium color temperature region, and the color statistic points in the low color temperature region.
In some embodiments, the method further comprises: summing the first total number and the second total number to obtain a first summation value;
determining a first second color temperature mixture based on the first total number, comprising: determining the first and second color temperature mixedness based on a ratio between twice the first total number and the first summation value;
said determining said first and second color temperature mixes based on said second total includes:
determining the first and second degrees of color temperature mixing based on a ratio between twice the second total and the first summation value.
As shown in fig. 4, taking the first color temperature region as the high color temperature region and the second color temperature region as the low color temperature region as an example, the step of determining the high and low color temperature mixedness by the terminal device according to the embodiment of the present disclosure includes:
s301, judging whether the first total number of the color counting points in the high-color-temperature area and the second total number of the color counting points in the low-color-temperature area are both preset total numbers or not; if yes, go to step S302, if not, go to step S303;
step S302, determining the mixing degree of high and low color temperatures as a preset mixing degree;
step S303, judging whether the first total number is larger than or equal to the second total number; if yes, go to step S304, otherwise go to step S305;
s304, summing the first total number and the second total number to obtain a first sum value; determining a high-low color temperature mixing degree based on a ratio of twice the first total number to the first summation value;
s305, summing the first total number and the second total number to obtain a first sum value; based on the ratio between the doubled second sum and the first summation value, a high-low color temperature mixing degree is determined.
In the embodiment of the disclosure, the determination of the first and second color temperature mixtures can be applied to different situations of the first total and the second total, and the accuracy of determining the first and second color temperature mixtures is improved.
In some embodiments, the regions of different color temperatures include: a first color temperature region, a second color temperature region and a third color temperature region;
the color temperature mixing degree of the two color temperature regions includes: a first second color temperature mixing degree;
mixed category weights comprising: a first color temperature class weight corresponding to the first color temperature and a second color temperature and a third color temperature class weight corresponding to the first color temperature and the second color temperature;
the determining the mixing class weights corresponding to the color temperature mixedness of two color temperature regions in different color temperature regions based on the color temperature mixedness and preset adaptation parameters comprises:
determining a first color temperature class weight corresponding to a first color temperature based on a first second color temperature mixing degree, a third color temperature adaptation parameter corresponding to the first color temperature in preset adaptation parameters and a first color temperature adaptation parameter corresponding to the first color temperature in the preset adaptation parameters;
determining a second color temperature class weight corresponding to the first and second color temperatures based on the first and second color temperature mixing degrees, a third color temperature adaptation parameter corresponding to the first and second color temperatures in preset adaptation parameters, and a second color temperature adaptation parameter corresponding to the first and second color temperatures in preset adaptation parameters;
and determining a third color temperature class weight corresponding to the first color temperature and the second color temperature based on a third color temperature adaptation parameter corresponding to the first color temperature and the second color temperature in preset adaptation parameters.
In an embodiment of the present disclosure, when the first color temperature region is a high color temperature region, the second color temperature region is a low color temperature region, and the third color temperature region is a medium color temperature region, the corresponding mixed class weights include: high color temperature category weight corresponding to high and low color temperatures, low color temperature category weight corresponding to high and low color temperatures and medium color temperature category weight corresponding to high and low color temperatures;
when the first color temperature region is a high color temperature region, the second color temperature region is a medium color temperature region, and the third color temperature region is a low color temperature region, the corresponding mixed class weight includes: high color temperature category weight corresponding to high and medium color temperature, medium color temperature category weight corresponding to high and medium color temperature, and low color temperature category weight corresponding to high and medium color temperature;
when the first color temperature region is a middle color temperature region, the second color temperature region is a low color temperature region, and the third color temperature region is a high color temperature region, the corresponding mixed class weight includes: the color temperature classification weight comprises a medium color temperature classification weight corresponding to medium and low color temperatures, a low color temperature classification weight corresponding to medium and low color temperatures and a high color temperature classification weight corresponding to medium and low color temperatures.
In an embodiment of the present disclosure, the presetting of the adaptation parameter includes: a first color temperature adaptation parameter corresponding to the first second color temperature, a second color temperature adaptation parameter corresponding to the first second color temperature, and a third color temperature adaptation parameter corresponding to the first second color temperature; a first color temperature adaptation parameter corresponding to a first third color temperature, a second color temperature adaptation parameter corresponding to a first third color temperature, and a third color temperature adaptation parameter corresponding to a first third color temperature; a first color temperature adaptation parameter corresponding to a second third color temperature, a second color temperature adaptation parameter corresponding to a second third color temperature, and a third color temperature adaptation parameter corresponding to a second third color temperature.
It should be noted that the preset adaptive parameter may be set according to actual conditions. For example, the first color temperature adaptation parameter corresponding to the first and second color temperatures is 70, the second color temperature adaptation parameter corresponding to the first and second color temperatures is 50, and the third color temperature adaptation parameter corresponding to the first and second color temperatures is 20. For another example, the first color temperature adaptation parameter corresponding to the first third color temperature is 50, the second color temperature adaptation parameter corresponding to the first third color temperature is 70, and the third color temperature adaptation parameter corresponding to the first third color temperature is 30. For another example, the first color temperature adaptation parameter corresponding to the second third color temperature is 60, the second color temperature adaptation parameter corresponding to the second third color temperature is 40, and the third color temperature adaptation parameter corresponding to the second third color temperature is 50.
In an embodiment of the present disclosure, determining a first color temperature class weight corresponding to a first color temperature and a second color temperature based on a first color temperature mixing degree, a third color temperature adaptation parameter corresponding to the first color temperature and a first color temperature adaptation parameter corresponding to the first color temperature and a second color temperature, wherein the third color temperature adaptation parameter is a preset adaptation parameter, includes:
firstly, obtaining a difference value between a first color temperature adaptation parameter corresponding to a first color temperature and a second color temperature adaptation parameter corresponding to the first color temperature in preset adaptation parameters and a third color temperature adaptation parameter corresponding to the first color temperature and the second color temperature in the preset adaptation parameters; and finally, calculating the sum of the product and a third color temperature adaptation parameter corresponding to the first color temperature and the second color temperature in the preset adaptation parameters to obtain the first color temperature category weight corresponding to the first color temperature and the second color temperature.
For example, when the first color temperature region is a high color temperature region and the second color temperature region is a low color temperature region, formula (3) may be used to determine the high color temperature class weight corresponding to the high and low color temperatures. Wherein, the high color temperature category weight corresponding to the high and low color temperatures is HL _ H _ Wet; presetting a high color temperature adjustment parameter corresponding to high and low color temperatures in an adjustment parameter as HL _ H; the medium color temperature adaptation parameter corresponding to the medium and low color temperatures in the preset adaptation parameters is HL _ M.
HL _ H _ Wet ═ HL _ M + (HL _ H-HL _ M) × degree of mixing of high and low color temperatures (3)
When the first color temperature region is a high color temperature region and the second color temperature region is a medium color temperature region, formula (4) can be used to determine the high color temperature class weight corresponding to the high and medium color temperature. The high and medium color temperature corresponding to the high and medium color temperature category weight is HM _ H _ Wet; the preset adaptation parameter is a high color temperature adaptation parameter corresponding to the middle color temperature and is HM _ H; the preset adaptation parameter is HM _ L, wherein the low color temperature adaptation parameter corresponding to the high and medium color temperatures is HM _ L.
HM _ H _ Wet ═ HM _ L + (HM _ H-HM _ L) × high and medium color temperature mixing degree (4)
When the first color temperature region is a medium color temperature region and the second color temperature region is a low color temperature region, formula (5) may be used to determine the medium color temperature category weight corresponding to the medium and low color temperatures. The medium color temperature category weight corresponding to the medium and low color temperature is ML _ M _ Wet; the medium color temperature adaptation parameter corresponding to the medium color temperature in the preset adaptation parameter is ML _ M; the high color temperature adaptation parameter corresponding to the medium and low color temperature in the preset adaptation parameters is ML _ H.
ML _ M _ Wet ═ ML _ H + (ML _ M-ML _ H) × low and medium color temperature mixing degree (5)
In an embodiment of the present disclosure, determining a second color temperature class weight corresponding to a first color temperature and a second color temperature based on a color temperature mixing degree corresponding to the first color temperature and a third color temperature adapting parameter corresponding to the first color temperature and a second color temperature adapting parameter corresponding to the first color temperature in preset adapting parameters includes:
and solving a difference value between a second color temperature adaptation parameter corresponding to the first color temperature and a third color temperature adaptation parameter corresponding to the first color temperature and the second color temperature in the preset adaptation parameters, solving a product between the difference value and the first color temperature mixing degree, and solving a sum value of the product and the third color temperature adaptation parameter corresponding to the first color temperature and the second color temperature in the preset adaptation parameters to obtain a second color temperature class weight corresponding to the first color temperature and the second color temperature.
For example, when the first color temperature region is a high color temperature region and the second color temperature region is a low color temperature region, equation (6) may be used to determine the low color temperature category weight corresponding to the high and low color temperatures. The low color temperature category weight corresponding to the high and low color temperatures is HL _ L _ Wet; a low color temperature adaptation parameter corresponding to a high color temperature and a low color temperature in preset adaptation parameters is HL _ L; the medium color temperature adaptation parameter corresponding to the medium and low color temperatures in the preset adaptation parameters is HL _ M.
HL _ L _ Wet ═ HL _ M + (HL _ L-HL _ M) × degree of mixing of high and low color temperatures (6)
When the first color temperature region is a high color temperature region and the second color temperature region is a medium color temperature region, formula (7) may be used to determine the medium color temperature category weight corresponding to the high and medium color temperatures. The weight of the medium color temperature category corresponding to the high and medium color temperatures is HM _ M _ Wet; presetting a medium color temperature adaptation parameter corresponding to the high and medium color temperatures in the adaptation parameters as HM _ M; the preset adaptation parameter is HM _ L, wherein the low color temperature adaptation parameter corresponding to the high and medium color temperatures is HM _ L.
HM _ M _ Wet ═ HM _ L + (HM _ M-HM _ L) × high and medium color temperature mixing degree (7)
When the first color temperature region is a middle color temperature region and the second color temperature region is a low color temperature region, a formula (8) can be used to determine the low color temperature region corresponding to the middle and low color temperature. The low color temperature category weight corresponding to the medium and low color temperature is ML _ L _ Wet; the low color temperature adaptation parameter corresponding to the medium and low color temperatures in the preset adaptation parameters is ML _ L; the high color temperature adaptation parameter corresponding to the medium-low color temperature in the preset adaptation parameters is ML _ H.
ML _ L _ Wet ═ ML _ H + (ML _ L-ML _ H) · medium and low color temperature mixing degree (8)
In an embodiment of the present disclosure, the preset third color temperature adjustment parameter corresponding to the first color temperature and the second color temperature in the adjustment parameters, and determining the third color temperature class weight corresponding to the first color temperature and the second color temperature includes: and taking a third color temperature adaptation parameter corresponding to the first color temperature and the second color temperature in the preset adaptation parameters as a third color temperature class weight corresponding to the first color temperature and the second color temperature.
When the first color temperature area is a high color temperature area, the second color temperature area is a low color temperature area, and the third color temperature area is a medium color temperature area; the embodiment of the present disclosure may use equation (9) to determine the mid-color temperature category weight corresponding to the high-low color temperature. The medium color temperature adapting parameter corresponding to the medium and low color temperatures in the preset adapting parameter is HL _ M.
HL_M_Wet=HL_M (9)
When the first color temperature area is a high color temperature area, the second color temperature area is a medium color temperature area, and the third color temperature area is a low color temperature area; the embodiment of the present disclosure may use formula (10) to determine a low color temperature category weight corresponding to a high and medium color temperature. And the low color temperature adaptation parameter corresponding to the high and medium color temperatures in the preset adaptation parameters is HM _ L.
HM_L_Wet=HM_L (10)
When the first color temperature area is a middle color temperature area, the second color temperature area is a low color temperature area, and the third color temperature area is a high color temperature area; the embodiment of the present disclosure may use equation (11) to determine the high color temperature category weight corresponding to the medium-low color temperature. Wherein, the high color temperature adaptation parameter corresponding to the middle color temperature in the preset adaptation parameters is ML _ H.
ML_H_Wet=ML_H (11)
Illustratively, the first color temperature region is a high color temperature region, the second color temperature region is a low color temperature region, the third color temperature region is a medium color temperature region, and the mixing class weights corresponding to the two color temperature mixedness degrees include: the high color temperature category weight corresponding to high and low color temperatures, the low color temperature category weight corresponding to high and low color temperatures and the medium color temperature category weight corresponding to high and low color temperatures.
In the process of determining the mixing category weight corresponding to the high and low color temperatures, when the mixing degree value of the high and low color temperatures is 0.0, the situation that the high and low color temperatures form the mixed color temperature is not obvious. And (3) bringing an HL _ H value of 70, an HL _ M value of 50, an HL _ L value of 20 and a high-low color temperature mixing degree value of 0.0 into a formula (3), a formula (6) and a formula (9) to obtain the same value 50 of the HL _ H _ Wet, the HL _ M _ Wet and the HL _ L _ Wet, which indicates that the category weights of the three color temperature regions, namely the high color temperature region, the middle color temperature region and the low color temperature region, are the same under the condition that the high-low mixed color temperature is not obvious.
When the mixing degree of the high and low color temperatures is 1.0, the situation that the high and low color temperatures form mixed color temperatures is obvious. And substituting 70 values of HL _ H, 50 values of HL _ M, 20 values of HL _ L and 1.0 value of mixing degree of high and low color temperature into a formula (3), a formula (6) and a formula (9) to obtain 70, 50 and 20 values of HL _ H _ Wet, HL _ M _ Wet and HL _ L _ Wet, wherein the weight corresponding to the high color temperature area is 70 and the weight corresponding to the low color temperature area is 20 under the condition of obvious high and low mixed color temperature. It can be seen that, when the values of HL _ H, HL _ M and HL _ L are 70, 50 and 20, respectively, the category weights of the high, medium and low color temperature regions corresponding to the high, medium and low color temperature statistical points are different when the high and low mixed color temperature scene appears, and if no high and low mixed color temperature scene appears, the weights of the high, medium and low color temperature statistical points are all kept the same as 50.
In some embodiments, the different color temperature regions include: a first color temperature region, a second color temperature region and a third color temperature region;
the color temperature category proportions of two color temperature regions in the different color temperature regions comprise: a first color temperature category specific gravity of the first color temperature region and the second color temperature region;
the determining of the color temperature category proportion of two color temperature areas in different color temperature areas based on the color statistic points located in different color temperature areas comprises the following steps:
summing the color statistical points in the first color temperature region and the color statistical points in the second color temperature region to obtain a second sum value;
summing the color statistic points in the first color temperature region, the color statistic points in the second color temperature region and the color statistic points in the third color temperature region to obtain a third sum value;
determining the first and second color temperature class ratios based on a ratio between the second summation value and the third summation value.
In the embodiment of the present disclosure, in the process of determining the weights of different color temperature regions, the mixed class weight needs to be converted into the weights of the different color temperature regions, and the color temperature class weights of the two color temperature regions need to be considered in the conversion process.
For example, when the first color temperature region is a high color temperature region, the second color temperature region is a low color temperature region, and the third color temperature region is a medium color temperature region, the first and second color temperature class specific gravities may be determined using equation (12). The first color temperature category specific gravity and the second color temperature category specific gravity are high color temperature category specific gravity and low color temperature category specific gravity, the color statistic points in the first color temperature area are high color temperature statistic points, the color statistic points in the second color temperature area are low color temperature statistic points, and the color statistic points in the third color temperature area are medium color temperature color statistic points.
Figure BDA0002958550910000201
When the first color temperature region is a middle color temperature region, the second color temperature region is a low color temperature region, and the third color temperature region is a high color temperature region, the formula (13) may be used to determine the first and second color temperature category specific gravity. The first color temperature category specific gravity and the second color temperature category specific gravity are respectively the medium-color temperature category specific gravity and the medium-color temperature category specific gravity, the color statistic point in the first color temperature area is the medium-color temperature statistic point, the color statistic point in the second color temperature area is the low-color temperature color statistic point, and the color statistic point in the third color temperature area is the high-color temperature color statistic point.
Figure BDA0002958550910000202
When the first color temperature region is a high color temperature region, the second color temperature region is a medium color temperature region, and the third color temperature region is a low color temperature region, the first and second color temperature class specific gravity can be determined by using equation (14). The first color temperature category specific gravity and the second color temperature category specific gravity are high and medium color temperature category specific gravity, the color statistic points in the first color temperature area are high color temperature statistic points, the color statistic points in the second color temperature area are medium color temperature color statistic points, and the color statistic points in the third color temperature area are low color temperature color statistic points.
Figure BDA0002958550910000203
In some embodiments, the regions of different color temperatures include: a first color temperature region, a second color temperature region and a third color temperature region;
the mixed category weights include: a first color temperature category weight corresponding to a first second color temperature, a first color temperature category weight corresponding to a first third color temperature and a first color temperature category weight corresponding to a second third color temperature;
the color temperature category weights include: a category specific gravity of the first second color temperature, a category specific gravity of the first third color temperature, and a category specific gravity of the second third color temperature;
the weights of the different color temperature regions include: a weight of the first color temperature zone;
the determining weights of different color temperature regions based on the color temperature category specific gravity and the mixed category weight comprises:
determining the weight of the first color temperature region based on the first color temperature category weight corresponding to the first color temperature, the first color temperature category weight corresponding to the second color temperature, the category specific gravity of the first color temperature and the category specific gravity of the second color temperature.
In an embodiment of the present disclosure, determining a weight of the first color temperature region based on a first color temperature category weight corresponding to the first color temperature, a first color temperature category weight corresponding to the second color temperature, a category specific gravity of the first color temperature, and a category specific gravity of the second color temperature includes:
multiplying the category specific gravity of the first and second color temperatures by the first color temperature category weight corresponding to the first and second color temperatures to obtain a first product; multiplying the class specific gravity of the first third color temperature and the first color temperature class weight corresponding to the first third color temperature to obtain a second product; multiplying the category specific gravity of the second and third color temperatures by the first color temperature category weight corresponding to the second and third color temperatures to obtain a third product; and summing the first product, the second product and the third product to obtain the weight of the first color temperature area.
For example, when the first color temperature region is a high color temperature region, the second color temperature region is a low color temperature region, and the third color temperature region is a medium color temperature region, the weight of the first color temperature region may be determined using equation (15). The first color temperature class weight corresponding to the first and second color temperatures is HL _ H _ Wet, the first color temperature class weight corresponding to the first and third color temperatures is HM _ H _ Wet, the first color temperature class weight corresponding to the second and third color temperatures is ML _ H _ Wet, the class specific gravity of the first and second color temperatures is high and low color temperature class specific gravity a, the class specific gravity of the first and third color temperatures is high and medium color temperature class specific gravity B, the class specific gravity of the second and third color temperatures is medium and low color temperature class specific value C, and the weight of the first color temperature region is the weight of the high color temperature region.
Weight of high color temperature region HL _ H _ Wet A + ML _ H _ Wet C + HM _ H _ Wet B (15)
When the first color temperature region is a medium color temperature region, the second color temperature region is a low color temperature region, and the third color temperature region is a high color temperature region, the weight of the first color temperature region may be determined by equation (16). The first color temperature class weight corresponding to the first and second color temperatures is ML _ M _ Wet, the first color temperature class weight corresponding to the first and third color temperatures is HM _ M _ Wet, the first color temperature class weight corresponding to the second and third color temperatures is HL _ M _ Wet, the class specific gravity of the first and second color temperatures is a medium and low color temperature class specific gravity C, the class specific gravity of the first and third color temperatures is a high and medium color temperature class specific gravity B, the class specific gravity of the second and third color temperatures is a high and low color temperature class specific value a, and the weight of the first color temperature region is a weight corresponding to a medium color temperature region.
Weight of middle color temperature region HL _ M _ Wet A + ML _ M _ Wet C + HM _ M _ Wet B (16)
When the first color temperature region is a low color temperature region, the second color temperature region is a medium color temperature region, and the third color temperature region is a high color temperature region, the weight of the first color temperature region may be determined by using formula (17). The first color temperature category weight corresponding to the first and second color temperatures is ML _ L _ Wet, the first color temperature category weight corresponding to the first and third color temperatures is HL _ L _ Wet, the first color temperature category weight corresponding to the second and third color temperatures is HM _ L _ Wet, the category specific gravity of the first and second color temperatures is middle and low color temperature category specific gravity C, the category specific gravity of the first and third color temperatures is high and low color temperature category specific gravity A, the category specific gravity of the second and third color temperatures is high and middle color temperature category specific gravity B, and the weight of the first color temperature region is the weight corresponding to the low color temperature region.
Weight of low color temperature region HL _ L _ Wet A + ML _ L _ Wet C + HM _ L _ Wet B (17)
For a better understanding of the above embodiments, the embodiments of the present disclosure are exemplified as follows:
as shown in fig. 5, the method for the terminal device to perform the white balance processing includes:
s201, acquiring a calibration area on the two-dimensional plane;
s202, dividing the calibration area according to the color temperatures of different light sources to obtain areas with different color temperatures;
s203, when a plurality of color temperature light sources exist in the shooting environment, acquiring color statistic points in different color temperature areas on a two-dimensional plane;
s204, determining the color temperature mixing degree of two color temperature areas in different color temperature areas based on the color statistic points positioned in the different color temperature areas;
s205, determining color temperature category specific gravity of two color temperature areas in different color temperature areas based on the color statistic points in the different color temperature areas;
s206, determining mixing class weights corresponding to the color temperature mixing degrees of two color temperature areas in different color temperature areas based on the color temperature mixing degree and preset adaptation parameters;
s207, determining weights of different color temperature regions based on the color temperature category specific gravity and the mixed category weight;
s208, determining a white balance gain value of the image to be processed based on the color statistical points in the different color temperature areas and the weights of the different color temperature areas;
and S209, carrying out white balance processing on the image to be processed based on the white balance gain value to obtain a processed image.
The white balance processing method of the embodiment of the disclosure can be suitable for a plurality of color temperature light sources in a shooting environment, and can also determine the white balance gain value based on different color statistic points and weights of different color temperature areas, so that the accurate white balance gain value of the image to be processed can be obtained in a plurality of color temperature light source scenes, and the image to be processed can show correct imaging color.
Fig. 6 is a first white balance processing apparatus according to an exemplary embodiment. Referring to fig. 6, the white balance processing apparatus includes a first obtaining module 1001, a first determining module 1002, a second determining module 1003, and a second obtaining module 1004, wherein,
a first obtaining module 1001 configured to obtain color statistic points located in different color temperature regions on a two-dimensional plane when there are a plurality of color temperature light sources in a shooting environment;
a first determining module 1002, configured to determine weights of different color temperature regions according to the color statistic points in the different color temperature regions;
a second determining module 1003 configured to determine a white balance gain value of the image to be processed based on the color statistic points in different color temperature regions and weights of different color temperature regions;
the second obtaining module 1004 is configured to perform white balance processing on the image to be processed based on the white balance gain value to obtain a processed image.
In some embodiments, the apparatus further comprises:
the segmentation and conversion module is configured to segment and convert the image to be processed to obtain a plurality of color statistics values;
the third acquisition module is configured to map the color statistic value to the two-dimensional plane to obtain a plurality of color statistic points;
and the third determining module is configured to determine that the shooting environment has a plurality of color temperature light sources when a plurality of the color statistical points are simultaneously positioned in different color temperature areas on the two-dimensional plane.
In some embodiments, the first determining module comprises:
the first determining submodule is configured to determine the color temperature mixing degree of two color temperature areas in different color temperature areas based on the color statistic points located in the different color temperature areas;
the second determining submodule is configured to determine color temperature category proportions of two color temperature areas in different color temperature areas based on the color statistic points located in the different color temperature areas;
the third determining submodule is configured to determine mixing category weights corresponding to the color temperature mixing degrees of two color temperature areas in different color temperature areas based on the color temperature mixing degree and a preset adaptation parameter;
a fourth determination submodule configured to determine weights of different color temperature regions based on the color temperature category specific gravity and the mixed category weight.
In some embodiments, the different color temperature regions include: a first color temperature region, a second color temperature region and a third color temperature region;
the color temperature mixing degree of two color temperature regions in the different color temperature regions comprises: a first and second color temperature mixedness of the first and second color temperature zones;
the first determining submodule is further configured to determine that the first and second color temperature mixedness is a preset mixedness when a first total number of the color statistic points located in the first color temperature region and a second total number of the color statistic points located in the second color temperature region are both preset total numbers; when the first total number is larger than or equal to the second total number and neither the first total number nor the second total number is the preset total number, determining the first and second color temperature mixing degrees based on the first total number; determining the first and second color temperature mixes based on the second total number when the first total number is less than the second total number.
In some embodiments, the apparatus further comprises:
the fourth obtaining module is configured to sum the first total number and the second total number to obtain a first sum value;
the first determination sub-module is further configured to determine the first second color temperature mixture degree based on a ratio between twice the first total number and the first summation value; determining the first and second degrees of color temperature mixing based on a ratio between twice the second total and the first summation value.
In some embodiments, the different color temperature regions include: a first color temperature region, a second color temperature region and a third color temperature region;
the color temperature category proportions of two color temperature regions in the different color temperature regions comprise: a first and second color temperature category specific gravity of the first and second color temperature regions;
the second determining submodule is further configured to sum the color statistical points located in the first color temperature region and the color statistical points located in the second color temperature region to obtain a second sum value; summing the color statistic points in the first color temperature region, the color statistic points in the second color temperature region and the color statistic points in the third color temperature region to obtain a third sum value; determining the first and second color temperature class ratios based on a ratio between the second summation value and the third summation value.
In some embodiments, the regions of different color temperatures include: a first color temperature region, a second color temperature region and a third color temperature region;
the color temperature mixing degree of the two color temperature regions includes: a first second color temperature mixing degree;
mixed category weights comprising: a first color temperature class weight corresponding to the first color temperature and a second color temperature and a third color temperature class weight corresponding to the first color temperature and the second color temperature;
the third determining submodule is further configured to determine a first color temperature class weight corresponding to the first and second color temperatures based on the first and second color temperature mixture degrees, a third color temperature adaptation parameter corresponding to the first and second color temperatures in preset adaptation parameters, and a first color temperature adaptation parameter corresponding to the first and second color temperatures in preset adaptation parameters; determining a second color temperature class weight corresponding to the first and second color temperatures based on the first and second color temperature mixing degrees, a third color temperature adaptation parameter corresponding to the first and second color temperatures in preset adaptation parameters, and a second color temperature adaptation parameter corresponding to the first and second color temperatures in preset adaptation parameters; and determining a third color temperature class weight corresponding to the first and second color temperatures based on a third color temperature adaptation parameter corresponding to the first and second color temperatures in preset adaptation parameters.
In some embodiments, the regions of different color temperatures include: a first color temperature region, a second color temperature region and a third color temperature region;
the mixed category weights include: a first color temperature category weight corresponding to a first second color temperature, a first color temperature category weight corresponding to a first third color temperature and a first color temperature category weight corresponding to a second third color temperature;
the color temperature category weights include: a category specific gravity of the first and second color temperatures, a category specific gravity of the first and third color temperatures, and a category specific gravity of the second and third color temperatures;
the weights of the different color temperature regions include: a weight of the first color temperature zone;
the fourth determination submodule is further configured to determine the weight of the first color temperature region based on a first color temperature category weight corresponding to the first and second color temperatures, a first color temperature category weight corresponding to the first and third color temperatures, a first color temperature category weight corresponding to the second and third color temperatures, a category specific gravity of the first and second color temperatures, a category specific gravity of the first and third color temperatures, and a category specific gravity of the second and third color temperatures.
In some embodiments, the apparatus further comprises:
a fifth obtaining module, configured to obtain a calibration region on the two-dimensional plane, where calibration points of different light sources on the two-dimensional plane are all in the calibration region;
the sixth acquisition module is configured to divide the calibration area according to the color temperatures of different light sources to obtain different color temperature areas;
the calibration area is the sum of areas with different color temperatures, and the areas with different color temperatures are not overlapped.
In some embodiments, the sixth obtaining module is further configured to divide an area where the calibration point of the light source located in the first color temperature range is located into a first color temperature area; dividing the area where the calibration point of the light source located in the second color temperature range is located into a second color temperature area; dividing the area where the calibration point of the light source in the third color temperature range is located into a third color temperature area; the color temperature value in the first color temperature range, the color temperature value in the second color temperature range and the color temperature value in the third color temperature range are different.
In some embodiments, the second obtaining module is further configured to obtain the processed image based on a first color gain value, a second color gain value, a third color gain value of the white balance gain, and color components of the image to be processed in three different colors.
With regard to the apparatus in the above-described embodiment, the specific manner in which each module performs the operation has been described in detail in the embodiment related to the method, and will not be elaborated here.
Fig. 7 is a diagram illustrating a white balance processing apparatus according to an exemplary embodiment. For example, the device may be a mobile phone, a mobile computer, etc.
Referring to fig. 7, an apparatus may include one or more of the following components: processing component 802, memory 804, power component 806, multimedia component 808, audio component 810, input/output (I/O) interface 812, sensor component 814, and communications component 816.
The processing component 802 generally controls overall operation of the device, such as operations associated with display, telephone calls, data communications, camera operations, and recording operations. The processing components 802 may include one or more processors 820 to execute instructions to perform all or a portion of the steps of the methods described above. Further, the processing component 802 can include one or more modules that facilitate interaction between the processing component 802 and other components. For example, the processing component 802 can include a multimedia module to facilitate interaction between the multimedia component 808 and the processing component 802.
The memory 804 is configured to store various types of data to support operations at the device. Examples of such data include instructions for any application or method operating on the device, contact data, phonebook data, messages, pictures, videos, and the like. The memory 804 may be implemented by any type or combination of volatile or non-volatile memory devices such as Static Random Access Memory (SRAM), electrically erasable programmable read-only memory (EEPROM), erasable programmable read-only memory (EPROM), programmable read-only memory (PROM), read-only memory (ROM), magnetic memory, flash memory, magnetic or optical disks.
The power component 806 provides power for the various components of the device. The power components 806 may include a power management system, one or more power sources, and other components associated with generating, managing, and distributing power for a device.
The multimedia component 808 includes a screen that provides an output interface between the device and the user. In some embodiments, the screen may include a Liquid Crystal Display (LCD) and a Touch Panel (TP). If the screen includes a touch panel, the screen may be implemented as a touch screen to receive an input signal from a user. The touch panel includes one or more touch sensors to sense touch, slide, and gestures on the touch panel. The touch sensor may not only sense the boundary of a touch or slide action, but also detect the duration and pressure associated with the touch or slide operation. In some embodiments, the multimedia component 808 includes a front facing camera and/or a rear facing camera. The front camera and/or the rear camera may receive external multimedia data when the device is in an operational mode, such as a shooting mode or a video mode. Each front camera and rear camera may be a fixed optical lens system or have a focal length and optical zoom capability.
The audio component 810 is configured to output and/or input audio signals. For example, the audio component 810 includes a Microphone (MIC) configured to receive external audio signals when the apparatus is in an operating mode, such as a call mode, a recording mode, and a voice recognition mode. The received audio signals may further be stored in the memory 804 or transmitted via the communication component 816. In some embodiments, audio component 810 also includes a speaker for outputting audio signals.
The I/O interface 812 provides an interface between the processing component 802 and peripheral interface modules, which may be keyboards, click wheels, buttons, etc. These buttons may include, but are not limited to: a home button, a volume button, a start button, and a lock button.
The sensor assembly 814 includes one or more sensors for providing various aspects of state assessment for the device. For example, the sensor assembly 814 may detect the on/off status of the device, the relative positioning of the components, such as the display and keypad of the apparatus, the sensor assembly 814 may also detect a change in the position of the apparatus or a component of the apparatus, the presence or absence of user contact with the apparatus, the orientation or acceleration/deceleration of the apparatus, and a change in the temperature of the apparatus. Sensor assembly 814 may include a proximity sensor configured to detect the presence of a nearby object without any physical contact. The sensor assembly 814 may also include a light sensor, such as a CMOS or CCD image sensor, for use in imaging applications. In some embodiments, the sensor assembly 814 may also include an acceleration sensor, a gyroscope sensor, a magnetic sensor, a pressure sensor, or a temperature sensor.
The communication component 816 is configured to facilitate communication between the apparatus and other devices in a wired or wireless manner. The device may access a wireless network based on a communication standard, such as Wi-Fi, 4G or 5G, or a combination thereof. In an exemplary embodiment, the communication component 816 receives a broadcast signal or broadcast related information from an external broadcast management system via a broadcast channel. In an exemplary embodiment, the communication component 816 further includes a Near Field Communication (NFC) module to facilitate short-range communications. For example, the NFC module may be implemented based on Radio Frequency Identification (RFID) technology, infrared data association (IrDA) technology, Ultra Wideband (UWB) technology, Bluetooth (BT) technology, and other technologies.
In an exemplary embodiment, the apparatus may be implemented by one or more Application Specific Integrated Circuits (ASICs), Digital Signal Processors (DSPs), Digital Signal Processing Devices (DSPDs), Programmable Logic Devices (PLDs), Field Programmable Gate Arrays (FPGAs), controllers, micro-controllers, microprocessors or other electronic components for performing the above-described methods.
In an exemplary embodiment, a non-transitory computer-readable storage medium comprising instructions, such as the memory 804 comprising instructions, executable by the processor 820 of the apparatus to perform the method described above is also provided. For example, the non-transitory computer readable storage medium may be a ROM, a Random Access Memory (RAM), a CD-ROM, a magnetic tape, a floppy disk, an optical data storage device, and the like.
A non-transitory computer readable storage medium in which instructions, when executed by a processor of a terminal device, enable the terminal device to perform a white balance processing method, the method comprising:
when a plurality of color temperature light sources exist in a shooting environment, acquiring color statistic points in different color temperature areas on a two-dimensional plane;
determining weights of different color temperature areas according to the color statistic points in the different color temperature areas;
determining a white balance gain value of the image to be processed based on the color statistic points in different color temperature areas and the weights of different color temperature areas;
and carrying out white balance processing on the image to be processed based on the white balance gain value to obtain a processed image.
Other embodiments of the disclosure will be apparent to those skilled in the art from consideration of the specification and practice of the disclosure disclosed herein. This application is intended to cover any variations, uses, or adaptations of the disclosure following, in general, the principles of the disclosure and including such departures from the present disclosure as come within known or customary practice within the art to which the disclosure pertains. It is intended that the specification and examples be considered as exemplary only, with a true scope and spirit of the disclosure being indicated by the following claims.
It will be understood that the present disclosure is not limited to the precise arrangements described above and shown in the drawings and that various modifications and changes may be made without departing from the scope thereof. The scope of the present disclosure is limited only by the appended claims.

Claims (24)

1. A white balance processing method, characterized by comprising:
when a plurality of color temperature light sources exist in a shooting environment, acquiring color statistic points in different color temperature areas on a two-dimensional plane;
determining weights of different color temperature areas according to the color statistic points in the different color temperature areas;
determining a white balance gain value of the image to be processed based on the color statistic points in different color temperature areas and the weights of different color temperature areas;
and carrying out white balance processing on the image to be processed based on the white balance gain value to obtain a processed image.
2. The method of claim 1, further comprising:
segmenting and converting the image to be processed to obtain a plurality of color statistics values;
mapping the color statistic value to the two-dimensional plane to obtain a plurality of color statistic points;
and when the plurality of color statistical points are simultaneously positioned in different color temperature areas on the two-dimensional plane, determining that the shooting environment has a plurality of color temperature light sources.
3. The method according to claim 1 or 2, wherein determining weights of different color temperature regions according to the color statistic points in the different color temperature regions comprises:
determining the color temperature mixing degree of two color temperature areas in different color temperature areas based on the color statistic points in different color temperature areas;
determining color temperature category specific gravity of two color temperature areas in different color temperature areas based on the color statistic points in the different color temperature areas;
determining mixing category weights corresponding to the color temperature mixing degrees of two color temperature areas in different color temperature areas based on the color temperature mixing degree and a preset adaptation parameter;
determining weights of different color temperature regions based on the color temperature category specific gravity and the mixed category weight.
4. The method of claim 3, wherein differentiating the color temperature regions comprises: a first color temperature region, a second color temperature region and a third color temperature region;
the color temperature mixing degree of two color temperature regions in different color temperature regions comprises the following steps: a first and second color temperature mixing degrees of the first and second color temperature regions;
the determining the color temperature mixing degree of the two color temperature areas in the different color temperature areas based on the color statistic points in the different color temperature areas comprises:
when the first total number of the color counting points in the first color temperature area and the second total number of the color counting points in the second color temperature area are both preset total numbers, determining that the first color temperature mixing degree and the second color temperature mixing degree are preset mixing degrees;
when the first total number is greater than or equal to the second total number and neither the first total number nor the second total number is the preset total number, determining the first and second color temperature mixedness based on the first total number;
determining the first and second color temperature mixes based on the second total number when the first total number is less than the second total number.
5. The method of claim 4, further comprising:
summing the first total number and the second total number to obtain a first summation value;
the determining the first and second color temperature mixes based on the first total number includes:
determining the first and second color temperature mixes based on a ratio between twice the first total and the first summation value;
the determining the first and second color temperature mixes based on the second total includes:
determining the first and second degrees of color temperature mixing based on a ratio between twice the second total and the first summation value.
6. The method of claim 3, wherein differentiating the color temperature regions comprises: a first color temperature region, a second color temperature region and a third color temperature region;
the color temperature category proportions of two color temperature regions in different color temperature regions comprise: a first and second color temperature category specific gravity of the first and second color temperature regions;
the determining of the color temperature category proportion of the two color temperature areas in the different color temperature areas based on the color statistic points located in the different color temperature areas comprises the following steps:
summing the color statistical points in the first color temperature area and the color statistical points in the second color temperature area to obtain a second sum value;
summing the color statistic points in the first color temperature region, the color statistic points in the second color temperature region and the color statistic points in the third color temperature region to obtain a third sum value;
determining the first and second color temperature class ratios based on a ratio between the second summation value and the third summation value.
7. The method of claim 3, wherein differentiating the color temperature regions comprises: a first color temperature region, a second color temperature region and a third color temperature region;
the color temperature mixing degree of the two color temperature regions comprises: a first and second color temperature mix;
the mixed category weights comprise: a first color temperature class weight corresponding to the first color temperature and a second color temperature and a third color temperature class weight corresponding to the first color temperature and the second color temperature;
the determining of the mixing category weights corresponding to the color temperature mixing degrees of the two color temperature regions in the different color temperature regions based on the color temperature mixing degree and a preset adaptation parameter comprises:
determining a first color temperature class weight corresponding to the first second color temperature based on the first second color temperature mixture degree, a third color temperature adaptation parameter corresponding to the first second color temperature in the preset adaptation parameters, and a first color temperature adaptation parameter corresponding to the first second color temperature in the preset adaptation parameters;
determining a second color temperature class weight corresponding to the first and second color temperatures based on the first and second color temperature mixture degrees, a third color temperature adaptation parameter corresponding to the first and second color temperatures in the preset adaptation parameters, and a second color temperature adaptation parameter corresponding to the first and second color temperatures in the preset adaptation parameters;
and determining a third color temperature class weight corresponding to the first and second color temperatures based on a third color temperature adaptation parameter corresponding to the first and second color temperatures in the preset adaptation parameters.
8. The method of claim 3, wherein differentiating the color temperature regions comprises: a first color temperature region, a second color temperature region and a third color temperature region;
the mixed category weights include: a first color temperature category weight corresponding to a first second color temperature, a first color temperature category weight corresponding to a first third color temperature and a first color temperature category weight corresponding to a second third color temperature;
the color temperature category weights include: a category specific gravity of the first second color temperature, a category specific gravity of the first third color temperature, and a category specific gravity of the second third color temperature;
the weights of the different color temperature regions include: a weight of the first color temperature zone;
the determining weights of different color temperature regions based on the color temperature category specific gravity and the mixed category weight comprises:
determining the weight of the first color temperature region based on the first color temperature category weight corresponding to the first color temperature, the first color temperature category weight corresponding to the second color temperature, the category specific gravity of the first color temperature and the category specific gravity of the second color temperature.
9. The method according to claim 1 or 2, characterized in that the method further comprises:
acquiring a calibration area on the two-dimensional plane, wherein calibration points of different light sources on the two-dimensional plane are all in the calibration area;
dividing the calibration area according to the color temperatures of different light sources to obtain different color temperature areas;
the calibration area is the sum of the different color temperature areas, and the different color temperature areas are not overlapped.
10. The method of claim 9, wherein the dividing the calibration area according to the color temperatures of the different light sources to obtain the different color temperature areas comprises:
dividing the area where the calibration point of the light source located in the first color temperature range is located into a first color temperature area;
dividing the area where the calibration point of the light source located in the second color temperature range is located into a second color temperature area;
dividing the area where the calibration point of the light source is located in the third color temperature range into a third color temperature area;
and the color temperature value in the first color temperature range, the color temperature value in the second color temperature range and the color temperature value in the third color temperature range are different.
11. The method according to claim 1 or 2, wherein the performing white balance processing on the image to be processed based on the white balance gain value to obtain a processed image comprises:
and obtaining the processed image based on a first color gain value, a second color gain value and a third color gain value in the white balance gain and color components of the image to be processed under three different colors.
12. A white balance processing apparatus, characterized in that the apparatus comprises:
the device comprises a first acquisition module, a second acquisition module and a third acquisition module, wherein the first acquisition module is configured to acquire color statistic points in different color temperature areas on a two-dimensional plane when a plurality of color temperature light sources exist in a shooting environment;
the first determining module is configured to determine weights of different color temperature areas according to the color statistic points in the different color temperature areas;
the second determination module is configured to determine a white balance gain value of the image to be processed based on the color statistic points in different color temperature areas and the weights of different color temperature areas;
and the second acquisition module is configured to perform white balance processing on the image to be processed based on the white balance gain value to obtain a processed image.
13. The apparatus of claim 12, further comprising:
the segmentation and conversion module is configured to segment and convert the image to be processed to obtain a plurality of color statistics values;
the third acquisition module is configured to map the color statistic value to the two-dimensional plane to obtain a plurality of color statistic points;
and the third determining module is configured to determine that the shooting environment has a plurality of color temperature light sources when a plurality of the color statistical points are simultaneously positioned in different color temperature areas on the two-dimensional plane.
14. The apparatus according to claim 12 or 13, wherein the first determining module comprises:
the first determining submodule is configured to determine the color temperature mixing degree of two color temperature areas in different color temperature areas based on the color statistic points in the different color temperature areas;
a second determination submodule configured to determine color temperature category proportions of two color temperature regions in different color temperature regions based on the color statistic points located in the different color temperature regions;
a third determining submodule configured to determine mixing category weights corresponding to the color temperature mixing degrees of two color temperature regions of different color temperature regions based on the color temperature mixing degree and a preset adaptation parameter;
a fourth determination submodule configured to determine weights of different color temperature regions based on the color temperature category specific gravity and the mixed category weight.
15. The apparatus of claim 14, wherein the different color temperature regions comprise: a first color temperature region, a second color temperature region and a third color temperature region;
the mixing degree of the color temperatures of two color temperature regions in different color temperature regions comprises: a first and second color temperature mixedness of the first and second color temperature zones;
the first determining submodule is further configured to determine that the first and second color temperature mixedness is a preset mixedness when a first total number of the color statistic points located in the first color temperature region and a second total number of the color statistic points located in the second color temperature region are both preset total numbers; when the first total number is greater than or equal to the second total number and neither the first total number nor the second total number is the preset total number, determining the first and second color temperature mixedness based on the first total number; determining the first and second color temperature mixes based on the second total number when the first total number is less than the second total number.
16. The apparatus of claim 15, further comprising:
the fourth obtaining module is configured to sum the first total number and the second total number to obtain a first sum value;
the first determination submodule is further configured to determine the first second color temperature mixture degree based on a ratio between twice the first total number and the first summation value; determining the first and second color temperature mixes based on a ratio between twice the second total and the first summation value.
17. The apparatus of claim 14, wherein the different color temperature regions comprise: a first color temperature region, a second color temperature region and a third color temperature region;
the color temperature category proportions of two color temperature regions in different color temperature regions comprise: a first and second color temperature category specific gravity of the first and second color temperature regions;
the second determining submodule is further configured to sum the color statistic points located in the first color temperature region and the color statistic points located in the second color temperature region to obtain a second sum value; summing the color statistic points in the first color temperature region, the color statistic points in the second color temperature region and the color statistic points in the third color temperature region to obtain a third sum value; determining the first and second color temperature class ratios based on a ratio between the second summation value and the third summation value.
18. The apparatus of claim 14, wherein the different color temperature regions comprise: a first color temperature region, a second color temperature region and a third color temperature region;
the color temperature mixing degree of the two color temperature regions comprises: a first second color temperature mixing degree;
the mixed category weights comprise: a first color temperature class weight corresponding to the first color temperature and a second color temperature and a third color temperature class weight corresponding to the first color temperature and the second color temperature;
the third determining sub-module is further configured to determine a first color temperature class weight corresponding to the first and second color temperatures based on the first and second color temperature mixture degrees, a third color temperature adaptation parameter corresponding to the first and second color temperatures in the preset adaptation parameters, and a first color temperature adaptation parameter corresponding to the first and second color temperatures in the preset adaptation parameters; determining a second color temperature class weight corresponding to the first second color temperature based on the first second color temperature mixture degree, a third color temperature adaptation parameter corresponding to the first second color temperature in the preset adaptation parameters, and a second color temperature adaptation parameter corresponding to the first second color temperature in the preset adaptation parameters; and determining a third color temperature class weight corresponding to the first and second color temperatures based on a third color temperature adaptation parameter corresponding to the first and second color temperatures in the preset adaptation parameters.
19. The apparatus of claim 14, wherein the different color temperature regions comprise: a first color temperature region, a second color temperature region and a third color temperature region;
the mixed category weights include: a first color temperature category weight corresponding to a first second color temperature, a first color temperature category weight corresponding to a first third color temperature and a first color temperature category weight corresponding to a second third color temperature;
the color temperature category weights include: a category specific gravity of the first second color temperature, a category specific gravity of the first third color temperature, and a category specific gravity of the second third color temperature;
the weights of the different color temperature regions include: a weight of the first color temperature zone;
the fourth determination submodule is further configured to determine the weight of the first color temperature region based on a first color temperature category weight corresponding to the first second color temperature, a first color temperature category weight corresponding to the first third color temperature, a first color temperature category weight corresponding to the second third color temperature, a category specific gravity of the first second color temperature, a category specific gravity of the first third color temperature, and a category specific gravity of the second third color temperature.
20. The apparatus of claim 12 or 13, further comprising:
a fifth obtaining module, configured to obtain a calibration region on the two-dimensional plane, where calibration points of different light sources on the two-dimensional plane are all in the calibration region;
the sixth acquisition module is configured to divide the calibration area according to the color temperatures of different light sources to obtain different color temperature areas;
the calibration area is the sum of the different color temperature areas, and the different color temperature areas are not overlapped.
21. The apparatus according to claim 20, wherein the sixth obtaining module is further configured to divide an area where the calibration point of the light source located in a first color temperature range is located into first color temperature areas; dividing the area where the calibration point of the light source is located in the second color temperature range into second color temperature areas; dividing the area where the calibration point of the light source is located in the third color temperature range into a third color temperature area; and the color temperature value in the first color temperature range, the color temperature value in the second color temperature range and the color temperature value in the third color temperature range are different.
22. The apparatus according to claim 12 or 13, wherein the second obtaining module is further configured to obtain the processed image based on a first color gain value, a second color gain value, and a third color gain value of the white balance gain, and color components of the image to be processed in three different colors.
23. A white balance processing apparatus, characterized in that the apparatus comprises at least: a processor and a memory for storing executable instructions operable on the processor, wherein:
the processor is configured to execute the executable instructions, and the executable instructions perform the steps of the white balance processing method provided in any one of the above claims 1 to 11.
24. A non-transitory computer-readable storage medium having stored therein computer-executable instructions that, when executed by a processor, implement the white balance processing method provided in any one of claims 1 to 11.
CN202110231613.6A 2021-03-02 2021-03-02 White balance processing method and device, and storage medium Pending CN115002437A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202110231613.6A CN115002437A (en) 2021-03-02 2021-03-02 White balance processing method and device, and storage medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202110231613.6A CN115002437A (en) 2021-03-02 2021-03-02 White balance processing method and device, and storage medium

Publications (1)

Publication Number Publication Date
CN115002437A true CN115002437A (en) 2022-09-02

Family

ID=83018010

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202110231613.6A Pending CN115002437A (en) 2021-03-02 2021-03-02 White balance processing method and device, and storage medium

Country Status (1)

Country Link
CN (1) CN115002437A (en)

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN115412712A (en) * 2022-11-03 2022-11-29 深圳比特微电子科技有限公司 White balance method and device in multi-light-source scene and readable storage medium

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN115412712A (en) * 2022-11-03 2022-11-29 深圳比特微电子科技有限公司 White balance method and device in multi-light-source scene and readable storage medium

Similar Documents

Publication Publication Date Title
US10269129B2 (en) Color adjustment method and device
KR101762081B1 (en) Automatic white balancing with skin tone correction for image processing
CN107992182B (en) Method and device for displaying interface image
CN110958401B (en) Super night scene image color correction method and device and electronic equipment
CN108932696B (en) Signal lamp halo suppression method and device
CN111696479B (en) Color gamut adjusting method and device
CN106982327B (en) Image processing method and device
CN105791790A (en) Image processing method and apparatus
CN107564073B (en) Skin color identification method and device and storage medium
CN111294576A (en) Automatic white balance processing method and device and electronic equipment
US11971557B2 (en) Optical processing apparatus, camera module, electronic device and capturing method
CN115002437A (en) White balance processing method and device, and storage medium
CN106375787B (en) Video playing method and device
US11501412B2 (en) Image processing apparatus, imaging apparatus, image processing method, and image processing program
WO2023240444A1 (en) Image processing method, apparatus and storage medium
CN112905141A (en) Screen display method and device and computer storage medium
CN109005360B (en) Light supplementing method and device for shooting environment and computer readable storage medium
EP3993399A1 (en) Color filter structure, related photographing method, device, terminal, and storage medium
CN111414223B (en) Desktop management method and device
CN108538261B (en) Display control method and device and display equipment
CN115834855A (en) Image processing device and method and imaging equipment
CN110648373B (en) Image processing method and device
CN116703736A (en) Image processing method, image processing apparatus, and storage medium
CN114339187B (en) Image processing method, image processing apparatus, and storage medium
US20230410260A1 (en) Method and apparatus for processing image

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination