This is directly related to my previous post, Diving into a Digital Persona.
After playing around with Cython and fprint in Python3’s terminal, I found some combinations of commands that provided meaningful (and cool) results.
Initializing the device with the following code…
import fprint
fprint.init()
… should prepare the program to accept commands. The first step is to tell the library to find available devices, and is done with…
devices = fprint.DiscoveredDevices()
Now the devicescode> variable hopefully has an object containing the available devices. Unless you have more than one, the following code should put your device object into another variable:
devices = devices[0]
device = fprint.Device.open(devices)
… and now device
is assigned to the device, ready to accept commands!
The following snippet should save a binarized file to a user-defined location:
fingerprint = device.capture_image(0)
fingerprint = fingerprint.binarize() // optional
fingerprint.save_to_file('/tmp/fingerprint.pgm')
A file in your /tmp
folder should appear. This is not fingerprint data that can be read by the library, but merely a graphical representation.
To get the actual, comparable fingerprint data, the following commands are needed:
(fingerprint, image) = device.enroll_finger()
fingerprint = fprint.PrintData.from_data(fingerprint.data)
From what I understand about this is that the fingerprint is converted into machine-readable data from predetermined points on the print, and then the data saved to memory.
Actually comparing fingerprints require the following commands:
(result, img) = dev.verify_finger(print_data)
print(result)
Where result is either true or false depending on whether the fingerprint was previously enrolled or not.