Code covered by the BSD License  

Highlights from
Gabor Feature Extraction

4.75

4.8 | 5 ratings Rate this file 531 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
MATLAB release MATLAB 8.3 (R2014a)
Tags for This File   Please login to tag files.
Please login to add a comment or rating.
Comments and Ratings (31)
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

Contact us