matplotlib.pyplot与cv2、Image.open 读取图片显示的差异
来源:互联网 发布:l36h刷机软件 编辑:程序博客网 时间:2024/05/22 13:21
简介
In the Python bindings of OpenCV, images are represented as NumPy arrays in BGR order. This works fine when using the cv2.imshow function. However, if you intend on using Matplotlib, the plt.imshow function assumes the image is in RGB order. A simple call to cv2.cvtColor will resolve this problem, or you can use the opencv2matplotlib convenience function.
cv2.imshow读取图片的NumPy arrays数组是以 BGR order形式保存的,而Matplotlib中的plt.imshow 是以RGB顺序保存的。若要以plt显示需要用imutils.opencv2matplotlib函数,或者要将Image.open 读取的图片正常显示需要cv2.cvtColor来调用。
图片Gaussian pyramid(一)Image.open 读取
http://blog.csdn.net/u011463646/article/details/77415047
代码
import matplotlib.pyplot as pltimport cv2import imutilscactus = cv2.imread('') # INCORRECT: show the image without converting color spacesplt.figure("Incorrect")plt.imshow(cactus)# CORRECT: convert color spaces before using plt.imshowplt.figure("Correct")plt.imshow(imutils.opencv2matplotlib(cactus))plt.show()
效果
参考
【1】图片Gaussian pyramid(一)Image.open 读取
http://blog.csdn.net/u011463646/article/details/77415047
【2】https://github.com/jrosebr1/imutils
- matplotlib.pyplot与cv2、Image.open 读取图片显示的差异
- 三、Matplotlib系列---pyplot的中文显示
- 四、Matplotlib系列---pyplot的文本显示
- matplotlib pyplot 显示中文
- matplotlib pyplot 输出eps图片打开后显示空白
- matplotlib.pyplot绘图显示控制
- opencv cv2.read 读取不了cv2.imwrite 写入的图片
- matplotlib、PIL、cv2图像操作差异分析
- matplotlib.pyplot画图 图片的二进制流的获取
- 使用matplotlib时pyplot.show()不显示图像的问题
- 理解matplotlib、pylab与pyplot之间的关系
- matplotlib.pyplot
- matplotlib.pyplot
- matplotlib.pyplot库的中文显示,文本显示,子绘图区域
- Form2.Image 控件显示ADO 读取的二进制图片
- 如何用cv2读取图片
- pyplot的中文显示
- Python matplotlib pyplot中title() xlabel() ylabel()无法显示在中文(方框乱码)的解决办法
- 【JDK源码分析】String的存储区与不可变性
- SQL数据库中表的增删改除四种基本操作与逻辑表达式
- 挂缀codevs2382
- eclipse中解除jdk的访问限制(以BASE64Encoder/BASE64Decoder为例)
- 设计模式---抽象工厂
- matplotlib.pyplot与cv2、Image.open 读取图片显示的差异
- PHP删除字符串最后一个字符
- IIS中多个版本php共存的方法,IIS如何快速搭建PHP网站,多个php实现共存的神器!
- MySQL性能优化的最佳20+条经验
- 基础很重要~~04.表表达式-上篇
- Java多线程学习(吐血超详细总结)
- 百度地图点击地图,标点并显示地址信息
- Java集合框架源码解析-TreeSet
- CSS样式表