bilinearInterpolator: A function to perform bilinar interpolation

Description Usage Arguments Value Author(s) See Also Examples

View source: R/bilinearInterpolator.R

Description

This function is just a wrapper to the interp.surface.grid function to perform bilinar interpolation of a regular matrix.

Usage

1
bilinearInterpolator(oldMatrix, pointsInNewX, pointsInNewY)

Arguments

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

Value

It returns an interpolated matrix. The size of the new matrix is pointsInNewX rows and pointsInNewY columns.

Author(s)

Alberto Krone-Martins

See Also

interp.surface.grid

Examples

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

RsimMosaic documentation built on May 2, 2019, 7:29 a.m.