OpenCV waitKey () alternative in IPython Notebook

I am trying to show cv2 library images in my Jupiter s laptop cv2.imshow(img)and it shows as expected, but I can’t use or don’t know how to use it cv2.waitKey(0), so the cell will not stop execution.

cv2.waitKey(0) works in a script, but not in a laptop.

Here is a snippet:

cv2.imshow('Image', img)
cv2.waitKey(0)
cv2.destroyAllWindows()

How to stop cell execution without restarting the entire kernel?

+4
source share
1 answer

So thanks to @Micka, here is the solution:

You must write first cv2.startWindowThread(), explaining here .

+7
source

Source: https://habr.com/ru/post/1609586/


All Articles