Description Usage Arguments Details Value See Also Examples
Three methods to execute rotation by 1) assuming values to destination, 2) obtaining values from the source image by inverse rotation with "nearest neighbor (NN)", 3) previous procedure together with "bilinear interpolation". The default is a rotation with "bilinear Interpolation".
1 2 |
rotate.matrix(x, angle, method="bilinear")
|
x |
A raster image or a matrix |
angle |
Plus(>0) value to request clockwise rotation, while minus for anticlockwise rotation. |
method |
"simple" assumes values to destination', "NN" obtains values from the source image by inverse rotation with "nearest neighbor", and "bilinear" performs the same but with "bilinear interpolation" of the source image. value to request clockwise rotation. |
Assuming 8-bit grayscale image as an input.
A matrix after rotation
rgb2gray
1 2 3 4 5 6 7 8 9 10 | data(camphora)
par(mfrow=c(2,2))
r1 <- rotate.matrix(camphora,15, method="simple")
image(rot90c(r1),asp=1,col=grey(c(0:255)/255), main= "simple",
useRaster=TRUE, axes=FALSE)
r2 <- rotate.matrix(camphora,25, method="NN")
image(rot90c(r2),asp=1,col=grey(c(0:255)/255), main="nearest neighbour", useRaster=TRUE, axes=FALSE)
r3 <- rotate.matrix(camphora,35, method="bilinear")
image(rot90c(r3),asp=1,col=grey(c(0:255)/255),main="bilinear interpolation",
useRaster=TRUE, axes=FALSE)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.