imager (version 0.45.8)

as.cimg: Convert to cimg object

Description

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.

Usage

as.cimg(obj, ...)

# S3 method for numeric as.cimg(obj, ...)

# S3 method for logical as.cimg(obj, ...)

# S3 method for double as.cimg(obj, ...)

# S3 method for cimg as.cimg(obj, ...)

# S3 method for vector as.cimg(obj, x = NA, y = NA, z = NA, cc = NA, dim = NULL, ...)

# S3 method for matrix as.cimg(obj, ...)

Arguments

obj

an object

...

optional arguments

x

width

y

height

z

depth

cc

spectrum

dim

a vector of dimensions (optional, use instead of xyzcc)

Methods (by class)

  • as.cimg(numeric): convert numeric

  • as.cimg(logical): convert logical

  • as.cimg(double): convert double

  • as.cimg(cimg): return object

  • as.cimg(vector): convert vector

  • as.cimg(matrix): Convert to matrix

Author

Simon Barthelme

See Also

as.cimg.array, as.cimg.function, as.cimg.data.frame

Examples

Run this code
cimg.limit.openmp()
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

Run the code above in your browser using DataLab