Specifications

Image Statistics Functions
12-5
12
Image Moments
Spatial and central moments are important statistical characteristics of an
image. The spatial moment M
U
(m,n) and central moment U
U
(m,n)are
defined as follows:
()
Mmn xyP
U
j
nRows
k
m
j
n
jk
k
nCols
,
,
=
=
=
∑∑
0
1
0
1
()
()
()
Umn x x y y P
U
j
nRows
k
m
j
n
jk
k
nCols
,
,
=−
=
=
∑∑
0
1
00
0
1
where the summation is performed for all rows and columns in the image;
P
j,k
are pixel values; x
k
and y
j
are pixel coordinates; m and n are integer
power exponents; x
0
and y
0
are the gravity center’s coordinates:
x
0
= M
U
(1,0)/M
U
(0,0)
y
0
= M
U
(0,1)/M
U
(0,0).
The sum of exponents m + n is called the moment order. The library
functions support moments of order 0 to 3 (that is, 0
m + n 3).
In the Image Processing Library image moments are stored in structures of
the
IplMomentState type. The type declaration is given below.
IplMomentState Structure Definition
typedef struct {
double scale /* scaling factor for the moment */
double value /* the moment */
} ownMoment;
typedef ownMoment IplMomentState[4][4];