rotate.matrix: Image Rotation by Bilinear Interpolation

Description Usage Arguments Details Value See Also Examples

Description

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".

Usage

1
2
 
rotate.matrix(x, angle, method="bilinear")

Arguments

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.

Details

Assuming 8-bit grayscale image as an input.

Value

A matrix after rotation

See Also

rgb2gray

Examples

 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)

Example output



wvtool documentation built on May 1, 2019, 10:27 p.m.

Related to rotate.matrix in wvtool...