Learn R Programming

Rvision (version 0.4.2)

changeColorSpace: Convert image between colorspaces

Description

This function takes an Image object and converts it to another colorspace (e.g BGR to grayscale).

Usage

changeColorSpace(image, colorspace, in_place = FALSE)

Arguments

image

An Image object.

colorspace

A string corresponding to the colorspace the image should be converted to. Options are "BGR" (Blue Green Red image), "BGRA" (BGR image with Alpha channel), and "GRAY" (grayscale image). Converting from a Bayer mosaic to BGR using the default algorithm is also possible with "BayerBG2BGR", "BayerGB2BGR", "BayerRG2BGR", or "BayerGR2BGR".

in_place

A logical indicating whether the change should be applied to the image itself (TRUE, faster but destructive) or to a copy of it (FALSE, the default, slower but non destructive).

Value

An Image object if in_place=FALSE. Otherwise, it returns nothing and modifies image in place.

See Also

Image

Examples

Run this code
# NOT RUN {
balloon <- image(system.file("sample_img/balloon1.png", package = "Rvision"))
grey_balloon <- changeColorSpace(balloon, "GRAY")

# }

Run the code above in your browser using DataLab