imageToDataFrame: Convert an image's pixels to a data.frame of RGB values.

Description Usage Arguments Value Examples

Description

This function converts the channels of a raster image to a data.frame with red, green and blue columns. Each row of the data.frame represents one pixel in the image. Rows of the image can be accessed as ranges of rows in the data.frame.

This format is used by the palette and colour histogram functions.

Usage

1

Arguments

image

An RGB raster image.

Value

A data frame with columns named“red”,“green” and “blue”.

Examples

1
2
3
4
5
6
library(CulturalAnalytics)
library(jpeg)
imgdir<-paste(system.file(package = "CulturalAnalytics"), "images", sep = "/")
imgs<-paste(imgdir, dir(path = imgdir, pattern = ".jpg"), sep = "/")
img<-readJPEG(imgs[1])
rgbs<-imageToDataFrame(img)

CulturalAnalytics documentation built on May 2, 2019, 5:24 p.m.