This function computes the weighted sum of two
Image objects.
Usage
addWeighted(e1, e2, weight = c(0.5, 0.5), target = "new")Arguments
- e1
An
Imageobject.- e2
An
Imageobject.- weight
A 2-element vector of the respective weight of each image (default: c(0.5, 0.5)). If the two weights do not add up to 1, they will be rescaled accordingly.
- target
The location where the results should be stored. It can take 3 values:
- "new":
a new
Imageobject is created and the results are stored inside (the default).- "self":
the results are stored back into
e1(faster but destructive).- An
Imageobject: the results are stored in another existing
Imageobject. This is fast and will not replace the content ofe1but will replace that oftarget. Note that iftargetdoes not have the same dimensions, number of channels, and bit depth ase1, nothing will be stored.
Value
If target="new", the function returns an Image
object. If target="self", the function returns nothing and modifies
e1 in place. If target is an Image object,
the function returns nothing and modifies that Image object in
place.
Author
Simon Garnier, garnier@njit.edu
Examples
balloon1 <- image(system.file("sample_img/balloon1.png", package = "Rvision"))
balloon2 <- image(system.file("sample_img/balloon2.png", package = "Rvision"))
balloon_weighted <- addWeighted(balloon1, balloon2)