青铜弟弟 2021-07-23 16:57 采纳率: 62.5%
浏览 2111
已结题

AttributeError: 'NoneType' object has no attribute 'shape'

height, weight = img.shape
AttributeError: 'NoneType' object has no attribute 'shape'
而且:cv2.imshow('input',img_input)
cv2.error: OpenCV(4.4.0) C:\Users\appveyor\AppData\Local\Temp\1\pip-req-build-6sxsq0tp\opencv\modules\highgui\src\window.cpp:376: error: (-215:Assertion failed) size.width>0 && size.height>0 in function 'cv::imshow'

img

求指导

  • 写回答

2条回答 默认 最新

  • python收藏家 2021-07-23 17:27
    关注

    img.shape 这个元组的元素应该是3 或者4吧,你只有两个变量接收 肯定会报错,而且你要判断这个img.shape是不是有值的先,二元组才能你这样写

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论
查看更多回答(1条)

报告相同问题?

问题事件

  • 系统已结题 7月31日
  • 已采纳回答 7月23日
  • 创建了问题 7月23日

悬赏问题

  • ¥50 Kubernetes&Fission&Eleasticsearch
  • ¥15 有没有帮写代码做实验仿真的
  • ¥15 報錯:Person is not mapped,如何解決?
  • ¥30 vmware exsi重置后登不上
  • ¥15 易盾点选的cb参数怎么解啊
  • ¥15 MATLAB运行显示错误,如何解决?
  • ¥15 c++头文件不能识别CDialog
  • ¥15 Excel发现不可读取的内容
  • ¥15 关于#stm32#的问题:CANOpen的PDO同步传输问题
  • ¥20 yolov5自定义Prune报错,如何解决?