Learn R Programming

pavo (version 2.0.0)

getimg: Import image data

Description

Finds and imports PNG, JPEG, and/or BMP images.

Usage

getimg(imgpath = getwd(), subdir = FALSE, subdir.names = FALSE,
  max.size = 1, cores = getOption("mc.cores", 2L))

Arguments

imgpath

(required) either the full path to a given image (including extension), or the path to a folder in which multiple image files are located. Mixed file formats within a folder are accepted.

subdir

should subdirectories within the imgpath folder be included in the search? (defaults to FALSE).

subdir.names

should subdirectory path be included in the name of the images? (defaults to FALSE).

max.size

maximum size of all images to be allowed in memory, in GB. Defaults to 1.

cores

number of cores to be used in parallel processing. If 1, or if total image sizes exceed 200 mb in memory, parallel computing will not be used. Defaults to getOption("mc.cores", 2L). Not available on Windows.

Value

a image, or list of images, of class rimg, for use in further pavo functions.

Examples

Run this code
# NOT RUN {
# Single image
papilio <- getimg(system.file("testdata/images/papilio.png", package = 'pavo'))

# Multiple images
snakes <- getimg(system.file("testdata/images/snakes", package = 'pavo'))
# }
# NOT RUN {
# }

Run the code above in your browser using DataLab