unpad(im, pad_width)[source]#

Remove padding from a previously padded image given original pad widths

  • 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.


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.


Click here to view online example.