effects.py 文件源码

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

项目:py-noisemaker 作者: aayars 项目源码 文件源码
def pop(tensor, shape):
    """
    Pop art filter

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

    images = []

    freq = random.randint(1, 3) * 2

    ref = _downsample(resample(tensor, shape), shape, [int(shape[0] / (freq * 2)), int(shape[1] / (freq * 2)), shape[2]])

    for i in range(freq * freq):
        image = posterize(ref, random.randint(3, 6))
        image = image % tf.random_normal([3], mean=.5, stddev=.25)
        images.append(image)

    x, y = point_cloud(freq, distrib=PointDistribution.square, shape=shape, corners=True)

    out = voronoi(None, shape, diagram_type=VoronoiDiagramType.collage, xy=(x, y, len(x)), nth=random.randint(0, 3), collage_images=images, image_count=4)

    return outline(out, shape, sobel_func=1)
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号