A method and apparatus for dehazing nighttime images based on brightness compensation and layer separation

By using brightness compensation and layer separation, the image is decomposed into structural and texture layers. Combined with brightness compensation and fog density estimation, the problems of halo and block effect in nighttime foggy image processing are solved, achieving high-quality defogging effect.

CN115170404BActive Publication Date: 2025-10-28BEIJING INST OF TECH
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202210586575.0
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2022-05-26
Publication Date
2025-10-28
Estimated Expiration
2042-05-26

AI Technical Summary

Technical Problem

Existing single-image dehazing methods are ineffective in foggy nighttime conditions, especially for large areas of sky and point light sources, where they fail to process images and exhibit halo effects, thus failing to effectively remove the effects of haze.

Method used

By using brightness compensation and layer separation, the image is decomposed into a structure layer and a texture layer. The total variation TV method is used for layer separation. Combining the dark channel prior assumption of brightness compensation and fog density estimation, the local ambient light is estimated and corrected by guided filtering. Finally, the corrected texture layer and structure layer are fused to generate a dehazed image.

Benefits of technology

It effectively reduces the impact of nighttime halos, minimizes blockiness, maintains color fidelity in output images, and improves the quality of nighttime foggy images.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN115170404B_ABST
    Figure CN115170404B_ABST
Patent Text Reader

Abstract

This invention discloses a method and apparatus for dehazing nighttime images based on brightness compensation and layer separation, which can reduce the impact of nighttime halo on scenes and achieve image dehazing processing for nighttime dehazing application scenarios. To achieve the above objective, the technical solution of this invention includes the following steps: Step 1): The input color image is converted into a grayscale image, the low-frequency part of the grayscale image is processed to obtain a nighttime glow image, and the nighttime fog concentration coefficient is calculated based on the low-frequency grayscale image and the glow image. Step 2): The input color image is separated into layers, decomposed into a structure layer and a texture layer. Step 3): The structure layer is dehazed by using a dark channel prior assumption based on brightness compensation and estimating the local ambient light based on fog concentration. Step 4): The texture layer is corrected, and the corrected texture layer is fused with the structure layer to obtain the output image.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention relates to the field of digital image processing technology, specifically to a method and apparatus for dehazing nighttime images based on brightness compensation and layer separation. Background Technology

[0002] Haze is a common natural phenomenon. In hazy conditions, the air contains a large number of fine particles that scatter light, causing a decline in image quality acquired by visible light image acquisition equipment and severely impacting advanced computer vision tasks. At night, the scattering of light by haze on point light sources has an even greater impact on images. Therefore, dehazing is essential to improve the quality of nighttime fog images.

[0003] Current mainstream single-image dehazing methods are based on the dark channel prior assumption of atmospheric scattering models. The dark channel prior assumption states that in most non-sky regions of daytime RGB images, at least one color channel has pixel values ​​that are very low and close to zero. Based on this assumption, the transmittance distribution map can be reconstructed; simultaneously, the pixel values ​​of the brightest areas in the image are extracted as global atmospheric illumination. Using this as a basis, the atmospheric scattering model can be solved inversely, thus restoring a haze-free image. However, the dark channel prior assumption method has significant limitations. It fails for images with large sky areas and cannot restore the detailed texture of large areas of white objects. Under foggy nighttime conditions, atmospheric illumination cannot satisfy the assumption of global consistency; at the same time, the presence of point light sources can cause local overbrightness and halos, making it difficult to effectively dehaze using traditional DCP methods.

[0004] Therefore, there is currently a lack of image processing methods specifically for nighttime defogging applications. Summary of the Invention

[0005] In view of this, the present invention provides a method and apparatus for dehazing nighttime images based on brightness compensation and layer separation, which can reduce the impact of nighttime halo on the scene and realize image dehazing processing for nighttime dehazing application scenarios.

[0006] To achieve the above objectives, the technical solution of the present invention includes the following steps:

[0007] Step 1): Convert the input color image into a grayscale image, process the low-frequency part of the grayscale image to obtain the night glow image, and calculate the night fog concentration coefficient based on the low-frequency grayscale image and the glow image.

