Very simple code
import cv2
cap = cv2.VideoCapture('../data/videos/cat.mp4')
ret, frame = cap.read()
cv2.imshow('Hi', frame)
cv2.waitKey(0)
cv2.destroyAllWindows()
It opens the first frame as expected and shows it. When I press a key however, python refuses to respond and I get Application not responding
leading to a crash after a while or me having to manually force quit it.
I'm running it in a Jupyter notebook in VSCode (using the extension). Strange thing is that when I run this code in a .py
file inside VSCode, it does work as expected. I see a million and one threads about this but they mostly give the advice add waitKey
and destroyAllWindows
but I haven't come across one using ipynb
in VSCode. Anyone knows how to fix this?