Utilities#

kornia.image.make_grid(tensor, n_row=None, padding=2)[source]#

Convert a batched tensor to one image with padding in between.

Parameters:
  • tensor (Tensor) – A batched tensor of shape (B, C, H, W).

  • n_row (Optional[int], optional) – Number of images displayed in each row of the grid. Default: None

  • padding (int, optional) – The amount of padding to add between images. Default: 2

Returns:

The combined image grid.

Return type:

torch.Tensor

kornia.image.perform_keep_shape_image(f)[source]#

Apply f to an image of arbitrary leading dimensions (*, C, H, W).

It works by first viewing the image as (B, C, H, W), applying the function and re-viewing the image as original shape.

Return type:

Callable[..., Tensor]

kornia.image.perform_keep_shape_video(f)[source]#

Apply f to an image of arbitrary leading dimensions (*, C, D, H, W).

It works by first viewing the image as (B, C, D, H, W), applying the function and re-viewing the image as original shape.

Return type:

Callable[..., Tensor]