imageutil.py 文件源码

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

项目:nuts-ml 作者: maet3608 项目源码 文件源码
def resize(image, w, h, **kwargs):
    """
    Resize image.

    Image can be up- or down-sized (using interpolation). For details see:
    http://scikit-image.org/docs/dev/api/skimage.transform.html#skimage.transform.resize

    >>> image = np.ones((10,5), dtype='uint8')
    >>> resize(image, 4, 3)
    array([[1, 1, 1, 1],
           [1, 1, 1, 1],
           [1, 1, 1, 1]], dtype=uint8)

    :param numpy array image: Numpy array with range [0,255] and dtype 'uint8'.
    :param int w: Width in pixels.
    :param int h: Height in pixels.
    :param kwargs kwargs: Keyword arguments for the underlying scikit-image
       resize function, e.g. order=1 for linear interpolation.
    :return: Resized image
    :rtype: numpy array with range [0,255] and dtype 'uint8'
    """
    set_default_order(kwargs)
    return skt.resize(image, (h, w), mode='constant',
                      preserve_range=True, **kwargs).astype('uint8')
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号