Quantcast
Channel: OpenCV Q&A Forum - Latest question feed
Viewing all articles
Browse latest Browse all 19555

destroywindow and destroyallwindows not working.

$
0
0
Mac, Python 3.5.2 destroywindow and destroyallwindows cannot close the windows created by the program. I found something saying I need to use waitkey afterwards but I can't get it to work. The following code isn't mine it's from a tutorial as an example that should work. The code successfully displays the live feed from my webcam but the window won't close when I hit 'q' to escape. import numpy as np import cv2 cap = cv2.VideoCapture(0) while(True): # Capture frame-by-frame ret, frame = cap.read() # Display the resulting frame cv2.imshow('frame',frame) if cv2.waitKey(1) & 0xFF == ord('q'): break cv2.destroyWindow('frame') # When everything done, release the capture cap.release() ##

Viewing all articles
Browse latest Browse all 19555

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>