#图像加法
import cv2
import numpy as np
#读取图片
qwe = cv2.imread('./rourou.png')
asd = cv2.imread('./cat.png')
print(qwe.shape)
print(asd.shape)
#qwe更大所以需要从qwe中切asd的大小
new_qwe = qwe[0:320, 0:236]
print(new_qwe.shape)
#cv2.add加法操作要求两个图片长款相同维度数相同
new_img = cv2.add(new_qwe, asd)
cv2.imshow('new_img', new_img)
key = cv2.waitKey(0)
cv2.destroyAllWindows()
#图像减法new_img= cv2.subtract(img1, img2)
#图像加法
import cv2
import numpy as np
qwe = cv2.imread('./rourou.png')
asd = cv2.imread('./cat.png')
print(qwe.shape)
print(asd.shape)
#qwe更大所以需要从qwe中切asd的大小
new_qwe = qwe[0:320, 0:236]
print(new_qwe.shape)
#cv2.add加法操作要求两个图片长款相同维度数相同
new_img = cv2.subtract(new_qwe, asd)
cv2.imshow('new_img', new_img)
key = cv2.waitKey(0)
cv2.destroyAllWindows()