8000 enhancements to Gauss prior deconvolution by grlee77 · Pull Request #1 · alexjarosch/scikit-image · GitHub
[go: up one dir, main page]

Skip to content

enhancements to Gauss prior deconvolution #1

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

Conversation

grlee77
Copy link
@grlee77 grlee77 commented Oct 29, 2020

This PR adds a few commits that improve the performance of deconvolution and extend the support to n-dimensional image and psf.

I also added the ability to optionally pad the input using a pad_width argument, to reduce artifacts at the edges.

I was not 100% sure about this PSF flip, but an empirical test seems to indicate that it should not be there. Specifically, try running demo with a non-symmetric PSF and then subtract the deconvolved result from the original image. With the PSF flip I get a lot of edge content due to a spatial shift, but without the flip it looks much better.

example

import numpy as np
from skimage import img_as_float, data, restoration
from scipy.ndimage import convolve
import matplotlib.pyplot as plt

camera = img_as_float(data.camera())
psf = np.zeros((7, 7))
psf[2:, 2:] = 1
psf /= psf.sum()
camera = convolve(camera, psf)
camera += 0.1 * camera.std() * np.random.standard_normal(camera.shape)
deconvolved = restoration.DNP_Gauss_freq(camera, psf)

plt.figure()
plt.imshow(deconvolved - img_as_float(data.camera()))

Below are results before and after removal of the flip:
psf_flip
psf_no_flip

adding pad_width=16 in the script above would also remove much of the ringing artifact at the boundary.

alignment of the deconvolved result seems incorrect when this flip is present
Gradient terms are implemented via 1D FFTs and broadcasting for efficiency
@alexjarosch
Copy link
Owner

@grlee77 Thank you for all these contributions! I did not have time this week to proceed on this and your work definitely makes the code more mature and user friendly. Regarding the double flip on the PSF, I had this from an older Matlab implementation and had it on my list to check if it is at all needed. Thus it's great that you have already tested for it.

94A6

@alexjarosch alexjarosch merged commit 9255247 into alexjarosch:deconvolution-gauss-prior Oct 29, 2020
@grlee77
Copy link
Author
grlee77 commented Oct 29, 2020

I did not have time this week to proceed on this and your work definitely makes the code more mature and user friendly.

No worries, we understand most contributions come from volunteer effort, so we don't expect updates to necessarily be quick. I just happened to be interested in taking a look at this and wanted to help out here. It is probably more often the case that PRs end up languishing for waiting on maintainers to review them as we are mostly on volunteer effort as well!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants
0