Local white balance adjustment method and device, equipment, storage medium and program product

By distinguishing the light source differences between the face area and the background area, and combining global and local adjustment levels, a white balance adjustment coefficient is generated for each pixel block. This solves the problem of face color distortion under complex lighting conditions and achieves white balance effects for both the image background and the face area.

CN121815100APending Publication Date: 2026-04-07SPREADTRUM SEMICON (NANJING) CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2025-12-29
Publication Date
2026-04-07

AI Technical Summary

Technical Problem

In complex lighting environments, existing technologies for adjusting image white balance result in color distortion in both the face and background areas.

Method used

By distinguishing the light source differences between the face area and the background area, and combining the global adjustment intensity of the face area with the local adjustment intensity of each pixel block, a white balance adjustment coefficient for each pixel block is generated, thereby enabling individual adjustment of the white balance of the face area.

Benefits of technology

It solves the color distortion problem of traditional global white balance in complex lighting scenes, and takes into account the white balance effect of image background and face area.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN121815100A_ABST
    Figure CN121815100A_ABST
Patent Text Reader

Abstract

The embodiment of the invention provides a local white balance adjustment method and device, equipment, a storage medium and a program product. The method comprises the following steps: acquiring a light source parameter of at least one face area and a light source parameter of a background area in a target image; for any one face area in the at least one face area, determining a local white balance adjustment coefficient according to the light source parameter of the face area and the light source parameter of the background area; determining the global adjustment strength of the face area and the local adjustment strength of each pixel block in the face area; determining a target white balance adjustment coefficient of each pixel block in the face area according to the global adjustment strength of the face area, the local adjustment strength of each pixel block in the face area and the local white balance adjustment coefficient; and adjusting the target image according to the target white balance adjustment coefficient of each pixel block in the at least one face region to obtain an adjusted image. The method can avoid the problem of color distortion in a complex light source scene.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This application relates to the field of image processing technology, and in particular to a method, apparatus, device, storage medium, and program product for local white balance adjustment. Background Technology

[0002] When shooting or previewing images, camera equipment often needs to automatically adjust the white balance of the image according to the ambient light conditions to ensure the authenticity and naturalness of the image colors.

[0003] In related techniques, a uniform compensation gain is typically generated based on the light source estimation results of the entire image and applied to all pixels. However, in complex lighting environments, the light source differences between the face area and the background area in the same image can be significant. If the above method is used to correct the image white balance, it will lead to color distortion in either the face area or the background area. Summary of the Invention

[0004] The local white balance adjustment method, apparatus, device, storage medium, and program products provided in this application can avoid color distortion problems in complex lighting scenarios.

[0005] In a first aspect, embodiments of this application provide a method for adjusting local white balance, including:

[0006] Obtain the light source parameters of at least one face region and the light source parameters of the background region in the target image;

[0007] For any face region in the at least one face region, a local white balance adjustment coefficient is determined based on the light source parameters of the face region and the light source parameters of the background region;

[0008] Determine the global adjustment intensity of the face region and the local adjustment intensity of each pixel block in the face region;

[0009] The target white balance adjustment coefficient for each pixel block in the face region is determined based on the global adjustment intensity of the face region, the local adjustment intensity of each pixel block in the face region, and the local white balance adjustment coefficient.

[0010] The target image is adjusted according to the target white balance adjustment coefficient of each pixel block in the at least one face region to obtain the adjusted image.

[0011] In one possible implementation, determining the local white balance adjustment coefficient based on the light source parameters of the face region and the light source parameters of the background region includes:

[0012] The difference value of the light source parameters is determined based on the light source parameters of the face region and the light source parameters of the background region;

[0013] Obtain first preset parameter information, which includes multiple preset light source parameter values ​​and a preset white balance adjustment coefficient corresponding to each light source parameter value;

[0014] The local white balance adjustment coefficient is determined based on the difference in the light source parameters and the first preset parameter information.

[0015] In one possible implementation, determining the global adjustment intensity of the face region includes:

[0016] Obtain facial information of the face region, wherein the facial information includes at least one of the following: face score, face size, effective face block ratio, and face brightness value;

[0017] Obtain second preset parameter information, which includes multiple preset face information and a preset adjustment intensity corresponding to each preset face information;

[0018] The global adjustment intensity is determined based on the facial information and the second preset parameter information.

[0019] In one possible implementation, determining the local adjustment intensity of each pixel block in the face region includes:

[0020] Determine the distance coefficient for each pixel block in the face region. The distance coefficient is the ratio of the distance between the pixel block and the center point of the face region to the maximum allowable distance from the pixel block to the face region along the same radial direction.

[0021] Obtain third preset parameter information, which includes multiple preset distance coefficients and a preset adjustment force corresponding to each preset distance coefficient;

[0022] The local adjustment intensity of each pixel block is determined based on the distance coefficient of each pixel block and the third preset parameter information.

[0023] In one possible implementation, determining the target white balance adjustment coefficient for each pixel block in the face region based on the global adjustment intensity of the face region, the local adjustment intensity of each pixel block in the face region, and the local white balance adjustment coefficient includes:

[0024] The local white balance adjustment coefficient is used as the initial white balance adjustment coefficient for each pixel block;

[0025] For any pixel block in the face region, the initial white balance adjustment coefficient of the pixel block is adjusted according to the global adjustment intensity of the face region and the local adjustment intensity of the pixel block to obtain the target white balance adjustment coefficient of the pixel block.

