An improved dark channel prior image dehazing method

By performing octree segmentation and brightness mean segmentation on the dark channel image and combining the bright and dark channels to calculate the transmittance, the problem of poor defogging effect in the sky area of ​​traditional methods is solved, and better defogging effect and image detail enhancement are achieved.

CN118469863BActive Publication Date: 2025-09-16HANGZHOU DIANZI UNIV
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202410494937.2
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2024-04-23
Publication Date
2025-09-16
Estimated Expiration
2044-04-23

AI Technical Summary

Technical Problem

Traditional image dehazing methods based on dark channel prior cannot effectively process the sky area and pure color area of ​​the image, resulting in poor dehazing effect and even image distortion.

Method used

An improved dark channel prior method is adopted. The atmospheric light value is determined by performing octree segmentation on the upper half of the dark channel image. The pixel categories are segmented by combining the brightness mean. The transmittance is calculated using the bright channel and dark channel respectively. The transmittance image details are processed by combining Gaussian filtering and guided filtering to enhance the image details and texture.

Benefits of technology

It effectively improves the dehazing effect in the sky area, reduces image distortion, and enhances image details and texture information.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN118469863B_ABST
    Figure CN118469863B_ABST
Patent Text Reader

Abstract

The present invention discloses an improved image defogging method using a dark channel prior. The method first processes a foggy image to obtain a dark channel image, then uses an octree segmentation method to determine the atmospheric light value on the upper half of the image. The method then calculates the average brightness of the dark channel image and obtains the category label of each pixel in the foggy image: bright or dark. The method then determines whether each pixel in the foggy image is a bright spot, thereby obtaining a bright channel transmittance image or a dark channel transmittance image. The two images are then corrected and synthesized into a transmittance image. A detail image is obtained based on the transmittance image and its Gaussian filtered image. The method then determines whether each pixel in the detail image is zero. If so, the pixel is Gaussian filtered; otherwise, the pixel is guided filtered to obtain a final detail image. The defogged image is then calculated based on the category labels of the pixels in the foggy image and the final detail image. The present invention can effectively defog an image and avoid distortion.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The invention belongs to the technical field of image processing and relates to an improved dark channel prior image defogging method. Background Art

[0002] At present, the image defogging method based on dark channel prior is widely used in the field of image defogging. Its main idea is to record the obtained foggy image as an atmospheric scattering model, and calculate the original image by estimating the atmospheric light value A and the transmittance image t(x,y).

[0003] The atmospheric scattering model expression is:

[0004] ,

[0005] Where, is the original foggy image; Indicates a clear image; represents the transmittance image; A Indicates the atmospheric light value; Indicates the position of a pixel.

[0006] Dark channel prior theory believes that: in the non-sky area or non-pure color area of ​​the image, the local neighborhood ) The minimum values ​​of the three channels R, G, and B of all pixels in the image tend to 0, that is:

[0007] ,

[0008] ,

[0009] In the formula It is a clear and fog-free image. is its corresponding dark channel image, c Represented as one of the three channels R, G, and B. Indicated in pixels The filter window is centered. min represents the minimum function.

[0010] Obviously, image dehazing methods based on dark channel priors can only effectively dehaze the non-sky areas of foggy images, and cannot process the sky and pure color areas of foggy images. Therefore, traditional image dehazing algorithms based on dark channel priors cannot effectively dehaze the sky and pure color areas of the image, and may even cause image distortion. Summary of the Invention

[0011] In order to solve the above technical problems existing in the prior art, the present invention proposes an improved dark channel prior image defogging method, the specific technical solution of which is as follows:

[0012] An improved dark channel prior image dehazing method includes the following steps:

[0013] Step 1: Input foggy image;

[0014] Step 2: Process the foggy image according to the dark channel prior principle to obtain a dark channel image;

[0015] Step 3: Use the octree segmentation method to determine the atmospheric light value of the upper half of the dark channel image;

