Image.planes#

Image.planes(copy: bool = False) β†’ Iterator[Image][source][source]#

Iterator for image planes

Parameters:

copy (bool, optional) – if True each plane is an independent, C-contiguous copy, otherwise it is a view that shares its pixels with the image, defaults to False

Return out:

image containing a single plane

Return type:

Image

Iterator that returns sequential image planes.

Note

By default each plane is a view that shares its pixels with the image, and is not C-contiguous. Use copy=True for planes that can be drawn into, or changed without changing the image. See plane.

Changed in version 2.5.0: Added the copy option.

Examples

>>> from machinevisiontoolbox import Image
>>> img = Image.Read("flowers4.png") # in RGB order
>>> for plane in img.planes():
...     print(plane)
Image: 640 x 426 (uint8), 1 anonymous plane
  span=[0, 255]; mean=97.9412, 𝜎=56.7939; median=91
Image: 640 x 426 (uint8), 1 anonymous plane
  span=[0, 255]; mean=103.689, 𝜎=54.6656; median=101
Image: 640 x 426 (uint8), 1 anonymous plane
  span=[0, 255]; mean=43.2257, 𝜎=43.1836; median=35

See also

plane __getitem__