[0026] In one possible implementation, adjusting the target image according to the target white balance adjustment coefficient for each pixel block in the at least one face region to obtain the adjusted image includes:

[0027] Obtain the rotation angle of the face in at least one face region;

[0028] Adjust the direction of the corresponding facial region according to the rotation angle of the face;

[0029] The second lens shadow compensation table is determined based on the target white balance adjustment coefficient of each pixel block in at least one face region after adjustment and the first lens shadow compensation table;

[0030] The target image is adjusted according to the second lens shadow compensation table to obtain the adjusted image.

[0031] Secondly, embodiments of this application provide a local white balance adjustment device, comprising:

[0032] The acquisition module is used to acquire the light source parameters of at least one face region and the light source parameters of the background region in the target image;

[0033] The first determining module is used to determine a local white balance adjustment coefficient for any face region in the at least one face region, based on the light source parameters of the face region and the light source parameters of the background region.

[0034] The second determining module is used to determine the global adjustment intensity of the face region and the local adjustment intensity of each pixel block in the face region;

[0035] The third determining module is used to determine the target white balance adjustment coefficient of each pixel block in the face region based on the global adjustment intensity of the face region, the local adjustment intensity of each pixel block in the face region, and the local white balance adjustment coefficient.

[0036] An adjustment module is used to adjust the target image according to the target white balance adjustment coefficient of each pixel block in the at least one face region to obtain an adjusted image.

[0037] In one possible implementation, the first determining module is specifically used for:

[0038] The difference value of the light source parameters is determined based on the light source parameters of the face region and the light source parameters of the background region;

[0039] Obtain first preset parameter information, which includes multiple preset light source parameter values ​​and a preset white balance adjustment coefficient corresponding to each light source parameter value;

[0040] The local white balance adjustment coefficient is determined based on the difference in the light source parameters and the first preset parameter information.

[0041] In one possible implementation, the second determining module is specifically used for:

[0042] Obtain facial information of the face region, wherein the facial information includes at least one of the following: face score, face size, effective face block ratio, and face brightness value;

[0043] Obtain second preset parameter information, which includes multiple preset face information and a preset adjustment intensity corresponding to each preset face information;

[0044] The global adjustment intensity is determined based on the facial information and the second preset parameter information.

[0045] In one possible implementation, the second determining module is specifically used for:

[0046] Determine the distance coefficient for each pixel block in the face region. The distance coefficient is the ratio of the distance between the pixel block and the center point of the face region to the maximum allowable distance from the pixel block to the face region along the same radial direction.

[0047] Obtain third preset parameter information, which includes multiple preset distance coefficients and a preset adjustment force corresponding to each preset distance coefficient;

[0048] The local adjustment intensity of each pixel block is determined based on the distance coefficient of each pixel block and the third preset parameter information.

[0049] In one possible implementation, the third determining module is specifically used for:

[0050] The local white balance adjustment coefficient is used as the initial white balance adjustment coefficient for each pixel block;

[0051] For any pixel block in the face region, the initial white balance adjustment coefficient of the pixel block is adjusted according to the global adjustment intensity of the face region and the local adjustment intensity of the pixel block to obtain the target white balance adjustment coefficient of the pixel block.

[0052] In one possible implementation, the adjustment module is specifically used for:

[0053] Obtain the rotation angle of the face in at least one face region;

[0054] Adjust the direction of the corresponding facial region according to the rotation angle of the face;

[0055] The second lens shadow compensation table is determined based on the target white balance adjustment coefficient of each pixel block in at least one face region after adjustment and the first lens shadow compensation table;

[0056] The target image is adjusted according to the second lens shadow compensation table to obtain the adjusted image.

[0057] Thirdly, embodiments of this application provide an electronic device, including: a memory and a processor;

[0058] The memory stores computer-executed instructions;

[0059] The processor executes computer execution instructions stored in the memory, causing the processor to perform the first aspect and / or various possible implementations of the first aspect as described above.

[0060] Fourthly, embodiments of this application provide a computer-readable storage medium storing computer-executable instructions, which, when executed by a processor, are used to implement the first aspect and / or various possible implementations of the first aspect.

[0061] Fifthly, embodiments of this application provide a computer program product, including a computer program that, when executed by a processor, implements the first aspect and / or various possible implementations of the first aspect.

[0062] This application provides a method, apparatus, device, storage medium, and program product for local white balance adjustment. By distinguishing the light source differences between the face region and the background region, and combining the global adjustment intensity of the face region with the local adjustment intensity of each pixel block in the face region, a white balance adjustment coefficient for each pixel block in the face region is generated. This allows for individual adjustment of the white balance of the face region, achieving a white balance effect that takes into account both the image background and the face region, and solving the color distortion problem of traditional global white balance in complex lighting scenes. Attached Figure Description

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

[0064] Figure 1 Flowchart of the local white balance adjustment method provided in the embodiments of this application Figure 1 ;

[0065] Figure 2 A schematic diagram of the target image provided in the embodiments of this application;

[0066] Figure 3 A schematic diagram of the face region provided in the embodiments of this application;

[0067] Figure 4 A schematic diagram of a face frame provided in an embodiment of this application;

[0068] Figure 5 Flowchart of the local white balance adjustment method provided in the embodiments of this application Figure 2 ;

