Image Processing Toolbox | ![]() ![]() |
Image Rotation
The imrotate
function rotates an image, using a specified interpolation method and rotation angle. If you do not specify an interpolation method, the function uses nearest neighbor interpolation.
You specify the rotation angle in degrees. If you specify a positive value, imrotate
rotates the image counterclockwise; if you specify a negative value, imrotate
rotates the image clockwise.
For example, these commands rotate an image 35° counterclockwise.
I = imread('ic.tif'); J = imrotate(I,35,'bilinear'); imshow(I) figure, imshow(J)
In order to include the entire original image, imrotate
pads the outside with 0's. This creates the black background in J
and results in the output image being larger than the input image.
imrotate
has an option for cropping the output image to the same size as the input image. See the reference page for imrotate
for more information.
![]() | Image Resizing | Image Cropping | ![]() |