[0008] Step 2): Separate the input color image into layers, decomposing it into a structure layer and a texture layer.

[0009] Step 3): Dehaze the structural layer by using a dark channel prior assumption based on brightness compensation and estimating the local ambient light based on fog concentration.

[0010] Step 4): Correct the texture layer and fuse the corrected texture layer with the structure layer to obtain the output image.

[0011] Further, in step 1), the low-frequency portion of the grayscale image is processed to obtain the night glow image, specifically as follows:

[0012] The low-frequency portion of a grayscale image is obtained using guided filtering or a Gaussian low-pass filter.

[0013] The low-frequency portion of the grayscale image is used to estimate the fog concentration.

[0014] Glow layer separation is achieved by utilizing the short-tailed distribution characteristics of the glow layer, which is accomplished by minimizing a first objective function, E(H(x)):

[0015] E(H(x))=∑ x (ρ(H(x)*f 1,2 )+λ((I(x)-H(x))*f3) 2 )

[0016] st0≤H(x)≤I(x)

[0017] In the formula, H(x) represents the output glow-free image, I(x) represents the input image, and f 1,2 f3 represents a first-order derivative filter in both vertical and horizontal directions, f3 represents a second-order Laplace filter, and * represents a convolution operation; ρ(s) is a robust function, s is the parameter in this robust function, and ρ(s) = min(s) 2 ,τ), its function is to retain pixels with large gradients in the input image I, thereby preserving the texture contour information of the image;

[0018] λ((I(x)-H(x))*f3) 2 The L2 regularization term represents the gradient of the glow layer;

[0019] After minimizing the first objective function, H(x) is obtained;

[0020] The glow layer G is then expressed as G(x)=I(x)-H(x); λ is the weight of the second term, the glow layer gradient, and its change has a direct impact on the smoothness of the resulting glow layer.

[0021] Obtain the glow layer LF glow This is a nighttime glow pattern.

[0022] Further, in step 1), the nighttime fog concentration coefficient is calculated based on the low-frequency grayscale image and glow image. The specific calculation method is as follows:

[0023] Nighttime fog concentration coefficient is

[0024] The function f is defined as follows: x is a variable in the function f.

[0025] The fog concentration coefficient represents the glow layer (LF) of a low-frequency image. glow The ratio of the number of pixels with larger pixel values ​​in the medium-frequency image to the number of pixels with larger pixel values ​​in the low-frequency image LF.

[0026] Further, in step 2), the input color image is layer-separated into a structure layer and a texture layer, specifically as follows:

[0027] The layer separation method based on total variation TV decomposes the input color image into structural layer I. struct and texture layer I text .

[0028] The layer separation method is as follows:

[0029] The input color image I is decomposed into structural layers I. S and detail layer I T The two parts can be expressed by the formula:

[0030] I = I S +I T

[0031] Separation based on the total variation TV method is achieved by minimizing a second objective function, which is:

[0032]

[0033] The first item The L2 loss term aligns the colors of the structural layer with the original image; the second term... For gradient operations; I represents the pixel value of the structural layer. i Given the pixel values ​​of the original layer, the image structure layer I is obtained by minimizing the second objective function. S The detail layer I can be obtained by subtracting it from the original image. T .

[0034] Furthermore, in step 3), the structural layer is dehazed by using a dark channel prior assumption based on brightness compensation and estimating the local ambient light based on fog concentration. The dehazing method used is as follows:

[0035] First, determine whether a pixel belongs to the light source region. The formula for this determination is:

[0036]

[0037] Where win-size represents the side length of the square neighborhood of pixel x; To determine the sum of pixel values ​​in the neighborhood of a pixel, Ω x The size of the neighborhood of a pixel is determined by win-size.

[0038] When the sum of pixel values ​​within a local area exceeds a threshold, the location is determined to be near the light source. Pixels located in the light source area are close to the estimate under fog-free conditions, and the pixel values ​​within this range are represented as follows:

[0039]

[0040] I r (x) represents the pixel value of the red channel; I g (x) represents the pixel value of the green channel; I b (x) represents the pixel value of the blue channel; I c (x) represents the average value of the pixel value across the three channels.

[0041] Based on the above two equations, the improved dark channel prior yields the following transmittance distribution formula:

[0042]

[0043] In the formula, A local (x) represents the local ambient light at pixel x, and K represents the magnification factor of the region near the light source. After obtaining the preliminary transmittance distribution, a guided filter is applied to obtain a further transmittance estimate.

[0044] For local light estimation, firstly, the input hazy image I... hazy The brightness channel image I obtained based on the brightness channel prior is obtained separately. BCP And the dark channel image I obtained based on the dark channel prior. DCP Then, by subtracting the two prior images, we obtain the difference map I between the bright and dark channel distributions. CD :

[0045] I CD =I BCP -I DCP

[0046] The prior local windows Ω for the bright and dark channels are selected as 15×15 squares. Based on this, guided filtering is applied for correction, i.e.:

[0047] I refine =guided_filter(I CD I hazy )

[0048] I refine Each pixel value is used as the ambient light level at the corresponding pixel location, and the size of the guided filter radius is dynamically adjusted through an adaptive function based on the fog concentration coefficient.

[0049] The adaptive function g(ρ) based on the fog concentration coefficient is expressed as:

[0050] g(ρ)=e 1.6*ρ / win_size

[0051] The estimated value ρ of the fog concentration coefficient is obtained from step 1), and the local filtering radius of the guided filter is expressed as r = win - size * g(ρ).

[0052] By using guided filtering to locally estimate ambient light and dynamically adjusting the filter radius using the fog concentration coefficient, a more specific ambient light estimate can be obtained, thus achieving defogging of the structural layer.

[0053] Furthermore, the texture layer is modified, and the modified texture layer is fused with the structure layer to obtain the output image. The specific method is as follows:

[0054] The texture layer is modified using a soft matting method; the soft matting method obtains the detail map by constructing a third objective function, which is:

[0055]

[0056] In the formula, m and These represent the corrected detail image M and the uncorrected detail image, respectively. The column vector L is composed of structural layer I. S The generated Laplace matrix.

[0057] The first term in the formula Constraints were added between the before and after detail drawings, the second item. Constraints were added between the detail image and the structure layer to make the corrected detail image closer to the structure layer in terms of structure and outline; α is a blending coefficient in the range of [0,1], and the closer it is to 1, the closer the corrected image is to the structure layer.

[0058] Based on the modified texture layer, the texture layer and the structure layer are merged. The fusion strategy is as follows:

[0059] I output =J struct +10*refined(Itext )

[0060] Among them, J struct This represents the dehazing result of the color image structure layer, where refined indicates the result of the texture layer I. text The result of the correction.

[0061] Another embodiment provides a nighttime image dehazing device based on brightness compensation and layer separation, including the following modules:

[0062] The input image processing module receives the input color image, converts it into a grayscale image, obtains the low-frequency part of the grayscale image, processes it to obtain a night glow image, and calculates the night fog concentration coefficient based on the low-frequency grayscale image and the glow image, which is then sent to the structural layer defogging module.

[0063] The layer separation module receives the input color image and separates it into a structure layer and a texture layer. The structure layer is sent to the structure layer dehazing module, and the texture layer is sent to the texture layer correction module.

[0064] Structural layer dehazing module: The structural layer is dehazed by using a dark channel prior assumption based on brightness compensation and estimating the local ambient light based on the fog concentration coefficient. The dehazed structural layer is then sent to the fusion module.

[0065] The texture layer correction module is used to correct the texture layer, and the corrected texture layer is sent to the blending module.

[0066] The fusion module is used to fuse the corrected texture layer with the dehazed structure layer to obtain the output image.

[0067] Another embodiment provides a storage medium storing computer instructions that are computer readable, characterized in that the instructions, when executed by a processor, can implement the steps in any of the above-described methods for dehazing nighttime images based on brightness compensation and layer separation.

[0068] Another embodiment provides an electronic device including a memory, a processor, and a computer program stored in the memory and executable on the processor, characterized in that the processor executes the program to implement any of the above-described methods for dehazing nighttime images based on brightness compensation and layer separation.

[0069] Beneficial effects:

