I'm trying to learn OpenCV framework on python3 and when I want to destroy an opened image, nothing happens and the only way to close the window is "Force Quit". I tried some solutions like cv2.startWindowThread()
but it didn't work for me. Here is my code:
import cv2
import numpy as np
import matplotlib as plt
img = cv2.imread('image.jpg')
cv2.startWindowThread()
cv2.imshow('image', img)
cv2.waitKey(0)
cv2.destroyAllWindows()
versions:
python -> 3.6.0
OpenCV -> 3.3.0
macOS High Sierra -> 10.13.6
Update:
I was trying to run the code in jupyter-notebook and when I tried to run it in Pycharm I had no more problem.