Due date: 25 April 2016, Monday, 23:59 (It is a long HW. Better off starting now)
DIGITAL IMAGE PROCESSING
HOMEWORK 4
WIENER FILTERING
Give each of your answer in a separate section.
Note: To create a new section, just add two percentage character %% and a space, then your title.
Ex:
%% Adding Motion blur
a = ...
(50 points) Q1) Spatial domain
See http://uk.mathworks.com/help/images/examples/deblurring-images-using-a-wiener-filter.html
A) Write a MATLAB script section that reads the parrots image provided below.
Create another section for adding motion blur to the image.
Add a motion blur in 45 degree direction with 44 pixels length.
I got this image:
B) In a new section, restore the image using deconvolution wiener filter. See the link.
I got this:
C) In a new section, add a zero mean gaussian noise to the blurred image with variance 0.0001.
I got this:
D) In a new section, Try to restore the image using same method in B). You will fail. Explain why it fails.
I got this:
E) In a new section, restore the image utilizing the noise and signal variances. See the link.
I got this:
(100 points) Q2) Frequency domain
A) Implement motion blur effect in frequency domain. That is, implement the degradation function of it. See Eq. 5.6-10. Take T=1 and a=0.05. That applies motion blur in x direction only.
some part of my code is this:
%% Motion blur in Freq. domain
T=1; a= 0.05;
[u,v] = meshgrid(1:size(I,2),1:size(I,1));
H = ...
F = fft2(I);
G=F.*H; %note that this is dot multiplication. We never need matrix multiplication or division in this HW.
Ig = abs(ifft2(G));
imshow(Ig);
title('Motion blur in freq domain')
B) Apply inverse filtering.
...
FinvFiltered = G./H;
...
C) Add a zero mean UNIFORM noise in range [-0.001,0.001] in frequency domain to the blurry image.
D) Try inverse filtering on the noisy blurred image. It should fail. Explain the reason.
...
imagesc(InoisyInvFiltered)
...
E) Implement Wiener filter in frequency domain. See Eq. 5.8-2. Apply it assuming that we know power spectrum of noise and undegraded image. See end of page 375.
F) Suppose that we do not know power spectrum of noise or undegraded image. Then we give a constant value as in 5.8-6 and find the best K just by trial and error. Find the best K and apply Eq. 5.8-6.