Saturday, April 16, 2016

IPython freeze on OpenCV destroyAllWindows

If you are running OpenCV on an IPython console, chances are cv2.destroyAllWindows() will freeze your image window and ultimately kill the kernel. To get around this, intersperse your code with the following functions (startWindowThread() and waitKey(1)) :

cv2.namedWindow('image')
cv2.startWindowThread()
.
.
.
cv2.waitKey(1)
cv2.destroyAllWindows()
cv2.waitKey(1)

Should hopefully solve the issue!

No comments:

Post a Comment