Intel® Integrated Performance Primitives (Intel® IPP) Developer Guide and Reference

ID 790148
Date 3/22/2024
Public
Document Table of Contents

Image Moments

Spatial and central moments are important statistical properties of an image. The spatial moment MU (m,n) of order (m,n) is defined as follows:


where the summation is performed for all rows and columns in the image; Pj,k are pixel values; xk and yj are pixel coordinates; m and n are integer power exponents that define the moment order.

The central moment UU ( m,n) is the spatial moment computed relative to the “center of gravity” (x0, y0):


where x0 = MU (1,0)/ MU(0,0) and y0 = MU(0,1)/ MU(0,0).

The normalized spatial moment M(m,n) and central moment U(m, n) are defined as follows:


The Intel IPP functions support moments of order (m, n) with 0 ≤ m + n ≤ 3. The computation of seven invariant Hu moments derived from the second and third order moments is also supported. All computed moments are stored in context structures of type IppiMomentState_64s (for integer versions)or IppiMomentState_64f (for floating point versions).

Most Intel IPP functions for computing image moments have code branches that implement different algorithms to compute the results. You can choose the desired code variety to be used by the given function by setting the hint argument to one of the following values that are listed in Table “Hint Arguments for Image Moment Functions”:

Hint Arguments for Image Moment Functions 
Value Description
ippAlgHintNone The computation algorithm will be chosen by the internal function logic.
ippAlgHintFast Fast algorithm must be used. The output results will be less accurate.
ippAlgHintAccurate High accuracy algorithm must be used. The function will need more time to execute.