as.rimg {pavo}R Documentation

Convert data to an rimg object

Description

Converts an array of RGB values, a cimg object, or a magick-image object, to an rimg object.

Usage

as.rimg(object, name = "img")

## Default S3 method:
as.rimg(object, name = "img")

## S3 method for class 'cimg'
as.rimg(object, name = "img")

is.rimg(object)

Arguments

object

(required) a three-dimensional array containing RGB values.

name

the name(s) of the image(s).

Value

an object of class rimg for use in further pavo functions

a logical value indicating whether the object is of class rimg

Author(s)

Thomas E. White thomas.white026@gmail.com

Hugo Gruson hugo.gruson+R@normalesup.org

Examples


# Generate some fake image data
fake <- array(c(
  as.matrix(rep(c(0.2, 0.4, 0.6), each = 250)),
  as.matrix(rep(c(0.4, 0.7, 0.8), each = 250)),
  as.matrix(rep(c(0.6, 0.1, 0.2), each = 250))
),
dim = c(750, 750, 3)
)

# Inspect it
head(fake)

# Determine if is an rimg object
is.rimg(fake)

# Convert to rimg object and check again
fake2 <- as.rimg(fake)
is.rimg(fake2)


[Package pavo version 2.9.0 Index]