# -*- coding: utf-8 -*-
from PIL import Image
from pylab import *

#添加中文支持
from matplotlib.font_manager import FontProperties
font = FontProperties(fname=r"c:\windows\fonts\方正喵呜体.ttf", size=14)
figure()


img=array(Image.open("F:/pic/jiandan/70b86a16gw1dl7jmvvwlkj.jpg"))
subplot(141)
#gray()

axis('off')
title(u'原图像',fontproperties=font)
imshow(img)

im=array(Image.open("F:/pic/jiandan/70b86a16gw1dl7jmvvwlkj.jpg").convert('L'))
subplot(142)
gray()
contour(im,origin="image")
axis('equal')
axis('off')
title(u'图像轮廓',fontproperties=font)

subplot(143)
hist(im.flatten(),128)
title(u'图像直方图',fontproperties=font)
plt.xlim([0,260])
plt.ylim([0,11000])

subplot(144)
hist(img.flatten(),128)
title(u'元图像直方图',fontproperties=font)
plt.xlim([0,260])
plt.ylim([0,11000])


show()

显示原图 灰度图 
subplot(mnp),m行n列第p张

相关文章:

  • 2021-12-04
  • 2021-12-05
  • 2022-12-23
  • 2022-12-23
  • 2021-11-01
  • 2022-12-23
  • 2021-08-26
  • 2021-08-28
猜你喜欢
  • 2022-01-26
  • 2021-04-08
  • 2022-01-13
  • 2022-12-23
  • 2022-12-23
  • 2021-12-20
  • 2021-06-06
相关资源
相似解决方案