Research on single image dehazing algorithm based on dark channel prior (1)

Research on single image dehazing algorithm based on dark channel prior (1)

  • Algorithm block diagram
  • Details of the improvements
  • Code implementation and simulation results

Algorithm block diagram

write picture description here

Details of the improvements

adaptive filter window size

An adaptive method is used for the size of the minimum filter window, which is applicable to all image sizes.
**Implementation method
windowsize=min(h*0.03,w*0.03,35)
Among them, 35 is the highest threshold, and the 35*35 filtering window is relatively good for filtering results of pictures of various sizes.

Solving for Adaptive Atmospheric Light Values ​​(Sky Segmentation)

The original solution method of atmospheric light value
(1) Sort the pixel intensity of the dark channel image, take the original image area corresponding to the first one thousandth of the pixels as the sky area, and use the maximum pixel value in this area as the atmospheric light value.
(2) Directly take the point with the highest pixel in the dark channel image and the pixel of the corresponding point in the original image as the atmospheric light value.
The atmospheric light value adaptive solution method
first divides the image into sky area and non-sky area, finds the maximum pixel point in the sky area, obtains the minimum filter window corresponding to this point in the original image, and finds out the pixels in the window that meet the conditions, The largest point is selected as the atmospheric light value. If there is no point that meets the conditions, the average value of the pixels in the window is used as the atmospheric light value.
Condition
A=(1-a)max(Idark)+a*max(Irgb)
Conditional principle
Thesis steps of
sky
region segmentation: (1) Grayscale image, filtering, canny edge detection, to obtain a binary image containing edge information
( 2) Scan the binary image from top to bottom, set all the pixels before the first pixel equal to 1 in each column to 1, and set all subsequent pixels to 0 to obtain a new binary image
(3) Find Take the pixel average and maximum value of the gray image area corresponding to the area where the pixel point is 1. If Imax>0.9*Iavg, there is a sky area in the image, and the adaptive method is used to solve the atmospheric light value, otherwise the original method is used.

Implementation method
Markdown Extra

guided filtering

Correction of transmittance
Implementation method

Optimization of transmittance of dark channel prior failure area (adding tolerance value)

Principle explanation
The atmospheric light scattering model is improved. Considering that the pixel intensity in areas such as car lights and water surfaces is close to atmospheric light, the dark channel prior model is not applicable, so a tolerance value is added. When the pixel intensity reaches the tolerance value K , consider it as the atmospheric light area, so that the calculated dehaze image will not have color spots in the light area.
The value of the tolerance value K
K=0.7*Idark_avg

Code implementation and simulation results

Implementation

(1) In the part of the adaptive atmospheric light value, it is not completely calculated according to that condition. For the points that meet the conditions, the average value is directly used as A. Solve A with the original method, the result is the same, try to solve the points that meet the conditions next time,
(2) For the problem that the result of the dehazed image is too dark, apply gamma correction and automatic color scale, the gamma is less than 1, but for The fog-free part will be blurred, and the gamma value will be selected.
(3) The maximum atmospheric light value of 220 is added to the part of solving A, as a limit
(4) When calculating the rough transmittance, the average atmospheric light value is added, and the obtained transmittance map is better
(5) Automatic color scale is added, But the dehazing effect of the obtained image is not very good, and then look at Dr. He's paper and try to do it with deep learning methods.
Part of the sky is stained! ! !


Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=325218670&siteId=291194637