我正在尝试使用以下示例:
import SimpleCV as scv
lenna = scv.Image('lenna')
scv.Image(lenna.toString()).show()
以上代码生成IOError
,如下所示:
---------------------------------------------------------------------------
IOError Traceback (most recent call last)
<ipython-input-21-225589a7ddf6> in <module>()
----> 1 scv.Image(lenna.toString()).show()
/usr/local/lib/python2.7/dist-packages/SimpleCV/ImageClass.pyc in __init__(self, source, camera, colorSpace, verbose, sample, cv2image, webp)
1071 self._bitmap = cv.LoadImage(self.filename, iscolor=cv.CV_LOAD_IMAGE_COLOR)
1072 except:
-> 1073 self._pil = pil.open(self.filename).convert("RGB")
1074 self._bitmap = cv.CreateImageHeader(self._pil.size, cv.IPL_DEPTH_8U, 3)
1075 cv.SetData(self._bitmap, self._pil.tostring())
/usr/lib/python2.7/dist-packages/PIL/Image.pyc in open(fp, mode)
1986 if isStringType(fp):
1987 filename = fp
-> 1988 fp = builtins.open(fp, "rb")
1989 else:
1990 filename = ""
IOError: [Errno 36] File name too long: [...] # base64 string excluded because it's long as all hell
我也尝试先解码字符串,但无济于事:
import SimpleCV as scv
lenna = scv.Image('lenna')
scv.Image(lenna.toString().decode('base64')).show()
这会产生类似的错误,尽管报告的文件名要小得多。
是什么给出的?我该怎么做到这一点?
编辑:还应该注意,简单地解码字节串,即lenna.toString.decode('base64')
也不起作用。我只是得到另一个看起来像base64的字符串。