-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathNegative
46 lines (35 loc) · 1.01 KB
/
Negative
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
import cv2
import matplotlib.pyplot as plt
def main():
path = "C:\\Users\\edkni\\Downloads\\image_processing_files\\Dataset\\"
imgpath1 = path + "4.2.06.tiff"
img1 = cv2.imread(imgpath1, 1)
img1 = cv2.cvtColor(img1,cv2.COLOR_BGR2RGB)
img2 = cv2.cvtColor(img1,cv2.COLOR_BGR2GRAY)
img3 = abs(255 - img1)
img4 = abs(255 - img2)
titles = ["Original image","Gray","Original Negative","Gray Negative"]
images = [img1,img2,img3,img4]
plt.subplot(2,2,1)
plt.imshow(images[0])
plt.title(titles[0])
plt.xticks([])
plt.yticks([])
plt.subplot(2,2,2)
plt.imshow(images[1],cmap = "gray")
plt.title(titles[1])
plt.xticks([])
plt.yticks([])
plt.subplot(2,2,3)
plt.imshow(images[2])
plt.xticks([])
plt.yticks([])
plt.title(titles[2])
plt.subplot(2,2,4)
plt.imshow(images[3],cmap = "gray")
plt.xticks([])
plt.yticks([])
plt.title(titles[3])
plt.show()
if __name__ == "__main__":
main()