as.data.frame.cimg {imager}R Documentation

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 class 'cimg'
as.data.frame(x, ..., wide = c(FALSE, "c", "d"))

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.

Value

a data.frame

Author(s)

Simon Barthelme

Examples



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

[Package imager version 1.0.2 Index]