rotate: Image Rotation In 90-Degree Increments

View source: R/transform.R

rotateR Documentation

Image Rotation In 90-Degree Increments

Description

rotate rotates an image in multiples of 90 degrees.

Usage

rotate(image, rotation = "CLOCKWISE", target = "new")

Arguments

image

An Image object.

rotation

A character string indicating the desired rotation:

  • "CLOCKWISE" (default):rotate by 90 degrees clockwise.

  • "COUNTER":rotate by 90 degrees counterclockwise.

  • "180":rotate by 180 degrees.

target

The location where the results should be stored. It can take 3 values:

  • "new":a new Image object is created and the results are stored inside (the default).

  • An Image object:the results are stored in another existing Image object. This is fast and will not replace the content of image but will replace that of target. Note that target must have the same bit depth and number of channels as image. The dimensions must be the same if rotation="CLOCKWISE", or inverted if rotation="CLOCKWISE" or rotation="COUNTER".

Value

If target="new", the function returns an Image object. If target is an Image object, the function returns nothing and modifies that Image object in place.

Author(s)

Simon Garnier, garnier@njit.edu

See Also

rotateScale

Examples

img <- image(system.file("sample_img/balloon1.png", package = "Rvision"))
img_rotated <- rotate(img)


swarm-lab/Rvision documentation built on Feb. 7, 2024, 4:59 a.m.