im_resize

PURPOSE ^

IM_RESIZE - resize an image using bicubic interpolation

SYNOPSIS ^

function newimg = im_resize(img,nw,nh)

DESCRIPTION ^

IM_RESIZE - resize an image using bicubic interpolation

   NEWIMG = IM_RESIZE(IMG,NW,NH) Given input image IMG,
   returns a new image NEWIMG of size NWxNH.

 Matthew Dailey 2000

CROSS-REFERENCE INFORMATION ^

This function calls: This function is called by:

SOURCE CODE ^

0001 function newimg = im_resize(img,nw,nh)
0002 %IM_RESIZE - resize an image using bicubic interpolation
0003 %
0004 %   NEWIMG = IM_RESIZE(IMG,NW,NH) Given input image IMG,
0005 %   returns a new image NEWIMG of size NWxNH.
0006 %
0007 % Matthew Dailey 2000
0008 
0009   if nargin ~= 3
0010     error('usage: im_resize(image,new_wid,new_ht)');
0011   end;
0012   
0013   ht_scale = size(img,1) / nh;
0014   wid_scale = size(img,2) / nw;
0015   
0016   newimg = interp2(img,(1:nw)*wid_scale,(1:nh)'*ht_scale,'cubic');

Generated on Sun 29-Mar-2009 20:22:55 by m2html © 2003