problem in executing,wiener program
Mostrar comentarios más antiguos
Hi,
I have been working on the wiener filter for images, and have a question regarding the executing when I want to execute my program,this problem appear and I do not know how to solve it.
My Program
clc;
x = imread('lena.jpg');
[m n]=size(x);
figure(1),
imshow(x);
%%adding noise to image .
afterNoise = imnoise(x,'gaussian',0,0.025);
figure,
imshow(afterNoise);
%Implementing Wiener filter
N = size(x,1);
Yf = fft2(x);
Hf = fft2(afterNoise,m,n);
Pyf = abs(Yf).^2/N^2;
gamma=1;
alpha=1;
sigma=1;
% direct implementation of the regularized inverse filter,
% when alpha = 1, it is the Wiener filter
% Gf = conj(Hf).*Pxf./(abs(Hf.^2).*Pxf+alpha*sigma^2);
% Since we don't know Pxf, the following
% handle singular case (zero case)
sHf = Hf.*(abs(Hf)>0)+1/gamma*(abs(Hf)==0);
iHf = 1./sHf;
iHf = iHf.*(abs(Hf)*gamma>1)+gamma*abs(sHf).*iHf.*(abs (sHf)*gamma<=1);
Pyf = Pyf.*(Pyf>sigma^2)+sigma^2*(Pyf<=sigma^2);
Gf = iHf.*(Pyf-sigma^2)./(Pyf-(1-alpha)*sigma^2);
% max(max(abs(Gf).^2)) % should be equal to gamma^2
% Restorated image without denoising
eXf = Gf.*Yf;
ex = real(ifft2(eXf));
figure(3),
imshow(ex,gray(256));
Please help me, not ignore my question.
Thanks in advance
1 comentario
bym
el 23 de Abr. de 2011
what does whos('x') return?
Respuesta aceptada
Más respuestas (0)
Categorías
Más información sobre Image Filtering and Enhancement en Centro de ayuda y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!