Learn R Programming

imager (version 0.42.19)

as.cimg.array: Turn an numeric array into a cimg object

Description

If the array has two dimensions, we assume it's a grayscale image. If it has three dimensions we assume it's a video, unless the third dimension has a depth of 3, in which case we assume it's a colour image,

Usage

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

Arguments

obj

an array

...

ignored

Examples

Run this code
as.cimg(array(1:9,c(3,3)))
as.cimg(array(1,c(10,10,3))) #Guesses colour image
as.cimg(array(1:9,c(10,10,4))) #Guesses video

Run the code above in your browser using DataLab