Learn R Programming

SpatialVx (version 1.0-2)

Mij: Raw Image Moments.

Description

Calculate the raw Hu image moment Mij.

Usage

Mij(x, s, i = 0, j = 0)

Value

A single numeric giving the desired moment is returned.

Arguments

x

A matrix.

s

A two-column matrix giving the location coordinates. May be missing in which case they are assumed to be integers giving the row and column numbers.

i,j

Integer giving the moment order for each coordinate x and y, resp.

Author

Eric Gilleland

Details

The raw moment M(ij) (Hu 1962) is calculated by

M(ij) = sum(x^i * y^j * Im[i, j])

where x and y are the pixel coordinates and Im is the (image) matrix. Various useful properties of an image may be gleaned from certain moments. For example, the image area is given by M(00), and the image centroid is (M(10) / M(00), M(01) / M(00)). The image orientation angle can also be derived.

References

Hu, M. K. (1962) Visual Pattern Recognition by Moment Invariants. IRE Trans. Info. Theory, IT-8, 179--187.

See Also

imomenter

Examples

Run this code
data( "geom000" )

Mij( geom000 ) # area

Run the code above in your browser using DataLab