machinevisiontoolbox.Image.var

Image.var(*args, **kwargs)[source]

Variance of all pixels

Parameters:
  • args – additional positional arguments to numpy.var

  • kwargs – additional keyword arguments to numpy.var

Returns:

variance value

Example:

>>> from machinevisiontoolbox import Image
>>> img = Image.Read('flowers1.png')
>>> img.var()
64.30520799436279
>>> img = Image.Read('flowers1.png', dtype='float32')
>>> img.var()
0.25217727
Note:
  • The return value type is the same as the image type.

  • By default the result is a scalar computed over all pixels, if the axis option is given the results is a 1D or 2D NumPy array.

Seealso:

numpy.var