mindspore/docs/api/api_python/dataset_vision/mindspore.dataset.vision.Ro...

28 lines
1.9 KiB
ReStructuredText
Raw Normal View History

mindspore.dataset.vision.Rotate
===============================
2022-02-12 10:34:53 +08:00
.. py:class:: mindspore.dataset.vision.Rotate(degrees, resample=Inter.NEAREST, expand=False, center=None, fill_value=0)
2022-02-12 10:34:53 +08:00
将输入图像旋转指定的度数。
2022-07-11 18:56:38 +08:00
参数:
- **degrees** (Union[int, float]) - 旋转角度。
- **resample** (Inter, 可选) - 插值方式。它可以是 [Inter.BILINEAR, Inter.NEAREST, Inter.BICUBIC] 中的任何一个默认值Inter.NEAREST。
- Inter.BILINEAR双线性插值。
- Inter.NEAREST最近邻插值。
- Inter.BICUBIC双三次插值。
- **expand** (bool, 可选) - 若为True将扩展图像尺寸大小使其足以容纳整个旋转图像若为False则保持图像尺寸大小不变。请注意扩展时将假设图像为中心旋转且未进行平移。默认值False。
- **center** (tuple, 可选) - 可选的旋转中心,以图像左上角为原点,旋转中心的位置按照 (宽度, 高度) 格式指定。默认值None表示中心旋转。
- **fill_value** (Union[int, tuple[int]], 可选) - 旋转图像之外区域的像素填充值。若输入3元素元组将分别用于填充R、G、B通道若输入整型将以该值填充RGB通道。 `fill_value` 值必须在 [0, 255] 范围内默认值0。
异常:
- **TypeError** - 当 `degrees` 的类型不为int或float。
- **TypeError** - 当 `resample` 的类型不为 :class:`mindspore.dataset.vision.Inter`
- **TypeError** - 当 `expand` 的类型不为bool。
- **TypeError** - 当 `center` 的类型不为tuple。
- **TypeError** - 当 `fill_value` 的类型不为int或tuple[int]。
- **ValueError** - 当 `fill_value` 取值不在[0, 255]范围内。
- **RuntimeError** - 当输入图像的shape不为<H, W>或<..., H, W, C>。