Code covered by the BSD License  

Highlights from
Gabor Feature Extraction

4.65217

4.7 | 28 ratings Rate this file 779 Downloads (last 30 days) File Size: 2.49 KB File ID: #44630
image thumbnail

Gabor Feature Extraction

by

 

06 Dec 2013 (Updated )

This program generates a custom Gabor filter bank; and extracts the image features using them.

| Watch this File

File Information
Description

First function named "gaborFilterBank" generates a custom-sized Gabor filter bank. It creates a u*v array, whose elements are m by n matrices; each matrix being a 2-D Gabor filter.
Second function named "gaborFeatures" extracts the Gabor features of the image.
It creates a column vector, consisting of the image's Gabor features.
At the end of each file there is a Show section that plots the filters and shows the filtered images. These are only for illustration purpose, and you can comment them as you wish.
 
Details can be found in:
 
M. Haghighat, S. Zonouz, M. Abdel-Mottaleb, "Identification Using Encrypted Biometrics," Computer Analysis of Images and Patterns, Springer Berlin Heidelberg, pp. 440-448, 2013.
 
I WILL APPRECIATE IF YOU CITE OUR PAPER IN YOUR WORK.

Required Products Image Processing Toolbox
MATLAB
Signal Processing Toolbox
MATLAB release MATLAB 8.4 (R2014b)
MATLAB Search Path
/
Tags for This File   Please login to tag files.
Please login to add a comment or rating.
Comments and Ratings (91)
22 Nov 2014 Mohammad Haghighat

Shanmugam:

m & n define the size of filter and cannot be set to 1.

18 Nov 2014 SHANMUGAM RAMASAMY

Hi, I am shanmugam, I am using your code for image quality assessment. I am not able to understand the usage of m and n ?
Can they be set equal to 1 , All i want is for the code to return a u*v column vector for each pixel in the image ! Thank you.

18 Nov 2014 qu  
18 Nov 2014 qu  
15 Nov 2014 Mohammad Haghighat

Hillol:

d1 and d2 does not have any effect on computational complexity, but m & n have direct relation. You may want to deduce m and n if you are not interested in high frequency features in your images.

15 Nov 2014 Mohammad Haghighat

Sherko:

To the best of my knowledge, there is no relationship between the size of the image and the filter bank. The number of scales and orientations are arbitrary and mostly dependent on your application and image content and if you are interested in high frequency features or not.

11 Nov 2014 Mehran Kh  
09 Nov 2014 HILLOL

Hello Haghighat, I am using your code for scene identification purpose. Here I have around 100 240x320 images, each of the images are divided into 60x60 patches and I need to extract features from each of these patches. So computation time has become very high. Please tell me how to adjust d1,d2,m and n to reduce time as well as length of feature vector? And it would be great if you could send me your paper. my email address:
hillolchakrabarty40@gmail.com

08 Nov 2014 Sherko

Dear Haghighat , thanks so much for quick reply. I'm new in gabor filter, My question is that if there is any relation between filter bank and Image size? i.e What is the best way to specify the number of scales and orientations? by trial and error or any thing else?

thank you

08 Nov 2014 Mohammad Haghighat

Sherko:

Selecting the downsampling factor is a trade-off problem, and it mostly depends on you input image and the application. For example, if you have a finely detailed image, you cannot choose a large downsampling factor, because you may loose information. But on the other hand, a smaller downsampling factor leads to a larger feature vector, which is not good either.

But for sure, (d1 & d2 ) = 64,60 or (d1 & d2) = 32,30 for an image of size 128x120 is too much! I would rather using a lower downsampling factor, like 4, and then apply a dimensionality reduction approach to reduce the feature vector size.

Thank you for your comment. I sent you the paper.

08 Nov 2014 Sherko

Dear Mr. Haghighat, my image size is 128x120 when the factors for (d1 & d2 ) = 64,60 then we have 160 features , if (d1 & d2)=32,30 then the number of features will be 640 and so on. My question is that which factor is best? largest,lowest ...,etc. How the factor affect on the recognition process?

Thank you

08 Nov 2014 Sherko

Please,Could you send me your paper to my email ?sherko.rahman@gmail.com

06 Nov 2014 Thuvanan

Could you please send me your paper to my email
Thuvanan.bo@up.ac.th

06 Nov 2014 Thuvanan  
05 Nov 2014 Mohammad Haghighat

Ahammed and Popy:

