update watershed.py: check if windows are still open

change the `while` loop to check if the two windows created by this example still exist, stop the program otherwise
This commit is contained in:
Simon Hänisch 2016-06-27 17:03:37 +02:00 committed by GitHub
parent 0e436c3fe9
commit 6489d8a96f

View File

@ -55,7 +55,7 @@ class App:
cv2.imshow('watershed', vis)
def run(self):
while True:
while cv2.getWindowProperty('img', 0) != -1 or cv2.getWindowProperty('watershed', 0) != -1:
ch = 0xFF & cv2.waitKey(50)
if ch == 27:
break