pip3 install opencv-python #报错 end of statement expected
import cv2
img_head=cv2.imread("C:/Users/skyswzmc/.PyCharmCE2019.3/logo.jpg")
img_logo = cv2.imread('C:/Users/skyswzmc/.PyCharmCE2019.3/head.jpg')
获取头像和logo的宽度
w_head,h_head=img_head.shape[:2]
w_head,h_head=img_logo.shape[:2]
scale = w_head / w_logo
img_flag = cv2.resize(img_logo, (0, 0), fx=scale, fy=scale)
w_flag, h_flag = img_flag.shape[:2]
for c in range(0, 3):
img_head[w_head - w_flag:, h_head - h_flag:, c] = img_flag[:, :,C]
cv2.imwrite('C:/Users/skyswzmc/.PyCharmCE2019.3/new_head.jpg', img_head)
输出:no module named'cv2'