| Image Processing Toolbox™ | ![]() |
B = imrotate(A,angle)
B = imrotate(A,angle,method)
B = imrotate(A,angle,method,bbox)
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 |
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. |
The input image can be numeric or logical. The output image is of the same class as the input image.
Read a solar spectra image, stored in FITS format, and rotate the image to bring it into horizontal alignment. A rotation of -1 degree is all that is required.
I = fitsread('solarspectra.fts');
I = mat2gray(I);
J = imrotate(I,-1,'bilinear','crop');
figure, imshow(I)
figure, imshow(J)

imcrop, imresize, imtransform, tformarray
![]() | imroi | imsave | ![]() |
| © 1984-2008- The MathWorks, Inc. - Site Help - Patents - Trademarks - Privacy Policy - Preventing Piracy - RSS |