[0070] 1. The nighttime image dehazing method based on brightness compensation and layer separation provided by this invention reduces the impact of nighttime halos on the scene. After halo layer stripping and block effect processing, the image has almost no block effect in the sky area, and the area of ​​the halo is also significantly reduced. At the same time, since the halo layer is only discarded during grayscale processing, the output color image is not distorted, and the color of the output image is still close to that of the input image.

[0071] 2. The nighttime image dehazing method based on brightness compensation and layer separation provided by this invention uses guided filtering (or Gaussian low-pass filter) to obtain the low-frequency part of the grayscale image. The low-frequency part of the image contains a large number of factors that reduce visibility, such as fog and glow, and the fog concentration can be estimated by utilizing the characteristics of the low-frequency part.

[0072] 3. The nighttime image dehazing method based on brightness compensation and layer separation provided by this invention addresses the enhanced scattering effect of fog on nighttime light. This invention designs a rapid fog concentration coefficient calculation method, namely the fog concentration coefficient ρ calculation formula, where the fog concentration coefficient represents the glow layer LF of the low-frequency image. glow The ratio of the number of pixels with larger pixel values ​​in the mid-range image to the number of pixels with larger pixel values ​​in the low-frequency (LF) image. An estimate of the fog concentration coefficient generated using this method.

[0073] ρ can be used as a reference for the parameters of the global ambient light.

[0074] 4. The nighttime image dehazing method based on brightness compensation and layer separation provided by this invention decomposes the input original color image into structural layer I. S and detail layer I T The process involves two parts, each processed separately to achieve effects such as noise suppression, contrast enhancement, or texture improvement. The input original color image is decomposed into structural layer I. S and detail layer I T The two parts are processed separately to achieve the effects of noise suppression, contrast enhancement, or texture enhancement.

[0075] 5. The nighttime image dehazing method based on brightness compensation and layer separation provided by this invention addresses the complex light sources in nighttime images, which do not satisfy the assumption of globally consistent atmospheric light in traditional dark channel methods. By using brightness compensation at both light source and non-light source locations, it can adaptively handle both situations. Furthermore, by using guided filtering to locally estimate ambient light and dynamically adjusting the filter radius using the fog concentration coefficient, a more specific ambient light estimate can be obtained, thereby further improving the nighttime dehazing effect.

[0076] 6. The nighttime image dehazing device based on brightness compensation and layer separation provided by the present invention includes an input image processing module, a layer separation module, a structural layer dehazing module, a texture layer correction module, and a fusion module. This device reduces the impact of nighttime halos on the scene. After halo layer stripping and block effect processing, the image has almost no block effect in the sky area, and the area of ​​the halo is also significantly reduced. At the same time, since the halo layer is discarded only during grayscale processing, the output color image is not distorted, and the color of the output image is still close to that of the input image. Attached Figure Description

[0077] Figure 1 The flowchart of the nighttime image dehazing method based on brightness compensation and layer separation provided by the present invention is shown. Detailed Implementation

[0078] The present invention will now be described in detail with reference to the accompanying drawings and embodiments.

[0079] Figure 1 This is a flowchart illustrating the implementation process of this example. The implementation of this example includes the following steps:

[0080] Step 1): Convert the input color image to a grayscale image, use the low-frequency part of the grayscale image to obtain the night glow image, and calculate the night fog concentration coefficient based on the low-frequency grayscale image and the glow image.

[0081] In this embodiment of the invention, guided filtering (or Gaussian low-pass filtering) is used to obtain the low-frequency portion of the grayscale image. The low-frequency portion of the image contains numerous factors that reduce visibility, such as fog and glow, and the fog concentration can be estimated using the characteristics of the low-frequency portion. In this invention, glow layer separation is achieved by utilizing the short-tailed distribution characteristics of the glow layer, which is accomplished by minimizing an objective function. This objective function is:

[0082] E(H(x))=Σ x (ρ(H(x)*f 1,2 )+λ((I(x)-H(x))*f3) 2 )

[0083] st0≤H(x)≤I(x)