[0069] Figure 6 A schematic diagram of the distance coefficient provided for an embodiment of this application;

[0070] Figure 7 This is a schematic diagram of the structure of the local white balance adjustment device provided in the embodiments of this application;

[0071] Figure 8 This is a schematic diagram of the structure of an electronic device provided in an embodiment of this application.

[0072] The accompanying drawings illustrate specific embodiments of this application, which will be described in more detail below. These drawings and descriptions are not intended to limit the scope of the concept in any way, but rather to illustrate the concept of this application to those skilled in the art through reference to particular embodiments. Detailed Implementation

[0073] To make the objectives, technical solutions, and advantages of the embodiments of this application clearer, the technical solutions of the embodiments of this application will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of this application, not all embodiments. Based on the embodiments of this application, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of this application.

[0074] In the embodiments of this application, the term "at least one" refers to one or more, "multiple" refers to two or more, and other quantifiers are similar.

[0075] The terms "first," "second," etc., used in the embodiments of this application are for illustrative purposes and to distinguish the objects being described. They do not indicate any order or limit on the number of objects in the embodiments of this application, and cannot constitute any limitation on the embodiments of this application. For example, the use of terms such as "first preset parameter information" and "second preset parameter information" is only to distinguish different preset parameter information, and does not indicate any difference in the size, priority, or importance of these two preset parameter information.

[0076] It should be further understood that the terms "comprising" or "including" indicate the presence of the aforementioned features, steps, operations, elements, components, types, and / or groups, but do not exclude the presence, occurrence, or addition of one or more other features, steps, operations, elements, components, types, and / or groups.

[0077] In this application, terms such as "exemplary," "in some embodiments," and "in other embodiments" are used to indicate that something is an example, illustration, or description. Any embodiment or design described as "exemplary" in this application should not be construed as being more preferred or advantageous than other embodiments or designs. Rather, the term "exemplary" is used to present the concept in a specific manner.

[0078] It should be understood that although the steps in the flowcharts of this application's embodiments are shown sequentially according to the arrows, these steps are not necessarily executed in the order indicated by the arrows. Unless explicitly stated herein, there is no strict order restriction on the execution of these steps, and they can be executed in other orders. Moreover, at least some of the steps in the figures may include at least one sub-step or at least one stage. These sub-steps or stages are not necessarily completed at the same time, but can be executed at different times, and their execution order is not necessarily sequential, but can be performed alternately or in turn with other steps or at least a portion of the sub-steps or stages of other steps.

[0079] To address the technical problems in the background art, the local white balance adjustment method, apparatus, device, storage medium, and program product provided in this application distinguish the light source differences between the face region and the background region, and combine the global adjustment intensity of the face region with the local adjustment intensity of each pixel block in the face region to generate a white balance adjustment coefficient for each pixel block in the face region. This enables the individual adjustment of the white balance of the face region, achieving a white balance effect that takes into account both the image background and the face region, and solving the color distortion problem of traditional global white balance in complex lighting scenes.

[0080] The technical solution of this application and how the technical solution of this application solves the above-mentioned technical problems are described in detail below with specific embodiments. These specific embodiments can be combined with each other, and the same or similar concepts or processes may not be described again in some embodiments. The embodiments of this application will now be described with reference to the accompanying drawings.

[0081] Figure 1 Flowchart of the local white balance adjustment method provided in the embodiments of this application Figure 1 ,like Figure 1 As shown, the method includes the following steps:

[0082] S101. Obtain the light source parameters of at least one face region and the light source parameters of the background region in the target image.

[0083] The execution subject of this application embodiment can be an electronic device, a chip, or a chip module, or it can be a local white balance adjustment device installed in an electronic device, a chip, or a chip module. The local white balance adjustment device can be implemented by software or by a combination of software and hardware.

[0084] Among them, electronic devices can be devices with image processing capabilities, such as mobile phones, industrial cameras, web cameras, tablet computer cameras, game console cameras, video smartwatches, security cameras, camera modules, and other devices that use cameras to capture and preview images.

[0085] The target image can be acquired using an image sensor. After acquisition, black level correction can be performed on the target image. Following correction, a face capture module can be used to capture the face region and the face's rotation angle. For example, the target image might look like this: Figure 2 As shown in the image, the face capture module obtains the following results: Figure 3 The image shows the face region and its rotation angle of 45 degrees. That is, regardless of the rotation angle of the face in the target image, the face region captured by the face acquisition module is always positive, meaning the rotation angle of the face captured by the face acquisition module is 0 degrees.

[0086] For any face region in the target image, the face acquisition module can also acquire the face bounding box and the rotation angle of the face. The face bounding box is a rectangular frame that includes the face region. Regardless of the rotation angle of the face in the target image, the face in the face bounding box acquired by the face acquisition module is always upright, that is, the rotation angle of the face in the face bounding box acquired by the face acquisition module is 0 degrees. Figure 4 As shown, Figure 4 The shaded area in the image represents part of the background.

[0087] The face region or face bounding box captured by the face capture module can be downsampled.

[0088] The light source parameters for each face region and background region can be calculated separately using image analysis algorithms. For example, the light source parameters can be color temperature values ​​or red (R), green (G), and blue (B) gain values.

[0089] S102. For any face region in at least one face region, determine the local white balance adjustment coefficient based on the light source parameters of the face region and the light source parameters of the background region.

[0090] The local white balance adjustment factor refers to the white balance adjustment factor applied to the entire face area.

[0091] In one possible implementation, the local white balance adjustment coefficient can be determined based on the light source parameters of the face region and the background region in the following manner:

[0092] Based on the light source parameters of the face region and the light source parameters of the background region, determine the difference value of the light source parameters; obtain the first preset parameter information, which includes multiple preset light source parameter values ​​and the preset white balance adjustment coefficient corresponding to each light source parameter value; and determine the local white balance adjustment coefficient based on the difference value of the light source parameters and the first preset parameter information.

[0093] The light source parameters of the background region can be obtained based on the background region in the target image or based on the entire target image; this application does not impose any restrictions on this.

[0094] The light source parameter difference value is the difference between the light source parameters of the face region and the light source parameters of the background region.

[0095] For example, the light source parameter is the color temperature value. When the difference in the light source parameter is positive, the color temperature of the light source in the face area is higher than that of the light source in the background area (i.e., the ambient light source); when the difference in the light source parameter is negative, the color temperature of the light source in the face area is lower than that of the light source in the background area.

[0096] The first preset parameter information can be presented as a parameter set or in the form of a table; this application does not impose any restrictions on this. For example, the first preset parameter information can be shown in Table 1.

[0097] Table 1. First Preset Parameter Information

[0098]

[0099] Based on the difference in light source parameters, a light source parameter value matching the same transmission difference value is searched in the first preset parameter information. If a light source parameter value matching the transmission difference value exists, the white balance adjustment coefficient corresponding to that light source parameter value is used as the local white balance adjustment coefficient. For example, if light source parameter value 3 matches the transmission difference value, then white balance adjustment coefficient 3 is used as the local white balance adjustment coefficient.

[0100] If no light source parameter value with the same transmission difference value exists in the first preset parameter information, then the two light source parameter values ​​closest to the transmission difference value are searched in the first preset parameter information. Linear interpolation is then performed on the white balance adjustment coefficients corresponding to these two light source parameter values ​​to determine the local white balance adjustment coefficient. For example, if the two light source parameter values ​​closest to the transmission difference value are light source parameter value 4 and light source parameter value 5, then linear interpolation can be performed on the white balance adjustment coefficients 4 and 5 corresponding to light source parameter value 4 and white balance adjustment coefficient 5 to obtain the local white balance adjustment coefficient.

[0101] It should be noted that the white balance adjustment factor includes the white balance adjustment factor for the R channel and the white balance adjustment factor for the B channel.

[0102] S103. Determine the global adjustment intensity of the face region and the local adjustment intensity of each pixel block in the face region.

[0103] The global adjustment level of the face region can be determined based on the facial information of the face region.

[0104] The local adjustment intensity of each pixel block can be determined based on the position of each pixel block in the entire face area.

[0105] S104. Based on the global adjustment intensity of the face region, the local adjustment intensity of each pixel block in the face region, and the local white balance adjustment coefficient, determine the target white balance adjustment coefficient for each pixel block in the face region.

[0106] In one possible implementation, the target white balance adjustment coefficient for each pixel block in the face region can be determined based on the global adjustment intensity of the face region, the local adjustment intensity of each pixel block in the face region, and the local white balance adjustment coefficient, as follows:

[0107] The local white balance adjustment coefficient is used as the initial white balance adjustment coefficient for each pixel block. For any pixel block in the face region, the initial white balance adjustment coefficient of the pixel block is adjusted according to the global adjustment intensity of the face region and the local adjustment intensity of the pixel block to obtain the target white balance adjustment coefficient of the pixel block.

[0108] That is, the initial white balance adjustment factor is the same for each pixel block.

[0109] For example, the target balance adjustment factor for each pixel block can be calculated using the following formula:

[0110] ratio_r_new_i = (ratio_r_i–1.0)* stat_weight_i *global_weight+1.0

[0111] ratio_b_new_i = (ratio_b_i–1.0)*stat_weight_i*global_weight+1.0

[0112] Where ratio_r_new_i is the target white balance adjustment coefficient of pixel block i in the R channel, ratio_b_new_i is the target white balance adjustment coefficient of pixel block i in the B channel, ratio_r_i is the initial white balance adjustment coefficient of pixel block i in the R channel, ratio_b_i is the initial white balance adjustment coefficient of pixel block i in the B channel, stat_weight_i is the local adjustment intensity of the pixel block, and global_weight is the global adjustment intensity of the face region. The value of i is 1, 2, ..., n, where n is the total number of pixel blocks in the face region.

[0113] S105. Adjust the target image according to the target white balance adjustment coefficient of each pixel block in at least one face region to obtain the adjusted image.

[0114] Specifically, the white balance of the corresponding pixel block in the target image is adjusted according to the target white balance adjustment coefficient of each pixel block in at least one face region to obtain the adjusted image.

[0115] The white balance of the background region in the target image can be adjusted based on existing methods. For example, a uniform white balance gain for the background region can be calculated based on a global automatic white balance algorithm, and then the white balance of the background region can be adjusted according to this uniform white balance gain.

[0116] exist Figure 1 In the illustrated embodiment, by distinguishing the light source differences between the face region and the background region, and combining the global adjustment intensity of the face region and the local adjustment intensity of each pixel block in the face region, a white balance adjustment coefficient for each pixel block in the face region is generated. Based on the white balance adjustment coefficient of each pixel block in the face region, the white balance of the corresponding pixel block in the face region in the target image is adjusted, thereby realizing the independent adjustment of the white balance of the face region, achieving a white balance effect that takes into account both the image background and the face region, and solving the color distortion problem of traditional global white balance in complex lighting scenes.