Thank you for the 5-star votes. I sent you the paper.

05 Nov 2014 popy meilina

Could you please send me your paper to my email popy.meilina@gmail.com

thank you

27 Oct 2014 Ahammed

Hi, Thanks for the program. Can you please email me your paper to shahidpk74@gmail.com .

18 Oct 2014 Mohammad Haghighat

Hamid:

You can extract it from "gaborResult".

15 Oct 2014 Hamid OUANAN

Thank you very much for your work. i have just an question: in your work you have just used the Magnitude of Gahbor features (feautrevector). how i can recover phase if i need ??
Thanks for advances

15 Oct 2014 Hamid OUANAN  
15 Oct 2014 Mohammad Haghighat

You can use the Matlab Toolbox for Dimensionality Reduction available at:

http://homepage.tudelft.nl/19j49/Matlab_Toolbox_for_Dimensionality_Reduction.html

12 Oct 2014 Husdi

sarv

we had the same problem

12 Oct 2014 sarv

Thanks,I want to use the result of feature vector in classification but the result is too large, how can I solve this problem?

11 Oct 2014 Husdi

I have read the papers that you suggest "Identification Using Encrypted Biometrics," . ' and there explained that " The feature vector is still very large even after downsampling. Therefore, we will
need to use dimensionality reduction methods [5].For dimensionality reduction, we use general discriminant analysis (GDA)" , how the sample GDA source code in matlab?

11 Oct 2014 Husdi

I want to make the results of this Gabor " featureVector " for classification but vectornya very large size and computation time becomes very long .. , please help me how to use the results of Gabor feature vector size is not too big ?

10 Oct 2014 Mohammad Haghighat

Sarv:

You choose downsampling factor of 4 but 4 is not a factor of 374 (your image size).

10 Oct 2014 sarv

Hi, Thanks for your code. I test your code for 'Cameraman.tif' that work properly. But when I test it by my image this error happened.
My image is 374*388 unit8, I run
img = imread('101_1.tif');
if ndims(img) == 3;img=rgb2gray(img);end
gaborArray = gaborFilterBank(5,8,39,39);
featureVector =gaborFeatures(img,gaborArray,4,4);

The error is:

In an assignment A(I) = B, the number of elements in B and I must be the same.
(line86)featureVector(((c-1)*s+1):(c*s)) = gaborAbs;

if I comment this line the output is 0

Could you please help me?


25 Sep 2014 Mohammad Haghighat

qu:

m*n is the filter size, which is usually smaller than the image.

24 Sep 2014 qu

Is there someone who can tell me if the parameter m/n is the size of the image i want to process?

23 Sep 2014 Vero

Nice work. Could you please send me your paper to this address veronica.aramendia@gmail.com.
I really appreciate your help.

22 Sep 2014 Mohammad Haghighat

Yan:

Thanks for your comment and the 5-star vote. I just sent you the paper.

22 Sep 2014 Mohammad Haghighat

Indra:

Are you sure the complexity comes from the Gabor feature extraction step? Because for the size of image you mentioned, the feature extraction takes fraction of a second.

20 Sep 2014 Indra

Thank you for your work. I have question regarding implementation your work. I would like to extract features from my datasets (positive and negative) in order to detect head-shoulder of human body.

However, when I apply it takes so slow and long time in processing, especially during the detection while I am using scanning window detection for the detection part. How do I speed up the processing of gabor features extraction, if have image resolution 768x649 pixel size?

Thank you

20 Sep 2014 Yan Xu

Thank you very much for your work. Could you send your paper to this address peterxu1991@gmail.com I really appreciate your help.

11 Sep 2014 Husdi

Thank you very much..!

27 Aug 2014 Mohammad Haghighat

Adan:

Thank you for your 5-star vote.
I just sent you the paper.

27 Aug 2014 adan jauhary

Could you send me your paper to my email.
thank you

25 Aug 2014 Mohammad Haghighat

Salman:

Thank you for your 5-star vote.
I just sent you the paper.

24 Aug 2014 Salman

Could you please send me your paper to my email salnamo@yahoo.com

Thank you.

17 Aug 2014 Diatri Indradewi

Thank you so much

16 Aug 2014 Mohammad Haghighat

Diatri:

I just sent it to you.

15 Aug 2014 Diatri Indradewi

I need to read your paper to understand this gabor feature extraction. Could you please send it to rakatacimoet@gmail.com? Thank you

