Learn R Programming

imager (version 0.42.19)

as.data.frame.cimg: Convert a pixel image to a data.frame

Description

This function combines the output of pixel.grid with the actual values (stored in $value)

Usage

# S3 method for cimg
as.data.frame(x, ..., wide = c(FALSE, "c", "d"))

Value

a data.frame

Arguments

x

an image of class cimg

...

arguments passed to pixel.grid

wide

if "c" or "d" return a data.frame that is wide along colour or depth (for example with rgb values along columns). The default is FALSE, with each pixel forming a separate entry.

Author

Simon Barthelme

Examples

Run this code

#First five pixels
as.data.frame(boats) %>% head(5)
#Wide format along colour axis
as.data.frame(boats,wide="c") %>% head(5)

Run the code above in your browser using DataLab