utils.py 文件源码

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

项目:PIC 作者: ameroyer 项目源码 文件源码
def lab_to_rgb(x, eps=1e-8):
    """Converts a lab image [0; 100] [-127; 128] [-128; 127] to a valid RGB image."""
    x_rectified = np.array(x)
    upper_bound = 200 * (x[..., 0] + 16.) / 116. - eps
    x_rectified[..., 2] = np.clip(x_rectified[..., 2], - float('inf'), upper_bound)
    return np.array([lab2rgb(y) * 255. for y in x_rectified]).astype(np.uint8)
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号