Driver Image operations

Driver Image operations — Driver image operation functions

Functions

struct fp_img * fpi_img_new ()
struct fp_img * fpi_img_new_for_imgdev ()
struct fp_img * fpi_img_realloc ()
struct fp_img * fpi_img_resize ()
int fpi_std_sq_dev ()
int fpi_mean_sq_diff_norm ()

Types and Values

Includes

#include <fpi-img.h>

Description

Those are the driver-specific helpers for fp_img manipulation. See fp_img's documentation for more information about data formats, and their uses in front-end applications.

Functions

fpi_img_new ()

struct fp_img *
fpi_img_new (size_t length);

Creates a new fp_img structure with length bytes of data allocated to hold the image.

Parameters

length

the length of data to allocate

 

Returns

a new fp_img to free with fp_img_free()


fpi_img_new_for_imgdev ()

struct fp_img *
fpi_img_new_for_imgdev (struct fp_img_dev *imgdev);

Creates a new fp_img structure, like fpi_img_new(), but uses the driver's advertised height and width to calculate the size of the length of data to allocate.

Parameters

imgdev

a fp_img_dev imaging fingerprint device

 

Returns

a new fp_img to free with fp_img_free()


fpi_img_realloc ()

struct fp_img *
fpi_img_realloc (struct fp_img *img,
                 size_t newsize);

Changes the size of the data part of the fp_img.

Parameters

img

an fp_img image

 

newsize

the new length of the image

 

Returns

the modified fp_img, the same as the first argument to this function


fpi_img_resize ()

struct fp_img *
fpi_img_resize (struct fp_img *img,
                unsigned int w_factor,
                unsigned int h_factor);

Resizes the fp_img image by scaling it by w_factor times horizontally and h_factor times vertically.

Parameters

img

an fp_img image

 

w_factor

horizontal factor to resize the image by

 

h_factor

vertical factor to resize the image by

 

Returns

a newly allocated fp_img, the original img will not be modified and will also need to be freed


fpi_std_sq_dev ()

int
fpi_std_sq_dev (const unsigned char *buf,
                int size);

Calculates the squared standard deviation of the individual pixels in the buffer, as per the following formula:

1
2
mean = sum (buf[0..size]) / size
sq_dev = sum ((buf[0.size] - mean) ^ 2)

This function is usually used to determine whether image is empty.

Parameters

buf

buffer (usually bitmap, one byte per pixel)

 

size

size of buffer

 

Returns

the squared standard deviation for buffer


fpi_mean_sq_diff_norm ()

int
fpi_mean_sq_diff_norm (unsigned char *buf1,
                       unsigned char *buf2,
                       int size);

This function calculates the normalized mean square difference of two buffers, usually two lines, as per the following formula:

1
sq_diff = sum ((buf1[0..size] - buf2[0..size]) ^ 2) / size

This functions is usually used to get numerical difference between two images.

Parameters

buf1

buffer (usually bitmap, one byte per pixel)

 

buf2

buffer (usually bitmap, one byte per pixel)

 

size

buffer size of smallest buffer

 

Returns

the normalized mean squared difference between buf1 and buf2

Types and Values

enum FpiImgFlags

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).

Members

FP_IMG_V_FLIPPED

the image is vertically flipped

 

FP_IMG_H_FLIPPED

the image is horizontally flipped

 

FP_IMG_COLORS_INVERTED

the colours are inverted

 

FP_IMG_BINARIZED_FORM

binarised image, see fp_img_binarize()

 

FP_IMG_PARTIAL

the image is partial, useful for driver to keep track of incomplete captures