Skip to content

Commit 6489d8a

Browse files
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
1 parent 0e436c3 commit 6489d8a

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

samples/python/watershed.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ def watershed(self):
5555
cv2.imshow('watershed', vis)
5656

5757
def run(self):
58-
while True:
58+
while cv2.getWindowProperty('img', 0) != -1 or cv2.getWindowProperty('watershed', 0) != -1:
5959
ch = 0xFF & cv2.waitKey(50)
6060
if ch == 27:
6161
break

0 commit comments

Comments
 (0)