def rotate(image, angle=0, **kwargs):
"""
Rotate image.
For details see:
http://scikit-image.org/docs/dev/api/skimage.transform.html#skimage.transform.rotate
For a smooth interpolation of images set 'order=1'. To rotate masks use
the default 'order=0'.
>>> image = np.eye(3, dtype='uint8')
>>> rotate(image, 90)
array([[0, 0, 1],
[0, 1, 0],
[1, 0, 0]], dtype=uint8)
:param numpy array image: Numpy array with range [0,255] and dtype 'uint8'.
:param float angle: Angle in degrees in counter-clockwise direction
:param kwargs kwargs: Keyword arguments for the underlying scikit-image
rotate function, e.g. order=1 for linear interpolation.
:return: Rotated image
:rtype: numpy array with range [0,255] and dtype 'uint8'
"""
set_default_order(kwargs)
return skt.rotate(image, angle, preserve_range=True,
**kwargs).astype('uint8')
评论列表
文章目录