首页新闻招聘找找看知识库

TypeError: Image data cannot be converted to float

0
悬赏园豆:10 [待解决问题]
import numpy as np
import cv2.cv2 as cv
from matplotlib import pyplot as plt
img = cv.imread('../Chrysanthemum.jpg',0)
plt.imshow(img, cmap = 'gray', interpolation = 'bicubic')
plt.xticks([]), plt.yticks([])  # to hide tick values on X and Y axis
plt.show()

上面代码报错:

File "D:\software\python\lib\matplotlib\__init__.py", line 1855, in inner
return func(ax, *args, **kwargs)
File "D:\software\python\lib\matplotlib\axes\_axes.py", line 5487, in imshow
im.set_data(X)
File "D:\software\python\lib\matplotlib\image.py", line 649, in set_data
raise TypeError("Image data cannot be converted to float")
TypeError: Image data cannot be converted to float

为什么?

web_小隆的主页 web_小隆 | 初学一级 | 园豆:173
提问于:2018-07-12 20:09
< >
分享
清除回答草稿
   您需要登录以后才能回答,未注册用户请先注册