imager.replace: Replace part of an image with another

Description Usage Arguments Functions See Also Examples

Description

These replacement functions let you modify part of an image (for example, only the red channel). Note that cimg objects can also be treated as regular arrays and modified using the usual [] operator.

Usage

1
2
3
4
5
6
7
8
9
channel(x, ind) <- value

R(x) <- value

G(x) <- value

B(x) <- value

frame(x, ind) <- value

Arguments

x

an image to be modified

ind

an index

value

the image to insert

Functions

  • channel<-: Replace image channel

  • R<-: Replace red channel

  • G<-: Replace green channel

  • B<-: Replace blue channel

  • frame<-: Replace image frame

See Also

imdraw

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
boats.cp <- boats
#Set the green channel in the boats image to 0
G(boats.cp) <- 0
#Same thing, more verbose
channel(boats.cp,2) <- 0
#Replace the red channel with noise
R(boats.cp) <- imnoise(width(boats),height(boats))
#A new image with 5 frames
tmp <- imfill(10,10,5)
#Fill the third frame with noise
frame(tmp,3) <- imnoise(10,10)

imager documentation built on May 19, 2017, 7:04 p.m.

Search within the imager package
Search all R packages, documentation and source code

Questions? Problems? Suggestions? Tweet to @rdrrHQ or email at ian@mutexlabs.com.

Please suggest features or report bugs in the GitHub issue tracker.

All documentation is copyright its authors; we didn't write any of that.