[0016] Step 4: Calculate the average brightness of the dark channel image and obtain the category label of each pixel in the foggy image: bright spot or dark spot;

[0017] Step 5: Determine whether each pixel in the foggy image is a bright spot. If so, use the bright channel-based method to calculate the transmittance to obtain a bright channel transmittance image. Otherwise, use the dark channel-based method to calculate the transmittance to obtain a dark channel transmittance image.

[0018] Step 6: Correct the bright channel transmittance image and the dark channel transmittance image and synthesize them into a transmittance image;

[0019] Step 7: Obtain a detail image based on the transmittance image and the image after Gaussian filtering;

[0020] Step 8: Determine whether the pixel points in the detail image are 0 one by one. If so, perform Gaussian filtering on the pixel point. Otherwise, perform guided filtering on the pixel point and obtain the final detail image.

[0021] Step 9: Calculate the defogging image based on the category labels of the pixels in the foggy image and the final detail image obtained;

[0022] Step 10: Output the dehazed image.

[0023] Furthermore, the step 2 is specifically as follows: scan the pixels of the foggy image one by one, find the minimum value of the three channels R, G, and B for each pixel, and obtain a new image I 1. Image I 1 Perform minimum filtering to obtain the dark channel image , the process expression for obtaining the dark channel image is:

[0024] ,

[0025] ,

[0026] Where, Represents each pixel in the image, cRepresented as one of the three channels R, G, and B. Indicated by pixels The filter window is centered. min represents the minimum function.

[0027] Furthermore, the step 3 is specifically as follows: the dark channel image is evenly divided into two upper and lower image blocks, and then the upper half of the image is octree segmented to obtain eight image blocks, and then the parameters of the eight image blocks are calculated. Is And Is The largest image block is segmented by octree, and then the parameter calculation and image segmentation process are repeated until the image block size reaches the set value. The position of the image block at this time is the atmospheric light value. A The positioning area, finally according to A Find the corresponding foggy image area in the positioning area, and calculate the average value of the pixels in this area to get the atmospheric light value A ,parameter Is and A The calculation expression is:

[0028] ,

[0029] ,

[0030] In the formula is the pixel mean of the image block, is the variance of the image patch, is the pixel mean of the corresponding foggy image area.

[0031] Furthermore, the step 4 is specifically as follows: calculating the average brightness of the dark channel image M , and get the category labels of each pixel in the foggy image:

[0032] ,

[0033] In the formula Sumd is the dark channel image The sum of the corresponding values ​​of all pixels, N yes The number of all pixels, set:

[0034] .

[0035] Furthermore, the transmittance image corresponding to the bright channel in step 5 and dark channel transmittance image The calculation expression is:

[0036] ,

[0037] ,

[0038] Where, min represents the minimum function, max Represents the maximum function.

[0039] Furthermore, the step 6 is specifically as follows: dark channel transmittance image t and bright channel transmittance image Correction is performed and the corrected images are added to obtain the transmittance image , the calculation expression is:

[0040] ,

[0041] ,

[0042] ,

[0043] ,

[0044] In the formula, is a pixel in the foggy image Department The values ​​of the three channels, is the set threshold, and They are the dark channel transmittance images and bright channel transmittance image The image obtained after correction.

[0045] Furthermore, the step 7 is specifically as follows: the detail image is obtained by subtracting the transmittance image from the result image obtained after the transmittance image is Gaussian filtered, and the detail image is obtained. The calculation expression is:

[0046] t 2( x , y )= t ( x , y )- t 1( x , y )

[0047] In the formula is the transmittance image The image is obtained after Gaussian filtering.

[0048] Furthermore, the step 8 is specifically as follows: if the detail image Pixels If it is 0, then the transmittance image Gaussian filtering is performed at the location where the image is to be refined, otherwise guided filtering is performed to obtain the final detail image, that is, the refined transmission image. , The calculation expression is:

[0049] ,

[0050] is the transmittance image Transmission map after thinning.

