Image brightening method and device, and electronic device

By segmenting and matching the image to be processed and the guide image with the brightness in accordance with the expectations, the problem of contrast loss during image brightening in the prior art is solved, and a high-quality image brightening effect is achieved.

CN113888429BActive Publication Date: 2025-02-11GUANGDONG OPPO MOBILE TELECOMMUNICATIONS CORP LTD
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202111155541.8
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2021-09-29
Publication Date
2025-02-11
Estimated Expiration
2041-09-29

AI Technical Summary

Technical Problem

The prior art will lose the contrast of the content when brightening an image, resulting in a contrast between light and dark and spatial hierarchy between the missing areas of the processed image.

Method used

By obtaining the image to be processed and a guide image with brightness in line with expectations, after segmenting the image block, hemistry calculation and matching are performed on each image block to obtain the brightness mapping curve, and brightness mapping is performed on the image block to be processed to ensure brightness The latter image does not lose the overall dynamic range and the light and dark contrast between the area.

Benefits of technology

The image brightening effect is achieved without losing the overall dynamic range and the light and dark contrast between the regions, improving the quality of the brightening image.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN113888429B_ABST
    Figure CN113888429B_ABST
Patent Text Reader

Abstract

The present application relates to an image brightening method, comprising: obtaining an image to be processed and a corresponding guide image, wherein the guide image is an image with expected brightness, and the relative motion amplitude between the guide image and the image to be processed is within a preset range; segmenting the image to be processed and the corresponding guide image into image blocks according to the same block size; performing histogram calculation on each image block to be processed obtained by segmenting the image to be processed, and obtaining a histogram of the image block to be processed corresponding to each image block to be processed; performing histogram calculation on each guide image block obtained by segmenting the guide image, and obtaining a histogram of the guide image block corresponding to each guide image block; performing histogram matching based on the image block to be processed and the guide image block at the matching position, and obtaining a brightness mapping curve corresponding to each image block to be processed; performing brightness mapping on each image block to be processed based on the brightness mapping curve, and obtaining a corresponding brightened image block, to form a brightened image, and to improve the quality of the brightened image.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the field of computer technology, and in particular to an image brightening method and device, an electronic device, and a computer-readable storage medium. Background Art

[0002] With the rapid development of electronic devices, electronic devices such as mobile phones and tablet computers are equipped with image acquisition functions, and users have increasingly higher requirements for the quality of images captured by electronic devices.

[0003] Brightening an image is a common operation in multi-frame image fusion and image enhancement algorithms. Conventional image brightening methods, while adjusting the overall brightness, will lose the contrast of the content. The processed image lacks the light and dark contrast between regions and lacks a sense of spatial hierarchy. Summary of the invention

[0004] The embodiments of the present application provide an image brightening method and device, an electronic device, and a computer-readable storage medium, so that the brightened image does not lose the overall dynamic range or the light and dark contrast between regions, thereby improving the quality of the brightened image.

[0005] An image brightening method, comprising:

[0006] Acquire an image to be processed and a corresponding guide image, wherein the guide image is an image whose brightness meets expectations, and the relative motion amplitude between the guide image and the image to be processed is within a preset range;

[0007] Segmenting the image to be processed and the corresponding guide image into image blocks according to the same block size;

[0008] Performing histogram calculation on each image block to be processed obtained by segmenting the image to be processed, to obtain a histogram of the image block to be processed corresponding to each image block to be processed;

[0009] Performing histogram calculation on each guide image block obtained by guide image segmentation to obtain a guide image block histogram corresponding to each guide image block;

[0010] Based on the image blocks to be processed and the guide image blocks at the matching positions, histogram matching is performed to obtain brightness mapping curves corresponding to the image blocks to be processed;

[0011] Brightness mapping is performed on each image block to be processed based on the corresponding brightness mapping curve to obtain a corresponding brightened image block, and each brightened image block constitutes a brightened image.

[0012] An image brightening device, comprising:

[0013] An acquisition module, used to acquire an image to be processed and a corresponding guide image, wherein the guide image is an image whose brightness meets the expected requirements, and the relative motion amplitude between the guide image and the image to be processed is within a preset range;

[0014] A segmentation module, used for segmenting the image to be processed and the corresponding guide image into image blocks with the same block size;

[0015] A histogram calculation module is used to perform histogram calculation on each to-be-processed image block obtained by segmenting the to-be-processed image to obtain a to-be-processed image block histogram corresponding to each to-be-processed image block; and to perform histogram calculation on each guide image block obtained by segmenting the guide image to obtain a guide image block histogram corresponding to each guide image block;

[0016] The histogram matching module is used to perform histogram matching based on the image block to be processed and the guide image block at the matching position to obtain the brightness mapping curve corresponding to each image block to be processed.

[0017] The brightening module is used to perform brightness mapping on each image block to be processed based on the corresponding brightness mapping curve to obtain a corresponding brightened image block, and each brightened image block constitutes a brightened image.

[0018] An electronic device includes a memory and a processor, wherein the memory stores a computer program, and when the computer program is executed by the processor, the processor executes the following steps:

[0019] Acquire an image to be processed and a corresponding guide image, wherein the guide image is an image whose brightness meets expectations, and the relative motion amplitude between the guide image and the image to be processed is within a preset range;