[0084] In the formula, H(x) represents the output glow-free image, I(x) represents the input image, and f 1,2 f represents the first-order derivative filter in both the vertical and horizontal directions, f3 represents the second-order Laplace filter, and * represents the convolution operation. The first term in equation (3.5) is a robust function, ρ(s) = min(s). 2,τ), its function is to retain pixels with large gradients in the input image I, thereby preserving the texture contour information of the image. The second term in equation (3.5) represents the L2 regularization term of the glow layer gradient. After minimizing the objective function, H(x) can be obtained, and the glow layer G can be expressed as G(x)=I(x)-H(x). λ is the weight of the second term glow layer gradient in the equation, and its change has a direct impact on the smoothness of the obtained glow layer. Here, λ is set to 500. The solution of this equation can be easily obtained by applying semi-quadratic splitting. Therefore, the obtained glow layer LF can be directly obtained. glow .

[0085] To address the enhanced light scattering effect of fog at night, this invention presents a rapid method for calculating the fog concentration coefficient ρ. The formula for calculating the fog concentration coefficient ρ is:

[0086]

[0087] The function f is defined as follows:

[0088]

[0089] The fog concentration coefficient represents the glow layer (LF) of a low-frequency image. glow The ratio of the number of pixels with larger pixel values ​​in the mid-range image to the number of pixels with larger pixel values ​​in the low-frequency image (LF). The estimated fog concentration coefficient ρ generated using this method can serve as a reference for global ambient light parameters and can be used in subsequent steps to dynamically adjust the filter window size.

[0090] Step 2): Based on the total variation TV layer separation method, the input color image is decomposed into structural layer I. struct and texture layer I text .

[0091] Furthermore, the input original color image is decomposed into structural layer I. S and detail layer I T The process involves two parts, each processed separately to achieve effects such as noise suppression, contrast enhancement, or texture improvement. This can be expressed as a formula:

[0092] I = I S +I

[0093] The structure layer retains the basic colors of the original image, including fog, glow, and prominent objects. The texture layer retains the edge and texture information of the image, but has significant noise and block artifacts in flat areas. Separation based on the Total Variation TV method is achieved by minimizing an objective function, which is:

[0094]

[0095] The first term is the L2 loss term, which aligns the colors of the structural layer with the original image; the second term is the gradient operation. By minimizing this objective function, the image structural layer I can be obtained. S The detail layer I can be obtained by subtracting it from the original image. T .

[0096] Step 3): Based on the dark channel prior assumption based on brightness compensation and the local ambient light estimation based on fog concentration, the structural layer I is... struct Perform defogging.

[0097] Furthermore, since the light sources in nighttime images are complex and do not satisfy the assumption of global atmospheric light uniformity in traditional dark channel methods, brightness compensation can adaptively handle both situations at light source and non-light source locations. In addition, by using guided filtering to locally estimate ambient light and dynamically adjusting the filter radius using the fog concentration coefficient, a more specific ambient light estimate can be obtained, thereby further improving the defogging effect at night.

[0098] This invention proposes a method for determining whether a pixel belongs to a light source region. The determination formula is as follows:

[0099]

[0100] Here, `win-size` represents the side length of the square neighborhood of pixel `x`. When the sum of pixel values ​​within a local area exceeds a threshold, the location is determined to be near the light source. Pixels located near the light source are close to the estimate under fog-free conditions, and the pixel values ​​within this range can be represented as:

[0101]

[0102] This pixel value is the average of the three channel pixel values. Based on the above two equations, the transmittance distribution formula obtained from the improved dark channel prior is:

[0103]

[0104] In the formula, A local (x) represents the local ambient light at pixel x, and K represents the magnification factor for the region near the light source, with the aim of further amplifying the transmittance near the light source. In this invention, the value of K is set to 1.4. This method can obtain a preliminary transmittance distribution, and guided filtering and other methods can be applied to obtain a more refined transmittance estimate.

[0105] For local light estimation, firstly, the input hazy image I... hazy The brightness channel image I obtained based on the brightness channel prior is obtained separately. BCP And the dark channel image I obtained based on the dark channel prior. DCPThen, by subtracting the two prior images, we obtain the difference map I between the bright and dark channel distributions. CD :

[0106] I CD =I BCP -I DCP

[0107] In this invention, the size of the prior local window Ω for the bright and dark channels is a 15×15 square. Based on this, guided filtering is applied for correction, i.e.:

