Skip to contents

Given an object image, converts it into a data frame where each row corresponds to the intensity values of each pixel in the image.

Usage

image_to_mat(img, parallel = FALSE, workers = NULL, verbose = TRUE)

Arguments

img

An image object.

parallel

Processes the images asynchronously (in parallel) in separate R sessions running in the background on the same machine. It may speed up the processing time when image is a list. The number of sections is set up to 70% of available cores.

workers

A positive numeric scalar or a function specifying the maximum number of parallel processes that can be active at the same time.

verbose

If TRUE (default) a summary is shown in the console.

Value

A list containing three matrices (R, G, and B), and a data frame containing four columns: the name of the image in image and the R, G, B values.

Author

Tiago Olivoto tiagoolivoto@gmail.com

Examples

library(pliman)
img <- image_pliman("sev_leaf.jpg")
dim(img)
#> [1] 490 557   3
mat <- image_to_mat(img)
dim(mat[[1]])
#> NULL