Image.Vstack#

classmethod Image.Vstack(images: list[Any] | tuple[Any, ...], sep: int = 1, bgcolor: Any = None, return_offsets: bool = False) Any[source]#

Vertical concatenation of images

Parameters:
  • images (iterable of Image) – images to concatenate vertically

  • sep (int, optional) – separation between images, defaults to 1

  • bgcolor (scalar, string, array_like, optional) – color of background, seen in the separation between images, defaults to black

  • return_offsets (bool, optional) – additionally return the vertical coordinates of each input image within the output image, defaults to False

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

  • ValueError – all images must have the same color order

Returns:

vertically stacked images

Return type:

Image

Create a new image by stacking the input images vertically, with a horizontal separator line of width sep and color bgcolor.

The vertical coordinate of the first row of each image, in the composite output image, can be optionally returned if return_offsets is True.

Example:

>>> from machinevisiontoolbox import Image
>>> img = Image.Read('street.png')
>>> img
Image(size=(1280, 851), dtype=uint8, name='.../images/street.png')
>>> Image.Vstack((img, img, img))
Image(size=(1280, 2555), dtype=uint8)
>>> Image.Vstack((img, img, img), return_offsets=True)
(Image(size=(1280, 2555), dtype=uint8), [0, 852, 1704])

(Source code, png, hires.png, pdf)

../_images/machinevisiontoolbox-Image-Vstack-1.png
Seealso:

Hstack Pstack Tile