Affine#
- class deeptrack.augmentations.Affine(scale: PropertyLike[float] = 1, translate: PropertyLike[float | None] = None, translate_px: PropertyLike[float] = 0.0, rotate: PropertyLike[float] = 0.0, shear: PropertyLike[float] = 0.0, order: PropertyLike[int] = 1, cval: PropertyLike[float] = 0.0, mode: PropertyLike[str] = 'reflect', **kwargs)#
Bases:
AugmentationAugmenter to apply affine transformations to images.
Affine transformations include:
Translation
Scaling
Rotation
Shearing
Some transformations involve interpolations between several pixels of the input image to generate output pixel values. The parameter order deals with the method of interpolation used for this.
Parameters#
- scale: float or tuple of floats or list of floats or dict
Scaling factor to use, where
1.0denotes “no change” and0.5is zoomed out to50percent of the original size. If two values are provided (using tuple, list, or dict), the two first dimensions of the input are scaled individually.- translate: float or tuple of floats or list of floats or dict
Translation in pixels.
- translate_px: float or tuple of floats or list of floats or dict
DEPRECATED, use translate.
- rotate: float
Rotation in radians, i.e. Rotation happens around the center of the image.
- shear: float
Shear in radians. Values in the range (-pi/4, pi/4) are common.
- order: int
Interpolation order to use. Same meaning as in
skimage:0:Nearest-neighbor1:Bi-linear(default)2:Bi-quadratic(not recommended by skimage)3:Bi-cubic4:Bi-quartic5:Bi-quintic
- cval: float
The constant intensity value used to fill in new pixels. This value is only used if mode is set to
constant.- mode: str
Parameter that defines newly created pixels. May take the same values as in
scipy.ndimage.affine_transform(), i.e.constant,nearest,reflectorwrap.
Methods#
- _process_properties(properties: dict) -> dict
Processes the properties of the image.
- get(image: Image | np.ndarray, scale: PropertyLike[float], translate: PropertyLike[float], rotate: PropertyLike[float], shear: PropertyLike[float], **kwargs) -> Image
Abstract method which performs the Affine augmentation.
Methods Summary
get(image, scale, translate, rotate, shear, ...)Abstract method which performs the Affine augmentation.
Methods Documentation