[0051] Furthermore, the step 9 is specifically as follows: the foggy image obtained in step 4 is obtained I The category labels of the pixels in the image and the refined projected image obtained in step 8 Calculate the dehazed image , The calculation expression is:

[0052] ,

[0053] Where, is a very small number that is not 0. Beneficial effects

[0054] The present invention proposes a method for performing octree segmentation on the upper half of a dark channel image to obtain a localized area for atmospheric light values ​​and calculate the atmospheric light values. This method calculates the atmospheric light values ​​based on the fact that the sky region generally appears above the image and that the pixel values ​​within a certain neighborhood have a large variation range but a small variation range. This solves the problem of locating the atmospheric light values ​​in high-brightness areas, making the estimated atmospheric light values ​​closer to the true values.

[0055] The present invention proposes to classify foggy images into bright spots and dark spots by using the brightness mean of the dark channel image, and to calculate the transmittance map of the dark spots using the dark channel-based method. , for bright spots, use the bright channel-based method to calculate the transmittance map , then obtain the transmittance image of the image This method solves the problem that the traditional dehazing algorithm based on dark channel prior has poor processing effect and even image distortion in the sky and pure color areas, making the image dehazing effect good in the sky area;

[0056] The invention proposes to obtain a transmittance image by Gaussian filtering Layer of Detail , according to whether the value of the pixel point in the detail layer is zero, the transmittance image Coarse filtering with Gaussian filtering and fine filtering with guided filtering are performed to enhance the details and texture information of the image, thereby better refining the transmittance image. BRIEF DESCRIPTION OF THE DRAWINGS

[0057] Figure 1 1 is a schematic diagram of a specific process of an improved dark channel prior image defogging method of the present invention;

[0058] Figure 2 Schematic diagram of octree segmentation of the upper half of an image in the method of the present invention;

[0059] Figure 3 It is a schematic diagram of the octree structure for image segmentation in the method of the present invention. DETAILED DESCRIPTION

[0060] In order to make the purpose, technical solution and technical effect of the present invention more clear, the present invention is further described in detail below with reference to the accompanying drawings and embodiments.

[0061] like Figure 1 As shown, the improved dark channel prior image defogging method of the present invention includes the following steps:

[0062] Step 1: Input foggy image.

[0063] Step 2: Obtain the dark channel image based on the dark channel prior principle. Specifically, scan the pixels of the foggy image one by one and calculate the The minimum value of the three channels is used to obtain a new image I 1. Image I 1 Perform minimum filtering to obtain the dark channel image , the process of obtaining the dark channel image can be expressed as:

[0064] ,

[0065] ,

[0066] Where, Represents each pixel in the image, c Expressed as One of the three channels, Indicated by pixels The filter window is centered. min represents the minimum function.

[0067] Step 3: Use the octree segmentation method to determine the atmospheric light value of the upper half of the dark channel image A Specifically, first, the dark channel image is evenly divided into two upper and lower image blocks, and then the upper half of the image is segmented by octree to obtain eight image blocks. The segmentation method is as follows Figure 2 As shown, the parameters of the eight image blocks are then calculated Is And Is The largest image block is segmented by octree, and the parameter calculation and image segmentation process are repeated until the image block size reaches the set value. The position of the image block at this time is the atmospheric light value. A The positioning area, finally according to A Find the corresponding foggy image area in the positioning area, and calculate the average value of the pixels in this area to get the atmospheric light value A ,parameter Is and A The calculation formula is expressed as:

[0068] ,

[0069] ,

[0070] In the formula is the pixel mean of the image block, is the variance of the image patch, is the pixel mean value of the corresponding foggy image area. This step calculates the atmospheric light value based on the fact that the sky area generally appears above the image and the pixel values ​​within a certain neighborhood have a large variation range but a small variation range. This solves the problem of locating the atmospheric light value in the high-brightness area, making the estimated atmospheric light value closer to the true value.

