This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Adapted from http://www.aishack.in/2010/07/transparent-image-overlays-in-opencv/ | |
# Note: This code assumes a PNG with a Color->Transparency, with black as the alpha color | |
from cv2 import * | |
src = cv.LoadImage("image.jpg") # Load a source image | |
overlay = cv.LoadImage("ghost.png") # Load an image to overlay | |
posx = 170 # Define a point (posx, posy) on the source | |
posy = 100 # image where the overlay will be placed | |
S = (0.5, 0.5, 0.5, 0.5) # Define blending coefficients S and D |