EBImage (version 4.14.2)

transpose: Image Transposition

Description

Transposes an image by swapping its first two, i.e., spatial dimensions.

Usage

transpose(x, coerce = FALSE)

Arguments

x
an Image object or an array.
coerce
controls the coercion of x. By default the output is of the same class as the input. If coerce = TRUE then x becomes coerced to an array.

Value

An Image object or an array, containing x with its XY dimensions transposed. When coerce = TRUE the output is coerced to an array.

Details

The transposition of an image is performed by swapping the X and Y indices of its array representation.

See Also

flip, flop, rotate

Examples

Run this code
  x = readImage(system.file("images", "sample-color.png", package="EBImage"))
  y = transpose(x)
  
  display(x, title='Original')
  display(y, title='Transposed')

  ## performing the transposition of an image twice should result in the original image
  z = transpose(y)
  identical(x, z)

Run the code above in your browser using DataLab