An implementation of the IEEE paper titled Effective Single Image Dehazing by Fusion by Codruta Orniana Ancuti, Cosmin Ancuti and Philippe Bekaert.
For any queries, you may contact:
- Adhithya Arun ([email protected])
- Namratha Gopalabhatla ([email protected])
- image-dehazing
- image_dehazing : Image dehazing package
- __init__.py
- single_image.py : ImageDehazing class
- demo.py : Demo script
- height_variance.py : Sample script to display variance in quality of dehazed results with height of image pyramid
- LICENSE : License
- README.md : Documentation
- requirements.txt : Package requirements
Below are the pre-requisites to be satisfied before the package can be used.
-
Make sure
python3
is installed. (Preferablypython3.7
) -
Package requirements:
matplotlib
numpy
opencv-python
scikit-image
-
If the above packages are not installed,
- You may manually install the packages individually
- You can also install the packages using the requirements.txt:
sudo python3.7 -m pip install -r requirements.txt
- ImageDehazing([verbose = False])
- Methods:
-
white_balance(image)
Description: Function to perform white balancing operation on an imageParameter Description Default image Image to be white balanced None -
enhance_contrast(image)
Description: Function to enhance contrast in an imageParameter Description Default image Image to be contrast enhanced None -
luminance_map(image)
Description: Function to generate the Luminance Weight Map of an imageParameter Description Default image Image whose luminance map is to be generated None -
chromatic_map(image)
Description: Function to generate the Chromatic Weight Map of an imageParameter Description Default image Image whose chromatic map is to be generated None -
saliency_map(image)
Description: Function to generate the Saliency Weight Map of an imageParameter Description Default image Image whose saliency map is to be generated None -
image_pyramid(image, pyramid_type, levels)
Description: Function to generate the Gaussian/Laplacian pyramid of an imageParameter Description Default image Image whose pyramid is to be generated None pyramid_type Type of pyramid: 'gaussian' or 'laplacian' 'gaussian' levels Height of pyramid 1 -
fusion(inputs, weights, gaussians)
Description: Function to fuse the pyramids togetherParameter Description Default inputs Images to be fused None weights Image to be white balanced None gaussians Gaussian pyramids for the corresponding inputs None -
dehaze(image, [verbose = None, pyramid_height = 12])
Description: Driver function to dehaze the imageParameter Description Default image Image to be dehazed None verbose Flag denoting whether each step should be displayed None pyramid_height Height of image pyramids 12
-
-
Once the pre-requisites are satisfied, the demo can be run by running the following command:
python3.7 demo.py
-
Place the image_dehazing directory in the same directory as your code files that are using them.
-
The ImageDehazing class from the package can be used as shown in the below example:
from skimage.io import imread import matplotlib.pyplot as plt # Import ImageDehazing class from image_dehazing.single_image import ImageDehazing # Read image path_to_image = './dataset/image_1.jpg' # Path to hazy image hazy_image = imread(path_to_image) # Create object of ImageDehazing class dehazer = ImageDehazing(verbose=True) # Dehaze the the image using th dehaze method of the object dehaze_data = dehazer.dehaze(hazy_image, pyramid_height=12) # Display dehazed image plt.figure() plt.subplot(1, 2, 1) plt.imshow(dehaze_data['hazed']) plt.title('Hazy Image') plt.axis('off') plt.subplot(1, 2, 2) plt.imshow(dehaze_data['dehazed']) plt.title('Dehazed Image') plt.axis('off') plt.show()
-
To see results on analysis of the changes observed due to variation in height of the pyramid, run the height_variance.py script as follows:
python3.7 height_variance.py