Learn R Programming

imager (version 0.45.8)

as.cimg.raster: Convert a raster object to a cimg object

Description

R's native object for representing images is a "raster". This function converts raster objects to cimg objects.

Usage

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

Value

a cimg object

Arguments

obj

a raster object

...

ignored

Author

Simon Barthelme

Examples

Run this code
cimg.limit.openmp()
rst <- as.raster(matrix((1:4)/4,2,2))
as.cimg(rst) %>% plot(int=FALSE)
all.equal(rst,as.raster(as.cimg(rst)))

Run the code above in your browser using DataLab