The propose of this repository is to implement the image haze removal base on the Zhiming Tan Et al. paper.
The code can be executed via terminal
python dehaze.py
then input the PATH_TO_IMAGEimagename.png
This dehaze algorithm contains three steps,
- Determine intensity of atmospheric light
- Estimate transmission map
- Clarify image
First, the intensity of atmospheric light A
is estimated form hazed image I(x)
. Then, the transmission map t(x)
is estimated using A
and I(x)
. Finally, the image is clarified with the image defogging model.
Find the top 0.1% brightest pixels in the dark channel then choose one with highest intensity as the representing of atmospheric light.
First, find a dark channel based on a local area(coarsemap)
Then, the transmission map t(x)
is thereby obtained:
t(x) = 1 – defoggingParam * darkPixelFromCoarseMap / AtmosphericLightIntensity
The defoggingParam
is a value between 0 to 1. The higher value the lesser amount of fog would be kept for the distant objects.
Finally, the image is clarified by: J(x)=(I(x)- A)/max(t(x), t0)+A
Where J(x)
is output, I(x)
is input, t(x)
is transmission map, A
is atmospheric light and t0
is set to a constant value to avoid dividing by zero.