www.gusucode.com > images 案例代码 matlab源码程序 > images/RotateImageClockwiseForBetterHorizontalAlignmentExample.m

    %% Rotate Image Clockwise for Better Horizontal Alignment
% 
%%
% Read image into the workspace.

% Copyright 2015 The MathWorks, Inc.

I = fitsread('solarspectra.fts');
%%
% Convert to grayscale.
I = mat2gray(I);
%%
% Rotate the image 1 degree clockwise to bring it into better
% horizontal alignment. The example specified bilinear interpolation and
% requests that the result be cropped to be the same size as the original
% image.
J = imrotate(I,-1,'bilinear','crop');
%%
% Display the original image and the rotated image.
figure
imshow(I)
title('Original Image')
figure
imshow(J)
title('Rotated Image')