如何使用 Python OpenCV 中的坐标在图像中绘制热图?

How to draw a Heatmap in a image using the coordinates in Python OpenCV?

我有一大堆走在街上的人的坐标 (x,y),我喜欢使用这些坐标 (x,y) 设计热图,即它应该看起来像 this. I want much hotter spot for multiple coordinates in a single spot, hotter means red colored spot. I've tried this but ended up getting a heatmap like this 不是我预期的那个,也不是一开始提到的网站(维基百科热图)。这是我试过的代码,

import cv2
import numpy as np
import matplotlib.pyplot as plt
import seaborn as sns
x,y = [230,150,200],[200,100,150]
plt.imshow(img)
ax = sns.kdeplot(x,y, cmap = "Blues", shade= True, shade_lowest=False)
ax.set_frame_on(False)
plt.axis('off')
plt.savefig('heatmap_pic.png')

此代码还使结果图像尺寸变小,而实际图像要大得多。我是 OpenCV 和 Matplotlib 的新手,有人请帮助我,使用一堆坐标在图像中绘制热图 (like this)。

您需要拍摄图像、创建热图并叠加它。
检查 this or this.