|
23 | 23 | #ifdef __cplusplus |
24 | 24 | extern "C" { |
25 | 25 | #endif |
26 | | -struct SfmEnrollData; |
27 | | -typedef struct SfmEnrollData SfmEnrollData; |
28 | 26 | typedef unsigned char SfmPix; |
| 27 | +/** |
| 28 | + * @brief Contains information used by the sigfm algorithm for matching |
| 29 | + * @details Get one from sfm_extract() and make sure to clean it up with sfm_free_info() |
| 30 | + * @struct SfmImgInfo |
| 31 | + */ |
29 | 32 | typedef struct SfmImgInfo SfmImgInfo; |
30 | 33 |
|
31 | | -SfmEnrollData* sfm_begin_enroll(const char* username, int finger); |
32 | | -void sfm_add_enroll_frame(SfmEnrollData* data, unsigned char* pix, int width, |
33 | | - int height); |
| 34 | +/** |
| 35 | + * @brief Extracts information from an image for later use sfm_match_score |
| 36 | + * |
| 37 | + * @param pix Pixels of the image must be width * height in length |
| 38 | + * @param width Width of the image |
| 39 | + * @param height Height of the image |
| 40 | + * @return SfmImgInfo* Info that can be used with the API |
| 41 | + */ |
34 | 42 | SfmImgInfo* sfm_extract(const SfmPix* pix, int width, int height); |
35 | 43 |
|
36 | | -void sfm_end_enroll(SfmEnrollData* data); |
| 44 | +/** |
| 45 | + * @brief Destroy an SfmImgInfo |
| 46 | + * @warning Call this instead of free() or you will get UB! |
| 47 | + * @param info SfmImgInfo to destroy |
| 48 | + */ |
37 | 49 | void sfm_free_info(SfmImgInfo* info); |
| 50 | + |
| 51 | +/** |
| 52 | + * @brief Score how closely a frame matches another |
| 53 | + * |
| 54 | + * @param frame Print to be checked |
| 55 | + * @param enrolled Canonical print to verify against |
| 56 | + * @return int Score of how closely they match, values <0 indicate error, 0 means always reject |
| 57 | + */ |
38 | 58 | int sfm_match_score(SfmImgInfo* frame, SfmImgInfo* enrolled); |
| 59 | + |
| 60 | +/** |
| 61 | + * @brief Serialize an image info for storage |
| 62 | + * |
| 63 | + * @param info SfmImgInfo to store |
| 64 | + * @param outlen output: Length of the returned byte array |
| 65 | + * @return unsigned* char byte array for storage, should be free'd by the callee |
| 66 | + */ |
39 | 67 | unsigned char* sfm_serialize_binary(SfmImgInfo* info, int* outlen); |
| 68 | +/** |
| 69 | + * @brief Deserialize an SfmImgInfo from storage |
| 70 | + * |
| 71 | + * @param bytes Byte array to deserialize from |
| 72 | + * @param len Length of the byte array |
| 73 | + * @return SfmImgInfo* Deserialized info, or NULL if deserialization failed |
| 74 | + */ |
40 | 75 | SfmImgInfo* sfm_deserialize_binary(const unsigned char* bytes, int len); |
| 76 | + |
| 77 | +/** |
| 78 | + * @brief Keypoints for an image. Low keypoints generally means the image is |
| 79 | + * low quality for matching |
| 80 | + * |
| 81 | + * @param info |
| 82 | + * @return int |
| 83 | + */ |
| 84 | + |
41 | 85 | int sfm_keypoints_count(SfmImgInfo* info); |
42 | | -SfmImgInfo* sfm_copy_info(SfmImgInfo* info); |
43 | 86 |
|
44 | | -//int sfm_info_equal(SfmImgInfo* lhs, SfmImgInfo* rhs); |
| 87 | +/** |
| 88 | + * @brief Copy an SfmImgInfo |
| 89 | + * |
| 90 | + * @param info Source of copy |
| 91 | + * @return SfmImgInfo* Newly allocated and copied version of info |
| 92 | + */ |
| 93 | +SfmImgInfo* sfm_copy_info(SfmImgInfo* info); |
45 | 94 |
|
46 | 95 | #ifdef __cplusplus |
47 | 96 | } |
|
0 commit comments