[0020] Segmenting the image to be processed and the corresponding guide image into image blocks according to the same block size;

[0021] Performing histogram calculation on each image block to be processed obtained by segmenting the image to be processed, to obtain a histogram of the image block to be processed corresponding to each image block to be processed;

[0022] Performing histogram calculation on each guide image block obtained by guide image segmentation to obtain a guide image block histogram corresponding to each guide image block;

[0023] Based on the image blocks to be processed and the guide image blocks at the matching positions, histogram matching is performed to obtain brightness mapping curves corresponding to the image blocks to be processed;

[0024] Brightness mapping is performed on each image block to be processed based on the corresponding brightness mapping curve to obtain a corresponding brightened image block, and each brightened image block constitutes a brightened image.

[0025] A computer-readable storage medium stores a computer program, which, when executed by a processor, causes the processor to perform the following steps:

[0026] Acquire an image to be processed and a corresponding guide image, wherein the guide image is an image whose brightness meets expectations, and the relative motion amplitude between the guide image and the image to be processed is within a preset range;

[0027] Segmenting the image to be processed and the corresponding guide image into image blocks according to the same block size;

[0028] Performing histogram calculation on each image block to be processed obtained by segmenting the image to be processed, to obtain a histogram of the image block to be processed corresponding to each image block to be processed;

[0029] Performing histogram calculation on each guide image block obtained by guide image segmentation to obtain a guide image block histogram corresponding to each guide image block;

[0030] Based on the image blocks to be processed and the guide image blocks at the matching positions, histogram matching is performed to obtain brightness mapping curves corresponding to the image blocks to be processed;

[0031] Brightness mapping is performed on each image block to be processed based on the corresponding brightness mapping curve to obtain a corresponding brightened image block, and each brightened image block constitutes a brightened image.

[0032] The above-mentioned image brightening method, device, electronic device and computer-readable storage medium obtain an image to be processed and a corresponding guide image, wherein the guide image is an image with expected brightness, and the relative motion amplitude between the guide image and the image to be processed is within a preset range; the image to be processed and the corresponding guide image are divided into image blocks according to the same block size; histogram calculation is performed on each image block to be processed obtained by segmenting the image to be processed to obtain a histogram of the image block to be processed corresponding to each image block to be processed; histogram calculation is performed on each guide image block obtained by segmenting the guide image to obtain a histogram of the guide image block corresponding to each guide image block; histogram matching is performed based on the image block to be processed and the guide image block at the matching position to obtain a brightness mapping curve corresponding to each image block to be processed; brightness mapping is performed on each image block to be processed based on the corresponding brightness mapping curve to obtain a corresponding brightened image block, and each brightened image block constitutes a brightened image, and with the help of an image that meets the expected brightness requirements as a guide, brightness value mapping is performed on the image blocks to be processed to achieve a nonlinear brightening effect in spatial latitude without losing the overall dynamics or the light and dark contrast between regions. By performing histogram matching in blocks in the image, the brightness distribution of one image is mapped to the same or similar brightness distribution of another frame of image, thereby improving the quality of the brightened image. BRIEF DESCRIPTION OF THE DRAWINGS

[0033] In order to more clearly illustrate the embodiments of the present application or the technical solutions in the prior art, the drawings required for use in the embodiments or the description of the prior art will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present application. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying creative work.

[0034] Figure 1 A diagram showing an application environment of an image brightening method in one embodiment;

[0035] Figure 2 A schematic diagram of a process of an image brightening method in one embodiment;

[0036] Figure 3 A schematic diagram of a process for obtaining a brightness mapping curve in one embodiment;

[0037] Figure 4 A schematic diagram of a process of obtaining a currently brightened image block in one embodiment;

[0038] Figure 5 is a structural block diagram of an image brightening device in one embodiment;

[0039] Figure 6 FIG. 4 is a block diagram of the internal structure of an electronic device in one embodiment. DETAILED DESCRIPTION

[0040] 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.

[0041] Figure 1 FIG. 1 is an application environment diagram of an image brightening method in an embodiment. Figure 1As shown, the application environment includes a terminal 110 and a server 120, and the image brightening method can be completed independently by the terminal 110 or the server 120, or can be completed by the terminal 110 or the server 120 in cooperation. The terminal 110 or the server 120 obtains the image to be processed and the corresponding guide image, the guide image is an image with expected brightness, and the relative motion amplitude between the guide image and the image to be processed is within a preset range; the image to be processed and the corresponding guide image are segmented into image blocks according to the same block size; histogram calculation is performed on each image block to be processed obtained by segmenting the image to be processed, and a histogram of the image block to be processed corresponding to each image block to be processed is obtained; histogram calculation is performed on each guide image block obtained by segmenting the guide image, and a guide image block histogram corresponding to each guide image block is obtained; histogram matching is performed based on the image block to be processed and the guide image block at the matching position, and a brightness mapping curve corresponding to each image block to be processed is obtained; brightness mapping is performed on each image block to be processed based on the corresponding brightness mapping curve, and a corresponding brightened image block is obtained, and each brightened image block constitutes a brightened image. The terminal 110 may be a terminal device including a mobile phone, a tablet computer, a PDA (Personal Digital Assistant), a car computer, a wearable device, etc. The terminal device may obtain various types of images to be processed, including but not limited to images obtained by fusion of multiple frames, images taken in real time, images downloaded from a server, etc. The server 120 may be a server or a server cluster.

[0042] Figure 2 The figure is a flowchart of an image brightening method according to an embodiment. Figure 2 The image brightening method shown can be applied to the above-mentioned terminal 110 or server 120, including:

[0043] Step 202 : acquiring the image to be processed and the corresponding guide image, wherein the guide image is an image whose brightness meets the expected conditions, and the relative motion amplitude between the guide image and the image to be processed is within a preset range.

[0044] The image to be processed refers to the image that needs to adjust the image brightness. It can be the original image output by the terminal sensor or the image after image processing, such as the image obtained by fusion of multiple frames. The ISP module can be used to process the image with the expected brightness, where Image Signal Process refers to the module on the chip that processes the original data output by the sensor into the final image that can be displayed on the screen. The ISP module includes a normal image processing module, and the brightness after processing is the brightness of the automatic mode preview on the mobile phone screen.

[0045] The guide image is an image with expected brightness, which is used to map the brightness values ​​of the blocks of the image to be processed, so as to achieve a nonlinear brightening effect in the spatial dimension without losing the overall dynamic range or the light and dark contrast between regions. The guide image and the image to be processed can be homologous images or non-homologous images, and the relative motion amplitude between the guide image and the image to be processed is within a preset range. As long as the interval between the exposure times of the guide image and the image to be processed is small enough and within the preset time interval, the relative motion amplitude is considered to be within the preset range.

[0046] Step 204 , segmenting the image to be processed and the corresponding guide image into image blocks with the same block size.

[0047] The size of the block for image block segmentation can be customized, and the block size for image block segmentation can be determined based on the effect experiment of algorithm simulation. Different block sizes can be determined for image block segmentation based on the association between the image to be processed and the corresponding guide image. In one embodiment, the block size can be determined based on the image scene of the image to be processed and the corresponding guide image.

[0048] Specifically, when the block size is determined, the image to be processed and the corresponding guide image are segmented into image blocks respectively. The block size is recorded as size_1. If size_1 is 8, the image to be processed and the corresponding guide image are segmented into multiple 8*8 image blocks respectively.

[0049] Step 206, performing histogram calculation on each to-be-processed image block obtained by segmenting the to-be-processed image to obtain a to-be-processed image block histogram corresponding to each to-be-processed image block. Performing histogram calculation on each guide image block obtained by segmenting the guide image to obtain a guide image block histogram corresponding to each guide image block.

[0050] Specifically, size_1 is selected as the block size, and the image to be processed and the guide image are divided into one-to-one corresponding image blocks of size_1x size_1. At each image block position xi, the histogram of the image block to be processed corresponding to the image block to be processed is calculated, recorded as hist_origin_xi. The histogram of the guide image block corresponding to the guide image block is calculated, recorded as hist_target_xi. The horizontal axis in the histogram is the pixel value, and the vertical axis is the number of pixels of the pixel value in the image.

[0051] Step 208: Perform histogram matching based on the image blocks to be processed and the guide image blocks at the matching positions to obtain brightness mapping curves corresponding to the image blocks to be processed.

[0052] Specifically, standard histogram matching, or histogram specification technology, is used to find the brightness mapping curve mapCurve_xi that maps hist_origin_xi to hist_target_xi based on the image block to be processed and the guide image block at the matching position, and all image block positions are traversed. The above operation is repeated to obtain the brightness mapping curve corresponding to each image block to be processed. The brightness mapping curve is a brightness transformation function that replaces the pixel value in the image with another value. Different image blocks to be processed correspond to different brightness mapping curves, thereby achieving a nonlinear brightening effect in the spatial dimension without losing the overall dynamic range or the light and dark contrast between regions.

[0053] Step 210 , performing brightness mapping on each image block to be processed based on the corresponding brightness mapping curve to obtain a corresponding brightened image block, and each brightened image block constitutes a brightened image.

[0054] Specifically, the brightness mapping curve is used to perform brightness mapping on the image block at position xi of the image to be processed, and the image block at position xi is brightened. By traversing all image block positions and repeating the above operation, each brightened image block can be obtained, and each brightened image block constitutes a brightened image, and a complete image guided brightening result is obtained.

[0055] The image brightening method in this embodiment obtains an image to be processed and a corresponding guide image, wherein the guide image is an image with expected brightness, and the relative motion amplitude between the guide image and the image to be processed is within a preset range; the image to be processed and the corresponding guide image are segmented into image blocks according to the same block size; histogram calculation is performed on each image block to be processed obtained by segmenting the image to be processed to obtain a histogram of the image block to be processed corresponding to each image block to be processed; histogram calculation is performed on each guide image block obtained by segmenting the guide image to obtain a histogram of the guide image block corresponding to each guide image block; histogram matching is performed based on the image block to be processed and the guide image block at the matching position to obtain a brightness mapping curve corresponding to each image block to be processed; brightness mapping is performed on each image block to be processed based on the corresponding brightness mapping curve to obtain a corresponding brightened image block, and each brightened image block constitutes a brightened image, and with the help of an image that meets the expected brightness requirements as a guide, brightness value mapping is performed on the image blocks to be processed to achieve a nonlinear brightening effect in spatial latitude without losing the overall dynamics or the light and dark contrast between regions. By performing histogram matching in blocks in the image, the brightness distribution of one image is mapped to the same or similar brightness distribution of another frame of image, thereby improving the quality of the brightened image.

