Загрузка
Apply affine transformation on the image keeping image center invariant. If the image is torch Tensor, it is expected to have […, H, W] shape, where … means an arbitrary number of leading dimensions.
img (PIL Image or Tensor) – image to transform.
angle (number) – rotation angle in degrees between -180 and 180, clockwise direction.
translate (sequence of python:integers) – horizontal and vertical translations (post-rotation translation)
scale (float) – overall scale
shear (float or sequence) – shear angle value in degrees between -180 to 180, clockwise direction. If a sequence is specified, the first value corresponds to a shear parallel to the x-axis, while the second value corresponds to a shear parallel to the y-axis.
interpolation (InterpolationMode) – Desired interpolation enum defined by
torchvision.transforms.InterpolationMode. Default is InterpolationMode.NEAREST.
If input is Tensor, only InterpolationMode.NEAREST, InterpolationMode.BILINEAR are supported.
The corresponding Pillow integer constants, e.g. PIL.Image.BILINEAR are accepted as well.
fill (sequence or number, optional) –
Pixel fill value for the area outside the transformed image. If given a number, the value is used for all bands respectively.
center (sequence, optional) – Optional center of rotation. Origin is the upper left corner. Default is the center of the image.
Transformed image.
PIL Image or Tensor
Examples using affine: