Image enhancement method, device and electronic device
By acquiring and processing multiple images to be processed, combined with adaptive weight detection and exposure fusion algorithms, high dynamic range images are generated, which solves the problem of poor low-light image enhancement in the existing technology and improves the contrast and details of the image.
Patent Information
- Application Number
- CN202110955265.7
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2021-08-19
- Publication Date
- 2024-09-13
- Estimated Expiration
- 2041-08-19
AI Technical Summary
Existing low-light image enhancement algorithms cannot be fully and effectively applied to all types of low-light images, especially in the field of high dynamic range image synthesis technology. Commonly used methods cannot effectively handle the local features of the image, resulting in poor enhanced image effects.
By acquiring at least two images to be processed of the target scene, performing different brightness processing and exposure parameter processing respectively, adaptive weight detection and weighted average processing are performed, and combined with the exposure fusion algorithm, an enhanced high dynamic range image is generated.
It improves the contrast and saturation of the image, enhances the image details, alleviates the problem of poor enhanced image effects in the existing technology, and is suitable for image processing in low light and large overexposed areas.
Smart Images

Figure CN113781370B
Abstract
Description
Technical Field
[0001] The present application relates to the technical field of image processing, and in particular to an image enhancement method, device and electronic device. Background Art
[0002] Image information plays a huge role in current production and life. As an important information carrier, it promotes the exchange of information and helps people to understand the world more intuitively. However, in real life, under low light conditions, due to dim ambient light, insufficient illumination, weak light reflected by objects in the environment, and insufficient number of photons captured by imaging devices, the final image has low contrast, insufficient saturation, and loss of image details.
[0003] In recent years, low-light image enhancement technology has become one of the research hotspots in the field of image processing. Many researchers have focused on the study of its algorithms and proposed various effective methods. However, due to the variability of low-light environments and the diversity of shooting equipment, some existing low-light image enhancement algorithms cannot be fully and effectively applied to all types of low-light images. Especially in the field of high dynamic range (HDR) image synthesis technology, the commonly used methods include global histogram equalization (GHE), which is suitable for overall image enhancement, but it is not suitable for local features of the image, and the enhanced image effect is poor; some scholars have proposed a single image contrast enhancement algorithm based on deep learning, but when there is a large area of overexposed area in the image, the algorithm cannot perform good correction on the overexposed area.
[0004] In summary, the enhanced image obtained by the existing image enhancement methods has poor effect. Summary of the invention
[0005] In view of this, the purpose of the present application is to provide an image enhancement method, device and electronic device to alleviate the technical problem of poor enhanced image effect obtained by existing image enhancement methods.
[0006] In a first aspect, an embodiment of the present application provides an image enhancement method, comprising:
[0007] Acquire at least two to-be-processed images of a target scene, and process the brightness of a first to-be-processed image of the at least two to-be-processed images to obtain a second to-be-processed image, wherein the exposure parameters of the at least two to-be-processed images are different;
[0008] Performing a first fusion process on the first image to be processed and the second image to be processed to obtain a fused image to be processed;
[0009] The to-be-processed fused image is subjected to a second fusion process with the remaining to-be-processed images among the at least two to-be-processed images except the first to-be-processed image to obtain an enhanced fused image.
[0010] Further, performing a first fusion process on the first image to be processed and the second image to be processed to obtain a fused image to be processed includes:
[0011] Performing adaptive weight detection on the first image to be processed to obtain a fusion coefficient feature map;
[0012] A first fusion process is performed on the first image to be processed and the second image to be processed based on the fusion coefficient feature map to obtain the fused image to be processed.
[0013] Further, processing the brightness of a first image to be processed among the at least two images to be processed to obtain a second image to be processed includes:
[0014] Determining brightness values of the at least two images to be processed;
[0015] Determining the first image to be processed from the at least two images to be processed according to the brightness value;
[0016] The first image to be processed is brightened to obtain the second image to be processed.
[0017] Furthermore, adaptive weight detection is performed on the first image to be processed to obtain a fusion coefficient feature map, including:
[0018] Based on the pixel value of each pixel point in the first image to be processed, the weight value corresponding to each pixel point in the first image to be processed is determined, and then a fusion coefficient feature map corresponding to the first image to be processed is obtained.
[0019] Further, based on the pixel value of each pixel in the first image to be processed, determining the weight value corresponding to each pixel in the first image to be processed includes:
[0020] Performing adaptive weight detection on each pixel point in the first image to be processed by the following formula to obtain a weight value corresponding to each pixel point in the first image to be processed;
[0021]
[0022] Wherein, W represents the weight value corresponding to each pixel point in the first image to be processed, represents the Gaussian curve, c represents the number of channels, u c(x) represents the pixel value of the pixel point at the x coordinate after the pixel values of each pixel point in the first image to be processed are normalized, x represents the coordinate of the pixel point in the first image to be processed, σ 2 represents the variance parameter in the Gaussian distribution.
[0023] Furthermore, the fusion coefficient feature map is a fusion coefficient feature map corresponding to the first image to be processed, and performing a first fusion process on the first image to be processed and the second image to be processed based on the fusion coefficient feature map includes:
[0024] Determining a fusion coefficient feature map corresponding to the second image to be processed according to the fusion coefficient feature map corresponding to the first image to be processed;
[0025] The first image to be processed, the fusion coefficient feature map corresponding to the first image to be processed, the second image to be processed, and the fusion coefficient feature map corresponding to the second image to be processed are weighted averaged to obtain the fused image to be processed.
[0026] Further, weighted averaging is performed on the first image to be processed, the fusion coefficient feature map corresponding to the first image to be processed, the second image to be processed, and the fusion coefficient feature map corresponding to the second image to be processed, including:
[0027] Based on the weighted average formula I=I1*mask+I2*(1-mask), the first image to be processed, the fusion coefficient feature map corresponding to the first image to be processed, the second image to be processed, and the fusion coefficient feature map corresponding to the second image to be processed are weighted averaged to obtain the fused image to be processed, wherein I represents the fused image to be processed, I1 represents the first image to be processed, I2 represents the second image to be processed, mask represents the fusion coefficient feature map corresponding to the first image to be processed, and (1-mask) represents the fusion coefficient feature map corresponding to the second image to be processed.
[0028] Further, performing a second fusion process on the to-be-processed fused image and the remaining to-be-processed images among the at least two to-be-processed images except the first to-be-processed image, comprises:
[0029] Determine the weight corresponding to each pixel in the fused image to be processed according to the contrast, saturation and exposure of each pixel in the fused image to be processed, and obtain the weight map corresponding to the fused image to be processed; and determine the weight corresponding to each pixel in the remaining images to be processed according to the contrast, saturation and exposure of each pixel in the remaining images to be processed, and obtain the weight map corresponding to the remaining images to be processed;
[0030] The enhanced fused image is obtained by performing weighted averaging processing on the fused image to be processed, the weight map corresponding to the fused image to be processed, the remaining images to be processed, and the weight maps corresponding to the remaining images to be processed.
[0031] Furthermore, the first image to be processed is the image with the highest brightness among the at least two images to be processed.
[0032] In a second aspect, the embodiment of the present application further provides an image enhancement device, including:
[0033] A processing unit, used to obtain at least two images to be processed of a target scene, and process the brightness of a first image to be processed of the at least two images to be processed to obtain a second image to be processed, wherein the exposure parameters of the at least two images to be processed are different;
[0034] A first fusion processing unit, configured to perform a first fusion process on the first image to be processed and the second image to be processed to obtain a fused image to be processed;
[0035] The second fusion processing unit is used to perform a second fusion process on the to-be-processed fused image and the remaining to-be-processed images among the at least two to-be-processed images except the first to-be-processed image, so as to obtain an enhanced fused image.
[0036] In a third aspect, an embodiment of the present application provides an electronic device, comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor implements the steps of any one of the methods described in the first aspect when executing the computer program.
[0037] In a fourth aspect, an embodiment of the present application provides a computer-readable medium having a non-volatile program code executable by a processor, wherein the program code enables the processor to execute the steps of the method described in any one of the first aspects above.
[0038] In an embodiment of the present application, an image enhancement method is provided, including: obtaining at least two images to be processed of a target scene, and processing the brightness of a first image to be processed of the at least two images to be processed to obtain a second image to be processed; then, performing a first fusion process on the first image to be processed and the second image to be processed to obtain a fused image to be processed; finally, performing a second fusion process on the fused image to be processed and the remaining images to be processed of the at least two images to be processed except the first image to be processed to obtain an enhanced fused image. It can be seen from the above description that the present application performs a first fusion process on the first image to be processed and the second image to be processed, so that the image effect of the fused image to be processed is good, and then the enhanced fused image obtained based on the fused image to be processed with good image effect has good image effect, which alleviates the technical problem of poor enhanced image effect obtained by the existing image enhancement method. BRIEF DESCRIPTION OF THE DRAWINGS
[0039] In order to more clearly illustrate the specific implementation methods of the present application or the technical solutions in the prior art, the drawings required for use in the specific implementation methods or the description of the prior art will be briefly introduced below. Obviously, the drawings described below are some implementation methods of the present application. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying any creative work.
[0040] Figure 1 A schematic diagram of an electronic device provided in an embodiment of the present application;
[0041] Figure 2 A flowchart of an image enhancement method provided in an embodiment of the present application;
[0042] Figure 3 A flowchart for processing the brightness of a first image to be processed among at least two images to be processed provided in an embodiment of the present application;
[0043] Figure 4 A schematic diagram of a first image to be processed provided in an embodiment of the present application;
[0044] Figure 5 A schematic diagram of a fusion coefficient feature map corresponding to a first image to be processed provided in an embodiment of the present application;
[0045] Figure 6 A schematic diagram of another image to be processed of the two images to be processed provided in an embodiment of the present application;
[0046] Figure 7 A schematic diagram for comparing a non-enhanced fused image and an enhanced fused image provided in an embodiment of the present application;
[0047] Figure 8A schematic diagram of an image enhancement device provided in an embodiment of the present application. DETAILED DESCRIPTION
[0048] The technical solution of the present application will be described clearly and completely below in conjunction with the embodiments. Obviously, the described embodiments are part of the embodiments of the present application, not all of the embodiments. Based on the embodiments in the present application, all other embodiments obtained by ordinary technicians in the field without creative work are within the scope of protection of the present application.
[0049] First, refer to Figure 1 An electronic device 100 for implementing the embodiments of the present application is described. The electronic device can be used to execute the image enhancement method of each embodiment of the present application.
[0050] like Figure 1 As shown, the electronic device 100 includes one or more processors 102, one or more memories 104, an input device 106, an output device 108, and a camera 110, and these components are interconnected via a bus system 112 and / or other forms of connection mechanisms (not shown). It should be noted that Figure 1 The components and structures of the electronic device 100 shown are merely exemplary and non-limiting. The electronic device may also have other components and structures as required.
[0051] The processor 102 can be implemented in at least one hardware form of a digital signal processor (DSP), a field programmable gate array (FPGA), a programmable logic array (PLA) and an ASIC (Application Specific Integrated Circuit). The processor 102 can be a central processing unit (CPU) or other forms of processing units with data processing capabilities and / or instruction execution capabilities, and can control other components in the electronic device 100 to perform desired functions.
[0052] The memory 104 may include one or more computer program products, and the computer program product may include various forms of computer-readable storage media, such as volatile memory and / or non-volatile memory. The volatile memory may include, for example, random access memory (RAM) and / or cache memory (cache), etc. The non-volatile memory may include, for example, read-only memory (ROM), hard disk, flash memory, etc. One or more computer program instructions may be stored on the computer-readable storage medium, and the processor 102 may run the program instructions to implement the client functions (implemented by the processor) in the embodiments of the present application described below and / or other desired functions. Various applications and various data may also be stored in the computer-readable storage medium, such as various data used and / or generated by the application, etc.
[0053] The input device 106 may be a device used by a user to input instructions, and may include one or more of a keyboard, a mouse, a microphone, a touch screen, and the like.
[0054] The output device 108 may output various information (eg, images or sounds) to the outside (eg, a user), and may include one or more of a display, a speaker, and the like.
[0055] The camera 110 is used to acquire at least two images to be processed, wherein the at least two images to be processed acquired by the camera are processed by the image enhancement method to obtain an enhanced fused image. For example, the camera can capture an image desired by a user (such as a photo, video, etc.), and then process the image by the image enhancement method to obtain an enhanced fused image. The camera can also store the captured image in the memory 104 for use by other components.
[0056] Exemplarily, the electronic device for implementing the image enhancement method according to the embodiment of the present application may be implemented as an intelligent mobile terminal such as a smart phone, a tablet computer, or the like.
[0057] In recent years, research on computer vision, deep learning, machine learning, image processing, image recognition and other technologies based on artificial intelligence has made important progress. Artificial Intelligence (AI) is an emerging science and technology that studies and develops theories, methods, technologies and application systems for simulating and extending human intelligence. Artificial intelligence is a comprehensive discipline involving many types of technologies such as chips, big data, cloud computing, the Internet of Things, distributed storage, deep learning, machine learning, neural networks, etc. Computer vision, as an important branch of artificial intelligence, specifically allows machines to recognize the world. Computer vision technology usually includes face recognition, liveness detection, fingerprint recognition and anti-counterfeiting verification, biometric recognition, face detection, pedestrian detection, target detection, pedestrian recognition, image processing, image recognition, image semantic understanding, image retrieval, text recognition, video processing, video content recognition, behavior recognition, 3D reconstruction, virtual reality, augmented reality, simultaneous localization and mapping (SLAM), computational photography, robot navigation and positioning and other technologies. With the research and advancement of artificial intelligence technology, this technology has been applied in many fields, such as security, urban management, traffic management, building management, park management, facial access, facial attendance, logistics management, warehouse management, robots, intelligent marketing, computational photography, mobile phone imaging, cloud services, smart homes, wearable devices, unmanned driving, automatic driving, smart medical care, facial payment, facial unlocking, fingerprint unlocking, identity verification, smart screens, smart TVs, cameras, mobile Internet, live streaming, beauty, makeup, medical beauty, and smart temperature measurement.
[0058] According to an embodiment of the present application, a method for enhancing an image is provided. It should be noted that the steps shown in the flowchart of the accompanying drawings can be executed in a computer system such as a set of computer executable instructions, and although a logical order is shown in the flowchart, in some cases, the steps shown or described can be executed in an order different from that shown here.
[0059] Figure 2 is a flow chart of an image enhancement method according to an embodiment of the present application, such as Figure 2 As shown, the method comprises the following steps:
[0060] Step S202, acquiring at least two to-be-processed images of the target scene, and processing the brightness of a first to-be-processed image of the at least two to-be-processed images to obtain a second to-be-processed image, wherein the exposure parameters of the at least two to-be-processed images are different;
[0061] In an embodiment of the present application, the above-mentioned target scene can be any scene, and the above-mentioned at least two images to be processed can be images obtained by photographing the same target scene, or can be images of the same target scene stored in advance. The embodiment of the present application does not specifically limit the method for obtaining the above-mentioned at least two images to be processed.
[0062] It should be noted that the scales of the at least two images to be processed are the same (in the embodiment of the present application, the scale refers to the size of the image, i.e., H*W), and the exposure parameters of the at least two images to be processed are different. In some embodiments, the exposure parameters may be, for example, exposure time, light flux, etc., which are not limited in the embodiment of the present application.
[0063] After obtaining at least two images to be processed, the brightness of the first image to be processed among the at least two images to be processed is processed to obtain the second image to be processed. The first image to be processed can be determined from the at least two images to be processed according to the brightness values of the at least two images to be processed.
[0064] Step S204, performing a first fusion process on the first image to be processed and the second image to be processed to obtain a fused image to be processed;
[0065] The first fusion processing may be weighted processing of the first image to be processed and the second image to be processed to obtain a fused image to be processed.
[0066] Step S206 , performing a second fusion process on the to-be-processed fused image and the remaining to-be-processed images of the at least two to-be-processed images except the first to-be-processed image, to obtain an enhanced fused image.
[0067] The enhanced fused image mentioned above is actually an enhanced high dynamic range image.
[0068] High-Dynamic Range (HDR) images can provide more dynamic range and image details than ordinary images. According to different exposure times of LDR (Low-Dynamic Range), the final HDR image is synthesized using the LDR image with the best details corresponding to each exposure time. It can better reflect the visual effect in the real environment. In the embodiment of the present application, the final enhanced HDR image is synthesized based on the fused image to be processed and the remaining images to be processed in at least two images to be processed except the first image to be processed, and the image effect of the enhanced high dynamic range image is good.
[0069] In an embodiment of the present application, an image enhancement method is provided, including: obtaining at least two images to be processed of a target scene, and processing the brightness of a first image to be processed of the at least two images to be processed to obtain a second image to be processed; then, performing a first fusion process on the first image to be processed and the second image to be processed to obtain a fused image to be processed; finally, performing a second fusion process on the fused image to be processed and the remaining images to be processed of the at least two images to be processed except the first image to be processed to obtain an enhanced fused image. It can be seen from the above description that the present application performs a first fusion process on the first image to be processed and the second image to be processed, so that the image effect of the fused image to be processed is good, and then the enhanced fused image obtained based on the fused image to be processed with good image effect has good image effect, which alleviates the technical problem of poor enhanced image effect obtained by the existing image enhancement method.
[0070] The above content briefly introduces the image enhancement method of the present application, and the specific contents involved are described in detail below.
[0071] In an optional embodiment of the present application, a first fusion process is performed on the first image to be processed and the second image to be processed to obtain a fused image to be processed, which specifically includes: performing adaptive weight detection on the first image to be processed to obtain a fusion coefficient feature map; performing a first fusion process on the first image to be processed and the second image to be processed based on the fusion coefficient feature map to obtain the fused image to be processed.
[0072] Specifically, a related formula may be used to perform adaptive weight detection on the first image to be processed, and an adaptive weight detection model may be used to perform adaptive weight detection on the first image to be processed, thereby obtaining a fusion coefficient feature map.
[0073] In an optional embodiment of the present application, reference Figure 3 , processing the brightness of a first image to be processed among at least two images to be processed, specifically comprising the following steps:
[0074] Step S301, determining brightness values of at least two images to be processed;
[0075] Step S302, determining a first image to be processed from at least two images to be processed according to the brightness value;
[0076] Step S303: brighten the first image to be processed to obtain a second image to be processed.
[0077] The first image to be processed may be an image with the highest brightness among the at least two images to be processed. The embodiment of the present application does not impose any specific limitation on the first image to be processed.
[0078] Specifically, a weighted distribution adaptive gamma correction (AGCWD) algorithm can be used to brighten the first image to be processed to obtain a second image to be processed. In the AGCWD algorithm, an adaptive gamma curve (a special tone curve) is designed according to the distribution function to brighten the image. When the gamma value is equal to 1, the curve is a straight line at 45° to the coordinate axis, which means that the input and output densities are the same. A gamma value higher than 1 will cause the output to be darkened, and a gamma value lower than 1 will cause the output to be brightened.
[0079] The reason for choosing the above AGCWD algorithm is that it can be compatible with speed while achieving the desired effect.
[0080] In an optional embodiment of the present application, the above-mentioned step S204 performs adaptive weight detection on the first image to be processed to obtain a fusion coefficient feature map, which specifically includes: based on the pixel value of each pixel point in the first image to be processed, determining the weight value corresponding to each pixel point in the first image to be processed, and then obtaining the fusion coefficient feature map corresponding to the first image to be processed.
[0081] Optionally, adaptive weight detection is performed on each pixel point in the first image to be processed by the following formula to obtain a weight value corresponding to each pixel point in the first image to be processed;
[0082]
[0083] Wherein, W represents the weight value corresponding to each pixel in the first image to be processed, represents the Gaussian curve, c represents the number of channels, u c (x) represents the pixel value of the pixel point at the x coordinate after the pixel values of each pixel point in the first image to be processed are normalized, x represents the coordinate of the pixel point in the first image to be processed, σ 2 represents the variance parameter in the Gaussian distribution, and 0.5 represents the ideal pixel value. The ideal pixel value can generally take a value between 0 and 1. In some embodiments, the ideal pixel value can be set to a value greater than or less than 0.5 as required. Preferably, σ is equal to 0.2.
[0084] Figure 4 is a schematic diagram of a first image to be processed, Figure 5 For the first image to be processed Figure 4 A schematic diagram of a fusion coefficient feature map corresponding to the first image to be processed obtained after adaptive weight detection, Figure 6 A schematic diagram of another image to be processed of the two images to be processed.
[0085] In an optional embodiment of the present application, the fusion coefficient feature map is a fusion coefficient feature map corresponding to the first image to be processed. The above step S206 performs a first fusion processing on the first image to be processed and the second image to be processed based on the fusion coefficient feature map, specifically including: determining the fusion coefficient feature map corresponding to the second image to be processed according to the fusion coefficient feature map corresponding to the first image to be processed; performing weighted averaging processing on the first image to be processed, the fusion coefficient feature map corresponding to the first image to be processed, the second image to be processed, and the fusion coefficient feature map corresponding to the second image to be processed to obtain a fused image to be processed.
[0086] Specifically, it includes: based on the weighted average formula I=I1*mask+I2*(1-mask), weighted averaging processing is performed on the first image to be processed, the fusion coefficient feature map corresponding to the first image to be processed, the second image to be processed, and the fusion coefficient feature map corresponding to the second image to be processed to obtain the fused image to be processed, wherein I represents the fused image to be processed, I1 represents the first image to be processed, I2 represents the second image to be processed, mask represents the fusion coefficient feature map corresponding to the first image to be processed, and (1-mask) represents the fusion coefficient feature map corresponding to the second image to be processed.
[0087] Specifically, when performing the above-mentioned first fusion processing, the first image to be processed is multiplied by the fusion coefficient feature map, and at the same time, the second image to be processed is multiplied by (1-fusion coefficient feature map), and the two product operation results are then added.
[0088] For example, when the first image to be processed A' is multiplied with the fusion coefficient feature map mask, the pixel value of each pixel in A' is multiplied with the corresponding weight value (ie, the fusion coefficient) in the mask.
[0089] Through the above-mentioned first fusion processing, in the obtained fused image to be processed, the low-light area comes from the second image to be processed, and the high-light area comes from the first image to be processed, thus achieving the effect of low-light enhancement.
[0090] In an optional embodiment of the present application, the above step S208, performing a second fusion process on the fused image to be processed and the remaining images to be processed except the first image to be processed among the at least two images to be processed, specifically includes:
[0091] The weight corresponding to each pixel in the fused image to be processed is determined according to the contrast, saturation and exposure of each pixel in the fused image to be processed, and the weight map corresponding to the fused image to be processed is obtained; the weight corresponding to each pixel in the remaining images to be processed is determined according to the contrast, saturation and exposure of each pixel in the remaining images to be processed, and the weight maps corresponding to the remaining images to be processed are obtained; the fused image to be processed, the weight map corresponding to the fused image to be processed, the remaining images to be processed, and the weight maps corresponding to the remaining images to be processed are weighted averaged to obtain an enhanced fused image.
[0092] The above process uses the exposure fusion algorithm to perform a second fusion process on the to-be-processed fused image and the remaining to-be-processed images of at least two to-be-processed images except the first to-be-processed image, so as to obtain an enhanced fused image.
[0093] The above-mentioned exposure fusion algorithm uses the three quality indicators of image contrast, saturation, and good exposure to fuse multiple frames of images. The exposure fusion algorithm can directly extract information from LDR image sequences with different exposures and fuse them into a locally adaptively exposed HDR image (i.e., the enhanced fused image).
[0094] Specifically, many images in the sequence contain flat, colorless areas due to underexposure and overexposure. Such areas should be given less weight, while interesting areas containing bright colors and details should be preserved. To this end, we will take the following measures:
[0095] Contrast: We apply a Laplacian filter to the grayscale of each image and take the absolute value of the filter response. This produces a simple indicator, C, for contrast. It tends to give high weight to important elements such as edges and textures.
[0096] Saturation: When a photo is exposed for a long time, the resulting colors become desaturated and eventually clipped. Saturated colors are desirable and make the image look vivid. We include a saturation measure, S, which is the standard deviation of each pixel calculated within the R, G, and B channels.
[0097] Good exposure: Just looking at the raw intensity within one channel reveals how exposed a pixel is. We want to keep the intensity from being close to 0 (underexposed) or 1 (overexposed). We use a Gaussian curve to calculate its weight based on how close the intensity i is to 0.5: Where σ = 0.2 in our actual operation. To consider multiple color channels, we apply the Gaussian curve to each channel separately and multiply the results to obtain the measurement value E.
[0098] For each pixel, we use multiplication to combine the information from the different metrics into a scalar weight map. We chose a product instead of a linear combination because we wanted to perform all the qualities defined by the metrics at once (e.g., like an "and" selection, as opposed to an "or" selection). Similar to the weighting terms of the linear combination, we can control the influence of each metric using a power function:
[0099] W ij,k =(C ij,k ) wc ×(S ij,k ) ws ×(E ij,k ) wE , C, S, E represent contrast, saturation, and good exposure respectively, the index w represents the weight of the three, ij, k represents the (i, j)th pixel of the kth image. If the index is equal to 0, the corresponding metric is not considered. The final pixel weight is used to guide the fusion process.
[0100] A weighted average is calculated along each pixel to fuse multiple images. The weights calculated in the above process are used. In order to obtain consistent results, the weights are normalized so that the sum is 1 at each pixel (i, j). Multiple images are weighted mixed to obtain the enhanced fused image.
[0101] Figure 7 The left figure in FIG. 1 shows a schematic diagram of a fused image without enhancement, and the right figure shows a schematic diagram of a fused image after enhancement. Figure 7 From the comparison in , we can see that compared with the unenhanced fused image, the highlight area of the enhanced fused image (corresponding to the upper boxes in the left and right images, respectively) has no diffusion and no overexposure, and the low light area (corresponding to the lower boxes in the left and right images, respectively) has been well enhanced, and the image effect is good.
[0102] Traditional image enhancement methods are often based on single-image enhancement, which cannot achieve real-time effects on mobile terminals. The image enhancement method of the present application is based on high dynamic range scenes, using images to be processed with different exposure times. Through adaptive weight detection, the fusion coefficient feature map of the highlight area and the low-light area can be quickly calculated. As a result, the enhancement method of the present application can obtain an enhanced high dynamic range image with good effect, which is compatible with low-light scenes with large-area overexposure and has good real-time performance.
[0103] The embodiment of the present application also provides an image enhancement device, which is mainly used to execute the image enhancement method provided in the above content of the embodiment of the present application. The image enhancement device provided in the embodiment of the present application is specifically introduced below.
[0104] Figure 8is a schematic diagram of an image enhancement device according to an embodiment of the present application, such as Figure 8 As shown, the image enhancement device mainly includes: a processing unit 10, a first fusion processing unit 20 and a second fusion processing unit 30, wherein:
[0105] A processing unit, used to obtain at least two images to be processed of a target scene, and process the brightness of a first image to be processed of the at least two images to be processed to obtain a second image to be processed, wherein the exposure parameters of the at least two images to be processed are different;
[0106] A first fusion processing unit, used for performing a first fusion process on the first image to be processed and the second image to be processed to obtain a fused image to be processed;
[0107] The second fusion processing unit is used to perform a second fusion process on the fused image to be processed and the remaining images to be processed except the first image to be processed among the at least two images to be processed to obtain an enhanced fused image.
[0108] In an embodiment of the present application, an image enhancement device is provided, comprising: obtaining at least two images to be processed of a target scene, and processing the brightness of a first image to be processed of the at least two images to be processed to obtain a second image to be processed; then, performing a first fusion process on the first image to be processed and the second image to be processed to obtain a fused image to be processed; finally, performing a second fusion process on the fused image to be processed and the remaining images to be processed of the at least two images to be processed except the first image to be processed to obtain an enhanced fused image. It can be seen from the above description that the present application performs a first fusion process on the first image to be processed and the second image to be processed, so that the image effect of the obtained fused image to be processed is good, and then the enhanced fused image obtained based on the fused image to be processed with good image effect has good image effect, which alleviates the technical problem of poor enhanced image effect obtained by the existing image enhancement method.
[0109] Optionally, the first fusion processing unit is further used to: perform adaptive weight detection on the first image to be processed to obtain a fusion coefficient feature map; perform a first fusion process on the first image to be processed and the second image to be processed based on the fusion coefficient feature map to obtain a fused image to be processed.
[0110] Optionally, the processing unit is further used to: determine brightness values of at least two images to be processed; determine a first image to be processed from the at least two images to be processed according to the brightness values; and brighten the first image to be processed to obtain a second image to be processed.
[0111] Optionally, the first fusion processing unit is also used to: determine the weight value corresponding to each pixel point in the first image to be processed based on the pixel value of each pixel point in the first image to be processed, and then obtain a fusion coefficient feature map corresponding to the first image to be processed.
[0112] Optionally, the first fusion processing unit is further used to: perform adaptive weight detection on each pixel point in the first image to be processed by the following formula to obtain a weight value corresponding to each pixel point in the first image to be processed; Wherein, W represents the weight value corresponding to each pixel in the first image to be processed, represents the Gaussian curve, c represents the number of channels, u c (x) represents the pixel value of the pixel point at the x coordinate after the pixel values of each pixel point in the first image to be processed are normalized, x represents the coordinate of the pixel point in the first image to be processed, σ 2 represents the variance parameter in the Gaussian distribution.
[0113] Optionally, the fusion coefficient feature map is a fusion coefficient feature map corresponding to the first image to be processed, and the first fusion processing unit is further used to: determine the fusion coefficient feature map corresponding to the second image to be processed based on the fusion coefficient feature map corresponding to the first image to be processed; perform weighted averaging processing on the first image to be processed, the fusion coefficient feature map corresponding to the first image to be processed, the second image to be processed, and the fusion coefficient feature map corresponding to the second image to be processed to obtain the fused image to be processed.
[0114] Optionally, the first fusion processing unit is also used to: perform weighted averaging processing on the first image to be processed, the fusion coefficient feature map corresponding to the first image to be processed, the second image to be processed, and the fusion coefficient feature map corresponding to the second image to be processed based on the weighted averaging formula I=I1*mask+I2*(1-mask) to obtain the fused image to be processed, wherein I represents the fused image to be processed, I1 represents the first image to be processed, I2 represents the second image to be processed, mask represents the fusion coefficient feature map corresponding to the first image to be processed, and (1-mask) represents the fusion coefficient feature map corresponding to the second image to be processed.
[0115] Optionally, the second fusion processing unit is also used to: determine the weight corresponding to each pixel in the to-be-processed fused image according to the contrast, saturation and exposure of each pixel in the to-be-processed fused image, and obtain a weight map corresponding to the to-be-processed fused image; and determine the weight corresponding to each pixel in the remaining images to be processed according to the contrast, saturation and exposure of each pixel in the remaining images to be processed, and obtain a weight map corresponding to the remaining images to be processed; perform weighted averaging processing on the to-be-processed fused image, the weight map corresponding to the to-be-processed fused image, the remaining images to be processed, and the weight maps corresponding to the remaining images to be processed, to obtain an enhanced fused image.
[0116] Optionally, the first image to be processed is an image with the highest brightness among the at least two images to be processed.
[0117] The image enhancement device provided in the embodiment of the present application has the same implementation principle and technical effects as those in the aforementioned method embodiment. For the sake of brief description, for matters not mentioned in the device embodiment, reference may be made to the corresponding contents in the aforementioned method embodiment.
[0118] In another embodiment, a computer-readable medium having a non-volatile program code executable by a processor is provided, wherein the program code enables the processor to execute the steps of the method described in any of the above method embodiments.
[0119] In addition, in the description of the embodiments of the present application, unless otherwise clearly specified and limited, the terms "installed", "connected", and "connected" should be understood in a broad sense, for example, it can be a fixed connection, a detachable connection, or an integral connection; it can be a mechanical connection or an electrical connection; it can be a direct connection or an indirect connection through an intermediate medium, or it can be the internal communication of two components. For ordinary technicians in this field, the specific meanings of the above terms in this application can be understood according to specific circumstances.
[0120] In the description of the present application, it should be noted that the terms "center", "upper", "lower", "left", "right", "vertical", "horizontal", "inner", "outer", etc., indicating the orientation or positional relationship, are based on the orientation or positional relationship shown in the drawings, and are only for the convenience of describing the present application and simplifying the description, rather than indicating or implying that the device or element referred to must have a specific orientation, be constructed and operated in a specific orientation, and therefore cannot be understood as limiting the present application. In addition, the terms "first", "second", and "third" are used for descriptive purposes only, and cannot be understood as indicating or implying relative importance.
[0121] Those skilled in the art can clearly understand that, for the convenience and brevity of description, the specific working processes of the systems, devices and units described above can refer to the corresponding processes in the aforementioned method embodiments and will not be repeated here.
[0122] In the several embodiments provided in the present application, it should be understood that the disclosed systems, devices and methods can be implemented in other ways. The device embodiments described above are merely schematic. For example, the division of the units is only a logical function division. There may be other division methods in actual implementation. For example, multiple units or components can be combined or integrated into another system, or some features can be ignored or not executed. Another point is that the mutual coupling or direct coupling or communication connection shown or discussed can be through some communication interfaces, and the indirect coupling or communication connection of devices or units can be electrical, mechanical or other forms.
[0123] The units described as separate components may or may not be physically separated, and the components shown as units may or may not be physical units, that is, they may be located in one place or distributed on multiple network units. Some or all of the units may be selected according to actual needs to achieve the purpose of the solution of this embodiment.
[0124] In addition, each functional unit in each embodiment of the present application may be integrated into one processing unit, or each unit may exist physically separately, or two or more units may be integrated into one unit.
[0125] If the functions are implemented in the form of software functional units and sold or used as independent products, they can be stored in a non-volatile computer-readable storage medium that is executable by a processor. Based on this understanding, the technical solution of the present application, or the part that contributes to the prior art or the part of the technical solution, can be embodied in the form of a software product, which is stored in a storage medium and includes several instructions for a computer device (which can be a personal computer, a server, or a network device, etc.) to perform all or part of the steps of the method described in each embodiment of the present application. The aforementioned storage medium includes: various media that can store program codes, such as a USB flash drive, a mobile hard disk, a read-only memory (ROM), a random access memory (RAM), a magnetic disk or an optical disk.
[0126] Finally, it should be noted that the above-described embodiments are only specific implementation methods of the present application, which are used to illustrate the technical solutions of the present application, rather than to limit them. The protection scope of the present application is not limited thereto. Although the present application is described in detail with reference to the above-described embodiments, ordinary technicians in the field should understand that any technician familiar with the technical field can still modify the technical solutions recorded in the above-described embodiments within the technical scope disclosed in the present application, or can easily think of changes, or make equivalent replacements for some of the technical features therein; and these modifications, changes or replacements do not make the essence of the corresponding technical solutions deviate from the spirit and scope of the technical solutions of the embodiments of the present application, and should be included in the protection scope of the present application. Therefore, the protection scope of the present application shall be subject to the protection scope of the claims.
Claims
1. A method for enhancing an image, characterized in that: include: Acquire at least two to-be-processed images of a target scene, and process the brightness of a first to-be-processed image of the at least two to-be-processed images to obtain a second to-be-processed image, wherein the exposure parameters of the at least two to-be-processed images are different; Performing a first fusion process on the first image to be processed and the second image to be processed to obtain a fused image to be processed, wherein in the fused image to be processed, a low-light area comes from the second image to be processed, and a high-light area comes from the first image to be processed; An exposure fusion algorithm is used to perform a second fusion process on the to-be-processed fused image and the remaining to-be-processed images among the at least two to-be-processed images except the first to-be-processed image, so as to obtain an enhanced fused image; The first fusion process is performed on the first image to be processed and the second image to be processed to obtain a fused image to be processed, including: Performing adaptive weight detection on the first image to be processed to obtain a fusion coefficient feature map; Performing a first fusion process on the first image to be processed and the second image to be processed based on the fusion coefficient feature map to obtain the fused image to be processed; The fusion coefficient feature map is a fusion coefficient feature map corresponding to the first image to be processed, and performing a first fusion process on the first image to be processed and the second image to be processed based on the fusion coefficient feature map, including: Determining a fusion coefficient feature map corresponding to the second image to be processed according to the fusion coefficient feature map corresponding to the first image to be processed; The first image to be processed, the fusion coefficient feature map corresponding to the first image to be processed, the second image to be processed, and the fusion coefficient feature map corresponding to the second image to be processed are weighted averaged to obtain the fused image to be processed.
2. The method according to claim 1, characterized in that Processing the brightness of a first image to be processed among the at least two images to be processed to obtain a second image to be processed includes: Determining brightness values of the at least two images to be processed; Determining the first image to be processed from the at least two images to be processed according to the brightness value; The first image to be processed is brightened to obtain the second image to be processed.
3. The method according to claim 1, characterized in that Performing adaptive weight detection on the first image to be processed to obtain a fusion coefficient feature map, including: Based on the pixel value of each pixel point in the first image to be processed, the weight value corresponding to each pixel point in the first image to be processed is determined, and then a fusion coefficient feature map corresponding to the first image to be processed is obtained.
4. The method according to claim 3, characterized in that Determining a weight value corresponding to each pixel point in the first image to be processed based on a pixel value of each pixel point in the first image to be processed includes: Performing adaptive weight detection on each pixel point in the first image to be processed by the following formula to obtain a weight value corresponding to each pixel point in the first image to be processed; in, represents the weight value corresponding to each pixel in the first image to be processed, represents a Gaussian curve, Indicates the number of channels, Indicates that the pixel values of each pixel in the first image to be processed are normalized The pixel value of the pixel point at the coordinate, represents the coordinates of the pixel points in the first image to be processed, represents the variance parameter in the Gaussian distribution.
5. The method according to claim 1, characterized in that The method of performing weighted average processing on the first image to be processed, the fusion coefficient feature map corresponding to the first image to be processed, the second image to be processed, and the fusion coefficient feature map corresponding to the second image to be processed includes: Based on the weighted average formula The first image to be processed, the fusion coefficient feature map corresponding to the first image to be processed, the second image to be processed, and the fusion coefficient feature map corresponding to the second image to be processed are subjected to weighted averaging processing to obtain the fused image to be processed, wherein: represents the fused image to be processed, represents the first image to be processed, represents the second image to be processed, represents a fusion coefficient feature map corresponding to the first image to be processed, Represents a fusion coefficient feature map corresponding to the second image to be processed.
6. The method according to any one of claims 1 to 5, characterized in that: Performing a second fusion process on the to-be-processed fused image and the remaining to-be-processed images among the at least two to-be-processed images except the first to-be-processed image, comprising: Determine the weight corresponding to each pixel in the fused image to be processed according to the contrast, saturation and exposure of each pixel in the fused image to be processed, and obtain the weight map corresponding to the fused image to be processed; and determine the weight corresponding to each pixel in the remaining images to be processed according to the contrast, saturation and exposure of each pixel in the remaining images to be processed, and obtain the weight map corresponding to the remaining images to be processed; The enhanced fused image is obtained by performing weighted averaging processing on the fused image to be processed, the weight map corresponding to the fused image to be processed, the remaining images to be processed, and the weight maps corresponding to the remaining images to be processed.
7. The method according to any one of claims 1 to 5, characterized in that: The first image to be processed is the image with the highest brightness among the at least two images to be processed.
8. An image enhancement device, characterized in that: include: A processing unit, used to obtain at least two images to be processed of a target scene, and process the brightness of a first image to be processed of the at least two images to be processed to obtain a second image to be processed, wherein the exposure parameters of the at least two images to be processed are different; a first fusion processing unit, configured to perform a first fusion processing on the first image to be processed and the second image to be processed to obtain a fused image to be processed, wherein in the fused image to be processed, a low light area comes from the second image to be processed, and a high light area comes from the first image to be processed; A second fusion processing unit is used to perform a second fusion process on the to-be-processed fused image and the remaining to-be-processed images among the at least two to-be-processed images except the first to-be-processed image by using an exposure fusion algorithm to obtain an enhanced fused image; The first fusion processing unit is further used to: perform adaptive weight detection on the first image to be processed to obtain a fusion coefficient feature map; perform a first fusion process on the first image to be processed and the second image to be processed based on the fusion coefficient feature map to obtain the fused image to be processed; The fusion coefficient feature map is a fusion coefficient feature map corresponding to the first image to be processed, and the first fusion processing unit is also used to: determine the fusion coefficient feature map corresponding to the second image to be processed based on the fusion coefficient feature map corresponding to the first image to be processed; perform weighted averaging processing on the first image to be processed, the fusion coefficient feature map corresponding to the first image to be processed, the second image to be processed, and the fusion coefficient feature map corresponding to the second image to be processed to obtain the fused image to be processed.
9. An electronic device comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, 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 medium having a non-volatile program code executable by a processor, characterized in that: The program code enables the processor to execute the steps of the method according to any one of claims 1 to 7.
