Wiener Filter

Wiener filter is a filter used to remove degradation from a image without being affected by noise that’s present in the image. If wiener filter is not used, and the image is restored just by dividing the frequency domain of an image by the frequency domain of the future, the image will be badly corrupted by noise and the portion that lies on high frequency.

As shown in the image of a gaussian filter  below, it’s obvious that values on that are not within the red lines are close to 0. Thus if we divide an image by that filter, we’ll have values close to infinity which will corrupt our image.


Thus we come up with a filter called the wiener filter which solves this problem. The equation of the wiener filter is shown below. The main goal of the wiener filter is to attenuate corruption of the filter at high frequencies.

{\begin{aligned}G(f)&={\frac {1}{H(f)}}\left[{\frac {|H(f)|^{2}}{|H(f)|^{2}+{\frac {N(f)}{S(f)}}}}\right]\\&={\frac {1}{H(f)}}\left[{\frac {|H(f)|^{2}}{|H(f)|^{2}+{\frac {1}{\mathrm {SNR} (f)}}}}\right]\end{aligned}}

To further simplify the Wiener Filter, we can set \frac{1}{SNR(f)} as K .


We’re going to implement the Wiener filter using few well known filters. The first filter that we’re about to try on is the Gaussian filter.

Blurred Image

We start with an image that’s blurred.


We assume that it’s degraded by gaussian blur. thus in order to restore that image, we’ve to first generate a gaussian mask in the spacial domain. Next, we convert the mask to frequency domain. The mask is picked based on the sigma that gives the highest Peak signal-to-noise ratio (PSNR). The formula for PSNR is given below:


Once we obtain the frequency domain of our gaussian filter, we plug it into the formula used for computing Wiener Filter. The Gaussian Filter will be H(f) in our formula.

Next we multiply the Wiener Filter with the frequency domain of our original image and the result is shown as follow:


It can be seen that the result is better than the original image but there’s still a gap from the original image.

The original image is shown below:


Blurred Image with Noise


The next image that we’re going to deal with is a bit tricky. It has noise that are distributed evenly throughout the entire image. It looks like salt noise to me, thus I first pass the image below through a median filter as shown below:


It can be seen that most of the noise is filtered out, but there’re still some noise present that’d be bad for our computations later.

We next convert the image into its frequency domain. We’ll also use gaussian filter as our deblurring tool here. The sigma we picked is 4.5 which produces that highest PSNR.

The filter is also passed into a Wiener Filter and it’s multiplied with the image in the frequency domain. The result is shown below:


It can be seen that the image is still far from perfect compared to the original image shown below:


Motion Blur

The next image that we’re about to work with is an image that has a motion blur in the upper right direction.


To deal with this kind of image, we’ve to create our own mask. The mask I used is shown below:


The ones will extend towards the bottom left depending on the amount of extends that gives the best results. It will then be divided by the total number of ones to normalize the mask.

The mask is then placed in the middle in the spacial domain padded with zeros until it reaches the size of the original image. The resulting image is then transformed into the frequency domain.

The filter is then placed into the Wiener filter and then multiplied with the frequency domain of the original image.

The result is shown below:


The result does not look perfect and does not gives the highest PSNR based on my measurement. I picked this as my result because it’s the answer closest to the original image where the “motion” is centered to where it’s supposed to be. The original image is shown below:



Leave a Reply

Please log in using one of these methods to post your comment: Logo

You are commenting using your account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s