简体   繁体   English

类型错误:图像数据无法转换为浮点数

[英]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.

相关问题 类型错误:无法将图像数据转换为浮点数 无法将图像数据转换为浮点数 - TypeError: Image data cannot be converted to float Image data cannot be converted to float matplotlib.image.imsave TypeError:无法将图像数据转换为float - matplotlib.image.imsave TypeError: Image data cannot be converted to float TypeError:图像数据无法转换为少量图像浮动 - TypeError: Image data cannot be converted to float for few images 类型错误:dtype 对象的图像数据无法转换为浮点数 - TypeError: Image data of dtype object cannot be converted to float TypeError:图像数据无法在 wordcloud 项目上转换为浮点数 - TypeError: Image data cannot be converted to float on wordcloud project Python OpenCV 错误:“类型错误:图像数据无法转换为浮点数” - Python OpenCV Error: “TypeError: Image data cannot be converted to float” plt.imshow()给出TypeError(“图像数据无法转换为浮点数”) - plt.imshow() giving TypeError(“Image data cannot be converted to float”) TypeError:加载.npy文件时,图像数据无法转换为float - TypeError: Image data cannot be converted to float while loading .npy file TypeError: 图片数据不能转换为float // 导入.png图片时 - TypeError: Image data cannot be converted to float // When importing .png images TypeError: dtype object 的图像数据无法转换为浮点数修复 - TypeError: Image data of dtype object cannot be converted to float Fix
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM