4.07463

4.1 | 69 ratings Rate this file 492 downloads (last 30 days) File Size: 2.49 KB File ID: #5237

2D Gabor Filter(Ver1,2,3)

by Ahmad Poursaberi

 

13 Jun 2004 (Updated 10 Nov 2004)

No BSD License  

To design 2D Gabor filter and apply it to image.

Download Now | Watch this File

File Information
Description

Recent studies on Mathematical modeling of visual cortical cells [Kulikowski/Marcelja/Bishop:1982] suggest a tuned band pass filter bank structure. These filters are found to have Gaussian transfer functions in the frequency domain. Thus, taking the Inverse Fourier Transform of this transfer function we get a filter characteristics closely resembling to the Gabor filters. The Gabor filter is basically a Gaussian (with variances sx and sy along x and y-axes respectively) modulated by a complex sinusoid (with centre frequencies U and V along x and y-axes respectively).

Gabor filters are used mostly in shape detectin and feature extractin in image processing.

function [G,gabout] = gaborfilter1(I,Sx,Sy,f,theta);
from 'gaborfilter1' with different f(Frequency) and theta(Angle).
for example

f:0,2,4,8,16,32
theta = 0,pi/3,pi/6,pi/2,3pi/4

then for any input image like(eg. stereo.jpg)

you have 6x5 = 30 filtered images.

You can choose your desired angles or frequencies.

You can put nominaly Sx & Sy = 2,4 or some one else.

For instance I tested above example on ('cameraman.tif')(in MATLAB pictures)

I = imread('cameraman.tif');
[G,gabout] = gaborfilter1(I,2,4,16,pi/3);
figure,imshow(uint8(gabout));

Acknowledgements
This submission has inspired the following:
Gabor filter
Required Products Filter Design Toolbox
Image Processing Toolbox
MATLAB release MATLAB 6.5 (R13)
Zip File Content  
Other Files gaborfilter.m,
gaborfilter2.m,
gaborfilter1.m
Tags for This File  
Everyone's Tags
Tags I've Applied
Add New Tags Please login to tag files.
Comments and Ratings (83)
19 Jun 2004 mana sh

thx,very complete!!

21 Jun 2004 robert kelly

I need this for my project very very much.You do it well:))

02 Jul 2004 khaled sultan

thnka

05 Jul 2004 ali adhami

very powerfull!

05 Jul 2004 Jesmin Khan  
02 Aug 2004 Viara Van Raad

Usually 2D design of Gabor filters require DESIGN in 2D Frequency ( because it can easily get out of boounds!). This is related to several issues:
a) not obeying the Nyquist criteria
b) phase distortions
c) not forming a '' frame'' see 10 lectures on wavelets
d) mack up in 2D frequencies
and some others. The design in space is naive.

09 Nov 2004 Daniel Garcia

It is good

04 Dec 2004 Alex Leykin

The normalization doesn't work. The repsonse jumps out of bounds at pi/2

21 Apr 2005 Natalia Zabrydowa

thank you:)

28 Apr 2005 Luigi Rosa

Excellent work. In order to improve filtering performances a Recursive Gabor filtering for 1D and 2D signals is required.

For more information please visit:
 
http://utenti.lycos.it/matlab/gabor.htm

20 May 2005 Pablo Suau

It doesn't work when using pi/2

27 Jun 2005 abdel oranov

les deux filtre ne sont pas symetrique.
pour verifier tu fais sum(G1(:)) tu va trouver que ce n'est pas tjr symetrique;

03 Jul 2005 adek yudi

after I tried, I think it's great...!!!

11 Jul 2005 ahmad vazvani  
08 Aug 2005 gopal krishnan  
31 Aug 2005 Basabdatta Bhattacharya  
01 Sep 2005 Fiona Yu

The mask matrix is excellent in approximation to the Gaussian envelope.

23 Sep 2005 Peng Zhangping

i want to process the image of fingerprints,i hope this can help me to enhance the image.

