GCC Code Coverage Report


Directory: ./
File: libfprint/nbis/mindtct/xytreps.c
Date: 2024-09-16 14:36:32
Exec Total Coverage
Lines: 13 13 100.0%
Functions: 1 1 100.0%
Branches: 3 4 75.0%

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: XYTREPS.C
49 AUTHOR: Michael D. Garris
50 DATE: 09/16/2004
51 UPDATED: 01/11/2012
52
53 Contains routines useful in converting minutiae in LFS "native"
54 representation into other representations, such as
55 M1 (ANSI INCITS 378-2004) & NIST internal representations.
56
57 ***********************************************************************
58 ROUTINES:
59 lfs2nist_minutia_XTY()
60 lfs2m1_minutia_XTY()
61 lfs2nist_format()
62
63 ***********************************************************************/
64
65 #include <lfs.h>
66 #include <defs.h>
67
68 /*************************************************************************
69 **************************************************************************
70 #cat: lfs2nist_minutia_XYT - Converts XYT minutiae attributes in LFS native
71 #cat: representation to NIST internal representation
72
73 Input:
74 minutia - LFS minutia structure containing attributes to be converted
75 Output:
76 ox - NIST internal based x-pixel coordinate
77 oy - NIST internal based y-pixel coordinate
78 ot - NIST internal based minutia direction/orientation
79 **************************************************************************/
80 2923 void lfs2nist_minutia_XYT(int *ox, int *oy, int *ot,
81 const MINUTIA *minutia, const int iw, const int ih)
82 {
83 2923 int x, y, t;
84 2923 float degrees_per_unit;
85
86 /* XYT's according to NIST internal rep: */
87 /* 1. pixel coordinates with origin bottom-left */
88 /* 2. orientation in degrees on range [0..360] */
89 /* with 0 pointing east and increasing counter */
90 /* clockwise (same as M1) */
91 /* 3. direction pointing out and away from the */
92 /* ridge ending or bifurcation valley */
93 /* (opposite direction from M1) */
94
95 2923 x = minutia->x;
96 2923 y = ih - minutia->y;
97
98 2923 degrees_per_unit = 180 / (float)NUM_DIRECTIONS;
99
100
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 2923 times.
2923 t = (270 - sround(minutia->direction * degrees_per_unit)) % 360;
101
2/2
✓ Branch 0 taken 678 times.
✓ Branch 1 taken 2245 times.
2923 if(t < 0){
102 678 t += 360;
103 }
104
105 2923 *ox = x;
106 2923 *oy = y;
107 2923 *ot = t;
108 2923 }
109
110 /*************************************************************************
111 **************************************************************************
112 #cat: lfs2m1_minutia_XYT - Converts XYT minutiae attributes in LFS native
113 #cat: representation to M1 (ANSI INCITS 378-2004) representation
114
115 Input:
116 minutia - LFS minutia structure containing attributes to be converted
117 Output:
118 ox - M1 based x-pixel coordinate
119 oy - M1 based y-pixel coordinate
120 ot - M1 based minutia direction/orientation
121 **************************************************************************/
122
123 /*************************************************************************
124 **************************************************************************
125 #cat: lfs2nist_format - Takes a minutiae data structure and converts
126 #cat: the XYT minutiae attributes in LFS native
127 #cat: representation to NIST internal representation
128 Input:
129 iminutiae - minutiae data structure
130 iw - width (in pixels) of the grayscale image
131 ih - height (in pixels) of the grayscale image
132 Output:
133 iminutiae - overwrite each minutia element in the minutiae data
134 sturcture convernt to nist internal minutiae format
135 **************************************************************************/
136
137