LPF in frequency domain

4 ビュー (過去 30 日間)
MANDA
MANDA 2022 年 12 月 3 日
回答済み: Gokul Nath S J 2022 年 12 月 6 日
clc; close all; clear
img = imread('PUPPY.jpg');
low_mask=zeros(M,N);
low_mask(M/2 - M/8:M/2 + M/8,N/2 - N/8:N/2 + N/8)=1; % DC+-16 pix : Low
LPF_img = ;%
How to make lpf image in frequency domain using this code ?
please .................
I don't know ....

回答 (1 件)

Gokul Nath S J
Gokul Nath S J 2022 年 12 月 6 日
Hi Manda,
I am assuming LPF to Low pass filtering in digital Image processing. Please find the following code as an extension. I have converted an rgb image to grayscale assuming that you are having a colour image. If not kindly skip this step.
clc; close all; clear;
img = imread(PUPPY.jpg);
imgGray = rgb2gray(img);
[M, N] = size(imgGray);
low_mask=zeros(size(imgGray));
low_mask(M/2 - M/8:M/2 + M/8,N/2 - N/8:N/2 + N/8)=1; % DC+-16 pix : Low
LPF_img = fft(imgGray) .* (low_mask);%
Filt_img = ifft(LPF_img);
imshow(abs(Filt_img),[]);
In the 7th line, I am doing a frequency domain multiplication (time domain convolution) between the images. Finally in line 8, I did an inverse Fourier transform to convert the image from frequency domain to the spatial one.
Hope this helps!

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by