Learn R Programming

recolorize (version 0.2.0)

readImage: Read in an image as a 3D array

Description

Reads in and processes an image as a 3D array. Extremely simple wrapper for imager::load.image(), but it strips the depth channel (resulting in a 3D, not 4D, array). This will probably change.

Usage

readImage(img_path, resize = NULL, rotate = NULL)

Value

A 3D RGB array (pixel rows x pixel columns x color channels). RGB channels are all scaled 0-1, not 0-255.

Arguments

img_path

Path to the image (a string).

resize

Fraction by which to reduce image size. Important for speed.

rotate

Number of degrees to rotate the image.

Examples

Run this code
corbetti <- system.file("extdata/corbetti.png", package = "recolorize")
img <- readImage(corbetti)
plotImageArray(img)

Run the code above in your browser using DataLab