as.cimg | R Documentation |
Imager implements various converters that turn your data into cimg objects. If you convert from a vector (which only has a length, and no dimension), either specify dimensions explicitly or some guesswork will be involved. See examples for clarifications.
as.cimg(obj, ...) ## S3 method for class 'numeric' as.cimg(obj, ...) ## S3 method for class 'logical' as.cimg(obj, ...) ## S3 method for class 'double' as.cimg(obj, ...) ## S3 method for class 'cimg' as.cimg(obj, ...) ## S3 method for class 'vector' as.cimg(obj, x = NA, y = NA, z = NA, cc = NA, dim = NULL, ...) ## S3 method for class 'matrix' as.cimg(obj, ...)
obj |
an object |
... |
optional arguments |
x |
width |
y |
height |
z |
depth |
cc |
spectrum |
dim |
a vector of dimensions (optional, use instead of xyzcc) |
numeric
: convert numeric
logical
: convert logical
double
: convert double
cimg
: return object
vector
: convert vector
matrix
: Convert to matrix
Simon Barthelme
as.cimg.array, as.cimg.function, as.cimg.data.frame
as.cimg(1:100,x=10,y=10) #10x10, grayscale image as.cimg(rep(1:100,3),x=10,y=10,cc=3) #10x10 RGB as.cimg(1:100,dim=c(10,10,1,1)) as.cimg(1:100) #Guesses dimensions, warning is issued as.cimg(rep(1:100,3)) #Guesses dimensions, warning is issued
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.