-
Notifications
You must be signed in to change notification settings - Fork 51
/
Extension.py
142 lines (112 loc) · 4.83 KB
/
Extension.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
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
import matplotlib.pyplot as plt
from IO2 import *
def NumpyAddExtension(list):
r = np.zeros(list[0].shape, dtype=int)
for x in range(len(list)):
r = r + list[x]
return r
def PicSave(pic, name):
if len(pic) == 1:
fig0, ax0 = plt.subplots(nrows=1, ncols=1)
ax0.imshow(pic[0]).set_cmap("gray")
ax0.set_title("Input pic")
ax0.get_xaxis().set_ticks([])
ax0.get_yaxis().set_ticks([])
plt.savefig(name, bbox_inches="tight")
plt.close(fig0)
elif len(pic) == 6:
fig1, ax1 = plt.subplots(nrows=3, ncols=2)
ax1[0, 0].imshow(Decompress(pic[0])).set_cmap("gray")
ax1[0, 0].set_title("Map1")
ax1[0, 0].get_xaxis().set_ticks([])
ax1[0, 0].get_yaxis().set_ticks([])
ax1[0, 1].imshow(Decompress(pic[1])).set_cmap("gray")
ax1[0, 1].set_title("Map2")
ax1[0, 1].get_xaxis().set_ticks([])
ax1[0, 1].get_yaxis().set_ticks([])
ax1[1, 0].imshow(Decompress(pic[2])).set_cmap("gray")
ax1[1, 0].set_title("Map3")
ax1[1, 0].get_xaxis().set_ticks([])
ax1[1, 0].get_yaxis().set_ticks([])
ax1[1, 1].imshow(Decompress(pic[3])).set_cmap("gray")
ax1[1, 1].set_title("Map4")
ax1[1, 1].get_xaxis().set_ticks([])
ax1[1, 1].get_yaxis().set_ticks([])
ax1[2, 0].imshow(Decompress(pic[4])).set_cmap("gray")
ax1[2, 0].set_title("Map5")
ax1[2, 0].get_xaxis().set_ticks([])
ax1[2, 0].get_yaxis().set_ticks([])
ax1[2, 1].imshow(Decompress(pic[5])).set_cmap("gray")
ax1[2, 1].set_title("Map6")
ax1[2, 1].get_xaxis().set_ticks([])
ax1[2, 1].get_yaxis().set_ticks([])
plt.savefig(name, bbox_inches="tight")
plt.close(fig1)
elif len(pic) == 16:
fig1, ax1 = plt.subplots(nrows=4, ncols=4)
ax1[0, 0].imshow(Decompress(pic[0])).set_cmap("gray")
ax1[0, 0].set_title("Map1")
ax1[0, 0].get_xaxis().set_ticks([])
ax1[0, 0].get_yaxis().set_ticks([])
ax1[0, 1].imshow(Decompress(pic[1])).set_cmap("gray")
ax1[0, 1].set_title("Map2")
ax1[0, 1].get_xaxis().set_ticks([])
ax1[0, 1].get_yaxis().set_ticks([])
ax1[0, 2].imshow(Decompress(pic[2])).set_cmap("gray")
ax1[0, 2].set_title("Map3")
ax1[0, 2].get_xaxis().set_ticks([])
ax1[0, 2].get_yaxis().set_ticks([])
ax1[0, 3].imshow(Decompress(pic[3])).set_cmap("gray")
ax1[0, 3].set_title("Map4")
ax1[0, 3].get_xaxis().set_ticks([])
ax1[0, 3].get_yaxis().set_ticks([])
ax1[1, 0].imshow(Decompress(pic[4])).set_cmap("gray")
ax1[1, 0].set_title("Map5")
ax1[1, 0].get_xaxis().set_ticks([])
ax1[1, 0].get_yaxis().set_ticks([])
ax1[1, 1].imshow(Decompress(pic[5])).set_cmap("gray")
ax1[1, 1].set_title("Map6")
ax1[1, 1].get_xaxis().set_ticks([])
ax1[1, 1].get_yaxis().set_ticks([])
ax1[1, 2].imshow(Decompress(pic[6])).set_cmap("gray")
ax1[1, 2].set_title("Map7")
ax1[1, 2].get_xaxis().set_ticks([])
ax1[1, 2].get_yaxis().set_ticks([])
ax1[1, 3].imshow(Decompress(pic[7])).set_cmap("gray")
ax1[1, 3].set_title("Map8")
ax1[1, 3].get_xaxis().set_ticks([])
ax1[1, 3].get_yaxis().set_ticks([])
ax1[2, 0].imshow(Decompress(pic[8])).set_cmap("gray")
ax1[2, 0].set_title("Map9")
ax1[2, 0].get_xaxis().set_ticks([])
ax1[2, 0].get_yaxis().set_ticks([])
ax1[2, 1].imshow(Decompress(pic[9])).set_cmap("gray")
ax1[2, 1].set_title("Map10")
ax1[2, 1].get_xaxis().set_ticks([])
ax1[2, 1].get_yaxis().set_ticks([])
ax1[2, 2].imshow(Decompress(pic[10])).set_cmap("gray")
ax1[2, 2].set_title("Map11")
ax1[2, 2].get_xaxis().set_ticks([])
ax1[2, 2].get_yaxis().set_ticks([])
ax1[2, 3].imshow(Decompress(pic[11])).set_cmap("gray")
ax1[2, 3].set_title("Map12")
ax1[2, 3].get_xaxis().set_ticks([])
ax1[2, 3].get_yaxis().set_ticks([])
ax1[3, 0].imshow(Decompress(pic[12])).set_cmap("gray")
ax1[3, 0].set_title("Map13")
ax1[3, 0].get_xaxis().set_ticks([])
ax1[3, 0].get_yaxis().set_ticks([])
ax1[3, 1].imshow(Decompress(pic[13])).set_cmap("gray")
ax1[3, 1].set_title("Map14")
ax1[3, 1].get_xaxis().set_ticks([])
ax1[3, 1].get_yaxis().set_ticks([])
ax1[3, 2].imshow(Decompress(pic[14])).set_cmap("gray")
ax1[3, 2].set_title("Map15")
ax1[3, 2].get_xaxis().set_ticks([])
ax1[3, 2].get_yaxis().set_ticks([])
ax1[3, 3].imshow(Decompress(pic[15])).set_cmap("gray")
ax1[3, 3].set_title("Map16")
ax1[3, 3].get_xaxis().set_ticks([])
ax1[3, 3].get_yaxis().set_ticks([])
plt.savefig(name, bbox_inches="tight")
plt.close(fig1)