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.

Don't use plagiarized sources. Get Your Custom Essay on

Write a program to implement the Gaussian low pass filter

Just from $13/Page

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.