Вы находитесь на странице: 1из 2

TASK 01: (02 Marks)

Write a MATLAB program to get the Fourier Spectrum of an image.


img=imread('cameraman.tif');
dbl=im2double(img);
ft=fft2(dbl);
figure,imshow(ft),title('fft image');

TASK 02: (02 Marks)


Write a MATLAB program to implement Ideal low pass filtering.

img=imread('cameraman.tif'); figure,imshow(h),title('filter design


dbl=im2double(img); image');
ft=fft2(dbl);
d0=input('enter input');
figure,imshow(ft),title('fft image'); i=(h).*(ft_shift);
ft_shift=fftshift(ft); ifft=ifftshift(i);
figure,imshow(ft_shift),title('fftshift figure,imshow(ifft),title('Ideal low
image'); pass image');
[m n]=size(dbl);
[u v]=meshgrid(-128:127,-128:127);
mag=sqrt(u.^2+v.^2); realifft=real(ifft2(ifft));
h=im2double(mag<=d0); figure,imshow(realifft);

TASK 04: (02 Marks)


Write a MATLAB program to implement Butterworth low pass filtering.
img=imread('cameraman.tif'); subplot(323),imshow(h),title('filter
dbl=im2double(img); design image');
ft=fft2(dbl);
d0=input('enter input');
subplot(321),imshow(ft),title('fft i=(h).*(ft_shift);
image'); ifft=ifftshift(i);
ft_shift=fftshift(ft);
subplot(322),imshow(ft_shift),title('ffts subplot(324),imshow(ifft),title('Butterwo
hift image'); rth low pass image');
[m n]=size(dbl);
[u v]=meshgrid(-128:127,-128:127);
d=sqrt(u.^2+v.^2); realifft=real(ifft2(ifft));
h=double(1./(1+(d/d0).^2)); subplot(325),imshow(realifft);
TASK 03: (02 Marks)
Write a MATLAB program to implement Gaussian low pass filtering.
.
img=imread('cameraman.tif'); subplot(323),imshow(h),title('filter
dbl=im2double(img); design image');
ft=fft2(dbl);
d0=input('enter input');
subplot(321),show(ft),title('fft image'); i=(h).*(ft_shift);
ft_shift=fftshift(ft); ifft=ifftshift(i);
subplot(322),imshow(ft_shift),title('ffts
hift image'); subplot(324),imshow(ifft),title('Gaussian
[m n]=size(dbl); low pass image');
[u v]=meshgrid(-128:127,-128:127);
d=sqrt(u.^2+v.^2);
h=exp(-d.^2/(2*(d0.^2))); realifft=real(ifft2(ifft));
subplot(325),imshow(realifft);

Вам также может понравиться