concatenate
concatenates two images into one, either
vertically or horizontally.
Arguments
- image1, image2
Image
objects with the same bitdepth and number of channels, and either the same width (ifdirection = "vertical"
) or the same height (ifdirection = "horizontal"
).- direction
A character string indicating the direction of concatenation. It can be either
"vertical"
(the default) or"horizontal"
.- 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 ofimage
but will replace that oftarget
. Note thattarget
must have the same bitdepth and number of channels asimage1
andimage2
. Ifdirection = "vertical"
, the height oftarget
must be the sum of the heights ofimage1
andimage2
. Ifdirection = "horizontal"
, the width oftarget
must be the sum of the widths ofimage1
andimage2
.
Value
If target="new"
, the function returns an 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"))
two_balloons <- concatenate(balloon, balloon)