'SystemError: new style getargs format but argument is not a tuple?
What causes the SystemError in this line of code
cv2.line(output, point1, point2, (0,0,255), 5)?
Solution 1:[1]
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)
Solution 2:[2]
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]
Solution 3:[3]
It seems the lastest version opencv-python have fixed this issue, I upgrade opencv-python from 4.4.0.44 to 4.5.5.64 by pip install --upgrade opencv-python, then this error disappear.
Solution 4:[4]
Try this...
point1=(x1,x2)
point2=(y1,y2)
new_img=cv2.line(img,point1,point2,(0,0,255),3)
Solution 5:[5]
The passing arguments aren't matching with the desirable arguments. I have faced same problem for:
x = cv2.resize(img, (32*32)).flatten()
x.resize(3032, 1)
And, solve it by correcting 32*32 to 32, 32.
x = cv2.resize(img, (32,32)).flatten()
x.resize(3032, 1)
Solution 6:[6]
just write this following way v2.line(output, tuple(point1), tuple(point2), (0,0,255), 5)?
Solution 7:[7]
since it didn't work in colab :(with same error )
cv2.drawChessboardCorners(imgBoard, board_size, found_corners, True) plt.imshow("imgBoard", imgBoard)
*i switched to my own small function:*
def showImageWithCorners(img,cornerToShow):
plt.plot(cornerToShow[:,0], cornerToShow[:,1], marker='o', color="red")
plt.imshow(img)
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 | Leonid Dashko |
| Solution 2 | |
| Solution 3 | Wade Wang |
| Solution 4 | praveen kumar dakua |
| Solution 5 | Shuvra |
| Solution 6 | Ishaque3 Nizamani |
| Solution 7 | user3452134 |
