import cv2
import numpy as np
qwe = cv2.imread('./rourou.png')
asd = cv2.imread('./cat.png')
#非操作
qwe_not = cv2.bitwise_not(qwe)
cv2.imshow('not', np.hstack((qwe, qwe_not)))
print(qwe[:2, :2])
print(qwe_not[:2, :2])
key = cv2.waitKey(0)
cv2.destroyAllWindows()
#与操作也是按位,所以需要像素一致
import cv2
import numpy as np
qwe = cv2.imread('./rourou.png')
asd = cv2.imread('./cat.png')
new_qwe = qwe[0:320, 0:236]
#
asd_and = cv2.bitwise_and(new_qwe, asd)
cv2.imshow('and', np.hstack((new_qwe, asd_and)))
print(new_qwe[:2, :2])
print(asd_and[:2, :2])
key = cv2.waitKey(0)
cv2.destroyAllWindows()