[0071] Step 4: Calculate the average brightness of the dark channel image M , and obtain the category labels of each pixel in the foggy image. Specifically, calculate the average brightness of the dark channel image M , and get the category labels of each pixel in the foggy image:

[0072] ,

[0073] In the formula Sumd is the dark channel image The sum of the corresponding values ​​of all pixels, N yes The number of all pixels, set:

[0074] .

[0075] Step 5: Determine whether the pixels of the foggy image are bright spots one by one. If so, use the method based on the bright channel to calculate the transmittance. Otherwise, use the method based on the dark channel to calculate the transmittance. Specifically, according to step 4, the category label of each pixel in the foggy image can be obtained: bright spot or dark spot, and the transmittance image of the bright channel tl and dark channel transmittance image td , the calculation process of the two images is expressed as:

[0076] ,

[0077] ,

[0078] Where, min represents the minimum function, max Represents the maximum function.

[0079] Step 6: Synthesize the transmittance image , specifically, for the dark channel transmittance image t and bright channel transmittance image Correction is performed and the corrected images are added to obtain the transmittance image , the calculation expression is:

[0080] ,

[0081] ,

[0082] ,

[0083] ,

[0084] In the formula, is a pixel in the foggy image Department The values ​​of the three channels, is the set threshold, and They are the dark channel transmittance images and bright channel transmittance image The image obtained after correction.

[0085] Step 7: Get the detail image Specifically, the detail image is obtained by subtracting the transmittance image from the result image obtained after Gaussian filtering of the transmittance image. The calculation formula is expressed as:

[0086] t 2( x , y )= t ( x , y )- t 1( x , y )

[0087] In the formula is the transmittance image The image is obtained after Gaussian filtering.

[0088] Step 8: Judge one by one image Is the pixel at 0? If so, the pixel Perform Gaussian filtering, otherwise the pixel Perform guided filtering and obtain the final detail image , specifically, if the detail image Pixels If it is 0, then image A coarse filter of Gaussian filtering is performed at the position where the filter is used, otherwise a fine filter of guided filtering is performed, and the transmission image after refinement It can be expressed as:

[0089] ,

[0090] is the transmittance image Transmission map after thinning.

[0091] Step 9: According to the category labels and Calculate the defogging image, specifically, the foggy image obtained according to step 4 I The category labels of the pixels in the image and the refined projected image obtained in step 8 Calculate the dehazed image , It can be expressed as:

[0092] ,

[0093] Where, It is a very small number that is not zero to prevent the denominator from being zero.

[0094] Step 10: Output the dehazed image.

[0095] like Figure 2 The figure shows the schematic diagram of octree segmentation for the upper half of the image. Since the sky area generally only appears above the image, octree segmentation is only performed on the upper part of the image. Figure 2 As shown, the upper half of the image is divided into R1~R8, and the eight images are calculated. Is The parameter is maximized and the data block is split into octrees.

[0096] like Figure 3 Shown is the octree structure involved in image segmentation. Figure 3 The R in the image represents the upper half of the image. The size and shape of the R1 to R8 data blocks are exactly the same. Figure 3 Assume that R3 data block Is The parameter is the largest, so the R3 data block is split into octrees again, and so on.

[0097] The above description is only a preferred embodiment of the present invention and does not constitute any form of limitation to the present invention. Although the implementation process of the present invention is described in detail above, it is still possible for those familiar with the art to modify the technical solutions described in the above examples or to replace some of the technical features therein with equivalents. Any modifications, equivalent replacements, etc. made within the spirit and principles of the present invention shall be included in the scope of protection of the present invention.

Claims

