Check a fingerprint in the database

China☆狼群 提交于 2020-02-27 09:01:26

问题


I am saving the fingerprints in a field "blob", then wonder if the only way to compare these impressions is retrieving all prints saved in the database and then create a vector to check, using the function "identify_finger"? You can check directly from the database using a SELECT?

I'm working with libfprint. In this code the verification is done in a vector:

def test_identify():
    cur = DB.cursor()
    cur.execute('select id, fp from print')
    id = []
    gallary = []
    for row in cur.fetchall():
        data = pyfprint.pyf.fp_print_data_from_data(str(row['fp']))
        gallary.append(pyfprint.Fprint(data_ptr = data))
        id.append(row['id'])
    n, fp, img = FingerDevice.identify_finger(gallary)

回答1:


There are two fundamentally different ways to use a fingerprint database. One is to verify the identity of a person who is known through other means, and one is to search for a person whose identity is unknown.

A simple library such as libfprint is suitable for the first case only. Since you're using it to verify someone you can use their identity to look up a single row from the database. Perhaps you've scanned more than one finger, or perhaps you've stored multiple scans per finger, but it will still be a small number of database blobs returned.

A fingerprint search algorithm must be designed from the ground up to narrow the search space, to compare quickly, and to rank the results and deal with false positives. Just as a Google search may come up with pages totally unrelated to what you're looking for, so too will a fingerprint search. There are companies that devote their entire existence to solving this problem.




回答2:


Another way would be to have a mysql plugin that knows how to work with fingerprint images and select based on what you are looking for.

I really doubt that there is such a thing.

You could also try to parallelize the fingerprint comparation, ie - calling:

FingerDevice.identify_finger(gallary)

in parallel, on different cores/machines




回答3:


You can't check directly from the database using a SELECT because each scan is different and will produce different blobs. libfprint does the hard work of comparing different scans and judging if they are from the same person or not

What zinking and Tudor are saying, I think, is that if you understand how does that judgement process works (which is by the way, by minutiae comparison) you can develop a method of storing the relevant data for the process (the *minutiae, maybe?) in the database and then a method for fetching the relevant values -- maybe a kind of index or some type of extension to the database.

In other words, you would have to reimplement the libfprint algorithms in a more complex (and beautiful) way, instead of just accepting the libfprint method of comparing the scan with all stored fingerprint in a loop.

other solutions for speeding your program

use C:

I only know sufficient C to write kind of hello-world programs, but it was not hard to write code in pure C to use the fp_identify_finger_img function of libfprint and I can tell you it is much faster than pyfprint.identify_finger.

You can continue doing the enrollment part of the stuff in python. I do it.

use a time / location based SELECT:

If you know your users will scan their fingerprints with more probability at some time than other time, or at some place than other place (maybe arriving at work at some time and scanning their fingers, or leaving, or entering the building by one gate, or by other), you can collect data (at each scan) for measuring the probabilities and creating parallel tables to sort the users for their probability of arriving at each time and location.

We know that identify_finger tries to identify fingers in a loop with the fingerprint objects you provided in a list, so we can use that and give it the objects sorted in a way in which the more likely user for that time and that location will be the first in the list and so on.



来源:https://stackoverflow.com/questions/11407850/check-a-fingerprint-in-the-database

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!