python – SystemError: new style getargs format but argument is not a tuple?

python – SystemError: new style getargs format but argument is not a tuple?

Faced with the same problem and solved it by using tuples instead of lists:

# How it looked before:
point1, point2 = [x1, y1], [x2, y2]

# How it should be:
point1, point2 = (x1, y1), (x2, y2)

Python OpenCV drawing functions take points as tuples. Possibly your point1 and point2 are of some other type, eg. a list maybe. So try this

cv2.line(output, tuple(point1), tuple(point2), (0,0,255),5)

The error is raised, because the OpenCV Python extensions call the function PyArg_ParseTuple() with something that is not a tuple. [see here]

python – SystemError: new style getargs format but argument is not a tuple?

Try this…

point1=(x1,x2)
point2=(y1,y2)
new_img=cv2.line(img,point1,point2,(0,0,255),3)

Leave a Reply

Your email address will not be published.