Image objects are pointers toward C++ objects
stored in memory. When copying an Image object using an
assignment operator, this creates a copy of the pointer, but not a copy of
the C++ object. Any operation on the copied Image object will
therefore result in a modification of the orginal Image object.
This function duplicates the original Image object instead,
allowing safe operations on it while maintaining the integrity of the
original Image object.
Arguments
- x
An
Imageobject.- 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, number of channels, and bit depth asimage, an error may be thrown.
Value
An Image object.
Author
Simon Garnier, garnier@njit.edu
Examples
balloon <- image(system.file("sample_img/balloon1.png", package = "Rvision"))
balloon_clone <- cloneImage(balloon)