Code covered by the BSD License  

Highlights from
Fingerprint matching algorithm using shape context and orientation descriptors


4.7 | 22 ratings Rate this file 172 Downloads (last 30 days) File Size: 1.74 MB File ID: #29280
image thumbnail

Fingerprint matching algorithm using shape context and orientation descriptors



04 Nov 2010 (Updated )

Fingerprint matching code using a hybrid descriptor. EER < 1% (approx. 0.75%) on FVC2002 Db1_A.

| Watch this File

File Information

This is a fingerprint matching code based on the fingerprint matching algorithm found in the upcoming book chapter (published in July 2011):

Book title: State of the art in Biometrics (ISBN 978-953-307-489-4)
Chapter title: Fingerprint Matching using A Hybrid Shape and Orientation Descriptor
Authors: Joshua Abraham, Paul Kwan and Junbin Gao

Located at:

Note: LATEST version of the book chapter describing some minor simplifications to the implemented algorithm is now attached in the file (with identical performance recorded, EER=0.75% for FVC2002 DB1_A). Please still reference the original book chapter found at the link above.

Performs reasonably well on FVC2002 database 1 set A. This algorithm uses a hybrid descriptor based on the shape context and Tico's orientation descriptor. However, the shape context descriptor has been modified to include Gaussian bin weighting and other modifications. The Tico orientation descriptor has also been modified to weigh orientation point coverage.

Required Products Image Processing Toolbox
MATLAB release MATLAB 7.4 (R2007a)
Tags for This File   Please login to tag files.
Please login to add a comment or rating.
Comments and Ratings (57)
09 Oct 2014 vennela

Hi sir,
when i am executing extract_db.m there will be errors like below...
plz tell me how to solve..

Error in ==> cond at 40
s = svd(A);

Error in ==> maketform>validate_matrix at 346
if cond(A) > condlimit

Error in ==> maketform>affine at 163
A = validate_matrix( A, 'affine' );

Error in ==> maketform at 126
t = feval(fcn,varargin{2:end});

