-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathplot.py
43 lines (38 loc) · 1.08 KB
/
plot.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
32
33
34
35
36
37
38
39
40
41
42
43
import matplotlib.pyplot as plt
import numpy as np
from PIL import Image
def plot_from_npz(loaded_npz):
fig = plt.figure(figsize=(8, 8))
# faces= np.load(str(url))
# faces= faces["arr_0"]
# faces= np.load("video_faces.npz")["arr_0"]
faces= loaded_npz
i=1
# print(loaded_npz)
# print(np.load("video_faces.npz")["arr_0"])
# print(len(faces))
colrows= 12
for face_arr in faces:
#print(face)
face= Image.fromarray(face_arr)
# fig.add_subplot(colrows, colrows, i)
plt.imshow(face)
i+= 1
plt.show()
return
def testplot():
picture = "extracted_face_picture/single_face_picture.jpg"
picture = Image.open(picture)
# picture = cv2.imread(picture)[:, :, ::-1]
picture = picture.resize((160, 160))
plt.imshow(picture)
def testplot1():
frames_from_npz = "video_faces.npz"
frames = np.load(frames_from_npz)
frames = frames["arr_0"]
frame_num = 1
for frames_arr in frames:
frame = Image.fromarray(frames_arr)
plt.imshow(frame)
# testplot1()
# plot_from_npz("kkk")