Wiener filter image restoration

10 visualizzazioni (ultimi 30 giorni)
Kat_33
Kat_33 il 3 Ott 2020
Commentato: Image Analyst il 4 Ott 2020
%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?

Risposte (1)

Image Analyst
Image Analyst il 3 Ott 2020
Try imshow() with [] instead:
subplot(1,2,2); % Display in the right hand axes.
imshow(abs(I_recon), []);
  6 Commenti
Kat_33
Kat_33 il 4 Ott 2020
But I didn't apply any filter to blur the image. It is already blurred and I'm trying to unblur it using the wiener formula as I wrote it above(without using deconvwnr), not sure why its not working
Image Analyst
Image Analyst il 4 Ott 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.

Accedi per commentare.

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by