Posted: May 22nd, 2023
Plot the filter using “mesh†or “surfaceâ€; filter the test image “img03.jpg†with ideal low pass filter with cutoff frequencies set at radii values 5, 30, 80 and 230.
The Gaussian Low pass filter code is given below. The values of the radial distance can be modified easily using the code [4].
%% Q# 4 Gaussian Low Pass Filter
clc
clear all;
close all;
I = imread(‘img03.jpg’); %% Reading Input Image
[m,n]=size(I);%% finding size of image and stroing in m and n
D0 = 5;%% CHANGE the distance parameter and observe the result
[u,v]=dftuv(m,n);%% Creating
d= sqrt(u.^2 + v.^2);%% Calculating the distance
G_Lfilt = exp(-(d.^2)./(2*(D0^2)));
G_Lfilt_s = fftshift(G_Lfilt);
Iff = fft2(I);%% Fourier Transform of the image
Rf = Iff.*G_Lfilt; %Multiplying filter with the image both are in Fourier Domain
R = ifft2(Rf); % Inverse fourier transfrom of the above filtered image
figure;
% Displaying the original image
subplot (2,2,2); imshow(I);title(‘Original Image’)
% Displaying the final result
subplot (2,2,4); imshow(R,[]);title(‘Resultant Image after Filtering’)
% Displaying the mesh plot of filter tranfer function
subplot (2,2,[1,3]); mesh(G_Lfilt_s);title(‘Filter Mesh Plot D0 = 5’)
Place an order in 3 easy steps. Takes less than 5 mins.