bundles / skimage 0.26.1rc0.dev0+git20260530.b607368ff / skimage / measure / _moments / moments
function
skimage.measure._moments:moments
source: /dev/scikit-image/src/skimage/measure/_moments.py :154
Signature
def moments ( image , order = 3 , * , spacing = None ) Summary
Calculate all raw image moments up to a certain order.
Extended Summary
The following properties can be calculated from raw image moments:
Area as:
M[0, 0].Centroid as: {
M[1, 0] / M[0, 0],M[0, 1] / M[0, 0]}.
Note that raw moments are neither translation, scale nor rotation invariant.
Parameters
image: (N[, ...]) double or uint8 arrayRasterized shape as image.
order: int, optionalMaximum order of moments. Default is 3.
spacing: tuple of float, shape (ndim,)The pixel spacing along each axis of the image.
Returns
m: (``order + 1``, ``order + 1``) arrayRaw image moments.
Examples
image = np.zeros((20, 20), dtype=np.float64) image[13:17, 13:17] = 1 M = moments(image) centroid = (M[1, 0] / M[0, 0], M[0, 1] / M[0, 0])✓
centroid
✗Aliases
-
skimage.measure.moments