Package: nbsp-python
NBioBSP for PythonBeta module for integrating NBioBSP SDK with PythonThis 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êsRequirementsPython 3.10 or highereNBSP SDK greater or equal to 5.2MSVC 2019 or higher (maybe it works with another compiler, didn't test it yet)Cmake 20 or higherTo Do:Readable error output using NBioAPI types(priority)Handle errors properlyThrow translatable and proper exceptions from C++ to PythonHandle return values properly(priority)Handle fingerprint purposes on capture properlyImplement IndexSearch methodsImplement all functions that are possible in WindowsImplement all functions that arepossiblein Linux(no priority)You can test the module with the following code on the Python interpreter:importnbsp_pythonasnbsp# Initialize the NBioBSP instancenbsp.initialize_handle()# Get the version of the NBioBSP SDKnbsp.get_version()# Enumerate the devices connected to the computernbsp.enumerate_device()# Open the device using auto-detectionnbsp.open_device()# Capture a fingerprint and assign it to handlehandle=nbsp.capture("enroll",10000)# Verify fingerprints contained in handlenbsp.verify(handle)# Extract the hash from the last fingerprint added in the handlefingerprint_hash=nbsp.extract_fir_text(handle)# Initialize the index searchnbsp.init_index_search()# Add the fingerprint to the index search and passnbsp.add_fir_to_index_search(fingerprint_hash,1)# Identify the fingerprint in the index searchnbsp.identify_data_from_index_search(fingerprint_hash)# Terminate the index searchnbsp.terminate_index_search()# Terminate the NBioBSP instancenbsp.terminate_handle()# Close the devicenbsp.close_device()Or by executing aTKinter Examplewith Python.Installationgitclonehttps://github.com/Andoreatta/nbsp-python.gitcdnbsp-pythonpipinstall.Pulls all the dependencies and installs the module, if something happens, check if the dependencies in pyproject.toml are installed correctly.Usagenbsp.initialize_handle()Initializes the NBioBSP instance. Must be called before any other function thatinteracts 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.