globals.c 9.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315
  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. /***********************************************************************
  38. LIBRARY: LFS - NIST Latent Fingerprint System
  39. FILE: GLOBALS.C
  40. AUTHOR: Michael D. Garris
  41. DATE: 03/16/1999
  42. UPDATED: 10/04/1999 Version 2 by MDG
  43. Contains general global variable definitions required by the
  44. NIST Latent Fingerprint System (LFS).
  45. ***********************************************************************/
  46. #include "lfs.h"
  47. /*************************************************************************/
  48. /* GOBAL DECLARATIONS */
  49. /*************************************************************************/
  50. #ifdef LOG_REPORT
  51. FILE *logfp;
  52. #endif
  53. /* Constants (C) for defining 4 DFT frequencies, where */
  54. /* frequency is defined as C*(PI_FACTOR). PI_FACTOR */
  55. /* regulates the period of the function in x, so: */
  56. /* 1 = one period in range X. */
  57. /* 2 = twice the frequency in range X. */
  58. /* 3 = three times the frequency in reange X. */
  59. /* 4 = four times the frequency in ranage X. */
  60. double dft_coefs[NUM_DFT_WAVES] = { 1,2,3,4 };
  61. /* Allocate and initialize a global LFS parameters structure. */
  62. LFSPARMS lfsparms = {
  63. /* Image Controls */
  64. PAD_VALUE,
  65. JOIN_LINE_RADIUS,
  66. /* Map Controls */
  67. IMAP_BLOCKSIZE,
  68. UNUSED_INT, /* windowsize */
  69. UNUSED_INT, /* windowoffset */
  70. NUM_DIRECTIONS,
  71. START_DIR_ANGLE,
  72. RMV_VALID_NBR_MIN,
  73. DIR_STRENGTH_MIN,
  74. DIR_DISTANCE_MAX,
  75. SMTH_VALID_NBR_MIN,
  76. VORT_VALID_NBR_MIN,
  77. HIGHCURV_VORTICITY_MIN,
  78. HIGHCURV_CURVATURE_MIN,
  79. UNUSED_INT, /* min_interpolate_nbrs */
  80. UNUSED_INT, /* percentile_min_max */
  81. UNUSED_INT, /* min_contrast_delta */
  82. /* DFT Controls */
  83. NUM_DFT_WAVES,
  84. POWMAX_MIN,
  85. POWNORM_MIN,
  86. POWMAX_MAX,
  87. FORK_INTERVAL,
  88. FORK_PCT_POWMAX,
  89. FORK_PCT_POWNORM,
  90. /* Binarization Controls */
  91. DIRBIN_GRID_W,
  92. DIRBIN_GRID_H,
  93. ISOBIN_GRID_DIM,
  94. NUM_FILL_HOLES,
  95. /* Minutiae Detection Controls */
  96. MAX_MINUTIA_DELTA,
  97. MAX_HIGH_CURVE_THETA,
  98. HIGH_CURVE_HALF_CONTOUR,
  99. MIN_LOOP_LEN,
  100. MIN_LOOP_ASPECT_DIST,
  101. MIN_LOOP_ASPECT_RATIO,
  102. /* Minutiae Link Controls */
  103. LINK_TABLE_DIM,
  104. MAX_LINK_DIST,
  105. MIN_THETA_DIST,
  106. MAXTRANS,
  107. SCORE_THETA_NORM,
  108. SCORE_DIST_NORM,
  109. SCORE_DIST_WEIGHT,
  110. SCORE_NUMERATOR,
  111. /* False Minutiae Removal Controls */
  112. MAX_RMTEST_DIST,
  113. MAX_HOOK_LEN,
  114. MAX_HALF_LOOP,
  115. TRANS_DIR_PIX,
  116. SMALL_LOOP_LEN,
  117. SIDE_HALF_CONTOUR,
  118. INV_BLOCK_MARGIN,
  119. RM_VALID_NBR_MIN,
  120. UNUSED_INT, /* max_overlap_dist */
  121. UNUSED_INT, /* max_overlap_join_dist */
  122. UNUSED_INT, /* malformation_steps_1 */
  123. UNUSED_INT, /* malformation_steps_2 */
  124. UNUSED_DBL, /* min_malformation_ratio */
  125. UNUSED_INT, /* max_malformation_dist */
  126. PORES_TRANS_R,
  127. PORES_PERP_STEPS,
  128. PORES_STEPS_FWD,
  129. PORES_STEPS_BWD,
  130. PORES_MIN_DIST2,
  131. PORES_MAX_RATIO,
  132. /* Ridge Counting Controls */
  133. MAX_NBRS,
  134. MAX_RIDGE_STEPS
  135. };
  136. /* Allocate and initialize VERSION 2 global LFS parameters structure. */
  137. LFSPARMS lfsparms_V2 = {
  138. /* Image Controls */
  139. PAD_VALUE,
  140. JOIN_LINE_RADIUS,
  141. /* Map Controls */
  142. MAP_BLOCKSIZE_V2,
  143. MAP_WINDOWSIZE_V2,
  144. MAP_WINDOWOFFSET_V2,
  145. NUM_DIRECTIONS,
  146. START_DIR_ANGLE,
  147. RMV_VALID_NBR_MIN,
  148. DIR_STRENGTH_MIN,
  149. DIR_DISTANCE_MAX,
  150. SMTH_VALID_NBR_MIN,
  151. VORT_VALID_NBR_MIN,
  152. HIGHCURV_VORTICITY_MIN,
  153. HIGHCURV_CURVATURE_MIN,
  154. MIN_INTERPOLATE_NBRS,
  155. PERCENTILE_MIN_MAX,
  156. MIN_CONTRAST_DELTA,
  157. /* DFT Controls */
  158. NUM_DFT_WAVES,
  159. POWMAX_MIN,
  160. POWNORM_MIN,
  161. POWMAX_MAX,
  162. FORK_INTERVAL,
  163. FORK_PCT_POWMAX,
  164. FORK_PCT_POWNORM,
  165. /* Binarization Controls */
  166. DIRBIN_GRID_W,
  167. DIRBIN_GRID_H,
  168. UNUSED_INT, /* isobin_grid_dim */
  169. NUM_FILL_HOLES,
  170. /* Minutiae Detection Controls */
  171. MAX_MINUTIA_DELTA,
  172. MAX_HIGH_CURVE_THETA,
  173. HIGH_CURVE_HALF_CONTOUR,
  174. MIN_LOOP_LEN,
  175. MIN_LOOP_ASPECT_DIST,
  176. MIN_LOOP_ASPECT_RATIO,
  177. /* Minutiae Link Controls */
  178. UNUSED_INT, /* link_table_dim */
  179. UNUSED_INT, /* max_link_dist */
  180. UNUSED_INT, /* min_theta_dist */
  181. MAXTRANS, /* used for removing overlaps as well */
  182. UNUSED_DBL, /* score_theta_norm */
  183. UNUSED_DBL, /* score_dist_norm */
  184. UNUSED_DBL, /* score_dist_weight */
  185. UNUSED_DBL, /* score_numerator */
  186. /* False Minutiae Removal Controls */
  187. MAX_RMTEST_DIST_V2,
  188. MAX_HOOK_LEN_V2,
  189. MAX_HALF_LOOP_V2,
  190. TRANS_DIR_PIX_V2,
  191. SMALL_LOOP_LEN,
  192. SIDE_HALF_CONTOUR,
  193. INV_BLOCK_MARGIN_V2,
  194. RM_VALID_NBR_MIN,
  195. MAX_OVERLAP_DIST,
  196. MAX_OVERLAP_JOIN_DIST,
  197. MALFORMATION_STEPS_1,
  198. MALFORMATION_STEPS_2,
  199. MIN_MALFORMATION_RATIO,
  200. MAX_MALFORMATION_DIST,
  201. PORES_TRANS_R,
  202. PORES_PERP_STEPS,
  203. PORES_STEPS_FWD,
  204. PORES_STEPS_BWD,
  205. PORES_MIN_DIST2,
  206. PORES_MAX_RATIO,
  207. /* Ridge Counting Controls */
  208. MAX_NBRS,
  209. MAX_RIDGE_STEPS
  210. };
  211. /* Variables for conducting 8-connected neighbor analyses. */
  212. /* Pixel neighbor offsets: 0 1 2 3 4 5 6 7 */ /* 7 0 1 */
  213. int nbr8_dx[] = { 0, 1, 1, 1, 0,-1,-1,-1 }; /* 6 C 2 */
  214. int nbr8_dy[] = { -1,-1, 0, 1, 1, 1, 0,-1 }; /* 5 4 3 */
  215. /* The chain code lookup matrix for 8-connected neighbors. */
  216. /* Should put this in globals. */
  217. int chaincodes_nbr8[]={ 3, 2, 1,
  218. 4,-1, 0,
  219. 5, 6, 7};
  220. /* Global array of feature pixel pairs. */
  221. FEATURE_PATTERN feature_patterns[]=
  222. {{RIDGE_ENDING, /* a. Ridge Ending (appearing) */
  223. APPEARING,
  224. {0,0},
  225. {0,1},
  226. {0,0}},
  227. {RIDGE_ENDING, /* b. Ridge Ending (disappearing) */
  228. DISAPPEARING,
  229. {0,0},
  230. {1,0},
  231. {0,0}},
  232. {BIFURCATION, /* c. Bifurcation (disappearing) */
  233. DISAPPEARING,
  234. {1,1},
  235. {0,1},
  236. {1,1}},
  237. {BIFURCATION, /* d. Bifurcation (appearing) */
  238. APPEARING,
  239. {1,1},
  240. {1,0},
  241. {1,1}},
  242. {BIFURCATION, /* e. Bifurcation (disappearing) */
  243. DISAPPEARING,
  244. {1,0},
  245. {0,1},
  246. {1,1}},
  247. {BIFURCATION, /* f. Bifurcation (disappearing) */
  248. DISAPPEARING,
  249. {1,1},
  250. {0,1},
  251. {1,0}},
  252. {BIFURCATION, /* g. Bifurcation (appearing) */
  253. APPEARING,
  254. {1,1},
  255. {1,0},
  256. {0,1}},
  257. {BIFURCATION, /* h. Bifurcation (appearing) */
  258. APPEARING,
  259. {0,1},
  260. {1,0},
  261. {1,1}},
  262. {BIFURCATION, /* i. Bifurcation (disappearing) */
  263. DISAPPEARING,
  264. {1,0},
  265. {0,1},
  266. {1,0}},
  267. {BIFURCATION, /* j. Bifurcation (appearing) */
  268. APPEARING,
  269. {0,1},
  270. {1,0},
  271. {0,1}}};