[0056] In one embodiment, obtaining the image to be processed and the corresponding guide image in step 202 includes at least one of the following methods:

[0057] The first method is to obtain a homologous image of the image to be processed and use the homologous image as a guide image. The homologous image is an image obtained with the same exposure time.

[0058] Specifically, the homologous image refers to the same image as the image to be processed from the source, the output of the sensor once exposed, but copied into two copies later, each of which is processed differently, one of which is the image to be processed, and the other image with expected brightness is used as the guide image. Since they are the output of the same exposure, the relative motion amplitude between the guide image and the image to be processed is within the preset range.

[0059] The second method is to obtain a first image whose exposure time interval with the image to be processed is less than a preset time threshold, and use the first image as a guide image.

[0060] Specifically, if the exposure time interval with the image to be processed is less than a preset time threshold, it can be ensured that the relative motion amplitude between the guide image and the image to be processed is within a preset range, and the first image is an image with expected brightness.

[0061] In this embodiment, a guide image with expected brightness is obtained through different methods, and the relative motion amplitude between the guide image and the image to be processed is ensured to be within a preset range. Different types of guide images can be selected for different application scenarios, which is flexible and convenient.

[0062] In one embodiment, step 204 includes: if the guide image is a homologous image of the image to be processed, performing image block segmentation according to a first block size; if the guide image is not a homologous image of the image to be processed, performing image block segmentation according to a second block size, and the image scale of the first block size is smaller than the second block size.

[0063] Specifically, if the guide image is the same source image as the image to be processed, the image content is basically the same, and when the image block is segmented, it is segmented according to a first block size that is smaller than that of the non-homologous image. Since the image content is basically the same, the accuracy of the brightness mapping curve is higher when the histogram obtained by the smaller size segmentation is matched. If the guide image is not the same source image as the image to be processed, a larger second block size is used for segmentation to avoid the low similarity of the image after the smaller size segmentation, which leads to low accuracy of the brightness mapping curve when the histogram is matched.

[0064] In this embodiment, for different types of guide images, different block sizes are used to perform image block segmentation to obtain histograms corresponding to image blocks of different scales, thereby adaptively improving the accuracy of subsequent brightness mapping curves.

[0065] In one embodiment, Figure 3 As shown, step 208 includes:

[0066] Step 208A, obtaining the current image block to be processed and the corresponding current guide image block.

[0067] Specifically, the current image block to be processed and the corresponding current guiding image block may be acquired in order from top to bottom and from left to right, or may be acquired in a user-defined scanning order.

[0068] Step 208B, performing an equalization transformation on the histogram of the current image block to be processed corresponding to the current image block to be processed, to obtain an equalized histogram of the current image block to be processed.

[0069] Specifically, the image grayscale of the histogram after the equalization transformation will span a wider grayscale range, and the image contrast is increased after the equalization transformation. The transformation function for the equalization transformation can be customized.

[0070] Step 208C: Based on the current guide image block histogram corresponding to the current guide image block, a transformation value corresponding to the grayscale value of each guide image pixel is calculated by a transformation function.

[0071] Specifically, based on the number of grayscale values ​​of the guiding image pixels in the current guiding image block histogram, the probability of occurrence of the guiding image pixel grayscale values ​​in the image is obtained, and then substituted into the transformation function to obtain the transformation value corresponding to the guiding image pixel grayscale value. The transformation function can be obtained by calculating the probability density function corresponding to the current guiding image block histogram and the probability density function corresponding to the current image block to be processed.

[0072] Step 208D: based on the matching relationship between the equalization histogram of the current image block to be processed and the transformation value, obtain a brightness mapping curve corresponding to the current image block to be processed.

[0073] Specifically, for the current equalized pixel grayscale value in the equalized histogram of the current image block to be processed, find the transformation value that best matches it as the target transformation value, and find the target guide image pixel grayscale value corresponding to the target transformation value according to the corresponding relationship between the guide image pixel grayscale value and the transformation value. Thus, the corresponding relationship between the target guide image pixel grayscale value and the current equalized pixel grayscale value is established, and the brightness mapping curve corresponding to the current image block to be processed is obtained, so that the current image block to be processed can determine the mapping guide image pixel grayscale value through the brightness mapping curve by the corresponding current image block to be processed equalized histogram.

[0074] In this embodiment, the brightness mapping curve corresponding to the current image block to be processed is obtained by performing equalization transformation and transformation function on the histogram, thereby improving the accuracy of the brightness mapping curve.

[0075] In one embodiment, Figure 4 As shown, step 210 includes:

[0076] Step 210A, determining the current image block to be processed from each image block to be processed, and obtaining a current brightness mapping curve corresponding to the current image block to be processed, wherein the current brightness mapping curve includes a correlation between the equalized pixel grayscale value in the equalized histogram of the current image block to be processed and the guide image pixel grayscale value.

