Internal FpImage: libfprint Reference Manual

## Internal FpImage Internal FpImage — Internal image handling routines |

## Functions

gint | fpi_std_sq_dev ()
gint | fpi_mean_sq_diff_norm ()
FpImage * | fpi_image_resize ()

## Properties

guint | height | Read / Write / Construct Only
guint | width | Read / Write / Construct Only

## Types and Values

enum | FpiImageFlags
| FpImage

## Object Hierarchy

        GObject
        ╰── FpImage

## Description

Internal image handling routines. See FpImage for public routines.

## Functions

### fpi_std_sq_dev ()

    gint
    fpi_std_sq_dev (const guint8 *buf,
                    gint 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 ()

    gint
    fpi_mean_sq_diff_norm (const guint8 *buf1,
                           const guint8 *buf2,
                           gint 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`

### fpi_image_resize ()

    FpImage *
    fpi_image_resize (FpImage *orig,
                      guint w_factor,
                      guint h_factor);

## Types and Values

### enum FpiImageFlags

Flags used in an FpImage structure to describe the contained image. This is useful for image drivers as they can simply set these flags and rely on the image to be normalized by libfprint before further processing.

#### Members

FPI_IMAGE_NONE |  |
FPI_IMAGE_V_FLIPPED | the image is vertically flipped |
FPI_IMAGE_H_FLIPPED | the image is horizontally flipped |
FPI_IMAGE_COLORS_INVERTED | the colours are inverted |
FPI_IMAGE_PARTIAL | the image is a partial scan |

### FpImage

    typedef struct {
      guint         width;
      guint         height;

      gdouble       ppmm;

      FpiImageFlags flags;
    } FpImage;

Structure holding an image. The public fields are only public for internal use by the drivers.

## Property Details

### The `“height”` property

      “height”                   guint

The height of the image.

Owner: FpImage

Flags: Read / Write / Construct Only

Allowed values: <= 65535

Default value: 0

### The `“width”` property

      “width”                    guint

The width of the image.

Owner: FpImage

Flags: Read / Write / Construct Only

Allowed values: <= 65535

Default value: 0