You can superimpose your heatmap on the image using the function cv2.addweighted()
available in OpenCV.
Here is an example
Sample image:
img = cv2.imread('Sample.jpg', 1)
gray_img = cv2.cvtColor(img, cv2.COLOR_BGR2GRAY)
![enter image description here](https://i.stack.imgur.com/wL6s0.jpg)
Heatmap:
heatmap_img = cv2.applyColorMap(gray_img, cv2.COLORMAP_JET)
![enter image description here](https://i.stack.imgur.com/YfAxa.jpg)
Superimposed:
Now if you want to superimpose this on top of the original image, you can use cv2.addweighted()
function
fin = cv2.addWeighted(heatmap_img, 0.7, img, 0.3, 0)
![enter image description here](https://i.stack.imgur.com/oaz9i.jpg)
You can vary the weight parameters in the function for both the images.
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…