The af::moments() function allows for finding different properties of image regions. More...
Functions | |
AFAPI void | moments (double *out, const array &in, const momentType moment=AF_MOMENT_FIRST_ORDER) |
C++ Interface for calculating an image moment. More... | |
AFAPI array | moments (const array &in, const momentType moment=AF_MOMENT_FIRST_ORDER) |
C++ Interface for calculating image moments. More... | |
AFAPI af_err | af_moments (af_array *out, const af_array in, const af_moment_type moment) |
C Interface for finding image moments. More... | |
AFAPI af_err | af_moments_all (double *out, const af_array in, const af_moment_type moment) |
C Interface for calculating image moment(s) of a single image. More... | |
The af::moments() function allows for finding different properties of image regions.
Currently, ArrayFire calculates all first order moments. The moments are defined within the af_moment_type enum.
As the enum details, each moment can be returned individually or all first-order moments can be calculated at once. This can be done as follows:
Here is an example of how the shorthand versions might be used to find the area(or gray level sum) and center of mass of an image:
AFAPI af_err af_moments | ( | af_array * | out, |
const af_array | in, | ||
const af_moment_type | moment | ||
) |
C Interface for finding image moments.
[out] | out | is an array containing the calculated moments |
[in] | in | is an array of image(s) |
[in] | moment | is moment(s) to calculate |
AFAPI af_err af_moments_all | ( | double * | out, |
const af_array | in, | ||
const af_moment_type | moment | ||
) |
C Interface for calculating image moment(s) of a single image.
[out] | out | is a pointer to a pre-allocated array where the calculated moment(s) will be placed. User is responsible for ensuring enough space to hold all requested moments |
[in] | in | is the input image |
[in] | moment | is moment(s) to calculate |
AFAPI array moments | ( | const array & | in, |
const momentType | moment = AF_MOMENT_FIRST_ORDER |
||
) |
C++ Interface for calculating image moments.
[in] | in | contains the input image(s) |
[in] | moment | is moment(s) to calculate |
AFAPI void moments | ( | double * | out, |
const array & | in, | ||
const momentType | moment = AF_MOMENT_FIRST_ORDER |
||
) |
C++ Interface for calculating an image moment.
[out] | out | is a pointer to a pre-allocated array where the calculated moment(s) will be placed. User is responsible for ensuring enough space to hold all requested moments |
[in] | in | is the input image |
[in] | moment | is moment(s) to calculate |