OpenCV中图像通道的逻辑运算(与或非)
代码实现:
import cv2
#图像通道的逻辑运算(与或非)
img = cv2.imread('cat.jpg')
image = cv2.imread('cat.jpg')
_and = cv2.bitwise_and(img,image) #与
_or = cv2.bitwise_or(img,image) #或
_not = cv2.bitwise_not(img) #非(取反)
_xor = cv2.bitwise_xor(img,image) #异或
cv2.imshow('and',_and)
cv2.imshow('or',_or)
cv2.imshow('not',_not)
cv2.imshow('xor',_xor)
cv2.waitKey()