-
Notifications
You must be signed in to change notification settings - Fork 0
/
base.py
31 lines (26 loc) · 791 Bytes
/
base.py
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
import numpy as np
import yaml
from PIL import Image
import math
import matplotlib.pyplot as plt
import matplotlib.image as mpimg
from scipy import stats
def splitChannels(mat, h, w):
redChannel, greenChannel, blueChannel = [] , [] , []
for i in range(h):
l1, l2, l3 = [] , [] , []
for j in range(w):
r,g,b = mat[i][j][0], mat[i][j][1], mat[i][j][2]
l1.append(r)
l2.append(g)
l3.append(b)
redChannel.append(l1)
greenChannel.append(l2)
blueChannel.append(l3)
return redChannel, greenChannel, blueChannel
def display(type, img):
if type == "image":
plt.imshow(img)
plt.show()
else:
print(img)