I have a numpy array that consist n (x and y) coordinate (i declared this nparray as 'line') from an image(newimg). lets take 5 coordinates as the example
[[ 33 101]
[170 95]
[151 190]
[125 223]
[115 207]]
an then i want to make a sequential line between that coordinates (point 1 to point 2, point 2 to point 3, ...., point n-1 to point n and the point n to point 1)
I trying to make the algorithm with cv2.line like this
for a in range(5) :
cv2.line(newimg, line[a:], line[a 1:], (255,255,255), 1)
cv2.line(newimg, line, line[1], (255,255,255), 1)
and it produce SystemError: new style getargs format but argument is not a tuple
any idea?
CodePudding user response:
Solve, i edited my code to
for a in range(4) :
cv2.line(newimg, tuple(line[a]), tuple(line[a 1]), (255,255,255), 1)
cv2.line(newimg, tuple(line[4], tuple(line[0]), (255,255,255), 1)
EDIT
Updated the code to connect a line between the first and last points in line