我想在照片上添加预生成的热图。图像中的颜色并不重要,为了突出热图颜色,我将图像设为灰度。我已经使用
grey = cv2.cvtColor(img, cv2.COLOR_BGR2GRAY)
然而,与热图(BRG)相比,灰度图像现在的维度少了一个。如何将热图叠加在灰度图像之上?
最佳答案
在放置了两个相同大小和模式的图像后,执行以下代码。
from PIL import Images
im_1 = Image.open("/constr/pics1/100_canary.png")
# mode is RGBA
im_2 = Image.open("/constr/pics1/100_cockcrow.png")
# Check on mode, size and format first for compatibility.
# Make both modes the same
im_4 = Image.blend(im_1, im_2, 0.5)
im_4.show()
关于python - 向灰度图像添加颜色叠加,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/57624849/