27 Sep 2005 yu qian  
09 Nov 2005 wang yue  
01 Dec 2005 Alok Whig

Q1. What is the difference between GaborFilter,
    GaborFilter1 and GaborFilter2 ?

Q2. Is R13 realease same as MATLAB version 7.0 ?

I tried the files.They work fine.

09 Dec 2005 A.H. S

A Good Job done

05 Jan 2006 Liu Xianru

It is very good and suit for new researchers!
Thank you !

17 Feb 2006 wise wise

"Gabor filters are used mostly in shape detectin and feature extractin in image processing"

Can somebody give me some help on how to use gabor filter for fingerprint image feature extraction?

thanks..

02 Mar 2006 Chenna Krishna Varri  
05 Mar 2006 saratchandra k

I found this little description very useful. Wee bit'o more info about the cortical cell study .. or maybe where I can find it would be useful. And yeah im working on fingerprints and would like to get more info in that regard

08 Mar 2006 yunchu ZHANG

This helps me a lot!

13 Mar 2006 sriram pothuri  
20 Mar 2006 vijay anandh  
23 Mar 2006 Deepti Singh

Cn anyone tell me how to calculate optimal sx,sy,theta and f for an image.so that this function cn be used irrespective of any image.How to implement it i mean how to use the output G and gabout.Thx in advance.urgetntly in need of reply

02 Apr 2006 Hyeong-yong Jeon

good!

16 Apr 2006 he yi

very good,I once program a c++ version about gabor filters. now I find this code and use it to verify mine. It is very convenient and thanks for u.

29 Apr 2006 Sam Darvishi  
30 Apr 2006 Piyorot Khongchuay

cool

02 May 2006 Engy Cruel Heart  
03 May 2006 deepak singh

great work

16 May 2006 cintia monti  
28 May 2006 Piyorot Khongchuay

Cool

28 May 2006 Bobby Jan

Excellent. Has some one tried recursive Gabor filtering & its usefulness? Can some one share?

01 Jun 2006 Mayank Raj

Great

18 Jul 2006 Udai Kiran

Cool

21 Jul 2006 bendahmane zakaria  
08 Aug 2006 hamed kowsari  
25 Aug 2006 Weijun Zhao

Thanks, I have been searching for it.

28 Sep 2006 Dirkjan Krijnders

Functionality is good, but code does not depends on any toolbox and documentation is not in standard matlab format.

10 Oct 2006 hari bashkarraj

very nice

28 Oct 2006 Makoto Sanada

I am reading the gaborfilter1.m (version2), and I think there is a mistake.
In the source codes, there is a code line to retrive imaginary parts of filters as imag(G).
However, the math equation of G is originally calculating only real responses (cos). There is no jsin or exp(j...).
Don't you need imaginary responses?

29 Nov 2006 hamed kowsari  
07 Dec 2006 J. Colineau

The output seems to be the modulus of the complex response to your filter. In many cases, the interesting part is the real component, and not the modulus, which is a non-linear operation !

29 Dec 2006 T G

i think there is a mistake in this code. because the results shown in this link http://matlabserver.cs.rug.nl/edgedetectionweb/web/index.html are obtained by using the equation in this link, http://matlabserver.cs.rug.nl/edgedetectionweb/web/edgedetection_params.html

but unfortunately, these results are not as same as yours.

isn't it???

please, tell me if i'm wrong.
thanks a lot..

19 Jan 2007 paulhac ludo

I don't know if there is a mistake in this code. In fact the imaginary part is always null but it is normal if we look the formula used. In the formula there is not the imaginary part.
The general gabor formula has an imaginary part, but usually , when I read article, there is not this imaginary part and I don't know why.
Is there someone to answer ???

I implement gabor with the imaginary part and when I try with this link http://matlabserver.cs.rug.nl/edgedetectionweb/web/index.html I don't find the same things. But the result depends how we set parameters.

31 Jan 2007 Jyotirmoy Banerjee

