# 高,宽,深 image 是 (780, 960, 3), logo(88, 240, 3)
import numpyas np
import cv2
image = cv2.imread('image.jpg')
logo = cv2.imread('logo.png')
indexs = np.where(np.amin(logo, -1) >0)
image[100:188,100:340, :][indexs] = logo[indexs]
cv2.imshow('', image)
cv2.waitKey(0)
cv2.destroyAllWindows()
网友评论