# Basic Wiener application

I'm trying to filter this $$g(x,y)$$ WGN added

My Wiener filter is:

$$H(u,v) = \frac{P_{f}}{P_{f}+P_{n}}$$

Where the image power spectral density $$P_{x}$$ is estimated as $$\frac{|X(u,v|^{2}}{N^{2}}$$, $$X$$ being the FFT and $$N^{2}$$ its size.

Since image and noise are uncorrelated $$P_{g} = P_{f}+P_{n}$$, thus

$$H(u,v) = \frac{P_{g} - P_{n}}{P_{g}}$$

The noise variance is known, and the noisy image PSD is estimated as shown above. The application of the filter though yields disappointing results: Any ideas on what I may be doing wrong?

• What are you doing with the phase of the Wiener filter ? – Hilmar May 26 at 13:44

The typical derivation of the Wiener filter in Fourier domain arrives at the expression $$H(u,v) = {\frac {B^*(u,v)S_{ff}(u,v)} {|B(u,v)|^2 S_{ff}(u,v) + S_{nn}(u,v)}}$$ where $$H(u,v)$$ is the Wiener filter in agreement with your designation, $$B$$ is the point-spread function (blurring filter), and I rename your $$P$$'s into $$S$$'s in order to reserve the character $$P$$ for a common PSD. In keeping with your use of $$f$$ subscripts for the original image and $$g$$ for this image with WGN added, $$S_{ff}(u,v)$$ is the (supposedly unknown) power spectrum of the original image before the noise was added.
Using the periodogram technique to estimate the power spectrum from the DFT of the observation $$X(u,v)$$, one can write $$S^{periodogram} = |X(u,v)|^2/N^2$$ and then arrive at the expression similar to your $$H(u,v) = (P_g - P_n)/P_g$$: $$H(u,v) = {1 \over B}{\frac {S^{periodogram}(u,v) - S_{nn}}{S^{periodogram}(u,v)}}$$ with the remarkable appearance of the $${1 \over B}$$ factor.
Now, there can arise problems with the inverse of the point-spread function $$B(u,v)$$. The solution is to use matrix pseudoinverse.
Back to your question: you failed to reconstruct a denoised image because you omitted the averaging in the pixel neighborhoods. Experimentation with MATLAB function wiener2(I,[m n]) for the pixel-wise adaptive low-pass Wiener filtering with different sizes of the pixel neighborhood would help you understand the working of the Wiener filter on noisy images. You would see how the choice of optimal m,n values depends on the local image variance.