[0117] Based on the above, the following will combine... Figure 5 This application describes the proposed solution.

[0118] Figure 5 Flowchart of the local white balance adjustment method provided in the embodiments of this application Figure 2 ,like Figure 5 As shown, the method includes the following steps:

[0119] S501. Obtain the light source parameters of at least one face region and the light source parameters of the background region in the target image.

[0120] S502. For any face region in at least one face region, determine the light source difference value based on the light source parameters of the face region and the light source parameters of the background region.

[0121] S503. Obtain first preset parameter information, which includes multiple preset light source parameter values ​​and a preset white balance adjustment coefficient corresponding to each light source parameter value.

[0122] S504. Determine the local white balance adjustment coefficient based on the difference in light source parameters and the first preset parameter information.

[0123] It should be noted that the execution process of S501 to S504 can be referred to the execution process of S101 to S102, and will not be repeated here.

[0124] S505. Obtain facial information of the face region, including at least one of the following: face score, face size, percentage of effective face blocks, and face brightness value.

[0125] A face score refers to a confidence score output by a face detection algorithm, used to determine the probability that a detected region is a real face. The value typically ranges from 0 to 1. For example, a face score of 0.95 means there is a 95% probability that the detected region is a real face, and it is considered a valid face region. If the face score is 0.31, which is below a preset threshold, it is considered an invalid region.

[0126] The preset threshold can be set based on actual conditions; for example, a preset threshold of 0.8 or 0.9 is used, but this application does not impose any restrictions on this. Invalid areas can be adjusted for white balance together with the background area.

[0127] Face size can refer to the proportion of the face region in the target image. It can be expressed by the number of pixels, the length and width, or the face proportion. The face proportion can be the ratio of the number of pixels in the face region to the total number of pixels in the entire image.

[0128] The percentage of effective feature blocks in a face can refer to the proportion of the number of effective feature blocks in the face region to the total number of feature blocks. Effective feature blocks refer to image blocks containing clear facial organs (eyes, nose, mouth, eyebrows), excluding blurry, occluded, and shadowed areas.

[0129] For example, a 500×500 face region is divided into a 20×20 grid (400 feature blocks in total). After detection, it was found that 320 blocks contain clear facial features, and 80 blocks are obscured by hair or shadows. Therefore, the effective proportion of face blocks is 320 / 400=80%.

[0130] Face brightness value refers to the average brightness parameter of the face area, reflecting the light intensity of the face area. It is usually expressed as the average gray value or the average brightness value of the RGB channels.

[0131] S506. Obtain second preset parameter information, which includes multiple preset face information and a preset adjustment intensity corresponding to each preset face information.

[0132] The second preset parameter information can be presented as a parameter set or in the form of a table; this application does not impose any restrictions on this. For example, the second preset parameter information can be shown in Table 2.

[0133] Table 2. Second Preset Parameter Information

[0134]

[0135] In another implementation, the second preset parameter information may include multiple preset face parameters and the adjustment weight corresponding to each preset face parameter, as shown in Table 3. The adjustment weight corresponding to different face information can be determined based on the adjustment weight corresponding to each face parameter in the face information.

[0136] Table 3. Second Preset Parameter Information

[0137]

[0138] S507. Determine the global adjustment intensity of the face region based on the face information and the second preset parameter information.

[0139] If the second preset parameter information includes multiple preset face information and a preset adjustment intensity corresponding to each preset face information, then the preset face information that is the same as the value of each parameter in the face information can be found in the second preset parameter information according to the value of each parameter in the face information. If there is a preset face information that is the same as the value of each parameter in the face information, then the adjustment intensity corresponding to the preset face information is determined as the global adjustment intensity of the face region.

[0140] If there is no preset face information in the second preset parameter information that has the same parameter values ​​as the face information, then find the two preset face information that are closest to the parameter values ​​in the face information in the table, perform linear interpolation calculation on the adjustment intensity corresponding to the two preset face information, and determine the global adjustment intensity of the face region.

[0141] If the second preset parameter information includes multiple preset face parameters and the adjustment strength weight corresponding to each preset face parameter, then the preset face parameter range including each parameter value in the face information can be found in the second preset parameter information, and then the global adjustment strength of the face region can be determined based on the sum of the adjustment strength weights corresponding to each preset face parameter range and the upper limit of the sum of all weights.

[0142] For example, if the face score of a certain face region falls within face score range 1, the face size proportion falls within face size range 2, the effective face block proportion falls within effective face block proportion range 2, and the face brightness value falls within face brightness value range 1, then the global adjustment strength of the face region = adjustment strength weight 1 × adjustment strength weight 5 × adjustment strength weight 7 × adjustment strength weight 8. For ease of calculation, the range of the global adjustment strength can be limited to 0~1. If the global adjustment strength is greater than 1, it can be normalized.

[0143] S508. Determine the distance coefficient of each pixel block in the face region. The distance coefficient is the ratio of the distance between the pixel block and the center point of the face region to the maximum allowable distance of the pixel block to the face region along the same radial direction.