[0077] Specifically, if the correlation between the balanced pixel grayscale value in the balanced histogram of the current image block to be processed and the guide image pixel grayscale value is 1 and mapped to 3, it means that the balanced pixel grayscale value is 1, and the guide image pixel grayscale value obtained after mapping is 3.

[0078] Step 210B: acquiring the mapping guide image pixel grayscale value of the equalized pixel grayscale value corresponding to each pixel point in the current image block to be processed according to the association relationship.

[0079] Step 210C: replace the original pixel grayscale value of each pixel point with the corresponding pixel grayscale value of the mapping guidance image to obtain the current brightened image block corresponding to the current image block to be processed.

[0080] Specifically, the balanced pixel grayscale value corresponding to each pixel point in the current image block to be processed is first obtained through balanced mapping, and then the mapping guidance image pixel grayscale value of the balanced pixel grayscale value is obtained according to the association relationship, so that the original pixel grayscale value of each pixel point is replaced with the corresponding mapping guidance image pixel grayscale value to obtain the current brightened image block corresponding to the current image block to be processed.

[0081] In this embodiment, the target image pixel grayscale value corresponding to each pixel point in the current brightened image block corresponding to the current image block to be processed is quickly determined through the current brightness mapping curve, thereby quickly completing image brightening.

[0082] In one embodiment, step 208D includes: obtaining a target transformation value that matches the current balanced pixel grayscale value in the current image block balanced histogram; obtaining a target guiding image pixel grayscale value corresponding to the target transformation value, and establishing an association relationship between the target guiding image pixel grayscale value and the current balanced pixel grayscale value, until all balanced pixel grayscale values ​​in the current image block balanced histogram are processed, and a brightness mapping curve is obtained.

[0083] Specifically, if the current equalized pixel grayscale value is 1, the transformation function value G(z3)=1, since the current equalized pixel grayscale value is the same as the target transformation value, they are considered to match, 1 is used as the target transformation value, and according to the corresponding relationship between the guide image pixel grayscale value and the transformation value G(z3)=1, the target guide image pixel grayscale value 3 corresponding to the target transformation value is found. Thus, the corresponding relationship between the target guide image pixel grayscale value 3 and the current equalized pixel grayscale value 1 is established, and each pixel point is processed in turn to obtain the brightness mapping curve corresponding to the current image block to be processed.

[0084] In this embodiment, the brightness mapping curve is obtained by using the equalization histogram of the current image block to be processed as an intermediate relationship, thereby improving the mapping accuracy of the brightness mapping curve.

[0085] In a specific embodiment, a method for brightening an image is provided, and the image brightening process is specifically as follows:

[0086] 1. Acquire a multi-frame fused image as the image to be processed, and acquire a guide image by at least one of the following methods: Method 1: Acquire a first image with expected brightness and the same source as the image to be processed as the guide image; Method 2: Acquire a second image with expected brightness and an exposure time interval less than a preset time threshold with the image to be processed as the guide image.

[0087] 2. The image to be processed and the corresponding guide image are segmented into image blocks according to the same block size. If the guide image is obtained by the above method 1, the image block is segmented according to the first block size. If the guide image is obtained by the above method 2, the image block is segmented according to the second block size. The image scale of the first block size is smaller than the second block size.

[0088] 3. Perform histogram calculation on the first image block to be processed obtained by segmenting the image to be processed, and obtain a first image block to be processed histogram corresponding to the first image block to be processed. Perform histogram calculation on the first guide image block that matches the position of the first image block to be processed obtained by segmenting the guide image, and obtain a first guide image block histogram corresponding to the first guide image block.

[0089] 4. Perform histogram matching on the first image block to be processed and the first guide image block histogram, perform equalization transformation on the first image block to be processed, obtain the equalized histogram of the first image block to be processed, and calculate the transformation value corresponding to each guide image pixel grayscale value through the transformation function based on the first guide image block histogram. Obtain the target transformation value that matches the current equalized pixel grayscale value in the equalized histogram of the first image block to be processed, obtain the target guide image pixel grayscale value corresponding to the target transformation value, establish the association relationship between the target guide image pixel grayscale value and the current equalized pixel grayscale value, until all the equalized pixel grayscale values ​​in the equalized histogram of the first image block to be processed are processed, and obtain the first brightness mapping curve corresponding to the first image block to be processed. The first brightness mapping curve includes the association relationship between the equalized pixel grayscale value in the equalized histogram of the first image block to be processed and the guide image pixel grayscale value.

[0090] 5. According to the association relationship, obtain the mapping guiding image pixel grayscale value of the balanced pixel grayscale value corresponding to each pixel point in the first image block to be processed; replace the original pixel grayscale value of each pixel point with the corresponding mapping guiding image pixel grayscale value to obtain the first brightened image block corresponding to the first image block to be processed.

[0091] 6. Get the next image block to be processed and the corresponding guide image block, repeat the above steps to obtain the brightened image block corresponding to the next image block to be processed, until all the image blocks to be processed in the image to be processed are processed, and each brightened image block is obtained to form a brightened image.