06 Aug 2014 Mohammad Haghighat

Andre:

I just sent the paper to your e-mail.

06 Aug 2014 Andre Lukito

Your paper available was actually limited access. Can I fully read your paper so that I can cite the paper? Could you please send it via email to andrelukitok@gmail.com. Thank you

24 Jul 2014 Mohammad Haghighat

Sumeet:

I just sent the paper to you.

23 Jul 2014 SUMEET

Can i have your above cited paper.I dont have access to download this paper.If possible please send it to my email-id.
stylisheng90@gmail.com

I will be very much thankful to you.

03 Jul 2014 Hua

good

30 Jun 2014 Mohammad Haghighat

Aini Najwa:

I just sent it to you by e-mail.
Sure, you can use it for signature verification. There are some papers that have used Gabor in this application.

30 Jun 2014 Aini Najwa Azmi

Assalamualaikum Mohammad,
Please teach me how to get your file... I am a new user of MATLAB.Is the Gabor FE is suitable to a signature recognition system?
If someone already get this file, need your help to send to my email, aininajwa.azmi@gmail.com

Thanks so much

25 Jun 2014 Mohammad Haghighat

Andre:

The adjacent pixels in a image are highly correlated; so, we remove the information redundancy by downsampling the feature images. A low downsampling factor will not have a noticeable effect on the recognition accuracy; however, it increases the performance of the classifier.

24 Jun 2014 Andre Lukito

hi Mohammad. anyway thanks for the code. I have some questions. What is the impact of downsampling(d1 & d2)? does it removing some samples of the extrated feature? and Is that good to be used to face recognition process? Thanks

12 Jun 2014 slimane

please I need to use the Gabor filter for texture analysis and extract features on medical image, there's someone there who can help me
thank you

09 Jun 2014 Mohammad Haghighat

Nawaz:

Sure, you can use it. There are actually papers that have used Gabor for OCR.

07 Jun 2014 Nawaz Pasha

Hi, can I use this code for Feature Extraction in Handwritten Optical Character Recognition ?

02 Jun 2014 Mohammad Haghighat

Alessandro:

The downsampling factors (d1 and d2) must be factors of the size of the image.

01 Jun 2014 Alessandro

I have an error in line 80 of gaborFeatures

Error using downsample
Too many input arguments.

Error in gaborFeatures (line 80)
gaborAbs = downsample(gaborAbs,d1);

20 May 2014 Mohammad Haghighat

Kushol:

In order to see the results visually, you just need to uncomment the "Show filtered images" section in the bottom of gaborFeatures.m .

15 May 2014 Kushol Manna

how can i ckeck, whether the result is appropriate or not ??

08 May 2014 Kun  
26 Apr 2014 Mehul Parikh  
17 Apr 2014 shaik farook

hello sir. i want to match two images whether they belongs to same person or not. this can be done by feature extraction. can you please help how to do this. how to extract features. steps or procedure or basic code please sir

09 Apr 2014 Mohammad Haghighat

a b:

The downsampling factors (d1 and d2) must be factors of the size of the image.

08 Apr 2014 a b

Hi Mohammad
I have this problem
In an assignment A(I) = B, the number of elements in B
and I must be the same.

Error in gaborFeatures (line 86)
featureVector(((c-1)*s+1):(c*s)) = gaborAbs;

Error in testGabor (line 11)
featureVector = gaborFeatures(img,gaborArray,4,4); %
Extracts Gabor features

I test my image it is grayscale image tif

07 Apr 2014 Mohammad Haghighat

Maithri:

It works on every image on my computer. Maybe your images were RGB! I just took care of that problem. Please download the updated code.

07 Apr 2014 Mohammad Haghighat

Mohammad:

There is no recursive loops with any limitations in the code. Most probably the problem is with one of the internal functions of you Matlab. Do you know in which line of the code it happens?

07 Apr 2014 Mohammad Haghighat

Milton:

Getting a vector of zeros is very unlikely. Can you please send me the input image that you are using? Then, I may get what the problem is.

05 Apr 2014 Maithri

It is working for only 'cameraman.tif' image.. Plzz tell what changes can be made so that we can extract features from other images??

04 Apr 2014 Maithri

Thanks.. It works very well..

25 Mar 2014 mohammad hossein torabi motlagh fard

the system shows still this error :

