utils.py 文件源码

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

项目:Texture-Synthesis 作者: mohamedkeid 项目源码 文件源码
def load_image(path):
    # Load image [height, width, depth]
    img = skimage.io.imread(path) / 255.0
    assert (0 <= img).all() and (img <= 1.0).all()

    # Crop image from center
    short_edge = min(img.shape[:2])
    yy = int((img.shape[0] - short_edge) / 2)
    xx = int((img.shape[1] - short_edge) / 2)
    shape = list(img.shape)

    crop_img = img[yy: yy + short_edge, xx: xx + short_edge]
    resized_img = skimage.transform.resize(crop_img, (shape[0], shape[1]))
    return resized_img, shape


# Return a resized numpy array of an image specified by its path
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号