【发布时间】:2021-05-12 15:03:59
【问题描述】:
我想让我附加到图像的蒙版以某种方式透明。我有以下内容:
img_background[掩码]=[0,5,255]
我想让遮罩区域 ([0,5,255]) 透明。
【问题讨论】:
-
嗨,有趣,也许这可能是有趣的stackoverflow.com/questions/54082300/…
-
谢谢,我可以尝试使用 RGBA 图像而不是 RGB
我想让我附加到图像的蒙版以某种方式透明。我有以下内容:
img_background[掩码]=[0,5,255]
我想让遮罩区域 ([0,5,255]) 透明。
【问题讨论】:
您可以像这样使用 cv2.addWeighted 添加两个图像:
import cv2
background = cv2.imread('field.jpg')
overlay = cv2.imread('dice.png')
added_image = cv2.addWeighted(background,0.4,overlay,0.1,0)
cv2.imwrite('combined.png', added_image)
学分: Using openCV to overlay transparent image onto another image
【讨论】: