所以我写了一个简单的python脚本
from PIL import Image
from pylab import *
im = array(Image.open('sample.jpg'))
imshow(im)
我从 IDLE 得到这个错误
Traceback (most recent call last):
File "/home/michael/Dropbox/OpenCV/greyscale.py", line 5, in <module>
imshow(im)
File "/usr/local/lib/python2.7/dist-packages/matplotlib/pyplot.py", line 2722, in imshow
imlim=imlim, resample=resample, url=url, **kwargs)
File "/usr/local/lib/python2.7/dist-packages/matplotlib/axes.py", line 7091, in imshow
im.set_data(X)
File "/usr/local/lib/python2.7/dist-packages/matplotlib/image.py", line 418, in set_data
raise TypeError("Image data can not convert to float")
TypeError: Image data can not convert to float
基本上说我不能将我的图像转换为浮动,任何人都知道我错过了什么