[0108] I refine =guided_filter(I CD I hazy )

[0109] I refine Each pixel value is used as the ambient light magnitude at the corresponding pixel location, which avoids the problem of global ambient light failing at night. Generally speaking, the higher the fog concentration, the smaller the filtering radius of the guided filter used to calculate its local ambient light. This invention dynamically adjusts the size of the guided filter radius through an adaptive function based on the fog concentration coefficient. The adaptive function g(ρ) based on the fog concentration coefficient is expressed as:

[0110] g(ρ)=e 1·6*ρ / win_size

[0111] The estimated value ρ of the fog concentration coefficient is obtained from step 1), and the local filtering radius of the guided filter can be simply expressed as r = win - size * g(ρ). After obtaining the estimates of atmospheric illumination and transmittance distribution, the atmospheric scattering model is used to defog the structural layer.

[0112] Step 4): Apply the following to texture layer I text The corrections are made, and the corrected texture layer is then fused with the structure layer to obtain the output image.

[0113] Furthermore, a soft matting method is used to refine the texture layer. Soft matting obtains the detail map by constructing an objective function. The objective function is:

[0114]

[0115] In the formula, m and These represent the corrected detail image M and the uncorrected detail image, respectively. L is a column vector. S It is composed of structural layer I SThe generated Laplacian matrix. The first term in the formula adds constraints between the uncorrected and corrected detail images, and the second term adds constraints between the detail image and the structure layer, making the corrected detail image closer to the structure layer in structure and contour. Based on the corrected texture layer, the texture layer and structure layer are fused. The fusion strategy can be expressed as:

[0116] I output =J struct +10*refined(I text )

[0117] Among them, J struct This represents the dehazing result of the color image structure layer, where refined indicates the result of the texture layer I. text The result of the correction.

[0118] The greatest advantage of this invention is reducing the impact of nighttime halos on the scene. After halo layer stripping and block effect processing, the image shows almost no block effect in the sky area, and the area of ​​the halo is significantly reduced. Simultaneously, since the halo layer is discarded only during grayscale processing, there is no distortion in the output color image; the output image color remains close to the input image. The first column represents the input foggy image, and the second, third, and fourth columns represent the transmittance and dehazing results obtained by DCP, GDCP, and the algorithm proposed in this invention, respectively. It can be seen that DCP and GDCP overestimate the transmittance of nighttime images and make errors in the transmittance estimation of the light source area. The algorithm proposed in this invention, due to light source compensation, can obtain more accurate transmittance in nighttime scenes with multiple light sources, thus obtaining a dehazed image with better dehazing effect and a more natural visual effect.

[0119] Another embodiment of the present invention provides a nighttime image dehazing device based on brightness compensation and layer separation, comprising the following modules:

[0120] The input image processing module receives the input color image, converts it into a grayscale image, processes the low-frequency portion of the grayscale image to obtain a nighttime glow image, and calculates the nighttime fog concentration coefficient based on the low-frequency grayscale image and the glow image, which is then sent to the structural layer defogging module. This can be executed according to the process described in step 1 above.

[0121] The layer separation module is used to receive the input color image and separate it into a structure layer and a texture layer. The structure layer is sent to the structure layer dehazing module, and the texture layer is sent to the texture layer correction module. The process can be executed according to step 2 above.

[0122] Structural layer dehazing module: Based on the dark channel prior assumption based on brightness compensation and the estimation of local ambient light based on the fog concentration coefficient, the structural layer is dehazed and then sent to the fusion module; the process can be executed according to step 3 above.

[0123] The texture layer correction module is used to correct the texture layer, and the corrected texture layer is sent to the blending module; the correction process in step 4 above can be followed.

[0124] The fusion module is used to fuse the corrected texture layer with the dehazed structure layer to obtain the output image. This can be performed following the fusion process described in step 4 above.

[0125] Another embodiment of the present invention provides a storage medium storing computer instructions that are computer readable. When the instructions are executed by a processor, they can implement the steps in the above-described method for dehazing nighttime images based on brightness compensation and layer separation.

[0126] Another embodiment of the present invention provides an electronic device, including a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor executes the program to implement the above-described nighttime image dehazing method based on brightness compensation and layer separation.

