#
# evaluate an image object at a finer grid
#
data( lennon)
# create an example in the right list format like image or contour or persp.
obj<- list( x= 1:21, y=1:21, z= lennon[ 201:221, 201:221])
set.seed( 123)
# lots of random points
N<- 500
loc<- cbind( runif(N)*20, runif(N)*20)
z.new<- interp.surface( obj, loc)
# compare the image with bilinear interpolation at scattered points
set.panel(2,2)
image.plot( obj)
quilt.plot( loc, z.new)
# sample at 100X100 equally spaced points on a grid
grid.list<- list( x= seq( 1,20,,100), y= seq( 1,20,,100))
interp.surface.grid( obj, grid.list)-> look
# this will give an error in the FFT version because
# there are an even number of grid points for x.
# objTest<- list( x= 1:20, y=1:21, z= lennon[ 201:220, 201:221])
# look2<- interp.surface.FFT( objTest, M=10)
look2<- interp.surface.FFT( obj, M=20)-> look2
# take a look
set.panel(2,2)
image.plot( obj)
image.plot( look)
image.plot( look2)
Run the code above in your browser using DataLab