Gaussian mask for low-pass filter in frequency domain.
Show older comments
Hey i want to do simple low-pass filter in frequency domain with cutoff frequency 0,2. I need to create mask in frequency plane. Here is my code but it is not elegant at all. Since i am using normalized frequency i have to use normalize distance is that right? is there a elegant way to do it without so many loops? i have to do it manually without using fspecial function. Thank you!
[m n]=size(im);
p=m/2;
q=n/2;
d0=0.2;
for i=1:m
for j=1:n
distance(i,j)=sqrt(((i-p)^2+(j-q)^2));
end
end
distance=mat2gray(distance);
for i=1:m
for j=1:n
Hglp(i,j)=(exp(-(distance(i,j))^2/(2*(d0^2))));
end
end
Accepted Answer
More Answers (0)
Categories
Find more on Image Filtering in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!