image_to_mat: Convert an image to a data.frame

View source: R/utils_imagem.R

image_to_matR Documentation

Convert an image to a data.frame

Description

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(s)

Tiago Olivoto tiagoolivoto@gmail.com

Examples

library(pliman)
img <- image_pliman("sev_leaf.jpg")
dim(img)
mat <- image_to_mat(img)
dim(mat[[1]])

pliman documentation built on Oct. 15, 2023, 1:06 a.m.

Related to image_to_mat in pliman...