%[x,y]=meshgrid(-128:127,-128:127);
%z=255*sin(2*pi*((30/256)*x+(10/256)*y));
%figure, imshow(z)
%figure, surf(z), shading interp, colormap bone

%Basic code to create filters
[u,v]=meshgrid(-128:127,-128:127);
Duv=sqrt(u.^2+v.^2);
%the ideal filter
D0=(Duv<35);
%The Vutterworth filter
B=1./(1+((u.^2+v.^2)/35^2));
B=1-B;
%figure, imshow(D0)

c=imread('cameraman.gif');
figure, imshow(c)
%Compute Fourier transform
F=fftshift(fft2(c));
figure, imshow(mat2gray(log(1+abs(F))))
%Filter the image
%cF=F.*D0;
cF=F.*B;

figure, imshow(mat2gray(log(1+abs(cF))));
%Going back to spatial domain
IcF=ifft2(cF);
figure, imshow(mat2gray(abs(IcF)))
