-
Notifications
You must be signed in to change notification settings - Fork 0
/
myplot.py
103 lines (78 loc) · 2.43 KB
/
myplot.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
'''this is file contain functions of plotting things '''
import matplotlib.pyplot as plt
from scipy.misc import imresize
def plot_comparison(O_image, down_image):
O_size = O_image.shape
plt.subplot(2,3,1)
plt.imshow(O_image,cmap='gray')
plt.title('original size')
plt.subplot(2,3,2)
imrecov = imresize(down_image,size=O_size,interp='nearest')
plt.imshow(imrecov,cmap='gray')
plt.title('nearest ')
plt.subplot(2,3,3)
imrecov = imresize(down_image,size=O_size,interp='lanczos')
plt.imshow(imrecov,cmap='gray')
plt.title('lanczos ')
plt.subplot(2,3,4)
imrecov = imresize(down_image,size=O_size,interp='bilinear')
plt.imshow(imrecov,cmap='gray')
plt.title('bilinear ')
plt.subplot(2,3,5)
imrecov = imresize(down_image,size=O_size,interp='cubic')
plt.imshow(imrecov,cmap='gray')
plt.title('cubic ')
plt.subplot(2,3,6)
imrecov = imresize(down_image,size=O_size,interp='bicubic')
plt.imshow(imrecov,cmap='gray')
plt.title('bicubic ')
plt.show()
def plot_2(original,SR):
plt.subplot(211)
plt.title('original')
plt.imshow(original)
plt.subplot(212)
plt.title('SR')
plt.imshow(SR)
plt.show()
def norm(imrecov):
imrecov[imrecov>255]=255
imrecov[imrecov<0]=0
return imrecov
def plot_3(O_image,down_image,SR,index):
O_size = O_image.shape
plt.subplot(2,3,1)
plt.xticks([])
plt.imshow(O_image,cmap='gray')
plt.title('Original Image')
plt.subplot(2,3,6)
imrecov = imresize(down_image,size=O_size,interp='nearest')
imrecov =norm(imrecov)
plt.imshow(imrecov,cmap='gray')
plt.xticks([])
plt.title('Nearest ')
plt.subplot(2,3,3)
imrecov = imresize(down_image,size=O_size,interp='lanczos')
imrecov =norm(imrecov)
plt.imshow(imrecov,cmap='gray')
plt.title('Lanczos ')
plt.xticks([])
plt.subplot(2,3,4)
imrecov = imresize(down_image,size=O_size,interp='bilinear')
imrecov =norm(imrecov)
plt.imshow(imrecov,cmap='gray')
plt.title('Bilinear ')
plt.xticks([])
plt.subplot(2,3,5)
imrecov = imresize(down_image,size=O_size,interp='bicubic')
imrecov =norm(imrecov)
plt.imshow(imrecov,cmap='gray')
plt.title('Bicubic ')
plt.xticks([])
plt.subplot(2,3,2)
plt.imshow(SR,cmap='gray')
plt.title('SRCNN')
plt.xticks([])
plt.savefig('OMNIGLOT-outcome-comp_'+str(index))
plt.show()
return plt