Image Rotation

Matlab imrotate function

B = IMROTATE(A,ANGLE,'method') rotates the image A by ANGLE degrees. The image returned B will, in general, be larger than A. Invalid values on the periphery are set to one for indexed images or zero for all other image types. Possible interpolation methods are 'nearest' (nearest neighbor), 'bilinear' or 'bicubic'. 'nearest' is the default for all images. For indexed images, only nearest-neighbor interpolation should be used.

B = IMROTATE(A,ANGLE,'crop') or IMROTATE(A,ANGLE,'method','crop') crops B to be the same size as A.

reference: imrotate.m

Matlab example

>> img = imread('pens.tif');
>> whos
  Name      Size         Bytes  Class

  img     480x512x3     737280  uint8 array

>> z1 = imresize(img,1/3.0,'bicubic');
>> imshow(z1);
>> tiffwrite(z1,'pens1.tif');

>> z2 = imrotate(z1,30);
>> imshow(z2);
>> tiffwrite(z2,'pens2.tif');


Maintained by John Loomis, last updated July 9, 1997