Skip to content
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

Exception when comparing stored values #10

Open
Brando753 opened this issue Feb 7, 2017 · 10 comments
Open

Exception when comparing stored values #10

Brando753 opened this issue Feb 7, 2017 · 10 comments

Comments

@Brando753
Copy link

When running the example program in python3 the following exception occurs.

➜  examples git:(master) python3 disk_identify.py 
ready to match fingers!
Traceback (most recent call last):
  File "/usr/lib/python3/dist-packages/cffi/api.py", line 776, in accessor_function
    value = backendlib.load_function(BType, name)
KeyError: "function 'fp_img_compare_print_data_to_gallery' not found in library 'libfprint.so.0': /usr/lib/x86_64-linux-gnu/libfprint.so.0: undefined symbol: fp_img_compare_print_data_to_gallery"

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/usr/local/lib/python3.5/dist-packages/pyfprint/pyfprint.py", line 639, in identify
    r = C.fp_img_compare_print_data_to_gallery(newfp._get_print_data_ptr(), fprint_gallery, THRESHOLD, offset);
  File "/usr/lib/python3/dist-packages/cffi/api.py", line 837, in __getattr__
    make_accessor(name)
  File "/usr/lib/python3/dist-packages/cffi/api.py", line 833, in make_accessor
    accessors[name](name)
  File "/usr/lib/python3/dist-packages/cffi/api.py", line 778, in accessor_function
    raise AttributeError('%s: %s' % (name, e))
AttributeError: fp_img_compare_print_data_to_gallery: "function 'fp_img_compare_print_data_to_gallery' not found in library 'libfprint.so.0': /usr/lib/x86_64-linux-gnu/libfprint.so.0: undefined symbol: fp_img_compare_print_data_to_gallery"

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "disk_identify.py", line 25, in <module>
    i = pyfprint.identify(fp, fps)
  File "/usr/local/lib/python3.5/dist-packages/pyfprint/pyfprint.py", line 641, in identify
    raise FprintException("libfprint does not export fp_img_compare_print_data_to_gallery!")
pyfprint.pyfprint.FprintException: libfprint does not export fp_img_compare_print_data_to_gallery!
@franciscod
Copy link
Owner

Thanks!

I think I had patched libfprint with a modification that made that function exported/public. I don't remember the details but I could look it up eventually...

Do you need that "identify FP from disk" functionality or are just notifying about the broken test?

@Brando753
Copy link
Author

We are trying to use that functionality or something similar. The use case is that a fingerprint is scanned at a computer and that fingerprint object is then sent to a Django server which also has this library where it is then checked against the enrolled ones from the servers database. This seemed like the only way to compare two fingerprint objects that could be sent over a network.

@franciscod
Copy link
Owner

(it would be great to add a script automating all of this)

Get the libfprint source and try to change the following:

https://cgit.freedesktop.org/libfprint/libfprint/tree/libfprint/img.c#n385

At the beginning of that line defining fp_img_compare_print_data_to_gallery:

Then recompile and install that patched libfprint. I think that's enough, but I might be forgetting something. Let me know about the results and if I can help you with anything else!

@merindorium
Copy link

merindorium commented Feb 15, 2017

Hi @franciscod, i have compiled library and now it works.
But, when i'm trying to use pyfprint.identify() with the same fingerprint it doesn't work.
I found out that C.fp_img_compare_print_data_to_gallery() return -22 instead of 0 or 1 for C.FP_VERIFY_NO_MATCH and C.FP_VERIFY_MATCH.
It means that library returns error:

if (g_slist_length(print->prints) != 1) {
		fp_err("new_print contains more than one sample, is it enrolled print?");
		return -EINVAL;
	}

Maybe this happens because i identify loaded from disk fingerprint with itself but it works only with enrolled fingers?

@franciscod
Copy link
Owner

Hmm, maybe something changed on libfprint preventing that usage...

I don't have access to fingerprinting hardware to test it, but if you share your code I can hopefully guess something!

@merindorium
Copy link

merindorium commented Feb 16, 2017

Thanks for reply.
This is the code from your example disk_identify
I have replaced enrolled finger with loaded from disk.

import pyfprint
import os.path

pyfprint.fp_init()

fps = []

fps.append(pyfprint.Fprint(open('path_to_file', 'br').read()))
fps.append(pyfprint.Fprint(open('path_to_file', 'br').read()))

print("ready to match fingers!")

i = pyfprint.identify(fps[0], fps)

if i is None:
    print("No match found")
else:
    print("Found")

pyfprint.fp_exit()

@franciscod
Copy link
Owner

The code seems fine to me...

Does the disk_identify.py from the examples work?

@Brando753
Copy link
Author

Would it help if we ordered a finger print scanner for you to test with franciscod? That way you could actually test and not have to guess whats going on with the code. If so please PM me and I can get something sent to you.

@franciscod
Copy link
Owner

It surely would, but maybe it's easier to set up a (virtual?) machine with the scanner attached and let me access it via https://tmate.io/ or something?

@Brando753
Copy link
Author

We can do what ever route you would prefer.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants