nbis-python 0.1.4__py3-none-macosx_11_0_arm64.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,224 @@
1
+ Metadata-Version: 2.4
2
+ Name: nbis-python
3
+ Version: 0.1.4
4
+ Classifier: Development Status :: 3 - Alpha
5
+ Classifier: Intended Audience :: Developers
6
+ Classifier: Intended Audience :: Science/Research
7
+ Classifier: License :: OSI Approved :: MIT License
8
+ Classifier: Programming Language :: Python :: 3
9
+ Classifier: Programming Language :: Python :: 3.10
10
+ Classifier: Programming Language :: Python :: 3.11
11
+ Classifier: Programming Language :: Python :: 3.12
12
+ Classifier: Programming Language :: Rust
13
+ Classifier: Topic :: Scientific/Engineering :: Bio-Informatics
14
+ License-File: LICENSE
15
+ Summary: Python bindings for NBIS fingerprint processing using Rust + UniFFI
16
+ Keywords: fingerprint,nbis,biometrics,rust,uniffi
17
+ Home-Page: https://github.com/Seventh-Sense-Artificial-Intelligence/nbis-rs
18
+ Author-email: Varun Chatterji <varun@seventhsense.ai>
19
+ License: MIT
20
+ Requires-Python: >=3.10
21
+ Description-Content-Type: text/markdown; charset=UTF-8; variant=GFM
22
+ Project-URL: Bug Tracker, https://github.com/Seventh-Sense-Artificial-Intelligence/nbis-rs/issues
23
+ Project-URL: Documentation, https://github.com/Seventh-Sense-Artificial-Intelligence/nbis-rs
24
+ Project-URL: Homepage, https://github.com/Seventh-Sense-Artificial-Intelligence/nbis-rs
25
+ Project-URL: Repository, https://github.com/Seventh-Sense-Artificial-Intelligence/nbis-rs
26
+
27
+ ## NBIS-rs
28
+
29
+ This is a Rust/Python binding to the [NIST Biometric Image Software](https://www.nist.gov/services-resources/software/nist-biometric-image-software-nbis) (NBIS) library, which is used for processing biometric images, particularly in the context of fingerprint recognition.
30
+
31
+ For convenience, this library also binds to the [NIST Fingerprint Image Quality](https://www.nist.gov/services-resources/software/nfiq-2) (NFIQ) version 2.
32
+
33
+ ## Features
34
+
35
+ - Bindings to NBIS functions for minutia extraction, matching
36
+ - Exports minutiae templates in ISO/IEC 19794-2:2005 format
37
+ - Matches minutiae templates against each other using the NBIS Bozorth3 algorithm
38
+ - Provides support for NFIQ2 quality assessment
39
+
40
+ ## Building from source
41
+
42
+ Native dependencies (OpenCV 4, CMake, C++ toolchain) are required. See [DEPENDENCIES.md](DEPENDENCIES.md).
43
+
44
+ ```bash
45
+ # macOS
46
+ ./scripts/install-deps-macos.sh
47
+
48
+ # Linux (Debian/Ubuntu)
49
+ ./scripts/install-deps-linux.sh
50
+
51
+ cargo build --release
52
+ cargo test
53
+ make python # optional Python wheel
54
+ ```
55
+
56
+ ## Installation (Rust)
57
+
58
+ To use NBIS-rs, add the following to your `Cargo.toml`:
59
+
60
+ ```toml
61
+ [dependencies]
62
+ nbis-rs = { git = "https://github.com/Seventh-Sense-Artificial-Intelligence/nbis-rs", branch = "main", version = "0.1.3" }
63
+ ```
64
+ Or you can run the following command on the terminal of your new rust project:
65
+
66
+ cargo add nbis-rs --git https://github.com/Seventh-Sense-Artificial-Intelligence/nbis-rs --branch main
67
+
68
+ Running the above command will add the above dependency in your Cargo.toml
69
+
70
+ Now you can use the nbis-rs rust library in your project as mentioned in next section.
71
+
72
+ ## Usage (Rust)
73
+
74
+ Here's a simple example of how to use NBIS-rs in your project:
75
+
76
+ ```rust
77
+ fn main() -> Result<(), Box<dyn std::error::Error>> {
78
+ use nbis;
79
+ use nbis::Minutiae;
80
+ use nbis::NbisExtractorSettings;
81
+ // Configuration for the NbisExtractor
82
+ let settings = NbisExtractorSettings {
83
+ // No filtering on minutiae quality (all minutiae will be included)
84
+ min_quality: 0.0,
85
+ // Do not compute ROI or center to save computing resources
86
+ get_center: false,
87
+ // Do not check if the image is a fingerprint using SIVV
88
+ check_fingerprint: false,
89
+ // compute the NFIQ score
90
+ compute_nfiq2: true,
91
+ // No specific PPI, use the default
92
+ ppi: None,
93
+ };
94
+
95
+ let extractor = nbis::NbisExtractor::new(settings)?;
96
+
97
+ // Read the bytes from a file (you could also use nbis::extract_minutiae_from_image_file)
98
+ // but here we just load the image bytes as image paths on mobile platforms can be tricky.
99
+ let image_bytes = std::fs::read("test_data/p1/p1_1.png")?;
100
+
101
+ let minutiae_1 = extractor.extract_minutiae(&image_bytes)?;
102
+
103
+ let image_bytes = std::fs::read("test_data/p1/p1_2.png")?;
104
+ let minutiae_2 = extractor.extract_minutiae(&image_bytes)?;
105
+
106
+ let image_bytes = std::fs::read("test_data/p1/p1_3.png")?;
107
+ let minutiae_3 = extractor.extract_minutiae(&image_bytes)?;
108
+
109
+ // Compare the two sets of minutiae
110
+ let score = minutiae_1.compare(&minutiae_2);
111
+ assert!(score > 35, "Expected a high similarity score between p1_1 and p1_2");
112
+ let score = minutiae_1.compare(&minutiae_3);
113
+ assert!(score > 35, "Expected a high similarity score between p1_1 and p1_3");
114
+ let score = minutiae_2.compare(&minutiae_3);
115
+ assert!(score > 35, "Expected a high similarity score between p1_2 and p1_3");
116
+
117
+ // Next we will demonstrate conversion to ISO/IEC 19794-2:2005 format
118
+ // and back to a `Minutiae` object.
119
+ // First, convert the minutiae to ISO template bytes
120
+ let iso_template: Vec<u8> = minutiae_1.to_iso_19794_2_2005();
121
+ // And load it back
122
+ let minutiae_from_iso = extractor.load_iso_19794_2_2005(&iso_template)?;
123
+ // Compare the original minutiae with the one loaded from ISO template
124
+ for (a, b) in minutiae_from_iso.get().iter().zip(minutiae_1.get().iter()) {
125
+ assert_eq!(a.x(), b.x());
126
+ assert_eq!(a.y(), b.y());
127
+ assert_eq!(a.angle(), b.angle());
128
+ assert_eq!(a.kind(), b.kind());
129
+ // Reliability is quantized in the round-trip conversion,
130
+ // so we allow a small margin of error.
131
+ assert!((a.reliability() - b.reliability()).abs() < 1e-1);
132
+ }
133
+
134
+ // Finally we demonstrate loading from a file and comparing a negative match
135
+ let minutiae_4 = extractor.extract_minutiae_from_image_file("test_data/p2/p2_1.png")?;
136
+ let score = minutiae_1.compare(&minutiae_4);
137
+ assert!(score < 35, "Expected a low similarity score between p1_1 and p2_1");
138
+
139
+ // We can access the NFIQ2 quality via:
140
+ let nfiq2_quality = minutiae_1.quality();
141
+ assert!(nfiq2_quality.score > 50, "Expected a positive NFIQ2 quality score");
142
+
143
+ Ok(())
144
+ }
145
+ ```
146
+
147
+ ## Installation (Python)
148
+ To install the Python bindings, you can use pip:
149
+
150
+ ```bash
151
+ pip install nbis-py
152
+ ```
153
+
154
+ ## Usage (Python)
155
+
156
+ Here's a simple example of how to use the NBIS Python bindings:
157
+
158
+ ```python
159
+ import nbis
160
+ from nbis import NbisExtractor, NbisExtractorSettings
161
+
162
+ #Configuration for the NbisExtractor
163
+ settings = NbisExtractorSettings(
164
+ # Do not filter on minutiae quality (get all minutiae)
165
+ min_quality=0.0,
166
+ # Do not get the fingerprint center or ROI
167
+ get_center=False,
168
+ # Do not use SIVV to check if the image is a fingerprint
169
+ check_fingerprint=False,
170
+ # Compute the NFIQ2 quality score
171
+ compute_nfiq2=True,
172
+ # No specific PPI, use the default
173
+ ppi=None,
174
+ )
175
+
176
+ extractor = nbis.new_nbis_extractor(settings)
177
+
178
+ # Read the bytes from a file
179
+ image_bytes = open("test_data/p1/p1_1.png", "rb").read()
180
+ minutiae_1 = extractor.extract_minutiae(image_bytes)
181
+ image_bytes = open("test_data/p1/p1_2.png", "rb").read()
182
+ minutiae_2 = extractor.extract_minutiae(image_bytes)
183
+ image_bytes = open("test_data/p1/p1_3.png", "rb").read()
184
+ minutiae_3 = extractor.extract_minutiae(image_bytes)
185
+
186
+ # Compare the two sets of minutiae
187
+ score = minutiae_1.compare(minutiae_2)
188
+ assert score > 50, "Expected a high similarity score between p1_1 and p1_2"
189
+ score = minutiae_1.compare(minutiae_3)
190
+ assert score > 50, "Expected a high similarity score between p1_1 and p1_3"
191
+ score = minutiae_2.compare(minutiae_3)
192
+ assert score > 50, "Expected a high similarity score between p1_2 and p1_3"
193
+
194
+ # Convert minutiae to ISO/IEC 19794-2:2005 format
195
+ iso_template = minutiae_1.to_iso_19794_2_2005()
196
+ # Load it back
197
+ minutiae_from_iso = extractor.load_iso_19794_2_2005(iso_template)
198
+ # Compare the original minutiae with the one loaded from ISO template
199
+ for a, b in zip(minutiae_from_iso.get(), minutiae_1.get()):
200
+ assert a.x() == b.x()
201
+ assert a.y() == b.y()
202
+ assert a.angle() == b.angle()
203
+ assert a.kind() == b.kind()
204
+ # Reliability is quantized in the round-trip conversion,
205
+ # so we allow a small margin of error.
206
+ assert abs(a.reliability() - b.reliability()) < 0.1
207
+
208
+ # Finally we demonstrate loading from a file and comparing a negative match
209
+ minutiae_4 = extractor.extract_minutiae_from_image_file("test_data/p2/p2_1.png")
210
+ score = minutiae_1.compare(minutiae_4)
211
+ assert score < 50, "Expected a low similarity score between p1_1 and p2_1"
212
+
213
+ # We can access the NFIQ2 quality via:
214
+ nfiq2_quality = minutiae_1.quality()
215
+ assert nfiq2_quality.score > 50, "Expected a positive NFIQ2 quality score"
216
+ ```
217
+
218
+ ## Contributing
219
+
220
+ Contributions are welcome! Please open an issue or submit a pull request on GitHub.
221
+
222
+ ## License
223
+
224
+ This project is licensed under the MIT License - see the [LICENSE](LICENSE) file for details.
@@ -0,0 +1,10 @@
1
+ LICENSE,sha256=CRsdJdTqEyjgqdDVfl9aVJJDpMEl5LL2i0P8WruwZ_w,3395
2
+ nbis/__init__.py,sha256=T-bUbFt5I9vMycw6iWawrVKs6OaBdweC6v1RxjJKFcQ,651
3
+ nbis/nbis/__init__.py,sha256=JYcnMfeSWIRKp5e0rL5m2zy1gX6nOt-PaGn6a20FNVc,28
4
+ nbis/nbis/libnbis.dylib,sha256=UBCAa-hWLCgebrfpqajN5-H6zXhO5dVIkmwpaq88ta0,31052272
5
+ nbis/nbis/nbis.py,sha256=uFGt6O8-y-rm2qUehYpZOG1IEwV0CAllEDw_3lkR2HQ,82678
6
+ nbis_python-0.1.4.dist-info/METADATA,sha256=lx8njy3Y0a7QAayQIJhvqLr-krfB2vUD5QXTVz0T748,8760
7
+ nbis_python-0.1.4.dist-info/WHEEL,sha256=YxvB58IsRcvNDyvwuq2OMRTV0NDSKB8_Ti8Wdfvarzg,102
8
+ nbis_python-0.1.4.dist-info/licenses/LICENSE,sha256=CRsdJdTqEyjgqdDVfl9aVJJDpMEl5LL2i0P8WruwZ_w,3395
9
+ nbis_python-0.1.4.dist-info/sboms/nbis-rs.cyclonedx.json,sha256=-RVmRo0Twh4G4NP6KbFNtweNLXfko8q_5j0n3n6FJOk,243598
10
+ nbis_python-0.1.4.dist-info/RECORD,,
@@ -0,0 +1,4 @@
1
+ Wheel-Version: 1.0
2
+ Generator: maturin (1.13.3)
3
+ Root-Is-Purelib: false
4
+ Tag: py3-none-macosx_11_0_arm64
@@ -0,0 +1,63 @@
1
+ MIT License (Seventh Sense AI library)
2
+
3
+ Copyright (c) 2025 Seventh Sense Artificial Intelligence Private Limited
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
22
+
23
+ ----
24
+
25
+ NIST NBIS License for Algorithms (Public Domain)
26
+
27
+ This software and/or related materials was developed at the National Institute
28
+ of Standards and Technology (NIST) by employees of the Federal Government
29
+ in the course of their official duties. Pursuant to title 17 Section 105
30
+ of the United States Code, this software is not subject to copyright
31
+ protection and is in the public domain.
32
+
33
+ This software and/or related materials have been determined to be not subject
34
+ to the EAR (see Part 734.3 of the EAR for exact details) because it is
35
+ a publicly available technology and software, and is freely distributed
36
+ to any interested party with no licensing requirements. Therefore, it is
37
+ permissible to distribute this software as a free download from the internet.
38
+
39
+ Disclaimer:
40
+ This software and/or related materials was developed to promote biometric
41
+ standards and biometric technology testing for the Federal Government
42
+ in accordance with the USA PATRIOT Act and the Enhanced Border Security
43
+ and Visa Entry Reform Act. Specific hardware and software products identified
44
+ in this software were used in order to perform the software development.
45
+ In no case does such identification imply recommendation or endorsement
46
+ by the National Institute of Standards and Technology, nor does it imply that
47
+ the products and equipment identified are necessarily the best available
48
+ for the purpose.
49
+
50
+ This software and/or related materials are provided "AS-IS" without warranty
51
+ of any kind including NO WARRANTY OF PERFORMANCE, MERCHANTABILITY,
52
+ NO WARRANTY OF NON-INFRINGEMENT OF ANY 3RD PARTY INTELLECTUAL PROPERTY
53
+ or FITNESS FOR A PARTICULAR PURPOSE or for any purpose whatsoever, for the
54
+ licensed product, however used. In no event shall NIST be liable for any
55
+ damages and/or costs, including but not limited to incidental or consequential
56
+ damages of any kind, including economic damage or injury to property and lost
57
+ profits, regardless of whether NIST shall be advised, have reason to know,
58
+ or in fact shall know of the possibility.
59
+
60
+ By using this software, you agree to bear all risk relating to quality,
61
+ use and performance of the software and/or related materials. You agree
62
+ to hold the Government harmless from any claim arising from your use
63
+ of the software.