fprint.h

00001 /*
00002  * Main definitions for libfprint
00003  * Copyright (C) 2007 Daniel Drake <dsd@gentoo.org>
00004  *
00005  * This library is free software; you can redistribute it and/or
00006  * modify it under the terms of the GNU Lesser General Public
00007  * License as published by the Free Software Foundation; either
00008  * version 2.1 of the License, or (at your option) any later version.
00009  *
00010  * This library is distributed in the hope that it will be useful,
00011  * but WITHOUT ANY WARRANTY; without even the implied warranty of
00012  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00013  * Lesser General Public License for more details.
00014  *
00015  * You should have received a copy of the GNU Lesser General Public
00016  * License along with this library; if not, write to the Free Software
00017  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
00018  */
00019 
00020 #ifndef __FPRINT_H__
00021 #define __FPRINT_H__
00022 
00023 #include <stdint.h>
00024 
00025 /* structs that applications are not allowed to peek into */
00026 struct fp_dscv_dev;
00027 struct fp_dscv_print;
00028 struct fp_dev;
00029 struct fp_driver;
00030 struct fp_print_data;
00031 struct fp_img;
00032 
00033 /* misc/general stuff */
00034 
00040 enum fp_finger {
00041     LEFT_THUMB = 1, 
00042     LEFT_INDEX, 
00043     LEFT_MIDDLE, 
00044     LEFT_RING, 
00045     LEFT_LITTLE, 
00046     RIGHT_THUMB, 
00047     RIGHT_INDEX, 
00048     RIGHT_MIDDLE, 
00049     RIGHT_RING, 
00050     RIGHT_LITTLE, 
00051 };
00052 
00053 /* Drivers */
00054 const char *fp_driver_get_name(struct fp_driver *drv);
00055 const char *fp_driver_get_full_name(struct fp_driver *drv);
00056 uint16_t fp_driver_get_driver_id(struct fp_driver *drv);
00057 
00058 /* Device discovery */
00059 struct fp_dscv_dev **fp_discover_devs(void);
00060 void fp_dscv_devs_free(struct fp_dscv_dev **devs);
00061 struct fp_driver *fp_dscv_dev_get_driver(struct fp_dscv_dev *dev);
00062 uint32_t fp_dscv_dev_get_devtype(struct fp_dscv_dev *dev);
00063 int fp_dscv_dev_supports_print_data(struct fp_dscv_dev *dev,
00064     struct fp_print_data *print);
00065 int fp_dscv_dev_supports_dscv_print(struct fp_dscv_dev *dev,
00066     struct fp_dscv_print *print);
00067 struct fp_dscv_dev *fp_dscv_dev_for_print_data(struct fp_dscv_dev **devs,
00068     struct fp_print_data *print);
00069 struct fp_dscv_dev *fp_dscv_dev_for_dscv_print(struct fp_dscv_dev **devs,
00070     struct fp_dscv_print *print);
00071 
00072 static inline uint16_t fp_dscv_dev_get_driver_id(struct fp_dscv_dev *dev)
00073 {
00074     return fp_driver_get_driver_id(fp_dscv_dev_get_driver(dev));
00075 }
00076 
00077 /* Print discovery */
00078 struct fp_dscv_print **fp_discover_prints(void);
00079 void fp_dscv_prints_free(struct fp_dscv_print **prints);
00080 uint16_t fp_dscv_print_get_driver_id(struct fp_dscv_print *print);
00081 uint32_t fp_dscv_print_get_devtype(struct fp_dscv_print *print);
00082 enum fp_finger fp_dscv_print_get_finger(struct fp_dscv_print *print);
00083 int fp_dscv_print_delete(struct fp_dscv_print *print);
00084 
00085 /* Device handling */
00086 struct fp_dev *fp_dev_open(struct fp_dscv_dev *ddev);
00087 void fp_dev_close(struct fp_dev *dev);
00088 struct fp_driver *fp_dev_get_driver(struct fp_dev *dev);
00089 int fp_dev_get_nr_enroll_stages(struct fp_dev *dev);
00090 uint32_t fp_dev_get_devtype(struct fp_dev *dev);
00091 int fp_dev_supports_print_data(struct fp_dev *dev, struct fp_print_data *data);
00092 int fp_dev_supports_dscv_print(struct fp_dev *dev, struct fp_dscv_print *print);
00093 
00094 int fp_dev_supports_imaging(struct fp_dev *dev);
00095 int fp_dev_img_capture(struct fp_dev *dev, int unconditional,
00096     struct fp_img **image);
00097 int fp_dev_get_img_width(struct fp_dev *dev);
00098 int fp_dev_get_img_height(struct fp_dev *dev);
00099 
00108 enum fp_enroll_result {
00111     FP_ENROLL_COMPLETE = 1,
00114     FP_ENROLL_FAIL,
00116     FP_ENROLL_PASS,
00119     FP_ENROLL_RETRY = 100,
00122     FP_ENROLL_RETRY_TOO_SHORT,
00125     FP_ENROLL_RETRY_CENTER_FINGER,
00129     FP_ENROLL_RETRY_REMOVE_FINGER,
00130 };
00131 
00132 int fp_enroll_finger_img(struct fp_dev *dev, struct fp_print_data **print_data,
00133     struct fp_img **img);
00134 
00146 static inline int fp_enroll_finger(struct fp_dev *dev,
00147     struct fp_print_data **print_data)
00148 {
00149     return fp_enroll_finger_img(dev, print_data, NULL);
00150 }
00151 
00159 enum fp_verify_result {
00164     FP_VERIFY_NO_MATCH = 0,
00168     FP_VERIFY_MATCH = 1,
00171     FP_VERIFY_RETRY = FP_ENROLL_RETRY,
00173     FP_VERIFY_RETRY_TOO_SHORT = FP_ENROLL_RETRY_TOO_SHORT,
00176     FP_VERIFY_RETRY_CENTER_FINGER = FP_ENROLL_RETRY_CENTER_FINGER,
00179     FP_VERIFY_RETRY_REMOVE_FINGER = FP_ENROLL_RETRY_REMOVE_FINGER,
00180 };
00181 
00182 int fp_verify_finger_img(struct fp_dev *dev,
00183     struct fp_print_data *enrolled_print, struct fp_img **img);
00184 
00195 static inline int fp_verify_finger(struct fp_dev *dev,
00196     struct fp_print_data *enrolled_print)
00197 {
00198     return fp_verify_finger_img(dev, enrolled_print, NULL);
00199 }
00200 
00201 int fp_dev_supports_identification(struct fp_dev *dev);
00202 int fp_identify_finger_img(struct fp_dev *dev,
00203     struct fp_print_data **print_gallery, size_t *match_offset,
00204     struct fp_img **img);
00205 
00221 static inline int fp_identify_finger(struct fp_dev *dev,
00222     struct fp_print_data **print_gallery, size_t *match_offset)
00223 {
00224     return fp_identify_finger_img(dev, print_gallery, match_offset, NULL);
00225 }
00226 
00227 /* Data handling */
00228 int fp_print_data_load(struct fp_dev *dev, enum fp_finger finger,
00229     struct fp_print_data **data);
00230 int fp_print_data_from_dscv_print(struct fp_dscv_print *print,
00231     struct fp_print_data **data);
00232 int fp_print_data_save(struct fp_print_data *data, enum fp_finger finger);
00233 int fp_print_data_delete(struct fp_dev *dev, enum fp_finger finger);
00234 void fp_print_data_free(struct fp_print_data *data);
00235 size_t fp_print_data_get_data(struct fp_print_data *data, unsigned char **ret);
00236 struct fp_print_data *fp_print_data_from_data(unsigned char *buf,
00237     size_t buflen);
00238 uint16_t fp_print_data_get_driver_id(struct fp_print_data *data);
00239 uint32_t fp_print_data_get_devtype(struct fp_print_data *data);
00240 
00241 /* Image handling */
00242 
00244 struct fp_minutia {
00245     int x;
00246     int y;
00247     int ex;
00248     int ey;
00249     int direction;
00250     double reliability;
00251     int type;
00252     int appearing;
00253     int feature_id;
00254     int *nbrs;
00255     int *ridge_counts;
00256     int num_nbrs;
00257 };
00258 
00259 int fp_img_get_height(struct fp_img *img);
00260 int fp_img_get_width(struct fp_img *img);
00261 unsigned char *fp_img_get_data(struct fp_img *img);
00262 int fp_img_save_to_file(struct fp_img *img, char *path);
00263 void fp_img_standardize(struct fp_img *img);
00264 struct fp_img *fp_img_binarize(struct fp_img *img);
00265 struct fp_minutia **fp_img_get_minutiae(struct fp_img *img, int *nr_minutiae);
00266 void fp_img_free(struct fp_img *img);
00267 
00268 /* Library */
00269 int fp_init(void);
00270 void fp_exit(void);
00271 
00272 #endif
00273 

Generated on Fri Dec 19 15:01:45 2008 for libfprint by  doxygen 1.4.7