8
8

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 5 years have passed since last update.

JupyterでOpenCVを使うときにdestroyAllWindows()すると固まってしまう

Posted at

問題

JupyterでOpenCVを使うときにcv2.destroyAllWindows()すると固まってしまう

環境

  • macOS High Sierra
  • Jupyter notebook
  • OpenCV2

解決

cv2.startWindowThread()
cv2.imshow('image', img)
key = cv2.waitKey(0)

if key == ord('q'):            #qを押した時の処理
    cv2.waitKey(1)
    cv2.destroyAllWindows()
    cv2.waitKey(1)   

まとめ

  • imshowの前にstartWindowThread()を入れる
  • destroyAllWindows()をwaitKey()で挟む

参考にしたリンク

8
8
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
8
8

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?