tf_utils.py 文件源码

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

项目:mv3d 作者: lmb-freiburg 项目源码 文件源码
def save_images(images, size, image_path, color=True):
    h, w = images.shape[1], images.shape[2]
    if color is True:
        img = np.zeros((h * size[0], w * size[1], 3))
    else:
        img = np.zeros((h * size[0], w * size[1]))

    for idx, image in enumerate(images):
        i = idx % size[1]
        j = math.floor(idx / size[1])
        if color is True:
            img[j*h:j*h+h, i*w:i*w+w, :] = image
        else:
            img[j*h:j*h+h, i*w:i*w+w] = image
    if color is True:
        scipy.misc.toimage(rescale_image(img),
                           cmin=0, cmax=255).save(image_path)
    else:
        scipy.misc.toimage(rescale_dm(img), cmin=0, cmax=65535,
                           low=0, high=65535, mode='I').save(image_path)
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号