I check other question on google or stackoverflow, they are talking about run cv2.imshow in script, but my code run in jupyter notebook.
Here is my configuration:
<
This will help you understand what is happening:
import cv2
cvim2disp = cv2.imread('data/home.jpg')
cv2.imshow('HelloWorld', cvim2disp)
cv2.waitKey(0)
cv2.destroyWindow('HelloWorld')
waitKey(0)
method is waiting for an input infinitely. When you see a frame of the corresponding image, do not try to close the image using close in top right corner.
Instead press some key. waitkey
method will take that as an input and it will return back a value. Further you can also check which key was pressed to close the frame.
Additionally waitKey(33)
will keep the frame active for 33 ms and then close it automatically.
destroyWindow()
will destroy the current frame if there.
destroyAllWindows()
will destroy all the frames currently present.
This will solve.