def search(): f = PyFingerprint('COM6', 57600, 0xFFFFFFFF, 0x00000000) print('Currently used templates: ' + str(f.getTemplateCount()) + '/' + str(f.getStorageCapacity())) print('Waiting for finger...') while (f.readImage() == False): pass f.convertImage(FINGERPRINT_CHARBUFFER1) result = f.searchTemplate() positionNumber = result[0] accuracyScore = result[1] if (positionNumber == -1): print('No match found!') exit(0) else: print('Found template at position #' + str(positionNumber)) print('The accuracy score is: ' + str(accuracyScore)) f = open('profiles/' + str(positionNumber) + '.txt', 'r', encoding='UTF8') for line in f: print(line, end='') f.close()
def search(): ## Tries to initialize the sensor f = PyFingerprint('COM6', 57600, 0xFFFFFFFF, 0x00000000) ## Gets some sensor information print('Currently used templates: ' + str(f.getTemplateCount()) + '/' + str(f.getStorageCapacity())) ## Tries to search the finger and calculate hash print('Waiting for finger...') ## Wait that finger is read while (f.readImage() == False): pass ## Converts read image to characteristics and stores it in charbuffer 1 f.convertImage(FINGERPRINT_CHARBUFFER1) ## Searchs template result = f.searchTemplate() positionNumber = result[0] accuracyScore = result[1] if (positionNumber == -1): print('No match found!') exit(0) else: print('Found template at position #' + str(positionNumber)) print('The accuracy score is: ' + str(accuracyScore)) f = open('profiles/' + str(positionNumber) + '.txt', 'r', encoding='UTF8') for line in f: print(line, end='') f.close()
lcd.clear() lcd.message("Retire o dedo\n") lcd.message("do sensor 3/3") time.sleep(2) print('Aguarde o final da operacao...') lcd.clear() lcd.message("Aguarde ...") imageDestination = tempfile.gettempdir() + '/fingerprint.bmp' f.downloadImage(imageDestination) #print('The image was saved to "' + imageDestination + '".') #################################################################### print('Digital cadastrada com sucesso.') print('Nova digital cadastrada na posicao #' + str(positionNumber)) lcd.clear() lcd.message("Digital Salva\n") lcd.message("na posicao " + str(positionNumber)) f = open("position.txt", "w") f.write(str(positionNumber)) f.close() except Exception as e: print('Operation failed!') print('Exception message: ' + str(e)) exit(1)