From 6489d8a96fbadfca0070762829bf8374457e809d Mon Sep 17 00:00:00 2001 From: =?utf8?q?Simon=20H=C3=A4nisch?= Date: Mon, 27 Jun 2016 17:03:37 +0200 Subject: [PATCH] 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 --- samples/python/watershed.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/samples/python/watershed.py b/samples/python/watershed.py index 6d349e1..134e499 100755 --- a/samples/python/watershed.py +++ b/samples/python/watershed.py @@ -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 -- 2.7.4