Skip to content

Instantly share code, notes, and snippets.

@Nithilaa
Created October 27, 2021 06:57
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Nithilaa/9085b7774793159aea79f5ce8a1c1b4b to your computer and use it in GitHub Desktop.
Save Nithilaa/9085b7774793159aea79f5ce8a1c1b4b to your computer and use it in GitHub Desktop.
import cv2
#read the images
img1 = cv2.imread('bitwise_image_1.jpg')
img2 = cv2.imread('bitwise_image_2.jpg')
bitwise_AND = cv2.bitwise_and(img1, img2)
bitwise_OR = cv2.bitwise_or(img1, img2)
bitwise_NOT = cv2.bitwise_not(img1)
cv2.imshow('img1', img1)
cv2.waitKey(0)
cv2.destroyAllWindows()
cv2.imshow('img2', img2)
cv2.waitKey(0)
cv2.destroyAllWindows()
cv2.imshow('AND', bitwise_AND)
cv2.waitKey(0)
cv2.destroyAllWindows()
cv2.imshow('OR', bitwise_OR)
cv2.waitKey(0)
cv2.destroyAllWindows()
cv2.imshow('NOT', bitwise_NOT)
cv2.waitKey(0)
cv2.destroyAllWindows()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment