I want to make the mask which I append to an image transparent in some way. I have the following:
img_background[mask]=[0,5,255]
I want to have the mask region ([0,5,255]) transparent.
I want to make the mask which I append to an image transparent in some way. I have the following:
img_background[mask]=[0,5,255]
I want to have the mask region ([0,5,255]) transparent.
You can add the two images using cv2.addWeighted like this:
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)
Credits: Using openCV to overlay transparent image onto another image