bundles / skimage 0.26.1rc0.dev0+git20260530.b607368ff / skimage / measure / _moments / moments_coords_central
function
skimage.measure._moments:moments_coords_central
source: /dev/scikit-image/src/skimage/measure/_moments.py :51
Signature
def moments_coords_central ( coords , center = None , order = 3 ) Summary
Calculate all central 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
coords: (N, D) double or uint8 arrayArray of N points that describe an image of D dimensionality in Cartesian space. A tuple of coordinates as returned by
np.nonzerois also accepted as input.center: tuple of float, optionalCoordinates of the image centroid. This will be computed if it is not provided.
order: int, optionalMaximum order of moments. Default is 3.
Returns
Mc: (``order + 1``, ``order + 1``, ...) arrayCentral image moments. (D dimensions)
Examples
coords = np.array([[row, col] for row in range(13, 17) for col in range(14, 18)]) moments_coords_central(coords)✓
coords2 = np.concatenate((coords, [[17, 17]]), axis=0) np.round(moments_coords_central(coords2), decimals=2) # doctest: +NORMALIZE_WHITESPACE✓
np.allclose(moments_coords(coords), moments_coords_central(coords, (0, 0)))⚠
Aliases
-
skimage.measure.moments_coords_central