machinevisiontoolbox.Image.npq

Image.npq(p, q)

Normalized central image moments

Parameters:
  • p (int) – u exponent

  • q (int) – v exponent

Returns:

moment

Type:

scalar

Computes the pq’th normalized central moment of the image:

\[\nu(I) = \frac{\mu_{pq}(I)}{m_{00}(I)} = \frac{1}{m_{00}(I)} \sum_{uv} I_{uv} (u-u_0)^p (v-v_0)^q\]

where \(u_0 = m_{10}(I) / m_{00}(I)\) and \(v_0 = m_{01}(I) / m_{00}(I)\).

Example:

>>> from machinevisiontoolbox import Image
>>> img = Image.Read('shark1.png')
>>> img.npq(2, 2)
1.1596991128539826e-07
Note:
  • The normalized central moments are invariant to translation and scale.

  • Supports single channel images only.

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

Seealso:

sum mpq upq