Image.Pstack#

classmethod Image.Pstack(images: Sequence[Image], colororder: str | dict[str, int] | None = None) Image[source][source]#

Concatenation of image planes

Parameters:
  • images (iterable of Image) – images to concatenate plane-wise

  • colororder (str, optional) – color order for the result, defaults to None

Raises:
  • ValueError – all images must have the same dtype

  • ValueError – all images must have the same size

Returns:

plane-stacked image

Return type:

Image

Create a new image by stacking the planes of the input images. All images must have the same width, height and dtype. The resulting image has a number of planes equal to the sum of planes in all input images.

If colororder is not specified and all images have color orders defined, the result’s color order is constructed by concatenating the color orders of the input images.

Example:

>>> from machinevisiontoolbox import Image
>>> r = Image.Random(size=(100, 120), colororder='R')
>>> g = Image.Random(size=(100, 120), colororder='G')
>>> b = Image.Random(size=(100, 120), colororder='B')
>>> rgb = Image.Pstack((r, g, b))
>>> rgb.nplanes
3
>>> rgb.colororder_str
'R:G:B'
Seealso:

Vstack Hstack

AUTO_EDIT