-
-
Notifications
You must be signed in to change notification settings - Fork 2.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Guided filter #1104
base: main
Are you sure you want to change the base?
Guided filter #1104
Conversation
just making sure.. it's not patented/pending right? On Sun, Aug 17, 2014 at 6:02 PM, SamHames notifications@github.com wrote:
|
Actually it might be. I'm having trouble wading through the patents - does anybody have any guidance on how to better do that? |
Normally, the authors will clearly tell you if their work is patented. In this case, that doesn't seem to be the case. It is also included in the latest MATLAB: http://www.mathworks.com/help/images/ref/imguidedfilter.html |
@SamHames I browsed the paper and read your PR. First off, thank you very much for taking the time to contribute such a neat PR. Now, from the paper I understand that one of the benefits of this method is that it is fast, linear time--but this implementation is not, thereby losing that advantage. How difficult, do you think, would it be to change this to linear time? |
@stefanv Thanks for taking the time to have a look. The only thing needed to make it constant run time is a box filter based on integral images/summed area tables. This is relatively straightforward, and can build on transform.integral_image . It would be best to have this implemented as a filter in it's own right as filters.fast_uniform (or something to that effect). |
@SamHames If you're up for it, let's do it! |
@SamHames I know that the last discussion happened two years ago. What's the status of this PR for you? |
I would like to see this merged. Having fast box filters as the base for this is nice to have but should not be a show-stopper. |
Let's do this. |
@soupault Done Obviously life has intervened in the preceding couple of years :) Thanks for checking in. I'll review where this is at sometime early next week - going from memory I don't think there's any significant work remaining, just details. |
Implement the guided filter for fast, adaptive smoothing of images using local pixel statistics. Guided filtering is fast without approximations and computes the filtered image in one pass.
Implements the guided filter for fast, adaptive smoothing of images.
More informative examples for guided filtering now included.
Hello @SamHames! Thanks for updating the PR.
Comment last updated on April 23, 2017 at 13:50 Hours UTC |
doc/examples/plot_guided.py
Outdated
References | ||
========== | ||
|
||
.. [1] http://research.microsoft.com/en-us/um/people/kahe/eccv10/ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This link looks broken... like redirected.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If I'm correct, the correct paper is: DOI:10.1007/978-3-642-15549-9_1
@@ -11,7 +11,7 @@ | |||
http://www.opticsinfobase.org/josaa/abstract.cfm?URI=josaa-27-7-1593 | |||
|
|||
.. [2] Richardson, William Hadley, "Bayesian-Based Iterative Method of | |||
Image Restoration". JOSA 62 (1): 55–59. doi:10.1364/JOSA.62.000055, 1972 | |||
Image Restoration". JOSA 62 (1): 55-59. doi:10.1364/JOSA.62.000055, 1972 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It would be better to write DOI instead of doi. and the year before the DOI.
References | ||
---------- | ||
.. [1] "Guided Image Filtering", by He et al. appearing in ECCV 2010. | ||
http://research.microsoft.com/en-us/um/people/kahe/eccv10/ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If I'm correct, the correct paper is: DOI:10.1007/978-3-642-15549-9_1
|
||
def _guided_filter(image, guide, eta, radius): | ||
""" Guided filtering on two distinct single channel float images.""" | ||
window_size = 2*radius + 1 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Some PEP8 fixes to bring in these function.
[ 0.10548081, 0.10548081, 0.10548081], | ||
[ 0.82811797, 0.82811797, 0.82811797]]]) | ||
""" | ||
if guide is not None: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Minor. as None is default, I would flip the position of this block with the else
block to start with if guide is None
@soupault What do you wish to do with this PR? Would you want to work on further enhancements or do you prefer that we consider merging this code? |
@sciunto No, I just wanted to rebase the code, and perform the neccessary changes (PEP8-ify, refactor tests, move gallery example to the right place, etc). Pretty much done from my side (still need to fix failing docstring test). |
Codecov Report
@@ Coverage Diff @@
## master #1104 +/- ##
==========================================
+ Coverage 85.34% 85.38% +0.04%
==========================================
Files 331 333 +2
Lines 26444 26543 +99
==========================================
+ Hits 22568 22665 +97
- Misses 3876 3878 +2
Continue to review full report at Codecov.
|
Looks like we dropped the ball here. I am sorry about that, @SamHames. |
I would say this is a classic algorithm and, definitely, is a good addition. I may pick this up later (no spare time currently). In any case, better to keep the PR open. |
This implements the guided filtering routine for edge preserving smoothing. The website is here: http://research.microsoft.com/en-us/um/people/kahe/eccv10/ . This is not based on the code provided there.
This is just the basic functionality with an example and (some) tests. I'd appreciate some comments and thoughts before I move any further with this.
Todo
Some examples from the example script: