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)
评论列表
文章目录