Continue to Site

Welcome to EDAboard.com

Welcome to our site! EDAboard.com is an international Electronics Discussion Forum focused on EDA software, circuits, schematics, books, theory, papers, asic, pld, 8051, DSP, Network, RF, Analog Design, PCB, Service Manuals... and a whole lot more! To participate you need to register. Registration is free. Click here to register now.

image matching C++ code

Status
Not open for further replies.

zkai2000

Member level 5
Joined
Jul 25, 2004
Messages
94
Helped
0
Reputation
0
Reaction score
2
Trophy points
1,286
Activity points
907
hi, i've completed the C++ codes for matching two images (fingerprints). but it resulted "match" for every two images i compared. y did this happen? can anyone check the code for me? thanks!!
 

ok
1) is not C++ code
2) You should learn the use of C functions ..and some pointer will help also
3) the code seems to be ok (i mean it should compile that's all ).BUT you do something Weird .AND FUNNY !. INSIDE of two loops you calculate r1,r2, angle1,angle2 . and for evry iteration you just calculate the values .. and they are discarted EVERY single time .. so at the end of the loop you only have the last r1,r2 angle1,angle2 ..

Then you go into another loop comparing lots of times these values ..
Well it seems that r1,r2 angle1.angle2 need to be ARRAYS or pointers to BUFFERS.. not just single valued variables ..

NOW i'm affraid that once all that fixed YOUR BIGGEST PROBLEM is the MATCHING algorithm based on that angle and distance ..I don't know where you got that IDEA .. but i don't think that YOU CAN CATCH CRIMINALS WITH IT ...........!!!!

Cheers ..
 

1) is not C++ code

what issit then?? :oops:

Well it seems that r1,r2 angle1.angle2 need to be ARRAYS or pointers to BUFFERS.. not just single valued variables

I've used the idea and store r1,r2,angle1,angle2 into arrays first then use pointers to hold the addresses of the arrays and finally dereference the values of them. It SHOULD work but i have errors running the code. :cry:

NOW i'm affraid that once all that fixed YOUR BIGGEST PROBLEM is the MATCHING algorithm based on that angle and distance ..I don't know where you got that IDEA

it's from me and my supervisor... :oops:

but i don't think that YOU CAN CATCH CRIMINALS WITH IT ...........!!!!

I'm just a final year engineering student wishing to pass my final project~~ :cry:

If you have any idea, please advice..thanks!!!
 

Listen Friend . The code part in this project is not your biggest concern ..You get a C language book to seee examples on how to use pointers .Your biggest PROBLEM is tha you are not going ANYWHERE with a that idea of using angle and radius .. The only thing that you have acomplished is THAT you have a COORDINATES in INTEGERS ..so well expressed in a program and convert them to a DOUBLE with BASIC MATH routines ..By doing that you loose the exact position you had ..SO basically is NOT DOING ANYTHING .. When you take two scanned fingerrints .. the pixel will never coincide .. THE POSITIONS on the scanned picture of the CRESTS and valleys of a fingerprint will never coincide in two scans .So THERE IS NO POINT of compairing positions of pixel..Life is HARD and solutions dealing with BIOMETRICS demand some more work .The way that that a fingerprint matching is done is by identifying the bifurcation and end of ridges ( the finger print features) and comparing those points .(but not their pysical position)
It seems that you had a problem and didn't do an analysis of what you have in front .. I will suggest you to look for some information on open domain fingerprint matching algorithms .. The NIST has everything .incluiding the compression algorithm used by the FBI databases . Is free you can request the CD from them .If you live in the US .. I have it .. but is to big to post it here .There are other projects too.
Once agan to design a solution first do the analysis of what you are dealing with! finguerprints matching is based on the ridges( the name is minutiae) characteristics bifurcations and end of ridges..

This projects demands some Image processing funtions like edge detection ..see here the analysis here :
**broken link removed**
There is some matlab code here ..is possible to convert it to C.
http://www.owlnet.rice.edu/~elec301/Projects00/roshankg/background.htm
cheers
 

I think you could start at this book to get a general idea of the pattern matching/recognition problem and how people approach it.
 

Dear eltonjohn,

nonono,im not comparing pixels by pixels..i get the distance between the points and origin then store them into arrays for further comparison..
I've done lots of literature surveys, from using neural network to chaincode contours to match fingerprints. I know they work but i couldnt get the algorithms of the feature extractions parts.(how to detact bifurcations,endpoints,deltas,etc...) i dont think they will ever leaked out too...and NIST ONLY showed their image compression algorithms.. :cry: Thus, im using my own idea and hope that it works..the worst problem is that im required to use C++ to write the code! which im not good at..

Thanks for ur advice

Thanks me2please
 

Well, I got the same problem but the other way round. I have got a 2D array with some scalar values and I want to convert it into bitmap and display the image. I am trying to do it in C++, my knowledge is very limited, have no idea about bitmap and my knowledge of C is also not that good. Would someone suggest me where to start and how to do it, please?
 

