Top |
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 () |
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.
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.
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.
struct fp_img * fpi_img_realloc (struct fp_img *img
,size_t newsize
);
Changes the size of the data part of the fp_img.
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.
img |
an fp_img image |
|
w_factor |
horizontal factor to resize the image by |
|
h_factor |
vertical factor to resize the image by |
a newly allocated fp_img, the original img
will not be modified
and will also need to be freed
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.
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.
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).
the image is vertically flipped |
||
the image is horizontally flipped |
||
the colours are inverted |
||
binarised image, see |
||
the image is partial, useful for driver to keep track of incomplete captures |