| Line | Branch | Exec | Source |
|---|---|---|---|
| 1 | /******************************************************************************* | ||
| 2 | |||
| 3 | License: | ||
| 4 | This software and/or related materials was developed at the National Institute | ||
| 5 | of Standards and Technology (NIST) by employees of the Federal Government | ||
| 6 | in the course of their official duties. Pursuant to title 17 Section 105 | ||
| 7 | of the United States Code, this software is not subject to copyright | ||
| 8 | protection and is in the public domain. | ||
| 9 | |||
| 10 | This software and/or related materials have been determined to be not subject | ||
| 11 | to the EAR (see Part 734.3 of the EAR for exact details) because it is | ||
| 12 | a publicly available technology and software, and is freely distributed | ||
| 13 | to any interested party with no licensing requirements. Therefore, it is | ||
| 14 | permissible to distribute this software as a free download from the internet. | ||
| 15 | |||
| 16 | Disclaimer: | ||
| 17 | This software and/or related materials was developed to promote biometric | ||
| 18 | standards and biometric technology testing for the Federal Government | ||
| 19 | in accordance with the USA PATRIOT Act and the Enhanced Border Security | ||
| 20 | and Visa Entry Reform Act. Specific hardware and software products identified | ||
| 21 | in this software were used in order to perform the software development. | ||
| 22 | In no case does such identification imply recommendation or endorsement | ||
| 23 | by the National Institute of Standards and Technology, nor does it imply that | ||
| 24 | the products and equipment identified are necessarily the best available | ||
| 25 | for the purpose. | ||
| 26 | |||
| 27 | This software and/or related materials are provided "AS-IS" without warranty | ||
| 28 | of any kind including NO WARRANTY OF PERFORMANCE, MERCHANTABILITY, | ||
| 29 | NO WARRANTY OF NON-INFRINGEMENT OF ANY 3RD PARTY INTELLECTUAL PROPERTY | ||
| 30 | or FITNESS FOR A PARTICULAR PURPOSE or for any purpose whatsoever, for the | ||
| 31 | licensed product, however used. In no event shall NIST be liable for any | ||
| 32 | damages and/or costs, including but not limited to incidental or consequential | ||
| 33 | damages of any kind, including economic damage or injury to property and lost | ||
| 34 | profits, regardless of whether NIST shall be advised, have reason to know, | ||
| 35 | or in fact shall know of the possibility. | ||
| 36 | |||
| 37 | By using this software, you agree to bear all risk relating to quality, | ||
| 38 | use and performance of the software and/or related materials. You agree | ||
| 39 | to hold the Government harmless from any claim arising from your use | ||
| 40 | of the software. | ||
| 41 | |||
| 42 | *******************************************************************************/ | ||
| 43 | |||
| 44 | |||
| 45 | /*********************************************************************** | ||
| 46 | LIBRARY: LFS - NIST Latent Fingerprint System | ||
| 47 | |||
| 48 | FILE: GETMIN.C | ||
| 49 | AUTHOR: Michael D. Garris | ||
| 50 | DATE: 09/10/2004 | ||
| 51 | UPDATED: 03/16/2005 by MDG | ||
| 52 | |||
| 53 | Takes an 8-bit grayscale fingerpinrt image and detects minutiae | ||
| 54 | as part of the NIST Latent Fingerprint System (LFS), returning | ||
| 55 | minutiae with final reliabilities and maps including a merged | ||
| 56 | quality map. | ||
| 57 | |||
| 58 | *********************************************************************** | ||
| 59 | ROUTINES: | ||
| 60 | get_minutiae() | ||
| 61 | |||
| 62 | ***********************************************************************/ | ||
| 63 | |||
| 64 | #include <stdio.h> | ||
| 65 | #include <lfs.h> | ||
| 66 | |||
| 67 | /************************************************************************* | ||
| 68 | ************************************************************************** | ||
| 69 | #cat: get_minutiae - Takes a grayscale fingerprint image, binarizes the input | ||
| 70 | #cat: image, and detects minutiae points using LFS Version 2. | ||
| 71 | #cat: The routine passes back the detected minutiae, the | ||
| 72 | #cat: binarized image, and a set of image quality maps. | ||
| 73 | |||
| 74 | Input: | ||
| 75 | idata - grayscale fingerprint image data | ||
| 76 | iw - width (in pixels) of the grayscale image | ||
| 77 | ih - height (in pixels) of the grayscale image | ||
| 78 | id - pixel depth (in bits) of the grayscale image | ||
| 79 | ppmm - the scan resolution (in pixels/mm) of the grayscale image | ||
| 80 | lfsparms - parameters and thresholds for controlling LFS | ||
| 81 | Output: | ||
| 82 | ominutiae - points to a structure containing the | ||
| 83 | detected minutiae | ||
| 84 | oquality_map - resulting integrated image quality map | ||
| 85 | odirection_map - resulting direction map | ||
| 86 | olow_contrast_map - resulting low contrast map | ||
| 87 | olow_flow_map - resulting low ridge flow map | ||
| 88 | ohigh_curve_map - resulting high curvature map | ||
| 89 | omap_w - width (in blocks) of image maps | ||
| 90 | omap_h - height (in blocks) of image maps | ||
| 91 | obdata - points to binarized image data | ||
| 92 | obw - width (in pixels) of binarized image | ||
| 93 | obh - height (in pixels) of binarized image | ||
| 94 | obd - pixel depth (in bits) of binarized image | ||
| 95 | Return Code: | ||
| 96 | Zero - successful completion | ||
| 97 | Negative - system error | ||
| 98 | **************************************************************************/ | ||
| 99 | 48 | int get_minutiae(MINUTIAE **ominutiae, int **oquality_map, | |
| 100 | int **odirection_map, int **olow_contrast_map, | ||
| 101 | int **olow_flow_map, int **ohigh_curve_map, | ||
| 102 | int *omap_w, int *omap_h, | ||
| 103 | unsigned char **obdata, int *obw, int *obh, int *obd, | ||
| 104 | unsigned char *idata, const int iw, const int ih, | ||
| 105 | const int id, const double ppmm, const LFSPARMS *lfsparms) | ||
| 106 | { | ||
| 107 | 48 | int ret; | |
| 108 | 48 | MINUTIAE *minutiae; | |
| 109 | 48 | int *direction_map, *low_contrast_map, *low_flow_map; | |
| 110 | 48 | int *high_curve_map, *quality_map; | |
| 111 | 48 | int map_w, map_h; | |
| 112 | 48 | unsigned char *bdata; | |
| 113 | 48 | int bw, bh; | |
| 114 | |||
| 115 | /* If input image is not 8-bit grayscale ... */ | ||
| 116 |
1/2✗ Branch 0 (2→3) not taken.
✓ Branch 1 (2→6) taken 48 times.
|
48 | if(id != 8){ |
| 117 | ✗ | fprintf(stderr, "ERROR : get_minutiae : input image pixel "); | |
| 118 | ✗ | fprintf(stderr, "depth = %d != 8.\n", id); | |
| 119 | ✗ | return(-2); | |
| 120 | } | ||
| 121 | |||
| 122 | /* Detect minutiae in grayscale fingerpeint image. */ | ||
| 123 |
1/2✓ Branch 0 (7→8) taken 48 times.
✗ Branch 1 (7→28) not taken.
|
48 | if((ret = lfs_detect_minutiae_V2(&minutiae, |
| 124 | &direction_map, &low_contrast_map, | ||
| 125 | &low_flow_map, &high_curve_map, | ||
| 126 | &map_w, &map_h, | ||
| 127 | &bdata, &bw, &bh, | ||
| 128 | idata, iw, ih, lfsparms))){ | ||
| 129 | return(ret); | ||
| 130 | } | ||
| 131 | |||
| 132 | /* Build integrated quality map. */ | ||
| 133 |
1/2✗ Branch 0 (9→10) not taken.
✓ Branch 1 (9→17) taken 48 times.
|
48 | if((ret = gen_quality_map(&quality_map, |
| 134 | direction_map, low_contrast_map, | ||
| 135 | low_flow_map, high_curve_map, map_w, map_h))){ | ||
| 136 | ✗ | free_minutiae(minutiae); | |
| 137 | ✗ | g_free(direction_map); | |
| 138 | ✗ | g_free(low_contrast_map); | |
| 139 | ✗ | g_free(low_flow_map); | |
| 140 | ✗ | g_free(high_curve_map); | |
| 141 | ✗ | g_free(bdata); | |
| 142 | ✗ | return(ret); | |
| 143 | } | ||
| 144 | |||
| 145 | /* Assign reliability from quality map. */ | ||
| 146 |
1/2✗ Branch 0 (18→19) not taken.
✓ Branch 1 (18→27) taken 48 times.
|
48 | if((ret = combined_minutia_quality(minutiae, quality_map, map_w, map_h, |
| 147 | lfsparms->blocksize, | ||
| 148 | idata, iw, ih, id, ppmm))){ | ||
| 149 | ✗ | free_minutiae(minutiae); | |
| 150 | ✗ | g_free(direction_map); | |
| 151 | ✗ | g_free(low_contrast_map); | |
| 152 | ✗ | g_free(low_flow_map); | |
| 153 | ✗ | g_free(high_curve_map); | |
| 154 | ✗ | g_free(quality_map); | |
| 155 | ✗ | g_free(bdata); | |
| 156 | ✗ | return(ret); | |
| 157 | } | ||
| 158 | |||
| 159 | /* Set output pointers. */ | ||
| 160 | 48 | *ominutiae = minutiae; | |
| 161 | 48 | *oquality_map = quality_map; | |
| 162 | 48 | *odirection_map = direction_map; | |
| 163 | 48 | *olow_contrast_map = low_contrast_map; | |
| 164 | 48 | *olow_flow_map = low_flow_map; | |
| 165 | 48 | *ohigh_curve_map = high_curve_map; | |
| 166 | 48 | *omap_w = map_w; | |
| 167 | 48 | *omap_h = map_h; | |
| 168 | 48 | *obdata = bdata; | |
| 169 | 48 | *obw = bw; | |
| 170 | 48 | *obh = bh; | |
| 171 | 48 | *obd = id; | |
| 172 | |||
| 173 | /* Return normally. */ | ||
| 174 | 48 | return(0); | |
| 175 | } | ||
| 176 |