effects.py 文件源码

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

项目:py-noisemaker 作者: aayars 项目源码 文件源码
def bloom(tensor, shape, alpha=.5):
    """
    Bloom effect

    :param Tensor tensor:
    :param list[int] shape:
    :param float alpha:
    """

    height, width, channels = shape

    blurred = tf.maximum(tensor * 2.0 - 1.0, 0.0)
    blurred = _downsample(blurred, shape, [max(int(height * .01), 1), max(int(width * .01), 1), channels]) * 4.0
    blurred = resample(blurred, shape)
    blurred = offset(blurred, shape, x=int(shape[1] * -.05), y=int(shape[0] * -.05))

    return blend(tensor, normalize(tensor + blurred), alpha)
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号