An image defogging method and device, electronic equipment and storage medium
By performing exposure gain compensation, R-channel component extraction, and wavelet transform fusion processing on the image, the applicability and effectiveness of existing image dehazing methods in foggy environments are solved, achieving a high-efficiency and low-complexity dehazing effect.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2024-05-17
- Publication Date
- 2026-03-31
AI Technical Summary
Existing image dehazing methods have poor applicability in sea fog and heavy fog environments, and the dehazing effect is not ideal. They also suffer from high complexity, high cost, or insufficient signal-to-noise ratio.
Exposure gain compensation is performed on the original format image, the R channel component is extracted, the image is decomposed and fused using wavelet transform algorithm, and then combined with gamma correction and inverse wavelet transform processing to improve the image's fog penetration performance.
It achieves high-quality defogging in foggy environments, with high object signal strength, low method complexity, good applicability, and low requirements for equipment hardware and computing power.
Smart Images

Figure CN118505562B_ABST
Abstract
Description
Technical Field
[0001] This specification relates to the field of image processing technology, and more particularly to an image dehazing method, apparatus, electronic device, and storage medium. Background Technology
[0002] In special environments such as sea fog and dense fog, the scattering effect of the atmosphere during shooting reduces the contrast and visibility of the captured images, resulting in significant image degradation. This adversely affects the video surveillance and target tracking functions of the camera. Therefore, an image dehazing method is needed to process the original image. Existing image dehazing methods include optical dehazing, polarization differential dehazing, and electronic dehazing. However, optical dehazing loses the color information of the image and imposes additional requirements on the camera system hardware. The high complexity and cost of polarization dehazing systems limit their practical application, and they may not be able to image certain targets correctly. Electronic dehazing methods, because they cannot improve the signal-to-noise ratio of the original signal, often suffer from a priori failure, color distortion, and noise amplification in dense fog environments. Therefore, existing image dehazing methods have poor applicability and unsatisfactory dehazing effects in sea fog and dense fog environments. Summary of the Invention
[0003] This specification provides an image dehazing method, apparatus, and electronic device, the technical solutions of which are as follows:
[0004] Firstly, embodiments of this specification provide an image dehazing method, the method comprising:
[0005] The original format image is acquired, and exposure gain compensation is applied to the original format image to obtain a color reconstructed image;
[0006] Extract the R channel component of the original image to obtain the first image corresponding to the R channel component;
[0007] The color reconstructed image is decomposed based on the wavelet transform algorithm to obtain the contour layer image and the detail layer image;
[0008] The first image and the contour layer image are fused to obtain a fused image, and the fused image and the detail layer image are subjected to inverse wavelet transform to obtain a dehazed image.
[0009] Secondly, an image dehazing apparatus is provided, the apparatus comprising:
[0010] The acquisition module is used to acquire the original format image and perform exposure gain compensation on the original format image to obtain a color reconstructed image;
[0011] An extraction module is used to extract the R channel component of the original image to obtain a first image corresponding to the R channel component;
[0012] The decomposition module is used to decompose the color reconstructed image based on the wavelet transform algorithm to obtain the contour layer image and the detail layer image;
[0013] The fusion module is used to fuse the first image and the contour layer image to obtain a fused image, and to perform inverse wavelet transform processing on the fused image and the detail layer image to obtain a dehazed image.
[0014] Thirdly, an electronic device is provided, including a device processor and a memory;
[0015] The device processor is connected to the memory;
[0016] The memory is used to store executable program code;
[0017] The device processor runs a program corresponding to the executable program code stored in the memory to perform the steps of the method provided as in the first aspect or any possible implementation thereof.
[0018] Fourthly, a computer-readable storage medium is provided having a computer program stored thereon, the computer-readable storage medium storing instructions that, when executed on a computer or device processor, cause the computer or device processor to perform the method provided as in the first aspect or any possible implementation thereof.
[0019] The beneficial effects of the technical solutions provided in some embodiments of this specification include at least the following:
[0020] In one or more embodiments of this specification, exposure gain compensation is first performed on the original image acquired in environments such as sea fog or dense fog. A virtual exposure method with gamma correction is then used, and the higher transmittance of the R channel component in the original image is utilized. Wavelet decomposition and image fusion are then employed to perform image dehazing, resulting in a high signal intensity of objects in the final dehazed image. Thus, even in foggy shooting environments, this dehazing method can achieve ideal dehazing results. Furthermore, this method has low complexity, good real-time performance, and low requirements for device hardware and computing power, meeting the requirements of high applicability. Attached Figure Description
[0021] To more clearly illustrate the technical solutions in the embodiments of this application, the accompanying drawings used in the embodiments will be briefly introduced below. Obviously, the drawings described below are only some embodiments of this application. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort.
[0022] Figure 1 This is a schematic diagram of the system architecture of an image dehazing method provided in the embodiments of this specification;
[0023] Figure 2 A flowchart of an image dehazing method provided in the embodiments of this specification;
[0024] Figure 3 This is a schematic diagram of the structure of an image dehazing device provided in the embodiments of this specification;
[0025] Figure 4 This is a schematic diagram of the structure of an electronic device provided in an embodiment of this specification. Detailed Implementation
[0026] The technical solutions in the embodiments of this application will be clearly and completely described below with reference to the accompanying drawings.
[0027] The terms "first," "second," "third," etc., in the description, claims, and accompanying drawings are used to distinguish different objects, not to describe a specific order. Furthermore, the terms "comprising" and "having," and any variations thereof, are intended to cover non-exclusive inclusion. For example, a process, method, system, product, or apparatus that includes a series of steps or units is not limited to the listed steps or units, but may optionally include steps or units not listed, or may optionally include other steps or units inherent to such processes, methods, products, or apparatus.
[0028] The following description provides examples and does not limit the scope, applicability, or examples set forth in the claims. Changes may be made to the function and arrangement of the described elements without departing from the scope of this specification. Various processes or components may be appropriately omitted, substituted, or added to the examples. For example, the described methods may be performed in a different order than described, and various steps may be added, omitted, or combined. Furthermore, features described with respect to some examples may be combined into other examples.
[0029] Please see Figure 1 , Figure 1 A schematic diagram of the system architecture of an image dehazing method provided in an embodiment of this specification is shown.
[0030] like Figure 1As shown, the system architecture of this image dehazing method may include at least a terminal 10, a server 20, and a network 30.
[0031] Terminal 10 includes, but is not limited to, electronic devices such as smartphones, desktop computers, tablets, laptops, smart speakers, digital assistants, and smart wearable devices, and may also be software running on the aforementioned electronic devices, such as applications. Optionally, the operating system running on the electronic device may include, but is not limited to, Android, iOS, Linux, and Windows. Optionally, terminal 10 provides image dehazing services to users. Terminal 10 can obtain image dehazing instructions from the application programming interface and send image dehazing requests to server 20.
[0032] Server 20 can provide background services for terminal 10. Based on the image dehazing request sent by terminal 10, server 20 will obtain a series of image dehazing instructions and transmit the image dehazing instructions to other terminals 10 through network 30. Specifically, server 20 can be an independent physical server, a server cluster or distributed system composed of multiple physical servers, or a cloud server that provides basic cloud computing services such as cloud services, cloud databases, cloud computing, cloud functions, cloud storage, network services, cloud communication, middleware services, domain name services, security services, CDN (Content Delivery Network), and big data and artificial intelligence platforms.
[0033] Network 30 is a medium used to provide a communication link between terminal 10 and server 20. Network 30 may include various connection types, such as wired, wireless communication links, or fiber optic cables, etc.
[0034] In addition, it should be noted that, Figure 1 The system shown is merely one example of the system provided in this disclosure. In practical applications, other systems may also be included, such as more terminals.
[0035] In the embodiments described in this specification, the terminal 10 and the server 20 can be directly or indirectly connected through wired or wireless communication, and this disclosure does not impose any restrictions.
[0036] Please refer to the following. Figure 2 , Figure 2 An overall flowchart of an image dehazing method provided in an embodiment of this specification is shown. This image dehazing method can be used in server 20.
[0037] like Figure 2 As shown, the image dehazing method may include at least the following steps:
[0038] Step 201: Obtain the original format image and perform exposure gain compensation on the original format image to obtain a color reconstructed image.
[0039] In the embodiments of this specification, the image dehazing method can be used in camera systems in environments such as sea fog and heavy fog. The scattering effect of rain and fog particles on light causes the overall image to appear white and bright. The enhancement of invalid scattered light signals that do not contain object information will make the image brighter than in a normal environment. Conventional automatic exposure algorithms cannot recognize this environment and usually reduce physical quantities such as camera shutter speed, aperture size, and analog gain to maintain the overall brightness of the image at a suitable level. However, this also results in the camera receiving a weaker exposure signal of the object than in a fog-free environment, thereby reducing the signal-to-noise ratio of the input image signal to the camera image processing system. Therefore, in order to improve the brightness level of the original format image and make it closer to the ideal exposure effect, thereby improving the visual effect and quality of the image, automatic exposure gain compensation can first be performed on the original format image according to its exposure condition, and then the image's hue, color saturation, contrast, etc. can be adjusted as needed to obtain a color reconstructed image.
[0040] In one possible implementation, performing exposure gain compensation on the original format image to obtain a color reconstructed image includes:
[0041] Determine the defogging intensity appropriate for the current environment;
[0042] Based on the dehazing intensity, the original format image is subjected to exposure gain compensation to obtain a compensated image;
[0043] The compensated image is reconstructed based on the demosaic algorithm to obtain a color reconstructed image.
[0044] In the embodiments of this specification, the fog concentration in the current shooting environment of the camera can be obtained indirectly through measurement methods such as weather sensors or lidar. Then, the defogging intensity corresponding to the current environmental fog concentration can be determined through a preset concentration database. This concentration database can be constructed by statistically analyzing a large number of historical records of manually selected defogging intensities; each environmental fog concentration corresponds to a defogging intensity. Furthermore, when using an automatic exposure algorithm to perform exposure gain compensation on the original format image, the automatic exposure algorithm generally uses the following formula:
[0045] I ae =I0*gain
[0046] Where gain represents the magnification factor of the target brightness value in the automatic exposure algorithm, I0 represents the original target brightness, and I ae This indicates the brightness value after exposure.
[0047] Since the magnification gain can typically be adaptively adjusted based on the previously obtained dehazing intensity, exposure gain compensation can be performed on the original format image based on the determined dehazing intensity to obtain a compensated image. Next, to enhance image details and improve image quality, preparing for subsequent correction, fusion, noise reduction, and other processing steps, the compensated image needs to be de-mosaiced using a demosaic algorithm. Through interpolation and color reconstruction techniques, a color reconstructed image is obtained.
[0048] The demosaic algorithm has several implementation methods, including nearest neighbor interpolation, bilinear interpolation, adaptive algorithms, frequency domain methods, and various methods based on the color plane.
[0049] Step 202: Extract the R channel component of the original image to obtain the first image corresponding to the R channel component.
[0050] In the embodiments of this specification, since the R channel component in the color reconstructed image has higher transmittance, it can be used in subsequent image fusion processing steps to enhance the image's fog-penetrating performance. Therefore, after obtaining the color reconstructed image, all R channel components, i.e., red channel values, of the original image are extracted, and a new grayscale image, i.e., the first image, is created. In the first image, the brightness value of each pixel corresponds to the corresponding pixel value of the red channel in the original format image.
[0051] In one possible implementation, after extracting the R channel component of the original image to obtain the first image corresponding to the R channel component, the method further includes:
[0052] The brightness of the reconstructed color image is corrected based on the gamma correction algorithm to obtain the corrected image.
[0053] The decomposition of the color reconstructed image based on the wavelet transform algorithm to obtain the contour layer image includes:
[0054] The corrected image is decomposed based on the wavelet transform algorithm to obtain the contour layer image and the detail layer image.
[0055] In the embodiments of this specification, after obtaining the color reconstructed image processed by the automatic exposure algorithm, virtual exposure technology is needed to perform brightness correction on the color reconstructed image to achieve the best dehazing effect. Virtual exposure technology generally uses non-linear image correction methods, the most common being the use of gamma correction algorithms for brightness correction. The gamma correction algorithm formula is as follows:
[0056] I gamma =I norm y
[0057] Among them, Inorm I represents the brightness value of the reconstructed color image. ae The normalized brightness value, I gamma This represents the brightness value of the corrected image, and y represents the gamma correction intensity coefficient, which is generally around 2.
[0058] Therefore, the gamma correction algorithm is used to correct the brightness of the color reconstructed image. After obtaining the corrected image, in order to improve the dehazing effect during subsequent image decomposition, the corrected image can be directly decomposed based on the wavelet transform algorithm to obtain the contour layer image and the detail layer image.
[0059] Step 203: Decompose the color reconstructed image based on the wavelet transform algorithm to obtain the contour layer image and the detail layer image.
[0060] In the embodiments of this specification, it is necessary to decompose the color reconstructed image. The color reconstructed image can be decomposed first based on different image features using a wavelet transform algorithm to extract the contour layer image and three detail layer images, so that the decomposed images can be selected, fused, and denoised in subsequent processing to improve the dehazing effect.
[0061] The general steps of using the wavelet transform algorithm are as follows: First, the color reconstructed image undergoes preprocessing operations such as format conversion and normalization to obtain an image format suitable for wavelet transform calculations. Next, a two-dimensional wavelet transform is performed on the preprocessed image, which can be achieved using wavelet transform functions or libraries (such as the wavelet function in MATLAB). Further, a suitable wavelet basis and decomposition level are selected to decompose the image into multiple sub-bands. The approximate sub-band contains the main structure and low-frequency information of the image, corresponding to the contour layer, while the detail sub-band contains the texture and high-frequency information of the image, corresponding to the detail layer. Finally, the approximate sub-band, i.e., the contour layer image, is extracted from the wavelet decomposition results, and then the detail sub-band, i.e., the detail layer image, is extracted.
[0062] In one possible implementation, the step of decomposing the corrected image based on the wavelet transform algorithm to obtain a contour layer image and a detail layer image includes:
[0063] The corrected image is converted to a YUV format image;
[0064] Extract the Y channel component from the YUV format image to obtain the second image corresponding to the Y channel component;
[0065] The second image is decomposed using a wavelet transform algorithm to obtain a contour layer image and a detail layer image.
[0066] In the embodiments of this specification, when using the wavelet transform algorithm to decompose the corrected image, in order to save computational resources and improve processing efficiency, the corrected image can first be format-converted, converting RGB format data to YUV format data to obtain a YUV format image. Then, since the Y channel component in the YUV format image represents the luminance component, only the Y channel component needs to be extracted to obtain the second image corresponding to the Y channel component. Further, a suitable wavelet basis function can be determined first, and the wavelet transform algorithm can be used to transform the second image from the pixel domain to the wavelet domain. Then, the level of wavelet decomposition can be determined, and multi-level wavelet decomposition can be performed on the second image. This allows for the extraction of the contour layer image corresponding to the approximate sub-band and the detail layer image corresponding to the detail sub-band from the results of the multi-level wavelet decomposition.
[0067] Common wavelet bases include Haar wavelet, Daubechies wavelet, Symlet wavelet, etc.
[0068] Step 204: Fuse the first image and the contour layer image to obtain a fused image, and perform inverse wavelet transform processing on the fused image and the detail layer image to obtain a dehazed image.
[0069] In the embodiments of this specification, after obtaining a first image by extracting the R channel component and a contour layer image after wavelet decomposition, the first image and the contour layer image are fused using the higher transmittance of the R channel component to enhance the image's dehazing performance. Next, since both the fused image and the detail layer image are wavelet domain images after wavelet decomposition, they need to be merged and transformed into a dehazed image in the desired pixel domain using inverse wavelet transform.
[0070] When performing image fusion, it is crucial to select an appropriate fusion method. Common fusion methods include weighted fusion, pyramid fusion, and frequency transform fusion. Each method has its characteristics and applicable scenarios. For weighted fusion, weights are assigned to the first image and the contour layer image, and then they are summed. The weights can be manually set based on the importance of the image content or automatically determined by an algorithm. If pyramid or frequency transform fusion is used, a pyramid or multi-scale decomposition needs to be constructed for each image, and then fusion is performed at each level or frequency band.
[0071] In one possible implementation, fusing the first image and the contour layer image to obtain a fused image includes:
[0072] Determine the fusion weight ratio between the first image and the contour layer image;
[0073] The fusion scheme corresponding to the fusion weight ratio is determined based on the weighted fusion algorithm;
[0074] The first image and the contour layer image are fused according to the fusion scheme to obtain a fused image.
[0075] In the embodiments of this specification, when fusing the first image and the contour layer image, a weighted fusion algorithm can be used to determine the fusion scheme. The specific fusion formula for using the weighted fusion algorithm is as follows:
[0076] F=α×I R +(1-α)×J
[0077] Where F represents the fused image, I R Let J represent the first image, J represent the contour layer image, and α represent the fusion weight ratio.
[0078] Therefore, the fusion weight ratio between the first image and the contour layer image can be determined first based on the importance of the image content, and manually set to 0.3. Then, the linear fusion scheme in the weight fusion algorithm is determined through the set fusion weight ratio, that is, the two images are weighted and added together using a fusion formula. After fusing the first image and the contour layer image according to this linear fusion scheme, the desired fused image can be obtained.
[0079] In one possible implementation, after fusing the first image and the contour layer image to obtain a fused image, the method further includes:
[0080] The detail layer image is denoised using a filtering algorithm to obtain a denoised image.
[0081] The step of performing inverse wavelet transform processing on the fused image and the detail layer image to obtain a dehazed image includes:
[0082] The fused image and the denoised image are subjected to inverse wavelet transform to obtain a dehazed image.
[0083] In the embodiments of this specification, after obtaining the fused image, a filtering algorithm can be used to denoise the previously decomposed detail layer image to remove noise points and improve the image quality of the detail layer image. In the subsequent inverse wavelet transform process, the fused image and the denoised image after filtering are merged together to obtain the dehazed image.
[0084] Various filtering algorithms can be used for denoising detail layer images, including mean filtering, median filtering, Gaussian filtering, and bilateral filtering. Each of these algorithms has its own advantages and disadvantages and is suitable for different application scenarios and noise types. In practical applications, the appropriate filtering algorithm needs to be selected based on the characteristics of the detail layer image to be processed, the type of noise, and the denoising requirements.
[0085] In one possible implementation, performing inverse wavelet transform processing on the fused image and the denoised image to obtain a dehazed image includes:
[0086] The fused image and the denoised image are merged based on the inverse wavelet transform algorithm to obtain a merged image;
[0087] Image enhancement is performed on the merged image using a guided filter to obtain a dehazed image.
[0088] In the embodiments of this specification, since both the fused image and the denoised image are wavelet domain images decomposed by wavelet, they need to be reconstructed using an inverse wavelet transform algorithm to obtain a merged image in the pixel domain. Next, to further enhance the image dehazing effect, a guided filter can be used, employing a guided image to perform guided filtering processing on the obtained merged image.
[0089] In actual processing, the guide image can be the original input image or an image obtained through edge detection or other preprocessing steps. For each pixel, the mean and variance of the guide image and the local mean in the merged image are calculated first. Next, the local correlation between the guide image and the merged image is calculated. Then, based on the local statistical information of the guide image, the enhancement coefficient for each pixel is estimated. Finally, the estimated enhancement coefficients are used to filter each pixel of the merged image to obtain a dehazed image with enhanced dehazing effect.
[0090] The foregoing has described specific embodiments of this specification. Other embodiments are within the scope of the appended claims. In some cases, the actions or steps recited in the claims may be performed in a different order than that shown in the embodiments and may still achieve the desired result. Furthermore, the processes depicted in the drawings do not necessarily require the specific or sequential order shown to achieve the desired result. In some embodiments, multitasking and parallel processing are possible or may be advantageous.
[0091] Please refer to the following. Figure 3 , Figure 3 A schematic diagram of an image dehazing device provided in an embodiment of this specification is shown. It should be noted that... Figure 3 The image dehazing apparatus shown is used to perform the present application. Figure 2 The methods shown in the embodiments are for illustrative purposes only, illustrating the parts relevant to the embodiments of this application. For specific technical details not disclosed, please refer to this application. Figure 2 The example shown.
[0092] like Figure 3 As shown, the image dehazing device may include at least:
[0093] The acquisition module 301 is used to acquire the original format image and perform exposure gain compensation on the original format image to obtain a color reconstructed image;
[0094] Extraction module 302 is used to extract the R channel component of the original image to obtain the first image corresponding to the R channel component;
[0095] The decomposition module 303 is used to decompose the color reconstructed image based on the wavelet transform algorithm to obtain the contour layer image and the detail layer image;
[0096] The fusion module 304 is used to fuse the first image and the contour layer image to obtain a fused image, and to perform inverse wavelet transform processing on the fused image and the detail layer image to obtain a dehazed image.
[0097] In one possible implementation, the acquisition module 301 is specifically used for:
[0098] Determine the defogging intensity appropriate for the current environment;
[0099] Based on the dehazing intensity, the original format image is subjected to exposure gain compensation to obtain a compensated image;
[0100] The compensated image is reconstructed based on the demosaic algorithm to obtain a color reconstructed image.
[0101] In one possible implementation, the extraction module 302 is specifically used for:
[0102] The brightness of the reconstructed color image is corrected based on the gamma correction algorithm to obtain the corrected image.
[0103] The wavelet transform algorithm is used to decompose the color reconstructed image to obtain a contour layer image and a detail layer image, including:
[0104] The corrected image is decomposed based on the wavelet transform algorithm to obtain the contour layer image and the detail layer image.
[0105] In one possible implementation, the decomposition module 303 is specifically used for:
[0106] The corrected image is converted to a YUV format image;
[0107] Extract the Y channel component from the YUV format image to obtain the second image corresponding to the Y channel component;
[0108] The second image is decomposed using a wavelet transform algorithm to obtain a contour layer image and a detail layer image.
[0109] In one possible implementation, the fusion module 304 is specifically used for:
[0110] Determine the fusion weight ratio between the first image and the contour layer image;
[0111] The fusion scheme corresponding to the fusion weight ratio is determined based on the weighted fusion algorithm;
[0112] The first image and the contour layer image are fused according to the fusion scheme to obtain a fused image.
[0113] In one possible implementation, the fusion module 304 is further configured to:
[0114] The detail layer image is denoised using a filtering algorithm to obtain a denoised image.
[0115] The step of performing inverse wavelet transform processing on the fused image and the detail layer image to obtain a dehazed image includes:
[0116] The fused image and the denoised image are subjected to inverse wavelet transform to obtain a dehazed image.
[0117] In one possible implementation, the fusion module 304 is further configured to:
[0118] The fused image and the denoised image are merged based on the inverse wavelet transform algorithm to obtain a merged image;
[0119] Image enhancement is performed on the merged image using a guided filter to obtain a dehazed image.
[0120] Those skilled in the art will clearly understand that the technical solutions of the embodiments of this application can be implemented by means of software and / or hardware. In this specification, "unit" and "module" refer to software and / or hardware capable of independently completing or cooperating with other components to complete a specific function, wherein the hardware may be, for example, a Field-Programmable Gate Array (FPGA), an Integrated Circuit (IC), etc.
[0121] Each processing unit and / or module in the embodiments of this application can be implemented by an analog circuit that implements the functions described in the embodiments of this application, or by software that executes the functions described in the embodiments of this application.
[0122] Please refer to the following. Figure 4 , Figure 4 A schematic diagram of the structure of an electronic device provided in an embodiment of this specification is shown.
[0123] like Figure 4As shown, the electronic device 400 may include: at least one device processor 401, at least one network interface 404, user interface 403, memory 405, and at least one communication bus 402.
[0124] The communication bus 402 can be used to realize the connection and communication of the above components.
[0125] The user interface 403 may include buttons, and the optional user interface may also include a standard wired interface or a wireless interface.
[0126] Among them, network interface 404 may include, but is not limited to, Bluetooth module, NFC module, Wi-Fi module, etc.
[0127] The device processor 401 may include one or more processing cores. The device processor 401 connects to various parts within the electronic device 400 using various interfaces and lines. It executes various functions and processes data of the electronic device 400 by running or executing instructions, programs, code sets, or instruction sets stored in the memory 405, and by calling data stored in the memory 405. Optionally, the device processor 401 may be implemented using at least one hardware form of DSP, FPGA, or PLA. The device processor 401 may integrate one or more of the following: CPU, GPU, and modem. The CPU primarily handles the operating system, user interface, and applications; the GPU is responsible for rendering and drawing the content required for display; and the modem handles wireless communication. It is understood that the modem may also not be integrated into the device processor 401 and may be implemented as a separate chip.
[0128] The memory 405 may include RAM or ROM. Optionally, the memory 405 may include a non-transitory computer-readable medium. The memory 405 may be used to store instructions, programs, code, code sets, or instruction sets. The memory 405 may include a program storage area and a data storage area, wherein the program storage area may store instructions for implementing an operating system, instructions for at least one function (such as touch function, sound playback function, image playback function, etc.), instructions for implementing the above-described method embodiments, etc.; the data storage area may store data involved in the above-described method embodiments, etc. Optionally, the memory 405 may also be at least one storage device located remotely from the aforementioned device processor 401. Figure 4 As shown, the memory 405, which serves as a computer storage medium, may include an operating system, a network communication module, a user interface module, and program instructions.
[0129] Specifically, the device processor 401 can be used to call the image dehazing application stored in the memory 405 and perform the following operations:
[0130] The original format image is acquired, and exposure gain compensation is applied to the original format image to obtain a color reconstructed image;
[0131] Extract the R channel component of the original image to obtain the first image corresponding to the R channel component;
[0132] The color reconstructed image is decomposed based on the wavelet transform algorithm to obtain the contour layer image and the detail layer image;
[0133] The first image and the contour layer image are fused to obtain a fused image, and the fused image and the detail layer image are subjected to inverse wavelet transform to obtain a dehazed image.
[0134] As an optional embodiment of this specification, the step of performing exposure gain compensation on the original format image to obtain a color reconstructed image includes:
[0135] Determine the defogging intensity appropriate for the current environment;
[0136] Based on the dehazing intensity, the original format image is subjected to exposure gain compensation to obtain a compensated image;
[0137] The compensated image is reconstructed based on the demosaic algorithm to obtain a color reconstructed image.
[0138] As an optional embodiment of this specification, the step of extracting the R-channel component of the original image to obtain the first image corresponding to the R-channel component further includes:
[0139] The brightness of the reconstructed color image is corrected based on the gamma correction algorithm to obtain the corrected image.
[0140] The wavelet transform algorithm is used to decompose the color reconstructed image to obtain a contour layer image and a detail layer image, including:
[0141] The corrected image is decomposed based on the wavelet transform algorithm to obtain the contour layer image and the detail layer image.
[0142] As an optional embodiment of this specification, the step of decomposing the corrected image based on the wavelet transform algorithm to obtain a contour layer image and a detail layer image includes:
[0143] The corrected image is converted to a YUV format image;
[0144] Extract the Y channel component from the YUV format image to obtain the second image corresponding to the Y channel component;
[0145] The second image is decomposed using a wavelet transform algorithm to obtain a contour layer image and a detail layer image.
[0146] As an optional embodiment of this specification, the step of fusing the first image and the contour layer image to obtain a fused image includes:
[0147] Determine the fusion weight ratio between the first image and the contour layer image;
[0148] The fusion scheme corresponding to the fusion weight ratio is determined based on the weighted fusion algorithm;
[0149] The first image and the contour layer image are fused according to the fusion scheme to obtain a fused image.
[0150] As an optional embodiment of this specification, the step of fusing the first image and the contour layer image to obtain a fused image further includes:
[0151] The detail layer image is denoised using a filtering algorithm to obtain a denoised image.
[0152] The step of performing inverse wavelet transform processing on the fused image and the detail layer image to obtain a dehazed image includes:
[0153] The fused image and the denoised image are subjected to inverse wavelet transform to obtain a dehazed image.
[0154] As an optional embodiment of this specification, the step of performing inverse wavelet transform processing on the fused image and the denoised image to obtain a dehazed image includes:
[0155] The fused image and the denoised image are merged based on the inverse wavelet transform algorithm to obtain a merged image;
[0156] Image enhancement is performed on the merged image using a guided filter to obtain a dehazed image.
[0157] This specification also provides a computer-readable storage medium having a computer program stored thereon, which, when executed by a processor, implements the steps of the above-described method. The computer-readable storage medium may include, but is not limited to, any type of disk, including floppy disks, optical disks, DVDs, CD-ROMs, microdrives, as well as magneto-optical disks, ROMs, RAMs, EPROMs, EEPROMs, DRAMs, VRAMs, flash memory devices, magnetic cards or optical cards, nanosystems (including molecular memory ICs), or any type of medium or device suitable for storing instructions and / or data.
[0158] It should be noted that, for the sake of simplicity, the foregoing method embodiments are all described as a series of actions. However, those skilled in the art should understand that this application is not limited to the described order of actions, as some steps may be performed in other orders or simultaneously according to this application. Furthermore, those skilled in the art should also understand that the embodiments described in the specification are preferred embodiments, and the actions and modules involved are not necessarily essential to this application.
[0159] In the above embodiments, the descriptions of each embodiment have different focuses. For parts not described in detail in a certain embodiment, please refer to the relevant descriptions in other embodiments.
[0160] In the several embodiments provided in this application, it should be understood that the disclosed apparatus can be implemented in other ways. For example, the apparatus embodiments described above are merely illustrative; for instance, the division of units is only a logical functional division, and in actual implementation, there may be other division methods. For example, multiple units or components may be combined or integrated into another system, or some features may be ignored or not executed. Furthermore, the coupling or direct coupling or communication connection shown or discussed may be through some service interface; the indirect coupling or communication connection between devices or units may be electrical or other forms.
[0161] The units described as separate components may or may not be physically separate. The components shown as units may or may not be physical units; that is, they may be located in one place or distributed across multiple network units. Some or all of the units can be selected to achieve the purpose of this embodiment according to actual needs.
[0162] Furthermore, the functional units in the various embodiments of this application can be integrated into one processing unit, or each unit can exist physically separately, or two or more units can be integrated into one unit. The integrated unit can be implemented in hardware or as a software functional unit.
[0163] If the integrated unit is implemented as a software functional unit and sold or used as an independent product, it can be stored in a computer-readable storage device (CMD). Based on this understanding, the technical solution of this application, in essence, or the part that contributes to the prior art, or all or part of the technical solution, can be embodied in the form of a software product. This computer software product is stored in a memory and includes several instructions to cause a computer device (which may be a personal computer, server, or network device, etc.) to execute all or part of the steps of the methods described in the various embodiments of this application. The aforementioned memory includes various media capable of storing program code, such as USB flash drives, read-only memory (ROM), random access memory (RAM), portable hard drives, magnetic disks, or optical disks.
[0164] Those skilled in the art will understand that all or part of the steps in the various methods of the above embodiments can be implemented by a program instructing related hardware. The program can be stored in a computer-readable storage medium, which may include: a flash drive, a read-only memory (ROM), a random access memory (RAM), a magnetic disk, or an optical disk, etc.
[0165] The foregoing has described specific embodiments of this specification. Other embodiments are within the scope of the appended claims. In some cases, the actions or steps recited in the claims may be performed in a different order than that shown in the embodiments and may still achieve the desired result. Furthermore, the processes depicted in the drawings do not necessarily require the specific or sequential order shown to achieve the desired result. In some embodiments, multitasking and parallel processing are possible or may be advantageous.
Claims
1. An image defogging method, characterized by, The method comprises: obtaining an original format image, and performing exposure gain compensation on the original format image to obtain a color reconstruction image; extracting an R channel component of the original format image to obtain a first image corresponding to the R channel component; based on a wavelet transform algorithm, decomposing the color reconstruction image to obtain a contour layer image and a detail layer image; fusing the first image and the contour layer image to obtain a fused image, and performing inverse wavelet transform processing on the fused image and the detail layer image to obtain a defogging image; wherein, after the step of extracting the R channel component of the original format image to obtain the first image corresponding to the R channel component, the method further comprises: based on a gamma correction algorithm, performing brightness correction on the color reconstruction image to obtain a corrected image; based on a wavelet transform algorithm, decomposing the color reconstruction image to obtain a contour layer image and a detail layer image, comprising: based on a wavelet transform algorithm, decomposing the corrected image to obtain a contour layer image and a detail layer image; based on a wavelet transform algorithm, decomposing the corrected image to obtain a contour layer image and a detail layer image, comprising: performing format conversion on the corrected image to obtain a YUV format image; extracting a Y channel component in the YUV format image to obtain a second image corresponding to the Y channel component; based on a wavelet transform algorithm, decomposing the second image to obtain a contour layer image and a detail layer image.
2. The method of claim 1, wherein, The step of performing exposure gain compensation on the original format image to obtain a color reconstruction image comprises: determining a defogging intensity corresponding to a current environment; based on the defogging intensity, performing exposure gain compensation on the original format image to obtain a compensated image; based on a demosaic algorithm, reconstructing the compensated image to obtain a color reconstruction image.
3. The method of claim 1, wherein, The step of fusing the first image and the contour layer image to obtain a fused image comprises: determining a fusion weight ratio of the first image and the contour layer image; based on a weight fusion algorithm, determining a fusion scheme corresponding to the fusion weight ratio; fusing the first image and the contour layer image according to the fusion scheme to obtain a fused image.
4. The method of claim 1, wherein, After the step of fusing the first image and the contour layer image to obtain a fused image, the method further comprises: based on a filtering algorithm, denoising the detail layer image to obtain a denoised image; The step of performing inverse wavelet transform processing on the fused image and the detail layer image to obtain a defogging image comprises: performing inverse wavelet transform processing on the fused image and the denoised image to obtain a defogging image.
5. The method of claim 4, wherein, After the step of performing inverse wavelet transform processing on the fused image and the denoised image to obtain a defogging image, the method further comprises: based on a wavelet inverse transform algorithm, merging the fused image and the denoised image to obtain a merged image; based on a guided filter, performing image enhancement on the merged image to obtain a defogging image.
6. An image defogging apparatus characterized by comprising: The device comprises: an acquisition module, configured to obtain an original format image, and perform exposure gain compensation on the original format image to obtain a color reconstruction image; An extraction module is configured to extract an R channel component of the original format image to obtain a first image corresponding to the R channel component; A decomposition module is configured to decompose the color reconstructed image based on a wavelet transform algorithm to obtain a contour layer image and a detail layer image; A fusion module is configured to fuse the first image and the contour layer image to obtain a fused image, and perform inverse wavelet transform processing on the fused image and the detail layer image to obtain a defogged image. The extraction module is specifically configured to: perform brightness correction on the color reconstructed image based on a gamma correction algorithm to obtain a corrected image; the wavelet transform algorithm to decompose the color reconstructed image to obtain a contour layer image and a detail layer image, comprising: decompose the corrected image based on the wavelet transform algorithm to obtain a contour layer image and a detail layer image; The decomposition module is specifically configured to: perform format conversion on the corrected image to obtain a YUV format image; extract a Y channel component in the YUV format image to obtain a second image corresponding to the Y channel component; decompose the second image based on the wavelet transform algorithm to obtain a contour layer image and a detail layer image.
7. An electronic device comprising a memory, a processor, and a computer program stored on the memory and executable on the processor, characterized in that, The processor executes the computer program to realize the steps of the method of any one of claims 1-5.
8. A computer readable storage medium having stored thereon a computer program, the computer readable storage medium having stored therein instructions which, when executed on a computer or processor, cause the computer or processor to perform the steps of the method of any one of claims 1-5.
Citation Information
Patent Citations
Enhancement method of low-illumination color image
CN110276729A
Plant protection fog drop detection method based on HSV color model
CN112381819A