-
Notifications
You must be signed in to change notification settings - Fork 117
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fingerprint characteristics seem to change inside the reader #70
Comments
Hey @gitcat555 , |
Hey @philippmeisberger ,
Then I use the script to scan the finger multiple times:
As you can see, the hash is sometimes identical and then it's a completely different one. I then did a little modification to the search script to write out the raw characteristics to a file:
I then move the file from tmp to a folder after each scan and name it 1.txt, 2.txt etc. and compare them with diff. When the hash is different, the characteristics are indeed different, too. But how can this be when it should actually always be the SAME template that is being loaded? And there is only a single template in the reader anyway?! |
Indeed, this is really strange. I still could not reproduce it with ZFM-20:
Which sensor do you use? |
I also hav a ZFM-20 and sometimes I would get the same hash 10 or even 20 times in a row! However, it is never the same hash of the print I enrolled. By the way: is it possible to pull the characteristics from the actual template position and skip the step of copying it to charbuffer 1? |
You mean this line?
If you delete this line you would get a different hash as you download the contents of image buffer. The stored template must be downloaded to get the same hash constantly. |
So it has to be downloaded to 0x01 before it can be worked with? I just meant, well, if it is possible to work with a template directly at its actual storage position. The library code does not seem to support this, but would it be possible? |
Sure, you can directly access the stored templates. But the reading process ( The |
I actually have the exact same problem
Not sure how to solve this. |
At least I'm not the only one. I thought I was going mad at first! So what is the actual problem? Could it be faulty hardware? @philippmeisberger are you absolutely sure your ZFM-20 is ALWAYS producing the same hash? Give it say at least 30 rounds and try placing the finger in a slightly different way so that it will still find a match but normally in my case this causes a different hash to be produced. |
I have the same problem. |
Sorry for responding to such an "old" issue - but in have the same experience with an R302. To my understanding, the sensor works as follows when we initiate a search for a fingerprint match:
|
Did you find the way to this problem, if yes, can i get help please ? I have the same problem |
No... not really solved the problem. I haven't found a way to disable the automatic fingerprint "optimization". What problem are you facing / why is the optimization a problem for you? |
Cause i want to store it in a sqlite database to be able to use 2 sensors. One to register new finger and the other to compare finger. |
you still can do that. You could for example regularly retrieve the "optimized" fingerprints from the scanner which compares the finger and store it in the database. |
Ok i will try this. Just in case, is this possible to compare finger with the image. I extract the image then i compare the 2 finger with a library of finger recognition |
In my experience the image extraction is too slow.. |
Hey, i'm back ! I have a question, do you know how can i compare a finger to a characteristics. If i know that, i think i can do it ! |
Nevermind, it work !! Thank you for your help @alexander-rieder ! |
Can you share how you did it? |
Hello, yes, I can share with you how I managed to do it. It's been a while, so if something is not clearly explained, let me know. I removed all the unnecessary parts of my code, so only useful things remain. At this time I wasn't the best with coding, so my code could certainly be improved. Here, I'll explain to you how to remove fingerprint data from the sensor and store it in an external database (SQLite for me). Then, I'll explain how to do the opposite (retrieve every fingerprint data from the external database and upload it to the sensor). If you have any questions, don't hesitate. Store fingerprint in an external databaseglobal gout
def timer():
global gout
gout = False
compteur = 11
while (f.readImage() == False ):
gout = True
compteur -= 1
time.sleep(1)
if compteur == 0:
gout = False
break
# connection to the fingerprint sensor
f = PyFingerprint('/dev/ttyAMA1', 57600, 0xFFFFFFFF, 0x00000000)
# if password is false
if ( f.verifyPassword() == False ):
# do what you want
try:
timer()
time.sleep(0.2)
# if a finger is detected
if gout is True:
f.convertImage(0x01)
# ask user to remove his finger
time.sleep(1)
# ask user to put his same finger
time.sleep(1)
gout = False
timer()
# if a second finger is detected
if gout is True:
f.convertImage(0x02)
gout = False
# if the two finger are not the same
if ( f.compareCharacteristics() == 0 ):
# do what you want
# if the two finger are the same
else:
# store fingerprint in the sensor
positionNumber = f.storeTemplate()
f.loadTemplate(positionNumber = positionNumber, charBufferNumber = 1)
# take the fingerprint out of the sensor
cr = f.downloadCharacteristics()
# store fingerprint of the user in "code" with some modification
code = ','.join(str(v) for v in cr)
# clear sensor database
f.clearDatabase()
# then you can store "code" in your project database
# if the second finger is not detected
else:
# do what you want
# if no finger is detected
else:
# do what you want
# if an error appear
except Exception as e:
# do what you want Obtain fingerprint data from external database and store it in the second sensortry:
# connection to the external database
connection = sqlite3.connect(r"/home/pi/database/user.db", check_same_thread=False)
cursor = connection.cursor()
# connection to the fingerprint sensor
f = PyFingerprint('/dev/ttyS0', 57600, 0xFFFFFFFF, 0x00000000)
# if password is false
if ( f.verifyPassword() == False ):
# do what you want
# obtain data from my external database
req = cursor.execute('SELECT * FROM users')
data = cursor.fetchall()
# remove every fingerprint from the sensor
f.clearDatabase()
# browse all data
for row_finger in data:
id = row_finger[0]
database_finger = row_finger[5] # position of fingerdata from database
bef_carac = list(database_finger.split(',')) # remove the modification from last code
# store data in the sensor
carac = [int(i) for i in bef_carac]
f.uploadCharacteristics(charBufferNumber = 1, characteristicsData = carac)
f.storeTemplate(positionNumber = id, charBufferNumber = 1)
except Exception as e:
# do what you want |
Hey all, I've been working with this library for quite some time now and my understanding of how the reader works is:
(please correct me if I'm wrong!)
Now the problem I am facing is that the template does not quite seem to be exactly the same whenever I am scanning a fingerprint. I have even tried extracting the characteristics of the template, then deleting all templates from the reader and uploading the characteristics to the reader. After that, I do a scan and finds a match, however the raw characteristics differ from the ones uploaded, hence a different hash is generated. Therefore, it seems hashing is utterly pointless?!
Anyone else encounter this issue? After all, the reader can be used to authenticate someone, however working with hashes or matching raw characteristics 1:1 is not an option, obviously...
Is this normal? Any help much appreciated!
The text was updated successfully, but these errors were encountered: