moments

moments

skimage.measure.moments(image, order=3) [source]

Calculate all raw image moments up to a certain order.

The following properties can be calculated from raw image moments:
  • Area as: m[0, 0].
  • Centroid as: {m[0, 1] / m[0, 0], m[1, 0] / m[0, 0]}.

Note that raw moments are neither translation, scale nor rotation invariant.

Parameters:

image : 2D double or uint8 array

Rasterized shape as image.

order : int, optional

Maximum order of moments. Default is 3.

Returns:

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

Raw image moments.

References

[R265] Wilhelm Burger, Mark Burge. Principles of Digital Image Processing: Core Algorithms. Springer-Verlag, London, 2009.
[R266] B. Jähne. Digital Image Processing. Springer-Verlag, Berlin-Heidelberg, 6. edition, 2005.
[R267] T. H. Reiss. Recognizing Planar Objects Using Invariant Image Features, from Lecture notes in computer science, p. 676. Springer, Berlin, 1993.
[R268] 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]
>>> cr, cc
(14.5, 14.5)
doc_scikit_image
2017-01-12 17:22:27
Comments
Leave a Comment

Please login to continue.