COPY_PASTE_CVIP

copy_paste_cvip() - Copy a subimage from one image and paste to the same or another image.

Contents

SYNTAX

outImage = copy_paste_cvip( srcImage, destImage, startLocs, sizeSubimg, destLocs, transparent)

Input Parameters include :

Output Parameter includes :

DESCRIPTION

The function copies a subimage from the sourceImage and pastes it to the destinationImage.It is designed for the cross-image copy-paste,but it also works for copy-paste within the same image,which is indicated by making srcImage == destImage.If the subimage is too large,the size will be adjusted automatically so the subimage can be successfully copied from the srcImage and pasted to the destImage. If srcImage is 1-band image and destImage is 3-band image,then srcImage is made as 3-band image by copying same band information to other bands before pasting to destImage.In other case,if srcImage is 3-band image and destImage is 1-band image,only first band of scrImage is pasted to destImage.

REFERENCE

1. Scott E Umbaugh. DIGITAL IMAGE PROCESSING AND ANALYSIS: Applications with MATLAB and CVIPtools, 3rd Edition.

EXAMPLE

% Read image

 I1 = imread('cam.bmp');          %source image

 I2 = imread('butterfly.tif');   %destination image

% Start locs

 start_locs = [10 5];

% size sub image

 size_subimage = [150 200];

% Destination locs

 dest_locs = [64 64];

% transparent

 transparent = 1;

% call function

 O = copy_paste_cvip( I1, I2,start_locs,size_subimage,dest_locs,transparent);

% Display input image

 figure;imshow(I1);title('Input Image1');

 figure;imshow(I2);title('Input Image2');

% Display output image

figure; imshow(O);title('Output Image');

CREDITS

Author: Norsang Lama, April 2017
Copyright © 2017-2018 Scott E Umbaugh
For updates visit CVIP Toolbox Website