Image.mpq#

Image.mpq(p: int, q: int) float[source]#

Image moments

Parameters:
  • p (int) – u exponent

  • q (int) – v exponent

Returns:

moment

Type:

scalar

Computes the pq’th moment of the image:

\[m(I) = \sum_{uv} I_{uv} u^p v^q\]

Example:

>>> from machinevisiontoolbox import Image
>>> img = Image.Read('shark1.png')
>>> img.mpq(1, 0)
np.int64(341888955)

Note

  • Supports single channel images only.

  • mpq(0, 0) is the same as sum() but less efficient.

References:
Seealso:

sum npq upq