| View previous topic :: View next topic |
| Author |
Message |
Guest
|
Posted: Mon Oct 06, 2008 12:13 pm Post subject: wiener filter 2D |
|
|
Hi,
I have been working on the wiener filter for images, and have a
question regarding the implementation.
I found a document describing such a filter:
http://blogs.mathworks.com/steve/2007/11/02/image-deblurring-wiener-filter/
which provides wiener filter coefficients formula:
W(u,v) = H(u,v) / (|H(u,v)|^2 + Sn / Sx(u,v))
but in some other documents I found:
W(u,v) = H*(u,v) / (|H(u,v)|^2 + Sn / Sx(u,v))
W - wiener coeffiecients
H - PSF (H* - the conjucture of H)
Sn - noise spectra
Sx - original image spectra
Regarding this I have a few questions:
1) which of these equations is correct?
2) should the PSF be complex at all?
Additionally I would be obliged for information regarding the PSF
function - what kind of function is usually used?
I would also like to clarify whether "image power spectra" equals
autocorrelation in the frequency domain (as I read in one of the
documents), and whether the "image power spectra" is calculated as
e.g. Sx(u,v) = |S(u,v)|^2 ?
Thanks in advance,
--
rga |
|
| |
|
Back to top |
Martin Brown Guest
|
Posted: Mon Oct 06, 2008 6:01 pm Post subject: Re: wiener filter 2D |
|
|
rgarbacz@googlemail.com wrote:
[quote]Hi,
I have been working on the wiener filter for images, and have a
question regarding the implementation.
I found a document describing such a filter:
http://blogs.mathworks.com/steve/2007/11/02/image-deblurring-wiener-filter/
which provides wiener filter coefficients formula:
W(u,v) = H(u,v) / (|H(u,v)|^2 + Sn / Sx(u,v))
but in some other documents I found:
W(u,v) = H*(u,v) / (|H(u,v)|^2 + Sn / Sx(u,v))
W - wiener coeffiecients
H - PSF (H* - the conjucture of H)
Sn - noise spectra
Sx - original image spectra
Regarding this I have a few questions:
1) which of these equations is correct?
2) should the PSF be complex at all?
[/quote]
If you restrict yourself to the 1-D case to get a feel for things you
might like to consider the ramp psf h(x) = { 4, 3, 2, 1, 0, 0, ... }
and its Fourier representation H(u)and what it would mean in the above.
Another simple case which will shed some light is h(x) = delta(x-x0)
(pure translation with no blurring)
A symmetric psf placed at the origin will be exactly representable as a
linear combination pure cosines - anything else will be complex.
[quote]
Additionally I would be obliged for information regarding the PSF
function - what kind of function is usually used?
[/quote]
Something that bears a passing resemblance to the psf which blurred the
target image. Commonly uniform disk, Gaussian, Bessel function,
Lorentzian or some combination of them according to the situation.
Regards,
Martin Brown
** Posted from http://www.teranews.com ** |
|
| |
|
Back to top |
Guest
|
Posted: Thu Oct 16, 2008 5:19 am Post subject: Re: wiener filter 2D |
|
|
On Oct 6, 8:01 am, Martin Brown <|||newspam...@nezumi.demon.co.uk>
wrote:
[quote]Additionally I would be obliged for information regarding the PSF
function - what kind of function is usually used?
Something that bears a passing resemblance to the psf which blurred the
target image. Commonly uniform disk, Gaussian, Bessel function,
Lorentzian or some combination of them according to the situation.
[/quote]
Thank you very much for your help. I used Gaussian PSF and got decent
results.
I would be grateful for some additional help: when applying Gaussian
PSF, the output image brightness very depends on used sigmas. I solved
it by modifying the Gaussian PSF adding a little bit different
normalization.
The used Gaussian equation:
1.0 / (2*PI*SigX*SigY) * exp ( - ( (x-x0)^2/(2*SigX^2) + (y-y0)^2/
(2*SigY^2) ) )
To get decent results I had to change A to 1.0 /
(2*PI*sqrt(SigX*SigY))
which bothers me a little, since it should not be like this. I would
be grateful for suggestions regarding this issue.
Additionally after applying my wiener filter I get artefacts at the
image border (dark and white lines), which cripples the results from
the "automatic histogram expansion" filter. Does someone know what can
be the reason for such artefacts?
Thanks in advance.
--
rgarbacz |
|
| |
|
Back to top |
Martin Brown Guest
|
Posted: Thu Oct 16, 2008 10:06 am Post subject: Re: wiener filter 2D |
|
|
On Oct 16, 6:19 am, rgarb...@googlemail.com wrote:
Normalisation issues are generally related to how your FFT is
configured.
[quote]Additionally after applying mywienerfilterI get artefacts at the
image border (dark and white lines), which cripples the results from
the "automatic histogram expansion"filter. Does someone know what can
be the reason for such artefacts?
[/quote]
Welcome to the real world of image deconvolution. There is an implicit
edge discontinuity in the periodic FFT of an image (either
translational in the most common implementation or mirror reflection
which is less common). Shift the image along by N/2 M/2 before
applying the filter to see what I mean. Then you will have the mangled
cross in the middle of the deconvolved image and the nicely
deconvolved stuff relegated to the corners.
The most practical solution is to preblur a copy of the image with
your psf and replace the discontinuous border with a pre blurred
version of itself which fades out to nothing over about 1 psf diameter
from the edge. Then the filter will give you back something like the
original image at the edges and work on the rest of the image.
Regards,
Martin Brown |
|
| |
|
Back to top |
|