如何在基础图像上叠加热图? [英] how to superimpose heatmap on a base image?

查看:572
本文介绍了如何在基础图像上叠加热图?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

请查看此

我可以为网络创建一个热图,其大小与输入的大小相同,但无法叠加它们.热图形状为(800,800),基本图像形状为(800,800,3)

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)

推荐答案

您可以使用OpenCV中提供的功能cv2.addweighted()在图像上叠加热图.

You can superimpose your heatmap on the image using the function cv2.addweighted() available in OpenCV.

这是一个例子

img = cv2.imread('Sample.jpg', 1)
gray_img = cv2.cvtColor(img, cv2.COLOR_BGR2GRAY)

heatmap_img = cv2.applyColorMap(gray_img, cv2.COLORMAP_JET)

现在,如果要将其叠加在原始图像上,则可以使用cv2.addweighted()函数

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.

这篇关于如何在基础图像上叠加热图?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