The formula used in this code doesn't have parameters like aspect ratio and phase. so it is not fair to compare the results with some other code. All depends on the parameters you set.

23 Feb 2007 hamed nozari  
05 May 2007 Liang Zhao  
10 May 2007 ujjal bhowmik  
13 May 2007 Emin Orhan

The discrepancy between the results obtained by filtering with this implementation and the with the one on the matlabserver.cs.rug.nl is, I think, related to the size of the filter, G, instead of fix(Sx) (and fix(Sy)), try something like fix(3*Sx) etc.-i.e.enlarge the size of the filter- and the code works just fine (in corformity with matlabserver.cs.rug.nl), nothing wrong with the code.

15 Jul 2007 au diesel

thx

17 Oct 2007 lorenzo rossi

Why I have this error?
Function 'conv2' is not defined for values of class 'double' and attributes 'full 3d real'.

23 Oct 2007 Selvan Selvanidhyananthan

Gabor filter is a very interesting topic in wavelets.

30 Oct 2007 Protik Maitra

A few images with corresponding parameters would have helped understand this better.

16 Nov 2007 Ratnakar Dash  
12 Dec 2007 Feng Liu

very good!

04 Feb 2008 Richa Agarwal

Its very good.

18 Feb 2008 Jose Armando Fernández Gallego

Muy buen Codigo !

22 Feb 2008 ksibi amel

good

27 Feb 2008 Hedieh Sajedi  
12 Mar 2008 jun wu

thanks for your Gabor filter.

12 May 2008 Abd Elghany mohamed

Aslamo alekm
are you hove this code using IDL programming

13 May 2008 jimmy wang

So helpful!TKS

28 May 2008 Pushkin Alexander

Ican't fix "Undefined function or method 'conv2' for input arguments of type 'double' and attributes 'full 3d real'." Please somebody tell how fix it by "reshape". Thanks

09 Jul 2008 AKROUT Belhassen

good job

22 Jul 2008 vishal wankhede

Very efficient

14 Sep 2008 sandeep gupta

it is efficiently working

13 Oct 2008 Geovanny Giorgana

Hi all, I got the same error: Function 'conv2' is not defined for values of class 'double' and attributes 'full 3d real'.

Can someone explain me how to solve it. Thank you.

14 Oct 2008 mohammad poshideh  
14 Oct 2008 mohammad poshideh  
15 Oct 2008 akshay aggarwal

@Geovanny Giorgana: the filter works only for a 2-D immage. Try checking the size of the input image.

16 Oct 2008 vinayak jagzap

i m working on gabor filter
will u please send me the details
n if possible the code for fingerprint image
enhancement using it

11 Nov 2008 sidd singh

nice

27 Jan 2009 Anton

By looking over the code and the description, it seems the filters are being crated in the frequency domain and then applied in the spatial domain. Please correct me if I am wrong but this is WRONG. There are two RIGHT approaches. The first is that one needs to take the inverse FT of the filter and then convolve it with the image. The second it that one needs to convert the image into the frequency domain, multiply the spectra and then take the inverse of the result.

02 Mar 2009 ganesh kumar

can u just brief me on the parameters of the filter?On what basis do i select the parameter values??

07 Apr 2009 Varsha Mhaske  
29 Sep 2009 kevin  
Please login to add a comment or rating.
Updates
10 Nov 2004

A simple Example

Tag Activity for this File
Tag Applied By Date/Time
filtering Ahmad Poursaberi 22 Oct 2008 07:23:35
gabor filter Ahmad Poursaberi 22 Oct 2008 07:23:35
image processing Ahmad Poursaberi 22 Oct 2008 07:23:35
2d Ahmad Poursaberi 22 Oct 2008 07:23:35
visual cort Ahmad Poursaberi 22 Oct 2008 07:23:35
mathematical modeling Ahmad Poursaberi 22 Oct 2008 07:23:35
2d Ruichu Cai 14 Jan 2009 00:10:47
mathematical modeling Mayuresh Kulkarni 17 Aug 2009 07:27:24
 

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