lib: Transform fp_img flags into a FpiImgFlags enum

And document it.
This commit is contained in:
Bastien Nocera 2018-11-12 13:29:00 +01:00
parent 9316dfed2e
commit 9e5ae25abf
3 changed files with 27 additions and 17 deletions

View file

@ -261,13 +261,7 @@ fpi_drvcb_verify_stopped
<INCLUDE>fpi-img.h</INCLUDE> <INCLUDE>fpi-img.h</INCLUDE>
<FILE>fpi-img</FILE> <FILE>fpi-img</FILE>
fp_minutiae fp_minutiae
FpiImgFlags
FP_IMG_V_FLIPPED
FP_IMG_H_FLIPPED
FP_IMG_COLORS_INVERTED
FP_IMG_BINARIZED_FORM
FP_IMG_PARTIAL
FP_IMG_STANDARDIZATION_FLAGS
fpi_img_new fpi_img_new
fpi_img_new_for_imgdev fpi_img_new_for_imgdev

View file

@ -303,6 +303,9 @@ static void minutiae_to_xyt(struct fp_minutiae *minutiae, int bwidth,
xyt->nrows = nmin; xyt->nrows = nmin;
} }
#define FP_IMG_STANDARDIZATION_FLAGS (FP_IMG_V_FLIPPED | FP_IMG_H_FLIPPED \
| FP_IMG_COLORS_INVERTED)
static int fpi_img_detect_minutiae(struct fp_img *img) static int fpi_img_detect_minutiae(struct fp_img *img)
{ {
struct fp_minutiae *minutiae; struct fp_minutiae *minutiae;

View file

@ -24,21 +24,34 @@
struct fp_minutiae; struct fp_minutiae;
/* bit values for fp_img.flags */ /**
#define FP_IMG_V_FLIPPED (1<<0) * FpiImgFlags:
#define FP_IMG_H_FLIPPED (1<<1) * @FP_IMG_V_FLIPPED: the image is vertically flipped
#define FP_IMG_COLORS_INVERTED (1<<2) * @FP_IMG_H_FLIPPED: the image is horizontally flipped
#define FP_IMG_BINARIZED_FORM (1<<3) * @FP_IMG_COLORS_INVERTED: the colours are inverted
#define FP_IMG_PARTIAL (1<<4) * @FP_IMG_BINARIZED_FORM: binarised image, see fp_img_binarize()
* @FP_IMG_PARTIAL: the image is partial, useful for driver to keep track
#define FP_IMG_STANDARDIZATION_FLAGS (FP_IMG_V_FLIPPED | FP_IMG_H_FLIPPED \ * of incomplete captures
| FP_IMG_COLORS_INVERTED) *
* Flags used in the #fp_img structure to describe the image contained
* into the structure. Note that a number of functions will refuse to
* handle images which haven't been standardised through fp_img_standardize()
* (meaning the @FP_IMG_V_FLIPPED, @FP_IMG_H_FLIPPED and @FP_IMG_COLORS_INVERTED
* should all be unset when the image needs to be analysed).
*/
typedef enum {
FP_IMG_V_FLIPPED = 1 << 0,
FP_IMG_H_FLIPPED = 1 << 1,
FP_IMG_COLORS_INVERTED = 1 << 2,
FP_IMG_BINARIZED_FORM = 1 << 3,
FP_IMG_PARTIAL = 1 << 4
} FpiImgFlags;
struct fp_img { struct fp_img {
int width; int width;
int height; int height;
size_t length; size_t length;
uint16_t flags; FpiImgFlags flags;
struct fp_minutiae *minutiae; struct fp_minutiae *minutiae;
unsigned char *binarized; unsigned char *binarized;
unsigned char data[0]; unsigned char data[0];