Software routine to generate the formulated degradation function and obtain the blurred image;
And
Image restoration software routine that applies Wiener filtering and obtain the restorated image by using the Wiener filter formulation;
function [H W] = deg_filter(sigma,K,r,c)
for k=1:r
u=-pi+((k-1)*2*pi/r)*1i;
for l=1:c
v=-pi+((l-1)*2*pi/c)*1i;
H(k,l)=-sqrt(2*pi)*sigma*(u^2+v^2)*exp(2*pi*sigma*(u^2+v^2));
W(k,l)=H(k,l)/(H(k,l).^2+K);
end
end
end
file = uigetfile(‘*.jpg’);
if ~isequal(file, 0)
K = handles.K;
sigma = handles.sigma;
Im=imread(file);
Im_gray=rgb2gray(Im);
[r,c] = size(Im_gray);
figure;
subplot(2,2,1); imagesc(Im_gray); colormap(gray);
title(‘Original Image’);
fourier_image=fft2(Im_gray);
[H W] = deg_filter(sigma, K, r, c);
son=real(ifft2(H.*fourier_image));
fft_son=(H.*fourier_image);
subplot(2,2,2); imagesc(son); colormap(gray);
title(‘Blurred Image’);
F = real(ifft2(W.*fft_son));
subplot(2,2,3); imagesc(F); colormap(gray);
title(‘Restored Image’);




Indentation ve de Higlighting diyorum, gerisini de sen anla diyorum