I am displaying live video from a camera using OpenCV in Python. This is the code:
capture = cv.CaptureFromCAM(0)
if capture:
cv.NamedWindow("Live Video", cv.CV_WINDOW_AUTOSIZE)
frame = cv.QueryFrame(capture)
if frame:
cv.ShowImage("Live Video", frame)
cv.WaitKey(0)
cv.DestroyWindow("Live Video")
Now, I can only close my video window by pressing "esc", but nothing happens when I click on my window's close "X" button. Is there a way to make that work?
With the cv2
Python module there is a way to do that, I posted the solution here:
https://stackoverflow.com/a/37881722/2897426
This post is just for reference so anyone looking for it can find it
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With