unpad

unpad(im, pad_width)[source]

Remove padding from a previously padded image given original pad widths

Parameters
  • im (ndarray) – The padded image from which padding should be removed

  • pad_width (int or list of ints) – The amount of padding previously added to each axis. This should be the same as the values used to add original padding. Refer to numpy.pad documentation for more details.

Notes

A use case for this is when using skimage.morphology.skeletonize_3d to ensure that the skeleton extends beyond the edges of the image, but the padding should be subsequently removed.

Examples

Click here to view online example.