Skip to content

Implementation of IEEE paper on Image dehazing using multiple scale fusion.

License

Notifications You must be signed in to change notification settings

adhithyaarun/image-dehazing

Repository files navigation

image-dehazing

An implementation of the IEEE paper titled Effective Single Image Dehazing by Fusion by Codruta Orniana Ancuti, Cosmin Ancuti and Philippe Bekaert.

Contributors

For any queries, you may contact:

Directory Structure

Pre-requisites

Below are the pre-requisites to be satisfied before the package can be used.

  • Make sure python3 is installed. (Preferably python3.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

Class Structure

  • ImageDehazing([verbose = False])
  • Methods:
    • white_balance(image)
      Description: Function to perform white balancing operation on an image

      Parameter Description Default
      image Image to be white balanced None
    • enhance_contrast(image)
      Description: Function to enhance contrast in an image

      Parameter Description Default
      image Image to be contrast enhanced None
    • luminance_map(image)
      Description: Function to generate the Luminance Weight Map of an image

      Parameter 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 image

      Parameter 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 image

      Parameter 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 image

      Parameter 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 together

      Parameter 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 image

      Parameter 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

Usage

  • 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

About

Implementation of IEEE paper on Image dehazing using multiple scale fusion.

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages