extractChannel extracts a single color channel from the
source image.
Arguments
- image
An
Imageobject.- 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
Imageobject is created and the results are stored inside (the default).- An
Imageobject: the results are stored in another existing
Imageobject. This is fast and will not replace the content ofimagebut will replace that oftarget. Note that iftargetdoes not have the same dimensions and bit depth asimage, an error may be thrown.targetshould also be a single-channelImageobject 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
Simon Garnier, garnier@njit.edu
Examples
balloon <- image(system.file("sample_img/balloon1.png", package = "Rvision"))
extractChannel(balloon, 2)
#> Class: image.
#> Dimensions: 640x360.
#> Type: GRAY, 1-channel, 8U.
#> GPU: FALSE.