[fprint] compare fp_print_data
Dawit Abate
dawitabate2 at gmail.com
Sat Jun 24 11:44:12 UTC 2017
I have been trying to implement fingerprint identification by getting
fp_print_data from the device once and compare it with files on the
database. But i have a problem with fpi_img_compare_print_data. It returns
-22 - Invalid print format. I explicitly removed the check condition in
img.c and it takes too much time to compute. And I don't think it is
returning a valid value. I don't know where I am missing.
here is the code.
int main(int argc, char * argv[]) {
struct fp_dscv_dev ** discv_devs = NULL; /* list of scanners */
struct fp_dscv_dev * using_dev = NULL; /* using device */
struct fp_dev * dev = NULL;
struct fp_print_data * print_data = NULL; /* fingerprint from base
*/
struct fp_print_data * print_image = NULL; /* fingerprint from file
*/
int verify_retval = 0;
gchar *path;
/* init library fprint */
if (fp_init()) {
fprintf(stderr, "Cannit init fprint library!\n");
return 1;
}
// get list of devices
discv_devs = fp_discover_devs();
if (!discv_devs) {
fprintf(stderr, "Cannot discover any fingerprint
device!\n");
fp_exit();
return 1;
}
// use first found device and print driver's name
using_dev = discv_devs[0];
printf("Found device using %s driver.\n",
fp_driver_get_full_name(fp_dscv_dev_get_driver(using_dev)));
if ((dev = fp_dev_open(using_dev)) == NULL) {
fprintf(stderr, "Could not open device\n");
fp_exit();
return 1;
}
printf("Enter the path to file 1:\n");
int data1;
scanf("%d", &data1);
/* Load finger print from base */
printf("Loading first print\n");
if (fp_print_data_load(dev, user_id1, &print_data)) {
fprintf(stderr, "Failed to load the first fingerprint\n");
fp_dev_close(dev);
fp_exit();
return 1;
}
printf("Enter the path to file 1:\n");
int data2;
scanf("%d", &data2);
/* Load fingerprint from file */
printf("Loading second print\n");
if (fp_print_data_load(dev, 2, &print_image)) {
fprintf(stderr, "Failed to load the second fingerprint\n");
fp_dev_close(dev);
fp_exit();
return 1;
}
int match_score;
match_score = fpi_img_compare_print_data (print_data, print_data);
if (match_score > 40){
printf("Matched\n");
}else{
printf("Not Matched\n");
}
printf("Score = %d\n", match_score);
// free resources
fp_print_data_free(print_data);
fp_print_data_free(print_image);
fp_dev_close(dev);
fp_exit();
return 0;
}
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.freedesktop.org/archives/fprint/attachments/20170624/09db8c21/attachment.html>
More information about the fprint
mailing list