-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathsplitting_color.py
More file actions
40 lines (31 loc) · 844 Bytes
/
Copy pathsplitting_color.py
File metadata and controls
40 lines (31 loc) · 844 Bytes
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
import cv2
import numpy as np
import matplotlib.pyplot as plt
def main():
img_path = "D:\\MOHNISH REDDY\\ml\\misc\\misc\\4.2.07.tiff"
img = cv2.imread(img_path, 1)
img = cv2.cvtColor(img, cv2.COLOR_BGR2RGB)
r, g, b = cv2.split(img)
plt.subplot(2, 2, 1)
plt.title('1')
plt.xticks([])
plt.yticks([])
plt.imshow(cv2.merge((r, g, b)))
plt.subplot(2, 2, 2)
plt.title('1')
plt.xticks([])
plt.yticks([])
plt.imshow(r, cmap = 'gray')
plt.subplot(2, 2, 3)
plt.title('1')
plt.xticks([])
plt.yticks([])
plt.imshow(g, cmap = 'gray')
plt.subplot(2, 2, 4)
plt.title('1')
plt.xticks([])
plt.yticks([])
plt.imshow(b, cmap = 'gray')
plt.show()
if __name__ == "__main__":
main()