Repository navigation
ENH: Implements wavelet denoising (from #1833) - #2190
Conversation
| return pywt.waverecn([denoised_root, *denoised_detail], wavelet) | ||
|
|
||
|
|
||
| def denoise_wavelet(im, sigma=None, wavelet='db1', mode='soft'): |
There was a problem hiding this comment.
We prefer image (or img) instead of im.
|
@stsievert I made a first pass and wrote some comments to give you some indications to improve different things and to pass the tests. It's good to see wavelets coming in :) |
| ---------- | ||
| .. [1] Chang, S. Grace, Bin Yu, and Martin Vetterli. "Adaptive wavelet | ||
| thresholding for image denoising and compression." Image Processing, | ||
| IEEE Transactions on 9.9 (2000): 1532-1546. |
There was a problem hiding this comment.
Please, add DOI. Format: DOI:xxxyyy
im —> img adds paper DOI adds denoise_wavelet __init__ fixes typo in optional_requriments
| detail_coeffs = coeffs[-1]['d' * im.ndim] | ||
|
|
||
| if sigma is None: | ||
| # Estimate the noise std.dev as discussed in PR #1837 |
There was a problem hiding this comment.
I prefer to avoid references to PR as much as possible. Could you summarize the idea please?
| by wavelet shrinkage." Biometrika 81.3 (1994): 425-455. | ||
| DOI: 10.1093/biomet/81.3.425 | ||
| """ | ||
| import pywt |
There was a problem hiding this comment.
Why do you import pywt in the function?
There was a problem hiding this comment.
I'm trying to keep it an optional requirement -- that's what had been decided a couple months ago.
There was a problem hiding this comment.
I'm not sure that the decision is actually taken. See #1838.
f965224 to
dba65b7
Compare
|
I've made PyWavelets required. It seems that in #2019 we decided that we would wait for a PR of this flavor to come along. |
40690d1 to
eea7dfc
Compare
|
I'm +1 to do it this way for now and eventually turn off before the release if, for some reasons, we want to wait a little. @stsievert a little indent issue, then, we should be close :) |
711655a to
622a5aa
Compare
|
|
||
| Parameters | ||
| ---------- | ||
| img : ndarray (greater than 2d) of ints, uints or floats |
There was a problem hiding this comment.
>=2D here, but 2D/3D only in the function above.
Could you clarify the supported formats and fix the docstrings accordingly?
|
I agree with @soupault's comments. Once addressed, this should be good to go. |
as well as DOC: clarify 2D/3D + rewrite notes for denoise_wavelet
|
|
||
| img = img_as_float(img) | ||
|
|
||
| if img.ndims not in {2, 3}: |
There was a problem hiding this comment.
img.ndim here should fix the CI builds.
355eabf to
b09911d
Compare
TST: removes tests to particular image
b09911d to
13490a6
Compare
|
Thanks for sticking with this, @stsievert - the AppVeyor issue is unrelated, Travis is happy, and I'm merging. |
|
Hmm. I think the example is not really representative (http://scikit-image.org/docs/dev/auto_examples/filters/plot_denoise.html). Maybe apply stronger filtering? |
|
+1 and how about grayscale vs color images? Definitely not the same difficulty. |
|
It's actually significantly denoised, but doing the denoising separately per channel is problematic - each gets handled differently, so you end actually adding color noise. |
|
A common approach is to denoise the Y channel in YCbCr space, then return to RGB. |
|
Looks like in the top image we specify that the noise variation is less than it actually is. I say change the top image performs as default and the bottom image reduces more noise. At the very least we should add a note about YCbCr colorspace in the docs, and we should probably show the output when denoising using the YCbCr colorspace. |
|
@stsievert Would you like to start a PR on YCbCr? I would be appreciated for the next release :) |
|
I am interested in doing that, but am busy for the next week. |
Description
This implements wavelet denoising and is based off #1833 -- see that PR for more detail. I tried to
git rebasebut my attempt failed and this is faster.New changes that are not reflected in #1833:
noise_std-->sigma).Checklist
[It's fine to submit PRs which are a work in progress! But before they are merged, all PRs should provide:]
./doc/examples(new features only)References
This is the same implementation as #1833, but I made a new branch to resolve some merge conflicts (I tried to rebase but sigh).
edit briefly, here's the example in the docstring: