lfs.h 54 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255
  1. /*******************************************************************************
  2. License:
  3. This software and/or related materials was developed at the National Institute
  4. of Standards and Technology (NIST) by employees of the Federal Government
  5. in the course of their official duties. Pursuant to title 17 Section 105
  6. of the United States Code, this software is not subject to copyright
  7. protection and is in the public domain.
  8. This software and/or related materials have been determined to be not subject
  9. to the EAR (see Part 734.3 of the EAR for exact details) because it is
  10. a publicly available technology and software, and is freely distributed
  11. to any interested party with no licensing requirements. Therefore, it is
  12. permissible to distribute this software as a free download from the internet.
  13. Disclaimer:
  14. This software and/or related materials was developed to promote biometric
  15. standards and biometric technology testing for the Federal Government
  16. in accordance with the USA PATRIOT Act and the Enhanced Border Security
  17. and Visa Entry Reform Act. Specific hardware and software products identified
  18. in this software were used in order to perform the software development.
  19. In no case does such identification imply recommendation or endorsement
  20. by the National Institute of Standards and Technology, nor does it imply that
  21. the products and equipment identified are necessarily the best available
  22. for the purpose.
  23. This software and/or related materials are provided "AS-IS" without warranty
  24. of any kind including NO WARRANTY OF PERFORMANCE, MERCHANTABILITY,
  25. NO WARRANTY OF NON-INFRINGEMENT OF ANY 3RD PARTY INTELLECTUAL PROPERTY
  26. or FITNESS FOR A PARTICULAR PURPOSE or for any purpose whatsoever, for the
  27. licensed product, however used. In no event shall NIST be liable for any
  28. damages and/or costs, including but not limited to incidental or consequential
  29. damages of any kind, including economic damage or injury to property and lost
  30. profits, regardless of whether NIST shall be advised, have reason to know,
  31. or in fact shall know of the possibility.
  32. By using this software, you agree to bear all risk relating to quality,
  33. use and performance of the software and/or related materials. You agree
  34. to hold the Government harmless from any claim arising from your use
  35. of the software.
  36. *******************************************************************************/
  37. #ifndef _LFS_H
  38. #define _LFS_H
  39. /***********************************************************************
  40. PACKAGE: NIST Latent Fingerprint System
  41. AUTHOR: Michael D. Garris
  42. DATE: 03/16/1999
  43. UPDATED: 10/04/1999 Version 2 by MDG
  44. UPDATED: 10/26/1999 by MDG
  45. Comments added to guide changes to blocksize
  46. or number of detected directions.
  47. UPDATED: 03/11/2005 by MDG
  48. UPDATED: 01/31/2008 by Kenneth Ko
  49. UPDATED: 09/04/2008 by Kenneth Ko
  50. UPDATED: 01/11/2012 by Kenneth Ko
  51. FILE: LFS.H
  52. Contains all custom structure definitions, constant definitions,
  53. external function definitions, and external global variable
  54. definitions required by the NIST Latent Fingerprint System (LFS).
  55. ***********************************************************************/
  56. #include <math.h>
  57. #include <stdio.h>
  58. //#include "an2k.h" /* Needed by to_type9.c */
  59. #define MM_PER_INCH 25.4
  60. /*************************************************************************/
  61. /* OUTPUT FILE EXTENSIONS */
  62. /*************************************************************************/
  63. #define MIN_TXT_EXT "min"
  64. #define LOW_CONTRAST_MAP_EXT "lcm"
  65. #define HIGH_CURVE_MAP_EXT "hcm"
  66. #define DIRECTION_MAP_EXT "dm"
  67. #define LOW_FLOW_MAP_EXT "lfm"
  68. #define QUALITY_MAP_EXT "qm"
  69. #define AN2K_OUT_EXT "mdt"
  70. #define BINARY_IMG_EXT "brw"
  71. #define XYT_EXT "xyt"
  72. /*************************************************************************/
  73. /* MINUTIAE XYT REPRESENTATION SCHEMES */
  74. /*************************************************************************/
  75. #define NIST_INTERNAL_XYT_REP 0
  76. #define M1_XYT_REP 1
  77. /*************************************************************************/
  78. /* MACRO DEFINITIONS */
  79. /*************************************************************************/
  80. #define max(a, b) ((a) > (b) ? (a) : (b))
  81. #define min(a, b) ((a) < (b) ? (a) : (b))
  82. #define sround(x) ((int) (((x)<0) ? (x)-0.5 : (x)+0.5))
  83. #define trunc_dbl_precision(x, scale) ((double) (((x)<0.0) \
  84. ? ((int)(((x)*(scale))-0.5))/(scale) \
  85. : ((int)(((x)*(scale))+0.5))/(scale)))
  86. #ifndef M_PI
  87. #define M_PI 3.14159265358979323846 /* pi */
  88. #endif
  89. /*************************************************************************/
  90. /* STRUCTURE DEFINITIONS */
  91. /*************************************************************************/
  92. /* Lookup tables for converting from integer directions */
  93. /* to angles in radians. */
  94. typedef struct dir2rad{
  95. int ndirs;
  96. double *cos;
  97. double *sin;
  98. } DIR2RAD;
  99. /* DFT wave form structure containing both cosine and */
  100. /* sine components for a specific frequency. */
  101. typedef struct dftwave{
  102. double *cos;
  103. double *sin;
  104. } DFTWAVE;
  105. /* DFT wave forms structure containing all wave forms */
  106. /* to be used in DFT analysis. */
  107. typedef struct dftwaves{
  108. int nwaves;
  109. int wavelen;
  110. DFTWAVE **waves;
  111. }DFTWAVES;
  112. /* Rotated pixel offsets for a grid of specified dimensions */
  113. /* rotated at a specified number of different orientations */
  114. /* (directions). This structure used by the DFT analysis */
  115. /* when generating a Direction Map and also for conducting */
  116. /* isotropic binarization. */
  117. typedef struct rotgrids{
  118. int pad;
  119. int relative2;
  120. double start_angle;
  121. int ngrids;
  122. int grid_w;
  123. int grid_h;
  124. int **grids;
  125. } ROTGRIDS;
  126. /*************************************************************************/
  127. /* 10, 2X3 pixel pair feature patterns used to define ridge endings */
  128. /* and bifurcations. */
  129. /* 2nd pixel pair is permitted to repeat multiple times in match. */
  130. #define NFEATURES 10
  131. #define BIFURCATION 0
  132. #define RIDGE_ENDING 1
  133. #define DISAPPEARING 0
  134. #define APPEARING 1
  135. typedef struct minutia{
  136. int x;
  137. int y;
  138. int ex;
  139. int ey;
  140. int direction;
  141. double reliability;
  142. int type;
  143. int appearing;
  144. int feature_id;
  145. int *nbrs;
  146. int *ridge_counts;
  147. int num_nbrs;
  148. } MINUTIA;
  149. typedef struct minutiae{
  150. int alloc;
  151. int num;
  152. MINUTIA **list;
  153. } MINUTIAE;
  154. typedef struct feature_pattern{
  155. int type;
  156. int appearing;
  157. int first[2];
  158. int second[2];
  159. int third[2];
  160. } FEATURE_PATTERN;
  161. /* SHAPE structure definitions. */
  162. typedef struct rows{
  163. int y; /* Y-coord of current row in shape. */
  164. int *xs; /* X-coords for shape contour points on current row. */
  165. int alloc; /* Number of points allocate for x-coords on row. */
  166. int npts; /* Number of points assigned for x-coords on row. */
  167. } ROW;
  168. typedef struct shape{
  169. int ymin; /* Y-coord of top-most scanline in shape. */
  170. int ymax; /* Y-coord of bottom-most scanline in shape. */
  171. ROW **rows; /* List of row pointers comprising the shape. */
  172. int alloc; /* Number of rows allocated for shape. */
  173. int nrows; /* Number of rows assigned to shape. */
  174. } SHAPE;
  175. /* Parameters used by LFS for setting thresholds and */
  176. /* defining testing criterion. */
  177. typedef struct lfsparms{
  178. /* Image Controls */
  179. int pad_value;
  180. int join_line_radius;
  181. /* Map Controls */
  182. int blocksize; /* Pixel dimension image block. */
  183. int windowsize; /* Pixel dimension window surrounding block. */
  184. int windowoffset; /* Offset in X & Y from block to window origin. */
  185. int num_directions;
  186. double start_dir_angle;
  187. int rmv_valid_nbr_min;
  188. double dir_strength_min;
  189. int dir_distance_max;
  190. int smth_valid_nbr_min;
  191. int vort_valid_nbr_min;
  192. int highcurv_vorticity_min;
  193. int highcurv_curvature_min;
  194. int min_interpolate_nbrs;
  195. int percentile_min_max;
  196. int min_contrast_delta;
  197. /* DFT Controls */
  198. int num_dft_waves;
  199. double powmax_min;
  200. double pownorm_min;
  201. double powmax_max;
  202. int fork_interval;
  203. double fork_pct_powmax;
  204. double fork_pct_pownorm;
  205. /* Binarization Controls */
  206. int dirbin_grid_w;
  207. int dirbin_grid_h;
  208. int isobin_grid_dim;
  209. int num_fill_holes;
  210. /* Minutiae Detection Controls */
  211. int max_minutia_delta;
  212. double max_high_curve_theta;
  213. int high_curve_half_contour;
  214. int min_loop_len;
  215. double min_loop_aspect_dist;
  216. double min_loop_aspect_ratio;
  217. /* Minutiae Link Controls */
  218. int link_table_dim;
  219. int max_link_dist;
  220. int min_theta_dist;
  221. int maxtrans;
  222. double score_theta_norm;
  223. double score_dist_norm;
  224. double score_dist_weight;
  225. double score_numerator;
  226. /* False Minutiae Removal Controls */
  227. int max_rmtest_dist;
  228. int max_hook_len;
  229. int max_half_loop;
  230. int trans_dir_pix;
  231. int small_loop_len;
  232. int side_half_contour;
  233. int inv_block_margin;
  234. int rm_valid_nbr_min;
  235. int max_overlap_dist;
  236. int max_overlap_join_dist;
  237. int malformation_steps_1;
  238. int malformation_steps_2;
  239. double min_malformation_ratio;
  240. int max_malformation_dist;
  241. int pores_trans_r;
  242. int pores_perp_steps;
  243. int pores_steps_fwd;
  244. int pores_steps_bwd;
  245. double pores_min_dist2;
  246. double pores_max_ratio;
  247. /* Ridge Counting Controls */
  248. int max_nbrs;
  249. int max_ridge_steps;
  250. } LFSPARMS;
  251. /*************************************************************************/
  252. /* LFS CONSTANT DEFINITIONS */
  253. /*************************************************************************/
  254. /***** IMAGE CONSTANTS *****/
  255. #ifndef DEFAULT_PPI
  256. #define DEFAULT_PPI 500
  257. #endif
  258. /* Intensity used to fill padded image area */
  259. #define PAD_VALUE 128 /* medium gray @ 8 bits */
  260. /* Intensity used to draw on grayscale images */
  261. #define DRAW_PIXEL 255 /* white in 8 bits */
  262. /* Definitions for 8-bit binary pixel intensities. */
  263. #define WHITE_PIXEL 255
  264. #define BLACK_PIXEL 0
  265. /* Definitions for controlling join_miutia(). */
  266. /* Draw without opposite perimeter pixels. */
  267. #define NO_BOUNDARY 0
  268. /* Draw with opposite perimeter pixels. */
  269. #define WITH_BOUNDARY 1
  270. /* Radial width added to join line (not including the boundary pixels). */
  271. #define JOIN_LINE_RADIUS 1
  272. /***** MAP CONSTANTS *****/
  273. /* Map value for not well-defined directions */
  274. #define INVALID_DIR -1
  275. /* Map value assigned when the current block has no neighbors */
  276. /* with valid direction. */
  277. #define NO_VALID_NBRS -3
  278. /* Map value designating a block is near a high-curvature */
  279. /* area such as a core or delta. */
  280. #define HIGH_CURVATURE -2
  281. /* This specifies the pixel dimensions of each block in the IMAP */
  282. #define IMAP_BLOCKSIZE 24
  283. /* Pixel dimension of image blocks. The following three constants work */
  284. /* together to define a system of 8X8 adjacent and non-overlapping */
  285. /* blocks that are assigned results from analyzing a larger 24X24 */
  286. /* window centered about each of the 8X8 blocks. */
  287. /* CAUTION: If MAP_BLOCKSIZE_V2 is changed, then the following will */
  288. /* likely need to be changed: MAP_WINDOWOFFSET_V2, */
  289. /* TRANS_DIR_PIX_V2, */
  290. /* INV_BLOCK_MARGIN_V2 */
  291. #define MAP_BLOCKSIZE_V2 8
  292. /* Pixel dimension of window that surrounds the block. The result from */
  293. /* analyzing the content of the window is stored in the interior block. */
  294. #define MAP_WINDOWSIZE_V2 24
  295. /* Pixel offset in X & Y from the origin of the block to the origin of */
  296. /* the surrounding window. */
  297. #define MAP_WINDOWOFFSET_V2 8
  298. /* This is the number of integer directions to be used in semicircle. */
  299. /* CAUTION: If NUM_DIRECTIONS is changed, then the following will */
  300. /* likely need to be changed: HIGHCURV_VORTICITY_MIN, */
  301. /* HIGHCURV_CURVATURE_MIN, */
  302. /* FORK_INTERVAL */
  303. #define NUM_DIRECTIONS 16
  304. /* This is the theta from which integer directions */
  305. /* are to begin. */
  306. #define START_DIR_ANGLE (double)(M_PI/2.0) /* 90 degrees */
  307. /* Minimum number of valid neighbors required for a */
  308. /* valid block value to keep from being removed. */
  309. #define RMV_VALID_NBR_MIN 3
  310. /* Minimum strength for a direction to be considered significant. */
  311. #define DIR_STRENGTH_MIN 0.2
  312. /* Maximum distance allowable between valid block direction */
  313. /* and the average direction of its neighbors before the */
  314. /* direction is removed. */
  315. #define DIR_DISTANCE_MAX 3
  316. /* Minimum number of valid neighbors required for an */
  317. /* INVALID block direction to receive its direction from */
  318. /* the average of its neighbors. */
  319. #define SMTH_VALID_NBR_MIN 7
  320. /* Minimum number of valid neighbors required for a block */
  321. /* with an INVALID block direction to be measured for */
  322. /* vorticity. */
  323. #define VORT_VALID_NBR_MIN 7
  324. /* The minimum vorticity value whereby an INVALID block */
  325. /* is determined to be high-curvature based on the directions */
  326. /* of it neighbors. */
  327. #define HIGHCURV_VORTICITY_MIN 5
  328. /* The minimum curvature value whereby a VALID direction block is */
  329. /* determined to be high-curvature based on it value compared with */
  330. /* its neighbors' directions. */
  331. #define HIGHCURV_CURVATURE_MIN 5
  332. /* Minimum number of neighbors with VALID direction for an INVALID */
  333. /* directon block to have its direction interpolated from those neighbors. */
  334. #define MIN_INTERPOLATE_NBRS 2
  335. /* Definitions for creating a low contrast map. */
  336. /* Percentile cut off for choosing min and max pixel intensities */
  337. /* in a block. */
  338. #define PERCENTILE_MIN_MAX 10
  339. /* The minimum delta between min and max percentile pixel intensities */
  340. /* in block for block NOT to be considered low contrast. (Note that */
  341. /* this value is in terms of 6-bit pixels.) */
  342. #define MIN_CONTRAST_DELTA 5
  343. /***** DFT CONSTANTS *****/
  344. /* This specifies the number of DFT wave forms to be applied */
  345. #define NUM_DFT_WAVES 4
  346. /* Minimum total DFT power for any given block */
  347. /* which is used to compute an average power. */
  348. /* By setting a non-zero minimum total,possible */
  349. /* division by zero is avoided. This value was */
  350. /* taken from HO39. */
  351. #define MIN_POWER_SUM 10.0
  352. /* Thresholds and factors used by HO39. Renamed */
  353. /* here to give more meaning. */
  354. /* HO39 Name=Value */
  355. /* Minimum DFT power allowable in any one direction. */
  356. #define POWMAX_MIN 100000.0 /* thrhf=1e5f */
  357. /* Minimum normalized power allowable in any one */
  358. /* direction. */
  359. #define POWNORM_MIN 3.8 /* disc=3.8f */
  360. /* Maximum power allowable at the lowest frequency */
  361. /* DFT wave. */
  362. #define POWMAX_MAX 50000000.0 /* thrlf=5e7f */
  363. /* Check for a fork at +- this number of units from */
  364. /* current integer direction. For example, */
  365. /* 2 dir ==> 11.25 X 2 degrees. */
  366. #define FORK_INTERVAL 2
  367. /* Minimum DFT power allowable at fork angles is */
  368. /* FORK_PCT_POWMAX X block's max directional power. */
  369. #define FORK_PCT_POWMAX 0.7
  370. /* Minimum normalized power allowable at fork angles */
  371. /* is FORK_PCT_POWNORM X POWNORM_MIN */
  372. #define FORK_PCT_POWNORM 0.75
  373. /***** BINRAIZATION CONSTANTS *****/
  374. /* Directional binarization grid dimensions. */
  375. #define DIRBIN_GRID_W 7
  376. #define DIRBIN_GRID_H 9
  377. /* The pixel dimension (square) of the grid used in isotropic */
  378. /* binarization. */
  379. #define ISOBIN_GRID_DIM 11
  380. /* Number of passes through the resulting binary image where holes */
  381. /* of pixel length 1 in horizontal and vertical runs are filled. */
  382. #define NUM_FILL_HOLES 3
  383. /***** MINUTIAE DETECTION CONSTANTS *****/
  384. /* The maximum pixel translation distance in X or Y within which */
  385. /* two potential minutia points are to be considered similar. */
  386. #define MAX_MINUTIA_DELTA 10
  387. /* If the angle of a contour exceeds this angle, then it is NOT */
  388. /* to be considered to contain minutiae. */
  389. #define MAX_HIGH_CURVE_THETA (double)(M_PI/3.0)
  390. /* Half the length in pixels to be extracted for a high-curvature contour. */
  391. #define HIGH_CURVE_HALF_CONTOUR 14
  392. /* Loop must be larger than this threshold (in pixels) to be considered */
  393. /* to contain minutiae. */
  394. #define MIN_LOOP_LEN 20
  395. /* If loop's minimum distance half way across its contour is less than */
  396. /* this threshold, then loop is tested for minutiae. */
  397. #define MIN_LOOP_ASPECT_DIST 1.0
  398. /* If ratio of loop's maximum/minimum distances half way across its */
  399. /* contour is >= to this threshold, then loop is tested for minutiae. */
  400. #define MIN_LOOP_ASPECT_RATIO 2.25
  401. /* There are 10 unique feature patterns with ID = [0..9] , */
  402. /* so set LOOP ID to 10 (one more than max pattern ID). */
  403. #define LOOP_ID 10
  404. /* Definitions for controlling the scanning of minutiae. */
  405. #define SCAN_HORIZONTAL 0
  406. #define SCAN_VERTICAL 1
  407. #define SCAN_CLOCKWISE 0
  408. #define SCAN_COUNTER_CLOCKWISE 1
  409. /* The dimension of the chaincode loopkup matrix. */
  410. #define NBR8_DIM 3
  411. /* Default minutiae reliability. */
  412. #define DEFAULT_RELIABILITY 0.99
  413. /* Medium minutia reliability. */
  414. #define MEDIUM_RELIABILITY 0.50
  415. /* High minutia reliability. */
  416. #define HIGH_RELIABILITY 0.99
  417. /***** MINUTIAE LINKING CONSTANTS *****/
  418. /* Definitions for controlling the linking of minutiae. */
  419. /* Square dimensions of 2D table of potentially linked minutiae. */
  420. #define LINK_TABLE_DIM 20
  421. /* Distance (in pixels) used to determine if the orthogonal distance */
  422. /* between the coordinates of 2 minutia points are sufficiently close */
  423. /* to be considered for linking. */
  424. #define MAX_LINK_DIST 20
  425. /* Minimum distance (in pixels) between 2 minutia points that an angle */
  426. /* computed between the points may be considered reliable. */
  427. #define MIN_THETA_DIST 5
  428. /* Maximum number of transitions along a contiguous pixel trajectory */
  429. /* between 2 minutia points for that trajectory to be considered "free" */
  430. /* of obstacles. */
  431. #define MAXTRANS 2
  432. /* Parameters used to compute a link score between 2 minutiae. */
  433. #define SCORE_THETA_NORM 15.0
  434. #define SCORE_DIST_NORM 10.0
  435. #define SCORE_DIST_WEIGHT 4.0
  436. #define SCORE_NUMERATOR 32000.0
  437. /***** FALSE MINUTIAE REMOVAL CONSTANTS *****/
  438. /* Definitions for removing hooks, islands, lakes, and overlaps. */
  439. /* Distance (in pixels) used to determine if the orthogonal distance */
  440. /* between the coordinates of 2 minutia points are sufficiently close */
  441. /* to be considered for removal. */
  442. #define MAX_RMTEST_DIST 8
  443. #define MAX_RMTEST_DIST_V2 16
  444. /* Length of pixel contours to be traced and analyzed for possible hooks. */
  445. #define MAX_HOOK_LEN 15
  446. #define MAX_HOOK_LEN_V2 30
  447. /* Half the maximum length of pixel contours to be traced and analyzed */
  448. /* for possible loops (islands/lakes). */
  449. #define MAX_HALF_LOOP 15
  450. #define MAX_HALF_LOOP_V2 30
  451. /* Definitions for removing minutiae that are sufficiently close and */
  452. /* point to a block with invalid ridge flow. */
  453. /* Distance (in pixels) in direction opposite the minutia to be */
  454. /* considered sufficiently close to an invalid block. */
  455. #define TRANS_DIR_PIX 6
  456. #define TRANS_DIR_PIX_V2 4
  457. /* Definitions for removing small holes (islands/lakes). */
  458. /* Maximum circumference (in pixels) of qualifying loops. */
  459. #define SMALL_LOOP_LEN 15
  460. /* Definitions for removing or adusting side minutiae. */
  461. /* Half the number of pixels to be traced to form a complete contour. */
  462. #define SIDE_HALF_CONTOUR 7
  463. /* Definitions for removing minutiae near invalid blocks. */
  464. /* Maximum orthogonal distance a minutia can be neighboring a block with */
  465. /* invalid ridge flow in order to be removed. */
  466. #define INV_BLOCK_MARGIN 6
  467. #define INV_BLOCK_MARGIN_V2 4
  468. /* Given a sufficiently close, neighboring invalid block, if that invalid */
  469. /* block has a total number of neighboring blocks with valid ridge flow */
  470. /* less than this threshold, then the minutia point is removed. */
  471. #define RM_VALID_NBR_MIN 7
  472. /* Definitions for removing overlaps. */
  473. /* Maximum pixel distance between 2 points to be tested for overlapping */
  474. /* conditions. */
  475. #define MAX_OVERLAP_DIST 8
  476. /* Maximum pixel distance between 2 points on opposite sides of an overlap */
  477. /* will be joined. */
  478. #define MAX_OVERLAP_JOIN_DIST 6
  479. /* Definitions for removing "irregularly-shaped" minutiae. */
  480. /* Contour steps to be traced to 1st measuring point. */
  481. #define MALFORMATION_STEPS_1 10
  482. /* Contour steps to be traced to 2nd measuring point. */
  483. #define MALFORMATION_STEPS_2 20
  484. /* Minimum ratio of distances across feature at the two point to be */
  485. /* considered normal. */
  486. #define MIN_MALFORMATION_RATIO 2.0
  487. /* Maximum distance permitted across feature to be considered normal. */
  488. #define MAX_MALFORMATION_DIST 20
  489. /* Definitions for removing minutiae on pores. */
  490. /* Translation distance (in pixels) from minutia point in opposite direction */
  491. /* in order to get off a valley edge and into the neighboring ridge. */
  492. #define PORES_TRANS_R 3
  493. /* Number of steps (in pixels) to search for edge of current ridge. */
  494. #define PORES_PERP_STEPS 12
  495. /* Number of pixels to be traced to find forward contour points. */
  496. #define PORES_STEPS_FWD 10
  497. /* Number of pixels to be traced to find backward contour points. */
  498. #define PORES_STEPS_BWD 8
  499. /* Minimum squared distance between points before being considered zero. */
  500. #define PORES_MIN_DIST2 0.5
  501. /* Max ratio of computed distances between pairs of forward and backward */
  502. /* contour points to be considered a pore. */
  503. #define PORES_MAX_RATIO 2.25
  504. /***** RIDGE COUNTING CONSTANTS *****/
  505. /* Definitions for detecting nearest neighbors and counting ridges. */
  506. /* Maximum number of nearest neighbors per minutia. */
  507. #define MAX_NBRS 5
  508. /* Maximum number of contour steps taken to validate a ridge crossing. */
  509. #define MAX_RIDGE_STEPS 10
  510. /*************************************************************************/
  511. /* QUALITY/RELIABILITY DEFINITIONS */
  512. /*************************************************************************/
  513. /* Quality map levels */
  514. #define QMAP_LEVELS 5
  515. /* Neighborhood radius in millimeters computed from 11 pixles */
  516. /* scanned at 19.69 pixels/mm. */
  517. #define RADIUS_MM ((double)(11.0 / 19.69))
  518. /* Ideal Standard Deviation of pixel values in a neighborhood. */
  519. #define IDEALSTDEV 64
  520. /* Ideal Mean of pixel values in a neighborhood. */
  521. #define IDEALMEAN 127
  522. /* Look for neighbors this many blocks away. */
  523. #define NEIGHBOR_DELTA 2
  524. /*************************************************************************/
  525. /* GENERAL DEFINITIONS */
  526. /*************************************************************************/
  527. #define LFS_VERSION_STR "NIST_LFS_VER2"
  528. /* This factor converts degrees to radians. */
  529. #ifndef DEG2RAD
  530. #define DEG2RAD (double)(M_PI/180.0)
  531. #endif
  532. #define NORTH 0
  533. #define SOUTH 4
  534. #define EAST 2
  535. #define WEST 6
  536. #ifndef TRUE
  537. #define TRUE 1
  538. #endif
  539. #ifndef FALSE
  540. #define FALSE 0
  541. #endif
  542. #ifndef FOUND
  543. #define FOUND TRUE
  544. #endif
  545. #ifndef NOT_FOUND
  546. #define NOT_FOUND FALSE
  547. #endif
  548. #define HOOK_FOUND 1
  549. #define LOOP_FOUND 1
  550. #define IGNORE 2
  551. #define LIST_FULL 3
  552. #define INCOMPLETE 3
  553. /* Pixel value limit in 6-bit image. */
  554. #define IMG_6BIT_PIX_LIMIT 64
  555. /* Maximum number (or reallocated chunks) of minutia to be detected */
  556. /* in an image. */
  557. #define MAX_MINUTIAE 1000
  558. /* If both deltas in X and Y for a line of specified slope is less than */
  559. /* this threshold, then the angle for the line is set to 0 radians. */
  560. #define MIN_SLOPE_DELTA 0.5
  561. /* Designates that rotated grid offsets should be relative */
  562. /* to the grid's center. */
  563. #define RELATIVE2CENTER 0
  564. /* Designates that rotated grid offsets should be relative */
  565. /* to the grid's origin. */
  566. #define RELATIVE2ORIGIN 1
  567. /* Truncate floating point precision by multiply, rounding, and then */
  568. /* dividing by this value. This enables consistant results across */
  569. /* different computer architectures. */
  570. #define TRUNC_SCALE 16384.0
  571. /* Designates passed argument as undefined. */
  572. #define UNDEFINED -1
  573. /* Dummy values for unused LFS control parameters. */
  574. #define UNUSED_INT 0
  575. #define UNUSED_DBL 0.0
  576. /*************************************************************************/
  577. /* EXTERNAL FUNCTION DEFINITIONS */
  578. /*************************************************************************/
  579. /* binar.c */
  580. extern int binarize(unsigned char **, int *, int *,
  581. unsigned char *, const int, const int,
  582. int *, const int, const int,
  583. const ROTGRIDS *, const LFSPARMS *);
  584. extern int binarize_V2(unsigned char **, int *, int *,
  585. unsigned char *, const int, const int,
  586. int *, const int, const int,
  587. const ROTGRIDS *, const LFSPARMS *);
  588. extern int binarize_image(unsigned char **, int *, int *,
  589. unsigned char *, const int, const int,
  590. const int *, const int, const int, const int,
  591. const ROTGRIDS *, const int);
  592. extern int binarize_image_V2(unsigned char **, int *, int *,
  593. unsigned char *, const int, const int,
  594. const int *, const int, const int,
  595. const int, const ROTGRIDS *);
  596. extern int dirbinarize(const unsigned char *, const int, const ROTGRIDS *);
  597. extern int isobinarize(unsigned char *, const int, const int, const int);
  598. /* block.c */
  599. extern int block_offsets(int **, int *, int *, const int, const int,
  600. const int, const int);
  601. extern int low_contrast_block(const int, const int,
  602. unsigned char *, const int, const int, const LFSPARMS *);
  603. extern int find_valid_block(int *, int *, int *, int *, int *,
  604. const int, const int, const int, const int,
  605. const int, const int);
  606. extern void set_margin_blocks(int *, const int, const int, const int);
  607. /* chaincod.c */
  608. extern int chain_code_loop(int **, int *, const int *, const int *, const int);
  609. extern int is_chain_clockwise(const int *, const int, const int);
  610. /* contour.c */
  611. extern int allocate_contour(int **, int **, int **, int **, const int);
  612. extern void free_contour(int *, int *, int *, int *);
  613. extern int get_high_curvature_contour(int **, int **, int **, int **, int *,
  614. const int, const int, const int, const int, const int,
  615. unsigned char *, const int, const int);
  616. extern int get_centered_contour(int **, int **, int **, int **, int *,
  617. const int, const int, const int, const int, const int,
  618. unsigned char *, const int, const int);
  619. extern int trace_contour(int **, int **, int **, int **, int *,
  620. const int, const int, const int, const int, const int,
  621. const int, const int, const int,
  622. unsigned char *, const int, const int);
  623. extern int search_contour(const int, const int, const int,
  624. const int, const int, const int, const int, const int,
  625. unsigned char *, const int, const int);
  626. extern int next_contour_pixel(int *, int *, int *, int *,
  627. const int, const int, const int, const int, const int,
  628. unsigned char *, const int, const int);
  629. extern int start_scan_nbr(const int, const int, const int, const int);
  630. extern int next_scan_nbr(const int, const int);
  631. extern int min_contour_theta(int *, double *, const int, const int *,
  632. const int *, const int);
  633. extern void contour_limits(int *, int *, int *, int *, const int *,
  634. const int *, const int);
  635. extern void fix_edge_pixel_pair(int *, int *, int *, int *,
  636. unsigned char *, const int, const int);
  637. /* detect.c */
  638. extern int lfs_detect_minutiae( MINUTIAE **,
  639. int **, int **, int *, int *,
  640. unsigned char **, int *, int *,
  641. unsigned char *, const int, const int,
  642. const LFSPARMS *);
  643. extern int lfs_detect_minutiae_V2(MINUTIAE **,
  644. int **, int **, int **, int **, int *, int *,
  645. unsigned char **, int *, int *,
  646. unsigned char *, const int, const int,
  647. const LFSPARMS *);
  648. /* dft.c */
  649. extern int dft_dir_powers(double **, unsigned char *, const int,
  650. const int, const int, const DFTWAVES *,
  651. const ROTGRIDS *);
  652. extern void sum_rot_block_rows(int *, const unsigned char *, const int *,
  653. const int);
  654. extern void dft_power(double *, const int *, const DFTWAVE *, const int);
  655. extern int dft_power_stats(int *, double *, int *, double *, double **,
  656. const int, const int, const int);
  657. extern void get_max_norm(double *, int *, double *, const double *, const int);
  658. extern int sort_dft_waves(int *, const double *, const double *, const int);
  659. /* free.c */
  660. extern void free_dir2rad(DIR2RAD *);
  661. extern void free_dftwaves(DFTWAVES *);
  662. extern void free_rotgrids(ROTGRIDS *);
  663. extern void free_dir_powers(double **, const int);
  664. /* getmin.c */
  665. extern int get_minutiae(MINUTIAE **, int **, int **, int **,
  666. int **, int **, int *, int *,
  667. unsigned char **, int *, int *, int *,
  668. unsigned char *, const int, const int,
  669. const int, const double, const LFSPARMS *);
  670. /* imgutil.c */
  671. extern void bits_6to8(unsigned char *, const int, const int);
  672. extern void bits_8to6(unsigned char *, const int, const int);
  673. extern void gray2bin(const int, const int, const int,
  674. unsigned char *, const int, const int);
  675. extern int pad_uchar_image(unsigned char **, int *, int *,
  676. unsigned char *, const int, const int, const int,
  677. const int);
  678. extern void fill_holes(unsigned char *, const int, const int);
  679. extern int free_path(const int, const int, const int, const int,
  680. unsigned char *, const int, const int, const LFSPARMS *);
  681. extern int search_in_direction(int *, int *, int *, int *, const int,
  682. const int, const int, const double, const double,
  683. const int, unsigned char *, const int, const int);
  684. /* init.c */
  685. extern int init_dir2rad(DIR2RAD **, const int);
  686. extern int init_dftwaves(DFTWAVES **, const double *, const int, const int);
  687. extern int get_max_padding(const int, const int, const int, const int);
  688. extern int get_max_padding_V2(const int, const int, const int, const int);
  689. extern int init_rotgrids(ROTGRIDS **, const int, const int, const int,
  690. const double, const int, const int, const int, const int);
  691. extern int alloc_dir_powers(double ***, const int, const int);
  692. extern int alloc_power_stats(int **, double **, int **, double **, const int);
  693. /* isempty.c */
  694. extern int is_image_empty(int *, const int, const int);
  695. extern int is_qmap_empty(int *, const int, const int);
  696. /* line.c */
  697. extern int line_points(int **, int **, int *,
  698. const int, const int, const int, const int);
  699. extern int bresenham_line_points(int **, int **, int *,
  700. const int, const int, const int, const int);
  701. /* link.c */
  702. extern int link_minutiae(MINUTIAE *, unsigned char *, const int, const int,
  703. int *, const int, const int, const LFSPARMS *);
  704. extern int create_link_table(int **, int **, int **, int *, int *, int *,
  705. const int, const int, const MINUTIAE *, const int *,
  706. int *, const int, const int, unsigned char *,
  707. const int, const int, const LFSPARMS *);
  708. extern int update_link_table(int *, int *, int *, int *, int *, int *,
  709. const int, int *, int *, int *, int *,
  710. const int, const int, const int);
  711. extern int order_link_table(int *, int *, int *, const int, const int,
  712. const int, const int, const MINUTIAE *, const int);
  713. extern int process_link_table(const int *, const int *, const int *,
  714. const int, const int, const int, const int, MINUTIAE *,
  715. int *, unsigned char *, const int, const int,
  716. const LFSPARMS *);
  717. extern double link_score(const double, const double, const LFSPARMS *);
  718. /* loop.c */
  719. extern int get_loop_list(int **, MINUTIAE *, const int, unsigned char *,
  720. const int, const int);
  721. extern int on_loop(const MINUTIA *, const int, unsigned char *, const int,
  722. const int);
  723. extern int on_island_lake(int **, int **, int **, int **, int *,
  724. const MINUTIA *, const MINUTIA *, const int,
  725. unsigned char *, const int, const int);
  726. extern int on_hook(const MINUTIA *, const MINUTIA *, const int,
  727. unsigned char *, const int, const int);
  728. extern int is_loop_clockwise(const int *, const int *, const int, const int);
  729. extern int process_loop(MINUTIAE *, const int *, const int *,
  730. const int *, const int *, const int,
  731. unsigned char *, const int, const int, const LFSPARMS *);
  732. extern int process_loop_V2(MINUTIAE *, const int *, const int *,
  733. const int *, const int *, const int,
  734. unsigned char *, const int, const int,
  735. int *, const LFSPARMS *);
  736. extern void get_loop_aspect(int *, int *, double *, int *, int *, double *,
  737. const int *, const int *, const int);
  738. extern int fill_loop(const int *, const int *, const int,
  739. unsigned char *, const int, const int);
  740. extern void fill_partial_row(const int, const int, const int, const int,
  741. unsigned char *, const int, const int);
  742. extern void flood_loop(const int *, const int *, const int,
  743. unsigned char *, const int, const int);
  744. extern void flood_fill4(const int, const int, const int,
  745. unsigned char *, const int, const int);
  746. /* maps.c */
  747. extern int gen_image_maps(int **, int **, int **, int **, int *, int *,
  748. unsigned char *, const int, const int,
  749. const DIR2RAD *, const DFTWAVES *,
  750. const ROTGRIDS *, const LFSPARMS *);
  751. extern int gen_initial_maps(int **, int **, int **,
  752. int *, const int, const int,
  753. unsigned char *, const int, const int,
  754. const DFTWAVES *, const ROTGRIDS *, const LFSPARMS *);
  755. extern int interpolate_direction_map(int *, int *, const int, const int,
  756. const LFSPARMS *);
  757. extern int morph_TF_map(int *, const int, const int, const LFSPARMS *);
  758. extern int pixelize_map(int **, const int, const int,
  759. int *, const int, const int, const int);
  760. extern void smooth_direction_map(int *, int *, const int, const int,
  761. const DIR2RAD *, const LFSPARMS *);
  762. extern int gen_high_curve_map(int **, int *, const int, const int,
  763. const LFSPARMS *);
  764. extern int gen_imap(int **, int *, int *,
  765. unsigned char *, const int, const int,
  766. const DIR2RAD *, const DFTWAVES *, const ROTGRIDS *,
  767. const LFSPARMS *);
  768. extern int gen_initial_imap(int **, int *, const int, const int,
  769. unsigned char *, const int, const int,
  770. const DFTWAVES *, const ROTGRIDS *, const LFSPARMS *);
  771. extern int primary_dir_test(double **, const int *, const double *,
  772. const int *, const double *, const int,
  773. const LFSPARMS *);
  774. extern int secondary_fork_test(double **, const int *, const double *,
  775. const int *, const double *, const int,
  776. const LFSPARMS *);
  777. extern void remove_incon_dirs(int *, const int, const int,
  778. const DIR2RAD *, const LFSPARMS *);
  779. extern int test_top_edge(const int, const int, const int, const int,
  780. int *, const int, const int, const DIR2RAD *,
  781. const LFSPARMS *);
  782. extern int test_right_edge(const int, const int, const int, const int,
  783. int *, const int, const int, const DIR2RAD *,
  784. const LFSPARMS *);
  785. extern int test_bottom_edge(const int, const int, const int, const int,
  786. int *, const int, const int, const DIR2RAD *,
  787. const LFSPARMS *);
  788. extern int test_left_edge(const int, const int, const int, const int,
  789. int *, const int, const int, const DIR2RAD *,
  790. const LFSPARMS *);
  791. extern int remove_dir(int *, const int, const int, const int, const int,
  792. const DIR2RAD *, const LFSPARMS *);
  793. extern void average_8nbr_dir(int *, double *, int *, int *, const int,
  794. const int, const int, const int, const DIR2RAD *);
  795. extern int num_valid_8nbrs(int *, const int, const int, const int, const int);
  796. extern void smooth_imap(int *, const int, const int, const DIR2RAD *,
  797. const LFSPARMS *);
  798. extern int gen_nmap(int **, int *, const int, const int, const LFSPARMS *);
  799. extern int vorticity(int *, const int, const int, const int, const int,
  800. const int);
  801. extern void accum_nbr_vorticity(int *, const int, const int, const int);
  802. extern int curvature(int *, const int, const int, const int, const int,
  803. const int);
  804. /* matchpat.c */
  805. extern int match_1st_pair(unsigned char, unsigned char, int *, int *);
  806. extern int match_2nd_pair(unsigned char, unsigned char, int *, int *);
  807. extern int match_3rd_pair(unsigned char, unsigned char, int *, int *);
  808. extern void skip_repeated_horizontal_pair(int *, const int,
  809. unsigned char **, unsigned char **, const int, const int);
  810. extern void skip_repeated_vertical_pair(int *, const int,
  811. unsigned char **, unsigned char **, const int, const int);
  812. /* minutia.c */
  813. extern int alloc_minutiae(MINUTIAE **, const int);
  814. extern int realloc_minutiae(MINUTIAE *, const int);
  815. extern int detect_minutiae(MINUTIAE *, unsigned char *, const int, const int,
  816. const int *, const int *, const int, const int,
  817. const LFSPARMS *);
  818. extern int detect_minutiae_V2(MINUTIAE *,
  819. unsigned char *, const int, const int,
  820. int *, int *, int *, const int, const int,
  821. const LFSPARMS *);
  822. extern int update_minutiae(MINUTIAE *, MINUTIA *, unsigned char *,
  823. const int, const int, const LFSPARMS *);
  824. extern int update_minutiae_V2(MINUTIAE *, MINUTIA *, const int, const int,
  825. unsigned char *, const int, const int,
  826. const LFSPARMS *);
  827. extern int sort_minutiae(MINUTIAE *, const int, const int);
  828. extern int sort_minutiae_y_x(MINUTIAE *, const int, const int);
  829. extern int sort_minutiae_x_y(MINUTIAE *, const int, const int);
  830. extern int rm_dup_minutiae(MINUTIAE *);
  831. extern void dump_minutiae(FILE *, const MINUTIAE *);
  832. extern void dump_minutiae_pts(FILE *, const MINUTIAE *);
  833. extern void dump_reliable_minutiae_pts(FILE *, const MINUTIAE *, const double);
  834. extern int create_minutia(MINUTIA **, const int, const int,
  835. const int, const int, const int, const double,
  836. const int, const int, const int);
  837. extern void free_minutiae(MINUTIAE *);
  838. extern void free_minutia(MINUTIA *);
  839. extern int remove_minutia(const int, MINUTIAE *);
  840. extern int join_minutia(const MINUTIA *, const MINUTIA *, unsigned char *,
  841. const int, const int, const int, const int);
  842. extern int minutia_type(const int);
  843. extern int is_minutia_appearing(const int, const int, const int, const int);
  844. extern int choose_scan_direction(const int, const int);
  845. int scan4minutiae(MINUTIAE *, unsigned char *, const int, const int,
  846. const int *, const int *, const int, const int,
  847. const int, const int, const int, const int,
  848. const int, const int, const int, const LFSPARMS *);
  849. extern int scan4minutiae_horizontally(MINUTIAE *, unsigned char *,
  850. const int, const int, const int, const int,
  851. const int, const int, const int, const int,
  852. const LFSPARMS *);
  853. extern int scan4minutiae_horizontally_V2(MINUTIAE *,
  854. unsigned char *, const int, const int,
  855. int *, int *, int *,
  856. const LFSPARMS *);
  857. extern int scan4minutiae_vertically(MINUTIAE *, unsigned char *,
  858. const int, const int, const int, const int,
  859. const int, const int, const int, const int,
  860. const LFSPARMS *);
  861. extern int rescan4minutiae_horizontally(MINUTIAE *, unsigned char *bdata,
  862. const int, const int, const int *, const int *,
  863. const int, const int, const int, const int,
  864. const int, const int, const int, const int,
  865. const LFSPARMS *);
  866. extern int scan4minutiae_vertically_V2(MINUTIAE *,
  867. unsigned char *, const int, const int,
  868. int *, int *, int *, const LFSPARMS *);
  869. extern int rescan4minutiae_vertically(MINUTIAE *, unsigned char *,
  870. const int, const int, const int *, const int *,
  871. const int, const int, const int, const int,
  872. const int, const int, const int, const int,
  873. const LFSPARMS *);
  874. extern int rescan_partial_horizontally(const int, MINUTIAE *,
  875. unsigned char *, const int, const int,
  876. const int *, const int *,
  877. const int, const int, const int, const int,
  878. const int, const int, const int, const int,
  879. const LFSPARMS *);
  880. extern int rescan_partial_vertically(const int, MINUTIAE *,
  881. unsigned char *, const int, const int,
  882. const int *, const int *,
  883. const int, const int, const int, const int,
  884. const int, const int, const int, const int,
  885. const LFSPARMS *);
  886. extern int get_nbr_block_index(int *, const int, const int, const int,
  887. const int, const int);
  888. extern int adjust_horizontal_rescan(const int, int *, int *, int *, int *,
  889. const int, const int, const int, const int, const int);
  890. extern int adjust_vertical_rescan(const int, int *, int *, int *, int *,
  891. const int, const int, const int, const int, const int);
  892. extern int process_horizontal_scan_minutia(MINUTIAE *, const int, const int,
  893. const int, const int,
  894. unsigned char *, const int, const int,
  895. const int, const int, const LFSPARMS *);
  896. extern int process_horizontal_scan_minutia_V2(MINUTIAE *,
  897. const int, const int, const int, const int,
  898. unsigned char *, const int, const int,
  899. int *, int *, int *, const LFSPARMS *);
  900. extern int process_vertical_scan_minutia(MINUTIAE *, const int, const int,
  901. const int, const int,
  902. unsigned char *, const int, const int,
  903. const int, const int, const LFSPARMS *);
  904. extern int process_vertical_scan_minutia_V2(MINUTIAE *, const int, const int,
  905. const int, const int,
  906. unsigned char *, const int, const int,
  907. int *, int *, int *, const LFSPARMS *);
  908. extern int update_minutiae_V2(MINUTIAE *, MINUTIA *, const int, const int,
  909. unsigned char *, const int, const int,
  910. const LFSPARMS *);
  911. extern int adjust_high_curvature_minutia(int *, int *, int *, int *, int *,
  912. const int, const int, const int, const int,
  913. unsigned char *, const int, const int,
  914. MINUTIAE *, const LFSPARMS *);
  915. extern int adjust_high_curvature_minutia_V2(int *, int *, int *,
  916. int *, int *, const int, const int,
  917. const int, const int,
  918. unsigned char *, const int, const int,
  919. int *, MINUTIAE *, const LFSPARMS *);
  920. extern int get_low_curvature_direction(const int, const int, const int,
  921. const int);
  922. /* quality.c */
  923. extern int gen_quality_map(int **, int *, int *, int *, int *,
  924. const int, const int);
  925. extern int combined_minutia_quality(MINUTIAE *, int *, const int, const int,
  926. const int, unsigned char *, const int, const int,
  927. const int, const double);
  928. double grayscale_reliability(MINUTIA *, unsigned char *,
  929. const int, const int, const int);
  930. extern void get_neighborhood_stats(double *, double *, MINUTIA *,
  931. unsigned char *, const int, const int, const int);
  932. extern int reliability_fr_quality_map(MINUTIAE *, int *, const int,
  933. const int, const int, const int, const int);
  934. /* remove.c */
  935. extern int remove_false_minutia(MINUTIAE *,
  936. unsigned char *, const int, const int,
  937. int *, const int, const int, const LFSPARMS *);
  938. extern int remove_false_minutia_V2(MINUTIAE *,
  939. unsigned char *, const int, const int,
  940. int *, int *, int *, const int, const int,
  941. const LFSPARMS *);
  942. extern int remove_holes(MINUTIAE *, unsigned char *, const int, const int,
  943. const LFSPARMS *);
  944. extern int remove_hooks(MINUTIAE *,
  945. unsigned char *, const int, const int, const LFSPARMS *);
  946. extern int remove_hooks_islands_lakes_overlaps(MINUTIAE *, unsigned char *,
  947. const int, const int, const LFSPARMS *);
  948. extern int remove_islands_and_lakes(MINUTIAE *,
  949. unsigned char *, const int, const int, const LFSPARMS *);
  950. extern int remove_malformations(MINUTIAE *,
  951. unsigned char *, const int, const int,
  952. int *, const int, const int, const LFSPARMS *);
  953. extern int remove_near_invblock(MINUTIAE *, int *, const int, const int,
  954. const LFSPARMS *);
  955. extern int remove_near_invblock_V2(MINUTIAE *, int *,
  956. const int, const int, const LFSPARMS *);
  957. extern int remove_pointing_invblock(MINUTIAE *, int *, const int, const int,
  958. const LFSPARMS *);
  959. extern int remove_pointing_invblock_V2(MINUTIAE *,
  960. int *, const int, const int, const LFSPARMS *);
  961. extern int remove_overlaps(MINUTIAE *,
  962. unsigned char *, const int, const int, const LFSPARMS *);
  963. extern int remove_pores(MINUTIAE *,
  964. unsigned char *, const int, const int,
  965. int *, const int, const int, const LFSPARMS *);
  966. extern int remove_pores_V2(MINUTIAE *,
  967. unsigned char *, const int, const int,
  968. int *, int *, int *, const int, const int,
  969. const LFSPARMS *);
  970. extern int remove_or_adjust_side_minutiae(MINUTIAE *, unsigned char *,
  971. const int, const int, const LFSPARMS *);
  972. extern int remove_or_adjust_side_minutiae_V2(MINUTIAE *,
  973. unsigned char *, const int, const int,
  974. int *, const int, const int, const LFSPARMS *);
  975. /* results.c */
  976. extern int write_text_results(char *, const int, const int, const int,
  977. const MINUTIAE *, int *, int *, int *, int *, int *,
  978. const int, const int);
  979. extern int write_minutiae_XYTQ(char *ofile, const int,
  980. const MINUTIAE *, const int, const int);
  981. extern void dump_map(FILE *, int *, const int, const int);
  982. extern int drawimap(int *, const int, const int, unsigned char *,
  983. const int, const int, const ROTGRIDS *, const int);
  984. extern void drawimap2(int *, const int *, const int, const int,
  985. unsigned char *, const int, const int,
  986. const double, const int, const int);
  987. extern void drawblocks(const int *, const int, const int,
  988. unsigned char *, const int, const int, const int );
  989. extern int drawrotgrid(const ROTGRIDS *, const int, unsigned char *,
  990. const int, const int, const int, const int);
  991. extern void dump_link_table(FILE *, const int *, const int *, const int *,
  992. const int, const int, const int, const MINUTIAE *);
  993. extern int draw_direction_map(char *, int *,
  994. int *, const int, const int, const int,
  995. unsigned char *, const int, const int, const int);
  996. extern int draw_TF_map(char *, int *,
  997. int *, const int, const int, const int,
  998. unsigned char *, const int, const int, const int);
  999. /* ridges.c */
  1000. extern int count_minutiae_ridges(MINUTIAE *,
  1001. unsigned char *, const int, const int,
  1002. const LFSPARMS *);
  1003. extern int count_minutia_ridges(const int, MINUTIAE *,
  1004. unsigned char *, const int, const int,
  1005. const LFSPARMS *);
  1006. extern int find_neighbors(int **, int *, const int, const int, MINUTIAE *);
  1007. extern int update_nbr_dists(int *, double *, int *, const int,
  1008. const int, const int, MINUTIAE *);
  1009. extern int insert_neighbor(const int, const int, const double,
  1010. int *, double *, int *, const int);
  1011. extern int sort_neighbors(int *, const int, const int, MINUTIAE *);
  1012. extern int ridge_count(const int, const int, MINUTIAE *,
  1013. unsigned char *, const int, const int, const LFSPARMS *);
  1014. extern int find_transition(int *, const int, const int,
  1015. const int *, const int *, const int,
  1016. unsigned char *, const int, const int);
  1017. extern int validate_ridge_crossing(const int, const int,
  1018. const int *, const int *, const int,
  1019. unsigned char *, const int, const int, const int);
  1020. /* shape.c */
  1021. extern int alloc_shape(SHAPE **, const int, const int, const int, const int);
  1022. extern void free_shape(SHAPE *);
  1023. extern void dump_shape(FILE *, const SHAPE *);
  1024. extern int shape_from_contour(SHAPE **, const int *, const int *, const int);
  1025. extern void sort_row_on_x(ROW *);
  1026. /* sort.c */
  1027. extern int sort_indices_int_inc(int **, int *, const int);
  1028. extern int sort_indices_double_inc(int **, double *, const int);
  1029. extern void bubble_sort_int_inc_2(int *, int *, const int);
  1030. extern void bubble_sort_double_inc_2(double *, int *, const int);
  1031. extern void bubble_sort_double_dec_2(double *, int *, const int);
  1032. extern void bubble_sort_int_inc(int *, const int);
  1033. /* to_type9.c */
  1034. /*
  1035. extern int minutiae2type_9(RECORD **, const int, MINUTIAE *, const int,
  1036. const int, const double);
  1037. extern int mintiae2field_12(FIELD **, MINUTIAE *, const int, const int,
  1038. const double);
  1039. */
  1040. /* update.c */
  1041. /*
  1042. extern int update_ANSI_NIST_lfs_results(ANSI_NIST *, MINUTIAE *,
  1043. unsigned char *, const int, const int,
  1044. const int, const double, const int, const int);
  1045. */
  1046. /* util.c */
  1047. extern int maxv(const int *, const int);
  1048. extern int minv(const int *, const int);
  1049. extern int minmaxs(int **, int **, int **, int *, int *,
  1050. const int *, const int);
  1051. extern double distance(const int, const int, const int, const int);
  1052. extern double squared_distance(const int, const int, const int, const int);
  1053. extern int in_int_list(const int, const int *, const int);
  1054. extern int remove_from_int_list(const int, int *, const int);
  1055. extern int find_incr_position_dbl(const double, double *, const int);
  1056. extern double angle2line(const int, const int, const int, const int);
  1057. extern int line2direction(const int, const int, const int, const int,
  1058. const int);
  1059. extern int closest_dir_dist(const int, const int, const int);
  1060. /* xytreps.c */
  1061. extern void lfs2nist_minutia_XYT(int *, int *, int *,
  1062. const MINUTIA *, const int, const int);
  1063. extern void lfs2m1_minutia_XYT(int *, int *, int *, const MINUTIA *);
  1064. extern void lfs2nist_format(MINUTIAE *, int, int);
  1065. /*************************************************************************/
  1066. /* EXTERNAL GLOBAL VARIABLE DEFINITIONS */
  1067. /*************************************************************************/
  1068. extern double dft_coefs[];
  1069. extern LFSPARMS lfsparms;
  1070. extern LFSPARMS lfsparms_V2;
  1071. extern int nbr8_dx[];
  1072. extern int nbr8_dy[];
  1073. extern int chaincodes_nbr8[];
  1074. extern FEATURE_PATTERN feature_patterns[];
  1075. #endif