Face-based picture brightness adjustment method and device, equipment, medium and product
By identifying and analyzing multiple face areas in the monitoring screen, calculating and applying brightness adjustment ratios, the problem of uneven face brightness in the monitoring screen is solved, and the readability of the monitoring screen and the visibility of face features is improved.
Patent Information
- Application Number
- CN202510308132.9
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-03-14
- Publication Date
- 2025-06-17
AI Technical Summary
The prior art is difficult to take into account the brightness of different face areas in the monitoring screen under different lighting conditions, resulting in uneven face brightness and poor readability of the monitoring screen.
By identifying multiple face areas in the target monitoring screen of the monitoring device, the area size and brightness values of each face area are determined, and the brightness of each face area is solved according to the pre-calibrated target face brightness, the brightness adjustment ratio of the target monitoring screen is determined, and the brightness of the monitoring screen is adjusted according to the brightness parameters and adjustment ratio.
It achieves the balance of brightness in different face areas, improves the visibility of face features, and improves the readability of monitoring images.
Smart Images

Figure CN120166286A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of monitoring equipment control technology, and in particular to a method, device, equipment, medium and product for adjusting picture brightness based on face. Background Art
[0002] In video surveillance, smart camera and face recognition applications, monitoring equipment needs to provide images with appropriate brightness under different lighting conditions to ensure accurate collection of facial information. To improve the readability of the monitoring screen, the related technology usually adjusts the exposure of the monitoring screen according to the brightness of a certain area in the monitoring screen (such as the brightness of the face area), and adjusts the overall brightness of the monitoring screen to an appropriate range to improve the visibility of the face.
[0003] However, in the actual monitoring process, due to the influence of ambient lighting conditions, there may be large differences in the brightness of different face areas in the monitoring screen. The above-mentioned screen brightness adjustment method is difficult to take into account the brightness of different face areas, and it is easy to have uneven brightness of the faces in the monitoring screen, resulting in poor readability of the monitoring screen. Summary of the invention
[0004] The present invention provides a method, device, equipment, medium and product for adjusting picture brightness based on human face, so as to solve the problem that related picture brightness adjustment methods are prone to uneven face brightness, resulting in poor readability of monitoring pictures.
[0005] In a first aspect, an embodiment of the present application provides a method for adjusting picture brightness based on a face, comprising:
[0006] Identify multiple face areas in a target monitoring screen of a monitoring device;
[0007] Determine the size of each face area and the face brightness value;
[0008] According to the size of each face area and the face brightness value, the brightness of the target face calibrated in advance is used as the brightness target to solve and determine the brightness adjustment ratio of the target monitoring screen;
[0009] Adjust the brightness of the monitoring screen of the monitoring device according to the brightness parameters and brightness adjustment ratio of the target monitoring screen.
[0010] Optionally, according to the area size of each face area and the face brightness value, a pre-calibrated target face brightness is used as a brightness target to solve and determine the brightness adjustment ratio of the target monitoring screen, including:
[0011] Determine the weight coefficient of each face area in the target monitoring screen according to the area size of each face area;
[0012] Based on the weight coefficients of multiple face regions and the face brightness values, solve with the target face brightness as the brightness target to determine the brightness adjustment ratio of the target monitoring screen.
[0013] Optionally, the weight coefficients include an area weight and a brightness weight. Determine the weight coefficients of each face region in the target monitoring screen according to the area sizes of the face regions, including:
[0014] Determine the number of irrecoverable pixels in each face region, where irrecoverable pixels are pixels whose pixel values exceed a preset pixel range;
[0015] Determine the brightness weight of each face region according to the number of irrecoverable pixels in each face region;
[0016] Determine the area weight of each face region according to the ratio of the area size of each face region to the area size of the target monitoring screen.
[0017] Optionally, the weight coefficients include an area weight and a brightness weight. Based on the weight coefficients of multiple face regions and the face brightness values, solve with the target face brightness as the brightness target to determine the brightness adjustment ratio of the target monitoring screen, including:
[0018] Predict the face brightness after adjusting the screen brightness by a preset ratio parameter according to the brightness weight of the face region and the face brightness value to obtain the predicted face brightness of the face region;
[0019] Determine the difference between the predicted face brightness of the face region and the target face brightness as the predicted brightness difference of the face region;
[0020] Perform a weighted summation calculation according to the area weight and the predicted brightness difference of each face region to determine the weighted sum of the brightness distances between multiple face regions and the target face brightness;
[0021] Solve for the preset ratio parameter with the goal of minimizing the weighted sum of the brightness distances to obtain the brightness adjustment ratio of the target monitoring screen.
[0022] Optionally, the brightness parameters include the exposure amount and the gamma brightness curve. Adjust the brightness of the monitoring screen of the monitoring device according to the brightness parameters and the brightness adjustment ratio of the target monitoring screen, including:
[0023] In the case where the gain value of the target monitoring screen is less than the first gain threshold, adjust the exposure amount of the monitoring screen of the monitoring device according to the brightness adjustment ratio;
[0024] In the case where the gain value of the target monitoring screen is greater than the second gain threshold, adjust the gamma brightness curve of the monitoring screen of the monitoring device according to the brightness adjustment ratio.
[0025] Optionally, the brightness parameter includes the exposure amount and the gamma brightness curve. According to the brightness parameter and the brightness adjustment ratio of the target monitoring screen, the brightness of the monitoring screen of the monitoring device is adjusted, including:
[0026] When the gain value of the target monitoring screen is greater than or equal to the first gain threshold and less than or equal to the second gain threshold, determine the exposure adjustment ratio and the adjustment ratio of the gamma brightness curve according to the gain value of the target monitoring screen and the brightness adjustment ratio;
[0027] Adjust the exposure amount of the monitoring screen of the monitoring device according to the exposure adjustment ratio, and adjust the gamma brightness curve of the monitoring screen of the monitoring device according to the adjustment ratio of the gamma brightness curve.
[0028] Optionally, according to the gain value of the target monitoring screen and the brightness adjustment ratio, adjusting the brightness of the monitoring screen of the monitoring device includes:
[0029] Determine the brightness adjustment ratio of multiple consecutive monitoring screens, and the monitoring screen of the last frame in the multiple consecutive monitoring screens is the target monitoring screen;
[0030] Determine the optimized target adjustment ratio according to the brightness adjustment ratio of the multiple consecutive monitoring screens;
[0031] Adjust the brightness of the monitoring screen of the monitoring device according to the brightness parameter of the target monitoring screen and the optimized target adjustment ratio.
[0032] In a second aspect, an embodiment of the present application provides a screen brightness adjustment device, including:
[0033] A face recognition module for recognizing multiple face areas in the target monitoring screen of the monitoring device;
[0034] A first determination module for determining the area size and face brightness value of each face area;
[0035] A second determination module for solving with a pre-calibrated target face brightness as the brightness target according to the area size and face brightness value of each face area, and determining the brightness adjustment ratio of the target monitoring screen;
[0036] A brightness adjustment module for adjusting the brightness of the monitoring screen of the monitoring device according to the brightness parameter and the brightness adjustment ratio of the target monitoring screen.
[0037] In a third aspect, an embodiment of the present application provides an electronic device, including a memory, a processor, and a computer program stored in the memory and executable on the processor. When the processor executes the computer program, the steps of the above-mentioned face-based screen brightness adjustment method are implemented.
[0038] Fourthly, an embodiment of the present application provides a readable storage medium storing a computer program, which when executed by a processor, implements the steps of the above-mentioned method for adjusting the screen brightness.
[0039] Fifthly, an embodiment of the present application provides a computer program product, which includes a computer program. When the computer program is run, the method for adjusting the screen brightness based on human faces is executed.
[0040] In one solution provided by the above-mentioned method, device, equipment, medium and product for adjusting the screen brightness based on human faces, multiple human face regions in the target monitoring screen of the monitoring device are identified, and the area size and human face brightness value of each human face region are determined; according to the area size and human face brightness value of each human face region, with the pre-calibrated target human face brightness as the brightness target for solution, the brightness adjustment ratio of the target monitoring screen is determined; according to the brightness parameter and brightness adjustment ratio of the target monitoring screen, the brightness of the monitoring screen of the monitoring device is adjusted. In this embodiment, based on the preset target human face brightness, and based on the area and brightness value of the human face region, the brightness adjustment ratio of the overall screen is calculated, which can reflect the influence of different human face regions on the overall screen, reduce the unreasonable dominant effect on the global brightness adjustment caused by only using a single or partial human face region, and realize intelligent brightness adjustment optimized based on multiple human faces; by dynamically adjusting the brightness of the monitoring screen of the monitoring device through the brightness adjustment ratio, the brightness of different human face regions in the screen is made as close as possible to the target human face brightness, which can improve the balance of different human face brightness and the visibility of human face features, and improve the readability of the monitoring screen. Description of the Drawings
[0041] In order to more clearly illustrate the technical solutions of the embodiments of the present invention, the drawings required for the description of the embodiments of the present invention will be briefly introduced below. Obviously, the drawings in the following description are only some embodiments of the present invention, and those of ordinary skill in the art can also obtain other drawings without creative efforts based on these drawings.
[0042] Figure 1 is a schematic structural diagram of a monitoring system in an embodiment of the present invention;
[0043] Figure 2 is a schematic flowchart of a method for adjusting the screen brightness based on human faces in an embodiment of the present invention;
[0044] Figure 3 is Figure 2 a schematic implementation flowchart of step S30 in
[0045] Figure 4 is a schematic diagram of the effect before and after adjusting the brightness of the overexposed human face region in an embodiment of the present invention;
[0046] Figure 5 is the model output curve graph when taking different exponential values in an embodiment of the present invention;
[0047] Figure 6 is Figure 2 a schematic implementation flowchart of step S40 in
[0048] Figure 7 is the schematic structural diagram of the brightness queue in an embodiment of the present invention;
[0049] Figure 8 is Figure 2 another schematic implementation flowchart of step S40 in
[0050] Figure 9 is Figure 2 yet another schematic implementation flowchart of step S40 in
[0051] Figure 10 is Figure 1 a schematic structural diagram of the screen brightness adjustment device in
[0052] Figure 11 is the schematic structural diagram of an electronic device in an embodiment of the present invention. Detailed implementation manners
[0053] Next, the technical solutions in the embodiments of the present invention will be clearly and completely described in conjunction with the accompanying drawings in the embodiments of the present invention. Obviously, the described embodiments are part of the embodiments of the present invention, rather than all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by those of ordinary skill in the art without making creative efforts belong to the scope of protection of the present invention.
[0054] It should be understood that when used in the specification and the appended claims of the present invention, the term "comprising" indicates the presence of the described features, wholes, steps, operations, elements, and / or components, but does not exclude the presence or addition of one or more other features, wholes, steps, operations, elements, components, and / or their combinations. It should also be understood that the term "and / or" used in the specification and the appended claims of the present invention refers to any combination and all possible combinations of one or more of the related listed items, and includes these combinations.
[0055] In addition, in the description of the specification and the appended claims of the present invention, the terms "first", "second", "third", etc. are only used for distinguishing descriptions, and cannot be understood as indicating or implying relative importance.
[0056] Reference to "one embodiment" or "some embodiments" etc. described in the specification of the present invention means that a specific feature, structure or characteristic described in connection with the embodiment is included in one or more embodiments of the present invention. Thus, statements such as "in one embodiment", "in some embodiments", "in other some embodiments", "in still other embodiments" etc. that appear in different places in this specification do not necessarily all refer to the same embodiment, but mean "one or more but not all embodiments", unless otherwise specifically emphasized in another way. The terms "comprising", "including", "having" and their variants all mean "including but not limited to", unless otherwise specifically emphasized in another way.
[0057] It should be understood that the magnitudes of the sequence numbers of the steps in the following embodiments do not mean the order of execution is prior or subsequent. The execution order of each process should be determined according to its function and internal logic, and should not constitute any limitation to the implementation process of the embodiments of the present invention.
[0058] In order to illustrate the technical solution of the present invention, specific embodiments will be used for illustration below.
[0059] It should be understood that in the related art, the exposure amount of the monitoring screen is usually adjusted according to the brightness of a certain area in the monitoring screen (such as the brightness of the face area), and the overall brightness of the monitoring screen is adjusted to a suitable range to improve the overall visibility of the monitoring screen. However, in the actual monitoring process, due to the influence of environmental light conditions, there may be a large difference in the brightness of different face areas in the monitoring screen. The above-mentioned method of adjusting the screen brightness is difficult to take into account the brightness of different face areas, and it is easy to occur that some areas in the monitoring screen are overexposed or underexposed, which exacerbates the problem of uneven face brightness and results in poor readability of the monitoring screen.
[0060] For example, multiple people may appear in the screen at the same time. Due to the influence of environmental light conditions, the lighting effects of different faces are also different. If the overall exposure of the screen is adjusted according to the brightness of a certain face, then only the screen brightness can be increased or decreased. At this time, only the brightness of some faces can be improved, and the effects of some other faces may become worse, resulting in poor readability of the monitoring screen.
[0061] In view of the above problems, embodiments of the present invention provide a face-based screen brightness adjustment method, device, equipment, medium and product, which identify multiple face regions in the target monitoring screen of a monitoring device, and determine the area size and face brightness value of each face region; according to the area size and face brightness value of each face region, solve with a pre-calibrated target face brightness as the brightness target to determine the brightness adjustment ratio of the target monitoring screen; adjust the brightness of the monitoring screen of the monitoring device according to the brightness parameter and brightness adjustment ratio of the target monitoring screen. Based on the pre-set target face brightness, calculate the overall brightness adjustment ratio of the screen based on the area and brightness value of the face region, which can reflect the influence of different face regions on the overall screen, reduce the unreasonable dominant effect of using only a single or partial face region on the global brightness adjustment, and achieve intelligent brightness adjustment optimized based on multiple faces; dynamically adjust the screen brightness of the monitoring device through the brightness adjustment ratio, so that the brightness of different face regions in the screen is as close as possible to the target face brightness, which can improve the balance of different face brightness and the visibility of face features, and improve the readability of the monitoring screen.
[0062] The face-based screen brightness adjustment method provided by the embodiments of the present invention can be applied in a monitoring system as shown in Figure 1 The monitoring system includes a monitoring device and a screen brightness adjustment device. Among them, the monitoring device communicates with the screen brightness adjustment device through a network or a cable.
[0063] Specifically, during the operation of the monitoring system, the monitoring device monitors the environmental change situation in a specified position range. The screen brightness adjustment device obtains the monitoring screen collected by the monitoring device (such as the current monitoring target) as the target monitoring screen. After obtaining the target monitoring screen of the monitoring device, the screen brightness adjustment device can perform face detection on the target monitoring screen to determine multiple face regions in the target monitoring screen. Then, the screen brightness adjustment device determines the area size and face brightness value of each face region, and according to the area size and face brightness value of each face region, solves with a pre-calibrated target face brightness as the brightness target to determine the brightness adjustment ratio of the target monitoring screen; finally, adjusts the brightness of the monitoring screen of the monitoring device according to the brightness parameter and brightness adjustment ratio of the target monitoring screen.
[0064] In this embodiment, based on the preset target face brightness, the brightness adjustment ratio of the overall picture is calculated based on the area and brightness value of the face region, which can reflect the influence of different face regions on the overall picture, reduce the unreasonable dominant effect of only using a single or partial face region on the global brightness adjustment, and achieve intelligent brightness adjustment optimized based on multiple faces. The brightness of the monitoring device's picture is dynamically adjusted through the brightness adjustment ratio, so that the brightness of different face regions in the picture is as close as possible to the target face brightness, which can improve the balance of different face brightnesses and the visibility of face features, and improve the readability of the monitoring picture.
[0065] Among them, the monitoring device can be various types of imaging devices, such as cameras, cameras, etc. The picture brightness adjustment can be various electronic devices that can perform independent operations and control the monitoring device, such as various terminal devices such as personal computers, laptops, smartphones, tablets, etc., and various servers. The server can be implemented by an independent server or a server cluster composed of multiple servers.
[0066] In one embodiment, as Figure 2 shown, a method for adjusting the picture brightness based on faces is provided. Taking the monitoring system in Figure 1 as an example for description, the method includes the following steps:
[0067] S10: Identify multiple face regions in the target monitoring picture of the monitoring device.
[0068] The monitoring device monitors the environmental change situation within a specified position range. The picture brightness adjustment device acquires the target monitoring picture of the monitoring device and performs face detection on the target monitoring picture to determine multiple face regions in the target monitoring picture.
[0069] Among them, performing face detection on the target monitoring picture can be to perform face recognition on the current monitoring picture using a preset face recognition algorithm to determine multiple face regions in the target monitoring picture. Among them, the preset face recognition algorithm can be a face recognition algorithm based on face feature points, a face recognition algorithm based on the entire image, a face recognition algorithm based on templates, an algorithm for face recognition using neural networks, etc.
[0070] In other embodiments, due to the problem of the recognition accuracy of the above face recognition algorithm, there may be a situation where some faces in the monitoring picture cannot be recognized. To improve the accuracy and efficiency of face recognition, a preset face recognition algorithm can be first used to perform face recognition on the current monitoring picture to identify at least one face region; in the case where there are unrecognized face regions in the target monitoring picture, a preset face detection algorithm is used to detect the face regions of the human-shaped regions where no faces are recognized to obtain multiple face regions in the target monitoring picture.
[0071] Among them, the implementation process of the preset face detection algorithm can be as follows: determine the human-shaped area in the target monitoring screen; identify the background brightness and clothing brightness of the human-shaped area to determine the background brightness and clothing brightness in the human-shaped area; based on the background brightness and clothing brightness, determine the light and dark situation of the face relative to the background in the human-shaped area; according to the light and dark situation of the face, perform area detection on the preset area in the human-shaped area with the same light and dark situation to estimate the face area. Among them, the preset area is the area containing the head in the human-shaped area; the estimated face area is the area that can represent the face brightness in the human-shaped area. This method can estimate the area where the face may exist when no face is detected, so as to adjust the brightness of the monitoring screen according to the brightness of the estimated face area.
[0072] S20: Determine the area size and face brightness value of each face area.
[0073] After identifying multiple face areas in the target monitoring screen, the screen brightness adjustment device can determine the area size of each face area and determine the face brightness value of the face area.
[0074] Among them, the area size of the face area is the area of the pixels occupied by the face area in the target monitoring screen, which can be directly calculated according to the size (such as length and width) of the face area in the target monitoring screen.
[0075] Among them, the face brightness value can be the average brightness of the pixels in the face area, which can be obtained by calculating the average brightness value of each pixel in the face area. In other embodiments, the face brightness value can also be the maximum or minimum value of the pixel brightness in the face area.
[0076] S30: According to the area size and face brightness value of each face area, solve with the pre-calibrated target face brightness as the brightness target to determine the brightness adjustment ratio of the target monitoring screen.
[0077] For example, a pre-constructed brightness prediction model can be obtained. This brightness prediction model is constructed based on the area size and face brightness value of the face area, as well as the target face brightness and brightness adjustment ratio. This brightness prediction model is used to predict the brightness adjustment ratio required when adjusting the brightness of face areas with different areas in the target monitoring screen to be close to the target face brightness. Input the area size and face brightness value of multiple face areas into this brightness prediction model for multi-objective solution, and the brightness adjustment ratio of the target monitoring screen can be obtained.
[0078] S40: Adjust the brightness of the monitoring screen of the monitoring device according to the brightness parameter and brightness adjustment ratio of the target monitoring screen.
[0079] After determining the brightness adjustment ratio of the target monitoring screen, adjust the brightness of the monitoring screen of the monitoring device according to the brightness parameter and the brightness adjustment ratio of the target monitoring screen. The brightness adjustment ratio represents the degree to which the overall brightness of the monitoring screen needs to change. For example, if the brightness adjustment ratio is 1.1, it means that the brightness of the monitoring screen after adjustment is 110% of the brightness of the monitoring screen before adjustment; if the brightness adjustment ratio is 0.9, it means that the brightness of the monitoring screen after adjustment is 90% of the brightness of the monitoring screen before adjustment.
[0080] Among them, the current brightness parameter of the target monitoring screen can be directly multiplied by the brightness adjustment ratio to obtain a new brightness parameter, and the monitoring device can be controlled to work according to the new brightness, so as to realize the brightness adjustment of the monitoring screen.
[0081] For example, according to the current exposure of the target monitoring screen, adjust the exposure of the target monitoring screen according to the brightness adjustment ratio, so as to realize the brightness adjustment of the monitoring screen of the monitoring device.
[0082] In this embodiment, based on the area and brightness value of the face region, the weight coefficient of each region in the screen is calculated, which can reflect the influence of different face regions on the overall screen, reduce the unreasonable dominant effect of only using a single or partial face region on the global brightness adjustment, ensure that the brightness adjustment can take into account different faces, and ensure the balance of face brightness; and based on the preset target face brightness as a reference, according to the weight coefficients of different face regions, the brightness adjustment ratio of the overall screen can be accurately determined, so as to realize intelligent brightness adjustment based on face optimization. By dynamically adjusting the brightness of the monitoring device screen, the brightness of different face regions in the screen is made as close as possible to the target face brightness, improving the balance of different face brightness and the visibility of face features, and enhancing the readability of the monitoring screen.
[0083] In one embodiment, after the screen brightness adjustment device obtains the target monitoring screen of the monitoring device and performs face detection on the target monitoring screen, when no human-shaped region is recognized in the target monitoring screen, or when a human-shaped region is recognized but no face region is recognized, the brightness adjustment ratio of the target monitoring screen is determined to be 1, that is, the brightness of the target monitoring screen is not adjusted, so as to avoid excessive brightness adjustment.
[0084] It should be understood that adjusting the brightness of the monitoring screen by collecting the brightness adjustment ratio will overall increase or suppress the brightness of the screen and improve the brightness of the face to enhance the readability of the monitoring screen. However, this solution may also have an adverse impact on the background in the actual monitoring scenario, so a callback mechanism needs to be set up to correct the monitoring effect of the monitoring device.
[0085] That is, in one embodiment, the screen brightness adjustment device can record the number of monitored screen frames with a brightness adjustment ratio of 1, that is, record the number of monitored screen frames without brightness adjustment, to obtain the number of unadjusted screen frames. When the recorded number of unadjusted screen frames reaches a preset quantity, that is, when the number of monitored screen frames without detecting a human face reaches the preset quantity, the brightness parameter of the monitoring device can be adjusted to the original parameter (such as the parameter when the monitoring device is started) so that the brightness state of the monitored screen returns to the brightness state before adjustment to ensure a normal monitored screen. At the same time, the number of unadjusted screen frames is cleared to facilitate subsequent callback of brightness.
[0086] Among them, different scenarios can be distinguished according to the human figure and face recognition situation, and different preset quantities for callback can be set according to different scenarios. Among them, when no human figure area is recognized in the target monitored screen, the brightness adjustment ratio of the target monitored screen is determined to be 1, and the number of monitored screen frames without recognizing a human figure area is recorded, denoted as the first screen frame number. When a human figure area is recognized in the target monitored screen but no face area is recognized, the brightness adjustment ratio of the target monitored screen is determined to be 1, and the number of monitored screen frames with a recognized human figure area but no recognized face area is recorded, denoted as the second screen frame number. When the first screen frame number reaches the first preset quantity, the brightness parameter of the monitoring device can be adjusted to the original parameter to ensure a normal monitored screen, and at the same time, the number of unadjusted screen frames is cleared. When the second screen frame number reaches the second preset quantity, the brightness parameter of the monitoring device can be adjusted to the original parameter to ensure a normal monitored screen, and at the same time, the number of unadjusted screen frames is cleared. Among them, the second preset quantity is greater than the first preset quantity. By distinguishing different scenarios and setting different parameter callback thresholds according to different results of human figure and face recognition, the normal operation of the monitored screen can be effectively ensured.
[0087] In one embodiment, as Figure 3 shown, step S30, that is, according to the area size and face brightness value of each face area, solving with the pre-calibrated target face brightness as the brightness target to determine the brightness adjustment ratio of the target monitored screen, includes the following steps:
[0088] S31: Determine the weight coefficient of each face area in the target monitored screen according to the area size of each face area.
[0089] After determining the area size and face brightness value of each face area, the screen brightness adjustment device determines the weight coefficient of each face area in the target monitored screen according to the area size of each face area.
[0090] For example, a weight value can be assigned to each face region based on the area ratio between the area of each face region and a preset area, as well as the brightness difference between the face brightness value of each face region and a preset brightness value, so as to obtain the weight coefficient of each face region in the target monitoring screen. The larger the area ratio, the larger the weight coefficient. The farther the face brightness is from the target brightness, the larger the corresponding weight coefficient. Among them, the preset area can be the area of the target monitoring screen or the total area of all face regions in the target monitoring screen. The preset brightness value can be the calibrated target face brightness, such as 128, or the maximum face brightness value among the face brightness values of multiple face regions.
[0091] S32: Solve based on the weight coefficients and face brightness values of multiple face regions, with the target face brightness as the brightness target, to determine the brightness adjustment ratio of the target monitoring screen.
[0092] After determining the weight coefficients of each face region, the screen brightness adjustment device solves based on the weight coefficients and face brightness values of multiple face regions, with the pre-calibrated target face brightness as the brightness target, to determine the brightness adjustment ratio of the target monitoring screen.
[0093] For example, a pre-constructed brightness prediction model can be obtained. This brightness prediction model is constructed based on the weight coefficients of different face regions, the target face brightness, and the brightness adjustment ratio. This brightness prediction model is used to predict the brightness adjustment ratio required when adjusting the brightness of different face regions in the target monitoring screen to be close to the target face brightness. Inputting the weight coefficients of multiple face regions into this brightness prediction model for solution can obtain the brightness adjustment ratio of the target monitoring screen.
[0094] In this embodiment, the weight coefficient of the face region in the target monitoring screen is determined according to the area size of each face region, and then, based on the weight coefficients and face brightness values of multiple face regions, with the target face brightness as the brightness target for solution, the brightness adjustment ratio of the target monitoring screen is determined. Calculating the weight coefficient of each region in the screen based on the area of the face region can reflect the influence of different face regions on the overall screen, reduce the unreasonable dominant role of only using a single or partial face region in the global brightness adjustment, ensure that the brightness adjustment can take into account different faces, and ensure the balance of face brightness. And based on the preset target face brightness, according to the weight coefficients and face brightness values of different face regions, the brightness adjustment ratio of the entire screen can be accurately determined, so as to realize intelligent brightness adjustment optimized based on multiple faces, make the brightness of different face regions in the screen as close as possible to the target face brightness, improve the balance of different face brightness and the visibility of face features, and improve the readability of the monitoring screen.
[0095] In one embodiment, the weight coefficients of the face regions include an area weight and a brightness weight. Step S31, that is, determining the weight coefficients of the face regions in the target monitoring screen according to the area sizes of the face regions, includes the following steps:
[0096] S311: Determine the number of irrecoverable pixels in each face region.
[0097] In this embodiment, the weight coefficients of the face regions in the target monitoring screen include an area weight and a brightness weight.
[0098] Among them, the screen brightness adjustment device can determine the number of irrecoverable pixels in the face region according to the pixel values of the pixels in the face region, so as to obtain the number of irrecoverable pixels in the face region. The irrecoverable pixels are the pixels whose pixel values exceed the preset pixel range in the face region.
[0099] For example, the preset pixel range can be the pixel range [20, 235], that is, the pixels with pixel values in the pixel ranges [0, 20) and (235, 255] are irrecoverable pixels. Among them, a pixel value of 0 means that the pixel is a black dot, and a pixel value of 255 means that the pixel is a white dot. Such irrecoverable pixels are pixels that are difficult to restore their detailed features through post-processing; post-processing refers to the brightness or contrast adjustment processing of the image after converting the screen into an image. Pixels with other values are recoverable pixels, that is, pixels that can restore details. In other embodiments, the irrecoverable pixels in the face region can also be pixels with pixel values close to 0 and pixel values close to 255.
[0100] Among them, as Figure 4 shown, shows the brightness adjustment process of the face region in an overexposed image. Figure 4 The left image in is the face region image before processing, and most of the pixels in this face region image are pixels with a value of 255; Figure 4 The right image in is the face region image after post-processing the image of the monitoring screen. It can be seen from the figure that even if the details of the face region image are adjusted, it is difficult to observe, and the face details cannot be adjusted and restored through post-processing.
[0101] S312: Determine the brightness weight of each face region according to the number of irrecoverable pixels in each face region.
[0102] When determining the number of irrecoverable pixels in each face region, the screen brightness adjustment device determines the number of irrecoverable pixels in the face region and determines the brightness weight of the face region to obtain the brightness weight of each face region.
[0103] As can be seen from the above, the number of irrecoverable pixels in the face region affects the effect of subsequent screen brightness adjustment. Therefore, based on the number of irrecoverable pixels, the brightness weight of each face region is determined here, which can improve the accuracy of subsequent brightness adjustment based on the brightness weight.
[0104] Among them, for the face region with a larger number of irrecoverable pixels, a higher brightness weight is assigned. That is, the larger the number of irrecoverable pixels in the face region, the greater the brightness weight of the face region.
[0105] Specifically, the picture brightness adjustment device can determine the ratio of the number of irrecoverable pixels in the face region to the total number of pixels in the face region as the ratio of irrecoverable pixels in the face region; then, based on the ratio of irrecoverable pixels in the face region, determine the brightness weight of the face region to obtain the brightness weights of each face region.
[0106] Among them, the brightness weight of each face region can be calculated by the following formula:
[0107] k i = 1 ± α i ;
[0108] Among them, k i represents the brightness weight of face region i; α i represents the ratio of irrecoverable pixels in face region i. Among them, the selection of ± in the formula is determined according to the number of different types of irrecoverable pixels in the face region.
[0109] For example, when the number of dark pixels in the irrecoverable pixels of face region i is greater than the number of bright pixels, the ± in the formula takes the minus sign -; when the number of bright pixels in the irrecoverable pixels of face region i is greater than the number of dark pixels, the ± in the formula takes the plus sign +. For example, dark pixels can be pixels with a pixel value of 0 or close to 0. For example, pixels with a pixel value in the pixel range [0, 10) in the irrecoverable pixels can be used as dark pixels; bright pixels can be pixels with a pixel value of 255 or close to 255. For example, pixels with a pixel value in the pixel range (245, 255] in the irrecoverable pixels can be used as bright pixels.
[0110] Determining the brightness weight of the face region by the ratio of irrecoverable pixels to the total pixels of the face region is simple and intuitive. Based on the brightness weight of the face region and the face brightness value, the brightness change of the face region after adjusting the screen brightness according to the brightness adjustment ratio can be effectively estimated, providing an accurate data basis for the subsequent calculation of the brightness adjustment ratio.
[0111] S313: Determine the area weight of each face region according to the ratio of the area size of each face region to the area size of the target monitoring picture.
[0112] Meanwhile, the screen brightness adjustment device can determine the area weight of each face area according to the ratio of the area size of each face area to the area size of the target monitoring screen.
[0113] Specifically, the ratio of the area size of the face area to the area size of the target monitoring screen can be determined as the area proportion of the face area; according to the area proportion of the face area and the area proportions of all face areas in the target monitoring screen, the area weight of the face area is determined. When determining the area weight of each face area, the influence of the area proportions of other face areas is considered to improve the accuracy of the area weight.
[0114] Among them, the area weights of each face area can be calculated by the following formula:
[0115]
[0116] Among them, a i represents the area weight of face area i; s i represents the area size of face area i; S represents the area size of the target monitoring screen; represents the ratio of the area size of face area i to the area size of the target monitoring screen; n represents the total number of face areas in the target monitoring screen.
[0117] In this embodiment, the number of irrecoverable pixels in each face area is determined, and the irrecoverable pixels are pixels whose pixel values exceed the preset pixel range; according to the number of irrecoverable pixels in each face area, the brightness weight of each face area is determined; according to the ratio of the area size of each face area to the area size of the target monitoring screen, the area weight of each face area is determined. From the face brightness value, area size, and number of irrecoverable pixels of each face area, the brightness weight and area weight represented by each face area are determined to determine the importance of each face area in the target monitoring screen from different dimensions. The information that the weight coefficients of each face area can represent improves the accuracy of the weight coefficients. This solution can combine the brightness weights and area weights of each face area to determine a more accurate brightness adjustment ratio, so that the overall screen brightness adjustment not only depends on the local image quality, but also takes into account the relative importance of different regions, and can achieve more intelligent brightness optimization, so that sufficient face details and clarity can be restored after adjustment.
[0118] In one embodiment, the weight coefficient of the face area includes an area weight and a brightness weight. Step S32, that is, according to the weight coefficients of multiple face areas and the face brightness values, solving with the target face brightness as the brightness target to determine the brightness adjustment ratio of the target monitoring screen, includes the following steps:
[0119] S321: Predict the face brightness after adjusting the screen brightness with a preset proportional parameter based on the brightness weight and face brightness value of the face region, and obtain the predicted face brightness of the face region.
[0120] Among them, the weight coefficients of the face region include area weight and brightness weight. The screen brightness adjustment device predicts the face brightness after adjusting the screen brightness with a preset proportional parameter based on the brightness weight and face brightness value of the face region, and obtains the predicted face brightness of the face region, so as to determine the predicted face brightness of each face region.
[0121] Among them, the predicted face brightness of the face region is expressed by the following formula:
[0122] L i = k i * B i * x;
[0123] k i = 1 ± α i ;
[0124] Among them, k i represents the brightness weight of face region i; α i represents the proportion of irrecoverable pixels in face region i; B i represents the face brightness value of face region i, which can be the average brightness of face region i, that is, the average value of pixel values of face region i; x represents the preset proportional parameter, that is, it can represent the brightness adjustment ratio of the target monitoring screen. Among them, the selection of ± in the formula is determined according to the number of different types of irrecoverable pixels in the face region, as detailed above.
[0125] It should be noted that the brightness value (i.e., pixel value) sum of all pixels in the face region can be directly divided by the number of pixels in the face region to obtain the face brightness value of the face region. When predicting the face brightness after adjusting the screen brightness with a preset proportional parameter, the face brightness value of this face region is directly multiplied by the preset proportional parameter to roughly estimate the face brightness of this face region after brightness adjustment, that is, the predicted face brightness of the face region.
[0126] In this embodiment, during the calculation of the predicted face brightness, by using the proportion of irrecoverable pixels in the face region as the brightness weight and adding it to the calculation process of the predicted face brightness, the brightness values of the irrecoverable pixels can be effectively enhanced during this process. Considering the influence of the irrecoverable pixels in the face region on the brightness adjustment effect, the accuracy of the predicted face brightness can be increased. For example, pixels with pixel values outside the pixel range [10, 240] become irrecoverable pixels (i.e., irrecoverable detail pixels). When the pixel value of a pixel in the face region is 241 or above, it is directly set to 255 to participate in the calculation of the average face brightness, and when the pixel value of a pixel in the face region is 9 or below, it is directly set to 0 to participate in the calculation of the average face brightness, that is, to participate in the calculation of the predicted face brightness, and the calculated predicted face brightness is more accurate.
[0127] S322: Determine the difference between the predicted face brightness of the face region and the target face brightness as the predicted brightness difference of the face region.
[0128] After determining the predicted face brightness of each face region, the screen brightness adjustment device determines the difference between the predicted face brightness of the face region and the target face brightness as the predicted brightness difference of the face region.
[0129] S323: Perform a weighted summation calculation based on the area weights and predicted brightness differences of each face region to determine the weighted total of the brightness distances between multiple face regions and the target face brightness.
[0130] After determining the predicted brightness difference of the face region, the screen brightness adjustment device performs a weighted summation of the predicted brightness differences of each face region according to the area weights of each face region to obtain the weighted total of the brightness distances between multiple face regions and the target face brightness.
[0131] Specifically, after determining the predicted brightness difference of the face region, using the predicted brightness difference of the face region as the base number and the calibration value as the exponent, a brightness distance function that can represent the brightness distance between the brightness of the face region and the target face brightness is obtained, that is, the brightness distance function of each face region is obtained; according to the area weights of each face region, a weighted summation is performed on the brightness distance functions of each face region to calculate and predict the weighted total of the brightness distances between multiple face regions and the target face brightness.
[0132] S323: Taking the minimization of the weighted total of the brightness distances as the goal, solve for the preset proportional parameter to obtain the brightness adjustment ratio of the target monitoring screen.
[0133] After predicting the weighted total of the brightness distances between multiple face regions and the target face brightness, taking the minimization of the weighted total of the brightness distances as the goal, solve for the preset proportional parameter, and the brightness adjustment ratio of the target monitoring screen can be obtained.
[0134] Among them, the determination process of the weighted sum of brightness distances can be represented by the following brightness prediction model:
[0135]
[0136] Among them, a i represents the area weight of the face region i; k i represents the brightness weight of the face region i; b represents the pre-calibrated target face brightness, and this parameter is a constant value, such as 128; x represents the preset ratio parameter, that is, the brightness adjustment ratio of the target monitoring screen; n represents the total number of face regions in the target monitoring screen; B i represents the face brightness value of the face region i; α i represents the proportion of irrecoverable pixels in the face region i; |k i *B i *x - b| j represents the distance function between the face brightness value of the face region i and the target face brightness; represents the weighted sum of brightness distances between the brightness of n face regions after brightness adjustment and the target face brightness; m and j both represent a positive integer. When m is a positive integer, the above brightness prediction model has and only has one minimum value; j can be taken according to actual needs.
[0137] It should be noted that in the case of multiple faces in the target monitoring screen, when j = 1, according to the above expression, the brightness of the entire target monitoring screen is only determined by one face, and the brightness effect of such a screen is poor, and the problem of uneven face brightness is likely to occur. According to the experimental data, the larger j is, the more lagging the brightness adjustment ratio output by the brightness prediction model will make the screen brightness adjustment.
[0138] Taking the case where there are 3 face regions in the target monitoring screen and m equals 4 as an example, the output of the above brightness prediction model is simulated, and the simulation results are as Figure 5 shown. Figure 5 shows the brightness adjustment ratios output by the brightness prediction model when the weighted sum of brightness distances is the smallest when j is 1, 2, 3, and 4 respectively. Among them, Figure 4 the horizontal axis in represents the weighted sum of brightness distances, Figure 4 and the vertical axis in represents the preset ratio parameter, that is, the brightness adjustment ratio of the target monitoring screen. It can be clearly seen from the figure that when j = 1, the output of the above brightness prediction model is the most sensitive, and the brightness of the entire screen is directly determined by one face. However, when j = 4, the minimum value of the weighted sum of brightness distances of the above brightness prediction model approaches 1, resulting in insensitive adjustment of the screen brightness. The larger j is, the more inaccurate the brightness adjustment ratio is, resulting in more lagging adjustment of the screen brightness.
[0139] Therefore, in order to improve the accuracy of the brightness prediction model and the accuracy of the brightness adjustment ratio, in this embodiment, j can be set to 3 to control the output of the above brightness prediction model, that is, to minimize the weighted sum of the brightness distances of the brightness prediction model, and then the adjustment ratio x in the brightness prediction model at this time can be output as the brightness adjustment ratio of the target monitoring screen.
[0140] In this embodiment, according to the brightness weight and the face brightness value of the face region, the face brightness after adjusting the screen brightness by a preset ratio parameter is predicted to obtain the predicted face brightness of the face region; the difference between the predicted face brightness of the face region and the target face brightness is determined as the predicted brightness difference of the face region; according to the area weights and the predicted brightness differences of each face region, a weighted summation calculation is performed to determine the weighted sum of the brightness distances between multiple face regions and the target face brightness; with the goal of minimizing the weighted sum of the brightness distances, the preset ratio parameter is solved to obtain the brightness adjustment ratio of the target monitoring screen. By combining the brightness weight, the face brightness value, and the area weight of the face region, this solution can predict the weighted sum of the brightness distances between multiple face regions and the target face brightness, and finally minimize the weighted sum of the brightness distances to solve for the optimal brightness adjustment ratio, so that the screen brightness adjustment reaches the optimal state, ensuring that the face brightness in the target monitoring screen is as close as possible to the target brightness, avoiding the negative impact on the overall screen caused by over-adjustment, and improving the overall quality of the screen.
[0141] In one embodiment, as Figure 6 shown, step S40, that is, adjusting the brightness of the monitoring screen of the monitoring device according to the brightness parameter and the brightness adjustment ratio of the target monitoring screen, specifically includes the following steps:
[0142] S401: Determine the brightness adjustment ratios of multiple consecutive monitoring screens, and the last monitoring screen in the multiple consecutive monitoring screens is the target monitoring screen.
[0143] After determining the brightness adjustment ratio of the target monitoring screen, the screen brightness adjustment device can determine the brightness adjustment ratios of multiple consecutive monitoring screens. Among them, the last monitoring screen in the multiple consecutive monitoring screens is the target monitoring screen.
[0144] During the operation of the monitoring device, the brightness adjustment ratios of the monitoring images of a set number of frames are stored in a brightness queue, where the preset number of frames can be calibrated according to requirements. After the monitoring device captures each frame of the monitoring image, the image brightness adjustment device will use the captured monitoring image as the target monitoring image to determine the brightness adjustment ratio of the target monitoring image. After determining the brightness adjustment ratio of the target monitoring image, the image brightness adjustment device inputs the brightness adjustment ratio of the target monitoring image into the brightness queue. At this time, the brightness queue stores the brightness adjustment ratios of multiple consecutive monitoring images of the set number of frames. By directly reading the data in the brightness queue, the brightness adjustment ratios of multiple consecutive monitoring images can be obtained, which is simple and convenient.
[0145] For example, taking the preset number of frames as 5 frames, the brightness queue is as Figure 7 shown, storing the brightness adjustment ratios of 5 consecutive frames of monitoring images. After the image brightness adjustment device determines the brightness adjustment ratio of the target monitoring image (i.e., the latest monitoring image), it stores the brightness adjustment ratio of the target monitoring image at the end of the brightness queue. The brightness adjustment ratio of the target monitoring image, as new data, will push out the original old data at the head of the brightness queue, so that the brightness queue stores the brightness adjustment ratios of the latest 5 consecutive monitoring images. Therefore, by directly reading the data in the brightness queue, the brightness adjustment ratios of multiple consecutive monitoring images can be obtained, which can ensure data accuracy and improve data acquisition efficiency.
[0146] S402: Determine the optimized target adjustment ratio according to the brightness adjustment ratios of multiple consecutive monitoring images.
[0147] After determining the brightness adjustment ratios of multiple consecutive monitoring images, the brightness adjustment ratio of the target monitoring image can be optimized according to the brightness adjustment ratios of multiple consecutive monitoring images to determine the optimized target adjustment ratio.
[0148] Specifically, it is possible to determine the number of brightness adjustment ratios within the same ratio range among the brightness adjustment ratios of multiple consecutive monitoring images to obtain the number of frames of images with the same adjustment direction; when the number of frames of images with the same adjustment direction is greater than the first quantity, and the differences between each brightness adjustment ratio within the same ratio range and the brightness adjustment ratio of the target monitoring image are all less than the preset difference, the average value of the multiple brightness adjustment ratios within the same ratio range is determined as the optimized brightness adjustment ratio of the target monitoring image. Among them, the ratio range includes the first ratio range and the second ratio range, the first ratio range is the ratio range greater than or equal to 1, and the second ratio range is the ratio range less than or equal to 1.
[0149] The first quantity is close to the total quantity in multiple consecutive monitoring frames. For example, the multiple consecutive monitoring frames can be 5 consecutive monitoring frames, and the first quantity can be 4 frames.
[0150] In this embodiment, the adjustment direction of the monitoring frame is determined according to the proportion range. Being within the same proportion range means that the brightness adjustment directions are the same. Then, when it is determined that the adjustment directions of most monitoring frames in multiple consecutive monitoring frames are the same and the brightness adjustment ratios are not very different, the average value is taken for adjusting the brightness of the frame, which can improve the smoothness and coherence of the brightness adjustment.
[0151] In other embodiments, the average value or median of the brightness adjustment ratios of multiple consecutive monitoring frames can also be used as the optimized target adjustment ratio.
[0152] S403: Adjust the brightness of the monitoring frame of the monitoring device according to the brightness parameter of the target monitoring frame and the optimized target adjustment ratio.
[0153] After determining the optimized target adjustment ratio, adjust the brightness of the monitoring frame of the monitoring device according to the gain value of the target monitoring frame and the optimized target adjustment ratio. Based on the brightness adjustment ratios of multiple consecutive monitoring frames, the brightness of the target monitoring frame is adjusted, which can reduce the problem of brightness flicker of the monitoring frame and ensure the smoothness of the brightness adjustment of the frame.
[0154] In this embodiment, by determining the brightness adjustment ratios of multiple consecutive monitoring frames, the last monitoring frame in the multiple consecutive monitoring frames is the target monitoring frame. According to the brightness adjustment ratios of the multiple consecutive monitoring frames, the optimized target adjustment ratio is determined; according to the brightness parameter of the target monitoring frame and the optimized target adjustment ratio, the brightness of the monitoring frame of the monitoring device is adjusted, which can reduce the situation where the brightness adjustment of a single frame changes too much, reduce the brightness flicker of the monitoring frame, and ensure the smoothness of the brightness adjustment of the frame.
[0155] In one embodiment, the brightness parameter of the target monitoring frame includes the exposure amount and the gamma brightness curve. As Figure 8 shown, in step S40 or step 403, that is, adjusting the brightness of the monitoring frame of the monitoring device according to the brightness parameter of the target monitoring frame and the (optimized) brightness adjustment ratio includes the following steps:
[0156] S41: Determine the magnitudes of the gain value of the target monitoring frame, the first gain threshold, and the second gain threshold.
[0157] Among them, the brightness parameters of the target monitoring screen include the exposure and the gamma brightness curve. When determining the brightness adjustment ratio of the target monitoring screen, the screen brightness adjustment device determines the magnitude relationship between the current gain value of the target monitoring screen and the first gain threshold and the second gain threshold calibrated in advance. That is, it determines whether the current gain value of the target monitoring screen is less than the first gain threshold calibrated in advance, and determines whether the current gain value of the target monitoring screen is greater than the second gain threshold calibrated in advance, so as to execute different brightness adjustment strategies according to different determination results.
[0158] Among them, the first gain threshold and the second gain threshold are calibrated according to the characteristics of the monitoring device, and different monitoring devices correspond to different first gain thresholds and second gain thresholds.
[0159] S42: When the gain value of the target monitoring screen is less than the first gain threshold, adjust the exposure of the monitoring screen of the monitoring device according to the brightness adjustment ratio.
[0160] It should be noted that the adjustment of the exposure is usually to enhance the image brightness in low-light environments so that the camera can capture more details. Gamma adjustment is a non-linear brightness transformation, and the adjustment of the gamma brightness value curve will affect the brightness distribution of the entire image, especially the improvement of dark details. During the operation of the monitoring device, when the ambient brightness is low, some monitoring devices will increase parameters such as the gain value, exposure time, and aperture to adjust the exposure of the screen in order to improve the screen brightness, but this will cause adverse phenomena such as noise trailing of moving objects in the monitoring screen. When the face appears darker and the exposure is further increased, if the brightness adjustment ratio is directly used to adjust the exposure of the monitoring screen, the phenomenon of noise trailing will be further aggravated, and the imaging effect of moving objects in the screen will become worse. When the ambient brightness is already high, the highlight areas (such as white or bright parts) in the screen may be close to saturation (i.e., the brightness value is close to or equal to the maximum value). At this time, the gamma adjustment will not effectively change the brightness, but may cause the loss of highlight details that should be maintained in the screen, and the quality of the monitoring screen is not good.
[0161] To address the above problems, in this embodiment, the ambient brightness is judged by the gain of the monitoring screen. When the gain value of the target monitoring screen is less than the first gain threshold, it indicates that the current ambient brightness is high. To ensure the brightness adjustment effect of the screen, at this time, the exposure of the monitoring screen of the monitoring device can be adjusted according to the (optimized) brightness adjustment ratio to achieve the brightness adjustment of the monitoring screen.
[0162] For example, multiply the current exposure of the target monitoring screen by the (optimized) brightness adjustment ratio to obtain the target exposure. Using the target exposure as the adjustment target, adjust parameters such as the gain value, exposure time, and aperture of the monitoring device to achieve the brightness adjustment of the monitoring screen.
[0163] S43: When the gain value of the target monitoring screen is greater than the second gain threshold, adjust the gamma brightness curve of the monitoring screen of the monitoring device according to the brightness adjustment ratio.
[0164] Similarly, when the gain value of the target monitoring screen is greater than the second gain threshold, it indicates that the current ambient brightness is low. To reduce adverse phenomena such as noise trailing of moving objects in the monitoring screen, instead of adjusting the exposure of the monitoring screen, the gamma brightness curve of the monitoring screen of the monitoring device is adjusted according to the (optimized) brightness adjustment ratio to achieve the brightness adjustment of the monitoring screen. By changing the gamma curve of the monitoring device, the original pixels of the monitoring device can be mapped to higher pixel values, which is equivalent to multiplying all pixel values of a darker picture by a coefficient greater than 1 (i.e., the brightness adjustment ratio) to increase the picture brightness.
[0165] In addition, when the gain value of the target monitoring screen is greater than or equal to the first gain threshold and less than or equal to the second gain threshold, adjust the exposure and gamma brightness curve of the monitoring screen of the monitoring device according to the gain value of the target monitoring screen and the brightness adjustment ratio. At this time, the brightness adjustment of the picture takes into account both the exposure and the gamma brightness curve, which can effectively improve the brightness adjustment effect.
[0166] In this embodiment, when the gain value of the target monitoring screen is less than the first gain threshold, adjust the exposure of the monitoring screen of the monitoring device according to the brightness adjustment ratio; when the gain value of the target monitoring screen is greater than the second gain threshold, adjust the gamma brightness curve of the monitoring screen of the monitoring device according to the brightness adjustment ratio. This solution adaptively selects the adjustment method according to the gain value of the monitoring screen and the preset gain threshold to achieve the purpose of optimizing the brightness of the monitoring screen under different lighting conditions. The gamma brightness curve is used to adjust the picture brightness in low-light environments, and the exposure is used to adjust the picture brightness in high-light environments, so as to achieve more accurate, intelligent, and stable brightness adjustment, avoid the trailing problem and the aggravation of picture noise, and improve the clarity, recognizability of the monitoring screen and the stability of the monitoring system.
[0167] In one embodiment, as Figure 9 shown, step S40, that is, adjusting the brightness of the monitoring screen of the monitoring device according to the brightness parameter and brightness adjustment ratio of the target monitoring screen, includes the following steps:
[0168] S44: When the gain value of the target monitoring screen is greater than or equal to the first gain threshold and less than or equal to the second gain threshold, determine the exposure adjustment ratio and the adjustment ratio of the gamma brightness curve according to the gain value of the target monitoring screen and the brightness adjustment ratio.
[0169] After determining the magnitudes of the gain value of the target monitoring screen, the first gain threshold, and the second gain threshold, when the gain value of the target monitoring screen is greater than or equal to the first gain threshold and less than or equal to the second gain threshold, the screen brightness adjustment device determines the exposure adjustment ratio and the adjustment ratio of the gamma brightness curve according to the gain value of the target monitoring screen and the brightness adjustment ratio.
[0170] Specifically, the exposure adjustment ratio is determined according to the gain value of the target monitoring screen, the brightness adjustment ratio, the first gain threshold, and the second gain threshold; the adjustment ratio of the gamma brightness curve is determined according to the gain value of the target monitoring screen, the brightness adjustment ratio, the first gain threshold, and the second gain threshold.
[0171] Among them, when the brightness adjustment ratio is greater than 1 or greater than the maximum value of the preset ratio range, the exposure adjustment ratio and the adjustment ratio of the gamma brightness curve can be determined respectively by the following formulas:
[0172]
[0173] Among them, x expo represents the exposure adjustment ratio; x gamma represents the adjustment ratio of the gamma brightness curve; x represents the brightness adjustment ratio of the target monitoring screen; gain represents the gain value of the target monitoring screen; a represents the first gain threshold; b represents the second gain threshold. Among them, the preset ratio range is a ratio range close to 1, for example, the preset ratio range can be (0.98, 1.02).
[0174] Among them, when the brightness adjustment ratio is less than 1 or less than the minimum value of the preset ratio range, the exposure adjustment ratio and the adjustment ratio of the gamma brightness curve can be determined respectively by the following formulas:
[0175]
[0176] Among them, x expo represents the exposure adjustment ratio; x gamma represents the adjustment ratio of the gamma brightness curve; x represents the brightness adjustment ratio of the target monitoring screen; gain represents the gain value of the target monitoring screen; a represents the first gain threshold; b represents the second gain threshold.
[0177] S45: Adjust the exposure amount of the monitoring screen of the monitoring device according to the exposure adjustment ratio, and adjust the gamma brightness curve of the monitoring screen of the monitoring device according to the adjustment ratio of the gamma brightness curve.
[0178] Then, the screen brightness adjustment device adjusts the exposure amount of the monitoring screen of the monitoring device according to the exposure adjustment ratio, and adjusts the gamma brightness curve of the monitoring screen of the monitoring device according to the adjustment ratio of the gamma brightness curve.
[0179] In this embodiment, when the gain value of the target monitoring screen is greater than or equal to the first gain threshold and less than or equal to the second gain threshold, the exposure adjustment ratio and the adjustment ratio of the gamma brightness curve are determined according to the gain value of the target monitoring screen and the brightness adjustment ratio; the exposure amount of the monitoring screen of the monitoring device is adjusted according to the exposure adjustment ratio, and the gamma brightness curve of the monitoring screen of the monitoring device is adjusted according to the adjustment ratio of the gamma brightness curve. This solution realizes the precise adjustment of the exposure amount and gamma curve of the monitoring screen through the dynamic combination of the gain value and the brightness adjustment ratio, and optimizes the image quality. Especially in the environment between the first gain threshold and the second gain threshold, this solution can ensure that the image brightness is moderate, enhance the contrast, and improve the detail performance, thereby effectively improving the clarity and recognizability of the monitoring screen.
[0180] In one embodiment, the brightness parameter further includes contrast and wide dynamic range. Step S40, that is, adjusting the brightness of the monitoring screen of the monitoring device according to the brightness parameter and the brightness adjustment ratio of the target monitoring screen, includes the following steps:
[0181] S01: When the brightness adjustment ratio is 1 or within a preset ratio range, determine whether there is an overexposed face area or an underexposed face area in the target monitoring screen.
[0182] Among them, the preset ratio range is a ratio range close to 1. For example, the preset ratio range can be (0.98, 1.02).
[0183] Among them, when the brightness adjustment ratio is 1 or the brightness adjustment ratio is within the preset ratio range, generally the brightness of the target monitoring screen is not adjusted. However, due to the presence of multiple faces in the target monitoring screen, there may be a situation where the brightness of some faces is not good, such as some faces are overexposed or some faces are underexposed. To solve this problem, the brightness of the faces in the target monitoring screen can be further judged to determine whether the brightness of the screen needs to be adjusted according to the judgment result.
[0184] That is, when the brightness adjustment ratio is 1 or within the preset ratio range, it can be determined whether there is an overexposed face area or an underexposed face area in the target monitoring screen. Among them, the overexposed face area refers to the face area where the face brightness value is greater than the maximum value of the preset face brightness range; the underexposed face area refers to the face area where the face brightness value is less than the minimum value of the preset face brightness range. Among them, the preset face brightness range is a pre-calibrated brightness range that can clearly observe the details of the face; the preset face brightness range includes the target brightness of the face, and the preset face brightness range can be [100, 156].
[0185] S02: When there is an overexposed face area in the target monitoring screen, reduce the contrast of the monitoring screen of the monitoring device.
[0186] It should be understood that reducing the image contrast can brighten the dark areas of the image and darken the bright areas. When there is an overexposed face area in the target monitoring screen, reducing the contrast of the monitoring screen of the monitoring device can increase the brightness of different face areas, make the brightness difference between different faces smaller, improve the uneven brightness of different faces, and improve the readability of the monitoring screen.
[0187] S03: When there is an underexposed face area in the target monitoring screen, increase the wide dynamic range of the monitoring screen of the monitoring device.
[0188] When there is an underexposed face area in the target monitoring screen, increasing the wide dynamic range of the monitoring screen of the monitoring device can significantly increase the brightness of the dark areas in the monitoring screen, improve the brightness and details of the faces in the dark areas, and improve the readability of the monitoring screen.
[0189] When the brightness adjustment ratio is not 1 or not within the preset ratio range, the screen brightness adjustment device executes the above steps S41 - S45 to adjust the brightness of the monitoring screen of the monitoring device according to the brightness parameter and brightness adjustment ratio of the target monitoring screen.
[0190] In this embodiment, when the brightness adjustment ratio is 1 or within the preset ratio range, it is determined whether there is an overexposed face area or an underexposed face area in the target monitoring screen; when there is an overexposed face area in the target monitoring screen, reduce the contrast of the monitoring screen of the monitoring device; when there is an underexposed face area in the target monitoring screen, increase the wide dynamic range of the monitoring screen of the monitoring device. When some faces in the monitoring screen are in an overexposed state or an underexposed state, image contrast and image wide dynamic adjustment are introduced, and the brightness of the monitoring screen is adjusted through image contrast and image wide dynamic to ensure the brightness adjustment effect.
[0191] It should be understood that the magnitudes of the sequence numbers of the steps in the above embodiments do not mean the order of execution. The execution order of each process should be determined according to its function and internal logic, and should not constitute any limitation to the implementation process of the embodiments of the present invention.
[0192] In one embodiment, a screen brightness adjustment device is provided, and this screen brightness adjustment device corresponds one-to-one with the face-based screen brightness adjustment method in the above embodiment. As Figure 10 shown, this screen brightness adjustment device includes a face recognition module 101, a first determination module 102, a second determination module 103, and a brightness adjustment module 104. The detailed description of each functional module is as follows:
[0193] The face recognition module 101 is used to recognize multiple face regions in the target monitoring screen of the monitoring device;
[0194] The first determination module 102 is used to determine the area size and face brightness value of each face region;
[0195] The second determination module 103 is used to solve with the pre-calibrated target face brightness as the brightness target according to the area size and face brightness value of each face region, and determine the brightness adjustment ratio of the target monitoring screen;
[0196] The brightness adjustment module 104 is used to adjust the brightness of the monitoring screen of the monitoring device according to the brightness parameter and brightness adjustment ratio of the target monitoring screen.
[0197] Optionally, the second determination module 103 is specifically used for:
[0198] According to the area size of each face region, determine the weight coefficient of each face region in the target monitoring screen;
[0199] Solve with the target face brightness as the brightness target according to the weight coefficients and face brightness values of multiple face regions, and determine the brightness adjustment ratio of the target monitoring screen.
[0200] Optionally, the weight coefficient of the face region includes an area weight and a brightness weight, and the second determination module 103 is specifically further used for:
[0201] Determine the number of irrecoverable pixels in each face region, where the irrecoverable pixels are pixels with a preset pixel value;
[0202] According to the number of irrecoverable pixels in each face region, determine the brightness weight of each face region;
[0203] According to the ratio of the area size of each face region to the area size of the target monitoring screen, determine the area weight of each face region.
[0204] Optionally, the weight coefficient of the face region includes an area weight and a brightness weight, and the second determination module 103 is specifically further used for:
[0205] According to the brightness weight of the face region and the face brightness value, predict the face brightness after adjusting the screen brightness with a preset ratio parameter, and obtain the face prediction brightness of the face region;
[0206] Determine the difference between the face prediction brightness of the face region and the target face brightness as the prediction brightness difference of the face region;
[0207] Perform a weighted summation calculation according to the area weight and prediction brightness difference of each face region, and determine the weighted sum of the brightness distances between multiple face regions and the target face brightness;
[0208] Taking the minimization of the weighted sum of brightness distances as the goal, solve the preset proportional parameter to obtain the brightness adjustment ratio of the target monitoring screen.
[0209] Optionally, the brightness parameter includes the exposure amount and the gamma brightness curve. The brightness adjustment module 104 is specifically configured to:
[0210] When the gain value of the target monitoring screen is less than the first gain threshold, adjust the exposure amount of the monitoring screen of the monitoring device according to the brightness adjustment ratio;
[0211] When the gain value of the target monitoring screen is greater than the second gain threshold, adjust the gamma brightness curve of the monitoring screen of the monitoring device according to the brightness adjustment ratio.
[0212] Optionally, the brightness adjustment module 104 is specifically further configured to:
[0213] When the gain value of the target monitoring screen is greater than or equal to the first gain threshold and less than or equal to the second gain threshold, determine the exposure adjustment ratio and the adjustment ratio of the gamma brightness curve according to the gain value of the target monitoring screen and the brightness adjustment ratio;
[0214] Adjust the exposure amount of the monitoring screen of the monitoring device according to the exposure adjustment ratio, and adjust the gamma brightness curve of the monitoring screen of the monitoring device according to the adjustment ratio of the gamma brightness curve.
[0215] Optionally, the brightness adjustment module 104 is specifically further configured to:
[0216] Determine the brightness adjustment ratio of multiple consecutive monitoring screens, where the last monitoring screen in the multiple consecutive monitoring screens is the target monitoring screen;
[0217] Determine the optimized target adjustment ratio according to the brightness adjustment ratio of the multiple consecutive monitoring screens;
[0218] Adjust the brightness of the monitoring screen of the monitoring device according to the brightness parameter of the target monitoring screen and the optimized target adjustment ratio.
[0219] It should be noted that for the information interaction, execution process, etc. between the above-mentioned devices / units, since they are based on the same concept as the method embodiment of the present application, their specific functions and the technical effects brought about can be specifically referred to in the method embodiment part, and will not be elaborated here.
[0220] Those skilled in the art can clearly understand that, for the convenience and brevity of description, only the above division of each functional unit and module is used as an example. In actual applications, the above functions can be allocated to different functional units and modules according to needs, that is, the internal structure of the device is divided into different functional units or modules to complete all or part of the functions described above. Each functional unit and module in the embodiments can be integrated into a processing unit, or each unit can exist physically alone, or two or more units can be integrated into one unit. The above integrated unit can be implemented in the form of hardware or in the form of a software functional unit. In addition, the specific names of each functional unit and module are only for the convenience of mutual distinction and do not limit the protection scope of this application. The specific working processes of the units and modules in the above system can refer to the corresponding processes in the foregoing method embodiments and will not be elaborated herein.
[0221] An embodiment of this application also provides an electronic device, such as Figure 11 shown. The electronic device 11 includes: at least one processor 111, a memory 112, and a computer program 113 stored in the memory 112 and executable on the at least one processor 111. When the processor 111 executes the computer program 113, the steps in any of the foregoing method embodiments are implemented, or when the processor 111 executes the computer program 113, the functions of each module / unit in the foregoing device embodiments are implemented.
[0222] Exemplarily, the computer program 113 can be divided into one or more modules / units. The one or more modules / units are stored in the memory 112 and executed by the processor 111 to complete this application. The one or more modules / units can be a series of computer program instruction segments capable of completing specific functions, and these instruction segments are used to describe the execution process of the computer program 113 in the electronic device 11.
[0223] Those skilled in the art can understand that Figure 11 merely being examples of the electronic device does not constitute a limitation on the electronic device. It may include more or fewer components than shown in the figure, or combine certain components, or different components. For example, the electronic device may further include input / output devices, network access devices, buses, etc.
[0224] The above-mentioned processor may be a Central Processing Unit (CPU), or other general-purpose processors, Digital Signal Processors (DSPs), Application Specific Integrated Circuits (ASICs), Field-Programmable Gate Arrays (FPGAs), or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components, etc. The general-purpose processor may be a microprocessor or any conventional processor, etc.
[0225] The memory may be an internal storage unit of the electronic device, such as the hard disk or memory of the electronic device. The memory may also be an external storage device of the electronic device, such as a plug-in hard disk, Smart Media Card (SMC), Secure Digital (SD) card, Flash Card, etc. equipped on the electronic device. Further, the memory may also include both the internal storage unit and the external storage device of the electronic device.
[0226] An embodiment of this application also provides a readable storage medium storing a computer program, which when executed by a processor can implement the steps in the above-mentioned method embodiments.
[0227] An embodiment of this application provides a computer program product, which when running on an electronic device enables the electronic device to execute the steps in the above-mentioned method embodiments.
[0228] When the integrated unit is implemented in the form of a software functional unit and sold or used as an independent product, it can be stored in a computer-readable storage medium. Based on this understanding, to implement all or part of the processes in the above method embodiments of this application, a computer program can be used to instruct relevant hardware to complete. The computer program can be stored in a computer-readable storage medium. When the computer program is executed by a processor, the steps of the above method embodiments can be implemented. Among them, the computer program includes computer program code, and the computer program code can be in the form of source code, object code, executable file or some intermediate form, etc. The computer-readable medium can at least include: any entity or device that can carry the computer program code to the photographing device / terminal device, recording medium, computer memory, read-only memory (ROM, Read-Only Memory), random access memory (RAM, Random Access Memory), electrical carrier signal, telecommunication signal, and software distribution medium. For example, a USB flash drive, a mobile hard disk, a magnetic disk, or an optical disc, etc. In some jurisdictions, according to legislation and patent practice, the computer-readable medium may not be an electrical carrier signal and a telecommunication signal.
[0229] In the above embodiments, the descriptions of the respective embodiments have their own focuses. For the parts not detailed or recorded in a certain embodiment, reference can be made to the relevant descriptions of other embodiments.
[0230] Those of ordinary skill in the art can realize that the units and algorithm steps of the examples described in combination with the embodiments disclosed herein can be implemented by electronic hardware, or a combination of computer software and electronic hardware. Whether these functions are executed in a hardware or software manner depends on the specific application and design constraints of the technical solution. Professional technicians can use different methods to implement the described functions for each specific application, but such implementation should not be considered to exceed the scope of this application.
[0231] In the embodiments provided in this application, it should be understood that the disclosed device / equipment and method can be implemented in other ways. For example, the device / equipment embodiments described above are only illustrative. For example, the division of the modules or units is only a logical function division. In actual implementation, there can be other division methods. For example, multiple units or components can be combined or integrated into another system, or some features can be ignored or not executed. Another point is that the displayed or discussed coupling or direct coupling or communication connection to each other can be through some interfaces. The indirect coupling or communication connection of the device or unit can be in an electrical, mechanical or other form.
[0232] The unit described as a separation component may or may not be physically separated. The component displayed as a unit may or may not be a physical unit, that is, it may be located in one place or distributed across multiple network units. Some or all of the units can be selected according to actual needs to achieve the purpose of the solution of this embodiment.
[0233] The above-described embodiments are only used to illustrate the technical solutions of the present application, rather than to limit them; although the present application has been described in detail with reference to the foregoing embodiments, those of ordinary skill in the art should understand that: they can still modify the technical solutions recorded in the foregoing embodiments, or perform equivalent replacements on some of the technical features; and these modifications or replacements do not cause the essence of the corresponding technical solutions to deviate from the spirit and scope of the technical solutions of the various embodiments of the present application, and should all be included within the protection scope of the present application.
Claims
1. A method for adjusting the brightness of a picture based on a face, characterized in that: include: Identify multiple face areas in a target monitoring screen of a monitoring device; Determine the size of each face region and the face brightness value; According to the size of each face area and the face brightness value, a brightness adjustment ratio of the target monitoring screen is determined by solving the brightness of the target face calibrated in advance as the brightness target; The brightness of the monitoring screen of the monitoring device is adjusted according to the brightness parameter of the target monitoring screen and the brightness adjustment ratio.
2. The method for adjusting the brightness of a picture based on a face as claimed in claim 1, characterized in that: The method of solving the problem based on the area size and face brightness value of each face region and taking the pre-calibrated target face brightness as the brightness target to determine the brightness adjustment ratio of the target monitoring screen includes: Determining a weight coefficient of each face region in the target monitoring image according to the area size of each face region; According to the weight coefficients of the plurality of face regions and the face brightness values, the target face brightness is taken as the brightness target for solving, and the brightness adjustment ratio of the target monitoring image is determined.
3. The method for adjusting the brightness of a picture based on a face as claimed in claim 2, characterized in that: The weight coefficient includes an area weight and a brightness weight. The weight coefficient of the face area in the target monitoring screen is determined according to the area size of each face area, including: Determine irrecoverable pixels in each of the face regions, the irrecoverable pixels being pixels whose pixel values exceed a preset pixel range; Determining the brightness weight of each of the face regions according to the unrecoverable pixels in each of the face regions; The area weight of each of the face regions is determined according to the ratio of the area size of each of the face regions to the area size of the target monitoring screen.
4. The method for adjusting the brightness of a picture based on a face as claimed in claim 2, characterized in that: The weight coefficient includes an area weight and a brightness weight. The brightness adjustment ratio of the target monitoring screen is determined by solving the target face brightness as the brightness target based on the weight coefficients of the plurality of face areas and the face brightness value, including: According to the brightness weight of the face area and the face brightness value, predict the face brightness after adjusting the picture brightness with a preset ratio parameter to obtain the face predicted brightness of the face area; Determine the difference between the predicted brightness of the face area and the target face brightness as the predicted brightness difference of the face area; Performing a weighted sum calculation based on the area weight of each face region and the predicted brightness difference to determine a weighted sum of brightness distances between the plurality of face regions and the target face brightness; With the goal of minimizing the weighted sum of the brightness distance, the preset ratio parameter is solved to obtain the brightness adjustment ratio of the target monitoring picture.
5. The method for adjusting image brightness based on face according to any one of claims 1 to 4, characterized in that: The brightness parameter includes an exposure amount and a gamma brightness curve, and adjusting the brightness of the monitoring screen of the monitoring device according to the brightness parameter of the target monitoring screen and the brightness adjustment ratio includes: When the gain value of the target monitoring picture is less than the first gain threshold, adjusting the exposure of the monitoring picture of the monitoring device according to the brightness adjustment ratio; When the gain value of the target monitoring picture is greater than the second gain threshold, the gamma brightness curve of the monitoring picture of the monitoring device is adjusted according to the brightness adjustment ratio.
6. The method for adjusting image brightness based on face according to any one of claims 1 to 4, characterized in that: The brightness parameter includes an exposure amount and a gamma brightness curve, and adjusting the brightness of the monitoring screen of the monitoring device according to the brightness parameter of the target monitoring screen and the brightness adjustment ratio includes: When the gain value of the target monitoring picture is greater than or equal to the first gain threshold and less than or equal to the second gain threshold, determining the exposure adjustment ratio and the adjustment ratio of the gamma brightness curve according to the gain value of the target monitoring picture and the brightness adjustment ratio; The exposure of the monitoring screen of the monitoring device is adjusted according to the exposure adjustment ratio, and the gamma brightness curve of the monitoring screen of the monitoring device is adjusted according to the adjustment ratio of the gamma brightness curve.
7. A device for adjusting picture brightness, characterized in that: include: A face recognition module is used to identify multiple face areas in the target monitoring screen of the monitoring device; A first determination module is used to determine the area size and face brightness value of each face region; The second determination module is used to determine the brightness adjustment ratio of the target monitoring screen according to the area size and face brightness value of each face area and the pre-calibrated target face brightness as the brightness target; The brightness adjustment module is used to adjust the brightness of the monitoring screen of the monitoring device according to the brightness parameter of the target monitoring screen and the brightness adjustment ratio.
8. An electronic device comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, characterized in that: When the processor executes the computer program, the steps of the method for adjusting picture brightness based on face as claimed in any one of claims 1 to 6 are implemented.
9. A readable storage medium storing a computer program, characterized in that: When the computer program is executed by a processor, the steps of the method for adjusting picture brightness based on face as claimed in any one of claims 1 to 6 are implemented.
10. A computer program product, characterized in that The computer program product comprises a computer program, and when the computer program is executed, the method for adjusting picture brightness based on face as claimed in any one of claims 1 to 6 is executed.