x,y = np.random.multivariate_normal(mean, cov, 9000000).T
x = x + center_x
y = y + center_y
heatmap, xedges, yedges = np.histogram2d(x, y, bins=(640, 480), range=[[0, 640], [0, 480]])
extent = [0, 640, 0, 480]
# convert heatmap to image
heatmap = heatmap / max(heatmap.flatten())
print max(heatmap.flatten())
heatmap_im = Image.fromarray(np.uint8(cm.jet(np.transpose(heatmap))*255))
blend_im = Image.blend(im.convert("RGBA"), heatmap_im, 0.4)
blend_im.save("blend.png", "PNG")
No comments:
Post a Comment