Moments

1:st and 2:nd order moments for binary images. More...

Functions

int rapp_moment_order1_bin (const uint8_t *buf, int dim, int width, int height, uint32_t mom[3])
 First order binary image moments.
int rapp_moment_order2_bin (const uint8_t *buf, int dim, int width, int height, uintmax_t mom[6])
 First and second order binary image moments.

Detailed Description

1:st and 2:nd order moments for binary images.

All moments are image-global. The functions may read data up to the nearest alignment boundary, so if those pixels are not properly cleared the output may be invalid.

The performance of these functions is input-sensitive, with the best case occurring for images with all-zero pixels. The worst case is a dense, but not contiguous pattern, e.g. a checker board pattern. For actual performance figures, see the benchmark plots.

All images must be aligned.

Next section: Spatial Filtering


Function Documentation

int rapp_moment_order1_bin ( const uint8_t *  buf,
int  dim,
int  width,
int  height,
uint32_t  mom[3] 
)

First order binary image moments.

The result is only valid if it is not greater than 232.

Parameters:
[in] buf Source pixel buffer.
dim Row dimension of the source buffer.
width Image width in pixels.
height Image height in pixels.
[out] mom Storage array for the moment output with at least 3 elements. It is filled in the following way:

  • mom[0]: moment of order 0 (pixel sum)
  • mom[1]: 1:st order moment (x)
  • mom[2]: 1:st order moment (y)
Returns:
A negative error code on error, zero otherwise.
int rapp_moment_order2_bin ( const uint8_t *  buf,
int  dim,
int  width,
int  height,
uintmax_t  mom[6] 
)

First and second order binary image moments.

The 1:st and 2:nd order moments are only valid if they are not greater than 232 and 28*sizeof(uintmax_t), respectively.

Parameters:
[in] buf Source pixel buffer.
dim Row dimension of the source buffer.
width Image width in pixels.
height Image height in pixels.
[out] mom Storage array for the moment output with at least 6 elements. It is filled in the following way:

  • mom[0]: moment of order 0 (pixel sum)
  • mom[1]: 1:st order moment (x)
  • mom[2]: 1:st order moment (y)
  • mom[3]: 2:nd order moment (x)
  • mom[4]: 2:nd order moment (y)
  • mom[5]: 2:nd order moment (xy)
Returns:
A negative error code on error, zero otherwise.

Generated on 1 Jun 2016 for RAPP by  doxygen 1.6.1