Image.var#

Image.var(**kwargs: Any) generic | ndarray[source]#

Variance of all pixels

Parameters:

kwargs (dict) – additional keyword arguments passed to numpy.nanvar

Returns:

variance value

Example:

>>> from machinevisiontoolbox import Image
>>> img = Image.Read('flowers1.png')
>>> img.var()  # variance over all planes
np.float64(4135.159775198259)
>>> img.var(axis=(0,1))  # per-plane variance
array([5527.2767, 2503.9762, 4305.1756])

Note

  • The return value type is the same as the image type.

  • NaN values are ignored

  • For axis remember the axes are in NumPy order: 0=rows, 1=columns, 2=planes.

Seealso:

stats hist std numpy.nanvar numnan