python显示图片
来源:互联网 发布:淘宝客服视频教程 编辑:程序博客网 时间:2024/04/30 22:24
python显示图片两种方法
1.利用Pillow包
未安装的可以通过pip install Pillow安装
from PIL import Imageimg = Image.open('notMNIST_large/A/aGFua28udHRm.png')img.show()
显示的图片如下:
2.利用matplotlib
同样可以通过pip进行安装
from PIL import Imageimport matplotlib.pyplot as pltimg=Image.open('notMNIST_large/A/aGFua28udHRm.png')plt.figure("pic")plt.imshow(img)plt.show()
显示的图片如下:
感觉第二种跟matlab有点像,可以命名窗口,默认有坐标轴
fig = plt.figure()ax = fig.add_subplot(121)ax.imshow(img)ax = fig.add_subplot(122)ax.imshow(img, cmap = 'gray')plt.show()
默认显示的图片格式是三通道的,设置显示灰度图片,显示效果如下:
阅读全文
0 0
- python显示图片
- Python中显示图片
- python显示图片
- python PNG图片显示
- python for android : 显示图片
- python 读取二进制 显示图片
- Python AxesSubplot如何显示图片
- python----打开 显示 保存图片
- Python - 图片image显示 & osc-message模块
- python sklearn笔记 显示sample的图片
- python 抓取页面不显示图片问题
- python将图片转base64,前端显示
- python 图片显示几种办法
- python爬虫访问页面并显示图片
- Opencv-Python :图片读取、保存、显示
- Python用PIL打开显示图片
- python显示cifar10数据集中的图片
- Python Tkinter GUI(三)显示图片
- Elastic-job源码学习——环境准备
- ubuntu 如何通过ssh 登陆远程VPS
- HelloAndroid
- 组合数
- 框架:Spring、Spring MVC
- python显示图片
- Android文件操作
- BZOJ 1150: [CTSC2007]数据备份Backup【贪心】
- ubuntu下载工具aria2 & uGet
- KMP算法小学生理解
- Android点击事件
- (转)东方美人吉他谱及演奏(中川砂仁)
- 设计算法以判断集合A是否是集合B的子集
- 在Linux系统设置共享文件夹、Hadoop单机/伪分布部署,运行Hadoop Wordcount单词统计实例