borders#

borders(shape, thickness: int = 1, mode: Literal['edges', 'faces', 'corners'] = 'edges')[source]#

Creates an array of specified size with corners, edges or faces labelled as True.

This can be used as mask to manipulate values laying on the perimeter of an image.

Parameters:
  • shape (array_like) – The shape of the array to return. Can be either 2D or 3D.

  • thickness (scalar (default is 1)) – The number of pixels/voxels layers to place along perimeter.

  • mode (string) – The type of border to create. Options are ‘faces’, ‘edges’ (default) and ‘corners’. In 2D ‘corners’ and ‘edges’ give the same result.

Returns:

image – An ndarray of specified shape with True values at the perimeter and False elsewhere

Return type:

ndarray

Examples

Click here to view online example.