2.83333

2.8 | 18 ratings Rate this file 668 downloads (last 30 days) File Size: 1.2 KB File ID: #13586

Ideal Low Pass Filter

by Madhu S. Nair

 

09 Jan 2007 (Updated 12 Jan 2007)

Code covered by BSD License  

Ideal Low Pass Filter using DFT

Download Now | Watch this File

File Information
Description

Ideal Low Pass Filter using Discrete Fourier Transform

Required Products Image Processing Toolbox
MATLAB release MATLAB 7 (R14)
Tags for This File  
Everyone's Tags
Tags I've Applied
Add New Tags Please login to tag files.
Comments and Ratings (20)
28 Jan 2007 ARJUN KUMAR

Thanks for helping program

09 Feb 2007 Deepan chakravarrthy  
19 Mar 2007 martin barrera

Thanks a lot.

27 Mar 2007 Jithin R.G  
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.

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?

06 Oct 2007 h j  
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.

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)

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

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?

31 Mar 2008 prom etheus

awful

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.

10 May 2008 nancy m

this is a load of crap!

02 Jun 2008 yu peter

??

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

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

23 Oct 2008 Adam Baker

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

07 Apr 2009 Ricardo Barrios  
02 Nov 2009 steppenwolf Nayak

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

Please login to add a comment or rating.
Tag Activity for this File
Tag Applied By Date/Time
filtering Madhu S. Nair 22 Oct 2008 08:55:43
ideal low pass filter Madhu S. Nair 22 Oct 2008 08:55:43
ideal low pass filter heba saad 30 Dec 2008 15:13:32
ideal low pass filter Johannes 11 Sep 2009 04:39:47
ideal low pass filter Zoltan 18 Sep 2009 04:49:57
filtering Zoltan 18 Sep 2009 04:50:03
 

MATLAB Central Terms of Use

NOTICE: Any content you submit to MATLAB Central, including personal information, is not subject to the protections which may be afforded information collected under other sections of The MathWorks, Inc. Web site. You are entirely responsible for all content that you upload, post, e-mail, transmit or otherwise make available via MATLAB Central. The MathWorks does not control the content posted by visitors to MATLAB Central and, does not guarantee the accuracy, integrity, or quality of such content. Under no circumstances will The MathWorks be liable in any way for any content not authored by The MathWorks, or any loss or damage of any kind incurred as a result of the use of any content posted, e-mailed, transmitted or otherwise made available via MATLAB Central. Read the complete Terms prior to use.

Contact us at files@mathworks.com