-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathMatchAlg.cpp
More file actions
45 lines (38 loc) · 1.22 KB
/
Copy pathMatchAlg.cpp
File metadata and controls
45 lines (38 loc) · 1.22 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
#include "MatchAlg.h"
#include "MatchingTemplate.h"
#include "GetHammingDistance.h"
double MatchAlg:: mainMatchAlg(char *galleryName,char *probeName,
int gDataType, int pDataType)
{
if(galleryName ==NULL || probeName == NULL)
{
cout << "Failed to load the file name" << endl;
return -1;
}
MatchingTemplate *gallery = new MatchingTemplate();
MatchingTemplate *probe= new MatchingTemplate();
gallery->loadVASIRTemplate(galleryName, gDataType);
probe->loadVASIRTemplate(probeName, pDataType);
// DEBUG
if (gallery->getIrisTemplatePtr() == NULL
|| probe->getIrisTemplatePtr() == NULL)
{
printf("Error: Gallery = (%s) %p, probe = (%s) %p\n",
galleryName, gallery->getIrisTemplatePtr(),
probeName, probe->getIrisTemplatePtr());
delete gallery;
delete probe;
return -1;
}
// Calculate Hamming distance using XorY shifts method
GetHammingDistance hamming (5, 1);//10, 3
double hd = -1;
int hdScales = 1;
hd = hamming.computeHDXorY((const MatchingTemplate*)gallery,
(const MatchingTemplate*)probe,
hdScales);//X or Y direction shifts*/
printf("Hamming Distance: %.4f\n", hd);
delete gallery;
delete probe;
return hd;
}