利用cv与matplotlib.pyplot读图片与显示图片


 

import matplotlib.pyplot as plt
import cv2 as cv
a=cv.imread('learn.jpg')
cv.imshow('learn',a)
fig=plt.figure(1) #新建绘图窗口
b=fig.add_subplot(221) #选择画布第一个
b.imshow(a,cmap=plt.cm.gray) #读图
cv.imshow('learn',a)
fig=plt.figure(1) #新建绘图窗口
b=fig.add_subplot(222) #选择画布第一个
b.imshow(a,cmap='gray') #读图
plt.title('fig')
fig1=plt.figure(2) #新建绘图窗口
b1=fig1.add_subplot(223) #选择画布第一个
b1.imshow(a,cmap=plt.cm.gray) #读图
plt.title('fig1')
plt.figure(3) #新建绘图窗口
plt.subplot(111) #选择画布第一个
plt.imshow(a,cmap='gray') #读图
plt.title('fig2')

 

 

 

 

 


免责声明!

本站转载的文章为个人学习借鉴使用,本站对版权不负任何法律责任。如果侵犯了您的隐私权益,请联系本站邮箱yoyou2525@163.com删除。



 
粤ICP备18138465号  © 2018-2025 CODEPRJ.COM