【问题标题】:Python CV2 choose alpha of mask to make it transparentPython CV2 选择掩码的 alpha 使其透明
【发布时间】:2021-05-12 15:03:59
【问题描述】:

我想让我附加到图像的蒙版以某种方式透明。我有以下内容:

img_background[掩码]=[0,5,255]

我想让遮罩区域 ([0,5,255]) 透明。

【问题讨论】:

标签: python numpy opencv3.0


【解决方案1】:

您可以像这样使用 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

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2016-06-09
    • 1970-01-01
    • 1970-01-01
    • 2012-01-21
    • 1970-01-01
    • 2017-12-13
    • 2016-06-01
    • 2018-05-18
    相关资源
    最近更新 更多