Rotate the image by angle

transform_random_rotation(
  img,
  degrees,
  interpolation = 0,
  expand = FALSE,
  center = NULL,
  fill = NULL,
  resample
)

Arguments

img

A magick-image, array or torch_tensor.

degrees

(numeric vector of length 2 or numeric): Range of degrees to select from. If degrees is a bare number instead of a numeric vector of length 2 like c(min, max), the range of degrees will be (-degrees, +degrees).

interpolation

(integer, optional): Interpolation mode. 0 for nearest, 2 for bilinear. Default is 0 (nearest).

expand

(logical, optional): Optional expansion flag. If TRUE, expands the output to make it large enough to hold the entire rotated image. If FALSE or omitted, make the output image the same size as the input image. Note that the expand flag assumes rotation around the center and no translation.

center

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

fill

(numeric vector or numeric): Pixel fill value for area outside the rotated image. If a single numeric value, the value is used for all channels. Defaults to 0 for all channels. This option is not supported for Tensor input. Fill value for the area outside the transform in the output image is always 0.

resample

Deprecated. Use interpolation instead.