Image defogging method based on atmospheric scattering model and color correction
By employing an atmospheric scattering model and color correction-based image dehazing method, the problems of incomplete dehazing, color cast, and loss of detail information in existing technologies are solved, achieving a more natural dehazing effect and higher dehazing efficiency.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- GUIZHOU AEROSPACE NANHAI SCI & TECH
- Filing Date
- 2025-12-17
- Publication Date
- 2026-05-12
AI Technical Summary
Existing dehazing methods suffer from problems such as color cast, incomplete dehazing, loss of detail, and overall darkening of the image.
An image dehazing method based on atmospheric scattering model and color correction is adopted, including color correction, calculation of atmospheric light value and transmittance value, combined with guided filtering and quadtree segmentation algorithm to perform adaptive brightness and contrast enhancement.
It effectively improves the color cast, incomplete dehazing, and loss of detail in dehazed images, and the restored images are more in line with human visual perception. The process is simple and has low time complexity.
Smart Images

Figure CN122023191A_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of digital image processing technology. Background Technology
[0002] Existing dehazing methods still produce images with color cast, incomplete dehazing, loss of detail, and overall darkness.
[0003] For example, Chinese patent publication number "CN114757850A" discloses an "image dehazing method for eliminating halo effects." The method first obtains an input image and determines the atmospheric light value corresponding to the input image, where the atmospheric light value is a matrix of the same size as the input image. Then, the dark channel transmittance map and the bright channel transmittance map are fused according to a preset ratio to determine the image transmittance map corresponding to the input image. Finally, the atmospheric light value and the image transmittance map are input into an atmospheric scattering model to obtain the output dehazed image. Although this method can eliminate the halo effect in images taken under hazy conditions, the resulting dehazed image still suffers from color cast, incomplete dehazing, loss of detail, and overall image darkness. Summary of the Invention
[0004] The purpose of this invention is to provide an image dehazing method based on an atmospheric scattering model and color correction, which can effectively improve the color cast, incomplete dehazing, loss of detail information, and overall darkening of the image after dehazing of foggy images.
[0005] To address the aforementioned technical problems, this invention provides an image dehazing method based on an atmospheric scattering model and color correction, comprising the following steps: S1. Perform color correction on hazy images with color cast; S2. Calculate the atmospheric light value of the foggy image; S3. Calculate the transmittance value of the foggy image; S4. Based on the atmospheric light value and transmittance value, the defogging image is recovered using an atmospheric scattering model; S5. Obtain the dehazed image after adaptive brightness enhancement and adaptive contrast enhancement.
[0006] Step S1 includes the following steps: S11. Calculate the color cast of a hazy image in Lab space. Color components, Color components and brightness components; S12. Calculate the corrected color-cast hazy image in Lab space. Color components and Color components; S13. Based on the correction in Lab space Color components and Color components, calculating the hazy image after color cast correction. .
[0007] Step S12 includes the following steps: S121, Calculations used for correction Color component correction factor : ,in, Color components The correction factor, Color components According to the luminance component Weighted average: ,in, , Indicates the size of the image. Color components The pixel value of the corresponding pixel. The luminance component corresponds to the luminance value of a pixel. It is a weighted average; S122, Calculations used for correction Color component correction factor : ,in, Color components The correction factor, Color components Based on luminance components Weighted average: ,in, , Indicates the size of the image. Color components The pixel value of the corresponding pixel point. The luminance component corresponds to the luminance value of a pixel. It is a weighted average; S123. Calculate the corrected color components. and : ,in, Indicates the corrected Color components Indicates the corrected Color components Color components The correction factor, Color components The correction factor, and Indicates the color components before correction. =0.9 and =0.6 is a constant coefficient. Color components The absolute deviation of the mean, Color components The absolute deviation of the mean.
[0008] The The color components range from green to red. The color components range from blue to yellow.
[0009] The color components The absolute deviation of the mean is: ,in, Color components The absolute deviation of the mean, , Indicates the size of the image. Color components The pixel value of the corresponding pixel point. Represents color components The mean; Color components The absolute deviation of the mean is: ,in, Color components The absolute deviation of the mean, , Indicates the size of the image. Color components The pixel value of the corresponding pixel point. Represents color components The mean.
[0010] Step S2 includes the following steps: S21. Calculate the improved dark channel map of the hazy image; S22. Improved dark channel image after guided filtering; S23. Based on the improved dark channel map, the region where the atmospheric light value is located is calculated using the quadtree segmentation algorithm.
[0011] Step S21 includes the following steps: S211. Using the SLIC superpixel algorithm to process foggy images. Superpixel blocks obtained by superpixel segmentation: ,in, The number of superpixel blocks. , Indicates the size of the image. Size of the dark channel window: ,in, Size of the dark channel window. , Indicates the size of the image. This is an adjustment parameter with a value of 0.02; S212. First, calculate the dark channel value within each superpixel block. Then, its 5th percentile is used to replace all values in this sub-block to obtain the improved dark channel plot. : ,in, Dark channel values within each superpixel block For color channel indexes.
[0012] Step S22 includes the following steps: S221. Set the input image and guide image for the guided filter. The input image is the improved dark channel image. The guide image is a hazy image after color cast correction. grayscale image : ,in, To guide the image, , , The points are located on the red, green, and blue channels of the image with fog. Pixel values; S222, For each location in the image Calculate the local window centered at that location. The statistics within the image include the mean of the guiding image. and variance The mean of the input image Covariance between the guide image and the input image Among them, the mean of the guiding image for: In the formula, To guide the image, Variance of the guiding image for: , Mean of the input image for: , Covariance between guide image and input image for: ; S223, For each local window Calculate the linear transformation coefficients and bias terms ,in, Linear transformation coefficients for: In the formula, This is the regularization parameter, with a value of 0.15. Bias term for: ; S224. Take the average of the linear coefficients and bias terms for all windows covering the same pixel to obtain the average linear coefficient. and average bias term ; S225. Calculate the improved dark channel plot after guided filtering: , In the formula, This is the improved dark channel image after guided filtering. The average linear coefficients, For the average bias term, A hazy image after color cast correction A grayscale image.
[0013] Step S3 includes the following steps: S31. Calculate the foggy image. The brightness, chromaticity, and saturation values, among which, Foggy images brightness value for: In the formula, Image with fog At pixel The brightness value at that location, , , The points are located on the red, green, and blue channels of the image with fog. pixel values Foggy images chromaticity value for: In the formula, Image with fog At pixel The chromaticity value at that location, , , The points are located on the red, green, and blue channels of the image with fog. pixel values, , , Images with fog The average pixel values of the red, green, and blue channels. Foggy images saturation value for: In the formula, Image with fog At pixel The saturation value at that point, , , The points are located on the red, green, and blue channels of the image with fog. pixel values, Image with fog The global average values of the red, green, and blue channels. Foggy images Global average values of red, green, and blue channels for: , ; S32. Use an exponential decay model to fit a foggy image. The relationship between brightness, chromaticity, saturation and fog concentration , and Then calculate the fog concentration value. ,in, Foggy images The relationship between brightness and fog concentration for: In the formula, Image with fog The relationship between brightness and fog concentration, Image with fog At pixel The brightness value at that location, =1.2 represents the parameters of the exponential decay model. Foggy images The relationship between chromaticity and fog concentration for: In the formula, Image with fog The relationship between chromaticity and fog concentration, Image with fog At pixel The chromaticity value at that location, =1.5 is the parameter for the exponential decay model. Foggy images The relationship between saturation and fog concentration for: In the formula, Image with fog The relationship between saturation and fog concentration, Image with fog At pixel The saturation value at that point, =2.0 represents the parameters of the exponential decay model. fog concentration value for: ; S33. Calculate the foggy image. transmittance value : In the formula, Image with fog The transmittance value, Image with fog The fog concentration value, is the atmospheric scattering coefficient, with a value of 0.95.
[0014] Step S5 includes the following steps: S51. First, obtain the brightness image of the dehazed image. Then, use logarithmic transformation to process the brightness image to achieve adaptive adjustment of the brightness dynamic range. Dehazed images Brightness image for: In the formula, , , The points are located on the red, green, and blue channels of the dehazed image, respectively. pixel values, Brightness image after adaptive brightness enhancement for: In the formula, The brightness image of the dehazed image. The parameter is a constant. =3; S52. Brightness images after adaptive brightness enhancement at different scales By performing Gaussian kernel convolution operations at different scales, a blurred image is obtained. : In the formula, For the first Gaussian convolution kernels of various scales: In the formula, The Gaussian function scaling factor. It is a normalization factor, and the normalization factor conform to: , Then the Laplace response at each scale is calculated. : In the formula, The Laplace operator is used in a four-neighbor discrete form, specifically as follows: , Then calculate the adaptive gamma correction parameters. The expression is as follows: , In the formula, For the first The maximum absolute value of the Laplace response at each scale. As a detail protection factor and , For blurred images, The Laplace response at each scale, Then, the contrast-enhanced images at different scales were calculated. : , in, To enhance the contrast of images at different scales, For the brightness image after adaptive brightness enhancement, For adaptive gamma correction parameters, Finally, image enhancement at different scales was utilized. The average Laplacian response value is used as a weight to obtain the final adaptive contrast-enhanced dehazed image. : , , , In the formula, , Indicates the size of the image.
[0015] Compared with the prior art, the present invention can restore the color of the dehazed image to a natural state and improve the phenomena of color cast, incomplete dehazing, loss of detail information and overall darkness of the image. The restored dehazed image is more in line with human visual perception. At the same time, the process is simple, the time complexity is low, and the dehazing efficiency is better.
[0016] The above description is merely an overview of the technical solution of the present invention. In order to better understand the technical means of the present invention and to implement it in accordance with the contents of the specification, and in order to make the above and other objects, features and advantages of the present invention more apparent and understandable, specific embodiments of the present invention are described below. Attached Figure Description
[0017] One or more embodiments are illustrated by way of example with reference numerals in the accompanying drawings. These illustrations do not constitute a limitation on the embodiments. Elements with the same reference numerals in the drawings are denoted as similar elements. Unless otherwise stated, the figures in the drawings are not to be limited by scale.
[0018] Figure 1 This is a flowchart illustrating at least one embodiment of the present invention; Figure 2 This is a flowchart illustrating step S1 in at least one embodiment of the present invention; Figure 3 This is a flowchart illustrating step S2 in at least one embodiment of the present invention; Figure 4 This is a flowchart illustrating step S3 in at least one embodiment of the present invention; Figure 5 This is a flowchart illustrating step S5 in at least one embodiment of the present invention. Detailed Implementation
[0019] To make the objectives, technical solutions, and advantages of this invention clearer, the embodiments of this invention will be described in detail below with reference to the accompanying drawings. However, those skilled in the art will understand that many technical details are presented in the embodiments of this invention to facilitate a better understanding of this application. However, the technical solutions claimed in this application can be implemented even without these technical details and various variations and modifications based on the following embodiments. The division of the following embodiments is for ease of description and should not constitute any limitation on the specific implementation of this invention. The embodiments can be combined with and referenced by each other without contradiction.
[0020] Example 1 like Figure 1 The image dehazing method shown includes the following steps: (The method is based on an atmospheric scattering model and color correction.) S1. Perform color correction on hazy images with color cast; S2. Calculate the atmospheric light value of the foggy image; S3. Calculate the transmittance value of the foggy image; S4. Based on the atmospheric light value and transmittance value, the defogging image is recovered using an atmospheric scattering model; S5. Obtain the dehazed image after adaptive brightness enhancement and adaptive contrast enhancement.
[0021] Furthermore, step S1 includes the following steps: S11. Calculate the color cast of a hazy image in Lab space. Color components, Color components and brightness components; S12. Calculate the corrected color-cast hazy image in Lab space. Color components and Color components; S13. Based on the correction in Lab space Color components and Color components, calculating the hazy image after color cast correction. .
[0022] Example 2 Based on Example 1, step S12 includes the following steps: S121, Calculations used for correction Color component correction factor : ,in, Color components The correction factor, Color components According to the luminance component Weighted average: ,in, , Indicates the size of the image. Color components The pixel value of the corresponding pixel point. The luminance component corresponds to the luminance value of a pixel. It is a weighted average; S122, Calculations used for correction Color component correction factor : ,in, Color components The correction factor, Color components Based on luminance components Weighted average: ,in, , Indicates the size of the image. Color components The pixel value of the corresponding pixel point. The luminance component corresponds to the luminance value of a pixel. It is a weighted average; S123. Calculate the corrected color components. and : ,in, Indicates the corrected Color components Indicates the corrected Color components Color components The correction factor, Color components The correction factor, and Indicates the color components before correction. =0.9 and =0.6 is a constant coefficient. Color components The absolute deviation of the mean, Color components The absolute deviation of the mean.
[0023] Furthermore, The color components range from green to red. The color components range from blue to yellow.
[0024] Furthermore, color components The absolute deviation of the mean is: ,in, Color components The absolute deviation of the mean, , Indicates the size of the image. Color components The pixel value of the corresponding pixel point. Represents color components The mean; Color components The absolute deviation of the mean is: ,in, Color components The absolute deviation of the mean, , Indicates the size of the image. Color components The pixel value of the corresponding pixel point. Represents color components The mean.
[0025] Example 3 Based on Example 1, step S2 includes the following steps: S21. Calculate the improved dark channel map of the hazy image; S22. Improved dark channel image after guided filtering; S23. Based on the improved dark channel map, the region where the atmospheric light value is located is calculated using the quadtree segmentation algorithm.
[0026] Furthermore, step S21 includes the following steps: S211. Using the SLIC superpixel algorithm to process foggy images. Superpixel blocks obtained by superpixel segmentation: ,in, The number of superpixel blocks. , Indicates the size of the image. Size of the dark channel window: ,in, Size of the dark channel window. , Indicates the size of the image. This is an adjustment parameter with a value of 0.02; S212. First, calculate the dark channel value within each superpixel block. Then, its 5th percentile is used to replace all values in this sub-block to obtain the improved dark channel plot. : ,in, Dark channel values within each superpixel block For color channel indexes.
[0027] Furthermore, step S22 includes the following steps: S221. Set the input image and guide image for the guided filter. The input image is the improved dark channel image. The guide image is a hazy image after color cast correction. grayscale image : ,in, To guide the image, , , The points are located on the red, green, and blue channels of the image with fog. Pixel values; S222, For each location in the image Calculate the local window centered at that location. The statistics within the image include the mean of the guiding image. and variance The mean of the input image Covariance between the guide image and the input image Among them, the mean of the guiding image for: In the formula, To guide the image, Variance of the guiding image for: , Mean of the input image for: , Covariance between guide image and input image for: ; S223, For each local window Calculate the linear transformation coefficients and bias terms ,in, Linear transformation coefficients for: In the formula, This is the regularization parameter, with a value of 0.15. Bias term for: ; S224. Take the average of the linear coefficients and bias terms for all windows covering the same pixel to obtain the average linear coefficient. and average bias term ; S225. Calculate the improved dark channel plot after guided filtering: , In the formula, This is the improved dark channel image after guided filtering. The average linear coefficients, For the average bias term, A hazy image after color cast correction A grayscale image.
[0028] Example 4 Based on Example 1, step S3 includes the following steps: S31. Calculate the foggy image. The brightness, chromaticity, and saturation values, among which, Foggy images brightness value for: In the formula, Image with fog At pixel The brightness value at that location, , , The points are located on the red, green, and blue channels of the image with fog. pixel values Foggy images chromaticity value for: In the formula, Image with fog At pixel The chromaticity value at that location, , , The points are located on the red, green, and blue channels of the image with fog. pixel values, , , Images with fog The average pixel values of the red, green, and blue channels. Foggy images saturation value for: In the formula, Image with fog At pixel The saturation value at that point, , , The points are located on the red, green, and blue channels of the image with fog. pixel values, Image with fog The global average values of the red, green, and blue channels. Foggy images Global average values of red, green, and blue channels for: , ; S32. Use an exponential decay model to fit a foggy image. The relationship between brightness, chromaticity, saturation and fog concentration , and Then calculate the fog concentration value. ,in, Foggy images The relationship between brightness and fog concentration for: In the formula, Image with fog The relationship between brightness and fog concentration, Image with fog At pixel The brightness value at that location, =1.2 represents the parameters of the exponential decay model. Foggy images The relationship between chromaticity and fog concentration for: In the formula, Image with fog The relationship between chromaticity and fog concentration, Image with fog At pixel The chromaticity value at that location, =1.5 is the parameter for the exponential decay model. Foggy images The relationship between saturation and fog concentration for: In the formula, Image with fog The relationship between saturation and fog concentration, Image with fog At pixel The saturation value at that point, =2.0 represents the parameters of the exponential decay model. fog concentration value for: ; S33. Calculate the foggy image. transmittance value : In the formula, Image with fog The transmittance value, Image with fog The fog concentration value, is the atmospheric scattering coefficient, with a value of 0.95.
[0029] Furthermore, step S5 includes the following steps: S51. First, obtain the brightness image of the dehazed image. Then, use logarithmic transformation to process the brightness image to achieve adaptive adjustment of the brightness dynamic range. Dehazed images Brightness image for: In the formula, , , The points are located on the red, green, and blue channels of the dehazed image, respectively. pixel values, Brightness image after adaptive brightness enhancement for: In the formula, The brightness image of the dehazed image. The parameter is a constant. =3; S52. Brightness images after adaptive brightness enhancement at different scales By performing Gaussian kernel convolution operations at different scales, a blurred image is obtained. : In the formula, For the first Gaussian convolution kernels of various scales: In the formula, The Gaussian function scaling factor. It is a normalization factor, and the normalization factor conform to: , Then the Laplace response at each scale is calculated. : In the formula, The Laplace operator is used in a four-neighbor discrete form, specifically as follows: , Then calculate the adaptive gamma correction parameters. The expression is as follows: , In the formula, For the first The maximum absolute value of the Laplace response at each scale. As a detail protection factor and , For blurred images, The Laplace response at each scale, Then, the contrast-enhanced images at different scales were calculated. : , in, To enhance the contrast of images at different scales, For the brightness image after adaptive brightness enhancement, For adaptive gamma correction parameters, Finally, image enhancement at different scales was utilized. The average Laplacian response value is used as a weight to obtain the final adaptive contrast-enhanced dehazed image. : , , , In the formula, , Indicates the size of the image.
[0030] Example 5 In conjunction with the above embodiments, the following steps are included: Step 1, color correction flowchart for hazy images with color cast as shown below Figure 2 As shown, the specific steps are as follows: Step 1.1: Obtain the color-biased, hazy image in Lab space. , And the luminance component. The hazy image with color cast is converted from RGB space to Lab space, and the image's luminance component is extracted. Color components (color components from green to red) Color components (from blue to yellow) and luminance components .
[0031] Step 1.2: Obtain the corrected image of the hazy image with color cast in Lab space. Color components and Color components.
[0032] Step 1.2.1, calculate the values used for correction. Color component correction factor Its expression is as follows: in, Color components The correction factor, Color components Based on luminance components The weighted average is expressed as follows: in, , Indicates the size of the image. Color components The pixel value of the corresponding pixel point. This represents the brightness value of the corresponding pixel. This is a weighted average.
[0033] Step 1.2.2, calculate the values used for correction. Color component correction factor Its expression is as follows: in, Color components The correction factor, Color components Based on luminance components The weighted average is expressed as follows: in, , Indicates the size of the image. Color components The pixel value of the corresponding pixel point. This represents the brightness value of the corresponding pixel. This is a weighted average.
[0034] Step 1.2.3: Calculate the corrected color components. Based on the correction coefficients... and correction factor Calculate the corrected color components and The expression is as follows: in, Indicates the corrected Color components Indicates the corrected Color components Color components The correction factor, Color components The correction factor, and Indicates the color components before correction. =0.9 and =0.6 is a constant coefficient. Color components The absolute deviation of the mean is expressed as follows: in, Color components The absolute deviation of the mean, , Indicates the size of the image. Color components The pixel value of the corresponding pixel point. Represents color components The mean.
[0035] Color components The absolute deviation of the mean is expressed as follows: in, Color components The absolute deviation of the mean, , Indicates the size of the image. Color components The pixel value of the corresponding pixel point. Represents color components The mean.
[0036] Step 1.3: Obtain the hazy image after color cast correction. Based on the corrected color components obtained in step 1.2.3 and Combined with the luminance component from step 1.1 The image is converted from Lab color space back to RGB color space to obtain a color-corrected hazy image. Then proceed with the subsequent defogging process.
[0037] Step 2, the flowchart for estimating atmospheric light values in foggy images is as follows: Figure 3 As shown, the specific steps are as follows: Step 2.1: Obtain the improved dark channel image of the hazy image.
[0038] Step 2.1.1: Use the SLIC superpixel algorithm to process the foggy image. The superpixel blocks obtained by superpixel segmentation. The expression for the number of superpixel blocks is as follows: in, The number of superpixel blocks. , Indicates the size of the image. The expression for the size of the dark channel window is as follows: in, Size of the dark channel window. , Indicates the size of the image. This is an adjustment parameter with a value of 0.02.
[0039] Step 2.1.2: First, calculate the dark channel value within each superpixel block. (Minimum RGB channel value for each pixel), then replace all values of this sub-block with its 5th percentile to obtain the improved dark channel map. The expression for calculating the dark channel value within each superpixel block is as follows: in, Dark channel values within each superpixel block For color channel indexes.
[0040] Step 2.2: Obtain the improved dark channel image after guided filtering.
[0041] Step 2.2.1: Set the input image and guide image for the guided filter.
[0042] The input image is the improved dark channel image obtained in step 2.1.2. The guide image is a hazy image after color cast correction. grayscale image The expression is as follows: in, To guide the image, , , The points are located on the red, green, and blue channels of the image with fog. The pixel value.
[0043] Step 2.2.2: Calculate the statistics of the local window in the image. For each location in the image... Calculate the local window centered at that location. (Window size is) Statistics within ) including the mean of the guide image. and variance The mean of the input image Covariance between the guide image and the input image .
[0044] Mean of the guiding image The expression is as follows: Variance of the guiding image The expression is as follows: Mean of the input image The expression is as follows: Covariance between guide image and input image The expression is as follows: Step 2.2.3: Calculate the linear coefficients and bias terms. For each local window... Calculate the linear transformation coefficients and bias terms .
[0045] Linear transformation coefficients The expression is as follows: in, This is the regularization parameter, with a value of 0.15.
[0046] Bias term The expression is as follows: Step 2.2.4: Calculate the average linear coefficient and the average bias term. Since each pixel is covered by multiple windows, the average linear coefficient and bias term of all windows covering the same pixel are averaged to obtain the average linear coefficient. and average bias term .
[0047] Average linear coefficient The expression is as follows: Average bias term The expression is as follows: Step 2.2.5: Calculate the improved dark channel image after guided filtering.
[0048] in, This is the improved dark channel image after guided filtering. The average linear coefficients, For the average bias term, A hazy image after color cast correction A grayscale image.
[0049] Step 2.3: Perform a quadtree segmentation algorithm on the improved dark channel image obtained in Step 2.2.5 after guided filtering to obtain the region containing atmospheric light values. Within this region, select the region where the distance | The average value of the RGB three channels of the smallest pixel is used as an estimate of atmospheric light. The specific steps are as follows: (1) The improved dark channel image after guided filtering is divided into four sub-rectangular regions on an average basis; (2) Calculate the pixel average and standard deviation of the four sub-rectangular regions, and then calculate the pixel average minus the pixel standard deviation of the sub-rectangular regions to obtain the score of each region; (3) Obtain the region with the smallest score and then divide it into four equal regions; (4) Repeat steps (2) and (3). When the area of the region with the smallest score is less than 200 pixels, stop the segmentation and determine that the region is the region where the atmospheric light value is located. (5) Make the distance in the region where the atmospheric light value is located equal to | The average value of the RGB three channels of the smallest pixel is used as an estimate of atmospheric light. .
[0050] Step 3, the flowchart for estimating the transmittance value of the hazy image is as follows: Figure 4 As shown, the specific steps are as follows: Step 3.1, Calculate the foggy image The brightness, chromaticity, and saturation values.
[0051] Foggy images brightness value The expression is as follows: in, Image with fog At pixel The brightness value at that location, , , The points are located on the red, green, and blue channels of the image with fog. The pixel value.
[0052] Foggy images chromaticity value The expression is as follows: in, Image with fog At pixel The chromaticity value at that location, , , The points are located on the red, green, and blue channels of the image with fog. pixel values, , , Images with fog The average pixel values of the red, green, and blue channels.
[0053] Foggy images saturation value The expression is as follows: in, Image with fog At pixel The saturation value at that point, , , The points are located on the red, green, and blue channels of the image with fog. pixel values, Image with fog The global average value of the red, green, and blue channels is expressed as follows: Step 3.2, calculate the foggy image. The fog concentration value. An exponential decay model is used to fit the fog image. The relationship between brightness, chromaticity, saturation and fog concentration , and The final fog concentration value is obtained by calculating the geometric mean of the three values. .
[0054] Foggy images The relationship between brightness and fog concentration The expression is as follows: in, Image with fog The relationship between brightness and fog concentration, Image with fog At pixel The brightness value at that location, =1.2 represents the parameters of the exponential decay model.
[0055] Foggy images The relationship between chromaticity and fog concentration The expression is as follows: in, Image with fog The relationship between chromaticity and fog concentration, Image with fog At pixel The chromaticity value at that location, =1.5 represents the parameters of the exponential decay model.
[0056] Foggy images The relationship between saturation and fog concentration The expression is as follows: in, Image with fog The relationship between saturation and fog concentration, Image with fog At pixel The saturation value at that point, =2.0 represents the parameters of the exponential decay model.
[0057] Final fog concentration value The expression is as follows: = Step 3.3, Calculate the foggy image The transmittance value. Based on the relationship between the transmittance value and the fog concentration value of the fog image, the transmittance value of the fog image is obtained. transmittance value The expression is as follows: in, Image with fog The transmittance value, Image with fog The fog concentration value, is the atmospheric scattering coefficient, with a value of 0.95.
[0058] Step 4: Obtain the dehazed image. Reconstruct the dehazed image using the atmospheric scattering model. Substitute the atmospheric light and transmittance values of the hazy image estimated in Steps 2 and 3 into the atmospheric scattering model for solution to obtain the dehazed image. The expression is as follows: in, For dehazed images, For images with fog, The atmospheric light values for the foggy image. This represents the transmittance value of a foggy image. The lower limit threshold for transmittance is set, and .
[0059] The RESIDE dataset was used in the dehazing process. The RESIDE dataset comprises synthetic and real-world foggy images, and consists of five... subset Composition: Indoor Training Set (ITS), Outdoor Training Set (OTS), Integrated Objective Test Set (SOTS), Real-World Task-Driven Test Set (RTTS), and Hybrid Subjective Test Set (HSTS). ITS, OTS, and SOTS are synthetic datasets, RTTS is a real-world dataset, and HSTS consists of synthetic and real foggy images.
[0060] Step 5, the flowchart for obtaining the dehazed image after adaptive brightness enhancement and adaptive contrast enhancement is as follows: Figure 5 As shown, the specific steps are as follows: Step 5.1: Obtain the dehazed image with adaptive brightness enhancement. First, obtain the brightness image of the dehazed image, and then use logarithmic transformation to process the brightness image to achieve adaptive adjustment of the brightness dynamic range.
[0061] Step 5.1.1, Obtain the dehazed image The brightness image is expressed as follows: in, The brightness image of the dehazed image. , , The points are located on the red, green, and blue channels of the dehazed image, respectively. The pixel value.
[0062] Step 5.1.2: The luminance image is processed using logarithmic transformation to achieve adaptive adjustment of the dynamic range of luminance. The expression is as follows: in, This is the brightness image after adaptive brightness enhancement. The brightness image of the dehazed image. The parameter is a constant. =3, and The larger the value, the more significant the increase in brightness.
[0063] Step 5.2: Obtain the dehazed image after adaptive contrast enhancement. Adaptive contrast enhancement is applied to the brightness image obtained in Step 5.1 using adaptive gamma correction to obtain the dehazed image after adaptive contrast enhancement.
[0064] Step 5.2.1: Adjust the brightness image after adaptive brightness enhancement at different scales. By performing Gaussian kernel convolution operations at different scales, a blurred image is obtained. The expression is as follows: in, For the first The Gaussian convolution kernel of scale is expressed as follows: in, The Gaussian function scaling factor. The normalization factor is expressed as follows: Step 5.2.2, calculate the Laplace response at each scale. The expression is as follows: in, The Laplace operator, in four-neighborhood discrete form, is expressed as follows: Step 5.2.3: Calculate the adaptive gamma correction parameters. To preserve image details while enhancing contrast, a Laplacian response is introduced to adaptively adjust the gamma parameters, defining the adaptive gamma correction parameters. The expression is as follows: in, That is, the first The maximum absolute value of the Laplace response at each scale. As a detail protection factor and In this invention =0.5, For blurred images, The Laplace response at each scale.
[0065] Step 5.2.4 yields contrast-enhanced images at different scales. Adaptive gamma correction is used to enhance the brightness of the image after adaptive brightness enhancement. Multi-scale contrast enhancement is expressed as follows: in, To enhance the contrast of images at different scales, For the brightness image after adaptive brightness enhancement, These are the adaptive gamma correction parameters.
[0066] Step 5.2.5 yields the final dehazed image after adaptive contrast enhancement. To achieve better image enhancement results, the image is enhanced at different scales. The average Laplacian response value is used as a weight to obtain the final adaptive contrast-enhanced dehazed image. The expression is as follows: in, The weight value is expressed as follows: in, For the first The average absolute value of the Laplacian response of the enhanced image at each scale is expressed as follows: in, , Indicates the size of the image.
[0067] Step 6: Select peak signal-to-noise ratio and structural similarity as evaluation metrics to assess the quality of the dehazed image; select processor computation time as the efficiency measure.
[0068] Peak signal-to-noise ratio (PSNR) This is used to measure the distortion of the output dehazed image compared to a reference haze-free image. A higher value indicates less distortion and better image restoration. The peak signal-to-noise ratio (PSNR) is calculated as follows: in, Mean squared error (MSE) is a measure of the difference between the estimator and the estimated quantity. Its calculation formula is shown below: in, The height of the image. The width of the image. For dehazed images, A fog-free image for reference.
[0069] Structural similarity ( This is used to compare the structural similarity between the output hazy image and the input hazy image. Its value ranges from [0,1]. The larger the value, the more similar the output hazy image is to the input hazy image, and the better the quality of the resulting hazy image. The formula for calculating structural similarity is shown below: in, , Images The average value, , Images variance For image covariance, , It is a positive number.
[0070] Based on the verification in step 6, the numerical results of the indicators compared with those of the prior art and this embodiment are shown in Table 1: Table 1 Comparison of Relevant Indicators
[0071] As can be seen, by calculating the relevant evaluation indicators of the image obtained under the same conditions and with the prior art, the feasibility and superiority of this embodiment are verified. It has a higher peak signal-to-noise ratio and structural similarity than the prior art, and the running time of this embodiment is shortened by 0.6516s compared with the prior art.
[0072] Therefore, this invention effectively improves the color cast, incomplete dehazing, loss of detail, and overall darkening of foggy images after dehazing. It employs superpixel segmentation to obtain an improved dark channel image of the foggy image, then applies guided filtering to weaken the impact of edges and noise on atmospheric light value estimation. A quadtree segmentation algorithm is then executed on the improved dark channel image after guided filtering to obtain the atmospheric light value of the foggy image, avoiding interference from small white objects in the image. An exponential decay model is used to fit the relationship between the brightness, chroma, saturation, and fog density of the foggy image, calculating the geometric values of these three parameters. The fog concentration value of the foggy image is obtained by averaging. Then, based on the relationship between the transmittance value and the fog concentration value of the foggy image, the transmittance value of the foggy image is calculated, thereby improving the phenomenon of incomplete defogging and loss of detail in the defogging image. Logarithmic transformation is used to process the brightness image of the defogging image to achieve adaptive adjustment of the brightness dynamic range, so as to improve the overall darkness of the defogging image when using the traditional atmospheric scattering model to defogging the foggy image. When using adaptive gamma correction to achieve adaptive contrast enhancement of the brightness image after brightness enhancement, the Laplacian response on the image at different scales is selected as a weighting factor to retain more image information.
[0073] Those skilled in the art will understand that the above embodiments can be modified in form and detail in practical applications without departing from the spirit and scope of the invention.
Claims
1. An image dehazing method based on atmospheric scattering model and color correction, characterized in that, Includes the following steps: S1. Perform color correction on hazy images with color cast; S2. Calculate the atmospheric light value of the foggy image; S3. Calculate the transmittance value of the foggy image; S4. Based on the atmospheric light value and transmittance value, the defogging image is recovered using an atmospheric scattering model; S5. Obtain the dehazed image after adaptive brightness enhancement and adaptive contrast enhancement.
2. The image dehazing method based on atmospheric scattering model and color correction as described in claim 1, characterized in that, Step S1 includes the following steps: S11. Calculate the color cast of a hazy image in Lab space. Color components, Color components and brightness components; S12. Calculate the corrected color-cast hazy image in Lab space. Color components and Color components; S13. Based on the correction in Lab space Color components and Color components, calculating the hazy image after color cast correction. .
3. The image dehazing method based on atmospheric scattering model and color correction as described in claim 2, characterized in that, Step S12 includes the following steps: S121, Calculations used for correction Color component correction factor : ,in, Color components The correction factor, Color components According to the luminance component Weighted average: ,in, , Indicates the size of the image. Color components The pixel value of the corresponding pixel. The luminance component corresponds to the luminance value of a pixel. It is a weighted average; S122, Calculations used for correction Color component correction factor : ,in, Color components The correction factor, Color components Based on luminance components Weighted average: ,in, , Indicates the size of the image. Color components The pixel value of the corresponding pixel. The luminance component corresponds to the luminance value of a pixel. It is a weighted average; S123. Calculate the corrected color components. and : ,in, Indicates the corrected Color components Indicates the corrected Color components Color components The correction factor, Color components The correction factor, and Indicates the color components before correction. =0.9 and =0.6 is a constant coefficient. Color components The absolute deviation of the mean, Color components The absolute deviation of the mean.
4. The image dehazing method based on atmospheric scattering model and color correction as described in claim 2, characterized in that, The The color components range from green to red. The color components range from blue to yellow.
5. The image dehazing method based on atmospheric scattering model and color correction as described in claim 3, characterized in that, The color components The absolute deviation of the mean is: ,in, Color components The absolute deviation of the mean, , Indicates the size of the image. Color components The pixel value of the corresponding pixel. Represents color components The mean; Color components The absolute deviation of the mean is: ,in, Color components The absolute deviation of the mean, , Indicates the size of the image. Color components The pixel value of the corresponding pixel. Represents color components The mean.
6. The image dehazing method based on atmospheric scattering model and color correction as described in claim 1, characterized in that, Step S2 includes the following steps: S21. Calculate the improved dark channel map of the hazy image; S22. Improved dark channel image after guided filtering; S23. Based on the improved dark channel map, the region where the atmospheric light value is located is calculated using the quadtree segmentation algorithm.
7. The image dehazing method based on atmospheric scattering model and color correction as described in claim 1, characterized in that, Step S21 includes the following steps: S211. Using the SLIC superpixel algorithm to process foggy images. Superpixel blocks obtained by superpixel segmentation: ,in, The number of superpixel blocks. , Indicates the size of the image. Size of the dark channel window: ,in, Size of the dark channel window. , Indicates the size of the image. This is an adjustment parameter with a value of 0.02; S212, First, calculate the dark channel value within each superpixel block. Then, its 5th percentile is used to replace all values in this sub-block to obtain the improved dark channel plot. : ,in, Dark channel values within each superpixel block For color channel indexes.
8. The image dehazing method based on atmospheric scattering model and color correction as described in claim 1, characterized in that, Step S22 includes the following steps: S221. Set the input image and guide image for the guided filter. The input image is the improved dark channel image. The guide image is a hazy image after color cast correction. grayscale image : ,in, To guide the image, , , The points are located on the red, green, and blue channels of the image with fog. Pixel values; S222, For each location in the image Calculate the local window centered at that location. The statistics within the image include the mean of the guiding image. and variance The mean of the input image Covariance between the guide image and the input image Among them, the mean of the guiding image for: In the formula, To guide the image, Variance of the guiding image for: , Mean of the input image for: , Covariance between guide image and input image for: ; S223, For each local window Calculate the linear transformation coefficients and bias terms ,in, Linear transformation coefficients for: In the formula, This is the regularization parameter, with a value of 0.
15. Bias term for: ; S224. Take the average of the linear coefficients and bias terms for all windows covering the same pixel to obtain the average linear coefficient. and average bias term ; S225. Calculate the improved dark channel plot after guided filtering: , In the formula, This is the improved dark channel image after guided filtering. The average linear coefficients, For the average bias term, A hazy image after color cast correction A grayscale image.
9. The image dehazing method based on atmospheric scattering model and color correction as described in claim 1, characterized in that, Step S3 includes the following steps: S31. Calculate the foggy image. The brightness, chromaticity, and saturation values, among which, Foggy images brightness value for: In the formula, Image with fog At pixel The brightness value at that location, , , The points are located on the red, green, and blue channels of the image with fog. pixel values Foggy images chromaticity value for: In the formula, Image with fog At pixel The chromaticity value at that location, , , The points are located on the red, green, and blue channels of the image with fog. pixel values, , , Images with fog The average pixel values of the red, green, and blue channels. Foggy images saturation value for: In the formula, Image with fog At pixel The saturation value at that point, , , The points are located on the red, green, and blue channels of the image with fog. pixel values, Image with fog The global average values of the red, green, and blue channels. Foggy images Global average values of red, green, and blue channels for: ,; S32. Use an exponential decay model to fit a foggy image. The relationship between brightness, chromaticity, saturation and fog concentration , and Then calculate the fog concentration value. ,in, Foggy images The relationship between brightness and fog concentration for: In the formula, Image with fog The relationship between brightness and fog concentration, Image with fog At pixel The brightness value at that location, =1.2 represents the parameters of the exponential decay model. Foggy images The relationship between chromaticity and fog concentration for: In the formula, Image with fog The relationship between chromaticity and fog concentration, Image with fog At pixel The chromaticity value at that location, =1.5 is the parameter for the exponential decay model. Foggy images The relationship between saturation and fog concentration for: In the formula, Image with fog The relationship between saturation and fog concentration, Image with fog At pixel The saturation value at that point, =2.0 represents the parameters of the exponential decay model. fog concentration value for: ; S33. Calculate the foggy image. transmittance value : In the formula, Image with fog The transmittance value, Image with fog The fog concentration value, is the atmospheric scattering coefficient, with a value of 0.
95.
10. The image dehazing method based on atmospheric scattering model and color correction as described in claim 1, characterized in that, Step S5 includes the following steps: S51. First, obtain the brightness image of the dehazed image. Then, use logarithmic transformation to process the brightness image to achieve adaptive adjustment of the brightness dynamic range. Dehazed images Brightness image for: In the formula, , , The points are located on the red, green, and blue channels of the dehazed image, respectively. pixel values, Brightness image after adaptive brightness enhancement for: In the formula, The brightness image of the dehazed image. The parameter is a constant. =3; S52. Brightness images after adaptive brightness enhancement at different scales By performing Gaussian kernel convolution operations at different scales, a blurred image is obtained. : In the formula, For the first Gaussian convolution kernels of various scales: In the formula, The scaling factor is the Gaussian function. It is a normalization factor, and the normalization factor conform to: , Then the Laplace response at each scale is calculated. : In the formula, The Laplace operator is used in a four-neighbor discrete form, specifically as follows: , Then calculate the adaptive gamma correction parameters. The expression is as follows: , In the formula, For the first The maximum absolute value of the Laplace response at each scale. As a detail protection factor and , For blurred images, The Laplace response at each scale, Then, the contrast-enhanced images at different scales were calculated. : , in, To enhance the contrast of images at different scales, For the brightness image after adaptive brightness enhancement, For adaptive gamma correction parameters, Finally, image enhancement at different scales was utilized. The average Laplacian response value is used as a weight to obtain the final adaptive contrast-enhanced dehazed image. : , , , In the formula, , Indicates the size of the image.