Sunday 2 May 2021

opencv 40 bitwise operation


image 1

image 2

bit wise and

bit wise xor

bit wise or
#main.py
import numpy as np
import cv2

img1 = cv2.imread("assets/bitwise/1.jpg")
img2 = cv2.imread("assets/bitwise/2.jpg")

bitwiseAnd = cv2.bitwise_and(img1, img2)
bitwiseOr = cv2.bitwise_or(img1, img2)
bitwiseXor = cv2.bitwise_xor(img1, img2)

cv2.imshow("AND", bitwiseAnd)
cv2.imshow("or", bitwiseOr)
cv2.imshow("xor", bitwiseXor)
cv2.waitKey(0)

reference:

No comments:

Post a Comment