【发布时间】:2014-03-16 12:46:24
【问题描述】:
您好,我刚刚开始学习使用 python 进行图像处理。 当我试图打开从网上下载的图像时,我不断收到此错误,我不知道如何解决它。谁能帮我解决这个问题?
>>> 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
【问题讨论】:
-
能否请您正确格式化您的代码,以便更好地阅读?这会增加您获得好答案的机会。
-
您确定 dna.jpeg 是有效的 jpeg 吗?尝试从 mspaint 创建一个测试 .bmp。