Image brightness adjustment method and device, computer equipment and storage medium
By determining the label area and color sub-area in the image, calculating the ambient brightness and adjusting the brightness of the whole image, it solves the problem of uneven automatic exposure of traditional shooting equipment when shooting whiteboards or blackboards, and improves the visual effect and ease of operation of the image.
Patent Information
- Application Number
- CN202310292317.6
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2023-03-23
- Publication Date
- 2024-09-24
AI Technical Summary
When traditional shooting equipment shoots whiteboards or blackboards, the brightness of different areas of the image is inconsistent after automatic exposure, resulting in poor visual effects and the need to manually adjust the exposure value, making the operation cumbersome.
By determining the label area in the target image, dividing the color sub-areas, calculating the ambient brightness, determining the brightness offset value based on the ambient brightness and the full image brightness, and adjusting the full image brightness of the image to achieve appropriate exposure in different areas.
It achieves appropriate exposure of different areas of the image when shooting whiteboards or blackboards, improves visual effects, simplifies brightness adjustment operations, and reduces the need for manual adjustments.
Smart Images

Figure CN118694873A
Abstract
Description
Technical Field
[0001] The present application relates to the field of image processing technology, and in particular to a method, device, computer equipment, storage medium and computer program product for adjusting image brightness. Background Art
[0002] Traditional shooting equipment generally uses automatic white balance algorithms or post-production brightness adjustment to adjust the overall brightness of the image, and there is a problem of "white plus black minus", that is, after automatic exposure of a pure white scene, the exposure value needs to be manually increased later, and after automatic exposure of a pure black scene, the exposure value needs to be manually reduced later to obtain a correctly exposed image.
[0003] When photographing objects such as whiteboards or blackboards that have text and are mostly black or white, if a general exposure strategy is used for the photographed image, different areas of the exposed image will show different brightness, resulting in poor visual effects. It is generally necessary to adjust the brightness of different areas of the image through video software, which is also cumbersome to operate. Summary of the invention
[0004] Based on this, it is necessary to provide an image brightness adjustment method, device, computer equipment, computer-readable storage medium and computer program product to address the above-mentioned technical problems, which can ensure that the captured image has appropriate exposure in different areas and has a better visual effect when shooting objects such as whiteboards or blackboards.
[0005] In a first aspect, the present application provides a method for adjusting the brightness of an image. The method comprises:
[0006] Determine the label region in the target image;
[0007] Determine the brightness of the color sub-regions divided by the color of the label region, and convert the brightness of each color sub-region into the ambient brightness;
[0008] Determining the full image brightness of the target image;
[0009] A brightness offset value of the target image is determined based on the ambient brightness and the full-image brightness, and the full-image brightness of the target image is adjusted according to the brightness offset value.
[0010] In one embodiment, the color sub-region includes a monochrome sub-region; and converting the brightness of each color sub-region into the ambient brightness includes:
[0011] The brightness of each of the monochrome sub-regions is counted respectively to obtain the monochrome brightness of the label corresponding to each of the monochrome sub-regions;
[0012] Determine the label monochrome weight between the label monochrome brightness;
[0013] The monochrome brightness of each tag is weighted according to the monochrome weight of the tag to obtain the ambient brightness.
[0014] In one embodiment, the color sub-region includes a black sub-region and a white sub-region;
[0015] The counting of the brightness of each of the monochrome sub-regions to obtain the monochrome brightness of the label corresponding to each of the monochrome sub-regions includes:
[0016] In the label area, averaging is performed on the brightness of each black sub-area to obtain a brightness average of the black sub-areas in the label area;
[0017] In the label area, averaging is performed on the brightness of each of the white sub-areas to obtain a brightness average of the white sub-areas in the label area;
[0018] The weighted processing of the monochrome brightness of each tag according to the monochrome weight of the tag includes:
[0019] According to the label monochrome weight between the black sub-region and the white sub-region, weighted processing is performed on the average brightness value of the black sub-region and the average brightness value of the white sub-region.
[0020] In one embodiment, determining the full image brightness of the target image includes:
[0021] Determine the brightness of each pixel in the target image;
[0022] The overall brightness of the target image is determined according to the brightness of each pixel.
[0023] In one embodiment, determining the brightness offset value of the target image based on the ambient brightness and the full image brightness includes:
[0024] Calculating the brightness ratio of the ambient brightness to the full image brightness;
[0025] Determining a brightness ratio adjustment coefficient based on a shooting environment of the target image;
[0026] In one embodiment, determining the label area in the target image includes:
[0027] Acquire a target image containing a target object;
[0028] Determine the coordinates of each label of the target object in the target image;
[0029] A label area of a preset label shape is determined at the label coordinates.
[0030] In one of the embodiments, before determining the label area in the target image, the method further includes:
[0031] Get the initial image;
[0032] Identifying a positioning tag in the initial image;
[0033] Determine the target area in the initial image according to the positioning tag;
[0034] The image in the target area is corrected into a preset shape to obtain a target image.
[0035] In a second aspect, the present application also provides a device for adjusting the brightness of an image. The device comprises:
[0036] A label region acquisition module, used to determine the label region in the target image;
[0037] A label color brightness determination module, used to determine the brightness of the color sub-regions divided by the label area according to the color, and convert the brightness of each color sub-region into the ambient brightness;
[0038] A full-image brightness determination module, used to determine the full-image brightness of the target image;
[0039] The brightness adjustment module is used to determine the brightness offset value of the target image based on the ambient brightness and the full image brightness, and adjust the full image brightness of the target image according to the brightness offset value.
[0040] In a third aspect, the present application further provides a computer device, wherein the computer device comprises a memory and a processor, wherein the memory stores a computer program, and when the processor executes the computer program, the steps of adjusting the brightness of the image in any of the above embodiments are implemented.
[0041] In a fourth aspect, the present application further provides a computer-readable storage medium having a computer program stored thereon, and when the computer program is executed by a processor, the steps of adjusting the brightness of the image in any of the above embodiments are implemented.
[0042] In a fifth aspect, the present application further provides a computer program product, which includes a computer program, and when the computer program is executed by a processor, the steps of adjusting the brightness of the image in any of the above embodiments are implemented.
[0043] The above-mentioned image brightness adjustment method, device, computer equipment, storage medium and computer program product determine label areas at different positions in the target image; determine color sub-areas divided by color in the label area, and convert the brightness of each color sub-area into ambient brightness; since the label areas are distributed at different positions of the target image, the brightness of each position in the target image can be determined by the label area, so as to accurately calculate the ambient brightness and accurately reflect the actual brightness of the shooting environment; determine the full-image brightness of the target image; determine the brightness offset value of the target image based on the ambient brightness and the full-image brightness, and adjust the full-image brightness of the target image according to the brightness offset value, so as to adjust the full-image brightness to the ambient brightness through the brightness offset value, thereby reducing the brightness difference between the full-image brightness and the actual shooting scene, and then making the full-image brightness closer to the brightness of the actual shooting scene, achieving a better visual effect. BRIEF DESCRIPTION OF THE DRAWINGS
[0044] Figure 1 A diagram showing an application environment of a method for adjusting image brightness in one embodiment;
[0045] Figure 2 is a schematic flow chart of a method for adjusting image brightness in one embodiment;
[0046] Figure 3 A schematic diagram of an initial image in one embodiment;
[0047] Figure 4 is a schematic diagram of a target image in one embodiment;
[0048] Figure 5 This is a schematic diagram of the effect of a whiteboard scene in one embodiment;
[0049] Figure 6 A schematic diagram of the effect of a blackboard scene in one embodiment;
[0050] Figure 7 is a structural block diagram of a device for adjusting image brightness in one embodiment;
[0051] Figure 8 FIG. 4 is a diagram showing the internal structure of a computer device in one embodiment. DETAILED DESCRIPTION
[0052] In order to make the purpose, technical solution and advantages of the present application more clearly understood, the present application is further described in detail below in conjunction with the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are only used to explain the present application and are not used to limit the present application.
[0053] The image brightness adjustment method provided in the embodiment of the present application can be applied to a single terminal or to a Figure 1In the application environment shown. Among them, the terminal 102 communicates with the server 104 through the network. The data storage system can store the data that the server 104 needs to process. The data storage system can be integrated on the server 104, or it can be placed on the cloud or other network servers. The server 104 can be implemented with an independent server or a server cluster composed of multiple servers. This solution can be implemented based on the terminal 102, it can also be implemented based on the server 104, and it can also be implemented through the interaction between the terminal 102 and the server 104.
[0054] The terminals may be, but are not limited to, various cameras, panoramic cameras, sports cameras, personal computers, laptops, smart phones, tablet computers, IoT devices and portable wearable devices. IoT devices may be smart speakers, smart TVs, smart air conditioners, smart car-mounted devices, etc. Portable wearable devices may be smart watches, smart bracelets, head-mounted devices, etc.
[0055] In one embodiment, Figure 2 As shown, a method for adjusting the brightness of an image is provided, and the method is applied to Figure 1 Taking the server 104 in the example as an example, the following steps are included:
[0056] Step 202: determine a label region in the target image.
[0057] The target image is acquired for the target object with the tag installed; and the tag of the target object is in the tag area in the target image. Optionally, the tag areas are distributed in different positions of the target image, and the brightness of each position in the target image can be determined by the tag area. The brightness of each position is comprehensively calculated according to the propagation law of light, and the ambient brightness can be estimated more accurately. The tag area can be identified and located by the target detection algorithm. Optionally, the tag area can be located by identifying tags of preset shapes, colors or other features through the target detection model, the tag area can be located by searching for tags through preset templates, and the tag area can be located by feature point extraction or semantic information extraction.
[0058] In one feasible embodiment, determining label areas at different positions in a target image includes: obtaining a preset label shape and label distribution information of a target object in the target image; mapping the label position in the target image according to the label distribution information, and determining a label area of a preset label shape at the label position. Exemplarily, the target object is a writing board in a whiteboard or a blackboard, the preset label shape is the shape of a sticker on the writing board, and the label distribution information is obtained by identifying label features such as shape features, color features, structural features, and semantic features in the label based on a label detection model.
[0059] In one embodiment, determining a label area in a target image includes: acquiring a target image containing a target object; determining each label coordinate of the target object in the target image; and determining a label area of a preset label shape at the label coordinates.
[0060] Optionally, each label coordinate of the target object is detected in a preset corner position area, and the label coordinates and the label area at each label coordinate can be identified by a label-based detection model, which is trained according to the shape of the preset label area. Optionally, the target image is a whiteboard image captured by a camera in whiteboard mode, the target object is a whiteboard, and the preset label shape is defined according to the label position in the whiteboard.
[0061] In a feasible embodiment, determining the label coordinates of the target object in the target image includes: detecting the corner points of the whiteboard image according to the preset shapes for indicating the corner points, and obtaining the label coordinates of the target object in the target image. Exemplarily, the upper left corner position of the whiteboard image is detected according to the preset shape for indicating the upper left corner, and the label coordinates of the upper left corner in the target image are obtained; the lower right corner position of the whiteboard image is detected according to the preset shape for indicating the lower right corner, and the label coordinates of the lower right corner in the target image are obtained.
[0062] In a feasible embodiment, determining label areas at different positions in a target image includes: acquiring a whiteboard image obtained by capturing a whiteboard; determining label coordinates of the whiteboard in the whiteboard image; and determining a label area of a preset label shape at the label coordinates.
[0063] Therefore, by detecting the label coordinates of the target object and then determining the preset label shape of each label area according to the label coordinate position, it is less likely to have label misdetection and the label area can be determined in the target image more efficiently.
[0064] Step 204 , determining the color sub-regions into which the label region is divided according to color, and converting the brightness of each color sub-region into the ambient brightness.
[0065] The color sub-regions are divided according to the different colors of the label region, and different color sub-regions have different colors. The distribution of color sub-regions is not limited to whether the color sub-regions are connected. The same color sub-region can be distributed in different label regions or the same label region, and different color sub-regions can also be distributed in different label regions or the same label region. If a color sub-region includes only one color, the color sub-region is a monochrome sub-region; if a color sub-region includes a combination of at least two colors, the color sub-region is a multi-color sub-region. The brightness of the color sub-region is obtained based on the statistics of the brightness of the pixels in the color sub-region. The brightness in the color sub-region can be counted or otherwise processed according to the area of the color sub-region. Exemplarily, the brightness of the color sub-region can be the mean value of the brightness of each pixel in the color sub-region.
[0066] The ambient brightness is the sum of the brightness of the color sub-regions in the label region, which is the estimated brightness of each part of the target object in the shooting environment. Compared with the full image brightness of the target image, the ambient brightness of this embodiment more accurately reflects the actual brightness of the target object in the shooting environment.
[0067] The ambient brightness of this embodiment more accurately reflects the actual brightness of the target object in the shooting environment for the following reasons: according to the law of rectilinear propagation of light, since the label positions are distributed at different positions of the whiteboard, when light shines on a certain whiteboard, its different positions have their own exposure degrees, and therefore, the label areas at different positions can better reflect the actual brightness of the whiteboard; secondly, according to the law of reflection of light and the law of independent propagation, the reflectivity of different colors on the same object is different, and therefore the dimension of ambient brightness calculation is increased through the label area to reflect the actual brightness by increasing the dimension; in addition, according to the law of reflection of light and the law of independent propagation, the ambient brightness can be calculated based on the brightness reflected by the blackboard or whiteboard itself, and this solution can be seamlessly connected with this solution through weighted processing or other methods.
[0068] In one embodiment, determining the color sub-regions into which the label region is divided by color includes: determining the color of each pixel in the label region; dividing the pixels of the same color into the same color sub-region. For example, black pixels and white pixels may be determined according to the color channel value of each pixel; the black pixels are divided into the black sub-region, and the white pixels are divided into the white sub-region.
[0069] In one embodiment, converting the brightness of each color sub-region into the ambient brightness includes: counting the brightness of each color sub-region, determining the color sub-region weights between the color sub-regions, and fusing the brightness of each color sub-region according to the color sub-region weights to obtain the estimated ambient brightness.
[0070] In one embodiment, the color sub-region includes a monochrome sub-region. The monochrome sub-region has one color, and the color may be slightly different due to brightness, but the color change is within a preset range. Since each label region is similar to each point in the target image, the monochrome sub-regions in the label region at the same position have relatively close brightness, and the monochrome sub-regions in the label regions at different positions are relatively less affected by brightness.
[0071] The brightness of each color sub-region is converted into the ambient brightness, including: counting the brightness of each monochrome sub-region respectively to obtain the label monochrome brightness corresponding to each monochrome sub-region; determining the label monochrome weight between each label monochrome brightness; weighting the label monochrome brightness according to the label monochrome weight to obtain the ambient brightness.
[0072] The label monochrome weight may be a preset weight, and each monochrome sub-region has its own label monochrome weight. Optionally, the label monochrome weight may be recorded in a server or terminal through a weight table to improve data call efficiency, or may be stored in other forms.
[0073] In a feasible embodiment, determining the label monochrome weights between the monochrome brightnesses of each label includes: pairing the colors of the respective label monochrome sub-regions into color pairs; searching for the label monochrome weights of each color pair from a database in a server or terminal according to each color pair; and determining the label monochrome weights of each color pair as the label monochrome weights between the monochrome brightnesses of each label.
[0074] Since the color sub-region is a monochrome sub-region, the statistical process of the brightness of the pixels in each color sub-region improves the data processing efficiency, and the brightness between different color sub-regions is weighted by the label monochrome weight between each label monochrome brightness, so that the calculated ambient brightness can be closer to the actual shooting environment.
[0075] In a specific embodiment, the color sub-region includes a black sub-region and a white sub-region. The black sub-region is a label sub-region whose pixel brightness is within the range of black pixels, and the white sub-region is a label sub-region whose pixel brightness is within the range of white pixels. Exemplarily, the label region is binarized to obtain the black sub-region and the white sub-region.
[0076] The brightness of each monochrome sub-region is counted respectively to obtain the monochrome brightness of the label corresponding to each monochrome sub-region, including: in the label region, the brightness of each black sub-region is averaged to obtain the average brightness of the black sub-region of the label region; in the label region, the brightness of each white sub-region is averaged to obtain the average brightness of the white sub-region of the label region.
[0077] Correspondingly, weighted processing is performed on the monochrome brightness of each label according to the monochrome weight of the label, including: weighted processing is performed on the brightness mean of the black sub-region and the brightness mean of the white sub-region according to the monochrome weight of the label between the black sub-region and the white sub-region.
[0078] In an optional embodiment, in the label area, the brightness of each black sub-area is averaged to obtain the average brightness of the black sub-area of the label area, including: determining the black pixels in each black sub-area; determining the brightness of each black pixel, and accumulating the brightness of each black pixel as the brightness accumulation value of the black sub-area; calculating the ratio between the brightness accumulation value and the number of each black pixel to obtain the average brightness of the black sub-area of the label area.
[0079] In an optional embodiment, in the label area, the brightness of each white sub-area is averaged to obtain the average brightness of the white sub-area of the label area, including: determining the white pixels in each white sub-area; determining the brightness of each white pixel, and adding up the brightness of each white pixel as the brightness accumulation value of the white sub-area; calculating the ratio between the brightness accumulation value and the number of each white pixel to obtain the average brightness of the white sub-area of the label area.
[0080] The black sub-area and the white sub-area have a large difference in reflectivity, which has a high contrast on the target image, so that the calculated ambient brightness is closer to the real brightness of the actual shooting scene, providing more accurate reference information for adjusting the brightness of the entire image.
[0081] Step 206, determining the overall brightness of the target image.
[0082] The full image brightness is the brightness of each region of the target image. The full image brightness includes image regions of various types, including at least two types of image regions, namely, label regions and non-label regions, and may also include other types of image regions. The calculation methods of the full image brightness include the mean method, the histogram method and other strategies, each of which has its own advantages and disadvantages.
[0083] In one embodiment, determining the overall brightness of the target image includes: determining the brightness of each pixel in the target image; and performing averaging processing based on the brightness of each pixel to determine the overall brightness of the target image.
[0084] In an optional embodiment, in a target image, determining the brightness of each pixel includes: determining the color space of the target image; if the color space of the target image belongs to an RGB color space, converting the color channel value of each pixel into a brightness value of each pixel; if the color space of the target image belongs to a LAB color space or a YUV color space, using the brightness channel value of each pixel as the brightness of each pixel.
[0085] In an optional embodiment, the brightness of each pixel is averaged, including: adding the brightness of each pixel as a whole-image pixel accumulation value, and determining the number of pixels in the target image; calculating the ratio of the whole-image pixel accumulation value to the number of pixels, and using the ratio as the whole-image brightness of the target image.
[0086] In the process of determining the brightness of each pixel and performing averaging processing, less calculation is involved, which is more suitable for real-time full-image brightness calculation of shooting equipment with limited data processing capabilities. Although the full-image brightness calculated in this way is offset from the brightness of the actual scene, it can be corrected by the ambient brightness.
[0087] Step 208: determining a brightness offset value of the target image based on the ambient brightness and the full-image brightness, and adjusting the full-image brightness of the target image according to the brightness offset value.
[0088] The brightness offset value is the difference between the full image brightness and the expected ambient brightness, and the difference is used to adjust the full image brightness to match the ambient brightness. Optionally, the brightness offset value can be calculated by the ratio, difference or other methods between the expected ambient brightness and the full image brightness.
[0089] Among them, the ratio between the estimated ambient brightness and the full image brightness can be directly used as the brightness offset value of the target image to reduce the occupation of data resources and improve the calculation efficiency of the brightness offset value. The ratio between the ambient brightness and the full image brightness can also be adjusted based on other factors to reduce the brightness difference between the ambient brightness and the actual shooting scene, thereby making the full image brightness closer to the brightness of the actual shooting scene.
[0090] In one embodiment, the brightness offset value of the target image is determined based on the ambient brightness and the full image brightness, including: calculating the brightness ratio of the ambient brightness and the full image brightness; determining a brightness ratio adjustment coefficient based on the shooting environment of the target image; and adjusting the brightness ratio according to the brightness ratio adjustment coefficient to obtain a brightness offset value.
[0091] The shooting environment of the target image may have multiple granularities. At a certain granularity, the shooting environment is used to determine whether the shooting environment is a whiteboard or a blackboard; at another granularity, the shooting environment is used to determine whether the shooting environment is a whiteboard or a blackboard shot under a certain light level.
[0092] Since the brightness ratio adjustment coefficient is determined according to the shooting environment of the target image, and the brightness ratio adjustment coefficient can be obtained based on multiple experiments or debugging, the brightness offset value is more suitable for a specific shooting scene, thereby achieving a better adjustment effect on the brightness of the entire image.
[0093] In the brightness adjustment method of the above-mentioned image, label areas are determined at different positions in the target image; color sub-areas divided by the label areas according to colors are determined, and the brightness of each color sub-area is converted into the ambient brightness; since the label areas are distributed at different positions in the target image, the brightness of each position in the target image can be determined by the label areas, so as to accurately calculate the ambient brightness and accurately reflect the actual brightness of the shooting environment; the full image brightness of the target image is determined; the brightness offset value of the target image is determined based on the ambient brightness and the full image brightness, and the full image brightness of the target image is adjusted according to the brightness offset value. The brightness offset value is the difference between the full image brightness and the ambient brightness, and the difference can be used to characterize the data of the full image brightness adjusted to the ambient brightness to reduce the brightness difference between the ambient brightness and the actual shooting scene, thereby making the full image brightness closer to the brightness of the actual shooting scene.
[0094] In one embodiment, before determining the label area at different positions in the target image, the method further includes: acquiring an initial image; identifying a positioning label in the initial image; determining the target area in the initial image according to the positioning label; and correcting the image in the target area to a preset shape to obtain the target image. Figure 3 As shown, the target image is Figure 4 shown.
[0095] In an optional embodiment, determining the target area in the initial image based on the positioning tags in the initial image includes: performing positioning tag detection on the initial image to obtain the position of the positioning tags in the initial image and the orientation represented by the positioning tags; if the positioning tags in the initial image are a preset number of tags, connecting the positioning tags to obtain the target area of the positioning tags; if the positioning tags in the initial image are less than the preset number of tags, adjusting the acquisition parameters of the shooting device according to the orientation represented by the positioning tags; re-capturing the image according to the adjusted acquisition parameters, and performing positioning tag detection on the re-captured image. Wherein, the positioning tag is a tag with orientation indication, which is pre-set as a component at a certain position of the target object and is used to determine the target area of a preset shape.
[0096] Therefore, the focal length, shooting angle and other acquisition parameters of the shooting device are adjusted based on the positioning tags to recapture the image, and the positioning tags are detected on the recaptured image, so that the number of tags in the initial image exceeds the preset number of tags.
[0097] In an optional example, the image in the target area is corrected to a preset shape to obtain the target image, including: generating a corresponding perspective change matrix according to the corner point positions of the preset shape; correcting the target area according to the perspective change matrix to obtain the corrected target image. The corner point positions of the preset shape are a plurality of pre-set non-collinear positions, and these positions are calculated according to the projection to obtain the perspective change matrix; and then in the initial image, the positions of each positioning tag are calculated according to the perspective change matrix to achieve the correction of the target area.
[0098] Since the image is collected for the target object with the positioning tag installed, the position of the target object in the initial image can be determined by the positioning tag; the target area in the initial image is then determined based on the positioning tag in the initial image; and the image in the target area is corrected to a preset shape. In the process of determining the target area based on the positioning tag, the possibility of misidentification is reduced without the need for edge detection algorithm, the accuracy is high, and the target area is corrected.
[0099] The normal automatic exposure strategy is to calculate the average brightness of the entire screen, and then adjust the ISO, shutter, and aperture to make the average brightness of the screen suitable for human eyes. If the entire screen is white, the average brightness calculated by the conventional AE algorithm is higher when calculating the brightness of the screen, so the automatic exposure will tend to darken the screen, resulting in a dark whiteboard problem, which is particularly obvious in whiteboard mode.
[0100] Whiteboard mode is a shooting mode in cameras such as Insta360 Link. Its function is to make the image of a specific area (such as a whiteboard, blackboard, or display) fill the camera frame. In this mode, if you use the traditional exposure strategy, when performing automatic exposure under a whiteboard or blackboard, you need to manually increase the EV for automatic exposure in the whiteboard scene and manually decrease the EV for automatic exposure in the blackboard scene to obtain a correctly exposed image.
[0101] In an exemplary embodiment, the label monochrome weight between the black sub-region and the white sub-region includes the brightness weight of the black sub-region and the brightness weight of the white sub-region; step 204 specifically includes: determining that the shooting device is in whiteboard mode, controlling the shooting device to determine the position coordinates of the four label regions in the target image, obtaining the brightness of the black sub-region and the white sub-region according to the coordinate position, and performing brightness statistics respectively, and performing weighted calculation on the brightness of the black and white sub-regions according to the brightness weight of the black sub-region and the brightness weight of the white sub-region to obtain the brightness Y1 obtained by the label region statistics, and the brightness Y1 is the expected ambient brightness.
[0102] Specifically, α is the brightness weight of the white sub-region, (1-α) is the brightness weight of the black sub-region, and it is assumed that the brightness of the four white sub-regions is W1, W2, W3, W4; the brightness of the four black sub-regions is B1, B2, B3, B4. Then the average brightness of the white sub-region W = (W1+W2+W3+W4) / 4; the average brightness of the black sub-region B = (B1+B2+B3+B4) / 4; Y1 = αW+(1-α)B. Therefore, by calculating the average value of the label area at the four positions, the reliability of the estimated ambient brightness can be made higher.
[0103] Step 206 specifically includes: Y2 is the statistical brightness of the target image according to the AE algorithm, wherein Y2 is the average brightness of all pixels in the entire screen of the target image.
[0104] Step 208 includes: based on the ratio of Y1 / Y2, offsetting the actual target brightness calculated by the current AE, and the offset value needs to be adjusted based on the actual picture performance of the shooting environment.
[0105] Therefore, after debugging is completed, the AE algorithm can expose the whiteboard and blackboard scenes according to the brightness close to the actual scene, so that the camera can accurately expose the picture brightness to make the picture look appropriate regardless of whether it is facing the blackboard or the whiteboard. When the picture is a whiteboard scene, the automatic exposure is particularly dark. Traditional methods such as Figure 5 As shown in (1), the effect of this embodiment is as follows Figure 5 (2) When the picture is a blackboard scene, the automatic exposure is particularly bright. Figure 6 As shown in (1), the effect of this embodiment is as follows Figure 6 (2) as shown.
[0106] It should be understood that, although the various steps in the flowcharts involved in the above-mentioned embodiments are displayed in sequence according to the indication of the arrows, these steps are not necessarily executed in sequence according to the order indicated by the arrows. Unless there is a clear explanation in this article, the execution of these steps is not strictly limited in order, and these steps can be executed in other orders. Moreover, at least a part of the steps in the flowcharts involved in the above-mentioned embodiments can include multiple steps or multiple stages, and these steps or stages are not necessarily executed at the same time, but can be executed at different times, and the execution order of these steps or stages is not necessarily carried out in sequence, but can be executed in turn or alternately with other steps or at least a part of the steps or stages in other steps.
[0107] Based on the same inventive concept, the embodiment of the present application also provides an image brightness adjustment device for implementing the above-mentioned image brightness adjustment method. The implementation scheme for solving the problem provided by the device is similar to the implementation scheme recorded in the above-mentioned method, so the specific limitations in the embodiments of the brightness adjustment device for one or more images provided below can refer to the limitations of the image brightness adjustment method above, and will not be repeated here.
[0108] In one embodiment, Figure 7 As shown, a device for adjusting the brightness of an image is provided, comprising:
[0109] The label region acquisition module 702 is used to determine the label region in the target image;
[0110] The label color brightness determination module 704 is used to determine the brightness of the color sub-regions divided by the label region according to the color, and convert the brightness of each color sub-region into the ambient brightness;
[0111] A full image brightness determination module 706, used to determine the full image brightness of the target image;
[0112] The brightness adjustment module 708 is used to determine a brightness offset value of the target image based on the ambient brightness and the full image brightness, and adjust the full image brightness of the target image according to the brightness offset value.
[0113] In one embodiment, the color sub-region includes a monochrome sub-region; the label color brightness determination module 704 is used to:
[0114] The brightness of each of the monochrome sub-regions is counted respectively to obtain the monochrome brightness of the label corresponding to each of the monochrome sub-regions;
[0115] Determine the label monochrome weight between the label monochrome brightness;
[0116] The monochrome brightness of each tag is weighted according to the monochrome weight of the tag to obtain the ambient brightness.
[0117] In one embodiment, the color sub-region includes a black sub-region and a white sub-region;
[0118] The label color brightness determination module 704 is used to:
[0119] In the label area, averaging is performed on the brightness of each black sub-area to obtain a brightness average of the black sub-areas in the label area;
[0120] In the label area, averaging is performed on the brightness of each of the white sub-areas to obtain a brightness average of the white sub-areas in the label area;
[0121] The label color brightness determination module 704 is used to:
[0122] According to the label monochrome weight between the black sub-region and the white sub-region, weighted processing is performed on the average brightness value of the black sub-region and the average brightness value of the white sub-region.
[0123] In one embodiment, the full image brightness determination module 706 is used to:
[0124] Determine the brightness of each pixel in the target image;
[0125] The overall brightness of the target image is determined according to the brightness of each pixel.
[0126] In one embodiment, the brightness adjustment module 708 is used to:
[0127] Calculating the brightness ratio of the ambient brightness to the full image brightness;
[0128] Determining a brightness ratio adjustment coefficient based on a shooting environment of the target image;
[0129] In one embodiment, the label area acquisition module 702 is used to:
[0130] Acquire a target image containing a target object;
[0131] Determine the coordinates of each label of the target object in the target image;
[0132] A label area of a preset label shape is determined at the label coordinates.
[0133] In one embodiment, the brightness adjustment device further includes a target image acquisition module, and the target image acquisition module is used to:
[0134] Get the initial image;
[0135] Identifying a positioning tag in the initial image;
[0136] Determine the target area in the initial image according to the positioning tag;
[0137] The image in the target area is corrected into a preset shape to obtain a target image.
[0138] Each module in the above-mentioned image brightness adjustment device can be implemented in whole or in part by software, hardware or a combination thereof. Each module can be embedded in or independent of a processor in a computer device in the form of hardware, or can be stored in a memory in a computer device in the form of software, so that the processor can call and execute operations corresponding to each module above.
[0139] In one embodiment, a computer device is provided. The computer device may be a terminal, and its internal structure diagram may be as follows: Figure 8 As shown. The computer device includes a processor, a memory, an input / output interface, a communication interface, a display unit and an input device. The processor, the memory and the input / output interface are connected via a system bus, and the communication interface, the display unit and the input device are connected to the system bus via the input / output interface. The processor of the computer device is used to provide computing and control capabilities. The memory of the computer device includes a non-volatile storage medium and an internal memory. The non-volatile storage medium stores an operating system and a computer program. The internal memory provides an environment for the operation of the operating system and the computer program in the non-volatile storage medium. The input / output interface of the computer device is used to exchange information between the processor and an external device. The communication interface of the computer device is used to communicate with an external terminal in a wired or wireless manner, and the wireless manner can be implemented through WIFI, a mobile cellular network, NFC (near field communication) or other technologies. When the computer program is executed by the processor, a method for adjusting the brightness of an image is implemented. The display unit of the computer device is used to form a visually visible image, and can be a display screen, a projection device or a virtual reality imaging device. The display screen can be a liquid crystal display screen or an electronic ink display screen. The input device of the computer device can be a touch layer covered on the display screen, or a button, trackball or touchpad set on the computer device casing, or an external keyboard, touchpad or mouse, etc.
[0140] Those skilled in the art will understand that Figure 8 The structure shown in the figure is only a block diagram of a part of the structure related to the solution of the present application, and does not constitute a limitation on the computer device to which the solution of the present application is applied. The specific computer device may include more or fewer components than those shown in the figure, or combine certain components, or have a different arrangement of components.
[0141] In one embodiment, a computer device is further provided, including a memory and a processor, wherein a computer program is stored in the memory, and the processor implements the steps in the above method embodiments when executing the computer program.
[0142] In one embodiment, a computer-readable storage medium is provided, on which a computer program is stored. When the computer program is executed by a processor, the steps in the above-mentioned method embodiments are implemented.
[0143] In one embodiment, a computer program product is provided, including a computer program, which implements the steps in the above method embodiments when executed by a processor.
[0144] It should be noted that the user information (including but not limited to user device information, user personal information, etc.) and data (including but not limited to data used for analysis, stored data, displayed data, etc.) involved in this application are all information and data authorized by the user or fully authorized by all parties, and the collection, use and processing of relevant data must comply with relevant laws, regulations and standards of relevant countries and regions.
[0145] Those skilled in the art can understand that all or part of the processes in the above-mentioned embodiment methods can be completed by instructing the relevant hardware through a computer program, and the computer program can be stored in a non-volatile computer-readable storage medium. When the computer program is executed, it can include the processes of the embodiments of the above-mentioned methods. Among them, any reference to the memory, database or other medium used in the embodiments provided in the present application can include at least one of non-volatile and volatile memory. Non-volatile memory can include read-only memory (ROM), magnetic tape, floppy disk, flash memory, optical memory, high-density embedded non-volatile memory, resistive random access memory (ReRAM), magnetoresistive random access memory (MRAM), ferroelectric random access memory (FRAM), phase change memory (PCM), graphene memory, etc. Volatile memory can include random access memory (RAM) or external cache memory, etc. As an illustration and not limitation, RAM can be in various forms, such as static random access memory (SRAM) or dynamic random access memory (DRAM). The database involved in each embodiment provided in this application may include at least one of a relational database and a non-relational database. Non-relational databases may include distributed databases based on blockchains, etc., but are not limited to this. The processor involved in each embodiment provided in this application may be a general-purpose processor, a central processing unit, a graphics processor, a digital signal processor, a programmable logic device, a data processing logic device based on quantum computing, etc., but are not limited to this.
[0146] The technical features of the above embodiments may be combined arbitrarily. To make the description concise, not all possible combinations of the technical features in the above embodiments are described. However, as long as there is no contradiction in the combination of these technical features, they should be considered to be within the scope of this specification.
[0147] The above-described embodiments only express several implementation methods of the present application, and the descriptions thereof are relatively specific and detailed, but they cannot be understood as limiting the scope of the present application. It should be pointed out that, for a person of ordinary skill in the art, several variations and improvements can be made without departing from the concept of the present application, and these all belong to the protection scope of the present application. Therefore, the protection scope of the present application shall be subject to the attached claims.
Claims
1. A method for adjusting the brightness of an image, characterized in that: The method comprises: Determine the label region in the target image; Determine the brightness of the color sub-regions divided by the color of the label region, and convert the brightness of each color sub-region into the ambient brightness; Determining the full image brightness of the target image; A brightness offset value of the target image is determined based on the ambient brightness and the full-image brightness, and the full-image brightness of the target image is adjusted according to the brightness offset value.
2. The method according to claim 1, characterized in that The color sub-regions include monochrome sub-regions; and converting the brightness of each of the color sub-regions into ambient brightness includes: The brightness of each of the monochrome sub-regions is counted respectively to obtain the monochrome brightness of the label corresponding to each of the monochrome sub-regions; Determine the label monochrome weight between the label monochrome brightness; The monochrome brightness of each tag is weighted according to the monochrome weight of the tag to obtain the ambient brightness.
3. The method according to claim 2, characterized in that The color sub-region includes a black sub-region and a white sub-region; The counting of the brightness of each of the monochrome sub-regions to obtain the monochrome brightness of the label corresponding to each of the monochrome sub-regions includes: In the label area, averaging is performed on the brightness of each black sub-area to obtain a brightness average of the black sub-areas in the label area; In the label area, averaging is performed on the brightness of each of the white sub-areas to obtain a brightness average of the white sub-areas in the label area; The weighted processing of the monochrome brightness of each tag according to the monochrome weight of the tag includes: According to the label monochrome weight between the black sub-region and the white sub-region, weighted processing is performed on the average brightness value of the black sub-region and the average brightness value of the white sub-region.
4. The method according to claim 1, characterized in that: The step of determining the full image brightness of the target image comprises: Determine the brightness of each pixel in the target image; The overall brightness of the target image is determined according to the brightness of each pixel.
5. The method according to claim 1, characterized in that The step of determining the brightness offset value of the target image based on the ambient brightness and the full image brightness includes: Calculating the brightness ratio of the ambient brightness to the full image brightness; Determining a brightness ratio adjustment coefficient based on a shooting environment of the target image; The brightness ratio is adjusted according to the brightness ratio adjustment coefficient to obtain a brightness offset value.
6. The method according to claim 1, characterized in that Determining the label area in the target image includes: Acquire a target image containing a target object; Determine the coordinates of each label of the target object in the target image; A label area of a preset label shape is determined at the label coordinates.
7. The method according to claim 1, characterized in that Before determining the label area in the target image, the method further includes: Get the initial image; Identifying a positioning tag in the initial image; Determine the target area in the initial image according to the positioning tag; The image in the target area is corrected into a preset shape to obtain a target image.
8. A device for adjusting the brightness of an image, characterized in that: The device comprises: A label region acquisition module, used to determine the label region in the target image; A label color brightness determination module, used to determine the brightness of the color sub-regions divided by the label area according to the color, and convert the brightness of each color sub-region into the ambient brightness; A full-image brightness determination module, used to determine the full-image brightness of the target image; The brightness adjustment module is used to determine the brightness offset value of the target image based on the ambient brightness and the full image brightness, and adjust the full image brightness of the target image according to the brightness offset value.
9. A computer device comprising a memory and a processor, wherein the memory stores a computer program, wherein: When the processor executes the computer program, the steps of the method according to any one of claims 1 to 7 are implemented.
10. A computer-readable storage medium having a computer program stored thereon, characterized in that: When the computer program is executed by a processor, the steps of the method according to any one of claims 1 to 7 are implemented.