[0092] In this embodiment, with the help of an image that meets the expected brightness requirements as a guide, the brightness mapping curve corresponding to the image block to be processed is obtained by performing equalization transformation and transformation function through the histogram, and the brightness value mapping is performed on the image block to be processed, so as to achieve a nonlinear brightening effect in the spatial latitude without losing the overall dynamics or the light and dark contrast between regions. By performing histogram matching in the image block, the brightness distribution of one image is mapped to the same or similar brightness distribution as another frame image, thereby improving the quality of the brightened image.

[0093] It should be understood that although Figure 2-4 The steps in the flowchart are shown in sequence as indicated by the arrows, but these steps are not necessarily executed in the order indicated by the arrows. Unless otherwise specified in this document, there is no strict order restriction for the execution of these steps, and these steps can be executed in other orders. Moreover, Figure 2-4At least part of the steps may include multiple sub-steps or multiple stages. These sub-steps or stages are not necessarily executed at the same time, but can be executed at different times. The execution order of these sub-steps or stages is not necessarily sequential, but can be executed in turn or alternately with other steps or at least part of the sub-steps or stages of other steps.

[0094] Figure 5 FIG. 3 is a structural block diagram of an image brightening device 300 according to an embodiment. Figure 5 As shown, an image brightening device 300 includes: an acquisition module 302, a segmentation module 304, a histogram calculation module 306, a histogram matching module 308, and a brightening module 310. Among them:

[0095] The acquisition module 302 is used to acquire the image to be processed and the corresponding guide image, wherein the guide image is an image whose brightness meets the expected requirements, and the relative motion amplitude between the guide image and the image to be processed is within a preset range.

[0096] The segmentation module 304 is used to segment the image to be processed and the corresponding guide image into image blocks with the same block size.

[0097] The histogram calculation module 306 is used to perform histogram calculation on each to-be-processed image block obtained by segmenting the to-be-processed image to obtain a to-be-processed image block histogram corresponding to each to-be-processed image block; and perform histogram calculation on each guide image block obtained by segmenting the guide image to obtain a guide image block histogram corresponding to each guide image block.

[0098] The histogram matching module 308 is used to perform histogram matching based on the image blocks to be processed and the guide image blocks at the matching positions to obtain brightness mapping curves corresponding to the image blocks to be processed.

[0099] The brightening module 310 is used to perform brightness mapping on each image block to be processed based on the corresponding brightness mapping curve to obtain a corresponding brightened image block, and each brightened image block constitutes a brightened image.

[0100] The image brightening device 300 in this embodiment obtains an image to be processed and a corresponding guide image, wherein the guide image is an image with expected brightness, and the relative motion amplitude between the guide image and the image to be processed is within a preset range; the image to be processed and the corresponding guide image are segmented into image blocks according to the same block size; histogram calculation is performed on each image block to be processed obtained by segmenting the image to be processed to obtain a histogram of the image block to be processed corresponding to each image block to be processed; histogram calculation is performed on each guide image block obtained by segmenting the guide image to obtain a histogram of the guide image block corresponding to each guide image block; histogram matching is performed based on the image block to be processed and the guide image block at the matching position to obtain a brightness mapping curve corresponding to each image block to be processed; brightness mapping is performed on each image block to be processed based on the corresponding brightness mapping curve to obtain a corresponding brightened image block, and each brightened image block constitutes a brightened image, and with the help of an image that meets the expected brightness requirements as a guide, brightness value mapping is performed on the image blocks to be processed to achieve a nonlinear brightening effect in spatial latitude without losing the overall dynamics or the light and dark contrast between regions. By performing histogram matching in blocks in the image, the brightness distribution of one image is mapped to the same or similar brightness distribution of another frame of image, thereby improving the quality of the brightened image.

[0101] In one embodiment, the acquisition module is further used to acquire the image to be processed and the corresponding guide image by at least one of the following methods:

[0102] Method 1: obtaining a homologous image of the image to be processed, and using the homologous image as the guide image, wherein the homologous image is an image obtained with the same exposure time;

[0103] Method 2: Acquire a first image whose exposure time interval with the image to be processed is less than a preset time threshold, and use the first image as the guide image.

[0104] The image brightening device 300 in this embodiment obtains a guide image with expected brightness through different methods, and ensures that the relative motion amplitude between the guide image and the image to be processed is within a preset range. Different types of guide images can be selected for different application scenarios, which is flexible and convenient.

[0105] In one embodiment, the segmentation module 304 is further used to perform image block segmentation according to a first block size if the guide image is a homologous image of the image to be processed; if the guide image is not a homologous image of the image to be processed, perform image block segmentation according to a second block size, and the image scale of the first block size is smaller than the second block size.

[0106] The image brightening device 300 in this embodiment uses different block sizes to segment image blocks for different types of guide images, and obtains histograms corresponding to image blocks of different scales, thereby adaptively improving the accuracy of subsequent brightness mapping curves.

[0107] In one embodiment, the histogram matching module 308 is further used to obtain the current image block to be processed and the corresponding current guide image block; perform an equalization transformation on the current image block to be processed corresponding to the current image block to be processed to obtain an equalization histogram of the current image block to be processed; based on the current guide image block histogram corresponding to the current guide image block, obtain the transformation value corresponding to the grayscale value of each guide image pixel through a transformation function calculation; based on the matching relationship between the equalization histogram of the current image block to be processed and the transformation value, obtain the brightness mapping curve corresponding to the current image block to be processed.

