extractChannel: Extract Single Channel from Image

View source: R/ImageClass.R

extractChannelR Documentation

Extract Single Channel from Image

Description

extractChannel extracts a single color channel from the source image.

Usage

extractChannel(image, channel, target = "new")

Arguments

image

An Image object.

channel

An integer specifying the index of the channel to extract.

target

The location where the results should be stored. It can take 2 values:

  • "new":a new Image object is created and the results are stored inside (the default).

  • An Image object:the results are stored in another existing Image object. This is fast and will not replace the content of image but will replace that of target. Note that if target does not have the same dimensions and bit depth as image, an error may be thrown. target should also be a single-channel Image object or an error will be thrown.

Value

If target="new", the function returns a single-channel Image object. If target is an Image object, the function returns nothing and modifies that Image object in place.

Author(s)

Simon Garnier, garnier@njit.edu

See Also

Image, split, merge

Examples

balloon <- image(system.file("sample_img/balloon1.png", package = "Rvision"))
extractChannel(balloon, 2)


swarm-lab/Rvision documentation built on Feb. 7, 2024, 4:59 a.m.