imageutil.py 文件源码

python
阅读 23 收藏 0 点赞 0 评论 0

项目:nuts-ml 作者: maet3608 项目源码 文件源码
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')
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号