Image Processing Toolbox User's Guide Previous page   Next Page
imrotate

Rotate image

Syntax

Description

B = imrotate(A,angle) rotates image A by angle degrees in a counterclockwise direction around its center point. To rotate the image clockwise, specify a negative value for angle. imrotate makes the output image B large enough to contain the entire rotated image. imrotate uses nearest neighbor interpolation, setting the values of pixels in B that are outside the rotated image to 0 (zero).

B = imrotate(A,angle,method) rotates image A, using the interpolation method specified by method. method is a text string that can have one of these values. The default value is enclosed in braces ({}).

Value
Description
{'nearest'}
Nearest-neighbor interpolation
'bilinear'
Bilinear interpolation
'bicubic'
Bicubic interpolation
Note: Bicubic interpolation can produce pixel values outside the original range.

B = imrotate(A,angle,method,bbox) rotates image A, where bbox specifies the size of the returned image. bbox is a text string that can have one of the following values. The default value is enclosed in braces ({}).

Value
Description
'crop'
Make output image B the same size as the input image A, cropping the rotated image to fit
{'loose'}
Make output image B large enough to contain the entire rotated image. B is generally larger than A.

Class Support

The input image can be numeric or logical. The output image is of the same class as the input image.

Example

This example reads solar spectra image, stored in FITS format, and rotates the the image to bring it into horizontal alignment. A rotation of -1 degree is all that is required.

See Also

imcrop, imresize, imtransform, tformarray


Previous page  imresize imscrollpanel Next page

© 1994-2005 The MathWorks, Inc.