imageutil.py 文件源码

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

项目:nuts-ml 作者: maet3608 项目源码 文件源码
def save_image(filepath, image):
    """
    Save numpy array as image (or numpy array) to given filepath.

    Supported formats: gif, png, jpg, bmp, tif, npy

    :param string filepath: File path for image file. Extension determines
        image file format, e.g. .gif
    :param numpy array image: Numpy array to save as image.
        Must be of shape (h,w) or (h,w,3) or (h,w,4)
    """
    if filepath.endswith('.npy'):  # image as numpy array
        np.save(filepath, image, allow_pickle=False)
    else:
        ski.imsave(filepath, image)
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号