bz_drvrs.c 6.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139
  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: FING - NIST Fingerprint Systems Utilities
  39. FILE: BZ_DRVRS.C
  40. ALGORITHM: Allan S. Bozorth (FBI)
  41. MODIFICATIONS: Michael D. Garris (NIST)
  42. Stan Janet (NIST)
  43. DATE: 09/21/2004
  44. Contains driver routines responsible for kicking off matches
  45. using the Bozorth3 fingerprint matching algorithm.
  46. ***********************************************************************
  47. ROUTINES:
  48. #cat: bozorth_probe_init - creates the pairwise minutia comparison
  49. #cat: table for the probe fingerprint
  50. #cat: bozorth_gallery_init - creates the pairwise minutia comparison
  51. #cat: table for the gallery fingerprint
  52. #cat: bozorth_to_gallery - supports the matching scenario where the
  53. #cat: same probe fingerprint is matches repeatedly
  54. #cat: to multiple gallery fingerprints as in
  55. #cat: identification mode
  56. #cat: bozorth_main - supports the matching scenario where a
  57. #cat: single probe fingerprint is to be matched
  58. #cat: to a single gallery fingerprint as in
  59. #cat: verificaiton mode
  60. ***********************************************************************/
  61. #include <stdio.h>
  62. #include <stdlib.h>
  63. #include <string.h>
  64. #include "bozorth.h"
  65. /**************************************************************************/
  66. int bozorth_probe_init( struct xyt_struct * pstruct ){
  67. int sim; /* number of pointwise comparisons for Subject's record*/
  68. int msim; /* Pruned length of Subject's comparison pointer list */
  69. /* Take Subject's points and compute pointwise comparison statistics table and sorted row-pointer list. */
  70. /* This builds a "Web" of relative edge statistics between points. */
  71. bz_comp( pstruct->nrows, pstruct->xcol, pstruct->ycol, pstruct->thetacol, &sim, scols, scolpt );
  72. msim = sim; /* Init search to end of Subject's pointwise comparison table (last edge in Web) */
  73. bz_find( &msim, scolpt );
  74. /* Makes sure there are a reasonable number of edges (at least 500, if possible) to analyze in the Web */
  75. if ( msim < FDD ) msim = ( sim > FDD ) ? FDD : sim;
  76. return msim;
  77. }
  78. /**************************************************************************/
  79. int bozorth_gallery_init( struct xyt_struct * gstruct ){
  80. int fim; /* number of pointwise comparisons for On-File record*/
  81. int mfim; /* Pruned length of On-File Record's pointer list */
  82. /* Take On-File Record's points and compute pointwise comparison statistics table and sorted row-pointer list. */
  83. /* This builds a "Web" of relative edge statistics between points. */
  84. bz_comp( gstruct->nrows, gstruct->xcol, gstruct->ycol, gstruct->thetacol, &fim, fcols, fcolpt );
  85. mfim = fim; /* Init search to end of On-File Record's pointwise comparison table (last edge in Web) */
  86. bz_find( &mfim, fcolpt );
  87. /* Makes sure there are a reasonable number of edges (at least 500, if possible) to analyze in the Web */
  88. if ( mfim < FDD ) mfim = ( fim > FDD ) ? FDD : fim;
  89. return mfim;
  90. }
  91. /**************************************************************************/
  92. int bozorth_to_gallery( int probe_len, struct xyt_struct * pstruct, struct xyt_struct * gstruct ){
  93. int np;
  94. int gallery_len;
  95. gallery_len = bozorth_gallery_init( gstruct );
  96. np = bz_match( probe_len, gallery_len );
  97. return bz_match_score( np, pstruct, gstruct );
  98. }
  99. /**************************************************************************/
  100. int bozorth_main( struct xyt_struct * pstruct, struct xyt_struct * gstruct ) {
  101. int ms;
  102. int np;
  103. int probe_len;
  104. int gallery_len;
  105. probe_len = bozorth_probe_init( pstruct );
  106. gallery_len = bozorth_gallery_init( gstruct );
  107. np = bz_match( probe_len, gallery_len );
  108. ms = bz_match_score( np, pstruct, gstruct );
  109. return ms;
  110. }