results.c 6.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157
  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: RESULTS.C
  40. AUTHOR: Michael D. Garris
  41. DATE: 03/16/1999
  42. UPDATED: 10/04/1999 Version 2 by MDG
  43. 09/14/2004
  44. UPDATED: 03/16/2005 by MDG
  45. Contains routines useful in visualizing intermediate and final
  46. results when exercising the NIST Latent Fingerprint System (LFS).
  47. ***********************************************************************
  48. ROUTINES:
  49. write_minutiae_XYTQ()
  50. ***********************************************************************/
  51. #include <stdio.h>
  52. #include "lfs.h"
  53. /*************************************************************************
  54. **************************************************************************
  55. #cat: write_minutiae_XYTQ - Write just minutiae XYT's & Qualities to text
  56. #cat: file according to the specified mintuiae represenation
  57. Input:
  58. ofile - output file name
  59. reptype - specifies XYT output representation
  60. minutiae - structure containing a list of LFS detected minutiae
  61. iw - width (in pixels) of the input image
  62. ih - height (in pixels) of the input image
  63. Return Code:
  64. Zero - successful completion
  65. Negative - system error
  66. **************************************************************************/
  67. int write_minutiae_XYTQ(char *ofile, const int reptype, const MINUTIAE *minutiae, const int iw, const int ih){
  68. FILE *fp;
  69. int i, ox, oy, ot, oq;
  70. MINUTIA *minutia;
  71. /* A. If M1 flag set: */
  72. /* XYTQ's written according to M1 (ANSI INCITS */
  73. /* 378-2004) representation: */
  74. /* 1. pixel coordinates with origin top-left */
  75. /* 2. orientation in degrees on range [0..360] */
  76. /* with 0 pointing east and increasing counter */
  77. /* clockwise */
  78. /* 3. direction pointing up the ridge ending or */
  79. /* bifurcaiton valley */
  80. /* 4. minutiae qualities on integer range [0..100] */
  81. /* (non-standard) */
  82. /* */
  83. /* B. If M1 flag NOT set: */
  84. /* XYTQ's written according to NIST internal rep. */
  85. /* 1. pixel coordinates with origin bottom-left */
  86. /* 2. orientation in degrees on range [0..360] */
  87. /* with 0 pointing east and increasing counter */
  88. /* clockwise (same as M1) */
  89. /* 3. direction pointing out and away from the */
  90. /* ridge ending or bifurcation valley */
  91. /* (opposite direction from M1) */
  92. /* 4. minutiae qualities on integer range [0..100] */
  93. /* (non-standard) */
  94. if((fp = fopen(ofile, "wb")) == (FILE *)NULL){
  95. fprintf(stderr, "ERROR : write_minutiae_XYTQ : fopen : %s\n", ofile);
  96. return(-2);
  97. }
  98. for(i = 0; i < minutiae->num; i++){
  99. minutia = minutiae->list[i];
  100. switch(reptype){
  101. case M1_XYT_REP:
  102. lfs2m1_minutia_XYT(&ox, &oy, &ot, minutia);
  103. break;
  104. case NIST_INTERNAL_XYT_REP:
  105. lfs2nist_minutia_XYT(&ox, &oy, &ot, minutia, iw, ih);
  106. break;
  107. default:
  108. fprintf(stderr, "ERROR : write_minutiae_XYTQ : ");
  109. fprintf(stderr, "Invalid XYT representation type = %d\n", reptype);
  110. fclose(fp);
  111. return(-4);
  112. }
  113. oq = sround(minutia->reliability * 100.0);
  114. fprintf(fp, "%d %d %d %d\n", ox, oy, ot, oq);
  115. }
  116. if(fclose(fp)){
  117. fprintf(stderr, "ERROR : write_minutiae_XYTQ : fopen : %s\n", ofile);
  118. return(-5);
  119. }
  120. return(0);
  121. }