matlplotlib figure imshow
来源:互联网 发布:爆破作业模拟考试软件 编辑:程序博客网 时间:2024/05/05 03:48
matplotlib
在pycharm中处理图像和显示时,使用plt.imshow()有时候能显示图像,有时候又不能,发现少了一句plt.show()——Show result on screen,还是得把文档资料看完整啦~~
import matplotlib.pyplot as pltimport matplotlib.image as mgimgimport os #for open fileimport cv2imgpath = "./imgtest"imglist = os.listdir(imgpath)for i in xrange(len(imglist)): """choice one----cv2""" img = cv2.imread(imgpath + '/' + imglist[i]) cv2.imshow('img', img) cv2.waitKey() """choice two----mgimg""" img = mpimg.imread(imgpath + '/' + imglist[i]) plt.imshow(img) plt.show()
两者区别好像不大(?),官网上说Natively, matplotlib only supports PNG images. 但是测试的时候用jpg图像仍然可以正常运行显示。
http://matplotlib.org/users/image_tutorial.html
使用时有时候混淆了两种方法,如果用cv2.imread()图像,plt.imshow()显示图像,会发现原图的颜色有变化。
原图:
plt.imshow()显示(可显示坐标及对应像素值,这点比cv2方便):
颜色变化:
解释:
cv2中的色彩排列是(b,g,r),而matplotlib库中的排列方式是(r,g,b)!
reference:http://www.cnblogs.com/pakfahome/p/3917143.html
matplotlib用法这里有总结啦
http://liam0205.me/2014/09/11/matplotlib-tutorial-zh-cn/
0 0
- matlplotlib figure imshow
- imshow
- class matplotlib.figure.Figure
- cv::imshow
- 【OpenCV】imshow
- opencv imshow
- imshow()函数
- Matlab imshow
- Go figure
- figure元素
- figure game
- 画多图(figure)
- matplotlib--figure
- imshow(A,[])与imshow(A)不同
- MATLAB函数imshow简介
- imshow使用OpenCV
- imshow imagesc
- matlab中imshow
- 7.4将一个二维数组行和列元素互换,存到另一个二维数组中。
- [华为OJ] 数据分类处理
- 一些思路
- 【理解JVM】JVM内存管理(2)
- 地理名词、概念的解释
- matlplotlib figure imshow
- 最长回文子串
- 安卓拨号打电话代码
- JAVA之旅(二十三)——System,RunTime,Date,Calendar,Math的数学运算
- 使用shareSDK 进行分享和授权登录
- Wrong Manifest.mf in IntelliJ IDEA created .jar
- 【一天一道LeetCode】#113. Path Sum II
- 安卓动画集
- Office 文件操作权威指南03