-
Notifications
You must be signed in to change notification settings - Fork 17
/
plot_grid.py
57 lines (35 loc) · 862 Bytes
/
plot_grid.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
44
45
46
47
48
49
50
51
52
53
54
55
56
57
import matplotlib.pyplot as plt
import matplotlib.image as mpimg
import numpy as np
import os
from PIL import Image
import sys
if __name__ == "__main__":
img_dir = sys.argv[1]
images = os.listdir(img_dir)
images = [img_dir+'\\'+image for image in images]
imgs = [Image.open(image) for image in images]
width=200
height=130
rows = 2
cols = 2
axes=[]
fig=plt.figure()
for a in range(rows*cols):
b = imgs[a]
axes.append( fig.add_subplot(rows, cols, a+1) )
plt.imshow(b)
plt.axis('off')
fig.tight_layout()
plt.show()
fwidth=200
height=130
rows = 1
cols = 1
axes=[]
b = imgs[-1]
axes.append( fig.add_subplot(rows, cols, 1) )
plt.imshow(b)
plt.axis('off')
fig.tight_layout()
plt.show()