I am trying to close popup window when i call model.predict
using YOLOv8. I want to close window in code only, not using clt+c or q on popup window. Here is my code
import numpy
import datetime
import imutils
model = YOLO("./Inference_Files/EmptySpace.pt")
file_path= "path_to_video_file"
cap = cv2.VideoCapture(file_path)
while 1:
# Capture frame-by-frame
ret, frame = cap.read()
if ret == True:
# Display the resulting frame
#cv2.imshow('Frame', frame)
res = model.predict(frame,save=True,show=True)
else:
cap.release()
print("video playing is done")
#cv2.waitKey(0)
cv2.destroyAllWindows()
cv2.destroyAllWindows()
i tried using cv2.destroyAllWindows()
once prediction is done but still popup window will keep alive.