“cv2.error:OpenCV(4.5.5):-1:错误:(-5:错误参数)在函数'line'中“

kyks70gy  于 2023-04-07  发布在  其他
关注(0)|答案(1)|浏览(253)
Traceback (most recent call last):
  File "C:\Users\Inspiron\PycharmProjects\car\main.py", line 13, in <module>
    cv2.line(img,(coord[0][0],coord[0][1],coord[1][0],coord[1][1]),(0,0,255),2)
cv2.error: OpenCV(4.5.5) :-1: error: (-5:Bad argument) in function 'line'
> Overload resolution failed:
>  - Can't parse 'pt1'. Expected sequence length 2, got 4
>  - Can't parse 'pt1'. Expected sequence length 2, got 4
gzjq41n4

gzjq41n41#

line函数需要两个坐标(x0,y0)和(x1,y1)。尝试将调用改为:

cv2.line(img,(coord[0][0],coord[0][1]),(coord[1][0],coord[1][1]),(0,0,255),2)

请参见下面的link示例。

相关问题