在python中读取图像 [英] Reading images in python
本文介绍了在python中读取图像的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我正在尝试在python中读取png
图像. scipy
中的imread
函数正在已弃用,他们建议使用imageio
库.
I am trying to read a png
image in python. The imread
function in scipy
is being deprecated and they recommend using imageio
library.
但是,我宁愿将对外部库的使用限制为scipy
,numpy
和matplotlib
库.因此,使用imageio
或scikit image
对我来说不是一个好选择.
However, I am would rather restrict my usage of external libraries to scipy
, numpy
and matplotlib
libraries. Thus, using imageio
or scikit image
is not a good option for me.
在python或scipy
,numpy
或matplotlib
中是否有任何方法可以读取不被弃用的图像?
Are there any methods in python or scipy
, numpy
or matplotlib
to read images, which are not being deprecated?
推荐答案
With matplotlib you can use (as shown in the matplotlib documentation)
import matplotlib.pyplot as plt
import matplotlib.image as mpimg
img=mpimg.imread('image_name.png')
并根据需要绘制图像
imgplot = plt.imshow(img)
这篇关于在python中读取图像的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文