I tried to make a circle with cv2.circle
:
import cv2
cap = cv2.VideoCapture(0)
while(True):
ret, frame = cap.read()
a = cv2.circle(frame, frame[0]/2, frame[1]/2, 30, (0,255,255))
#cv2.imshow("test", opening)
if cv2.waitKey(1) & 0xFF == ord("q"):
break
cap.release()
cv2.destroyAllWindows()
After I ran this code above, I got this:
a = cv2.circle(frame, frame[0]/2, frame[1]/2, 30, (0,255,255))
cv2.error: OpenCV(4.5.2) :-1: error: (-5:Bad argument) in function 'circle'
> Overload resolution failed:
> - Can't parse 'center'. Expected sequence length 2, got 1280
> - Can't parse 'center'. Expected sequence length 2, got 1280
I thought it's about center coordinates, and changed frame[0]/2
as 300
, and did the same to other. It worked.
here's output.
So I used a virtual machine to test the same code with frame[0]/2
and frame[1]/2
and did the same things. I got this error message:
a = cv2.circle(frame, tuple(frame[0]/2), tuple(frame[1]/2), 10, (0,255,255))
TypeError: function takes exactly 2 arguments (1920 given)
My computer: MacBook pro m1 Visual Studio Code
Virtual Machine: Ubuntu 20.04.2 LTS PyCharm
Can anyone help me? I'm new at mac, StackOverflow and OpenCV so if I did a wrong thing please indicate it. Thank you all in advance.