1. An improved dark channel prior image dehazing method, characterized in that: The following steps are involved: Step 1: Input foggy image; Step 2: Process the foggy image according to the dark channel prior principle to obtain a dark channel image; Step 3: Use the octree segmentation method to determine the atmospheric light value of the upper half of the dark channel image; Step 4: Calculate the average brightness of the dark channel image and obtain the category label of each pixel in the foggy image: bright spot or dark spot; Step 5: Determine whether each pixel in the foggy image is a bright spot. If so, use the bright channel-based method to calculate the transmittance to obtain a bright channel transmittance image. Otherwise, use the dark channel-based method to calculate the transmittance to obtain a dark channel transmittance image. Step 6: Correct the bright channel transmittance image and the dark channel transmittance image and synthesize them into a transmittance image; Step 7: Obtain a detail image based on the transmittance image and the image after Gaussian filtering; Step 8: Determine whether the pixel points in the detail image are 0 one by one. If so, perform Gaussian filtering on the pixel point. Otherwise, perform guided filtering on the pixel point and obtain the final detail image. Step 9: Calculate the defogging image based on the category labels of the pixels in the foggy image and the final detail image obtained; Step 10: Output the dehazed image; The step 2 is specifically as follows: scanning the foggy images one by one I Pixels, for each pixel The minimum value of the three channels is used to obtain a new image I 1. Image I 1 Perform minimum filtering to obtain the dark channel image , the process expression for obtaining the dark channel image is: , , Where, Represents each pixel in the image, c Expressed as One of the three channels, Indicated by pixels The filter window is centered. min represents the minimum function; The step 3 is specifically as follows: the dark channel image is divided into two upper and lower image blocks, and then the upper half of the image is segmented by octree to obtain eight image blocks, and then the parameters of the eight image blocks are calculated. Is And Is The largest image block is segmented by octree, and then the parameter calculation and image segmentation process are repeated until the image block size reaches the set value. The position of the image block at this time is the atmospheric light value. A The positioning area, finally according to A Find the corresponding foggy image area in the positioning area, and calculate the average value of the pixels in this area to get the atmospheric light value A ,parameter Is and A The calculation expression is: , , In the formula is the pixel mean of the image block, is the variance of the image patch, is the pixel mean of the corresponding foggy image area; The step 4 is specifically: calculating the average brightness of the dark channel image M , and get the category labels of each pixel in the foggy image: , In the formula Sumd is the dark channel image The sum of the corresponding values ​​of all pixels, N yes The number of all pixels, set: ; The transmittance image corresponding to the bright channel in step 5 tl and dark channel transmittance image td The calculation expression is: , ; Where, min represents the minimum function, max Represents the maximum function.

2. The improved dark channel prior image defogging method according to claim 1, characterized in that: The step 6 is specifically as follows: and bright channel transmittance image Correction is performed and the corrected images are added to obtain the transmittance image , the calculation expression is: , , , , In the formula, is a pixel in the foggy image Department The values ​​of the three channels, is the set threshold, and They are the dark channel transmittance images and bright channel transmittance image The image obtained after correction.

3. The improved dark channel prior image dehazing method according to claim 2, wherein: The step 7 is specifically as follows: the detail image is obtained by subtracting the transmittance image from the result image obtained after the transmittance image is Gaussian filtered, and obtaining the detail image. The calculation expression is: t 2( x , y )= t ( x , y )- t 1( x , y ) In the formula is the transmittance image The image is obtained after Gaussian filtering.

4. The improved dark channel prior image dehazing method according to claim 3, wherein: The step 8 is specifically as follows: if the detail image Pixels If it is 0, then the transmittance image t Gaussian filtering is performed at the location where the image is to be refined, otherwise guided filtering is performed to obtain the final detail image, that is, the refined transmission image. , The calculation expression is: , is the transmittance image Transmission map after thinning.

5. The improved dark channel prior image defogging method according to claim 4, characterized in that: The step 9 is specifically as follows: the foggy image obtained in step 4 I The category labels of the pixels in the image and the refined projected image obtained in step 8 Calculate the dehazed image , The calculation expression is: , Where, is a very small number that is not 0.

Citation Information

Patent Citations

  • Image defogging method based on dark channel prior

    CN115482165A

  • Image dehazing method and system based on superpixel segmentation, and storage medium and electronic device

    WO2021000302A1