Coder Social home page Coder Social logo

zqpei / haze_removal_python Goto Github PK

View Code? Open in Web Editor NEW
9.0 9.0 9.0 6.22 MB

This is an python implementation of "single image haze removal using dark channel prior"

License: GNU General Public License v3.0

Python 100.00%
dehaze guidedfilter haze-removal paper

haze_removal_python's Introduction

Hi there ๐Ÿ‘‹, this is ZQPei's github.

  • ๐Ÿ”ญ Iโ€™m currently working on ML systems.
  • ๐ŸŒฑ Iโ€™m currently learning tvm.
  • ๐Ÿ“ซ How to reach me: [email protected].

Github Homepage Statistics

ZQPei's GitHub stats

HitsProfile views

haze_removal_python's People

Contributors

zqpei avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar

haze_removal_python's Issues

How to improve processing speed?

Hi, @ZQPei.
I'm finding methods about removing haze in images.
I'm surprised result from your codes.

But it spends long time like following messages.

Starting to compute dark channel prior...
time: 7.7209954261779785
Starting to compute air light prior...
time: 0.02899956703186035
Starting to compute transmission...
time: 17.077998876571655
Starting to compute guided filter trainsmission...
time: 36.619999408721924
Starting recovering...
time: 0.10297012329101562

What can i do for speed up?

Speedup by using Numba CUDA

For my use case(Large image size) the current processing takes a lot of time. I found that get_dark_channel and get_transmission functions takes a lot of time to process. Thus i decided to change the numba to use cuda by doing the below changes following this reference

@cuda.jit
    def get_dark_channel(self, radius=7):
@cuda.jit
    def get_transmission(self, radius=7, omega=0.95):

and called those as

    import sys
    hr = HazeRemoval()
    hr.open_image(sys.argv[1])
    #################### For CUDA
    # Set the number of threads in a block
    threadsperblock = 32 
    # Calculate the number of thread blocks in the grid
    blockspergrid = (hr.src.size + (threadsperblock - 1)) // threadsperblock
    ####################
    hr.get_dark_channel[blockspergrid, threadsperblock]()
    hr.get_air_light()
    hr.get_transmission[blockspergrid, threadsperblock]()
    hr.guided_filter()
    hr.recover()
    hr.show()

But i am getting the fllowing error

TypeError: Failed in nopython mode pipeline (step: fix up args)
Signature mismatch: 0 argument types given, but function takes 2 arguments

Has anyone tried to do this?

Run time Error:Not Enough value to unpack

Traceback (most recent call last):
File "haze_removal.py", line 99, in
hr.open_image(sys.argv[1])
File "haze_removal.py", line 17, in open_image
self.rows, self.cols, _ = self.src.shape
ValueError: not enough values to unpack (expected 3, got 2)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.