Apply affine transformation on an image keeping image center invariant

transform_affine(
  img,
  angle,
  translate,
  scale,
  shear,
  interpolation = 0,
  fill = NULL,
  resample,
  fillcolor,
  center = NULL
)

Arguments

img

A magick-image, array or torch_tensor.

angle

(float or int): rotation angle value in degrees, counter-clockwise.

translate

(sequence of int) – 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

(int or character): Interpolation mode. Supported values are 0 / "nearest" and 2 / "bilinear". Default is 0.

fill

Fill color for area outside the transform. Default is NULL.

resample

Deprecated. Use interpolation instead.

fillcolor

Deprecated. Use fill instead.

center

Optional center of rotation, c(x, y). Default is image center.