insertObjectInImage
Syntax
Description
[
inserts an object from a source image, newImage,boundingBox,newMask] = insertObjectInImage(destinationImage,sourceImage,mask)sourceImage, into a destination
image, destinationImage. By default, the
insertObjectInImage function inserts an object from the source image into a
randomized location on the destination image. The function returns the result as an
augmented image, newImage, a bounding box,
boundingBox, and a corresponding object mask,
newMask.
Note
This functionality requires Deep Learning Toolbox™ and the Automated Visual Inspection Library for Computer Vision Toolbox™. You can install the Automated Visual Inspection Library for Computer Vision Toolbox from Add-On Explorer. For more information about installing add-ons, see Get and Manage Add-Ons.
[
specifies options using one or more name-value arguments, in addition to the input arguments
from the previous syntax. For example, newImage,boundingBox,newMask] = insertObjectInImage(___,Name=Value)BoundaryConstraintMode="inbounds"
specifies to insert objects only when they are completely within the destination
image.
Input Arguments
Name-Value Arguments
Output Arguments
References
[1] He, Kaiming, Jian Sun, and Xiaoou Tang. “Guided Image Filtering.” IEEE Transactions on Pattern Analysis and Machine Intelligence 35, no. 6 (June 2013): 1397–1409. https://doi:10.1109/TPAMI.2012.213.
[2] Pérez, Patrick, Michel Gangnet, and Andrew Blake. “Poisson Image Editing.” In ACM SIGGRAPH 2003 Papers, 313–18. San Diego California: ACM, 2003. https://doi:10.1145/1201775.882269.
Version History
Introduced in R2025a