Because ZKTeco offical SDKs suck and are unstable and full of bugs, I decided to make a simple python wrapper library of their SDKs and save you from the agony of using their products.
why not?
This library can connect to SLK20R
and ZK series, including ZK9500
, ZK6500
, ZK8500R
devices.
- You have to first install the ZKFinger SDK from the offical website.
- Then install this library via pip:
pip install pyzkfp
- Initialize and interact with ZKFinger Reader devices.
- Capture fingerprint images.
- Perform fingerprint 1:1 comparisons.
- Perform fingerprint 1:N comparisons.
- Register and identify users.
- Light & Beep control functions.
Here's a simple example of how to use this library:
from pyzkfp import ZKFP2
# Initialize the ZKFP2 class
zkfp2 = ZKFP2()
zkfp2.Init()
# Get device count and open first device
device_count = zkfp2.GetDeviceCount()
logger.info(f"{device_count} Devices found, Connecting to the first device.")
zkfp2.OpenDevice(0)
while True:
capture = zkfp2.AcquireFingerprint()
if capture:
# Implement your logic here
break
tmp, img = capture
finger_id, score = zkfp2.DBIdentify(tmp)
res = zkfp2.DBMatch(template1, template2) # returns 1 if match, 0 if not
In order to register a fingerprint, we must collect 3 templates from the same finger. And then we can merge them into one template and store it in the device's database.
templates = []
for i in range(3):
while True:
capture = zkfp2.AcquireFingerprint()
if capture:
print('fingerprint captured')
tmp, img = capture
templates.append(tmp)
break
regTemp, regTempLen = zkfp2.DBMerge(*templates)
# Store the template in the device's database
finger_id = 1 # The id of the finger to be registered
zkfp2.DBAdd(finger_id, regTemp)
you can store regTemp
(the result of the 3 merged templates) in your favorite database and use it later for direct identification after adding it to the device's database with the DBAdd
method.
for member in members:
fid, temp = member
zkfp2.DBAdd(fid, temp)
...
zkfp2.Light('green') # green/red/white
zkfp2.Terminate()
For more detailed usage instructions, please refer to the example folder (WIP).
If you found this project useful, please hire a private investigator to legally blackmail ZKTeco's dev team, as this would really help spread the good word of this repository.