-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathgetmin.c
155 lines (138 loc) · 6.08 KB
/
getmin.c
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
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
/*******************************************************************************
License:
This software was developed at the National Institute of Standards and
Technology (NIST) by employees of the Federal Government in the course
of their official duties. Pursuant to title 17 Section 105 of the
United States Code, this software is not subject to copyright protection
and is in the public domain. NIST assumes no responsibility whatsoever for
its use by other parties, and makes no guarantees, expressed or implied,
about its quality, reliability, or any other characteristic.
Disclaimer:
This software was developed to promote biometric standards and biometric
technology testing for the Federal Government in accordance with the USA
PATRIOT Act and the Enhanced Border Security and Visa Entry Reform Act.
Specific hardware and software products identified in this software were used
in order to perform the software development. In no case does such
identification imply recommendation or endorsement by the National Institute
of Standards and Technology, nor does it imply that the products and equipment
identified are necessarily the best available for the purpose.
*******************************************************************************/
/***********************************************************************
LIBRARY: LFS - NIST Latent Fingerprint System
FILE: GETMIN.C
AUTHOR: Michael D. Garris
DATE: 09/10/2004
UPDATED: 03/16/2005 by MDG
Takes an 8-bit grayscale fingerpinrt image and detects minutiae
as part of the NIST Latent Fingerprint System (LFS), returning
minutiae with final reliabilities and maps including a merged
quality map.
***********************************************************************
ROUTINES:
get_minutiae()
***********************************************************************/
#include <stdio.h>
#include <malloc.h>
#include "lfs.h"
/*************************************************************************
**************************************************************************
#cat: get_minutiae - Takes a grayscale fingerprint image, binarizes the input
#cat: image, and detects minutiae points using LFS Version 2.
#cat: The routine passes back the detected minutiae, the
#cat: binarized image, and a set of image quality maps.
Input:
idata - grayscale fingerprint image data
iw - width (in pixels) of the grayscale image
ih - height (in pixels) of the grayscale image
id - pixel depth (in bits) of the grayscale image
ppmm - the scan resolution (in pixels/mm) of the grayscale image
lfsparms - parameters and thresholds for controlling LFS
Output:
ominutiae - points to a structure containing the
detected minutiae
oquality_map - resulting integrated image quality map
odirection_map - resulting direction map
olow_contrast_map - resulting low contrast map
olow_flow_map - resulting low ridge flow map
ohigh_curve_map - resulting high curvature map
omap_w - width (in blocks) of image maps
omap_h - height (in blocks) of image maps
obdata - points to binarized image data
obw - width (in pixels) of binarized image
obh - height (in pixels) of binarized image
obd - pixel depth (in bits) of binarized image
Return Code:
Zero - successful completion
Negative - system error
**************************************************************************/
int get_minutiae(MINUTIAE **ominutiae, int **oquality_map,
int **odirection_map, int **olow_contrast_map,
int **olow_flow_map, int **ohigh_curve_map,
int *omap_w, int *omap_h,
unsigned char **obdata, int *obw, int *obh, int *obd,
unsigned char *idata, const int iw, const int ih,
const int id, const double ppmm, const LFSPARMS *lfsparms)
{
int ret;
MINUTIAE *minutiae;
int *direction_map, *low_contrast_map, *low_flow_map;
int *high_curve_map, *quality_map;
int map_w, map_h;
unsigned char *bdata;
int bw, bh;
/* If input image is not 8-bit grayscale ... */
if(id != 8){
fprintf(stderr, "ERROR : get_minutiae : input image pixel ");
fprintf(stderr, "depth = %d != 8.\n", id);
return(-2);
}
/* Detect minutiae in grayscale fingerpeint image. */
if((ret = lfs_detect_minutiae_V2(&minutiae,
&direction_map, &low_contrast_map,
&low_flow_map, &high_curve_map,
&map_w, &map_h,
&bdata, &bw, &bh,
idata, iw, ih, lfsparms))){
return(ret);
}
/* Build integrated quality map. */
if((ret = gen_quality_map(&quality_map,
direction_map, low_contrast_map,
low_flow_map, high_curve_map, map_w, map_h))){
free_minutiae(minutiae);
free(direction_map);
free(low_contrast_map);
free(low_flow_map);
free(high_curve_map);
free(bdata);
return(ret);
}
/* Assign reliability from quality map. */
if((ret = combined_minutia_quality(minutiae, quality_map, map_w, map_h,
lfsparms->blocksize,
idata, iw, ih, id, ppmm))){
free_minutiae(minutiae);
free(direction_map);
free(low_contrast_map);
free(low_flow_map);
free(high_curve_map);
free(quality_map);
free(bdata);
return(ret);
}
/* Set output pointers. */
*ominutiae = minutiae;
*oquality_map = quality_map;
*odirection_map = direction_map;
*olow_contrast_map = low_contrast_map;
*olow_flow_map = low_flow_map;
*ohigh_curve_map = high_curve_map;
*omap_w = map_w;
*omap_h = map_h;
*obdata = bdata;
*obw = bw;
*obh = bh;
*obd = id;
/* Return normally. */
return(0);
}