From 1006467f33c8f78e2003cb523ac047444673061f Mon Sep 17 00:00:00 2001 From: Bastien Nocera Date: Mon, 8 Oct 2018 16:43:28 +0200 Subject: [PATCH] lib: Add accessor for minutia coordinates Add fp_minutia_get_coords() so that debugging applications can show the detected minutiae along with the captured image. This will also help fix the positively ancient fprint_demo. See https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=907470 --- doc/libfprint-sections.txt | 1 + libfprint/fpi-img.c | 24 ++++++++++++++++++++++++ libfprint/fprint.h | 1 + 3 files changed, 26 insertions(+) diff --git a/doc/libfprint-sections.txt b/doc/libfprint-sections.txt index 0a95c2d..502c6f4 100644 --- a/doc/libfprint-sections.txt +++ b/doc/libfprint-sections.txt @@ -134,6 +134,7 @@ fp_img_save_to_file fp_img_standardize fp_img_binarize fp_img_get_minutiae +fp_minutia_get_coords
diff --git a/libfprint/fpi-img.c b/libfprint/fpi-img.c index da5b5b8..34c9c38 100644 --- a/libfprint/fpi-img.c +++ b/libfprint/fpi-img.c @@ -533,6 +533,30 @@ API_EXPORTED struct fp_minutia **fp_img_get_minutiae(struct fp_img *img, return img->minutiae->list; } +/** + * fp_minutia_get_coords: + * @minutia: a struct #fp_minutia + * @x: the return variable for the X coordinate of the minutia + * @y: the return variable for the Y coordinate of the minutia + * + * Sets @x and @y to be the coordinates of the detected minutia, so it + * can be presented in a more verbose user interface. This is usually only + * used for debugging purposes. + * + * Returns: 0 on success, -1 on error. + */ +API_EXPORTED int fp_minutia_get_coords(struct fp_minutia *minutia, int *coord_x, int *coord_y) +{ + g_return_val_if_fail (minutia != NULL, -1); + g_return_val_if_fail (coord_x != NULL, -1); + g_return_val_if_fail (coord_y != NULL, -1); + + *coord_x = minutia->x; + *coord_y = minutia->y; + + return 0; +} + enum fp_imgdev_enroll_state fpi_imgdev_get_action_state(struct fp_img_dev *imgdev) { diff --git a/libfprint/fprint.h b/libfprint/fprint.h index ede569b..0cf42bb 100644 --- a/libfprint/fprint.h +++ b/libfprint/fprint.h @@ -296,6 +296,7 @@ int fp_img_save_to_file(struct fp_img *img, char *path); void fp_img_standardize(struct fp_img *img); struct fp_img *fp_img_binarize(struct fp_img *img); struct fp_minutia **fp_img_get_minutiae(struct fp_img *img, int *nr_minutiae); +int fp_minutia_get_coords(struct fp_minutia *minutia, int *coord_x, int *coord_y); void fp_img_free(struct fp_img *img); /* Polling and timing */