'"cv2.error: OpenCV(4.5.5) :-1: error: (-5:Bad argument) in function 'line'"
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
Solution 1:[1]
The line function expects two coordinates (x0,y0) and (x1,y1). Try changing your call to this:
cv2.line(img,(coord[0][0],coord[0][1]),(coord[1][0],coord[1][1]),(0,0,255),2)
See the following link for an example.
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
Solution | Source |
---|---|
Solution 1 | babernathy |