Fast Robust Fingerprint Feature Extraction and Classification
By: H. O. Nyongesa; S. Al-Khayatt; S. M. Mohamed; M. Mahmoud
Found in: Volume 40, Issue 1, May 2004
Pages: 103-112
From: Journal of Intelligent and Robotic Systems
 

Dear eltonjohn,

I can't output values for array ImageOut1[value][value] and ImageOut2[value][value]. Do you know why?

Thanks in advance!

Regards
 

I just took a brief look and found that your loops are actually like as follows.
for(i=1 ; i<WIDTH ; i++);
I am no a C++ expert but isn't this loop do nothing at all.
 

Code:
	if (ImageOut1[i][j]=0) //black dots' coordinates in monochrome fingerprint
	{	
		for(i=1;i<WIDTH;i++);	
		{
			for(j=1;j<HEIGHT;j++);	
			{
				//formula for finding the distance between two points
				r1 = pow(((pow((i-x0),2) + pow((j-y0),2))),0.5) ;
	   		
				//formula for finding the angle between the point and (0,0)								 
				angle1 = atan((j-y0)/(i-x0)) * 180 / pi;	
			}
		}

	}

1 I don't think this is in any loop for i and j
Code:
  if (ImageOut1[i][j]=0)
This only means for whatever value i and j at the moment, if ImageOut1[j] = 0 you do the following loop otherwise do nothing.

Code:
     for(k=1;k<WIDTH;k++)
		for(l=1;l<HEIGHT;l++)
                     // --- "{"  --starts here
			if(ImageIn2[k][l]>128)
				ImageOut2[k][l]=255;
			else
				ImageOut2[k][l]=0;
                     //  --- "}" -- implicitly ends here
The loop before that part already ends, as shown above.


2 Since you don't keep r and angle as array for every i,j , at the end of the loop before you have any chance to do comparison, what you have left is just the last value of r and angle.
Code:
        //formula for finding the distance between two points
	r2 = pow(((pow((k-x0),2) + pow((l-y0),2))),0.5) ;
	
	//formula for finding the angle between the point and (0,0)
	angle2 = atan((l-y0)/(k-x0)) * 180 / pi;
This only keeps current r and angle. What you will have at the exit of the loop are the r and angle of the last pixel.


3 TRY TO USE BRACES

4 This won't work. You compare PIXEL (even use r and angle--it is one to one mapping). In reality, you cannot compare point [j] from 1st image with [j] from 2nd image, since point [j] in the 1st image might have corresponding pixel [m][n] in the 2nd image due to scanning shift, rotation, and skin elasticity.
 

Dear me2please,

Thanks for ur advice on the data storing part. I've found a way to store the data for R and Angle..(using arrays)

The problem i met here now is when i type "cout<<ImageOut2[1][1]" right after the conversion, I should output either a value "255" or "0" rite?

Thanks again!!!
 

Yes, I guess so. I think that's what you write it to do. If you write it correctly, that's what it will do.

I couldn't agree more with eltonjohn that you should concern more about method. Since it seems you have trouble writing C code, I would suggest you try your idea first on Matlab. If the method doesn't work, even if you write a compiled code(bug free), it wouldn't give any result.

I'm not sure that you are convinced. :roll:
Here is the reason why people don't use absolute position whether in (x,y) or in (r,theta). In the acquisition of the images, you can hardly put the object in the exact same position. Even for distinct features, the positions of the distinct features of the same object(says singular points of fingerprints) from 2 scans wouldn't be at the same absolute position (relative to (0,0) as you are doing). That's why they use relative position among the features and not with the exact positions, just how they are positioned w.r.t. others.

There is also a reason why they extract features, not pixels. First, if we look at 1 pixel at a time, there is no way to tell the differences between 1 pixels from many others. Then, even if we consider template matching (which uses a chunk of pixels to match), it still requires heavy exhautive search (translation and rotation). Yet it still suffers from the elsticity where the fingerprint can stretched out and twisted randomly.

Therefore, the basic idea is that they are trying to use invariant features, something that are not affected(or at least very little) by translation, rotation, and some elastic effect.
 

you have declared r1,r2,angle1 and angle2 as double and these parameters are not arrays. I have not seen any other declaration of these parameters in this code. So, in the end there are just four values i.e. r1, r2, angle1 and angle2. Then, you are just comparing these values 500 times.
 

Hi all,
Does anyone know how to convert Matlab file (.m-file )to .dll or c++ code.
Matworks provide us new toolbox for Fingerprint Regconition project but I don't know how to use it in my project (written by visual c++) independently.
Please visit :

**broken link removed**

for download new toolbox.
 

I think if you remove the semicolons after the loop body it would work

you wrote

for(i=1;i<WIDTH;i++);
{
for(j=1;j<HEIGHT;j++);
{
......
}
}

The loop will just loop in place and do nothing

but if you wrote it as

for(i=1;i<WIDTH;i++)
{
for(j=1;j<HEIGHT;j++)
{

.............
}
Then this would loop into the internal loop the number of the external loop and check the values for each pixel in the range
 

Status
Not open for further replies.

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top