Add API to access minutiae
This commit is contained in:
parent
fa742a2142
commit
887e0e6acf
3 changed files with 65 additions and 16 deletions
|
@ -189,21 +189,6 @@ gboolean fpi_print_data_compatible(uint16_t driver_id1, uint32_t devtype1,
|
|||
enum fp_print_data_type type1, uint16_t driver_id2, uint32_t devtype2,
|
||||
enum fp_print_data_type type2);
|
||||
|
||||
struct fp_minutia {
|
||||
int x;
|
||||
int y;
|
||||
int ex;
|
||||
int ey;
|
||||
int direction;
|
||||
double reliability;
|
||||
int type;
|
||||
int appearing;
|
||||
int feature_id;
|
||||
int *nbrs;
|
||||
int *ridge_counts;
|
||||
int num_nbrs;
|
||||
};
|
||||
|
||||
struct fp_minutiae {
|
||||
int alloc;
|
||||
int num;
|
||||
|
|
|
@ -207,12 +207,30 @@ uint16_t fp_print_data_get_driver_id(struct fp_print_data *data);
|
|||
uint32_t fp_print_data_get_devtype(struct fp_print_data *data);
|
||||
|
||||
/* Image handling */
|
||||
|
||||
/** \ingroup img */
|
||||
struct fp_minutia {
|
||||
int x;
|
||||
int y;
|
||||
int ex;
|
||||
int ey;
|
||||
int direction;
|
||||
double reliability;
|
||||
int type;
|
||||
int appearing;
|
||||
int feature_id;
|
||||
int *nbrs;
|
||||
int *ridge_counts;
|
||||
int num_nbrs;
|
||||
};
|
||||
|
||||
int fp_img_get_height(struct fp_img *img);
|
||||
int fp_img_get_width(struct fp_img *img);
|
||||
unsigned char *fp_img_get_data(struct fp_img *img);
|
||||
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);
|
||||
void fp_img_free(struct fp_img *img);
|
||||
|
||||
/* Library */
|
||||
|
|
|
@ -398,8 +398,10 @@ API_EXPORTED struct fp_img *fp_img_binarize(struct fp_img *img)
|
|||
int r = fpi_img_detect_minutiae(img);
|
||||
if (r < 0)
|
||||
return NULL;
|
||||
if (!img->binarized)
|
||||
if (!img->binarized) {
|
||||
fp_err("no minutiae after successful detection?");
|
||||
return NULL;
|
||||
}
|
||||
}
|
||||
|
||||
ret = fpi_img_new(imgsize);
|
||||
|
@ -410,3 +412,47 @@ API_EXPORTED struct fp_img *fp_img_binarize(struct fp_img *img)
|
|||
return ret;
|
||||
}
|
||||
|
||||
/** \ingroup img
|
||||
* Get a list of minutiae detected in an image. A minutia point is a feature
|
||||
* detected on a fingerprint, typically where ridges end or split.
|
||||
* libfprint's image processing code relies upon comparing sets of minutiae,
|
||||
* so accurate placement of minutia points is critical for good imaging
|
||||
* performance.
|
||||
*
|
||||
* The image must have been \ref img_std "standardized" otherwise this function
|
||||
* will fail.
|
||||
*
|
||||
* You cannot pass a binarized image to this function. Instead, pass the
|
||||
* original image.
|
||||
*
|
||||
* Returns a list of pointers to minutiae, where the list is of length
|
||||
* indicated in the nr_minutiae output parameter. The returned list is only
|
||||
* valid while the parent image has not been freed, and the minutiae data
|
||||
* must not be modified or freed.
|
||||
*
|
||||
* \param img a standardized image
|
||||
* \param nr_minutiae an output location to store minutiae list length
|
||||
* \returns a list of minutiae points. Must not be modified or freed.
|
||||
*/
|
||||
API_EXPORTED struct fp_minutia **fp_img_get_minutiae(struct fp_img *img,
|
||||
int *nr_minutiae)
|
||||
{
|
||||
if (img->flags & FP_IMG_BINARIZED_FORM) {
|
||||
fp_err("image is binarized");
|
||||
return NULL;
|
||||
}
|
||||
|
||||
if (!img->minutiae) {
|
||||
int r = fpi_img_detect_minutiae(img);
|
||||
if (r < 0)
|
||||
return NULL;
|
||||
if (!img->minutiae) {
|
||||
fp_err("no minutiae after successful detection?");
|
||||
return NULL;
|
||||
}
|
||||
}
|
||||
|
||||
*nr_minutiae = img->minutiae->num;
|
||||
return img->minutiae->list;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue