[英]TypeError: Image data cannot be converted to float
I got a problem with the code:我的代码有问题:
import cv2
import matplotlib.pyplot as plt
img1 = cv2.imread('images\colombia_city.jpg')
img2 = cv2.imread('images\colombia_city_2.jpg')
#img = img1 + img2
#img = cv2.add(img1,img2)
abc = cv2.addWeighted(img1,0.7,img2,0.3,55)
plt.imshow(abc)
plt.show()
plt.title("Weighted"); plt.axes()
plt.waitforbuttonpress()
According to ** Visual Studio ** the problem this one in:根据 ** Visual Studio ** 这个问题在:
plt.imshow(abc)
plt.imshow(abc)
When I proved the program in another IDE, the program runs normally.当我在另一个IDE中验证该程序时,该程序运行正常。
VSCode shows you an error because of "pylint".由于“pylint”,VSCode 会向您显示错误。
This is just a linter telling you that there is an error.这只是一个 linter 告诉您存在错误。
I have got same problem when using OpenCV.我在使用 OpenCV 时遇到了同样的问题。 There are some other posts that suggests we need to include it to whitelist.
还有一些其他帖子表明我们需要将其包含在白名单中。
https://github.com/PyCQA/pylint/issues/1465 https://github.com/PyCQA/pylint/issues/1465
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.