NBioBSP for Python
Beta module for integrating NBioBSP SDK with Python
This is a Python module for NBioBSP SDK. Built with C/C++ and pybind11. Works only on Windows at the moment.
All code is self contained into a single file, as it is just bindings.
- Documento em Português
Requirements
- Python 3.10 or higher
- eNBSP SDK greater or equal to 5.2
- MSVC 2019 or higher (maybe it works with another compiler, didn't test it yet)
- Cmake 20 or higher
To Do:
- Readable error output using NBioAPI types (priority)
- Handle errors properly
- Throw translatable and proper exceptions from C++ to Python
- Handle return values properly (priority)
- Handle fingerprint purposes on capture properly
- Implement IndexSearch methods
- Implement all functions that are possible in Windows
- Implement all functions that are possible in Linux (no priority)
You can test the module with the following code on the Python interpreter:
import nbsp_python as nbsp
# Initialize the NBioBSP instance
nbsp.initialize_handle()
# Get the version of the NBioBSP SDK
nbsp.get_version()
# Enumerate the devices connected to the computer
nbsp.enumerate_device()
# Open the device using auto-detection
nbsp.open_device()
# Capture a fingerprint and assign it to handle
handle = nbsp.capture("enroll", 10000)
# Verify fingerprints contained in handle
nbsp.verify(handle)
# Extract the hash from the last fingerprint added in the handle
fingerprint_hash = nbsp.extract_fir_text(handle)
# Initialize the index search
nbsp.init_index_search()
# Add the fingerprint to the index search and pass
nbsp.add_fir_to_index_search(fingerprint_hash, 1)
# Identify the fingerprint in the index search
nbsp.identify_data_from_index_search(fingerprint_hash)
# Terminate the index search
nbsp.terminate_index_search()
# Terminate the NBioBSP instance
nbsp.terminate_handle()
# Close the device
nbsp.close_device()
Or by executing a TKinter Example with Python.
Installation
git clone https://github.com/Andoreatta/nbsp-python.git
cd nbsp-python
pip install .
Pulls all the dependencies and installs the module, if something happens, check if the dependencies in pyproject.toml are installed correctly.
Usage
-
nbsp.initialize_handle()Initializes the NBioBSP instance. Must be called before any other function that interacts with the device. So you can callget_version()beforeinitialize_handle(), but notcapture(). Returns a handle just in case. -
nbsp.terminate_handle()Terminates the NBioBSP instance. -
nbsp.get_version()Returns the version of the NBioBSP SDK. -
nbsp.enumerate_device()Enumerates the devices connected to the computer. Returns a list of devices. -
nbsp.open_device()Opens the device using auto-detection. Returns the handle of the device. -
nbsp.open_specific_device(index)Opens the device using the device ID. Returns true if successful. -
nbsp.close_device()Closes the device. -
nbsp.capture("purpose", timeout)Captures a fingerprint. Returns the handle of the fingerprint.purposecan be one of the following:"enroll"for registering a fingerprint"verify"for verifying a fingerprint"identify"for identifying a fingerprint (deprecated as of 5.2)"enroll_for_verification"for registering a fingerprint for verification"enroll_for_identification"for registering a fingerprint for identification Thetimeoutparameter is the maximum time in milliseconds to wait for a fingerprint to be captured.
-
nbsp.verify(handle)Verifies the last fingerprint added in handle. Returns true if successful. -
nbsp.extract_fir_text(handle)Extracts the fingerprint hash from the handle. Returns the fingerprint hash. -
nbsp.init_index_search()Initializes the index search. -
nbsp.terminate_index_search()Terminates the index search. -
nbsp.add_fir_to_index_search(fingerprint_hash, user_id)Adds a fingerprint to the index search. Returns true if successful.
Metadata
Release files for nbsp-python 1.1
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| nbsp_python-1.1-cp312-cp312-win_amd64.whl | CPython 3.12 | CPython 3.12 | Windows x86-64 | Details |
Release files / nbsp_python-1.1-cp312-cp312-win_amd64.whl
| Download URL | nbsp_python-1.1-cp312-cp312-win_amd64.whl |
|---|---|
| Size | 80.3 kB |
| Tags | CPython 3.12 Windows x86-64 |
|
SHA-256 checksum How to use checksums |
89866010266fb763dd2116933f2ce69440c772fadd26d0387efdf3c07cca18a0
|
|
BLAKE2b-256 checksum How to use checksums |
450065c0788ce4f1e1d84d442555fe8f65ed3a10acd17cfc32096ab0dff3b569
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/4.0.2 CPython/3.12.0
|