Maximum recursion limit of 500 reached. Use set(0,'RecursionLimit',N) to change the limitation.
I use set(0,'RecursionLimit',1000).still there is error.which part recursively run ?

25 Mar 2014 mohammad hossein torabi motlagh fard

the system shows still this error :

Maximum recursion limit of 500 reached. Use set(0,'RecursionLimit',N) to change the limi

24 Mar 2014 mohammad hossein torabi motlagh fard

Thanks for your code mohammad. I run the code but it works same loop . endless .
I want to see feature vector to apply for similarity measurement.
please guide me how to solve the problem .

21 Mar 2014 Milton

Hi, thanks to the code , but when i use it to get features in some images i get a vector of zeros,do you mind there is any reason for that ?

18 Mar 2014 Steve

Thanks for the update.

14 Mar 2014 Bao Ngoc Nguyen Thi

Do you use a difference formula of gabor filter?

12 Mar 2014 Mohammad Haghighat

Mark:

You are totally right. I first wrote the "gaborFilterBank" code for 8 orientations, and it was still there ;-)
Thank you for letting me know.
I just updated the code.

12 Mar 2014 Mohammad Haghighat

Ashok:

You need to specify the input arguments. Please read the help and "sample use" provided in the codes.

01 Mar 2014 Ashok BM

??? Error using ==> gaborFilterBank at 35
There should be four inputs.

??? Error using ==> gaborFeatures at 41
use correct number of input arguments

27 Feb 2014 Mark Veillette

Thanks for posting the code.
If I'm not mistaken, shouldn't line 55 in gaborFilterBank.m read

tetav = ((j-1)/v)*pi;

In my version it says

tetav = ((j-1)/8)*pi;

29 Jan 2014 putria

how to use this feature vector, into knn?, because, your wavelet only output 1 kolumn...?

27 Jan 2014 putria

thank's Mohammad, that's run, but why the results feature extraction so much?,

26 Jan 2014 Mohammad Haghighat

Putria:

If you read the short help added in the mfile, the downsampling factors (d1 and d2) must be factors of the size of the image.

26 Jan 2014 putria

after try, img = rgb2gray(img); ,i get an another error,
In an assignment A(I) = B, the number of elements in B and
I must be the same.

Error in ==> gaborFeatures at 80
featureVector(((c-1)*s+1):(c*s)) = gaborAbs;

Error in ==> testing at 4
featureVector = gaborFeatures( (img),gaborArray,4,4); % Extracts Gabor features

26 Jan 2014 Mohammad Haghighat

Putria:

Be aware that your images are in grayscale, not RGB.
You may try: img = rgb2gray(img); before feeding it into gaborFeatures.

26 Jan 2014 Mohammad Haghighat

Akshay:

This is only the code for Gabor Feature Extraction step.

26 Jan 2014 putria  
26 Jan 2014 putria

after run,your reply. i get an error

Undefined function or method 'conv2' for input arguments of type 'double' and attributes 'full 3d
complex'.

Error in ==> gaborFeatures at 54
gaborResult{i,j} = conv2(img,gaborArray{i,j},'same');

Error in ==> test_gabor at 3
featureVector = gaborFeatures(img,gaborArray,4,4); % Extracts Gabor features
how, to fix it...

24 Jan 2014 Akshay Gore

Hi Mohammad,
I recently read your paper "Identification Using Encrypted Biometrics"
In your paper these steps are performed.
1. Face Detection is performed.
2. Gabor Features Extraction.
3. Dimensionality Reduction
4. Feature Quantization using K D tree.
5. Crete Predicate.
6. Generate Token.
But here only second step i.e Gabor features extraction code is available, rest of steps not available in your code.
Please update it or send to me.
Thanks
Akshay Gore
akshaygore@live.com

22 Jan 2014 Mohammad Haghighat

img = imread('imageName.jpg'); % Reads the image
gaborArray = gaborFilterBank(5,8,39,39); % Generates the Gabor filter bank
featureVector = gaborFeatures(img,gaborArray,4,4); % Extracts Gabor features

20 Jan 2014 putria

how to get image / img from JPG n make feature of it?

07 Jan 2014 Akshay Gore  
06 Dec 2013 Steve  
Updates
20 Dec 2013

Added a reference

12 Mar 2014

Fixed a bug

18 Mar 2014

Added description

07 Apr 2014

Take care of the RGB images

07 Apr 2014

Took care of the RGB images

02 Nov 2014

MATLAB Toolbox File Format

Contact us