moments-central

moments_central

skimage.measure.moments_central(image, cr, cc, order=3) [source]

Calculate all central image moments up to a certain order.

The center coordinates (cr, cc) can be calculated from the raw moments as: {m[0, 1] / m[0, 0], m[1, 0] / m[0, 0]}.

Note that central moments are translation invariant but not scale and rotation invariant.

Parameters:

image : 2D double or uint8 array

Rasterized shape as image.

cr : double

Center row coordinate.

cc : double

Center column coordinate.

order : int, optional

Maximum order of moments. Default is 3.

Returns:

mu : (order + 1, order + 1) array

Central image moments.

References

[R269] Wilhelm Burger, Mark Burge. Principles of Digital Image Processing: Core Algorithms. Springer-Verlag, London, 2009.
[R270] B. Jähne. Digital Image Processing. Springer-Verlag, Berlin-Heidelberg, 6. edition, 2005.
[R271] T. H. Reiss. Recognizing Planar Objects Using Invariant Image Features, from Lecture notes in computer science, p. 676. Springer, Berlin, 1993.
[R272] http://en.wikipedia.org/wiki/Image_moment

Examples

>>> image = np.zeros((20, 20), dtype=np.double)
>>> image[13:17, 13:17] = 1
>>> m = moments(image)
>>> cr = m[0, 1] / m[0, 0]
>>> cc = m[1, 0] / m[0, 0]
>>> moments_central(image, cr, cc)
array([[ 16.,   0.,  20.,   0.],
       [  0.,   0.,   0.,   0.],
       [ 20.,   0.,  25.,   0.],
       [  0.,   0.,   0.,   0.]])
doc_scikit_image
2017-01-12 17:22:28
Comments
Leave a Comment

Please login to continue.