[0127] In summary, the above are merely preferred embodiments of the present invention and are not intended to limit the scope of protection of the present invention. Any modifications, equivalent substitutions, improvements, etc., made within the spirit and principles of the present invention should be included within the scope of protection of the present invention.

Claims

1. A nighttime image dehazing method based on brightness compensation and layer separation, characterized in that, The method includes the following steps: Step 1): Convert the input color image into a grayscale image, obtain the low-frequency part of the grayscale image and process it to obtain the night glow image, and calculate the night fog concentration coefficient based on the low-frequency grayscale image and the glow image. Step 2): Perform layer separation on the input color image, decomposing it into a structure layer and a texture layer; Step 3): Dehazing is performed on the structural layer based on the dark channel prior assumption based on brightness compensation and the estimation of local ambient light based on fog concentration; the dehazing method used is as follows: First, determine whether a pixel belongs to the light source region. The formula for this determination is: Where win-size represents the side length of the square neighborhood of pixel x; To determine the sum of pixel values ​​in the neighborhood of a pixel, Ω x The size of the neighborhood of a pixel is determined by win-size; When the sum of pixel values ​​within a local area exceeds a threshold, the location is determined to be near the light source. Pixels located in the light source area are close to the estimate under fog-free conditions, and the pixel values ​​within this range are represented as follows: I r (x) represents the pixel value of the red channel; I g (x) represents the pixel value of the green channel; I b (x) represents the pixel value of the blue channel; I c (x) represents the average value of the pixel value across the three channels; Based on the above two equations, the improved dark channel prior yields the following transmittance distribution formula: In the formula, A local (x) represents the local ambient light at pixel x, and K represents the magnification factor of the region near the light source; after obtaining the preliminary transmittance distribution, a guided filter is applied to obtain a further transmittance estimate. For local light estimation, firstly, the input hazy image I... hazy The brightness channel image I obtained based on the brightness channel prior is obtained separately. BCP And the dark channel image I obtained based on the dark channel prior. DCP Then, by subtracting the two prior images, we obtain the difference map I between the bright and dark channel distributions. CD : I CD =I BCP -I DCP The prior local window Ω for the bright and dark channels is selected as a 15×15 square; based on this, guided filtering needs to be applied for correction, that is: I refine =guided_filter(I CD ,I hazy ) I refine Each pixel value is used as the ambient light level at the corresponding pixel location. The size of the guiding filter radius is dynamically adjusted through an adaptive function based on the fog concentration coefficient. The adaptive function g(ρ) based on the fog concentration coefficient is expressed as: g(ρ)=e 1.6*ρ / win_size The estimated value ρ of the fog concentration coefficient is obtained in step 1), and the local filtering radius of the guided filter is expressed as r = win - size. * g(ρ); By using guided filtering to locally estimate ambient light and dynamically adjusting the filter radius using the fog concentration coefficient, a more specific ambient light estimate can be obtained, thereby achieving defogging of the structural layer; Step 4): Correct the texture layer and fuse the corrected texture layer with the structure layer to obtain the output image.

2. The method according to claim 1, characterized in that, In step 1), the low-frequency portion of the grayscale image is processed to obtain the night glow image, specifically as follows: The low-frequency components of a grayscale image are obtained using guided filtering or a Gaussian low-pass filter. The low-frequency portion of the grayscale image is used to estimate the fog concentration. Glow layer separation is achieved by utilizing the short-tailed distribution characteristics of the glow layer, which is accomplished by minimizing a first objective function, E(H(x)): st0≤H(x)≤I(x) In the formula, H(x) represents the output glow-free image, I(x) represents the input image, and f 1,2 f3 represents a first-order derivative filter in both vertical and horizontal directions, f3 represents a second-order Laplace filter, and * represents a convolution operation; ρ(s) is a robust function, s is the parameter in this robust function, and ρ(s) = min(s) 2 ,τ), its function is to retain pixels with large gradients in the input image I, thereby preserving the texture contour information of the image; λ((I(x)-H(x))*f3) 2 The L2 regularization term represents the gradient of the glow layer; After minimizing the first objective function, H(x) is obtained; The glow layer G is then expressed as G(x)=I(x)-H(x); λ is the weight of the second term, the glow layer gradient, and its change has a direct impact on the smoothness of the resulting glow layer. Obtain the glow layer LF glow This is a nighttime glow pattern.

