Main Content

imrotate.

旋转图像

描述

j= imrotate(一世角度旋转图像一世通过角度逆时针方向的程度围绕其中心点。要顺时针旋转图像,请指定负值角度imrotate.使输出图像j足够大以包含整个旋转图像。默认,imrotate.使用最近的邻插值,设置像素的值j在旋转图像之外0.

j= imrotate(一世角度方法旋转图像一世使用指定的插值方法方法

j= imrotate(一世角度方法bbox.also uses thebbox.argument to define the size of the output image. You can crop the output to the same size as the input image or return the entire rotated image.

例子

全部收缩

将图像读入工作区,并将其转换为灰度图像。

我= fitsread('solarspectra.fts');一世= rescale(I);

显示原始图像。

图imshow(i)标题('原始图像​​'

顺时针旋转图像1度以使其变为更好的水平对准。示例指定了双线性插值,并请求裁剪结果与原始图像相同。

j = imrootate(i,-1,'双线性''crop');

显示旋转图像。

数字imshow(j)标题('旋转图像'

输入参数

全部收缩

图像要旋转那specified as a numeric array, logical array, or categorical array.

数据类型:||INT8.|int16|int32|INT64.|uint8.|uint16|UINT32.|UINT64|逻辑|categorical

以度为单位的旋转量,指定为数字标量。

数据类型:||INT8.|int16|int32|INT64.|uint8.|uint16|UINT32.|UINT64|逻辑

插值方法,指定为以下值之一:

Value

描述

'最近'

最近邻的插值。输出像素被分配了该点在内部落入的像素的值。没有考虑其他像素。

Nearest-neighbor interpolation is the only method supported for categorical images.

'双线性'

双线性插值。输出像素值是最接近的2×2邻域的像素的加权平均值。

'bicubic'

双语插值。输出像素值是最接近的4×4附近的像素的加权平均值。

注意

Bicubic interpolation can produce pixel values outside the original range.

数据类型:char|

定义输出图像大小的边界框,指定为以下任一值:

Value

描述

'crop'

Make output imagej与输入图像相同的大小一世,裁剪旋转的图像以适合。

'loose'

Make output imagej足够大以包含整个旋转图像。j大于一世

数据类型:char|

输出参数

全部收缩

Rotated image, returned as a numeric, logical, or categorical array of the same data type as the input image,一世

Tips

  • This function changed in version 9.3 (R2015b). Previous versions of the Image Processing Toolbox™ use different spatial conventions. If you need the same results produced by the previous implementation, use the functionimrotate._old

  • 在某些情况下,此功能利用了数据类型的硬件优化uint8.uint16那and运行更快。

扩展能力

一世ntroduced before R2006a