Code covered by the BSD License  

Highlights from
imagepatch

  • ... IMAGEPATCH writes one image over another at location specified by offset.
  • View all files

5.0

5.0 | 1 rating Rate this file 6 Downloads (last 30 days) File Size: 2.75 KB File ID: #15518
image thumbnail

imagepatch

by DS

 

06 Jul 2007 (Updated 06 Jul 2007)

Paste one image over another with an offset, expanding first image as necessary.

| Watch this File

File Information
Description

Simple function to write one image matrix over another using a given "origin" pixel and an offset vector. If the pasted image extends beyond the bounds of the base image, the base image is padded using the built-in function PADARRAY.

I = imagepatch(image1,image2,...
[originx originy],[offsetx offsety]) returns a new image containing image1 overwritten by image 2 at the location
specified by the offset and origin coordinates.

[I origin] = imagepatch(im1,im2,...
[origin_x origin_y],[offset_x offset_y])
returns a new image, I, and a vector, origin, containing the pixel coordinates corresponding to the origin in the new image.

I = imagepatch(im1,im2,...
[origin_x origin_y],...
[offset_x offset_y],padval)
returns a new image, where padval specifies the padding value used by
PADARRAY if it is necessary to expand im1 to accomodate im2 at the offset
coordinates.

Example:
moon = imread('moon.tif');
pout = imread('pout.tif');
%origin at center
origin = round(flipdim(...
size(moon),2)./2);
offset = [200 250];
imshow(...
imagepatch(moon,pout,origin,offset));

Acknowledgements
This submission has inspired the following:
Patchwork
Required Products Image Processing Toolbox
MATLAB release MATLAB 7.0.4 (R14SP2)
Tags for This File  
Everyone's Tags
Tags I've Applied
Add New Tags Please login to tag files.
Comments and Ratings (1)
01 May 2010 Ulrich

useful, thanks

Please login to add a comment or rating.
Tag Activity for this File
Tag Applied By Date/Time
image paste write DS 22 Oct 2008 09:18:38
image patch Ulrich 01 May 2010 11:03:03
combine images Ulrich 01 May 2010 11:03:13

Contact us at files@mathworks.com