machinevisiontoolbox.Image.mpq

Image.mpq(p, q)

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)
341888955
Note:
  • Supports single channel images only.

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

References:
  • Robotics, Vision & Control for Python, Section 12.1.3.4, P. Corke, Springer 2023.

Seealso:

sum npq upq