Description Usage Arguments Value Examples
Discrete observations on one image are fit with a set of smooth curves, each defined by an expansion in terms of user-selected basis functions. The fitting criterion is least squares.
1 | smooth.2dbasis(s, u, y, e, f)
|
s |
a set of argument values corresponding to the observations in the rows of the matrix y. |
u |
a set of argument values corresponding to the observations in the columns of the matrix y. |
y |
the matrix of observed values corresponding s nad u. |
e |
a functional data basis object for the first argument s of the bivariate function. |
f |
a functional data basis object for the second argument t of the bivariate function. |
A 2d-functional object of class 'bifd'.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 | require(imager)
im <- as.cimg(function(x,y)
sin(x/16)+cos(y/16),128,128)
plot(im)
y <- im %>% as.matrix
m <- nrow(y)
n <- ncol(y)
p<-9
q<-9
e <- create.bspline.basis(c(0,1),p)
f <- create.bspline.basis(c(0,1),q)
u <- seq(0,1,length.out= n)
s <- seq(0,1,length.out= m)
x <- smooth.2dbasis(s,u,y,e,f)
y_hat <- eval.bifd(s,u,x)
sqrt(sum((y-y_hat)^2))
im_hat <- as.cimg(y_hat)
par(mfrow=c(1,2))
plot(im,main="True image")
plot(im_hat,main="Smoothed image")
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.