machinevisiontoolbox.Image.Tile

classmethod Image.Tile(tiles, columns=4, sep=2, bgcolor=None)

Tile images into a grid

Parameters:
  • tiles (iterable of Image) – images to tile

  • columns (int, optional) – number of columns in the grid, defaults to 4

  • 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

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

  • ValueError – all images must have the same dtype

Returns:

grid of images

Return type:

Image instance

Construct a new image by tiling the input images into a grid.

Example:

  File "/opt/hostedtoolcache/Python/3.9.20/x64/lib/python3.9/site-packages/machinevisiontoolbox/ImageColor.py", line 164, in colorize
    raise ValueError(self.image, "Image must be greyscale")
ValueError: (array([[[0, 0, 0],
        [0, 0, 0],
        [0, 0, 0],
        ...,
        [0, 0, 0],
        [0, 0, 0],
        [0, 0, 0]],

       [[0, 0, 0],
        [0, 0, 0],
        [0, 0, 0],
        ...,
        [0, 0, 0],
        [0, 0, 0],
        [0, 0, 0]],

       [[0, 0, 0],
        [0, 0, 0],
        [0, 0, 0],
        ...,
        [0, 0, 0],
        [0, 0, 0],
        [0, 0, 0]],

       ...,

       [[0, 0, 0],
        [0, 0, 0],
        [0, 0, 0],
        ...,
        [0, 0, 0],
        [0, 0, 0],
        [0, 0, 0]],

       [[0, 0, 0],
        [0, 0, 0],
        [0, 0, 0],
        ...,
        [0, 0, 0],
        [0, 0, 0],
        [0, 0, 0]],

       [[0, 0, 0],
        [0, 0, 0],
        [0, 0, 0],
        ...,
        [0, 0, 0],
        [0, 0, 0],
        [0, 0, 0]]], dtype=uint8), 'Image must be greyscale')

(Source code)

Seealso:

Hstack Vstack