Skip to contents

concatenate concatenates two images into one, either vertically or horizontally.

Usage

concatenate(image1, image2, direction = "vertical", target = "new")

Arguments

image1, image2

Image objects with the same bitdepth and number of channels, and either the same width (if direction = "vertical") or the same height (if direction = "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 of image but will replace that of target. Note that target must have the same bitdepth and number of channels as image1 and image2. If direction = "vertical", the height of target must be the sum of the heights of image1 and image2. If direction = "horizontal", the width of target must be the sum of the widths of image1 and image2.

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.

See also

Author

Simon Garnier, garnier@njit.edu

Examples

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