Wiener filter image restoration
8 views (last 30 days)
Show older comments
%parameter T (observation time) and motion rate
T=1; ax=30; ay=40; NSR=0; %since no noise
%reading the blurred picture
I=im2double(imread('blur.bmp'));
%generating frequencies for the blurring model
u=linspace(-0.5,0.5,size(I,2));
v=linspace(-0.5,0.5,size(I,1));
[U,V]=meshgrid(u,v);
H=(T./(pi*(U*ax+V*ay))).*sin(pi*(U*ax+V*ay)).*exp(-1i*pi*(U*ax+V*ay));
I_f=fft2(I);
I_motion_fn=fftshift(I_f);
wiener=(1./H).*((H.^2)./((H.^2)+NSR));
I_recon_fn=I_motion_fn.*wiener;
I_recon=ifft2(ifftshift(I_recon_fn));
figure(1);
subplot(1,2,1), imagesc(I), colormap(gray)
title('original image')
subplot(1,2,2),imagesc(abs(I_recon))
title('reconstruction using wiener')
Im trying to restore the following image using a wiener filter as show above, however im not getting the reconstructed image, what is the issue? I know that a wiener filter with no noise acts like an ideal inverse filter, however applying the code above is not showing me the reconstructed image

Also, if I were to do the same code but using the built in deconvwnr filter, how would I go around that using the parameters I have?
0 Comments
Answers (1)
Image Analyst
on 3 Oct 2020
Try imshow() with [] instead:
subplot(1,2,2); % Display in the right hand axes.
imshow(abs(I_recon), []);
6 Comments
Image Analyst
on 4 Oct 2020
Rather than starting out with some image where you don't know the blur kernel, start out with a known image, and then blur it with a known kernel. Then use that to see how well you can undo the blur using the known kernel.
See Also
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!