Image brightness optimization method and device, electronic equipment, and storage medium
By identifying the facial image region in the electronic device and calculating the brightness and chromaticity weight parameters, the image brightness adjustment is optimized, solving the imaging abnormality problem caused by the user's face occlusion and improving the accuracy of portrait photography.
Patent Information
- Application Number
- CN202310084844.8
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2023-02-08
- Publication Date
- 2026-03-03
- Estimated Expiration
- 2043-02-08
AI Technical Summary
Electronic devices cannot properly expose when the user's face is obscured (such as by wearing a mask or glasses), resulting in abnormal overall image brightness and reducing the accuracy of portrait photography.
By determining the face image region from the image to be processed, obtaining the face brightness and chromaticity information, calculating the first and second weight information to obtain the face brightness parameters, and fusing them into a fused face brightness parameter, which is used to adjust the brightness of the image.
It reduces the probability of incorrect image exposure, avoids abnormal facial brightness, and improves the accuracy of portrait photography on electronic devices.
Smart Images

Figure CN116012256B_ABST
Abstract
Description
Technical Field
[0001] This application relates to the field of image processing technology, and in particular to an image brightness optimization method and apparatus, electronic device, and storage medium. Background Technology
[0002] Currently, many electronic devices (such as smartphones and smart wearable devices) are equipped with cameras, allowing users to easily fulfill various shooting needs, including portrait photography. However, in practice, it has been found that when the user's face is obscured (e.g., when the user is wearing a mask or glasses), electronic devices often fail to expose correctly, leading to abnormal brightness in the overall image and reducing the accuracy of portrait photography. Summary of the Invention
[0003] This application discloses an image brightness optimization method, apparatus, electronic device, and storage medium. It can optimize and adjust the overall image brightness based on the brightness and chromaticity statistics of the face during portrait photography using an electronic device, thereby reducing the probability of incorrect exposure of the captured image and improving the accuracy of portrait photography by the electronic device.
[0004] The first aspect of this application discloses an image brightness optimization method, including:
[0005] Identify the face image region from the image to be processed;
[0006] Obtain the facial brightness information and facial color information corresponding to the facial image region;
[0007] Obtain the first weight information corresponding to the face brightness information, and calculate the first face brightness parameter based on the first weight information; and,
[0008] Obtain the second weight information corresponding to the facial brightness information, and calculate the second facial brightness parameter based on the second weight information;
[0009] Based on the first face brightness parameter and the second face brightness parameter, a fused face brightness parameter is calculated, which is used to adjust the brightness of the image to be processed.
[0010] The second aspect of this application discloses an image brightness optimization device, comprising:
[0011] The determining unit is used to determine the face image region from the image to be processed;
[0012] The information acquisition unit is used to acquire the face brightness information and face color information corresponding to the face image region;
[0013] The first calculation unit is configured to obtain first weight information corresponding to the face brightness information, and calculate a first face brightness parameter based on the first weight information; and,
[0014] The second calculation unit is used to obtain the second weight information corresponding to the facial brightness information, and calculate the second facial brightness parameter based on the second weight information;
[0015] The third calculation unit is used to calculate the fused face brightness parameter based on the first face brightness parameter and the second face brightness parameter, and the fused face brightness parameter is used to adjust the brightness of the image to be processed.
[0016] The third aspect of this application discloses an electronic device, including a memory and a processor. The memory stores a computer program, and when the computer program is executed by the processor, the processor causes the processor to implement all or part of the steps in any of the image brightness optimization methods disclosed in the first aspect of this application.
[0017] The fourth aspect of this application discloses a computer-readable storage medium storing a computer program, wherein the computer program, when executed by a processor, implements all or part of the steps in any of the image brightness optimization methods disclosed in the first aspect of this application.
[0018] Compared with related technologies, the embodiments of this application have the following beneficial effects:
[0019] The image brightness optimization method in this embodiment can be applied to an electronic device. The electronic device can determine a face image region from an image to be processed and obtain face brightness information and face color information corresponding to that face image region. Then, the electronic device can obtain first weight information corresponding to the face brightness information and calculate a first face brightness parameter based on the first weight information; and obtain second weight information corresponding to the face color information and calculate a second face brightness parameter based on the second weight information. Based on this, the electronic device can calculate a fused face brightness parameter based on the first and second face brightness parameters, which can be used to adjust the brightness of the image to be processed. Therefore, by implementing this embodiment, during portrait photography using an electronic device, based on the brightness and color statistics of the face, it is possible to analyze whether the user's face is obstructed, especially including factors that may cause abnormal brightness such as whether the user is wearing a mask or glasses. Based on this, the overall imaging brightness of the image captured by the electronic device can be optimized and adjusted, reducing the probability of incorrect exposure of the captured image and minimizing abnormal face brightness in the captured image, thereby improving the accuracy of portrait photography by the electronic device. Attached Figure Description
[0020] To more clearly illustrate the technical solutions in the embodiments of this application, the accompanying drawings used in the embodiments will be briefly introduced below. Obviously, the accompanying drawings described below are only some embodiments of this application. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort.
[0021] Figure 1 This is a schematic diagram illustrating an application scenario of the image brightness optimization method disclosed in the embodiments of this application;
[0022] Figure 2 This is a flowchart illustrating an image brightness optimization method disclosed in an embodiment of this application;
[0023] Figure 3 This is a schematic diagram of dividing a face image region into multiple grid regions, as disclosed in an embodiment of this application;
[0024] Figure 4 This is a flowchart illustrating another image brightness optimization method disclosed in an embodiment of this application;
[0025] Figure 5 This is a flowchart illustrating another image brightness optimization method disclosed in an embodiment of this application;
[0026] Figure 6 This is a schematic diagram of a process for adjusting the brightness of an image to be processed, as disclosed in an embodiment of this application.
[0027] Figure 7 This is a modular schematic diagram of an image brightness optimization device disclosed in an embodiment of this application;
[0028] Figure 8 This is a modular schematic diagram of an electronic device disclosed in an embodiment of this application. Detailed Implementation
[0029] 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, and not all embodiments. Based on the embodiments of this application, all other embodiments obtained by those of ordinary skill in the art without creative effort are within the scope of protection of this application.
[0030] It should be noted that the terms "comprising" and "having," and any variations thereof, in the embodiments of this application are intended to cover non-exclusive inclusion. For example, a process, method, system, product, or device that includes a series of steps or units is not necessarily limited to those steps or units explicitly listed, but may include other steps or units not explicitly listed or inherent to these processes, methods, products, or devices. Unless otherwise specified, the embodiments, implementation methods, and related technical features in this application can be combined and substituted with each other, and the explanations in different embodiments and implementation methods can be applied interchangeably. "A plurality" in this application refers to two or more.
[0031] This application discloses an image brightness optimization method, apparatus, electronic device, and storage medium. It can optimize and adjust the overall image brightness based on the brightness and chromaticity statistics of the face during portrait photography using an electronic device, thereby reducing the probability of incorrect exposure of the captured image and improving the accuracy of portrait photography by the electronic device.
[0032] The following will be described in detail with reference to the accompanying drawings.
[0033] Please see Figure 1 , Figure 1 This is a schematic diagram illustrating an application scenario of the image brightness optimization method disclosed in this application, including an electronic device 10 and a user 20. The electronic device 10 may include an image acquisition device (e.g., a camera, etc.). Figure 1 (Not specifically shown in the text) User 20 can hold or set up the electronic device 10 and use its image acquisition device to take a portrait of User 20 or other users (hereinafter collectively referred to as User 20), especially including taking a picture of the face of User 20, that is, realizing face image acquisition, thereby obtaining an image to be processed containing the face.
[0034] The aforementioned electronic device 10 may include various devices or systems equipped with image acquisition devices, such as mobile phones, smart wearable devices, vehicle terminals, tablet computers, PCs (Personal Computers), PDAs (Personal Digital Assistants), cameras, video recorders, etc., but is not specifically limited in this embodiment. It should be noted that... Figure 1 The electronic device 10 shown is a mobile phone. This is merely an example and should not be considered as a limitation on the device type of electronic device 10 in the embodiments of this application.
[0035] In some embodiments, the electronic device 10 may not include an image acquisition device, but instead acquire the image to be processed from other devices (such as mobile phones, computers, servers, etc.). For example, the electronic device 10 can establish a communication connection with other devices, thereby acquiring the image to be processed sent to the electronic device 10 by other devices, so that the electronic device 10 can perform face detection on the image to be processed locally, and perform further image brightness optimization measures on the image to be processed as a whole based on the face portion.
[0036] In related technologies, after an electronic device 10 acquires an image to be processed through its image acquisition device or through other devices, it often needs to optimize the brightness of the image to ensure that the face is sufficiently clear while obtaining a good overall imaging effect and facilitating the implementation of functions such as HDR (High-Dynamic Range) imaging. However, traditional image brightness optimization methods often suffer from abnormal facial brightness statistics in different scenarios due to factors such as occlusion of the user 20's face (e.g., the user wearing a mask or glasses). This leads to the electronic device 10 being unable to expose correctly (e.g., overexposure or underexposure), resulting in abnormal overall image brightness and significantly reducing the accuracy of the electronic device 10 in capturing portraits.
[0037] To address the aforementioned issues, in this embodiment, the electronic device 10 can determine a face image region from the image to be processed and obtain face brightness information and face color information corresponding to that face image region. Accordingly, the electronic device 10 can also obtain first weight information corresponding to the face brightness information and calculate a first face brightness parameter based on the first weight information; and obtain second weight information corresponding to the face color information and calculate a second face brightness parameter based on the second weight information. Based on this, the electronic device 10 can calculate a fused face brightness parameter based on the first face brightness parameter and the second face brightness parameter. This fused face brightness parameter can be used to adjust the brightness of the image to be processed.
[0038] As can be seen, by implementing the above image brightness optimization method, during the process of portrait photography using electronic device 10, based on the brightness and chromaticity statistics of the face, it is possible to analyze whether the user 20's face is obstructed, especially whether the user 20 is wearing a mask, glasses, or other factors that may cause abnormal brightness. Based on this, the overall imaging brightness of the image captured by electronic device 10 is optimized and adjusted, reducing the probability of incorrect exposure of the captured image and avoiding abnormal brightness of the face in the captured image as much as possible, thereby improving the accuracy of portrait photography by electronic device 10.
[0039] Please see Figure 2 , Figure 2 This is a flowchart illustrating an image brightness optimization method disclosed in an embodiment of this application. Figure 2 As shown, the image brightness optimization method may include the following steps:
[0040] 202. Identify the face image region from the image to be processed.
[0041] In this embodiment of the application, after acquiring the image to be processed, the electronic device can first perform face detection on the image to determine whether there is a face in it, and if there is a face, determine the corresponding face image region.
[0042] For example, please refer to Figure 3 , Figure 3 This is a schematic diagram illustrating how to determine a face image region from an image to be processed, as disclosed in an embodiment of this application. Figure 3 As shown, when a user holds or sets up an electronic device to acquire images, the resulting image to be processed often includes the user (e.g., upper body) and a certain range of background environment area (e.g., ...). Figure 3 (As shown in the area within the box on the left). To optimize the overall brightness of the image to be processed based on the face in subsequent steps, the electronic device can first use various face detection algorithms to segment the face image region from the image to be processed (such as...). Figure 3 (As shown in the inner frame in the middle).
[0043] In some embodiments, if the image to be processed is a static image already acquired by the electronic device, the electronic device can directly perform face detection on the image and use the detected ROI (Region of Interest), i.e., the region where a face exists, as the face image region. It should be noted that... Figure 3 The face image region shown is a regular rectangle, and in addition to the face, it still includes a portion of the background environment area; this is merely an example. In other embodiments, based on different face detection algorithms, the face image region may also be an irregular face outline, containing little or no background environment area; this application does not impose specific limitations on this.
[0044] In other embodiments, if the image to be processed is a preview stream presented by the electronic device during the preview acquisition process, the electronic device can determine the face image region from the image to be processed in real time and dynamically based on the AF (AutoFocus) algorithm. For example, the electronic device can perform face detection on each frame of the image to be processed in the preview stream to determine the ROI (Region of Interest) in each frame, i.e., the region where a face exists. Based on this, the electronic device can calculate the depth information of the ROI and perform corresponding focusing processing based on the depth information to obtain a clearly focused ROI as the face image region corresponding to each frame of the image to be processed in the preview stream.
[0045] Optionally, the electronic device can also select an initial image to be processed in the preview stream and perform face detection on that initial image to determine the corresponding Region of Interest (ROI). Based on this, the electronic device can perform tracking and focusing (including motion tracking, depth information calculation for focusing, etc.) on the aforementioned ROI for each subsequent image to be processed in the preview stream, thereby obtaining the clearly focused ROI in each subsequent image to be processed as the corresponding face image region.
[0046] 204. Obtain the facial brightness information and facial color information corresponding to the facial image region.
[0047] In this embodiment of the application, the electronic device can perform statistical analysis on the brightness and chromaticity data of the aforementioned face image region to obtain the face brightness information and face chromaticity information corresponding to the face image region.
[0048] For example, the aforementioned facial brightness information may include brightness data corresponding to each pixel in the facial image region. This brightness data can be represented by grayscale values (e.g., an 8-bit grayscale value can be represented by any integer in [0, 255]), or by luminous intensity per unit area (unit: candela per square meter, i.e., cd / m2, or nits). The aforementioned facial color information may include chromaticity data corresponding to each pixel in the facial image region. This chromaticity data may include hue and saturation. In some embodiments, it may also be represented by the proportions or grayscale values of the primary colors corresponding to each color channel (e.g., the red (R), green (G), and blue (B) channels in a three-channel color model).
[0049] In some embodiments, the aforementioned face image region may include one or more grid regions. In one embodiment, the entire face image region can be divided into multiple grid regions. The electronic device can then separately collect and obtain the face brightness information and face color information corresponding to each grid region, so as to calculate the required face brightness parameters based on each grid region in subsequent steps. This helps to reduce the data size and computational difficulty. For example, as shown... Figure 3 As shown, a face image region can include multiple regular grid regions (i.e., Figure 3 (The inner frame grid on the right), each grid area can contain the face and / or the background environment.
[0050] In another embodiment, the aforementioned grid region can also be a number of grid regions selected or extracted from multiple grid regions divided from the entire face image region. The number N of selected or extracted grid regions can be less than the total number M of the multiple grid regions, i.e., N < M (where N and M are natural numbers). For example, as... Figure 3 As shown in the inner grid on the right, by removing grid areas that do not contain the face and retaining only N grid areas that do contain the face, the electronic device can collect only the face brightness and color information corresponding to these N grid areas. In subsequent steps, it can calculate the required face brightness parameters based on these N grid areas. This further reduces the computational burden on the electronic device while accurately acquiring the brightness and color data corresponding to the face, thereby improving the accuracy of subsequent calculations of face brightness parameters and ultimately enhancing the accuracy of the electronic device in capturing portraits.
[0051] 206. Obtain the first weight information corresponding to the above-mentioned face brightness information, and calculate the first face brightness parameter based on the first weight information; and obtain the second weight information corresponding to the above-mentioned face brightness information, and calculate the second face brightness parameter based on the second weight information.
[0052] In this embodiment of the application, after the electronic device acquires the face brightness information and face color information corresponding to the face image region, it can calculate the first face brightness parameter related to the face brightness information and the second face brightness parameter related to the face color information, and then fuse the two in subsequent steps to obtain the fused face brightness parameter actually used for brightness optimization.
[0053] For example, both the first and second face brightness parameters mentioned above can include at least face brightness parameters and face gamma parameters. The face brightness parameters can include the brightness data that the face image region should present (e.g., represented by grayscale values, light intensity per unit area, etc.); the face gamma parameters can include the gamma correction relationship that the face image region should conform to (e.g., represented by gamma correction curves, gamma correction functions, etc.), that is, a non-linear encoding relationship that conforms to certain human visual characteristics for the brightness data corresponding to each pixel in the face image region.
[0054] In this embodiment, the electronic device can obtain first weight information for determining the first face brightness parameter based on the aforementioned face brightness information. In some embodiments, the first weight information may include a first weight value, which can be used to represent the degree of influence of the aforementioned face brightness information on the first face brightness parameter and the subsequently obtained fused face brightness parameter during the brightness optimization process of the image to be processed by the electronic device.
[0055] For example, if the aforementioned face brightness information indicates that the brightness data corresponding to each pixel in the face image area is large (e.g., when the user is wearing a white mask) or small (e.g., when the user is wearing a black mask or sunglasses), then the corresponding first weight value can be relatively large, so that the first face brightness parameter calculated based on the first weight value can balance the impact caused by the user's face being too bright or too dark; if the aforementioned face brightness information indicates that the brightness data corresponding to each pixel in the face image area is relatively balanced (e.g., when the user is not wearing a mask or glasses), then the corresponding first weight value can be relatively small, so that the first face brightness parameter calculated based on the first weight value has a smaller impact on the subsequent brightness optimization of the electronic device.
[0056] In other embodiments, if the face image region includes one or more grid regions, the aforementioned first weight information may also include the first weight value corresponding to each grid region. The electronic device can determine the first weight value corresponding to each grid region based on the face brightness information corresponding to each grid region, and then calculate the corresponding first face brightness parameter. For example, the electronic device can use the first weight value corresponding to each grid region to weight the first basic brightness parameter to obtain the first face brightness parameter corresponding to each grid region; it can also further perform statistical operations such as summation and averaging on the aforementioned first face brightness parameters, and use the statistical operation result as the first face brightness parameter. This application embodiment does not impose specific limitations.
[0057] Similarly, the electronic device can obtain second weighting information for determining the second face brightness parameter based on the aforementioned facial color information. In some embodiments, the aforementioned second weighting information may also include a second weight value, which can be used to represent the degree of influence of the aforementioned facial color information on the second face brightness parameter and the subsequently obtained fused face brightness parameter during the brightness optimization process of the image to be processed by the electronic device.
[0058] For example, if the aforementioned face brightness information indicates that the chromaticity data corresponding to each pixel in the face image region is abnormal (e.g., abnormal R / G color ratio, abnormal B / G color ratio, etc., possibly due to the user wearing a colored mask, background ambient light scattering, etc.), then the corresponding second weight value can be relatively large, so that the second face brightness parameter calculated based on the second weight value can balance the impact caused by the aforementioned color abnormality; if the aforementioned face brightness information indicates that the chromaticity data corresponding to each pixel in the face image region is relatively balanced (e.g., balanced R / G color ratio, balanced B / G color ratio, etc.), then the corresponding second weight value can be relatively small, so that the second face brightness parameter calculated based on the second weight value has a smaller impact on the subsequent brightness optimization of the electronic device.
[0059] In other embodiments, the aforementioned second weighting information may further include second weighting values corresponding to each grid region in the face image region. The electronic device can determine the second weighting value corresponding to each grid region based on the face brightness information corresponding to each grid region, and then calculate the corresponding second face brightness parameter. For example, the electronic device can use the second weighting values corresponding to each grid region to weight the second basic brightness parameter to obtain the second face brightness parameter corresponding to each grid region; it can also further perform statistical operations such as summation and averaging on the aforementioned second face brightness parameters, and use the statistical operation results as the second face brightness parameter. No specific limitations are made in this embodiment.
[0060] 208. Based on the first face brightness parameter and the second face brightness parameter mentioned above, the fused face brightness parameter is calculated. This fused face brightness parameter is used to adjust the brightness of the image to be processed.
[0061] In this embodiment, the electronic device can integrate the first face brightness parameter and the second face brightness parameter, comprehensively consider the brightness and color anomalies in the face image area, and then use the fused face brightness parameter to adaptively adjust the overall brightness of the image to be processed.
[0062] In some embodiments, if both the first face brightness parameter and the second face brightness parameter are single values, the electronic device can perform a weighted summation of the first face brightness parameter and the second face brightness parameter based on preset weights to obtain a corresponding fused face brightness parameter. This fused face brightness parameter can be directly used to adjust the brightness of the image to be processed.
[0063] In other embodiments, if both the first and second face brightness parameters include parameters corresponding to each grid region, the electronic device can also perform weighted summation of the first and second face brightness parameters for each grid region to obtain the fused face brightness parameters corresponding to each grid region. Based on this, the electronic device can perform post-processing such as filtering and noise reduction on the fused face brightness parameters corresponding to each grid region, and then apply them to the overall brightness adjustment of the image to be processed.
[0064] It should be noted that by adjusting the brightness of the above-mentioned images to be processed, multiple images with different brightness levels can be obtained. This is beneficial for realizing functions such as HDR (High-Dynamic Range) imaging, so as to preserve and display more details in the images to be processed under different brightness backgrounds, and improve the user experience of using electronic devices for portrait photography.
[0065] As can be seen, by implementing the image brightness optimization method described in the above embodiments, during the process of taking portrait photos using electronic devices, based on the brightness and chromaticity statistics of the face, it is possible to analyze whether the user's face is obscured, especially including whether the user is wearing a mask, glasses, or other factors that may cause abnormal brightness. Based on this, the overall imaging brightness of the image taken by the electronic device is optimized and adjusted, reducing the probability of incorrect exposure of the captured image and avoiding abnormal brightness of the face in the captured image as much as possible, thereby improving the accuracy of portrait photography by electronic devices.
[0066] Please see Figure 4 , Figure 4 This is a schematic flowchart of another image brightness optimization method disclosed in an embodiment of this application. Figure 4 As shown, the image brightness optimization method may include the following steps:
[0067] 402. Identify the face image region from the image to be processed.
[0068] 404. Obtain the facial brightness information and facial color information corresponding to the facial image region.
[0069] Steps 402 and 404 are similar to steps 202 and 204 above, and will not be described again here.
[0070] 406. If the above face brightness information meets the brightness triggering conditions, obtain the region brightness weight information corresponding to the face brightness information.
[0071] In this embodiment of the application, after obtaining the above-mentioned face brightness information and face color information, the electronic device can further analyze the face brightness information and face color information to determine whether the electronic device triggers the specified brightness adjustment scenario (i.e., determine whether the above-mentioned face brightness information and / or face color information meet the specified scenario triggering conditions), and adjust the brightness of the image to be processed under the corresponding brightness adjustment scenario.
[0072] The electronic device can determine whether the face brightness meets the specified brightness triggering conditions based on the aforementioned face brightness information (i.e., the aforementioned scene triggering conditions may include triggering conditions based solely on brightness data). In some embodiments, taking the aforementioned face image region as including one or more grid regions as an example, after the electronic device acquires the face brightness information and face color information corresponding to each grid region, it can analyze the face brightness information corresponding to each grid region.
[0073] For example, an electronic device can traverse each grid region and statistically analyze the facial brightness information corresponding to each grid region to obtain a brightness statistical result. For example, the brightness statistical result may include the mean, variance, and sum of the brightness data for each grid region, etc., which are not specifically limited in this embodiment.
[0074] Optionally, the electronic device can traverse each of the above grid regions by using a detection area of a specified size (e.g., 3×3 pixels, 5×5 pixels, etc.), thereby jointly determining the above brightness statistics based on the detection area and each grid region, whether partially or completely overlapping.
[0075] If the brightness statistics indicate that the face image region belongs to the target scene, the electronic device can confirm that the face brightness information meets the brightness triggering condition. The target scene can include either a bright area scene or a dark area scene. For example, taking the brightness statistics as an example where the average brightness data of each grid region is included, if the average value is greater than a first threshold A, it indicates that the face image region belongs to a bright area scene; if the average value is less than a second threshold B (B < A), it indicates that the face image region belongs to a dark area scene; if the average value is between the first and second thresholds, it indicates that the face image region belongs to neither a bright area scene nor a dark area scene, i.e., it does not meet the brightness triggering condition.
[0076] Based on this, the electronic device can obtain the region brightness weight information corresponding to the face brightness information according to the target scene described above. This region brightness weight information can be used in subsequent steps to calculate the first weight information corresponding to the face brightness information. It should be noted that the region brightness weight information obtained by the electronic device may vary depending on whether the face image region belongs to a bright or dark scene.
[0077] 408. Based on the brightness weight information of the region and the reference weight information table, calculate the first weight information corresponding to the face brightness information, and calculate the first face brightness parameter based on the first weight information.
[0078] In this embodiment, the electronic device can pre-set a reference weight information table. This table may include reference weight information corresponding to each grid region in the face image region, or it may include reference weight information corresponding to the entire face image region under different target scenes. By obtaining this reference weight information table, the electronic device can re-weight the brightness weight information of the aforementioned regions to determine the first weight information corresponding to the face brightness information.
[0079] In some embodiments, if the target scene is a bright area scene, the electronic device can obtain a first reference weight information table corresponding to the bright area scene. Based on this, the electronic device can jointly calculate the first weight information corresponding to the face brightness information according to the aforementioned regional brightness weight information and the first reference weight information table.
[0080] In other embodiments, if the target scene is a dark area scene, the electronic device can obtain a second reference weight information table corresponding to the dark area scene. Based on this, the electronic device can jointly calculate the first weight information corresponding to the face brightness information according to the aforementioned area brightness weight information and the second reference weight information table.
[0081] Based on this, the electronic device can perform weighted processing on the face brightness information corresponding to each grid area based on the aforementioned first weight information, thereby obtaining the first face brightness parameter corresponding to each grid area; it can also further perform statistical operations such as summation and averaging on the aforementioned first face brightness parameters, and use the statistical operation results as the first face brightness parameter. No specific limitation is made in this embodiment.
[0082] 410. If the above facial color information meets the color triggering conditions, obtain the extreme color scene ratio corresponding to the facial color information of that person.
[0083] In this embodiment, the electronic device can determine whether the face color information meets the specified color triggering conditions (i.e., the scene triggering conditions may include triggering conditions based solely on color data). In some embodiments, taking the face image region as including one or more grid regions as an example, after acquiring the face brightness information and face color information corresponding to each grid region, the electronic device can analyze the face color information corresponding to each grid region.
[0084] For example, the electronic device can calculate the color ratio information corresponding to each grid region based on the facial color intensity information corresponding to each grid region. The aforementioned color ratio information can include at least the R / G color ratio (i.e., the blue-green color ratio in the facial image region) and the B / G color ratio (i.e., the blue-red color ratio in the facial image region).
[0085] Based on the color ratio information corresponding to each of the aforementioned grid regions, the electronic device can determine a first image region exceeding an extreme color threshold. That is, an image region comprised of one or more grid regions whose color ratio information exceeds the extreme color threshold. The aforementioned R / G color ratio and B / G color ratio can be determined based on the same extreme color threshold or different extreme color thresholds. Therefore, grid regions whose R / G color ratio and / or B / G color ratio exceed the corresponding extreme color threshold can be classified as the first image region.
[0086] It can be understood that, in the aforementioned face image region, all other image regions besides the first image region can be classified as the second image region.
[0087] Based on this, the electronic device can calculate the region ratio between the first image region and the second image region, and if it is confirmed that the human face color information meets the color triggering conditions, the region ratio is determined as the extreme color scene ratio corresponding to the human face color information. The extreme color scene ratio can be used in subsequent steps to calculate the second weight information corresponding to the human face color information.
[0088] In some embodiments, the electronic device can directly determine whether the facial color information meets the color triggering condition based on the region ratio between the first image region and the second image region it calculates. For example, if the region ratio is greater than a third threshold C, it indicates that the facial image region contains a large number of grid regions exceeding the extreme color threshold, thus confirming that the facial color information corresponding to the facial image region meets the color triggering condition; if the region ratio is not greater than the third threshold C, it indicates that there are few grid regions exceeding the extreme color threshold in the facial image region, thus confirming that it does not meet the color triggering condition.
[0089] In other embodiments, the electronic device can also perform statistical analysis on the aforementioned facial color information in other ways to obtain corresponding color statistical results. For example, the color statistical results may include the mean, variance, and sum of color data (including hue, saturation, R / G color ratio, B / G color ratio, etc.) for each grid region, which is not specifically limited in this embodiment. Based on this, the electronic device can compare the aforementioned color statistical results with the corresponding fourth threshold D to confirm whether the aforementioned facial color information meets the color triggering conditions.
[0090] 412. Based on the proportion of the extreme color scene, calculate the second weight information corresponding to the human face brightness information, and calculate the second human face brightness parameter based on the second weight information.
[0091] In this embodiment, the aforementioned extreme color scene ratio can be used to represent the ratio between a first image region exceeding an extreme color threshold and a second image region other than the first image region in a face image region. Optionally, the electronic device can also recalculate the extreme color scene ratio corresponding to the entire face image region based on the color ratio information corresponding to the face image region, so as to represent the trigger ratio of extreme color scenes in that face image region. For example, the electronic device can calculate the overall extreme color scene ratio by weighting the specific R / G and B / G color ratios of each grid region by setting the same or different weights.
[0092] By acquiring the aforementioned extreme color scene ratio, the electronic device can apply it to adjust facial brightness information. For example, the electronic device can determine the second weight information corresponding to the facial brightness information based on the extreme color scene ratio (e.g., by looking up a table). Based on this, the electronic device can perform weighted processing on the facial brightness information corresponding to each grid region based on the aforementioned second weight information, thereby obtaining the second facial brightness parameter corresponding to each grid region; alternatively, it can further perform statistical operations such as summation and averaging on the aforementioned second facial brightness parameters, and use the statistical operation results as the second facial brightness parameter. This embodiment does not impose specific limitations.
[0093] 414. Based on the first face brightness parameter and the second face brightness parameter mentioned above, the fused face brightness parameter is calculated. This fused face brightness parameter is used to adjust the brightness of the image to be processed.
[0094] Step 414 is similar to step 208 above, and will not be repeated here.
[0095] As can be seen, the image brightness optimization method described in the above embodiments, during portrait photography using electronic devices, can analyze factors that may cause brightness abnormalities, such as whether the user's face is obstructed, based on the brightness and chromaticity statistics of the face. Accordingly, the overall imaging brightness of the image captured by the electronic device can be optimized and adjusted, reducing the probability of incorrect exposure and thus improving the accuracy of portrait photography. Furthermore, by statistically analyzing whether the captured image belongs to a bright or dark scene, or an extreme color scene, the relevant parameters used for brightness optimization can be adaptively adjusted to avoid brightness abnormalities caused by factors such as facial obstruction and color differences, thereby effectively improving the accuracy of portrait photography by electronic devices.
[0096] Please see Figure 5 , Figure 5 This is a schematic flowchart of another image brightness optimization method disclosed in an embodiment of this application. Figure 5 As shown, the image brightness optimization method may include the following steps:
[0097] 502. Identify the face image region from the image to be processed.
[0098] 504. Obtain the facial brightness information and facial color information corresponding to the facial image region.
[0099] Steps 502 and 504 are similar to steps 202 and 204 above, and will not be described again here.
[0100] 506. If the above face brightness information meets the brightness triggering conditions, obtain the region brightness weight information corresponding to the face brightness information.
[0101] 508. Based on the brightness weight information of the region and the reference weight information table, calculate the first weight information corresponding to the face brightness information, and calculate the first face brightness parameter based on the first weight information.
[0102] Steps 506 and 508 are similar to steps 406 and 408 above, and will not be described again here.
[0103] 510. If the above facial color information meets the color triggering conditions, obtain the extreme color scene ratio corresponding to the facial color information of that person.
[0104] The aforementioned extreme color scene ratio can be used to represent the ratio between a first image region exceeding the extreme color threshold and a second image region other than the first image region in a face image region.
[0105] 512. Based on the proportion of the extreme color scene, calculate the second weight information corresponding to the human face brightness information, and calculate the second human face brightness parameter based on the second weight information.
[0106] Steps 510 and 512 are similar to steps 410 and 412 above, and will not be described again here.
[0107] 514. Based on the first face brightness parameter and the second face brightness parameter mentioned above, the fused face brightness parameter is calculated.
[0108] Step 514 is similar to step 208 above, and will not be described again here.
[0109] 516. Obtain the brightness adjustment region corresponding to the above-mentioned fused face brightness parameters, wherein the brightness adjustment region includes any image region in the image to be processed that contains the above-mentioned face image region.
[0110] 518. Adjust the brightness of the brightness adjustment area by fusing the face brightness parameters.
[0111] In this embodiment of the application, the electronic device can adjust the brightness of the entire image to be processed by fusing face brightness parameters. That is, the entire image to be processed is used as the brightness adjustment area, and the brightness data (luma value) of the image to be processed is determined based on the fused face brightness parameters.
[0112] For example, please refer to Figure 6 , Figure 6 This is a schematic diagram of a process for adjusting the brightness of an image to be processed, as disclosed in an embodiment of this application. Figure 6 As shown, by determining whether the facial brightness information corresponding to a facial image region meets the brightness triggering condition (i.e., whether it belongs to a bright / dark scene), and whether the corresponding facial color information meets the chroma triggering condition (i.e., whether it belongs to an extreme color scene), the corresponding first and second facial brightness parameters can be adaptively obtained. The fused facial brightness parameter obtained by fusing the two is then applied to the brightness adjustment process of the image to be processed. It can be understood that if the facial brightness information does not meet the brightness triggering condition, or the facial color information does not meet the chroma triggering condition, the default (or unspecified) first or second facial brightness parameter can also be applied to the fused facial brightness parameter process.
[0113] Optionally, the electronic device can also adjust the brightness only on the face image area and its surroundings, ensuring that the brightness change is not abrupt. For example, the electronic device can use any image region in the image to be processed that contains the aforementioned face image region as the brightness adjustment region, and obtain fused face brightness parameters that match the brightness adjustment region by filtering the aforementioned fused face brightness parameters. It is understood that the matching fused face brightness parameters can be different for different sub-regions (which can be represented by grid regions) within the brightness adjustment region, thereby achieving adaptive and accurate brightness optimization of the entire image to be processed, focusing on the face image region.
[0114] As can be seen, the image brightness optimization method described in the above embodiments, during portrait photography using an electronic device, can analyze factors that may cause abnormal brightness, such as whether the user's face is obstructed, based on the brightness and chromaticity statistics of the face. Accordingly, it can optimize and adjust the overall imaging brightness of the image captured by the electronic device, reducing the probability of incorrect exposure and thus improving the accuracy of portrait photography. Furthermore, by adjusting the overall imaging brightness of the captured image, the image display effect can be optimized, especially including HDR imaging effects, enabling users to quickly obtain images with appropriate brightness, thereby improving the convenience of portrait photography using electronic devices.
[0115] The methods in the embodiments of this application have been described in detail above. The apparatus in the embodiments of this application will be described below with reference to the accompanying drawings.
[0116] Please see Figure 7 , Figure 7 This is a modular schematic diagram of an image brightness optimization device disclosed in an embodiment of this application. This image brightness optimization device can be the aforementioned electronic device, or a device applied within the aforementioned electronic device. Figure 7 As shown, the image brightness optimization device may include a determining unit 701, an information acquisition unit 702, a first calculation unit 703, a second calculation unit 704, and a third calculation unit 705, wherein:
[0117] The determining unit 701 is used to determine the face image region from the image to be processed;
[0118] The information acquisition unit 702 is used to acquire the face brightness information and face color information corresponding to the face image region;
[0119] The first calculation unit 703 is used to obtain the first weight information corresponding to the above-mentioned face brightness information, and calculate the first face brightness parameter based on the first weight information.
[0120] The second calculation unit 704 is used to obtain the second weight information corresponding to the above-mentioned face brightness information, and calculate the second face brightness parameter based on the second weight information.
[0121] The third calculation unit 705 is used to calculate the fused face brightness parameter based on the first face brightness parameter and the second face brightness parameter, and the fused face brightness parameter is used to adjust the brightness of the image to be processed.
[0122] As can be seen, the image brightness optimization device described in the above embodiments can, during the process of taking portrait photos using an electronic device, analyze whether the user's face is obscured based on the brightness and chromaticity statistics of the face, especially factors that may cause abnormal brightness, such as whether the user is wearing a mask or glasses. Based on this, the overall imaging brightness of the image taken by the electronic device is optimized and adjusted, reducing the probability of incorrect exposure of the captured image and avoiding abnormal brightness of the face in the captured image as much as possible, thereby improving the accuracy of portrait photography by the electronic device.
[0123] In one embodiment, the first calculation unit 703, when acquiring the first weight information corresponding to the face brightness information, may specifically include:
[0124] If the above face brightness information meets the brightness triggering conditions, obtain the region brightness weight information corresponding to the face brightness information;
[0125] Based on the brightness weight information of the region and the reference weight information table, the first weight information corresponding to the above face brightness information is calculated.
[0126] In one embodiment, the aforementioned face image region may include one or more grid regions, then the aforementioned information acquisition unit 702 may specifically be used for:
[0127] Obtain the facial brightness information and facial color information corresponding to each grid area respectively;
[0128] When the first calculation unit 703 is used to obtain the region brightness weight information corresponding to the face brightness information when the face brightness information meets the brightness triggering condition, it may specifically include:
[0129] By traversing each grid region, the brightness information of the face corresponding to each grid region is statistically analyzed to obtain the brightness statistics results.
[0130] If the brightness statistics result indicates that the above-mentioned face image area belongs to the target scene, the above-mentioned face brightness information is confirmed to meet the brightness triggering condition, wherein the target scene includes a bright area scene or a dark area scene.
[0131] Based on the target scenario described above, obtain the regional brightness weight information corresponding to the facial brightness information.
[0132] Based on this, when the first calculation unit 703 calculates the first weight information corresponding to the face brightness information according to the brightness weight information of the region and the reference weight information table, it may specifically include:
[0133] In the case that the target scene is a bright area scene, the first weight information corresponding to the face brightness information is obtained based on the regional brightness weight information and the first reference weight information table corresponding to the bright area scene; or,
[0134] In the case that the target scene is a dark scene, the first weight information corresponding to the face brightness information is obtained based on the regional brightness weight information and the second reference weight information table corresponding to the dark scene.
[0135] In one embodiment, the second calculation unit 704, when used to obtain the second weight information corresponding to the facial expression information, may specifically include:
[0136] When the above-mentioned facial color information meets the color triggering condition, the extreme color scene ratio corresponding to the facial color information is obtained. The extreme color scene ratio is used to represent the ratio between the first image region exceeding the extreme color threshold and the second image region other than the first image region in the above-mentioned facial image region.
[0137] Based on the proportion of this extreme color scene, calculate the second weight information corresponding to the above-mentioned human facial color information.
[0138] In one embodiment, the aforementioned face image region may include one or more grid regions. Therefore, when the second calculation unit 704 obtains the extreme color scene ratio corresponding to the face color information when the face color information meets the color triggering condition, it may specifically include:
[0139] Based on the facial color information corresponding to each grid area, the color ratio information corresponding to each grid area is calculated. The color ratio information can include at least the R / G color ratio and the B / G color ratio.
[0140] Based on the color ratio information corresponding to each grid region, the first image region exceeding the extreme color threshold is determined, as well as the second image region in the face image region other than the first image region.
[0141] Calculate the ratio between the first image region and the second image region, and if the above facial color information meets the color triggering conditions, determine the ratio of the region as the extreme color scene ratio corresponding to the facial color information.
[0142] In one embodiment, the image brightness optimization device may further include a region acquisition unit (not shown) and a brightness adjustment unit, wherein:
[0143] The region acquisition unit is used to acquire the brightness adjustment region corresponding to the fused face brightness parameter after the third calculation unit 705 calculates the fused face brightness parameter based on the first face brightness parameter and the second face brightness parameter. The brightness adjustment region includes any image region in the image to be processed that contains a face image region.
[0144] The brightness adjustment unit is used to adjust the brightness of the brightness adjustment area by fusing the aforementioned face brightness parameters.
[0145] As can be seen, the image brightness optimization device described in the above embodiments, during portrait photography using an electronic device, can analyze factors that may cause brightness abnormalities, such as whether the user's face is obstructed, based on the brightness and color statistics of the face. Accordingly, it optimizes and adjusts the overall imaging brightness of the image captured by the electronic device, reducing the probability of incorrect exposure and thus improving the accuracy of portrait photography. Furthermore, by statistically analyzing whether the captured image belongs to a bright or dark scene, or an extreme color scene, the relevant parameters used for brightness optimization can be adaptively adjusted to avoid brightness abnormalities caused by factors such as facial obstruction and color differences, thereby effectively improving the accuracy of portrait photography. In addition, by adjusting the overall imaging brightness of the captured image, the image display effect can be optimized, especially including HDR imaging effects, allowing users to quickly obtain images with suitable brightness, thus improving the convenience of portrait photography using electronic devices.
[0146] Please see Figure 8 , Figure 8 This is a modular schematic diagram of an electronic device disclosed in an embodiment of this application. For example... Figure 8 As shown, the electronic device may include:
[0147] Memory 801 storing executable program code;
[0148] Processor 802 coupled to memory 801;
[0149] The processor 802 can call the executable program code stored in the memory 801 to execute all or part of the steps in any of the image brightness optimization methods described in the above embodiments.
[0150] Furthermore, embodiments of this application disclose a computer-readable storage medium storing a computer program for electronic data interchange, wherein the computer program enables a computer to execute all or part of the steps in any of the image brightness optimization methods described in the above embodiments.
[0151] Furthermore, this application further discloses a computer program product that, when run on a computer, enables the computer to execute all or part of the steps in any of the image brightness optimization methods described in the above embodiments.
[0152] Those skilled in the art will understand that all or part of the steps in the various methods of the above embodiments can be implemented by a program instructing related hardware. The program can be stored in a computer-readable storage medium, including read-only memory (ROM), random access memory (RAM), programmable read-only memory (PROM), erasable programmable read-only memory (EPROM), one-time programmable read-only memory (OTPROM), electrically-erasable programmable read-only memory (EEPROM), compact disc read-only memory (CD-ROM) or other optical disc storage, disk storage, magnetic tape storage, or any other computer-readable medium capable of carrying or storing data.
[0153] The above provides a detailed description of an image brightness optimization method, apparatus, electronic device, and storage medium disclosed in the embodiments of this application. Specific examples have been used to illustrate the principles and implementation methods of this application. The descriptions of the above embodiments are only for the purpose of helping to understand the method and core ideas of this application. At the same time, for those skilled in the art, there will be changes in the specific implementation methods and application scope based on the ideas of this application. Therefore, the content of this specification should not be construed as a limitation of this application.
Claims
1. An image brightness optimization method, characterized in that, include: Identify the face image region from the image to be processed; Obtain the facial brightness information and facial color information corresponding to the facial image region; When the face brightness information meets the brightness triggering condition, obtain the region brightness weight information corresponding to the face brightness information; Based on the regional brightness weight information and the reference weight information table, calculate the first weight information corresponding to the face brightness information, and calculate the first face brightness parameter based on the first weight information; as well as, Obtain the second weight information corresponding to the facial brightness information, and calculate the second facial brightness parameter based on the second weight information; Based on the first face brightness parameter and the second face brightness parameter, a fused face brightness parameter is calculated, which is used to adjust the brightness of the image to be processed.
2. The method according to claim 1, characterized in that, The face image region includes one or more grid regions, and obtaining the face brightness information and face color information corresponding to the face image region includes: Obtain the facial brightness information and facial color information corresponding to each of the grid regions respectively; When the face brightness information meets the brightness triggering condition, the step of obtaining the region brightness weight information corresponding to the face brightness information includes: By traversing each of the grid regions, the brightness information of the face corresponding to each grid region is statistically analyzed to obtain the brightness statistics result. If the brightness statistics result indicates that the face image region belongs to the target scene, the face brightness information is confirmed to meet the brightness triggering condition, wherein the target scene includes a bright area scene or a dark area scene; Based on the target scene, obtain the region brightness weight information corresponding to the face brightness information.
3. The method according to claim 2, characterized in that, The step of obtaining the first weight information corresponding to the face brightness information based on the region brightness weight information and the reference weight information table includes: When the target scene is a bright area scene, the first weight information corresponding to the face brightness information is obtained based on the region brightness weight information and the first reference weight information table corresponding to the bright area scene; or, When the target scene is a dark scene, the first weight information corresponding to the face brightness information is obtained based on the regional brightness weight information and the second reference weight information table corresponding to the dark scene.
4. The method according to claim 1, characterized in that, The second weight information corresponding to the facial expression information is obtained as follows: When the facial color information meets the color triggering condition, the extreme color scene ratio corresponding to the facial color information is obtained. The extreme color scene ratio is used to represent the ratio between the first image region that exceeds the extreme color threshold and the second image region other than the first image region in the facial image region. Based on the proportion of the extreme color scene, the second weight information corresponding to the human facial color information is calculated.
5. The method according to claim 4, characterized in that, The face image region includes one or more grid regions. The step of obtaining the extreme color scene ratio corresponding to the face color information when the face color information meets the color triggering conditions includes: Based on the facial color information corresponding to each of the grid regions, the color ratio information corresponding to each of the grid regions is calculated, wherein the color ratio information includes at least the R / G color ratio and the B / G color ratio; Based on the color ratio information corresponding to each of the grid regions, a first image region exceeding the extreme color threshold is determined, and a second image region other than the first image region is determined in the face image region. Calculate the region ratio between the first image region and the second image region, and if it is confirmed that the human face color information meets the color triggering conditions, determine the region ratio as the extreme color scene ratio corresponding to the human face color information.
6. The method according to any one of claims 1 to 5, characterized in that, After calculating the fused face brightness parameters based on the first face brightness parameters and the second face brightness parameters, the method further includes: Obtain the brightness adjustment region corresponding to the fused face brightness parameters, wherein the brightness adjustment region includes any image region in the image to be processed that contains the face image region; The brightness of the brightness adjustment area is adjusted by fusing the facial brightness parameters.
7. An image brightness optimization device, characterized in that, include: The determining unit is used to determine the face image region from the image to be processed; The information acquisition unit is used to acquire the face brightness information and face color information corresponding to the face image region; The first calculation unit is used to obtain the region brightness weight information corresponding to the face brightness information when the face brightness information meets the brightness triggering condition. Based on the regional brightness weight information and the reference weight information table, calculate the first weight information corresponding to the face brightness information, and calculate the first face brightness parameter based on the first weight information; as well as, The second calculation unit is used to obtain the second weight information corresponding to the facial brightness information, and calculate the second facial brightness parameter based on the second weight information; The third calculation unit is used to calculate the fused face brightness parameter based on the first face brightness parameter and the second face brightness parameter, and the fused face brightness parameter is used to adjust the brightness of the image to be processed.
8. An electronic device, characterized in that, The system includes a memory and a processor, wherein the memory stores a computer program that, when executed by the processor, causes the processor to perform the method as described in any one of claims 1 to 6.
9. A computer-readable storage medium having a computer program stored thereon, characterized in that, When the computer program is executed by a processor, it implements the method as described in any one of claims 1 to 6.
Citation Information
Patent Citations
Portrait face adjustment methods and device, memory medium and terminal
CN109618098A
Face image exposure method and device, electronic equipment and storage medium
CN113379650A