123456789101112131415161718192021222324252627282930313233343536373839 |
- def fp_download():
- ## Reads image and download it
- ## Tries to initialize the sensor
- try:
- f = PyFingerprint('/dev/ttyUSB0', 57600, 0xFFFFFFFF, 0x00000000)
- if ( f.verifyPassword() == False ):
- raise ValueError('The given fingerprint sensor password is wrong!')
- except Exception as e:
- print('The fingerprint sensor could not be initialized!')
- print('Exception message: ' + str(e))
- exit(1)
- ## Gets some sensor information
- print('Currently stored templates: ' + str(f.getTemplateCount()))
- ## Tries to read image and download it
- try:
- print('Waiting for finger...')
- ## Wait that finger is read
- while ( f.readImage() == False ):
- pass
- print('Downloading image (this take a while)...')
- imageDestination = tempfile.gettempdir() + '/fingerprint.bmp'
- f.downloadImage(imageDestination)
- print('The image was saved to "' + imageDestination + '".')
- except Exception as e:
- print('Operation failed!')
- print('Exception message: ' + str(e))
- exit(1)
|