imtransform2

PURPOSE ^

Applies a general/special homography on an image I

SYNOPSIS ^

function IR = imtransform2( I, varargin )

DESCRIPTION ^

 Applies a general/special homography on an image I

 Takes the center of the image as the origin, not the top left corner.
 Also, the coordinate system is row/ column format, so H must be also.

 The bounding box of the image is set by the BBOX argument, a string that
 can be 'loose' (default) or 'crop'. When BBOX is 'loose', IR includes the
 whole transformed image, which generally is larger than I. When BBOX is
 'crop' IR is cropped to include only the central portion of the
 transformed image and is the same size as I.  Preserves I's type.

 USAGE
  IR = imtransform2( I, H, [method], [bbox], [show] )      % general hom
  IR = imtransform2( I, angle, [method], [bbox], [show] )  % rotation
  IR = imtransform2( I, dx, dy, [method], [bbox], [show] ) % translation

 INPUTS - common
  I       - 2D image [converted to double]
  method  - ['linear'] 'nearest', 'spline', 'cubic' (for interp2)
  bbox    - ['loose'] or 'crop'
  show    - [0] figure to use for optional display

 INPUTS - specific to general homography
  H       - 3x3 nonsingular homography matrix

 INPUTS - specific to rotation
  angle   - angle to rotate in degrees

 INPUTS - specific to translation
  dx      - x translation (right)
  dy      - y translation (up)

 OUTPUTS
  IR      - transformed image

 EXAMPLE - general homography
  load trees; I=X;
  R = rotationMatrix( pi/4 ); T = [1; 3]; H = [R T; 0 0 1];
  IR = imtransform2( I, H, [], 'crop', 1 );

 EXAMPLE - rotation
  load trees;
  tic; X1 = imrotate( X, 55, 'bicubic', 'crop' ); toc,
  tic; X2 = imtransform2( X, 55, 'bicubic', 'crop' ); toc
  clf;  subplot(2,2,1); im(X); subplot(2,2,2); im(X1-X2);
  subplot(2,2,3); im(X1); subplot(2,2,4); im(X2);

 EXAMPLE - translation
  load trees;
  XT = imtransform2(X,0,1.5,'bicubic','crop');
  figure(1); clf; im(X,[0 255]); figure(2); clf; im(XT,[0 255]);

 See also TEXTUREMAP, INTERP2

CROSS-REFERENCE INFORMATION ^

This function calls: This function is called by:
Generated on Wed 03-Oct-2007 13:09:09 by m2html © 2003