[0108] In this embodiment, the brightness mapping curve corresponding to the current image block to be processed is obtained by performing equalization transformation and transformation function on the histogram, thereby improving the accuracy of the brightness mapping curve.

[0109] In one embodiment, the brightening module 310 is also used to determine the current image block to be processed from the various image blocks to be processed, and obtain a current brightness mapping curve corresponding to the current image block to be processed, wherein the current brightness mapping curve includes a correlation between the balanced pixel grayscale value in the balanced histogram of the current image block to be processed and the guide image pixel grayscale value; according to the correlation, obtain the mapped guide image pixel grayscale value of the balanced pixel grayscale value corresponding to each pixel point in the current image block to be processed; replace the original pixel grayscale value of each pixel point with the corresponding mapped guide image pixel grayscale value to obtain the current brightened image block corresponding to the current image block to be processed.

[0110] The image brightening device 300 in this embodiment quickly determines the target image pixel grayscale value corresponding to each pixel point in the current brightened image block corresponding to the current image block to be processed through the current brightness mapping curve, thereby quickly completing image brightening.

[0111] In one embodiment, the histogram matching module 308 is also used to obtain a target transformation value that matches the current balanced pixel grayscale value in the balanced histogram of the current image block to be processed; obtain the target guiding image pixel grayscale value corresponding to the target transformation value, and establish an association relationship between the target guiding image pixel grayscale value and the current balanced pixel grayscale value, until all balanced pixel grayscale values ​​in the balanced histogram of the current image block to be processed are processed, and the brightness mapping curve is obtained.

[0112] The image brightening device 300 in this embodiment obtains a brightness mapping curve by using the equalization histogram of the current image block to be processed as an intermediate relationship, thereby improving the mapping accuracy of the brightness mapping curve.

[0113] For the specific definition of the image brightening device, please refer to the definition of the image brightening method above, which will not be repeated here. Each module in the above-mentioned image brightening device can be implemented in whole or in part by software, hardware and a combination thereof. The above-mentioned modules can be embedded in or independent of the processor in the computer device in the form of hardware, or can be stored in the memory of the computer device in the form of software, so that the processor can call and execute the operations corresponding to the above modules.

[0114] Figure 6 FIG. 1 is a schematic diagram of the internal structure of an electronic device in one embodiment. Figure 6 As shown, the electronic device includes a processor and a memory connected via a system bus. The processor is used to provide computing and control capabilities to support the operation of the entire electronic device. The memory may include a non-volatile storage medium and an internal memory. The non-volatile storage medium stores an operating system and a computer program. The computer program can be executed by the processor to implement the image brightening method provided in each of the above embodiments. The internal memory provides a cache operating environment for the operating system computer program in the non-volatile storage medium. The electronic device may be a mobile phone, a server, etc.

[0115] The implementation of each module in the image brightening device provided in the embodiment of the present application may be in the form of a computer program. The computer program may be run on a terminal or a server. The program modules constituted by the computer program may be stored in a memory of a terminal or a server. When the computer program is executed by a processor, the image brightening method described in the embodiment of the present application is implemented.

[0116] The present application also provides a computer-readable storage medium, one or more non-volatile computer-readable storage media containing computer-executable instructions, which, when executed by one or more processors, enable the processors to perform the image brightening method described in the present application.

[0117] A computer program product comprising instructions, when running on a computer, enables the computer to execute the image brightening method described in the embodiments of the present application.

[0118] Any reference to memory, storage, database or other medium used in this application may include non-volatile and / or volatile memory. Non-volatile memory may include read-only memory (ROM), programmable ROM (PROM), electrically programmable ROM (EPROM), electrically erasable programmable ROM (EEPROM) or flash memory. Volatile memory may include random access memory (RAM), which is used as an external cache memory. As an illustration and not limitation, RAM is available in many forms, such as static RAM (SRAM), dynamic RAM (DRAM), synchronous DRAM (SDRAM), double data rate SDRAM (DDR SDRAM), enhanced SDRAM (ESDRAM), synchronous link (Synchlink) DRAM (SLDRAM), memory bus (Rambus) direct RAM (RDRAM), direct memory bus dynamic RAM (DRDRAM), and memory bus dynamic RAM (RDRAM).

[0119] The above-mentioned 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 brightening an image, characterized in that: include: Acquire an image to be processed and a corresponding guide image, wherein the guide image is an image whose brightness meets expectations, and the relative motion amplitude between the guide image and the image to be processed is within a preset range; If the guide image is a homologous image of the image to be processed, segmenting the image to be processed and the corresponding guide image into image blocks according to a first block size; If the guide image is not a homologous image of the image to be processed, segmenting the image to be processed and the corresponding guide image into image blocks according to a second block size, wherein the image scale of the first block size is smaller than the second block size; Performing histogram calculation on each image block to be processed obtained by segmenting the image to be processed, to obtain a histogram of the image block to be processed corresponding to each image block to be processed; Performing histogram calculation on each guide image block obtained by guide image segmentation to obtain a guide image block histogram corresponding to each guide image block; Based on the image blocks to be processed and the guide image blocks at the matching positions, histogram matching is performed to obtain brightness mapping curves corresponding to the image blocks to be processed; Brightness mapping is performed on each image block to be processed based on the corresponding brightness mapping curve to obtain a corresponding brightened image block, and each brightened image block constitutes a brightened image.

