## Contour analysis

An image or a contour (binary image) can be analysed by moments.
A moment M under an order (p, q) is defined as follows:

M_(pq)=intint x^p y^q f(x,y)dxdy

With the double integral running over the whole domain of x and y (whole image or ROI).
As digital images represent a discrete subspace, we can replace the double integral with a double summation:

M_(pq)=sumsum x^p y^q f(x,y)dxdy

Simple moments:

• If we calculate M00 of the pixel intensity function I(x, y), we obtain the sum of the pixel values for monochrome images
• If we calculate M00 of the indicator function reporting the presence of non-zero pixels (unit value per pixel other than zero, otherwise null), we obtain the contour area.
• The image centroid coordinates can be calculated as follows:
bar x=M_(10)/M_(00), bar y= M_(01)/M_(00)

The central moments (referring to the centroid coordinates) can be calculated based on the previous moments

mu_(pq)=sum sum (x-bar x)^p(y - bar y)^qf(x,y)

Which have the property of being invariant with respect to translations (the centroid coordinates are based on M moments).

Invariance can be extended:

• to scale variation by calculating normalized moments
eta_(pq)=mu_(pq)/mu_(00)^(1+(p+q)/2)
• based on scale variation and rotation through Hu moments.

Clearly, the latter are the most widely used.

Hu moments are a concise way of describing complex images.

Next → 