Wiener filter image restoration

%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?

답변 (1개)

Image Analyst
Image Analyst 2020년 10월 3일

0 개 추천

Try imshow() with [] instead:
subplot(1,2,2); % Display in the right hand axes.
imshow(abs(I_recon), []);

댓글 수: 6

Kat_33
Kat_33 2020년 10월 3일
I did try that before, it doesnt solve my problem unfortunately
Image Analyst
Image Analyst 2020년 10월 3일
Why do you say you can't get I_recon? Does the fft2() or ifftshift() not work or throw an error or something? It's not just going to finish with no I_recon being created unless an error is thrown. Do you see I_recon in the workspace? Do you see any red error text (that you forgot to attach)? Please reply after you read this link.
Or do you actually get I_recon (contrary to what you said), but you just don't like how it looks?
Kat_33
Kat_33 2020년 10월 3일
As I said, I'm not getting anything that looks like the reconstructed image, its simply noise without any trace of the original picture
Image Analyst
Image Analyst 2020년 10월 4일
Then I guess you didn't pick the correct inverse filter - the same one used to blur the image in the first place.
Kat_33
Kat_33 2020년 10월 4일
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 2020년 10월 4일
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.

댓글을 달려면 로그인하십시오.

카테고리

도움말 센터File Exchange에서 Floating-Point to Fixed-Point Conversion에 대해 자세히 알아보기

질문:

2020년 10월 3일

댓글:

2020년 10월 4일

Community Treasure Hunt

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

Start Hunting!

Translated by