[0144] To reduce the impact of local white balance adjustments on the background color, the face region can be approximated by an ellipse (or represented by a polygon formed by connecting key points of the face region, or other polygons). Figure 6 As shown, the major axis of the ellipse is half the length of the face region, and the minor axis is half the width of the face region. The distance coefficient of any pixel block P in the face region is OP / OM, where O is the center point of the ellipse, and M is the intersection of the line OP and the outer edge of the face region.

[0145] S509. Obtain third preset parameter information, which includes multiple preset distance coefficients and the preset adjustment force corresponding to each preset distance coefficient.

[0146] The third preset parameter information can be presented as a parameter set or in the form of a table; this application does not impose any restrictions on this. For example, the third preset parameter information can be shown in Table 4.

[0147] Table 4. Third Preset Parameter Information

[0148]

[0149] S510. Determine the local adjustment intensity of each pixel block based on the distance coefficient of each pixel block and the third preset parameter information.

[0150] For any pixel block in the face region, a preset distance coefficient with the same distance coefficient as that pixel block can be found in the third preset parameter information. If a preset distance coefficient with the same distance coefficient as that pixel block exists in the third preset parameter information, the adjustment force corresponding to that preset distance coefficient is determined as the local adjustment force of that pixel block. For example, if the distance coefficient 5 is the same as the distance coefficient of that pixel block, then the adjustment force 5 can be used as the local adjustment force of that pixel block.

[0151] If there is no preset distance coefficient in the third preset parameter information that is the same as the distance coefficient of the pixel block, then the two preset distance coefficients that are closest to the distance coefficient of the pixel block are searched in the third preset parameter information, and the adjustment force corresponding to the two preset distance coefficients is calculated by linear interpolation to determine the adjustment force of the pixel block.

[0152] It should be noted that the local adjustment intensity of pixel blocks in the face area shows a decreasing trend from the center to the edge. That is, the adjustment intensity of the pixel block located at the center point is the largest, and the adjustment intensity of the pixel block located at the edge of the face area is the smallest, so that the white balance effect of the face area and the background area can be naturally transitioned.

[0153] S511. Based on the global adjustment intensity of the face region, the local adjustment intensity of each pixel block in the face region, and the local white balance adjustment coefficient, determine the target white balance adjustment coefficient for each pixel block in the face region.

[0154] It should be noted that the execution process of S511 can be referred to the execution process of S104, and will not be repeated here.

[0155] S512. Obtain the rotation angle of the face in at least one face region.

[0156] The rotation angle of the face in each face region can be obtained through the face acquisition module.

[0157] S513. Adjust the direction of the corresponding face area according to the rotation angle of the face.

[0158] That is, the face region is rotated according to the rotation angle of the face so that the face region for local white balance adjustment coincides with the actual face region in the target image, thereby reducing the impact on the color of the background region.

[0159] S514. Determine the second lens shadow compensation table based on the target white balance adjustment coefficient of each pixel block in at least one face region after adjustment and the first lens shadow compensation table.

[0160] A lens shading compensation table can refer to two-dimensional tabular data used to correct lens shading effects. For example, a lens shading compensation table could contain gain values ​​for different pixel blocks to correct vignetting at the edges of an image.

[0161] The target white balance adjustment coefficients for each pixel block in at least one face region can form a white balance adjustment coefficient table. Multiplying this white balance adjustment coefficient table by the first lens shadow compensation table according to the position of the pixel block yields the second lens shadow compensation table.

[0162] S515. Adjust the target image according to the second lens shadow compensation table to obtain the adjusted image.

[0163] The second lens shading compensation table is applied to each pixel block of the target image. For example, the brightness value of each pixel block in the target image is multiplied by the corresponding compensation coefficient in the second lens shading compensation table to obtain the adjusted image.

[0164] If the second shadow compensation table does not include the compensation coefficients for all pixel blocks in the target image, then the second shadow compensation table can be interpolated to obtain the compensation coefficients for all pixel blocks in the target image, and then the compensation coefficients for each pixel block can be applied to the corresponding pixel block.

[0165] The adjusted image can also undergo automatic white balance correction, depixelation, and other processing, which are not limited in this application. Finally, the processed image is transmitted to a display for display or to a memory for storage.

[0166] By reusing the lens shading compensation table, the efficiency of local white balance adjustment is improved and the computational complexity is reduced, ensuring the feasibility of the solution in resource-constrained equipment.

[0167] Figure 7 This is a schematic diagram of the local white balance adjustment device provided in an embodiment of this application. Figure 7 As shown, the device 10 includes an acquisition module 11, a first determination module 12, a second determination module 13, a third determination module 14, and an adjustment module 15.

[0168] The acquisition module 11 is used to acquire the light source parameters of at least one face region and the light source parameters of the background region in the target image;

[0169] The first determining module 12 is used to determine the local white balance adjustment coefficient for any face region in at least one face region, based on the light source parameters of the face region and the light source parameters of the background region.

[0170] The second determining module 13 is used to determine the global adjustment intensity of the face region and the local adjustment intensity of each pixel block in the face region;

[0171] The third determining module 14 is used to determine the target white balance adjustment coefficient of each pixel block in the face region based on the global adjustment intensity of the face region, the local adjustment intensity of each pixel block in the face region, and the local white balance adjustment coefficient.

[0172] The adjustment module 15 is used to adjust the target image according to the target white balance adjustment coefficient of each pixel block in at least one face region to obtain the adjusted image.