Error in ==> imrotate at 124
rotate = maketform('affine',[ cos(phi) sin(phi) 0; ...

Error in ==> freqest at 55
rotim = imrotate(im,orient/pi*180+90,'nearest', 'crop');

Error in ==> ridgefreq at 64
freq(r:r+blksze-1,c:c+blksze-1) = ...

Error in ==> testfin at 43
[freq, medfreq] = ridgefreq(normim, mask, orientim, 32, 5, 5,

05 Jun 2014 Jakub

good code.

30 Apr 2014 Abhilash


After the minutiae extraction process we get a N rows X 6 column Feature Matrix. .

The First 2 columns represent the (x,y) co-ordinates of the Nth minutiae..

The fourth Column represents the orientation is guess.. ( am i right?)

What do the 3rd , 5th & 6th columns represent.. ?? can anybody tell mee..

Btw "@ Joshua" sir, very nice effort to share the code so that we could learn from it..

06 Apr 2014 Avenash  
17 Mar 2014 Amal

can you send me a single function to compare two fingerprint images and return the percentage matching my email id is

13 Mar 2014 ZhG


I got a new problem when running it on FVC2004DB1.
The program failed to handler all the images of FVC2004DB1A. Actually, it does not work for most of the images of this database. But I have got another one that when I tried to assign block size as 32*32 to fft_enhance_cubs(img, BLKSZ). This function got a problem of matrix border.

??? Index exceeds matrix dimensions.

Error in ==> fft_enhance_cubs at 151

26 Feb 2014 Guha Prasaanth

Hello Joshua
Thanx for providing the program
i do get errors on 2 variable "START" and "FINISH" and since I am a beginner regarding Matlab i couldn't find a way to solve it and so my questoin here is whether should i use the file name of the image at the places of hose 2 variables or else what else should I do?

My actual question here what to do with using the 2 variables "START" and "FINISH"?

24 Feb 2014 boutahri mostafa

Merci mais n fonctionne ps

07 Feb 2014 ishan Bhardwaj

Hi Joshua
Thanks for uploading the program, as it is of great help.
My only concern is what many of the community members also faced. But apparently you have not replied to any of them.

"Matlab gives the following error
Undefined function 'substring' for input arguments of type 'char'.

Error in extract_db (line 46)
file_a = substring(char(file_a), 0, findstr(char(file_a), '_')-2);"

Please answer to this query,for the benefit of all.

03 Jan 2014 Ranjani Rathinavel

I am a pg student, who is doing project under fingerprint.. i tried this code to get orientation of fingerprint but it shows error and not running.. if i use the function which is given in this, it shows error.. i used plotridgeorient function but i get too many output arguments as error.. can anyone pls help me out in this???

18 Sep 2013 Sam

I am studying your code for PLOTRIDGEORIENT..

i dont understand why following commands are used.. I am new to matlab/programming so pardon me for novice queries...

xoff = len/2*cos(s_orient);
[x,y] = meshgrid(spacing:spacing:cols-spacing, spacing:spacing:rows-spacing);

x = x-xoff;
u = xoff*2

02 Sep 2013 sh alone

Hi, I'm trying to generate a revocable fingerprint template in terms of bit-string from a set of minutiae points.
Your code is working on FVC2002 and I’m looking for code to work on FVC2004DB-1 but this code gives error for this DB.
Do you have a solution to this problem?
Moreover, I need to generate the hash code of Minutiae.
Do you have experience in this area?
Can u help me about this?
Thank you!

17 Jul 2013 Henrique Costa

Hi, I'm trying to obtain the filtered images for 5000 dpi input images using some of the functions but could not figure out which would be the best parameters.
Could you please suggest ? I'm using ridgeorient(), ridgesegment(), ridgefreq() and ridgefilter()

11 Jul 2013 Umesh

Where can we find the referred database for testing please?

04 Jul 2013 Joshua Abraham

Hello Zhg

Yes it is based on the paper.

You are correct about the general procedure of the code.

However, the minutiae extraction and matching are done with separate function calls. The minutiae extraction needs to take place before matching.

27 Jun 2013 ZhG

Hi, Joshua. Another question about your reference. Which one or papers is(are) your reference for extratcting minutie, i.e. the references of one function, extract_finger().

27 Jun 2013 ZhG

Hello, Joshua.
I started to read your code 1 week ago. Performance is good. And I have a question about general procedure of your codes. Is it run in the way like
GRAY image,
Enhance gray image,
Binarize gray image,
Extract minutia,

I found a PDF in you .zip file. So, is it everything implemented based on that paper?

11 Jun 2013 albert graz  
14 May 2013 Divya Datta

Hi all

Is there anyone who can help me about this code?

I need to know, what to write for 'BASE_IMG = ' & 'COMP_IMG = '.

Waiting for your reply



01 May 2013 deepti

hi joshua

can u please explain what method you have used for ridge orientation and how are the equations in the analysis of the principle direction in it being used.


please reply ASAP

23 Apr 2013 sandeep ten

Hello sir, I got the code working exactly fine..but am unable to interpret the result of do_match.m...Its giving some value of sim at the end...Will you please tell me what that value represent..

Thanks in advance

25 Mar 2013 Divya Datta

Hi Jashua

What we should write for "BASE_IMG"and "COMP_IMG" in the main.m code?

Waiting for your reply.


18 Mar 2013 Divya Datta

Hi Jashua

Will you please explain, what does it mean by 'sim' in your code, file 'do_match'? And, what is the range for it?

Waiting for your reply.


17 Mar 2013 Teng

Hi, for the findTheta function, I am confused why we compute the orientation of the ridge bifurication in this way

15 Mar 2013 Divya Datta

Hi! I am having the same error problem as Hastin.

I get an error for folowing line of code: "file_a = substring(char(file_a), 0, findstr(char(file_a), '_')-2);". Matlab returns an error: "??? Undefined function or method 'substring' for input arguments of type 'char'.". There is no substring function in matlab...

Please let us know the solution.

18 Feb 2013 Elysi Cochin

sir, could u please show how to execute this code for one image.... please do reply sir.... where should i make the changes in the main file.....

13 Feb 2013 Joshua Abraham

Hastin, please read the readme.txt document for some instructions. Here is a summary:

After setting the correct path in the files
'main.m' and 'extract_db.m' (pinting to your FVC2002 database), you will then have to extract the features, with

START=1; FINISH=800; extract_db

and run the matcher on the entire DB (using the FVC matching method) with:

BASE_IMG=''; main

After the extraction stage, you can do individual matches with:

do_match(f1, f2)

where f1/f2 are the image file names of the fingerprints you wish to match (e.g., f1 may be '10_1.tif' f2 maybe '10_2.tif').

13 Feb 2013 hastin kauky

Hi! I get an error for folowing line of code: "file_a = substring(char(file_a), 0, findstr(char(file_a), '_')-2);". Matlab returns an error: "??? Undefined function or method 'substring' for input arguments of type 'char'.". There is no substring function in matlab... How did you solve this ? PLIZ

22 Nov 2012 Divya Datta

Hi Jashua

My posting was not showing. I thought it was for not rating.Then I just put the rating randomly. I hope you are understanding what I want to say.

I am trying to run the code for two images.

There is error:

Undefined function or method 'substring' for input arguments of type 'char'.

May I know how to solve it?

22 Nov 2012 Joshua Abraham

Divya, also make sure that the sc_minutia directory is added to your matlab path!!!

22 Nov 2012 Joshua Abraham

Divya Datta, the lines with:

cd '/home/joshua/Research/FVC2002/Dbs/Db1_a'

files = dir( '/home/joshua/Research/FVC2002/Dbs/Db1_a/*.tif');

in 'main.m' and 'extractdb.m' have to be changed to point to your DB location.


22 Nov 2012 Joshua Abraham

Divya Datta, please read the readme.txt file before asking questions and giving a 1 star rating..

22 Nov 2012 Divya Datta

Hi Jashua

I was trying to run the code.

But, when I am running the extract_db file the error is as follows:

??? Undefined function or method 'extract_finger' for input arguments of type 'char'.

Error in ==> extract_db at 27
finger_features = extract_finger(char(file_names(index1 + i)));

How to solve it?

20 Aug 2012 Omid  
23 Apr 2012 Sesh

Joshua,can you tell me the reference as to how in the testfin.m,you could say the median frequency value usage gives better output??I read different papers but could not find it anywhere..please help..

31 Mar 2012 zaidan

let me know it first but it's nice code for beginner

02 Mar 2012 Joshua Abraham

Hello Harjan, COMP_IMG is the string reference to the database for the query fingerprint impression.

02 Mar 2012 harjan

hi, What is the term COMP_IMg meant?

13 Dec 2011 Joshua Abraham

Sushobhit, this code is aimed towards fingerprint images already collected by scanning devices. You may need to write some trigger code that collects an image file from the scanners and then calls this code for feature extraction
with 'extract_finger <image file>'. Just add a line to this script change to the path the images will be saved. Hope this helps

06 Dec 2011 Sushobhit Rajan

means comparing the template is gud..and thanks for ur logic....but now how should i take input through device and check the identification

04 Nov 2011 nejc

Joshua this is great! Can't wait for new release!

Thank you!

24 Oct 2011 Joshua Abraham

Hello Nejc,

Sorry for the late reply...I have a much much faster algorithm coming out soon.

The EER for that is 0.96% to 0.67%..

This will be uploaded soon.


01 Oct 2011 nejc

Ok, stupid question... I solved it :) will be any speed up of the algorithm available in the future ? :) Thank you

30 Sep 2011 nejc

Hi! I get an error for folowing line of code: "file_a = substring(char(file_a), 0, findstr(char(file_a), '_')-2);". Matlab returns an error: "??? Undefined function or method 'substring' for input arguments of type 'char'.". There is no substring function in matlab... How did you solve this ?

09 Aug 2011 Abdul Aziz

Excellent work!!

01 Aug 2011 Abioye Samson

Hi Joshua, i am also working on a similar project, Thanks for the help. God bless u.

04 Jul 2011 yagnesh  
26 Jun 2011 Le Hai

Hi Joshua,

Is the link to the book chapter available and free for everyone?

Thank you much.

30 Apr 2011 Joshua Abraham

Hello Le

The good news is that a book chapter is about to be published on June 21st 2011,
which will be free for everyone to download. Unfortunately, I am not allowed to give detailed comments until this date. However, I will provide a link to the book and attach the book chapter at the publishing date (21st June).

I hope this will help everyone.

29 Apr 2011 Le Hai

Hi Joshua,
Could you give your idea about the combination between shape context and orientation descriptions in your code, so we can follow your code easily.
Thank you.

18 Apr 2011 Joshua Abraham

Thank you JuCheng for your bug notification. I will make the changes you suggest in the next update.

18 Apr 2011 JuCheng Yang

it is a nice code, one note, i meet a bug in the do_match.m;

??? Error using ==> load
Unknown text on line number 1 of ASCII file 'F:\sc_minutia\'101_1.o'

Error in ==> f15 at 1

to solve it, change all the "load" into "importdata" in the file do_match.m.

10 Nov 2010 Paul Smyth

Hard to find good performing code on the net. Thanks for this.

07 Nov 2010 Joshua Abraham

Sorry, mistake...I should have written

roc( RES_B - 0.1*SC_B, RES_G - 0.1*SC_G)

before, since we are dealing with distances not similarity scores.

07 Nov 2010 Joshua Abraham

Just one more thing to mention, this is proof of concept code.

The code will be further documented and optimised. At the moment, it runs slow (sorry about this) and documentation is
sparse. Please, if you have any questions about the code, email

07 Nov 2010 Joshua Abraham

SC_G and SC_B are additional shape context similarity distance.

They can be added to the the RES_G, RES_B scores, for instance
with something like:

roc( RES_B + 0.1*SC_B, RES_G + 0.1*SC_G)



07 Nov 2010 Bonnie Lee

This is very good software with low EER. However, documentation
needs fixing. The readme needs updated.

I had to add path sc_minutia folder first.
After templates created, I can run
BASE_IMG=''; main

This is long however. But I found that Ctrl-C to interrupt
process can be continued again with just 'main'.

also, when stopped, the RES_G and RES_B arrays can be used
to plot EER graphs with

[ig,ib]=calc_EER(1./RES_G, 1./ RES_B);
plot(ib, 'red');
axis([0 200 0 100]);

The EER is quite good. I have a question, what are the SC_G
and SC_B vectors for?

05 Nov 2010

Description update.

07 Nov 2010

Readme.txt file updated.

07 Nov 2010

1) readme.txt file updated
2) Typo in software description fixed

07 Nov 2010

1) readme.txt updated

2) program description update

14 Nov 2010

All plots are now done in one window as subplots for neatness sake.
Redundant old filter files are also removed.
Some messy debug is also removed.

09 Apr 2011

SVD used in affine transformation rotation calculation. Also, the EER graph is drawn at end of experiment. Lastly, unused files were removed.

20 Jun 2011

Summary includes reference to peer reviewed chapter that the method is derived from.

25 Jun 2011

Updated book title and release information

27 Jul 2011

Added link to document

28 Jul 2011

URL of book chapter for implemented method added in the description

07 Aug 2011

Attached updated book chapter referring to the latest implementation of the algorithm (minor change in similarity score calculation).

07 Aug 2011

Attached book chapter updated once again.

07 Aug 2011

Final update to attached book chapter (addendum) describing the implemented fingerprint matching algorithm.

07 Aug 2011

Final version of attached book chapter addendum required algorithms to be updated to reflect the implemented matlab algorithm.

08 Aug 2011

Removed duplicate subdirectory.

Contact us