Open weathon opened 6 days ago
Solution found, in video_iou.py, comments the following lines.
cv2.namedWindow('origin') # create a window
cv2.setMouseCallback('origin', mouseHandler) # set mouse callback function
while True:
imgCopy = img.copy()
if len(pts) > 0:
cv2.circle(imgCopy, pts[-1], 5, (0, 0, 255), -1) # draw the last point
if len(pts) > 1:
for i in range(len(pts) - 1):
cv2.circle(imgCopy, pts[i], 5, (0, 0, 255), -1) # draw the other points
cv2.line(imgCopy, pts[i], pts[i + 1], (255, 0, 0), 2) # draw the line between two points
if drawing == False:
cv2.line(imgCopy, pts[0], pts[-1], (255, 0, 0), 2) # draw the line between the first point and the last point
cv2.imshow('origin', imgCopy)
key = 0xFF & cv2.waitKey(1) # Press ESC to exit
if key == 27:
break
cv2.destroyAllWindows() # close all windows
I got this error because I do not have a GUI interface on my machine.