| transpose {EBImage} | R Documentation |
Transposes an image by swapping its first two, i.e., spatial dimensions.
transpose(x, coerce = FALSE)
x |
an |
coerce |
controls the coercion of |
The transposition of an image is performed by swapping the X and Y indices of its array representation.
An Image object or an array, containing x with its XY dimensions transposed. When coerce = TRUE the output is coerced to an array.
transpose is particularly useful when converting between different representations of image data in which the X and Y dimensions are swapped. Typically, in such context only the actual pixel data matters. For performance reasons it is best practice to issue the function directly on an Image object with coerce = TRUE rather than to extract its image data first and only then perform the transposition, or to transpose the Image object and coerce it to an array afterwards.
Andrzej Oles, andrzej.oles@embl.de, 2012
x = readImage(system.file("images", "lena-color.png", package="EBImage"))
y = transpose(x)
if (interactive()) {
display(x, title='Lena')
display(y, title='Transposed Lena')
}
## performing the transposition of an image twice should result in the original image
z = transpose(y)
identical(x, z)