Warning: file_get_contents(/data/phpspider/zhask/data//catemap/4/powerbi/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
在Python中从模块导入图片_Python_Scikit Image - Fatal编程技术网

在Python中从模块导入图片

在Python中从模块导入图片,python,scikit-image,Python,Scikit Image,非常愚蠢的问题,但问题来了 Scikit映像有一个名为“数据”的模块。该模块中有大量示例中使用的图片 例如: from skimage import data image = data.camera() # camera being a camera.png file in data 现在,我想将自己的文件导入到脚本中,但如果我将新文件添加到数据文件夹中,则返回以下错误: 模块数据没有属性“whatever”#whatever是我添加到数据中的新文件 作为对@Peter Wood评论的替代解决

非常愚蠢的问题,但问题来了

Scikit映像有一个名为“数据”的模块。该模块中有大量示例中使用的图片

例如:

from skimage import data
image = data.camera() # camera being a camera.png file in data
现在,我想将自己的文件导入到脚本中,但如果我将新文件添加到数据文件夹中,则返回以下错误:

模块数据没有属性“whatever”#whatever是我添加到数据中的新文件


作为对@Peter Wood评论的替代解决方案,我们应该做到以下几点:

In [5]: from skimage import io

In [6]: image = io.imread('whatever.png')

In [7]: io.imshow(image)
Out[7]: <matplotlib.image.AxesImage at 0xf695f98>
[5]中的
:来自skimage导入io
在[6]中:image=io.imread('whatever.png')
In[7]:io.imshow(图像)
出[7]:

data
是一个python模块。您需要编辑一些Python代码才能使其正常工作,除非它在属性查找方面做了一些巧妙的工作,但我对此表示怀疑。上面说您可以使用它读取任何图像文件,或从数据目录加载图像。Peter,非常感谢。