Code covered by the BSD License  

Highlights from
Ideal Low Pass Filter

2.85714

2.9 | 21 ratings Rate this file 55 Downloads (last 30 days) File Size: 1.2 KB File ID: #13586

Ideal Low Pass Filter

by

 

09 Jan 2007 (Updated )

Ideal Low Pass Filter using DFT

| Watch this File

File Information
Description

Ideal Low Pass Filter using Discrete Fourier Transform

Acknowledgements

This file inspired Ideal Low Pass Filtering Of An Image.

Required Products Image Processing Toolbox
MATLAB release MATLAB 7 (R14)
Tags for This File   Please login to tag files.
Please login to add a comment or rating.
Comments and Ratings (25)
24 Apr 2013 hewaa mero

when i am using this code and giving input as
f=imread('lena.jpg'); and after running it is giving the following error

??? Input argument "P" is undefined.

Error in ==> idealfilter at 13
H=double(D<=P);

can any body tell me how can i remove dis error...

07 Apr 2011 JOSE RAMON SIERRA BLASCO  
30 Jan 2011 amitesh kumar

when i am using this code and giving input as
f=imread('lena.jpg'); and after running it is giving the following error

??? Input argument "P" is undefined.

Error in ==> idealfilter at 13
H=double(D<=P);

can any body tell me how can i remove dis error...

17 Nov 2010 Ömer KAYA

The thing is that everybody said; this is junk this that this is it...

It is just code... a helpfull one... just download and use...
it says.. imread(X)... what else do you need for to get the code running.... just an input image...

Rest is detail... it works...

10 Mar 2010 velocity speed

Hello,
I'm reinhart..
I still don't know what the meaning of parameter P?
can I request an explanation?
Thank you,

02 Nov 2009 steppenwolf Nayak

thanks a lot.. could you clarify about the parameter P?

07 Apr 2009 Ricardo Barrios  
23 Oct 2008 Adam Baker

File exchange could do without this kind of submission. No explanation at all.

30 Sep 2008 Alejandro Stepnik

Hi, I am new to image processing and i need to filter some grayscale images with low and high frequency band filters.
Your code works fine but I still don't quite understand the parameter P. If I had to filter the image so that only frequencies < 6 cycles per degree where displayed on the image when viewed form 80 cm distance, then don't know how to calculate the accurate P value.
Could you give me a hint on this? I would really apreciate it

Thank you very much

07 Jul 2008 AB C

I think, if you wnat to use this to a full color image, you might need some changes...

%Question No:5
%IDEAL LOW-PASS FILTER

function idealfilter(X,P)
f=imread(X);
[M,N,O]=size(f);
F=fft2(double(f));
u=0:(M-1);
v=0:(N-1);
idx=find(u>M/2);
u(idx)=u(idx)-M;
idy=find(v>N/2);
v(idy)=v(idy)-N;
[V,U]=meshgrid(v,u);
D=sqrt(U.^2+V.^2);
H=double(D<=P);
G=F;
for i = 1:O
G(:,:,i) = H.*F(:,:,i);
end
g=uint8(real(ifft2(double(G))));
imshow(f),figure,imshow(g);
end

02 Jun 2008 yu peter

??

10 May 2008 nancy m

this is a load of crap!

24 Apr 2008 senthilkumar subramaniam

can anyone tell me how to implement this file ? It can't work. When i run the file from editor/debug, errors appear.

31 Mar 2008 prom etheus

awful

11 Mar 2008 PT sad

The worst low-pass filter ever. Not ideal at all. That's hard to believe than more than 5000 (hopeless?) people have downloaded it. Examples in the Matlab documentation are by far much better (and not poorly coded). Is FEX finally just a collection of irrelevant poor codes?

10 Mar 2008 Xander Baker

This code has no comments, but it works just spledidly -- it was designed for 2-D Images of a generic length. As a better illustration, try this code for an image with equal height and width.

% Ideal low pass filter
img = X/max(max(X));
P=[10 20 50 100];
% generate a mask to apply over the
% image's fourier transform.
% for square images, we can simplify the
% code to make a mask:
[L,W]=size(img);
for t=1:length(P)
for i=1:L
for j=1:L
dFromCenter = sqrt((i-L/2)^2 + (j-L/2)^2);
H(i,j)=double(dFromCenter<=P(t));
end
end
% apply the mask over the transform
F=fftshift(fft2(img)); % fft the image,
% bringing the 0
% frequencies to
% center
G=fftshift(H.*F); % mask out outer
% frequencies and shift
% back to image state
g=real(ifft2(double(G)));
figure(5);
subplot(2,2,t);
imshow(g);
title(sprintf('ILPF P=%1.f',P(t)));
end

13 Nov 2007 Duane Hanselman

This is just a poorly done homework problem. What does ideal mean? Here is the first three lines of the file:
%Question No:5
%IDEAL LOW-PASS FILTER
function idealfilter(X,P)

11 Nov 2007 Stewart Thomas

This program is horrible. Not a single comment, no explanation of how to use. This is not even ready to be generalized.

06 Oct 2007 h j  
24 Sep 2007 S K

This is a perfect example of junk submission- posting some badly written homework assignments. Please remove it all from FEX, there is enough junk already.

2 charles khoo: You marked file that you couldn’t even run as excellent. I wonder what mark do you give to the function that DOES work?

24 May 2007 charles khoo

Hallo, can anyone tell me how to implement this file ? It can't work.
When i run the file from editor/debug, errors appear.

27 Mar 2007 Jithin R.G  
19 Mar 2007 martin barrera

Thanks a lot.

09 Feb 2007 Deepan chakravarrthy  
28 Jan 2007 ARJUN KUMAR

Thanks for helping program

Contact us