Pad#

class deeptrack.augmentations.Pad(px: list[int] | tuple[int] = (0, 0, 0, 0), mode: PropertyLike[str] = 'constant', cval: PropertyLike[float] = 0, **kwargs)#

Bases: Augmentation

Pads an image by adding extra pixels along specified axes.

This augmentation uses numpy.pad internally but redefines pad_width as px, allowing padding along multiple axes (left, right, top, bottom, before_axis_3, after_axis_3, …).

Parameters#

pxlist of ints or tuple of ints

Amount of padding for each axis, specified as a tuple (left, right, top, bottom, etc.).

modestr

Padding mode, same as in numpy.pad.

cvalfloat

Value to fill in new pixels, same as in numpy.pad.

Methods#

get(image: Image | np.ndarray, px: PropertyLike[int], **kwargs) -> Image

Abstract method which performs the Pad augmentation.

_image_wrap_process_and_get(images: list[Image] | list[np.ndarray], **kwargs) -> list[Image]

Simple method which wraps an Image in a list.

Returns#

Image The padded image.

Methods Summary

get(image, px, **kwargs)

Abstract method which performs the Pad augmentation.

Methods Documentation

get(image: Image | np.ndarray, px: PropertyLike[int], **kwargs) Image#

Abstract method which performs the Pad augmentation.