Cannot determine type of file

我的梦境 提交于 2019-12-12 18:33:13

问题


Hi i have just started learning image processing using python. When i tried to open an image that i downloaded from the net, I keep getting this error and I have no idea about how to resolve it. Can anyone please help me with this?

>>> dna=mahotas.imread('dna.jpeg')

Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "C:\Python27\lib\site-packages\mahotas\io\freeimage.py", line 773, in imread
    img = read(filename)
  File "C:\Python27\lib\site-packages\mahotas\io\freeimage.py", line 444, in read
    bitmap = _read_bitmap(filename, flags)
  File "C:\Python27\lib\site-packages\mahotas\io\freeimage.py", line 490, in _read_bitmap
    'mahotas.freeimage: cannot determine type of file %s' % filename)
ValueError: mahotas.freeimage: cannot determine type of file dna.jpeg

回答1:


Hello this looks like a pretty old thread but I found it recently because I had the same problem.

I think that the error message is misleading because it implies that the type of file is incorrect.

I fixed the problem by including the full path to the image file. For example, it could look something like:

dna = mahotas.imread('C:\Documents\dna.jpeg')


来源:https://stackoverflow.com/questions/22437017/cannot-determine-type-of-file

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!