[0173] In one possible implementation, the first determining module 12 is specifically used for:

[0174] The difference in light source parameters is determined based on the light source parameters of the face region and the background region.

[0175] Obtain first preset parameter information, which includes multiple preset light source parameter values ​​and a preset white balance adjustment coefficient corresponding to each light source parameter value;

[0176] Based on the differences in light source parameters and the first preset parameter information, the local white balance adjustment coefficient is determined.

[0177] In one possible implementation, the second determining module 13 is specifically used for:

[0178] Obtain facial information of the face region, including at least one of the following: face score, face size, effective face block ratio, and face brightness value;

[0179] Obtain second preset parameter information, which includes multiple preset face information and a preset adjustment intensity corresponding to each preset face information;

[0180] The global adjustment intensity is determined based on facial information and second preset parameter information.

[0181] In one possible implementation, the second determining module 13 is specifically used for:

[0182] Determine the distance coefficient for each pixel block in the face region. The distance coefficient is the ratio of the distance between the pixel block and the center point of the face region to the maximum allowable distance of the pixel block to the face region along the same radial direction.

[0183] Obtain third preset parameter information, which includes multiple preset distance coefficients and the preset adjustment force corresponding to each preset distance coefficient;

[0184] The local adjustment intensity of each pixel block is determined based on the distance coefficient of each pixel block and the third preset parameter information.

[0185] In one possible implementation, the third determining module 14 is specifically used for:

[0186] The local white balance adjustment coefficient is used as the initial white balance adjustment coefficient for each pixel block;

[0187] For any pixel block in the face region, the initial white balance adjustment coefficient of the pixel block is adjusted according to the global adjustment intensity of the face region and the local adjustment intensity of the pixel block to obtain the target white balance adjustment coefficient of the pixel block.

[0188] In one possible implementation, the adjustment module 15 is specifically used for:

[0189] Obtain the rotation angle of the face in at least one face region;

[0190] Adjust the orientation of the corresponding facial area according to the rotation angle of the face;

[0191] The second lens shadow compensation table is determined based on the target white balance adjustment coefficient of each pixel block in at least one face region after adjustment and the first lens shadow compensation table;

[0192] The target image is adjusted according to the shadow compensation table of the second lens to obtain the adjusted image.

[0193] The local white balance adjustment device provided in this embodiment can perform the method provided in the above method embodiment. Its implementation principle and technical effect are similar, and will not be described in detail here.

[0194] Figure 8 This is a schematic diagram of the structure of an electronic device provided in an embodiment of this application. Figure 8 As shown, the electronic device 20 includes a transceiver 21, a memory 22, and a processor 23. The transceiver 21 may include a transmitter and / or a receiver. The transmitter may also be referred to as a transmitter, transmitter port, or transmitter interface, etc., and the receiver may also be referred to as a receiver, receiver port, or receiver interface, etc. Exemplarily, the transceiver 21, memory 22, and processor 23 are interconnected via a bus 24.

[0195] Memory 22 is used to store program instructions;

[0196] The processor 23 is used to execute the program instructions stored in the memory to cause the electronic device to perform any of the local white balance adjustment methods shown above.

[0197] Transceiver 21 is used to perform the sending and receiving functions of electronic devices.

[0198] In one possible implementation, the memory 22 may be the storage medium described above.

[0199] Electronic devices can include chips, modules, integrated development environments (IDEs), etc.

[0200] Figure 8 The electronic device shown in the embodiments can execute the technical solutions shown in the above method embodiments. Its implementation principle and beneficial effects are similar, and will not be repeated here.

[0201] This application provides a computer-readable storage medium storing computer-executable instructions, which, when executed by a processor, are used to implement the local white balance adjustment method described above.

[0202] This application provides a computer program product, including a computer program that, when executed by a processor, can implement any of the above-mentioned local white balance adjustment methods.

[0203] This application provides a chip on which a computer program is stored. When the computer program is executed by the chip, it implements the above-described local white balance adjustment method.

[0204] In one possible implementation, the chip is a chip in a chip module.

[0205] The computer-readable storage medium and computer program product of this application embodiment can execute the technical solution shown in the above-described local white balance adjustment method embodiment. Their implementation principle and beneficial effects are similar, and will not be described again here.

[0206] All or part of the steps in the above-described method embodiments can be implemented by hardware related to program instructions. The aforementioned program can be stored in a readable memory. When the program is executed, it performs the steps of the above-described method embodiments; and the aforementioned memory (storage medium) includes: read-only memory (ROM), random access memory (RAM), flash memory, hard disk, solid-state drive, magnetic tape, floppy disk, optical disc, and any combination thereof.

[0207] This application describes embodiments with reference to flowchart illustrations and / or block diagrams of methods, apparatus (systems), and computer program products according to embodiments of this application. It should be understood that each block of the flowchart illustrations and / or block diagrams, and combinations of blocks in the flowchart illustrations and / or block diagrams, can be implemented by computer program instructions. These computer program instructions can be provided to a processing unit of a general-purpose computer, special-purpose computer, embedded processor, or other programmable data processing apparatus to produce a machine, such that the instructions, which execute via the processing unit of the computer or other programmable data processing apparatus, generate instructions for implementing the flowchart illustrations. Figure 1 One or more processes and / or boxes Figure 1 A device that provides the functions specified in one or more boxes.

[0208] These computer program instructions may also be stored in a computer-readable storage medium that can direct a computer or other programmable data processing device to function in a particular manner, such that the instructions stored in the computer-readable storage medium produce an article of manufacture including instruction means, which are implemented in a process Figure 1 One or more processes and / or boxes Figure 1 The function specified in one or more boxes.

[0209] These computer program instructions may also be loaded onto a computer or other programmable data processing equipment to cause a series of operational steps to be performed on the computer or other programmable equipment to produce a computer-implemented process, thereby providing instructions that execute on the computer or other programmable equipment for implementing the process. Figure 1 One or more processes and / or boxes Figure 1 The steps of the function specified in one or more boxes.

[0210] Obviously, those skilled in the art can make various modifications and variations to the embodiments of this application without departing from the spirit and scope of this application. Therefore, if these modifications and variations to the embodiments of this application fall within the scope of the claims of this application and their equivalents, this application also intends to include these modifications and variations.

Claims

1. A method for local white balance adjustment, characterized in that, include: Obtain the light source parameters of at least one face region and the light source parameters of the background region in the target image; For any face region in the at least one face region, a local white balance adjustment coefficient is determined based on the light source parameters of the face region and the light source parameters of the background region; Determine the global adjustment intensity of the face region and the local adjustment intensity of each pixel block in the face region; The target white balance adjustment coefficient for each pixel block in the face region is determined based on the global adjustment intensity of the face region, the local adjustment intensity of each pixel block in the face region, and the local white balance adjustment coefficient. The target image is adjusted according to the target white balance adjustment coefficient of each pixel block in the at least one face region to obtain the adjusted image.

2. The method according to claim 1, characterized in that, The step of determining the local white balance adjustment coefficient based on the light source parameters of the face region and the light source parameters of the background region includes: The difference value of the light source parameters is determined based on the light source parameters of the face region and the light source parameters of the background region; Obtain first preset parameter information, which includes multiple preset light source parameter values ​​and a preset white balance adjustment coefficient corresponding to each light source parameter value; The local white balance adjustment coefficient is determined based on the difference in the light source parameters and the first preset parameter information.

3. The method according to claim 1 or 2, characterized in that, Determining the global adjustment level of the face region includes: Obtain facial information of the face region, wherein the facial information includes at least one of the following: face score, face size, effective face block ratio, and face brightness value; Obtain second preset parameter information, which includes multiple preset face information and a preset adjustment intensity corresponding to each preset face information; The global adjustment intensity is determined based on the facial information and the second preset parameter information.

4. The method according to any one of claims 1-3, characterized in that, Determining the local adjustment intensity of each pixel block in the face region includes: Determine the distance coefficient for each pixel block in the face region. The distance coefficient is the ratio of the distance between the pixel block and the center point of the face region to the maximum allowable distance from the pixel block to the face region along the same radial direction. Obtain third preset parameter information, which includes multiple preset distance coefficients and a preset adjustment force corresponding to each preset distance coefficient; The local adjustment intensity of each pixel block is determined based on the distance coefficient of each pixel block and the third preset parameter information.

5. The method according to any one of claims 1-4, characterized in that, The step of determining the target white balance adjustment coefficient for each pixel block in the face region based on the global adjustment intensity of the face region, the local adjustment intensity of each pixel block in the face region, and the local white balance adjustment coefficient includes: The local white balance adjustment coefficient is used as the initial white balance adjustment coefficient for each pixel block; For any pixel block in the face region, the initial white balance adjustment coefficient of the pixel block is adjusted according to the global adjustment intensity of the face region and the local adjustment intensity of the pixel block to obtain the target white balance adjustment coefficient of the pixel block.

6. The method according to any one of claims 1-5, characterized in that, The step of adjusting the target image according to the target white balance adjustment coefficient of each pixel block in the at least one face region to obtain the adjusted image includes: Obtain the rotation angle of the face in at least one face region; Adjust the direction of the corresponding facial region according to the rotation angle of the face; The second lens shadow compensation table is determined based on the target white balance adjustment coefficient of each pixel block in at least one face region after adjustment and the first lens shadow compensation table; The target image is adjusted according to the second lens shadow compensation table to obtain the adjusted image.

7. A local white balance adjustment device, characterized in that, include: The acquisition module is used to acquire the light source parameters of at least one face region and the light source parameters of the background region in the target image; The first determining module is used to determine a local white balance adjustment coefficient for any face region in the at least one face region, based on the light source parameters of the face region and the light source parameters of the background region. The second determining module is used to determine the global adjustment intensity of the face region and the local adjustment intensity of each pixel block in the face region; The third determining module is used to determine the target white balance adjustment coefficient of each pixel block in the face region based on the global adjustment intensity of the face region, the local adjustment intensity of each pixel block in the face region, and the local white balance adjustment coefficient. An adjustment module is used to adjust the target image according to the target white balance adjustment coefficient of each pixel block in the at least one face region to obtain an adjusted image.

8. An electronic device, characterized in that, include: Memory, processor; The memory stores computer-executed instructions; The processor executes computer execution instructions stored in the memory, causing the processor to perform the method as described in any one of claims 1-6.

9. A computer-readable storage medium, characterized in that, The computer-readable storage medium stores computer-executable instructions, which, when executed by a processor, are used to implement the method as described in any one of claims 1-6.

10. A computer program product, characterized in that, Includes a computer program that, when executed by a processor, implements the method described in any one of claims 1-6.