View License

Download apps, toolboxes, and other File Exchange content using Add-On Explorer in MATLAB.

» Watch video

Highlights from
Fingerprint matching algorithm using shape context and orientation descriptors

4.5 | 24 ratings Rate this file 82 Downloads (last 30 days) File Size: 1.74 MB File ID: #29280 Version: 1.18
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 (63)
25 Feb 2017 saba yaseen

Hi, I am following readme.txt file.. i am getting following error Undefined function 'substring' for input arguments of type 'char'.

Error in main (line 72)
if numel(COMP_IMG) == numel(BASE_IMG) & (substring(COMP_IMG, 0, numel(COMP_IMG) - 6) == substring(BASE_IMG,0, numel(BASE_IMG) -
Kindly help ASAP.

Comment only
06 Feb 2017 lisper

lisper (view profile)

hello Joshua Abraham could you or someone in the chat help me solve the following problem in the code?, I followed the steps explained by you, but when I get to the line that makes use of the substring I get the following error

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

Comment only
09 Sep 2016 Joshua Abraham

Hello Zhg

The feature detection won't work well with fvc2004. Sorry.

Comment only
09 Sep 2016 Frank

Frank (view profile)

How could you write code in such a style!!!! It will cost a lot time.....

for y=1:size(mask,1)-blk_sz_c*2
for x=blk_sz_c:size(mask,2)-blk_sz_c*2
for i = y-25:y+25
for j = x-25:x+25
if i > 0 && j > 0 && i < size(mask,1) && j < size(mask,2) && mask(i,j) > 0
cimg2(ceil(y/(blk_sz_c)), ceil(x/(blk_sz_c))) = 255;

11 Apr 2016 NEHA

NEHA (view profile)

Can you please tell me that which method had been used for detection of core point in 'extract_finger.m' fie?

Comment only
24 Nov 2015 sukumar thirugnanm

Sir your code is very good. How to calculate EER, FMR and FNMR?

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

Jakub (view profile)

good code.

Comment only
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

Amal (view profile)

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

Comment only
13 Mar 2014 ZhG

ZhG (view profile)


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

Comment only
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???

Comment only
18 Sep 2013 Sam

Sam (view profile)

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

Comment only
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!

Comment only
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()

Comment only
11 Jul 2013 Umesh

Umesh (view profile)

Where can we find the referred database for testing please?

Comment only
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.

Comment only
27 Jun 2013 ZhG

ZhG (view profile)

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

ZhG (view profile)

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



Comment only
01 May 2013 deepti

deepti (view profile)

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.


Comment only
17 Mar 2013 Teng

Teng (view profile)

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

Comment only
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.

Comment only
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.....

Comment only
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').

Comment only
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?

Comment only
22 Nov 2012 Joshua Abraham

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

Comment only
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.


Comment only
22 Nov 2012 Joshua Abraham

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

Comment only
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

Omid (view profile)

23 Apr 2012 Sesh

Sesh (view profile)

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..

Comment only
31 Mar 2012 zaidan

zaidan (view profile)

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.

Comment only
02 Mar 2012 harjan

harjan (view profile)

hi, What is the term COMP_IMg meant?

Comment only
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

Comment only
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

nejc (view profile)

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

Thank you!

Comment only
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.


Comment only
01 Oct 2011 nejc

nejc (view profile)

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

Comment only
30 Sep 2011 nejc

nejc (view profile)

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 ?

Comment only
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.

Comment only
04 Jul 2011 yagnesh

yagnesh (view profile)

26 Jun 2011 Le Hai

Le Hai (view profile)

Hi Joshua,

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

Thank you much.

Comment only
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.

Comment only
29 Apr 2011 Le Hai

Le Hai (view profile)

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.

Comment only
18 Apr 2011 Joshua Abraham

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

Comment only
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.

Comment only
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

Comment only
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)



Comment only
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 1.1

Description update.

07 Nov 2010 1.2

Readme.txt file updated.

07 Nov 2010 1.3

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

07 Nov 2010 1.4

1) readme.txt updated

2) program description update

14 Nov 2010 1.5

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 1.6

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 1.7

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

25 Jun 2011 1.10

Updated book title and release information

27 Jul 2011 1.11

Added link to document

28 Jul 2011 1.12

URL of book chapter for implemented method added in the description

07 Aug 2011 1.13

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

07 Aug 2011 1.15

Attached book chapter updated once again.

07 Aug 2011 1.16

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

07 Aug 2011 1.17

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

08 Aug 2011 1.18

Removed duplicate subdirectory.

Contact us