简体   繁体   English

使用skimage替换scipy.misc.imread

[英]using skimage to replace scipy.misc.imread

There is a code segment using scipy.misc to read image 有一个代码段使用scipy.misc读取图像

from scipy import misc
im = misc.imread(self.file_image, True)

I would like to know, are there any functions in scikit-image that can replace the above code with the same output. 我想知道,scikit-image中是否有任何函数可以用相同的输出替换上面的代码。

This is how you do it in scikit-image. 这就是您在scikit-image中的操作方式。

from skimage import io
im = io.imread(self.file_image)

However, according to scipy's documentation "imread is deprecated! imread is deprecated in SciPy 1.0.0, and will be removed in 1.2.0. Use imageio.imread instead." 但是,根据scipy的文档,“不建议使用imread!SciPy 1.0.0中不建议使用imread,而在1.2.0中将删除它。请改用imageio.imread。”

So the better option is to use imageio to read images. 因此,更好的选择是使用imageio读取图像。 You can install imageio if not already installed by using pip install imageio 如果尚未安装imageio,可以使用pip install imageio

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM