File Exchange

image thumbnail

Fingerprint matching algorithm using shape context and orientation descriptors

version 1.18 (1.74 MB) by

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

26 Ratings



View License

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.

Comments and Ratings (68)


lisper (view profile)

thanks Joshua Abraham

Joshua Abraham

Joshua Abraham (view profile)

The substring function works with the tested version of matlab (R2007a)... Please note that this software has not been tested in subsequent versions. You can perhaps find a substitute for the 'substring' function in forums.



lisper (view profile)

hi saba yaseen, I have the same problem, I have not been able to resolve that error, I wrote a long time ago and I have not received a reply from the author or someone on the forum. Looking for information I wrote in another forum of people specialized in matlab, and I just said that substring is not matlab.

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.


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

Joshua Abraham

Joshua Abraham (view profile)

Hello Zhg

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


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;


NEHA (view profile)

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

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


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,


Jakub (view profile)

good code.



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



Amal (view profile)

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


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

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"?

Merci mais n fonctionne ps

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.

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


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

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!

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


Umesh (view profile)

Where can we find the referred database for testing please?

Joshua Abraham

Joshua Abraham (view profile)

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.


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


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?

albert graz

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




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

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

Divya Datta

Hi Jashua

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

Waiting for your reply.


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.



Teng (view profile)

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

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.

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

Joshua Abraham

Joshua Abraham (view profile)

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

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

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?

Joshua Abraham

Joshua Abraham (view profile)

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

Joshua Abraham

Joshua Abraham (view profile)

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.


Joshua Abraham

Joshua Abraham (view profile)

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

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?


Omid (view profile)


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


zaidan (view profile)

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

Joshua Abraham

Joshua Abraham (view profile)

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


harjan (view profile)

hi, What is the term COMP_IMg meant?

Joshua Abraham

Joshua Abraham (view profile)

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

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


nejc (view profile)

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

Thank you!

Joshua Abraham

Joshua Abraham (view profile)

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.



nejc (view profile)

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


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 ?

Abdul Aziz

Excellent work!!

Abioye Samson

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


yagnesh (view profile)

Le Hai

Le Hai (view profile)

Hi Joshua,

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

Thank you much.

Joshua Abraham

Joshua Abraham (view profile)

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.

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.

Joshua Abraham

Joshua Abraham (view profile)

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

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.

Paul Smyth

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

Joshua Abraham

Joshua Abraham (view profile)

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.

Joshua Abraham

Joshua Abraham (view profile)

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

Joshua Abraham

Joshua Abraham (view profile)

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)



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?



Removed duplicate subdirectory.


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


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


Attached book chapter updated once again.


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


URL of book chapter for implemented method added in the description


Added link to document


Updated book title and release information


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


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


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.


1) readme.txt updated

2) program description update


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


Readme.txt file updated.


Description update.

MATLAB Release
MATLAB 7.4 (R2007a)

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

» Watch video