Matlab Exercise
a)Filter the image using both filters and display the original image(By loading and displaying ‘rice.png’ image by converting variable format to “double”.) and filtered images. (Image must be displayed in gray scale. Axis spacings must be equal and axis labels must be turned off. Each image must have its own color bar.)
b). Take [256, 256] Fourier Transform of the image ,[256, 256] Fourier Transform of the filters and take inverse Fourier Transform of filtered images.
b)What kind of filters are filt1 ve filt2 and what is the difference between them
close all,
clear all,
clc,
Orig = imread('rice.png');
subplot(1,3,1); imshow(Orig); title('Original Image');
Filt_1 = [1,2,1;2,4,2;1,2,1]; Filt_1 = (1/16)*Filt_1;
Mask_1_Filter_Image = imfilter(Orig,Filt_1);
subplot(1,3,2); imshow(Mask_1_Filter_Image); title('Filter Image
using Filt_1');
Filt_2 = [1,1,1,1,1;1,1,2,1,1;1,2,4,2,1;1,1,2,1,1;1,1,1,1,1];
Filt_2 = (1/32)*Filt_2;
Mask_2_Filter_Image = imfilter(Orig,Filt_2);
subplot(1,3,3); imshow(Mask_2_Filter_Image); title('Filter Image
using Filt_2');
figure,
Y = fft2(Orig,256,256);
subplot(2,2,1); imshow(Y); title('FFT of Original Image');
InverseFFT = ifft2(Y);
subplot(2,2,2); imshow(Y); title('Inverse Transform');
Y = fft2(Filt_1,256,256);
subplot(2,2,3); imshow(Y); title('FFT of FILT_1');
Y = fft2(Filt_2,256,256);
subplot(2,2,4); imshow(Y); title('FFT of FILT_-2');
Matlab Exercise a)Filter the image using both filters and display the original image(By loading and displaying ‘rice.png...