复现路上的花开花落(2)cv2.error: OpenCV(4.6.0) :-1: error: (-5:Bad argument) in function ‘line‘

复现complex yolo

运行检测程序报错

Traceback (most recent call last):
  File "test_detection.py", line 152, in <module>
    bev_utils.drawRotatedBox(RGB_Map, int(x), int(y), int(w), l, int(yaw), cnf.colors[int(cls_pred)])
  File "E:\IDM下载\conplex yolo\Complex-YOLOv3\utils\kitti_bev_utils.py", line 174, in drawRotatedBox
    cv2.line(img, (corners_int[0, 0], corners_int[0, 1]), (corners_int[3, 0], corners_int[3, 1]), (255, 255, 0), 2)
cv2.error: OpenCV(4.6.0) :-1: error: (-5:Bad argument) in function 'line'
> Overload resolution failed:
>  - Can't parse 'pt1'. Sequence item with index 0 has a wrong type
>  - Can't parse 'pt1'. Sequence item with index 0 has a wrong type

原因:类型出错

解决办法:

第一种:将报错语句中所有能改类型的值全加上int强制转成整型

第二句更正为:

cv2.line(img, (int(corners_int[0, 0]), int(corners_int[0, 1])), (int(corners_int[3, 0]), int(corners_int[3, 1])), (255, 255, 0), 2)

第二种:opencv-python版本过高导致,降低版本

参考别的博主,从4.6.0降下来,亲测该版本可行

pip install opencv-python==4.5.1.48

参考链接:

无法解析“pt1”。索引为 0 的序列项的类型错误 ·问题 #48 ·Maudzung/Complex-YOLOv4-Pytorch (github.com)

【YOLOv4运行demo.py报错】:cv2.error: OpenCV(4.5.5) :-1: error: (-5:Bad argument) in function ‘rectangle‘_码上出奇迹的博客-CSDN博客

  • 4
    点赞
  • 4
    收藏
    觉得还不错? 一键收藏
  • 1
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值