In [3]:
# import opencv library
import cv2
import numpy as np

# read the image
image = cv2.imread('sophie_turner.jpg')
logo  = cv2.imread('datahacker.png')

(hi, wi) = image.shape[:2]
(hw, ww) = logo.shape[:2]

overlay = np.zeros((hi, wi, 3), dtype="uint8")
overlay[hi - hw:hi, wi - ww:wi] = logo

cv2.addWeighted calculates the weighted sum of two arrays

$$dst= \alpha * src1 + \beta * src2 + \gamma $$
In [4]:
# add the logo onto the image
# cv2.addWeighted calculates the weighted sum of two arrays
output = image.copy()
cv2.addWeighted(image, 1, overlay, 1, 0, output)

cv2.imwrite("output.jpg", output)
Out[4]:
True