machinevisiontoolbox.Image.nplanes

property Image.nplanes

Number of color planes

Returns:

Number of color planes

Return type:

int

For a 2D or greyscale image this is one, otherwise it is the third dimension of the image.

Example:

>>> from machinevisiontoolbox import Image
>>> img = Image.Read('street.png')
>>> img.nplanes
1
>>> img = Image.Read('flowers1.png')
>>> img.nplanes
3
Note:

A greyscale image is stored internally as a 2D NumPy array which has zero planes, but nplanes will return ` in that case.

Seealso:

shape ndim