Description Usage Arguments Value Author(s) See Also Examples
View source: R/bilinearInterpolator.R
This function is just a wrapper to the interp.surface.grid
function to perform bilinar interpolation of a regular matrix.
1 | bilinearInterpolator(oldMatrix, pointsInNewX, pointsInNewY)
|
oldMatrix |
The original matrix. |
pointsInNewX |
The number of points in the new matrix (the number of new rows). |
pointsInNewY |
The number of points in the new matrix (the number of new columns). |
It returns an interpolated matrix. The size of the new matrix is pointsInNewX rows and pointsInNewY columns.
Alberto Krone-Martins
1 2 3 4 5 6 7 8 9 10 11 12 13 14 | library('jpeg')
# Read the R logo
logo <- readJPEG(system.file("img", "Rlogo.jpg", package="jpeg"))
# Create a scaled down version of the R channel
intrpArray <- array(dim=c(20, 20, 3))
intrpArray[,,1] <- bilinearInterpolator(logo[,,1], dim(intrpArray)[1], dim(intrpArray)[2])
# Display the results
dev.new()
image(logo[,,1], main="Original")
dev.new()
image(intrpArray[,,1], main="Scaled down")
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.