-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathimageNegative.py
21 lines (16 loc) · 966 Bytes
/
imageNegative.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
import cv2
# This import statement is used to import the python packages or modules that required by our program.
# Here we are importing cv2 module which is used for imgOrignal reading and also for displaying imgOrignal in our program.
# opencv read the images a numpy arrays.
img = cv2.imread("imagetr.jpg")
# cv2.imread() function is used to read and load imgOrignal files stored in your system.
imgNegative = cv2.bitwise_not(img)
# cv2.bitwise_not() is used to invert every bit present in the imgOrignal array.
cv2.imshow("Orignal Image", img)
cv2.imshow("Ngative imgOrignal", imgNegative)
cv2.waitKey(0)
# cv2.waitKey() function waits for a couple of seconds as specified by the user for a key event.
# Here as we have defined zero here then the waitKey() function waits infinitely for a key event to happen.
cv2.destroyAllWindows()
# This cv2.destroyAllWindows() function destroys all the opened GUI windows which are opened
# by this particular program.