White balance processing method, device and storage medium
By acquiring and analyzing the color statistics points in multiple color temperature areas and calculating the white balance gain value, the problem that the existing technology cannot be applied to multiple color temperature light source scenes is solved, and the accurate white balance processing of images under multiple color temperature light sources is achieved .
Patent Information
- Application Number
- CN202110231613.6
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2021-03-02
- Publication Date
- 2024-12-27
- Estimated Expiration
- 2041-03-02
AI Technical Summary
The existing white balance function cannot be applied to multiple color temperature light source scenes, and the white balance gain value of the to-process image cannot be accurately determined, resulting in inaccurate imaging colors.
By obtaining color statistics points located in different color temperature areas on the two-dimensional plane, the weights of different color temperature areas are determined, and the white balance gain value of the to-processed image is calculated based on these weights and color statistics points, and the white balance processing is performed.
The white balance gain value can be accurately determined in multiple color temperature light source scenarios, so that the image to be processed shows the correct imaging color, and is suitable for multiple color temperature light source scenarios.
Smart Images

Figure CN115002437B_ABST
Abstract
Description
Technical Field
[0001] The present disclosure relates to the field of information processing technology, and in particular to a white balance processing method and device, and a storage medium. Background Art
[0002] The white balance function is a basic function in camera image processing, which is used to correct the color deviation of the image to be processed under different light sources. For example, the white balance function can determine the white balance gain corresponding to the light source, and adjust the red, green and blue primary colors of the image to be processed based on the white balance gain, so that white objects in the shooting scene appear white in the image to be processed.
[0003] When there are multiple color temperature light sources in the shooting environment, the existing white balance function can usually only estimate the color temperature of one light source as the basis for correcting the color cast of the image. It cannot be applied to scenes with multiple color temperature light sources, and it is even more impossible to determine the white balance gain value of the image to be processed in scenes with multiple color temperature light sources. Summary of the invention
[0004] The present invention provides a white balance processing method and device, and a storage medium.
[0005] According to a first aspect of an embodiment of the present disclosure, a white balance processing method is provided, including:
[0006] When there are multiple color temperature light sources in the shooting environment, obtain color statistical points located in different color temperature areas on the two-dimensional plane;
[0007] Determining weights of different color temperature areas according to the color statistical points in different color temperature areas;
[0008] Determining a white balance gain value of the image to be processed based on the color statistical points in different color temperature regions and the weights of different color temperature regions;
[0009] White balance processing is performed on the image to be processed based on the white balance gain value to obtain a processed image.
[0010] In some embodiments, the method further comprises:
[0011] Segmenting and converting the image to be processed to obtain a plurality of color statistics values;
[0012] Mapping the color statistical value onto the two-dimensional plane to obtain a plurality of color statistical points;
[0013] When a plurality of the color statistical points are simultaneously located in different color temperature regions on the two-dimensional plane, it is determined that the shooting environment has a plurality of color temperature light sources.
[0014] In some embodiments, determining the weights of different color temperature regions according to the color statistical points in different color temperature regions includes:
[0015] Determining the color temperature mixing degree of two color temperature areas in different color temperature areas based on the color statistical points located in different color temperature areas;
[0016] Determining the color temperature category proportions of two color temperature areas in different color temperature areas based on the color statistical points located in different color temperature areas;
[0017] Determining, based on the color temperature mixing degree and a preset adaptation parameter, a mixing category weight corresponding to the color temperature mixing degrees of two of the color temperature areas in different color temperature areas;
[0018] Based on the color temperature category proportions and the mixed category weights, weights of different color temperature areas are determined.
[0019] 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;
[0020] The color temperature mixing degree of two color temperature areas in different color temperature areas includes: a first color temperature area and a second color temperature mixing degree of a first color temperature area and a second color temperature area;
[0021] The determining, based on the color statistical points located in different color temperature regions, the color temperature mixing degree of two color temperature regions in different color temperature regions comprises:
[0022] When a first total number of the color statistical points located in the first color temperature region and a second total number of the color statistical points located in the second color temperature region are both preset total numbers, determining that the first and second color temperature mixing degree is a preset mixing degree;
[0023] When the first total number is greater than or equal to the second total number, and both the first total number and the second total number are not the preset total number, determining the first and second color temperature mixing degrees based on the first total number;
[0024] When the first total is less than the second total, the first and second color temperature mixing degrees are determined based on the second total.
[0025] In some embodiments, the method further comprises:
[0026] summing the first total and the second total to obtain a first sum value;
[0027] The determining the first and second color temperature mixing degrees based on the first total comprises:
[0028] determining the first and second color temperature mixing degree based on a ratio between twice the first total and the first sum value;
[0029] The determining the first and second color temperature mixing degrees based on the second total comprises:
[0030] The first second color temperature mixing degree is determined based on a ratio between twice the second total and the first sum value.
[0031] 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;
[0032] The color temperature category proportions of the two color temperature areas in the different color temperature areas include: first and second color temperature category proportions of the first color temperature area and the second color temperature area;
[0033] The determining, based on the color statistical points located in different color temperature regions, the color temperature category proportions of two color temperature regions in different color temperature regions comprises:
[0034] Summing the color statistical points located within the first color temperature region and the color statistical points located within the second color temperature region to obtain a second summed value;
[0035] Summing the color statistical points located within the first color temperature region, the color statistical points located within the second color temperature region, and the color statistical points located within the third color temperature region to obtain a third summed value;
[0036] The first to second color temperature category ratio is determined based on a ratio between the second summed value and the third summed value.
[0037] 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;
[0038] The color temperature mixing degree of the two color temperature regions includes: a first and a second color temperature mixing degree;
[0039] The mixed category weights include: first color temperature category weights corresponding to the first and second color temperatures, second color temperature category weights corresponding to the first and second color temperatures, and third color temperature category weights corresponding to the first and second color temperatures;
[0040] The determining, based on the color temperature mixing degree and the preset adaptation parameter, a mixing category weight corresponding to the color temperature mixing degree of two color temperature areas in different color temperature areas comprises:
[0041] Determine a first color temperature category weight corresponding to the first and second color temperatures based on a first and second color temperature mixing degree, 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;
[0042] Determine a second color temperature category weight corresponding to the first and second color temperatures based on a first and second color temperature mixing degree, 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;
[0043] Based on the third color temperature adaptation parameter corresponding to the first and second color temperatures in the preset adaptation parameters, the third color temperature category weight corresponding to the first and second color temperatures is determined.
[0044] 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;
[0045] The mixed category weights include: first color temperature category weights corresponding to the first and second color temperatures, first color temperature category weights corresponding to the first and third color temperatures, and first color temperature category weights corresponding to the second and third color temperatures;
[0046] The color temperature category weights include: category weights of the first and second color temperatures, category weights of the first and third color temperatures, and category weights of the second and third color temperatures;
[0047] The weights of the different color temperature regions include: the weight of the first color temperature region;
[0048] The determining the weights of different color temperature areas based on the color temperature category proportions and the mixed category weights includes:
[0049] The weight of the first color temperature area is determined based on the first color temperature category weights corresponding to the first and second color temperatures, the first color temperature category weights corresponding to the first and third color temperatures, the first color temperature category weights corresponding to the second and third color temperatures, the category proportions of the first and second color temperatures, the category proportions of the first and third color temperatures, and the category proportions of the second and third color temperatures.
[0050] In some embodiments, the method further comprises:
[0051] Acquire a calibration area on the two-dimensional plane, wherein calibration points of different light sources on the two-dimensional plane are all within the calibration area;
[0052] Dividing the calibration area according to the color temperatures of different light sources to obtain different color temperature areas;
[0053] The calibration area is the sum of different color temperature areas, and the different color temperature areas do not overlap.
[0054] In some embodiments, dividing the calibration area according to the color temperatures of different light sources to obtain different color temperature areas includes:
[0055] Dividing the area where the calibration point of the light source within the first color temperature range is located as the first color temperature area;
[0056] Dividing the area where the calibration point of the light source within the second color temperature range is located as the second color temperature area;
[0057] Dividing the area where the calibration point of the light source within the third color temperature range is located as the third color temperature area;
[0058] The color temperature values within the first color temperature range, the color temperature values within the second color temperature range, and the color temperature values within the third color temperature range are all different.
[0059] 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:
[0060] The processed image is obtained based on the first color gain value, the second color gain value, the third color gain value in the white balance gain and the color components of the image to be processed in three different colors.
[0061] According to a second aspect of an embodiment of the present disclosure, a white balance processing device is provided, the device comprising:
[0062] A first acquisition module is configured to acquire color statistical points located in different color temperature areas on a two-dimensional plane when there are multiple color temperature light sources in the shooting environment;
[0063] A first determination module is configured to determine weights of different color temperature areas according to the color statistical points in different color temperature areas;
[0064] A second determination module is configured to determine a white balance gain value of the image to be processed based on the color statistical points in different color temperature regions and the weights of different color temperature regions;
[0065] 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.
[0066] In some embodiments, the apparatus further comprises:
[0067] A segmentation and conversion module, configured to segment and convert the image to be processed to obtain a plurality of color statistics values;
[0068] A third acquisition module is configured to map the color statistical value onto the two-dimensional plane to obtain a plurality of color statistical points;
[0069] The third determination module is configured to determine that the shooting environment has multiple color temperature light sources when multiple color statistical points are simultaneously located in different color temperature areas on the two-dimensional plane.
[0070] In some embodiments, the first determining module includes:
[0071] A first determination submodule is configured to determine the color temperature mixing degree of two color temperature areas in different color temperature areas based on the color statistical points located in different color temperature areas;
[0072] A second determination submodule is configured to determine the color temperature category proportions of two color temperature areas in different color temperature areas based on the color statistical points located in different color temperature areas;
[0073] A third determination submodule is configured to determine, based on the color temperature mixing degree and a preset adaptation parameter, a mixing category weight corresponding to the color temperature mixing degrees of two color temperature areas in different color temperature areas;
[0074] The fourth determination submodule is configured to determine the weights of the different color temperature areas based on the color temperature category proportions and the mixed category weights.
[0075] 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;
[0076] The color temperature mixing degree of two color temperature areas in different color temperature areas includes: a first color temperature area and a second color temperature mixing degree of a first color temperature area and a second color temperature area;
[0077] The first determination submodule is further configured to determine that the first-second color temperature mixing degree is a preset mixing degree when the first total number of the color statistical points located in the first color temperature area and the second total number of the color statistical points located in the second color temperature area are both preset total numbers; determine the first-second color temperature mixing degree based on the first total number 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; and determine the first-second color temperature mixing degree based on the second total number when the first total number is less than the second total number.
[0078] In some embodiments, the apparatus further comprises:
[0079] a fourth acquisition module, configured to sum the first total and the second total to obtain a first sum value;
[0080] The first determination submodule is further configured to determine the first and second color temperature mixing degree based on the ratio between twice the first total and the first sum value; and determine the first and second color temperature mixing degree based on the ratio between twice the second total and the first sum value.
[0081] 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;
[0082] The color temperature category proportions of the two color temperature areas in the different color temperature areas include: first and second color temperature category proportions of the first color temperature area and the second color temperature area;
[0083] The second determination submodule is further configured to sum the color statistical points located within the first color temperature region and the color statistical points located within the second color temperature region to obtain a second summed value; sum the color statistical points located within the first color temperature region, the color statistical points located within the second color temperature region, and the color statistical points located within the third color temperature region to obtain a third summed value; and determine the first to second color temperature category ratio based on the ratio between the second summed value and the third summed value.
[0084] 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;
[0085] The color temperature mixing degree of the two color temperature regions includes: a first and a second color temperature mixing degree;
[0086] The mixed category weights include: first color temperature category weights corresponding to the first and second color temperatures, second color temperature category weights corresponding to the first and second color temperatures, and third color temperature category weights corresponding to the first and second color temperatures;
[0087] The third determination submodule is further configured to determine the first color temperature category weight corresponding to the first and second color temperatures based on the first and second color temperature mixing degree, the third color temperature adaptation parameter corresponding to the first and second color temperatures in the preset adaptation parameters, and the first color temperature adaptation parameter corresponding to the first and second color temperatures in the preset adaptation parameters; determine the second color temperature category weight corresponding to the first and second color temperatures based on the first and second color temperature mixing degree, the third color temperature adaptation parameter corresponding to the first and second color temperatures in the preset adaptation parameters, and the second color temperature adaptation parameter corresponding to the first and second color temperatures in the preset adaptation parameters; determine the third color temperature category weight corresponding to the first and second color temperatures based on the third color temperature adaptation parameter corresponding to the first and second color temperatures in the preset adaptation parameters.
[0088] 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;
[0089] The mixed category weights include: first color temperature category weights corresponding to the first and second color temperatures, first color temperature category weights corresponding to the first and third color temperatures, and first color temperature category weights corresponding to the second and third color temperatures;
[0090] The color temperature category weights include: category weights of the first and second color temperatures, category weights of the first and third color temperatures, and category weights of the second and third color temperatures;
[0091] The weights of the different color temperature regions include: the weight of the first color temperature region;
[0092] The fourth determination submodule is further configured to determine the weight of the first color temperature area based on the first color temperature category weights corresponding to the first and second color temperatures, the first color temperature category weights corresponding to the first and third color temperatures, the first color temperature category weights corresponding to the second and third color temperatures, the category proportions of the first and second color temperatures, the category proportions of the first and third color temperatures, and the category proportions of the second and third color temperatures.
[0093] In some embodiments, the apparatus further comprises:
[0094] A fifth acquisition module is configured to acquire a calibration area on the two-dimensional plane, wherein calibration points of different light sources on the two-dimensional plane are all within the calibration area;
[0095] A 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;
[0096] The calibration area is the sum of different color temperature areas, and the different color temperature areas do not overlap.
[0097] In some embodiments, the sixth acquisition module is further configured to divide the area where the calibration points of the light sources within the first color temperature range are located into a first color temperature area; divide the area where the calibration points of the light sources within the second color temperature range are located into a second color temperature area; and divide the area where the calibration points of the light sources within the third color temperature range are located into a third color temperature area; wherein the color temperature values within the first color temperature range, the color temperature values within the second color temperature range, and the color temperature values within the third color temperature range are all different.
[0098] In some embodiments, the second acquisition module is further configured to obtain the processed image based on the first color gain value, the second color gain value, the third color gain value in the white balance gain and the color components of the image to be processed in three different colors.
[0099] According to a third aspect of an embodiment of the present disclosure, a white balance processing device is provided, the device comprising at least: a processor and a memory for storing executable instructions that can be run on the processor, wherein:
[0100] When the processor is used to run the executable instructions, the executable instructions execute the steps in the white balance processing method provided in the first aspect above.
[0101] According to a fourth aspect of an embodiment of the present disclosure, a non-temporary computer-readable storage medium is provided, wherein the computer-readable storage medium stores computer-executable instructions, which, when executed by a processor, implement the white balance processing method provided in the first aspect above.
[0102] The technical solution provided by the embodiments of the present disclosure may have the following beneficial effects:
[0103] In the embodiment of the present disclosure, when there are multiple color temperature light sources in the shooting environment, color statistical points in different color temperature regions are obtained; based on the color statistical points in different color temperature regions, the weights of the different color temperature regions are determined; based on the color statistical points in different color temperature regions and the weights of the different color temperature regions, the white balance gain value of the image to be processed is determined. In this way, the white balance processing method of the embodiment of the present disclosure can be applied to shooting environments with multiple color temperature light sources, and can also determine the white balance gain value based on different color statistical points and the weights of different color temperature regions, and thus can obtain accurate white balance gain values of the image to be processed in multiple color temperature light source scenes, so that the image to be processed exhibits correct imaging colors.
[0104] It is to be understood that the foregoing general description and the following detailed description are exemplary and explanatory only and are not restrictive of the present disclosure. BRIEF DESCRIPTION OF THE DRAWINGS
[0105] 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 present disclosure.
[0106] Figure 1 This is a white balance processing method flow shown in the embodiment of the present disclosure Figure 1 .
[0107] Figure 2 It is a schematic diagram of the calibration area shown in an embodiment of the present disclosure.
[0108] Figure 3 It is a schematic diagram of dividing color temperature areas shown in an embodiment of the present disclosure.
[0109] Figure 4 This is a white balance processing method flow shown in the embodiment of the present disclosure Figure 2 .
[0110] Figure 5 This is a white balance processing method flow shown in the embodiment of the present disclosure Figure 3 .
[0111] Figure 6 A white balance processing device shown in the embodiment of the present disclosure Figure 1 .
[0112] Figure 7 A white balance processing device shown in the embodiment of the present disclosure Figure 2 . DETAILED DESCRIPTION
[0113] Exemplary embodiments will be described in detail herein, examples of which are shown in the accompanying drawings. When the following description refers to the drawings, the same numbers in different drawings represent the same or similar elements unless otherwise indicated. The embodiments described in the following exemplary embodiments do not represent all embodiments consistent with the present disclosure. Instead, they are merely examples of devices and methods consistent with some aspects of the present disclosure as detailed in the appended claims.
[0114] Figure 1 This is a white balance processing method flow shown in the embodiment of the present disclosure Figure 1 ,like Figure 1 As shown, it is applied to a terminal device with a white balance processing function, and the terminal device performs a white balance processing method including the following steps:
[0115] S101, when there are multiple color temperature light sources in the shooting environment, obtaining color statistical points located in different color temperature areas on a two-dimensional plane;
[0116] S102, determining weights of different color temperature areas according to the color statistical points in different color temperature areas;
[0117] S103, 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;
[0118] S104 , performing white balance processing on the image to be processed based on the white balance gain value to obtain a processed image.
[0119] The above-mentioned 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 includes a mobile phone, a notebook, a tablet computer or a separate camera terminal. The wearable electronic device includes a smart watch or a smart bracelet. The embodiments of the present disclosure are not limited.
[0120] The above white balance processing method is applicable to scenes where there are multiple light sources of color temperatures in the shooting environment. For example, there are two or three light sources of different color temperatures in the shooting environment.
[0121] The above-mentioned color temperature is a physical quantity for evaluating the color of a light source. Objects exhibit different colors when illuminated by light sources with different color temperatures, which causes the object's reflected spectrum to deviate from the true color. For example, under the illumination of a low color temperature light source such as an indoor tungsten light, a white object will appear to have an orange hue, and the photographed object will appear to be yellowish. For another example, under the illumination of a high color temperature light source such as a blue sky, a white object will appear to have a blue hue. The terminal device uses a white balance processing method to correct the color deviation of the image to be processed in the shooting scene of multiple color temperature light sources, so that the processed image exhibits the correct imaging color.
[0122] In step S101, different color temperature light sources may have different color temperatures. The light sources in the shooting environment may be divided into a first color temperature light source, a second color temperature light source, and a third color temperature light source. In the disclosed embodiment, the first color temperature light source, the second color temperature light source, and the third color temperature light source may all be composed of one or more ambient light sources.
[0123] If the color temperature value of the first color temperature light source is greater than the preset first color temperature threshold, the first color temperature light source can be called a high color temperature light source, and the light source color of the high color temperature light source tends to be blue; if the color temperature value of the third color temperature light source is less than the preset second color temperature threshold, 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 tends to be yellow; if the color temperature value of the second color temperature light source is between the preset first color temperature threshold and the preset second color temperature threshold, the second color temperature light source can be called a medium color temperature light source, and the light source color of the medium color temperature light source tends to be white.
[0124] In the disclosed embodiment, 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 requirements. For example, two or more different color temperature areas can be divided. It should be noted that different color temperature areas do not overlap, and the calibration points of different color temperature light sources are located in different color temperature areas. For example, the calibration point of the first color temperature light source can be located in the first color temperature area; the calibration point of the second color temperature light source can be located in the second color temperature area; the calibration point of the third color temperature light source can be located in the third color temperature area.
[0125] It should be noted that the calibration area can be the area surrounded by calibration points of different light sources in the shooting environment. Figure 2 As shown, in the shooting environment, light sources D75, D65, D50, TL84, CWF, A and H are located in the calibration area 11. Figure 3 As shown, the embodiment of the present disclosure can also divide the calibration area into a high color temperature area 12, a medium color temperature area 13 and a low color temperature area 14 according to the color temperature. Among them, the color temperature value of the light source with the calibration point located in the high color temperature area is greater than the color temperature value of the light source with the calibration point located in the medium color temperature area; the color temperature value of the light source with the calibration point located in the medium color temperature area is greater than the color temperature value of the light source with the calibration point located in the low color temperature area.
[0126] In the embodiment of the present disclosure, different color temperature areas located on the two-dimensional plane may include three different color temperature areas located on the two-dimensional plane, the three different color temperature areas include a first color temperature area, a second color temperature area and a third color temperature area, and obtaining color statistical points within the different color temperature areas located on the two-dimensional plane may include: obtaining the sum of the color statistical points within the first color temperature area, the sum of the color statistical points within the second color temperature area, and the sum of the color statistical points within the third color temperature area.
[0127] In step S102, the number of color temperature light sources in the shooting environment is associated with the color statistical points in different color temperature regions. For example, if there are two different color temperature light sources in the shooting environment, there are color statistical points in the two color temperature regions on the corresponding two-dimensional plane. For another example, if there are three different color temperature light sources in the shooting environment, there are color statistical points in the three color temperature regions on the corresponding two-dimensional plane.
[0128] In the embodiment of the present disclosure, the color temperature light sources in the shooting environment are different, and the corresponding color statistical points in different color temperature areas show different differences. Therefore, the embodiment of the present disclosure can more accurately determine the weights of different color temperature areas according to the color statistical points in different color temperature areas.
[0129] Determining the weights of different color temperature areas according to the color statistical points in different color temperature areas includes: determining the weights of different color temperature areas by comparing the sums of the color statistical points in different color temperature areas; wherein comparing the sums of the color statistical points in different color temperature areas includes: comparing the difference between the sums of the color statistical points in different color temperature areas, or comparing the ratio of the sums of the color statistical points in different color temperature areas, which is not limited in the embodiments of the present disclosure.
[0130] In step S103, after determining the weights of different color temperature areas, the terminal device may determine the 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. The different color temperature areas include a first color temperature area, a second color temperature area, and a third color temperature area. The white balance gain of the image to be processed is determined based on the color statistical points in the different color temperature areas and the weights of the different color temperature areas, including:
[0131] Based on the product of the color statistical points of the first color temperature area and the weight of the first color temperature area, the product of the color statistical points of the second color temperature area and the weight of the second color temperature area, and the product of the color statistical points of the third color temperature area and the weight of the third color temperature area, the color statistical average value in the multi-color temperature light source scene is determined; and then based on the color statistical average value in the multi-color temperature light source scene, the white balance gain of the image to be processed is determined.
[0132] Wherein, based on the product between the color statistical point of the first color temperature area and the weight of the first color temperature area, the product between the color statistical point of the second color temperature area and the weight of the second color temperature area, and the product between the color statistical point of the third color temperature area and the weight of the third color temperature area, the color statistical average value in the multi-color temperature light source scene is determined, including:
[0133] First, based on the product of the color statistical points of the first color temperature area and the weight of the first color temperature area, the product of the color statistical points of the second color temperature area and the weight of the second color temperature area, and the product of the color statistical points of the third color temperature area and the weight of the third color temperature area, multiple color statistical values of the weighted image to be processed are determined; then, based on the average value of the multiple color statistical values of the weighted image to be processed, the color statistical average value in the multi-color temperature light source scene is determined.
[0134] Taking RgBg as an example, an image to be processed is composed of multiple red, green and blue (RGB) pixels. After determining the color statistics under the multi-color temperature light source scene, the first color gain value in the white balance gain, i.e., the R gain value, can be determined by formula (1a), and the second color gain value in the white balance gain, i.e., the G gain value, can be determined by formula (1b); and the third color gain value in the white balance gain, i.e., the B gain value, can be determined by formula (1c). Among them, the color statistical average value under the multi-color temperature light source scene includes the color statistical average value of the Rg axis on the two-dimensional plane as Rg avg The color statistical average of the Bg axis on the two-dimensional plane is Bg avg .
[0135] R gain value = 1 / Rg avg (1a)
[0136] G gain value = 1.0 (1b)
[0137] B gain value = 1 / Bg avg (1c)
[0138] That is to say, the embodiment of the present disclosure does not directly determine the white balance gain value of the image to be processed based on the color statistical points, but takes into account the different color statistical points in different color temperature areas, and the different weights of different color temperature areas corresponding to different shooting environments, thereby being able to obtain a more accurate white balance gain value of the image to be processed based on the different weights.
[0139] In step S104, based on the white balance gain value of the image to be processed, the terminal device can perform white balance processing on 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.
[0140] In some embodiments, performing white balance processing on an image to be processed based on a white balance gain value to obtain a processed image includes: 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 in three different colors.
[0141] In the embodiment of the present disclosure, the color components of the image to be processed under three different colors include: a color component under a first color, a color component under a second color, and a color component under a third color;
[0142] Based on the first color gain value, the second color gain value, the third color gain value in the white balance gain and the color components of the image to be processed under three different colors, the processed image is obtained, including:
[0143] A processed image is obtained based on the product of the first color gain value and the color component under the first color, the product of the second color gain value and the color component under the second color, and the product of the third color gain value and the color component under the third color.
[0144] It can be understood that, under 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 exhibit correct imaging color.
[0145] In the embodiment of the present disclosure, when there are multiple color temperature light sources in the shooting environment, color statistical points in different color temperature regions are obtained; based on the color statistical points in different color temperature regions, the weights of the different color temperature regions are determined; based on the color statistical points in different color temperature regions and the weights of the different color temperature regions, the white balance gain value of the image to be processed is determined. In this way, the white balance processing method of the embodiment of the present disclosure can be applied to shooting environments with multiple color temperature light sources, and can also determine the white balance gain value based on different color statistical points and the weights of different color temperature regions, and thus can obtain accurate white balance gain values of the image to be processed in multiple color temperature light source scenes, so that the image to be processed exhibits correct imaging colors.
[0146] In some embodiments, the terminal device performs the white balance processing method further comprising:
[0147] Segmenting and converting the image to be processed to obtain multiple color statistics values;
[0148] Mapping the color statistical value onto the two-dimensional plane to obtain a plurality of color statistical points;
[0149] When a plurality of the color statistical points are simultaneously located in different color temperature regions on the two-dimensional plane, it is determined that the shooting environment has a plurality of color temperature light sources.
[0150] In the embodiment of the present disclosure, the terminal device may determine that there are multiple color temperature light sources in the shooting environment before step S101.
[0151] The above-mentioned image to be processed is an original RAW image that has not been color processed, which is the original data converted into a digital signal by a light source signal captured by a CMOS or CCD image sensor.
[0152] It should be noted that a to-be-processed image is composed of a plurality of red, green, and blue (RGB) pixels. The to-be-processed image is segmented and converted to obtain a plurality of color statistics, including: segmenting the to-be-processed image into a plurality of blocks, calculating the average value of the R, G, and B components of each block, and converting the average value of the R, G, and B components of each block into a two-dimensional color space to obtain a plurality of color statistics.
[0153] The areas of the multiple blocks may be equal, and the multiple color spaces include UV (the color part of YUV), CbCr (the color part of YCbCr) or RgBg, which is not limited in the embodiments of the present disclosure.
[0154] Taking RgBg as an example, the image to be processed is segmented and converted to obtain multiple color statistics, among which the color statistics R g It can be obtained by formula (2a), the color statistics value B g It can be expressed by formula (2b). Where R avg Represents the average value of the block under the R component, G avg Indicates the average value of the G component, B avg Indicates the average value of the block under the B component.
[0155] R g =R avg / G avg (2a)
[0156] B g =B avg / G avg (2b)
[0157] In the disclosed embodiment, the color statistical values are mapped onto a two-dimensional plane to obtain a plurality of color statistical points, wherein the number of the color statistical points is the same as the number of the color statistical values of the blocks in the image to be processed.
[0158] Taking RgBg as an example, the horizontal coordinate of the RgBg rectangular coordinate system in the two-dimensional plane can be R g , the ordinate of the RgBg rectangular coordinate system can be B gIn this way, the color statistical value of each block is mapped to the two-dimensional plane of RgBg, and multiple color statistical points can be obtained.
[0159] In some embodiments, the terminal device performs the white balance processing method further comprising:
[0160] Acquire a calibration area on the two-dimensional plane, wherein calibration points of different light sources on the two-dimensional plane are all within the calibration area;
[0161] Dividing the calibration area according to the color temperatures of different light sources to obtain different color temperature areas;
[0162] The calibration area is the sum of different color temperature areas, and the different color temperature areas do not overlap.
[0163] In the embodiment of the present disclosure, the calibration area may be an area surrounded by calibration points of different light sources in the shooting environment on a two-dimensional plane. The calibration area may be located in an area surrounded by two adjacent coordinate axes of a rectangular coordinate system in a two-dimensional plane. Taking RgBg as an example, the calibration area may be located in the positive direction of the Rg coordinate axis and the positive direction of the Bg coordinate axis in the RgBg rectangular coordinate system.
[0164] In some embodiments, dividing the calibration area according to the color temperatures of different light sources to obtain different color temperature areas includes:
[0165] Dividing the area where the calibration point of the light source within the first color temperature range is located as the first color temperature area;
[0166] Dividing the area where the calibration point of the light source within the second color temperature range is located as the second color temperature area;
[0167] Dividing the area where the calibration point of the light source within the third color temperature range is located as the third color temperature area;
[0168] The color temperature values within the first color temperature range, the color temperature values within the second color temperature range, and the color temperature values within the third color temperature range are all different.
[0169] In the embodiment of the present disclosure, different color temperature areas include a first color temperature area, a second color temperature area and a third color temperature area. The first color temperature area may include calibration points of one or more light sources whose color temperatures are within the first color temperature range, the second color temperature area may include calibration points of one or more light sources whose color temperatures are within the second color temperature range, and the third color temperature area may include calibration points of one or more light sources whose color temperatures are within the third color temperature range.
[0170] It should be noted that the color temperature value of the first color temperature range is greater than the color temperature value of the second color temperature range, and the color temperature value of the second color temperature range is greater than the color temperature value of the third color temperature range. For example, the first color temperature range may include the calibration points of three light sources: D75 (color temperature 7500°K), D65 (color temperature 6500°K) and D50 (color temperature 5000°K); the second color temperature light source may include the calibration points of two light sources: CWF (color temperature 4100°K) and TL84 (color temperature 4000°K); the third color temperature light source may include the calibration points of two light sources: A (color temperature 2850°K) and H (color temperature 2300°K).
[0171] In the embodiment of the present disclosure, after different color temperature areas are divided, the terminal device can determine whether multiple color statistical points are located in different color temperature areas at the same time. When multiple color statistical points are located in different color temperature areas at the same time, it is determined that there are multiple color temperature light sources in the shooting environment, including: when multiple color temperature statistical points are located in two different color temperature areas at the same time, it is determined that there are two color temperature light sources in the shooting environment; when multiple color temperature statistical points are located in three different color temperature areas at the same time, it is determined that there are three color temperature light sources in the shooting environment.
[0172] In the disclosed embodiment, 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 simultaneously located in different color temperature areas. In this way, the disclosed embodiment makes the detection of multiple color temperature light source scenes simpler, does not require complex calculations, and can improve the efficiency of perceiving multiple light sources with different color temperatures in the shooting environment.
[0173] In some embodiments, determining the weights of different color temperature regions according to the color statistical points in different color temperature regions includes:
[0174] Determining the color temperature mixing degree of two color temperature areas in different color temperature areas based on the color statistical points located in different color temperature areas;
[0175] Determining the color temperature category proportions of two color temperature areas in different color temperature areas based on the color statistical points located in different color temperature areas;
[0176] Determining, based on the color temperature mixing degree and the preset adaptation parameter, a mixing category weight corresponding to the color temperature mixing degree of two color temperature areas in different color temperature areas;
[0177] Based on the color temperature category proportions and the mixed category weights, weights of different color temperature areas are determined.
[0178] In the disclosed embodiment, the color statistical points in two color temperature regions can quantify the color temperature mixing degree of the two color temperature regions. The value range of the color temperature mixing degree is between 0.0 and 1.0. The larger the value of the color temperature mixing degree of two color temperature regions in different color temperature regions, the smaller the difference in the total number of color statistical points located in the corresponding different color temperature regions, and the more obvious the situation where different color temperature light sources appear at the same time to form a mixed color temperature.
[0179] It should be noted that when the different color temperature areas include three different color temperature areas, the color temperature mixing degree of two color temperature areas among the three color temperature areas can be determined through the color statistical points in the three different color temperature areas. For example, the three color temperature areas include: a first color temperature area, a second color temperature area, and a third color temperature area; the first color temperature area can be a high color temperature area, the second color temperature area can be a medium color temperature area, and the third color temperature area can be a low color temperature area, and correspondingly, a high-medium color temperature mixing degree, a high-low color temperature mixing degree, or a medium-low color temperature mixing degree can be obtained.
[0180] In the 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;
[0181] The color temperature mixing degree of two color temperature areas in different color temperature areas includes: a first color temperature area and a second color temperature mixing degree of a first color temperature area and a second color temperature area;
[0182] In the process of determining the color temperature mixing degree of two color temperature regions, determining the color temperature mixing degree of two color temperature regions in different color temperature regions based on the color statistical points located in different color temperature regions includes:
[0183] When a first total number of the color statistical points located in the first color temperature region and a second total number of the color statistical points located in the second color temperature region are both preset total numbers, determining that the first and second color temperature mixing degree is a preset mixing degree;
[0184] When the first total number is greater than or equal to the second total number, and both the first total number and the second total number are not the preset total number, determining the first and second color temperature mixing degrees based on the first total number;
[0185] When the first total is less than the second total, the first and second color temperature mixing degrees are determined based on the second total.
[0186] In the disclosed embodiment, the preset mixing degree can be determined according to the preset total number. For example, when the preset total number is set to 0, it indicates that there is no first color temperature light source corresponding to the first color temperature area and no second color temperature light source corresponding to the second color temperature area in the shooting environment, and thus the preset mixing degree can be set to 0.0.
[0187] In the embodiment of the present disclosure, when the first total is greater than the second total, the first and second color temperature mixing degrees are determined based on the first total, including: determining the first and second color temperature mixing degrees based on the difference between the first total and the second total; or, determining the first and second color temperature mixing degrees based on the first total and the first summed value obtained by summing the first total and the second total, and the embodiment of the present disclosure is not limited.
[0188] It should be noted that when the first color temperature area is a high color temperature area and the second color temperature area is a low color temperature area, a corresponding high and low color temperature mixing degree can be obtained; when the first color temperature area is a medium color temperature area and the second color temperature area is a low color temperature area, a corresponding medium and low color temperature mixing degree can be obtained; when the first color temperature area is a high color temperature area and the second color temperature area is a medium color temperature area, a corresponding high and medium color temperature mixing degree can be obtained.
[0189] That is to say, when different color temperature areas include a high color temperature area, a low color temperature area, and a medium color temperature area, the embodiment of the present disclosure can determine the high-low color temperature mixing degree, the medium-low color temperature mixing degree, and the medium-high color temperature mixing degree based on the color statistical points in the high color temperature area, the color statistical points in the medium color temperature area, and the color statistical points in the low color temperature area.
[0190] In some embodiments, the method further includes: summing the first total and the second total to obtain a first sum value;
[0191] Determining a first and second color temperature mixing degree based on the first total number includes: determining the first and second color temperature mixing degree based on a ratio between twice the first total number and the first sum value;
[0192] The determining the first and second color temperature mixing degrees based on the second total comprises:
[0193] The first second color temperature mixing degree is determined based on a ratio between twice the second total and the first sum value.
[0194] like Figure 4 As shown, taking the first color temperature region as a high color temperature region and the second color temperature region as a low color temperature region as an example, the step of determining the high and low color temperature mixing degree by the terminal device in the embodiment of the present disclosure includes:
[0195] S301, determining whether the first total number of color statistical points in the high color temperature region and the second total number of color statistical points in the low color temperature region are both preset total numbers; if so, proceed to step S302; if not, proceed to step S303;
[0196] Step S302, determining the high and low color temperature mixing degree as a preset mixing degree;
[0197] Step S303, determine whether the first total is greater than or equal to the second total; if so, go to step S304, if not, go to step S305;
[0198] S304, summing the first total and the second total to obtain a first sum value; determining a high and low color temperature mixing degree based on a ratio between twice the first total and the first sum value;
[0199] S305 , sum the first total and the second total to obtain a first sum value; and determine a high and low color temperature mixing degree based on a ratio between twice the second total and the first sum value.
[0200] In the embodiment of the present disclosure, the determination of the first and second color temperature mixing degrees can be applicable to different situations of the first total number and the second total number, thereby improving the accuracy of the determination of the first and second color temperature mixing degrees.
[0201] 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;
[0202] The color temperature mixing degree of the two color temperature regions includes: a first and a second color temperature mixing degree;
[0203] Mixed category weights, including: first color temperature category weights corresponding to the first and second color temperatures, second color temperature category weights corresponding to the first and second color temperatures, and third color temperature category weights corresponding to the first and second color temperatures;
[0204] The determining, based on the color temperature mixing degree and the preset adaptation parameter, a mixing category weight corresponding to the color temperature mixing degree of two color temperature areas in different color temperature areas comprises:
[0205] Determine a first color temperature category weight corresponding to the first and second color temperatures based on a first and second color temperature mixing degree, 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;
[0206] Determine a second color temperature category weight corresponding to the first and second color temperatures based on a first and second color temperature mixing degree, 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;
[0207] Based on the third color temperature adaptation parameter corresponding to the first and second color temperatures in the preset adaptation parameters, the third color temperature category weight corresponding to the first and second color temperatures is determined.
[0208] In the embodiment of the present disclosure, 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 corresponding mixed category weights include: high color temperature category weights corresponding to high and low color temperatures, low color temperature category weights corresponding to high and low color temperatures, and medium color temperature category weights corresponding to high and low color temperatures;
[0209] 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 corresponding mixed category weights include: a high color temperature category weight corresponding to a high and medium color temperature, a medium color temperature category weight corresponding to a high and medium color temperature, and a low color temperature category weight corresponding to a high and medium color temperature;
[0210] When the first color temperature area is a medium 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 corresponding mixed category weights include: medium color temperature category weights corresponding to medium and low color temperatures, low color temperature category weights corresponding to medium and low color temperatures, and high color temperature category weights corresponding to medium and low color temperatures.
[0211] In the disclosed embodiment, the preset adaptation parameters include: first color temperature adaptation parameters corresponding to the first and second color temperatures, second color temperature adaptation parameters corresponding to the first and second color temperatures, and third color temperature adaptation parameters corresponding to the first and second color temperatures; first color temperature adaptation parameters corresponding to the first and third color temperatures, second color temperature adaptation parameters corresponding to the first and third color temperatures, and third color temperature adaptation parameters corresponding to the first and third color temperatures; first color temperature adaptation parameters corresponding to the second and third color temperatures, second color temperature adaptation parameters corresponding to the second and third color temperatures, and third color temperature adaptation parameters corresponding to the second and third color temperatures.
[0212] It should be noted that the preset adaptation parameters can 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 and third color temperatures is 50, the second color temperature adaptation parameter corresponding to the first and third color temperatures is 70, and the third color temperature adaptation parameter corresponding to the first and third color temperatures is 30. For another example, the first color temperature adaptation parameter corresponding to the second and third color temperatures is 60, the second color temperature adaptation parameter corresponding to the second and third color temperatures is 40, and the third color temperature adaptation parameter corresponding to the second and third color temperatures is 50.
[0213] In the embodiment of the present disclosure, based on the first and second color temperature mixing degree, the third color temperature adaptation parameter corresponding to the first and second color temperatures in the preset adaptation parameters, and the first color temperature adaptation parameter corresponding to the first and second color temperatures in the preset adaptation parameters, determining the first color temperature category weight corresponding to the first and second color temperatures includes:
[0214] First, the difference between the first color temperature adaptation parameter corresponding to the first and second color temperatures in the preset adaptation parameters and the third color temperature adaptation parameter corresponding to the first and second color temperatures in the preset adaptation parameters is calculated; then the product between the difference and the mixing degree of the first and second color temperatures is calculated, and finally the sum of the product and the third color temperature adaptation parameter corresponding to the first and second color temperatures in the preset adaptation parameters is calculated to obtain the first color temperature category weights corresponding to the first and second color temperatures.
[0215] Exemplarily, 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 category weights corresponding to the high and low color temperatures. The high color temperature category weights corresponding to the high and low color temperatures are HL_H_Wet; the high color temperature adaptation parameter corresponding to the high and low color temperatures in the preset adaptation parameters is HL_H; and the medium color temperature adaptation parameter corresponding to the high and low color temperatures in the preset adaptation parameters is HL_M.
[0216] HL_H_Wet=HL_M+(HL_H-HL_M)*high and low color temperature mixing degree (3)
[0217] When the first color temperature region is a high color temperature region and the second color temperature region is a medium color temperature region, the high color temperature category weight corresponding to the high and medium color temperatures can be determined by using formula (4). Among them, the high color temperature category weight corresponding to the high and medium color temperatures is HM_H_Wet; the high color temperature adaptation parameter corresponding to the high and medium color temperatures in the preset adaptation parameters is HM_H; and the low color temperature adaptation parameter corresponding to the high and medium color temperatures in the preset adaptation parameters is HM_L.
[0218] HM_H_Wet=HM_L+(HM_H-HM_L)*high and medium color temperature mixing degree (4)
[0219] When the first color temperature region is a medium color temperature region and the second color temperature region is a low color temperature region, the formula (5) can be used to determine the medium color temperature category weight corresponding to the medium and low color temperature. 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 and low color temperature in the preset adaptation parameter is ML_M; and the high color temperature adaptation parameter corresponding to the medium and low color temperature in the preset adaptation parameter is ML_H.
[0220] ML_M_Wet = ML_H + (ML_M - ML_H) * medium and low color temperature mixing degree (5)
[0221] In the embodiment of the present disclosure, based on the color temperature mixing degree corresponding to the first and second color temperatures, the third color temperature adaptation parameter corresponding to the first and second color temperatures in the preset adaptation parameters, and the second color temperature adaptation parameter corresponding to the first and second color temperatures in the preset adaptation parameters, determining the second color temperature category weight corresponding to the first and second color temperatures includes:
[0222] Obtain the difference between the second color temperature adaptation parameter corresponding to the first and second color temperatures in the preset adaptation parameters and the third color temperature adaptation parameter corresponding to the first and second color temperatures in the preset adaptation parameters, obtain the product between the difference and the mixing degree of the first and second color temperatures, and obtain the sum of the product and the third color temperature adaptation parameter corresponding to the first and second color temperatures in the preset adaptation parameters to obtain the second color temperature category weights corresponding to the first and second color temperatures.
[0223] 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 (6) may be used to determine the low color temperature category weights corresponding to the high and low color temperatures. The low color temperature category weights corresponding to the high and low color temperatures are HL_L_Wet; the low color temperature adaptation parameter corresponding to the high and low color temperatures in the preset adaptation parameters is HL_L; and the medium color temperature adaptation parameter corresponding to the high and low color temperatures in the preset adaptation parameters is HL_M.
[0224] HL_L_Wet=HL_M+(HL_L-HL_M)*high and low color temperature mixing degree (6)
[0225] When the first color temperature region is a high color temperature region and the second color temperature region is a medium color temperature region, the formula (7) can be used to determine the medium color temperature category weight corresponding to the high and medium color temperature. Among them, the medium color temperature category weight corresponding to the high and medium color temperature is HM_M_Wet; the medium color temperature adjustment parameter corresponding to the high and medium color temperature in the preset adjustment parameter is HM_M; and the low color temperature adjustment parameter corresponding to the high and medium color temperature in the preset adjustment parameter is HM_L.
[0226] HM_M_Wet=HM_L+(HM_M-HM_L)*high and medium color temperature mixing degree (7)
[0227] 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 (8) can be used to determine the low color temperature region corresponding to the medium 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 temperature in the preset adaptation parameter is ML_L; and the high color temperature adaptation parameter corresponding to the medium and low color temperature in the preset adaptation parameter is ML_H.
[0228] ML_L_Wet=ML_H+(ML_L-ML_H)*medium and low color temperature mixing degree (8)
[0229] In an embodiment of the present disclosure, the third color temperature adaptation parameter corresponding to the first and second color temperatures in the preset adaptation parameters determines the third color temperature category weight corresponding to the first and second color temperatures, including: using the third color temperature adaptation parameter corresponding to the first and second color temperatures in the preset adaptation parameters as the third color temperature category weight corresponding to the first and second color temperatures.
[0230] 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 embodiment of the present disclosure may use formula (9) to determine the medium color temperature category weights corresponding to high and low color temperatures. Among them, the medium color temperature adaptation parameter corresponding to high and low color temperatures in the preset adaptation parameter is HL_M.
[0231] HL_M_Wet=HL_M (9)
[0232] 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 embodiment of the present disclosure may use formula (10) to determine the low color temperature category weight corresponding to the high and medium color temperatures. Among them, the low color temperature adaptation parameter corresponding to the high and medium color temperatures in the preset adaptation parameters is HM_L.
[0233] HM_L_Wet=HM_L (10)
[0234] 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 embodiment of the present disclosure may use formula (11) to determine the high color temperature category weight corresponding to the medium and low color temperatures. Among them, the high color temperature adaptation parameter corresponding to the medium color temperature in the preset adaptation parameter is ML_H.
[0235] ML_H_Wet=ML_H (11)
[0236] Exemplarily, 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 mixed category weights corresponding to the two color temperature mixing degrees include: high color temperature category weights corresponding to high and low color temperatures, low color temperature category weights corresponding to high and low color temperatures, and medium color temperature category weights corresponding to high and low color temperatures.
[0237] In the process of determining the mixed category weights corresponding to high and low color temperatures, when the high and low color temperature mixed degree value is 0.0, it means that the situation where high and low color temperatures form a mixed color temperature is not obvious. Substituting HL_H value of 70, HL_M value of 50, HL_L value of 20 and the high and low color temperature mixed degree value of 0.0 into formula (3), formula (6) and formula (9), HL_H_Wet, HL_M_Wet and HL_L_Wet are obtained to be the same value of 50, indicating that when the high and low mixed color temperatures are not obvious, the category weights of the three color temperature areas of high color temperature area, medium color temperature area and low color temperature area are the same.
[0238] When the value of the high and low color temperature mixing degree is 1.0, it means that the high and low color temperatures form a mixed color temperature. Substituting HL_H value of 70, HL_M value of 50, HL_L value of 20, and the high and low color temperature mixing degree value of 1.0 into formula (3), formula (6) and formula (9), we get HL_H_Wet, HL_M_Wet and HL_L_Wet as preset values of 70, 50 and 20, which means that when the high and low mixed color temperatures are obvious, the weight corresponding to the high color temperature area is 70, and the weight corresponding to the low color temperature area is 20. It can be seen that when the values of HL_H, HL_M and HL_L are 70, 50 and 20 respectively, it means that when the high and low mixed color temperature scene appears, the category weights of the high, medium and low color temperature areas corresponding to the high, medium and low color temperature statistical points are different. If there is no high and low mixed color temperature scene, the weights of the high, medium and low color temperature statistical points remain consistent, all of which are 50.
[0239] 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;
[0240] The color temperature category proportions of the two color temperature areas in the different color temperature areas include: first and second color temperature category proportions of the first color temperature area and the second color temperature area;
[0241] The determining, based on the color statistical points located in different color temperature regions, the color temperature category proportions of two color temperature regions in different color temperature regions comprises:
[0242] Summing the color statistical points located within the first color temperature region and the color statistical points located within the second color temperature region to obtain a second summed value;
[0243] Summing the color statistical points located in the first color temperature region, the color statistical points located in the second color temperature region, and the color statistical points located in the third color temperature region to obtain a third summed value;
[0244] The first to second color temperature category ratio is determined based on a ratio between the second summed value and the third summed value.
[0245] In the embodiment of the present disclosure, in the process of determining the weights of different color temperature areas, the mixed category weights need to be converted into weights of different color temperature areas, and the color temperature category proportions of the two color temperature areas need to be considered during the conversion process.
[0246] Exemplarily, 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 category proportions may be determined using formula (12). The first and second color temperature category proportions are high and low color temperature category proportions, the color statistical point located in the first color temperature region is a high color temperature statistical point, the color statistical point located in the second color temperature region is a low color temperature color statistical point, and the color statistical point located in the third color temperature region is a medium color temperature color statistical point.
[0247]
[0248] 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 first and second color temperature category proportions may be determined using formula (13). The first and second color temperature category proportions are medium and low color temperature category proportions, the color statistical points located in the first color temperature region are medium color temperature statistical points, the color statistical points located in the second color temperature region are low color temperature color statistical points, and the color statistical points located in the third color temperature region are high color temperature color statistical points.
[0249]
[0250] 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 category proportions may be determined using formula (14). The first and second color temperature category proportions are medium and high color temperature category proportions, the color statistical point located in the first color temperature region is a high color temperature statistical point, the color statistical point located in the second color temperature region is a medium color temperature color statistical point, and the color statistical point located in the third color temperature region is a low color temperature color statistical point.
[0251]
[0252] 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;
[0253] The mixed category weights include: first color temperature category weights corresponding to the first and second color temperatures, first color temperature category weights corresponding to the first and third color temperatures, and first color temperature category weights corresponding to the second and third color temperatures;
[0254] The color temperature category weights include: category weights of the first and second color temperatures, category weights of the first and third color temperatures, and category weights of the second and third color temperatures;
[0255] The weights of the different color temperature regions include: the weight of the first color temperature region;
[0256] The determining the weights of different color temperature areas based on the color temperature category proportions and the mixed category weights includes:
[0257] The weight of the first color temperature area is determined based on the first color temperature category weights corresponding to the first and second color temperatures, the first color temperature category weights corresponding to the first and third color temperatures, the first color temperature category weights corresponding to the second and third color temperatures, the category proportions of the first and second color temperatures, the category proportions of the first and third color temperatures, and the category proportions of the second and third color temperatures.
[0258] In the embodiment of the present disclosure, based on the first color temperature category weights corresponding to the first and second color temperatures, the first color temperature category weights corresponding to the first and third color temperatures, the first color temperature category weights corresponding to the second and third color temperatures, the category weights of the first and second color temperatures, the category weights of the first and third color temperatures, and the category weights of the second and third color temperatures, the weights of the first and third color temperatures are determined, including:
[0259] The first product is obtained by multiplying the category proportions of the first and second color temperatures and the first color temperature category weights corresponding to the first and second color temperatures; the second product is obtained by multiplying the category proportions of the first and third color temperatures and the first color temperature category weights corresponding to the first and third color temperatures; the third product is obtained by multiplying the category proportions of the second and third color temperatures and the first color temperature category weights corresponding to the second and third color temperatures; the first product, the second product and the third product are summed to obtain the weight of the first color temperature area.
[0260] Exemplarily, 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 by using formula (15). The first color temperature category weights corresponding to the first and second color temperatures are HL_H_Wet, the first color temperature category weights corresponding to the first and third color temperatures are HM_H_Wet, the first color temperature category weights corresponding to the second and third color temperatures are ML_H_Wet, the category weights of the first and second color temperatures are the high and low color temperature category weights A, the category weights of the first and third color temperatures are the high and medium color temperature category weights B, the category weights of the second and third color temperatures are the medium and low color temperature category ratios C, and the weight of the first color temperature region is the weight of the high color temperature region.
[0261] The weight of the high color temperature area = HL_H_Wet*A+ML_H_Wet*C+HM_H_Wet*B (15)
[0262] 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 can be determined by using formula (16). The first color temperature category weights corresponding to the first and second color temperatures are ML_M_Wet, the first color temperature category weights corresponding to the first and third color temperatures are HM_M_Wet, the first color temperature category weights corresponding to the second and third color temperatures are HL_M_Wet, the category weights of the first and second color temperatures are medium and low color temperature category weights C, the category weights of the first and third color temperatures are medium and high color temperature category weights B, the category weights of the second and third color temperatures are high and low color temperature category ratios A, and the weight of the first color temperature region is the weight corresponding to the medium color temperature region.
[0263] Weight of medium color temperature area = HL_M_Wet*A+ML_M_Wet*C+HM_M_Wet*B (16)
[0264] 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 can be determined by using formula (17). Among them, the first color temperature category weights corresponding to the first and second color temperatures are ML_L_Wet, the first color temperature category weights corresponding to the first and third color temperatures are HL_L_Wet, the first color temperature category weights corresponding to the second and third color temperatures are HM_L_Wet, the category proportions of the first and second color temperatures are the medium and low color temperature category proportions C, the category proportions of the first and third color temperatures are the high and low color temperature category proportions A, the category proportions of the second and third color temperatures are the high and medium color temperature category ratios B, and the weight of the first color temperature region is the weight corresponding to the low color temperature region.
[0265] Weight of low color temperature area = HL_L_Wet*A+ML_L_Wet*C+HM_L_Wet*B (17)
[0266] In order to better understand the above embodiments, the embodiments of the present disclosure are exemplified as follows:
[0267] like Figure 5 As shown, the terminal device performs a white balance processing method including:
[0268] S201, obtaining a calibration area on the two-dimensional plane;
[0269] S202, dividing the calibration area according to the color temperatures of different light sources to obtain different color temperature areas;
[0270] S203, when there are multiple color temperature light sources in the shooting environment, obtaining color statistical points located in different color temperature regions on the two-dimensional plane;
[0271] S204, determining the color temperature mixing degree of two color temperature areas in different color temperature areas based on the color statistical points located in different color temperature areas;
[0272] S205, determining the color temperature category proportions of two color temperature areas in different color temperature areas based on the color statistical points located in different color temperature areas;
[0273] S206, determining a mixing category weight corresponding to the color temperature mixing degree of two color temperature areas in different color temperature areas based on the color temperature mixing degree and the preset adaptation parameter;
[0274] S207, determining weights of different color temperature areas based on the color temperature category proportions and the mixed category weights;
[0275] S208, 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;
[0276] S209 , performing white balance processing on the image to be processed based on the white balance gain value to obtain a processed image.
[0277] The white balance processing method of the disclosed embodiment can be applied to shooting environments with multiple color temperature light sources, and can also determine white balance gain values based on weights of different color statistical points and different color temperature areas, thereby being able to obtain accurate white balance gain values for images to be processed in multiple color temperature light source scenes, so that the images to be processed exhibit correct imaging colors.
[0278] Figure 6 A white balance processing device according to an exemplary embodiment is shown Figure 1 . Reference Figure 6 The white balance processing device includes a first acquisition module 1001, a first determination module 1002, a second determination module 1003 and a second acquisition module 1004, wherein:
[0279] The first acquisition module 1001 is configured to acquire color statistical points located in different color temperature regions on a two-dimensional plane when there are multiple color temperature light sources in the shooting environment;
[0280] A first determination module 1002 is configured to determine weights of different color temperature areas according to the color statistical points in different color temperature areas;
[0281] A second determination module 1003 is configured to determine a white balance gain value of the image to be processed based on the color statistical points in different color temperature regions and the weights of different color temperature regions;
[0282] The second acquisition 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.
[0283] In some embodiments, the apparatus further comprises:
[0284] A segmentation and conversion module, configured to segment and convert the image to be processed to obtain a plurality of color statistics values;
[0285] A third acquisition module is configured to map the color statistical value onto the two-dimensional plane to obtain a plurality of color statistical points;
[0286] The third determination module is configured to determine that the shooting environment has multiple color temperature light sources when multiple color statistical points are simultaneously located in different color temperature areas on the two-dimensional plane.
[0287] In some embodiments, the first determining module includes:
[0288] A first determination submodule is configured to determine the color temperature mixing degree of two color temperature areas in different color temperature areas based on the color statistical points located in different color temperature areas;
[0289] A second determination submodule is configured to determine the color temperature category proportions of two color temperature areas in different color temperature areas based on the color statistical points located in different color temperature areas;
[0290] A third determination submodule is configured to determine a mixing category weight corresponding to the color temperature mixing degree of two color temperature areas in different color temperature areas based on the color temperature mixing degree and a preset adaptation parameter;
[0291] The fourth determination submodule is configured to determine the weights of the different color temperature areas based on the color temperature category proportions and the mixed category weights.
[0292] 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;
[0293] The color temperature mixing degree of two color temperature areas in different color temperature areas includes: a first color temperature area and a second color temperature mixing degree of a first color temperature area and a second color temperature area;
[0294] The first determination submodule is further configured to determine that the first-second color temperature mixing degree is a preset mixing degree when the first total number of the color statistical points located in the first color temperature area and the second total number of the color statistical points located in the second color temperature area are both preset total numbers; determine the first-second color temperature mixing degree based on the first total number 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; and determine the first-second color temperature mixing degree based on the second total number when the first total number is less than the second total number.
[0295] In some embodiments, the apparatus further comprises:
[0296] a fourth acquisition module, configured to sum the first total and the second total to obtain a first sum value;
[0297] The first determination submodule is further configured to determine the first and second color temperature mixing degree based on the ratio between twice the first total and the first sum value; and determine the first and second color temperature mixing degree based on the ratio between twice the second total and the first sum value.
[0298] 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;
[0299] The color temperature category proportions of the two color temperature areas in the different color temperature areas include: first and second color temperature category proportions of the first color temperature area and the second color temperature area;
[0300] The second determination submodule is further configured to sum the color statistical points located within the first color temperature region and the color statistical points located within the second color temperature region to obtain a second summed value; sum the color statistical points located within the first color temperature region, the color statistical points located within the second color temperature region, and the color statistical points located within the third color temperature region to obtain a third summed value; and determine the first to second color temperature category ratio based on the ratio between the second summed value and the third summed value.
[0301] 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;
[0302] The color temperature mixing degree of the two color temperature regions includes: a first and a second color temperature mixing degree;
[0303] Mixed category weights, including: first color temperature category weights corresponding to the first and second color temperatures, second color temperature category weights corresponding to the first and second color temperatures, and third color temperature category weights corresponding to the first and second color temperatures;
[0304] The third determination submodule is further configured to determine the first color temperature category weight corresponding to the first and second color temperatures based on the first and second color temperature mixing degree, the third color temperature adaptation parameter corresponding to the first and second color temperatures in the preset adaptation parameters, and the first color temperature adaptation parameter corresponding to the first and second color temperatures in the preset adaptation parameters; determine the second color temperature category weight corresponding to the first and second color temperatures based on the first and second color temperature mixing degree, the third color temperature adaptation parameter corresponding to the first and second color temperatures in the preset adaptation parameters, and the second color temperature adaptation parameter corresponding to the first and second color temperatures in the preset adaptation parameters; determine the third color temperature category weight corresponding to the first and second color temperatures based on the third color temperature adaptation parameter corresponding to the first and second color temperatures in the preset adaptation parameters.
[0305] 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;
[0306] The mixed category weights include: first color temperature category weights corresponding to the first and second color temperatures, first color temperature category weights corresponding to the first and third color temperatures, and first color temperature category weights corresponding to the second and third color temperatures;
[0307] The color temperature category weights include: category weights of the first and second color temperatures, category weights of the first and third color temperatures, and category weights of the second and third color temperatures;
[0308] The weights of the different color temperature regions include: the weight of the first color temperature region;
[0309] The fourth determination submodule is further configured to determine the weight of the first color temperature area based on the first color temperature category weights corresponding to the first and second color temperatures, the first color temperature category weights corresponding to the first and third color temperatures, the first color temperature category weights corresponding to the second and third color temperatures, the category proportions of the first and second color temperatures, the category proportions of the first and third color temperatures, and the category proportions of the second and third color temperatures.
[0310] In some embodiments, the apparatus further comprises:
[0311] A fifth acquisition module is configured to acquire a calibration area on the two-dimensional plane, wherein calibration points of different light sources on the two-dimensional plane are all within the calibration area;
[0312] A 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;
[0313] The calibration area is the sum of different color temperature areas, and the different color temperature areas do not overlap.
[0314] In some embodiments, the sixth acquisition module is further configured to divide the area where the calibration points of the light sources within the first color temperature range are located into a first color temperature area; divide the area where the calibration points of the light sources within the second color temperature range are located into a second color temperature area; and divide the area where the calibration points of the light sources within the third color temperature range are located into a third color temperature area; wherein the color temperature values within the first color temperature range, the color temperature values within the second color temperature range, and the color temperature values within the third color temperature range are all different.
[0315] In some embodiments, the second acquisition module is further configured to obtain the processed image based on the first color gain value, the second color gain value, the third color gain value in the white balance gain and the color components of the image to be processed in three different colors.
[0316] Regarding the device in the above embodiment, the specific manner in which each module performs operations has been described in detail in the embodiment of the method, and will not be elaborated here.
[0317] Figure 7 A white balance processing device according to an exemplary embodiment is shown Figure 2 For example, the device may be a mobile phone, a mobile computer, etc.
[0318] Reference Figure 7 , the device may include one or more of the following components: a processing component 802 , a memory 804 , a power component 806 , a multimedia component 808 , an audio component 810 , an input / output (I / O) interface 812 , a sensor component 814 , and a communication component 816 .
[0319] The processing component 802 generally controls the overall operation of the device, such as operations associated with display, phone calls, data communications, camera operations, and recording operations. The processing component 802 may include one or more processors 820 to execute instructions to complete all or part of the steps of the above-mentioned method. In addition, the processing component 802 may include one or more modules to facilitate the interaction between the processing component 802 and other components. For example, the processing component 802 may include a multimedia module to facilitate the interaction between the multimedia component 808 and the processing component 802.
[0320] The memory 804 is configured to store various types of data to support the operation of the device. Examples of such data include instructions for any application or method operating on the device, contact data, phone book data, messages, pictures, videos, etc. The memory 804 can be implemented by any type of volatile or non-volatile storage device or a combination thereof, 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 disk or optical disk.
[0321] The power component 806 provides power to the various components of the device. The power component 806 may include a power management system, one or more power supplies, and other components associated with generating, managing, and distributing power to the device.
[0322] 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 input signals from the 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 boundaries of the 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 camera and / or a rear camera. When the device is in an operating mode, such as a shooting mode or a video mode, the front camera and / or the rear camera may receive external multimedia data. Each front camera and rear camera may be a fixed optical lens system or have a focal length and optical zoom capability.
[0323] The audio component 810 is configured to output and / or input audio signals. For example, the audio component 810 includes a microphone (MIC), and when the device is in an operating mode, such as a call mode, a recording mode, and a speech recognition mode, the microphone is configured to receive an external audio signal. The received audio signal can be further stored in the memory 804 or sent via the communication component 816. In some embodiments, the audio component 810 also includes a speaker for outputting audio signals.
[0324] I / O interface 812 provides an interface between processing component 802 and peripheral interface modules, such as 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.
[0325] The sensor assembly 814 includes one or more sensors for providing various aspects of the status assessment for the device. For example, the sensor assembly 814 can detect the open / closed state of the device, the relative positioning of the components, such as the display and keypad of the device, and the sensor assembly 814 can also detect the position change of the device or a component of the device, the presence or absence of user contact with the device, the device orientation or acceleration / deceleration and the temperature change of the device. The sensor assembly 814 may include a proximity sensor configured to detect the presence of nearby objects 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 accelerometer, a gyroscope sensor, a magnetic sensor, a pressure sensor or a temperature sensor.
[0326] The communication component 816 is configured to facilitate wired or wireless communication between the device and other devices. The device can 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 also includes a near field communication (NFC) module to facilitate short-range communication. For example, the NFC module can be implemented based on radio frequency identification (RFID) technology, infrared data association (IrDA) technology, ultra-wideband (UWB) technology, Bluetooth (BT) technology and other technologies.
[0327] 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, microcontrollers, microprocessors or other electronic components to perform the above methods.
[0328] In an exemplary embodiment, a non-transitory computer-readable storage medium including instructions is also provided, such as a memory 804 including instructions, and the instructions can be executed by the processor 820 of the device to perform the above method. For example, the non-transitory computer-readable storage medium can be a ROM, a random access memory (RAM), a CD-ROM, a magnetic tape, a floppy disk, an optical data storage device, etc.
[0329] A non-transitory computer-readable storage medium, when instructions in the storage medium are executed by a processor of a terminal device, enables the terminal device to perform a white balance processing method, the method comprising:
[0330] When there are multiple color temperature light sources in the shooting environment, obtain color statistical points located in different color temperature areas on the two-dimensional plane;
[0331] Determining weights of different color temperature areas according to the color statistical points in different color temperature areas;
[0332] Determining a white balance gain value of the image to be processed based on the color statistical points in different color temperature regions and the weights of different color temperature regions;
[0333] White balance processing is performed on the image to be processed based on the white balance gain value to obtain a processed image.
[0334] Those skilled in the art will readily appreciate other embodiments of the present disclosure after considering the specification and practicing the invention disclosed herein. This application is intended to cover any variations, uses or adaptations of the present disclosure, which follow the general principles of the present disclosure and include common knowledge or customary techniques in the art that are not disclosed in the present disclosure. The specification and examples are intended to be exemplary only, and the true scope and spirit of the present disclosure are indicated by the claims.
[0335] It should be understood that the present disclosure is not limited to the exact structures that have been 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
1. A white balance processing method, characterized in that: The method comprises: When there are multiple color temperature light sources in the shooting environment, obtain color statistical points located in different color temperature areas on the two-dimensional plane; Determining weights of different color temperature areas according to the color statistical points in different color temperature areas; Determining a white balance gain value of the image to be processed based on the color statistical points in different color temperature regions and the weights of different color temperature regions; Performing white balance processing on the image to be processed based on the white balance gain value to obtain a processed image; The step of determining the weights of different color temperature areas according to the color statistical points in different color temperature areas includes: Determining the color temperature mixing degree of two color temperature areas in different color temperature areas based on the color statistical points located in different color temperature areas; Determining the color temperature category proportions of two color temperature areas in different color temperature areas based on the color statistical points located in different color temperature areas; Determining, based on the color temperature mixing degree and a preset adaptation parameter, a mixing category weight corresponding to the color temperature mixing degrees of two of the color temperature areas in different color temperature areas; Based on the color temperature category proportions and the mixed category weights, weights of different color temperature areas are determined.
2. The method according to claim 1, characterized in that: The method further comprises: Segmenting and converting the image to be processed to obtain a plurality of color statistics values; Mapping the color statistical value onto the two-dimensional plane to obtain a plurality of color statistical points; When a plurality of the color statistical points are simultaneously located in different color temperature regions on the two-dimensional plane, it is determined that the shooting environment has a plurality of color temperature light sources.
3. The method according to claim 1, characterized in that 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 of the color temperature areas in different color temperature areas includes: the first color temperature mixing degree of the first color temperature area and the second color temperature mixing degree of the second color temperature area; The determining, based on the color statistical points located in different color temperature regions, the color temperature mixing degree of two color temperature regions in different color temperature regions comprises: When a first total number of the color statistical points located in the first color temperature region and a second total number of the color statistical points located in the second color temperature region are both preset total numbers, determining that the first and second color temperature mixing degree is a preset mixing degree; When the first total number is greater than or equal to the second total number, and both the first total number and the second total number are not the preset total number, determining the first and second color temperature mixing degrees based on the first total number; When the first total is less than the second total, the first and second color temperature mixing degrees are determined based on the second total.
4. The method according to claim 3, characterized in that The method further comprises: summing the first total and the second total to obtain a first sum value; The determining the first and second color temperature mixing degrees based on the first total comprises: determining the first and second color temperature mixing degree based on a ratio between twice the first total and the first sum value; The determining the first and second color temperature mixing degrees based on the second total comprises: The first second color temperature mixing degree is determined based on a ratio between twice the second total and the first sum value.
5. The method according to claim 1, characterized in that 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 of the color temperature areas in different color temperature areas include: the first and second color temperature category proportions of the first color temperature area and the second color temperature area; The determining, based on the color statistical points located in different color temperature areas, the color temperature category proportions of two color temperature areas in different color temperature areas comprises: Summing the color statistical points located within the first color temperature region and the color statistical points located within the second color temperature region to obtain a second sum value; Summing the color statistical points located within the first color temperature region, the color statistical points located within the second color temperature region, and the color statistical points located within the third color temperature region to obtain a third summed value; The first to second color temperature category ratio is determined based on a ratio between the second summed value and the third summed value.
6. The method according to claim 1, characterized in that 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 the two color temperature regions includes: a first color temperature mixing degree and a second color temperature mixing degree; The mixed category weights include: first color temperature category weights corresponding to the first and second color temperatures, second color temperature category weights corresponding to the first and second color temperatures, and third color temperature category weights corresponding to the first and second color temperatures; The determining, based on the color temperature mixing degree and the preset adaptation parameter, the mixing category weights corresponding to the color temperature mixing degrees of two color temperature areas in different color temperature areas comprises: Determine a first color temperature category weight corresponding to the first and second color temperatures based on the first and second color temperature mixing degree, 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; Determine a second color temperature category weight corresponding to the first and second color temperatures based on the first and second color temperature mixing degree, 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; Based on the third color temperature adaptation parameters corresponding to the first and second color temperatures in the preset adaptation parameters, the third color temperature category weights corresponding to the first and second color temperatures are determined.
7. The method according to claim 1, characterized in that The different color temperature regions include: a first color temperature region, a second color temperature region and a third color temperature region; The mixed category weights include: first color temperature category weights corresponding to the first and second color temperatures, first color temperature category weights corresponding to the first and third color temperatures, and first color temperature category weights corresponding to the second and third color temperatures; The color temperature category weights include: category weights of the first and second color temperatures, category weights of the first and third color temperatures, and category weights of the second and third color temperatures; The weights of the different color temperature regions include: the weight of the first color temperature region; The determining the weights of different color temperature areas based on the color temperature category proportions and the mixed category weights includes: The weight of the first color temperature area is determined based on the first color temperature category weight corresponding to the first second color temperature, the first color temperature category weight corresponding to the first third color temperature, the first color temperature category weight corresponding to the second third color temperature, the category proportion of the first second color temperature, the category proportion of the first third color temperature, and the category proportion of the second third color temperature.
8. The method according to claim 1 or 2, characterized in that: The method further comprises: Acquire a calibration area on the two-dimensional plane, wherein calibration points of different light sources on the two-dimensional plane are all within the calibration area; Dividing the calibration area according to the color temperatures of the 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 do not overlap.
9. The method according to claim 8, characterized in that The step of dividing the calibration area according to the color temperatures of the different light sources to obtain different color temperature areas includes: Dividing the area where the calibration point of the light source within the first color temperature range is located as 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 as a second color temperature area; Dividing the area where the calibration point of the light source within the third color temperature range is located as a third color temperature area; The color temperature values within the first color temperature range, the color temperature values within the second color temperature range, and the color temperature values within the third color temperature range are all different.
10. The method according to claim 1 or 2, characterized in that: The performing white balance processing on the image to be processed based on the white balance gain value to obtain a processed image includes: The processed image is obtained based on the first color gain value, the second color gain value, the third color gain value in the white balance gain and the color components of the image to be processed in three different colors.
11. A white balance processing device, characterized in that: The device comprises: A first acquisition module is configured to acquire color statistical points located in different color temperature areas on a two-dimensional plane when there are multiple color temperature light sources in the shooting environment; A first determination module is configured to determine weights of different color temperature areas according to the color statistical points in different color temperature areas; A second determination module is configured to determine a white balance gain value of the image to be processed based on the color statistical points in different color temperature regions and the weights of different color temperature regions; A 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; The first determining module includes: A 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 statistical points located in different color temperature areas; A second determination submodule is configured to determine the color temperature category proportions of two color temperature areas in different color temperature areas based on the color statistical points located in different color temperature areas; A third determining submodule is configured to determine, based on the color temperature mixing degree and a preset adaptation parameter, a mixing category weight corresponding to the color temperature mixing degrees of two of the color temperature areas in different color temperature areas; The fourth determination submodule is configured to determine the weights of the different color temperature areas based on the color temperature category proportions and the mixed category weights.
12. The device according to claim 11, characterized in that The device also includes: A segmentation and conversion module, configured to segment and convert the image to be processed to obtain a plurality of color statistics values; A third acquisition module is configured to map the color statistical value onto the two-dimensional plane to obtain a plurality of color statistical points; The third determination module is configured to determine that the shooting environment has multiple color temperature light sources when multiple color statistical points are simultaneously located in different color temperature areas on the two-dimensional plane.
13. The device according to claim 11, characterized in that 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 of the color temperature areas in different color temperature areas includes: the first color temperature mixing degree of the first color temperature area and the second color temperature mixing degree of the second color temperature area; The first determination submodule is further configured to determine that the first-second color temperature mixing degree is a preset mixing degree when the first total number of the color statistical points located in the first color temperature area and the second total number of the color statistical points located in the second color temperature area are both preset total numbers; determine the first-second color temperature mixing degree based on the first total number 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; and determine the first-second color temperature mixing degree based on the second total number when the first total number is less than the second total number.
14. The device according to claim 13, characterized in that The device also includes: a fourth acquisition module, configured to sum the first total and the second total to obtain a first sum value; The first determination submodule is further configured to determine the first and second color temperature mixing degree based on the ratio between twice the first total and the first sum value; and determine the first and second color temperature mixing degree based on the ratio between twice the second total and the first sum value.
15. The device according to claim 11, characterized in that 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 of the color temperature areas in different color temperature areas include: the first and second color temperature category proportions of the first color temperature area and the second color temperature area; The second determination submodule is further configured to sum the color statistical points located within the first color temperature region and the color statistical points located within the second color temperature region to obtain a second summed value; sum the color statistical points located within the first color temperature region, the color statistical points located within the second color temperature region, and the color statistical points located within the third color temperature region to obtain a third summed value; and determine the first to second color temperature category ratio based on the ratio between the second summed value and the third summed value.
16. The device according to claim 11, characterized in that 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 the two color temperature regions includes: a first color temperature mixing degree and a second color temperature mixing degree; The mixed category weights include: first color temperature category weights corresponding to the first and second color temperatures, second color temperature category weights corresponding to the first and second color temperatures, and third color temperature category weights corresponding to the first and second color temperatures; The third determination submodule is further configured to determine the first color temperature category weight corresponding to the first and second color temperatures based on the first and second color temperature mixing degree, the third color temperature adaptation parameter corresponding to the first and second color temperatures in the preset adaptation parameters, and the first color temperature adaptation parameter corresponding to the first and second color temperatures in the preset adaptation parameters; determine the second color temperature category weight corresponding to the first and second color temperatures based on the first and second color temperature mixing degree, the third color temperature adaptation parameter corresponding to the first and second color temperatures in the preset adaptation parameters, and the second color temperature adaptation parameter corresponding to the first and second color temperatures in the preset adaptation parameters; determine the third color temperature category weight corresponding to the first and second color temperatures based on the third color temperature adaptation parameter corresponding to the first and second color temperatures in the preset adaptation parameters.
17. The device according to claim 11, characterized in that The different color temperature regions include: a first color temperature region, a second color temperature region and a third color temperature region; The mixed category weights include: first color temperature category weights corresponding to the first and second color temperatures, first color temperature category weights corresponding to the first and third color temperatures, and first color temperature category weights corresponding to the second and third color temperatures; The color temperature category weights include: category weights of the first and second color temperatures, category weights of the first and third color temperatures, and category weights of the second and third color temperatures; The weights of the different color temperature regions include: the weight of the first color temperature region; The fourth determination submodule is further configured to determine the weight of the first color temperature area based on the first color temperature category weight corresponding to the first second color temperature, the first color temperature category weight corresponding to the first third color temperature, the first color temperature category weight corresponding to the second third color temperature, the category proportion of the first second color temperature, the category proportion of the first third color temperature, and the category proportion of the second third color temperature.
18. The device according to claim 11 or 12, characterized in that The device also includes: A fifth acquisition module is configured to acquire a calibration area on the two-dimensional plane, wherein calibration points of different light sources on the two-dimensional plane are all within the calibration area; a sixth acquisition module, configured to divide the calibration area according to the color temperatures of the 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 do not overlap.
19. The device according to claim 18, characterized in that The sixth acquisition module is further configured to divide the area where the calibration points of the light source located in the first color temperature range are located into a first color temperature area; divide the area where the calibration points of the light source located in the second color temperature range are located into a second color temperature area; and divide the area where the calibration points of the light source located in the third color temperature range are located into a third color temperature area; wherein the color temperature values within the first color temperature range, the color temperature values within the second color temperature range, and the color temperature values within the third color temperature range are all different.
20. The device according to claim 11 or 12, characterized in that The second acquisition module is further configured to obtain the processed image based on the first color gain value, the second color gain value, the third color gain value in the white balance gain and the color components of the image to be processed in three different colors.
21. A white balance processing device, characterized in that: The apparatus comprises at least: a processor and a memory for storing executable instructions that can be run on the processor, wherein: When the processor is used to run the executable instructions, the executable instructions execute the steps in the white balance processing method provided in any one of claims 1 to 10.
22. A non-transitory computer-readable storage medium, characterized in that: The computer-readable storage medium stores computer-executable instructions, which, when executed by a processor, implement the white balance processing method provided in any one of claims 1 to 10.