2. The method according to claim 1, characterized in that The obtaining of the image to be processed and the corresponding guide image comprises at least one of the following methods: Acquire a homologous image of the image to be processed, and use the homologous image as the guide image, wherein the homologous image is an image obtained with the same exposure time; A first image whose exposure time interval with the image to be processed is less than a preset time threshold is acquired, and the first image is used as the guide image.

3. The method according to claim 1, characterized in that The image block to be processed and the guide image block based on the matching position are subjected to histogram matching to obtain a brightness mapping curve corresponding to each image block to be processed, including: Obtaining the current image block to be processed and the corresponding current guide image block; Performing an equalization transformation on a histogram of a current image block to be processed corresponding to the current image block to be processed to obtain an equalized histogram of the current image block to be processed; Based on the current guide image block histogram corresponding to the current guide image block, a transformation value corresponding to the grayscale value of each guide image pixel is calculated by a transformation function; Based on the matching relationship between the equalization histogram of the current image block to be processed and the transformation value, a brightness mapping curve corresponding to the current image block to be processed is obtained.

4. The method according to claim 3, characterized in that The brightness mapping is performed on each image block to be processed based on the corresponding brightness mapping curve to obtain a corresponding brightened image block, and each brightened image block constitutes a brightened image, comprising: Determine a current image block to be processed from each image block to be processed, and obtain a current brightness mapping curve corresponding to the current image block to be processed, wherein the current brightness mapping curve includes a correlation relationship between a balanced pixel grayscale value in a balanced histogram of the current image block to be processed and a pixel grayscale value of the guide image; According to the association relationship, a mapping guide image pixel gray value of a balanced pixel gray value corresponding to each pixel point in the current image block to be processed is obtained; The original pixel grayscale value of each pixel point is replaced with the corresponding mapping guidance image pixel grayscale value to obtain the current brightened image block corresponding to the current image block to be processed.

5. The method according to claim 3 or 4, characterized in that: The step of obtaining a brightness mapping curve corresponding to the current image block to be processed based on the matching relationship between the equalization histogram of the current image block to be processed and the transformation value comprises: Obtaining a target transformation value that matches a current equalized pixel grayscale value in an equalized histogram of a current image block to be processed; The target guiding image pixel grayscale value corresponding to the target transformation value is obtained, and an association relationship between the target guiding image pixel grayscale value and the current balanced pixel grayscale value is established until all the balanced pixel grayscale values ​​in the balanced histogram of the current image block to be processed are processed to obtain the brightness mapping curve.

6. An image brightening device, characterized in that: include: An acquisition module, used to acquire an image to be processed and a corresponding guide image, wherein the guide image is an image whose brightness meets the expected requirements, and the relative motion amplitude between the guide image and the image to be processed is within a preset range; a segmentation module, configured to segment the image to be processed and the corresponding guide image into image blocks according to a first block size if the guide image is a homologous image of the image to be processed; and to segment the image to be processed and the corresponding guide image into image blocks according to a second block size if the guide image is not a homologous image of the image to be processed, wherein the image scale of the first block size is smaller than the second block size; A histogram calculation module is used to perform histogram calculation on each image block to be processed obtained by segmenting the image to be processed, so as to obtain a histogram of the image block to be processed corresponding to each image block to be processed; Performing histogram calculation on each guide image block obtained by guide image segmentation to obtain a guide image block histogram corresponding to each guide image block; A histogram matching module is used to perform histogram matching based on the image block to be processed and the guide image block at the matching position to obtain a brightness mapping curve corresponding to each image block to be processed; The brightening module is used to perform brightness mapping on each image block to be processed based on the corresponding brightness mapping curve to obtain a corresponding brightened image block, and each brightened image block constitutes a brightened image.

7. The device according to claim 6, characterized in that The acquisition module is further used to acquire the image to be processed and the corresponding guide image by at least one of the following methods: Acquire a homologous image of the image to be processed, and use the homologous image as the guide image, wherein the homologous image is an image obtained with the same exposure time; A first image whose exposure time interval with the image to be processed is less than a preset time threshold is acquired, and the first image is used as the guide image.

8. An electronic device comprising a memory and a processor, wherein the memory stores a computer program, and when the computer program is executed by the processor, the processor executes the image brightening method according to any one of claims 1 to 5.

9. A computer-readable storage medium having a computer program stored thereon, characterized in that: When the computer program is executed by a processor, the image brightening method according to any one of claims 1 to 5 is implemented.

10. A computer program product comprising instructions, which, when executed on a computer, enables the computer to implement the image brightening method according to any one of claims 1 to 5.

Citation Information

Patent Citations

  • Image processing method, device and system

    CN106204513A

  • Pathological image segmentation method based on domain adversarial self-supervised learning

    CN113379764A