Please look at this github page. I want to generate heat maps in this way using Python PIL,open cv or matplotlib library. Can somebody help me figure it out?
I could create a heat map for my network at the same size as the input, but I am not able superimpose them. The heatmap shape is (800,800) and the base image shape is (800,800,3)
You can superimpose your heatmap on the image using the function cv2.addweighted()
available in OpenCV.
Here is an example
img = cv2.imread('Sample.jpg', 1)
gray_img = cv2.cvtColor(img, cv2.COLOR_BGR2GRAY)
heatmap_img = cv2.applyColorMap(gray_img, cv2.COLORMAP_JET)
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)
You can vary the weight parameters in the function for both the images.