-
Notifications
You must be signed in to change notification settings - Fork 24
/
plot.py
82 lines (65 loc) · 2.07 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
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
# coding: utf-8
import numpy as np
from skimage import data
from matplotlib import pyplot as plt
import fast_glcm
def main():
pass
if __name__ == '__main__':
main()
img = data.camera()
h,w = img.shape
mean = fast_glcm.fast_glcm_mean(img)
std = fast_glcm.fast_glcm_std(img)
cont = fast_glcm.fast_glcm_contrast(img)
diss = fast_glcm.fast_glcm_dissimilarity(img)
homo = fast_glcm.fast_glcm_homogeneity(img)
asm, ene = fast_glcm.fast_glcm_ASM(img)
ma = fast_glcm.fast_glcm_max(img)
ent = fast_glcm.fast_glcm_entropy(img)
plt.figure(figsize=(10,4.5))
plt.rcParams['image.cmap'] = 'inferno'
fs = 15
plt.subplot(2,5,1)
plt.tick_params(labelbottom=False, labelleft=False)
plt.imshow(img)
plt.title('original', fontsize=fs)
plt.subplot(2,5,2)
plt.tick_params(labelbottom=False, labelleft=False)
plt.imshow(mean)
plt.title('mean', fontsize=fs)
plt.subplot(2,5,3)
plt.tick_params(labelbottom=False, labelleft=False)
plt.imshow(std)
plt.title('std', fontsize=fs)
plt.subplot(2,5,4)
plt.tick_params(labelbottom=False, labelleft=False)
plt.imshow(cont)
plt.title('contrast', fontsize=fs)
plt.subplot(2,5,5)
plt.tick_params(labelbottom=False, labelleft=False)
plt.imshow(diss)
plt.title('dissimilarity', fontsize=fs)
plt.subplot(2,5,6)
plt.tick_params(labelbottom=False, labelleft=False)
plt.imshow(homo)
plt.title('homogeneity', fontsize=fs)
plt.subplot(2,5,7)
plt.tick_params(labelbottom=False, labelleft=False)
plt.imshow(asm)
plt.title('ASM', fontsize=fs)
plt.subplot(2,5,8)
plt.tick_params(labelbottom=False, labelleft=False)
plt.imshow(ene)
plt.title('energy', fontsize=fs)
plt.subplot(2,5,9)
plt.tick_params(labelbottom=False, labelleft=False)
plt.imshow(ma)
plt.title('max', fontsize=fs)
plt.subplot(2,5,10)
plt.tick_params(labelbottom=False, labelleft=False)
plt.imshow(ent)
plt.title('entropy', fontsize=fs)
plt.tight_layout(pad=0.5)
plt.savefig('img/output.jpg')
plt.show()