3. The method according to claim 1, characterized in that... In step 1), the calculation of the nighttime fog concentration coefficient based on the low-frequency grayscale image and glow image is performed using the following method: Nighttime fog concentration coefficient is The function f is defined as follows: x is a variable in function f; The fog concentration coefficient represents the glow layer (LF) of a low-frequency image. glow The ratio of the number of pixels with larger pixel values ​​in the medium-frequency image to the number of pixels with larger pixel values ​​in the low-frequency image LF.

4. The method according to any one of claims 1 to 3, characterized in that, In step 2), the input color image is separated into layers, specifically into a structure layer and a texture layer: The layer separation method based on total variation TV decomposes the input color image into structural layer I. struct and texture layer I text ; The layer separation method is as follows: The input color image I is decomposed into structural layers I. S and detail layer I T The two parts can be expressed by the formula: I=I S +I T Separation based on the total variation TV method is achieved by minimizing a second objective function, which is: The first item The L2 loss term aligns the colors of the structural layer with the original image; the second term... For gradient operations; I represents the pixel value of the structural layer. i Given the pixel values ​​of the original layer, the image structure layer I is obtained by minimizing the second objective function. S The detail layer I can be obtained by subtracting it from the original image. T .

5. The method according to claim 1, characterized in that, The specific method for correcting the texture layer and fusing the corrected texture layer with the structure layer to obtain the output image is as follows: The texture layer is modified using a soft matting method; the soft matting method obtains the detail map by constructing a third objective function, which is: In the formula, m and These represent the corrected detail image M and the uncorrected detail image, respectively. The column vectors Ls are composed of structural layers I. S The generated Laplacian matrix; The first term in the formula Constraints were added between the before and after detail drawings, the second item. Constraints were added between the detail image and the structure layer to make the corrected detail image closer to the structure layer in terms of structure and outline; α is a blending coefficient in the range of [0,1], and the closer it is to 1, the closer the corrected image is to the structure layer; Based on the modified texture layer, the texture layer and the structure layer are merged. The fusion strategy is as follows: I output =J struct +10*refined(I text ) Among them, J struct This represents the dehazing result of the color image structure layer, where refined indicates the result of the texture layer I. text The result of the correction.

6. A nighttime image dehazing device based on brightness compensation and layer separation, characterized in that, The device is used to implement the steps in the night image dehazing method based on brightness compensation and layer separation as described in any one of claims 1 to 5, and includes the following modules: The input image processing module is used to receive the input color image, convert it into a grayscale image, obtain the low-frequency part of the grayscale image, process it to obtain the night glow image, and calculate the night fog concentration coefficient based on the low-frequency grayscale image and the glow image, and send it to the structural layer defogging module. The layer separation module is used to receive the input color image and separate it into a structure layer and a texture layer. The structure layer is sent to the structure layer dehazing module, and the texture layer is sent to the texture layer correction module. Structural layer dehazing module: Based on the dark channel prior assumption based on brightness compensation and the estimation of local ambient light based on the fog concentration coefficient, the structural layer is dehazed and then sent to the fusion module. The texture layer correction module is used to correct the texture layer, and the corrected texture layer is sent to the blending module. The fusion module is used to fuse the corrected texture layer with the dehazed structure layer to obtain the output image.

7. A storage medium storing computer instructions thereon, the storage medium being computer-readable, characterized in that, When the instruction is executed by the processor, it can implement the steps in the nighttime image dehazing method based on brightness compensation and layer separation as described in any one of claims 1 to 5.

8. An electronic device comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, characterized in that, When the processor executes the program, it implements the nighttime image dehazing method based on brightness compensation and layer separation as described in any one of claims 1 to 5.

Citation Information

Patent Citations

  • Single image defogging method based on middle channel compensation and self-adaptive atmospheric light estimation

    CN111161167A

  • Single night image defogging method based on multi-scale decomposition

    CN114170093A