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

(numeric): Rotation angle value in degrees, counter-clockwise.

translate

(integer vector of length 2): Horizontal and vertical translations (post-rotation translation).

scale

(numeric): Overall scale.

shear

(numeric vector or numeric): Shear angle value in degrees between -180 to 180, clockwise direction. If a numeric vector 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

(integer 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

(numeric vector of length 2, optional): Optional center of rotation, c(x, y). Default is image center.