Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit 41295cf

Browse files
Merge pull request avinashkranjan#665 from undetectablevirus/Applying-Bitwise-Operations
Applying bitwise operations
2 parents 9fd4ebd + 2b8884f commit 41295cf

File tree

2 files changed

+33
-0
lines changed

2 files changed

+33
-0
lines changed
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
import cv2
2+
3+
src1= input("Enter the path of the image 1\n") #getting the path for first image
4+
src1 = cv2.imread(src1)
5+
#src1 = cv2.resize(src1,(540,540)) #resizing the image
6+
src2 = input("Enter the path of the image 2\n") #getting the path for second image
7+
src2 = cv2.imread(src2)
8+
9+
src2 = cv2.resize(src2, src1.shape[1::-1]) #Resizing the image so that both images have same dimensions
10+
andop= cv2.bitwise_and(src1, src2,mask=None) #Applying Bitwise AND operation
11+
andop=cv2.resize(andop,(640,640))
12+
cv2.imshow('Bitwise AND',andop)
13+
14+
orop= cv2.bitwise_or(src1, src2,mask=None) #Applying Bitwise OR operation
15+
orop=cv2.resize(orop,(640,640))
16+
cv2.imshow('Bitwise OR',orop)
17+
18+
xorop = cv2.bitwise_xor(src1,src2,mask=None) #Applying Bitwise OR operation
19+
xorop=cv2.resize(xorop,(640,640))
20+
cv2.imshow('Bitwise XOR',xorop)
21+
cv2.waitKey(0)
22+
cv2.destroyAllWindows()

‎Applying Bitwise Operations/Readme.md

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
# Package/Script Name
2+
Applying Bitwise Operations on two images using OpenCV
3+
4+
# Short description of package/script
5+
We will apply bitwise operations-AND, OR and XOR on two images using OpenCV
6+
7+
# Setup instructions
8+
User needs to have Python and OpenCV installed in their machines.
9+
10+
# Author
11+
Garima Goyal

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /