forked from veraposeidon/Insect_Identification
-
Notifications
You must be signed in to change notification settings - Fork 0
/
sample2.py
37 lines (28 loc) · 1.1 KB
/
sample2.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
#coding=utf-8
#显示灰度图效果
from PIL import Image
import matplotlib.pyplot as plt
from matplotlib.font_manager import FontProperties
font = FontProperties(fname=r"c:\windows\fonts\SimSun.ttc", size=15)
path = "E:/Documents/Python_Script/Insect_Identification/picture"
cang = Image.open(path+'/cangtest0gray.jpg')
rice = Image.open(path+'/ricetestgray.jpg')
flygray = Image.open(path+'/fly0gray.jpg')
zhizhugray = Image.open(path+'/zhizhu0gray.jpg')
plt.subplot(2,2,1)
plt.title(u'蝴蝶灰度图',fontproperties=font)
plt.imshow(flygray,plt.cm.gray)
plt.axis('off') #不显示坐标尺寸
plt.subplot(2,2,2)
plt.title(u'蜘蛛灰度图',fontproperties=font) #第三幅图片标题
plt.imshow(zhizhugray,plt.cm.gray)
plt.axis('off') #不显示坐标尺寸
plt.subplot(2,2,3)
plt.title(u'粘板灰度图',fontproperties=font) #第三幅图片标题
plt.imshow(cang,plt.cm.gray)
plt.axis('off') #不显示坐标尺寸
plt.subplot(2,2,4)
plt.title(u'大米灰度图',fontproperties=font) #第三幅图片标题
plt.imshow(rice,plt.cm.gray)
plt.axis('off') #不显示坐标尺寸
plt.show()