{"action":"closed","number":6702,"pull_request":{"url":"https://api.github.com/repos/Itseez/opencv/pulls/6702","id":74430185,"html_url":"https://github.com/Itseez/opencv/pull/6702","diff_url":"https://github.com/Itseez/opencv/pull/6702.diff","patch_url":"https://github.com/Itseez/opencv/pull/6702.patch","issue_url":"https://api.github.com/repos/Itseez/opencv/issues/6702","number":6702,"state":"closed","locked":false,"title":"watershed.py: check if windows are still open","user":{"login":"simonhaenisch","id":3410759,"avatar_url":"https://avatars.githubusercontent.com/u/3410759?v=3","gravatar_id":"","url":"https://api.github.com/users/simonhaenisch","html_url":"https://github.com/simonhaenisch","followers_url":"https://api.github.com/users/simonhaenisch/followers","following_url":"https://api.github.com/users/simonhaenisch/following{/other_user}","gists_url":"https://api.github.com/users/simonhaenisch/gists{/gist_id}","starred_url":"https://api.github.com/users/simonhaenisch/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/simonhaenisch/subscriptions","organizations_url":"https://api.github.com/users/simonhaenisch/orgs","repos_url":"https://api.github.com/users/simonhaenisch/repos","events_url":"https://api.github.com/users/simonhaenisch/events{/privacy}","received_events_url":"https://api.github.com/users/simonhaenisch/received_events","type":"User","site_admin":false},"body":"### What does this PR change?\r\n\r\nI changed the `while` loop condition so it checks if the two windows that this example creates still exist, and stops the program otherwise. This is done via `cv2.getWindowProperty()`. Before, if both windows were closed using the `X` button instead of pressing `ESC` to quit, the loop would still continue and there would be no way to quit the program other than killing the Python process. Now the `while` loop stops when both windows are manually closed. I think this is good practice and should be somewhere in the examples.\r\n\r\nWhat I do is get the `CV_WND_PROP_FULLSCREEN` property of the window using [`cv2.getWindowProperty()`](http://docs.opencv.org/2.4/modules/highgui/doc/qt_new_functions.html#getwindowproperty) (the flag is defined as `0` in [highgui_c.h](https://github.com/Itseez/opencv/blob/master/modules/highgui/include/opencv2/highgui/highgui_c.h)). This returns a value `>= 0` as long as the window is open, and `-1` as soon as the window is closed. This way it can be used to check if the window still exists.\r\n\r\n*(It may also be beneficial to set the window names as properties in the `App` class, so it is clear where the names come from.)*","created_at":"2016-06-20T11:45:39Z","updated_at":"2016-06-21T19:12:28Z","closed_at":"2016-06-21T19:12:28Z","merged_at":null,"merge_commit_sha":"db63162da85fcda5de42f6e41d1176879c3376fc","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/Itseez/opencv/pulls/6702/commits","review_comments_url":"https://api.github.com/repos/Itseez/opencv/pulls/6702/comments","review_comment_url":"https://api.github.com/repos/Itseez/opencv/pulls/comments{/number}","comments_url":"https://api.github.com/repos/Itseez/opencv/issues/6702/comments","statuses_url":"https://api.github.com/repos/Itseez/opencv/statuses/e42afac286ba7cadb816ee8b06a5e39809e4e3f6","head":{"label":"simonhaenisch:simonhaenisch-improve-watershed.py-example","ref":"simonhaenisch-improve-watershed.py-example","sha":"e42afac286ba7cadb816ee8b06a5e39809e4e3f6","user":{"login":"simonhaenisch","id":3410759,"avatar_url":"https://avatars.githubusercontent.com/u/3410759?v=3","gravatar_id":"","url":"https://api.github.com/users/simonhaenisch","html_url":"https://github.com/simonhaenisch","followers_url":"https://api.github.com/users/simonhaenisch/followers","following_url":"https://api.github.com/users/simonhaenisch/following{/other_user}","gists_url":"https://api.github.com/users/simonhaenisch/gists{/gist_id}","starred_url":"https://api.github.com/users/simonhaenisch/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/simonhaenisch/subscriptions","organizations_url":"https://api.github.com/users/simonhaenisch/orgs","repos_url":"https://api.github.com/users/simonhaenisch/repos","events_url":"https://api.github.com/users/simonhaenisch/events{/privacy}","received_events_url":"https://api.github.com/users/simonhaenisch/received_events","type":"User","site_admin":false},"repo":null},"base":{"label":"Itseez:master","ref":"master","sha":"31952fbf1c081a4a62b3def3dc27b860e157d32c","user":{"login":"Itseez","id":1786446,"avatar_url":"https://avatars.githubusercontent.com/u/1786446?v=3","gravatar_id":"","url":"https://api.github.com/users/Itseez","html_url":"https://github.com/Itseez","followers_url":"https://api.github.com/users/Itseez/followers","following_url":"https://api.github.com/users/Itseez/following{/other_user}","gists_url":"https://api.github.com/users/Itseez/gists{/gist_id}","starred_url":"https://api.github.com/users/Itseez/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Itseez/subscriptions","organizations_url":"https://api.github.com/users/Itseez/orgs","repos_url":"https://api.github.com/users/Itseez/repos","events_url":"https://api.github.com/users/Itseez/events{/privacy}","received_events_url":"https://api.github.com/users/Itseez/received_events","type":"Organization","site_admin":false},"repo":{"id":5108051,"name":"opencv","full_name":"Itseez/opencv","owner":{"login":"Itseez","id":1786446,"avatar_url":"https://avatars.githubusercontent.com/u/1786446?v=3","gravatar_id":"","url":"https://api.github.com/users/Itseez","html_url":"https://github.com/Itseez","followers_url":"https://api.github.com/users/Itseez/followers","following_url":"https://api.github.com/users/Itseez/following{/other_user}","gists_url":"https://api.github.com/users/Itseez/gists{/gist_id}","starred_url":"https://api.github.com/users/Itseez/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Itseez/subscriptions","organizations_url":"https://api.github.com/users/Itseez/orgs","repos_url":"https://api.github.com/users/Itseez/repos","events_url":"https://api.github.com/users/Itseez/events{/privacy}","received_events_url":"https://api.github.com/users/Itseez/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/Itseez/opencv","description":"Open Source Computer Vision Library","fork":false,"url":"https://api.github.com/repos/Itseez/opencv","forks_url":"https://api.github.com/repos/Itseez/opencv/forks","keys_url":"https://api.github.com/repos/Itseez/opencv/keys{/key_id}","collaborators_url":"https://api.github.com/repos/Itseez/opencv/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/Itseez/opencv/teams","hooks_url":"https://api.github.com/repos/Itseez/opencv/hooks","issue_events_url":"https://api.github.com/repos/Itseez/opencv/issues/events{/number}","events_url":"https://api.github.com/repos/Itseez/opencv/events","assignees_url":"https://api.github.com/repos/Itseez/opencv/assignees{/user}","branches_url":"https://api.github.com/repos/Itseez/opencv/branches{/branch}","tags_url":"https://api.github.com/repos/Itseez/opencv/tags","blobs_url":"https://api.github.com/repos/Itseez/opencv/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/Itseez/opencv/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/Itseez/opencv/git/refs{/sha}","trees_url":"https://api.github.com/repos/Itseez/opencv/git/trees{/sha}","statuses_url":"https://api.github.com/repos/Itseez/opencv/statuses/{sha}","languages_url":"https://api.github.com/repos/Itseez/opencv/languages","stargazers_url":"https://api.github.com/repos/Itseez/opencv/stargazers","contributors_url":"https://api.github.com/repos/Itseez/opencv/contributors","subscribers_url":"https://api.github.com/repos/Itseez/opencv/subscribers","subscription_url":"https://api.github.com/repos/Itseez/opencv/subscription","commits_url":"https://api.github.com/repos/Itseez/opencv/commits{/sha}","git_commits_url":"https://api.github.com/repos/Itseez/opencv/git/commits{/sha}","comments_url":"https://api.github.com/repos/Itseez/opencv/comments{/number}","issue_comment_url":"https://api.github.com/repos/Itseez/opencv/issues/comments{/number}","contents_url":"https://api.github.com/repos/Itseez/opencv/contents/{+path}","compare_url":"https://api.github.com/repos/Itseez/opencv/compare/{base}...{head}","merges_url":"https://api.github.com/repos/Itseez/opencv/merges","archive_url":"https://api.github.com/repos/Itseez/opencv/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/Itseez/opencv/downloads","issues_url":"https://api.github.com/repos/Itseez/opencv/issues{/number}","pulls_url":"https://api.github.com/repos/Itseez/opencv/pulls{/number}","milestones_url":"https://api.github.com/repos/Itseez/opencv/milestones{/number}","notifications_url":"https://api.github.com/repos/Itseez/opencv/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/Itseez/opencv/labels{/name}","releases_url":"https://api.github.com/repos/Itseez/opencv/releases{/id}","deployments_url":"https://api.github.com/repos/Itseez/opencv/deployments","created_at":"2012-07-19T09:40:17Z","updated_at":"2016-06-21T17:41:00Z","pushed_at":"2016-06-21T18:03:07Z","git_url":"git://github.com/Itseez/opencv.git","ssh_url":"git@github.com:Itseez/opencv.git","clone_url":"https://github.com/Itseez/opencv.git","svn_url":"https://github.com/Itseez/opencv","homepage":"opencv.org","size":1076588,"stargazers_count":9988,"watchers_count":9988,"language":"C++","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":8429,"mirror_url":null,"open_issues_count":1094,"forks":8429,"open_issues":1094,"watchers":9988,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/Itseez/opencv/pulls/6702"},"html":{"href":"https://github.com/Itseez/opencv/pull/6702"},"issue":{"href":"https://api.github.com/repos/Itseez/opencv/issues/6702"},"comments":{"href":"https://api.github.com/repos/Itseez/opencv/issues/6702/comments"},"review_comments":{"href":"https://api.github.com/repos/Itseez/opencv/pulls/6702/comments"},"review_comment":{"href":"https://api.github.com/repos/Itseez/opencv/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/Itseez/opencv/pulls/6702/commits"},"statuses":{"href":"https://api.github.com/repos/Itseez/opencv/statuses/e42afac286ba7cadb816ee8b06a5e39809e4e3f6"}},"merged":false,"mergeable":true,"mergeable_state":"clean","merged_by":null,"comments":1,"review_comments":0,"commits":1,"additions":1,"deletions":1,"changed_files":1}}
{"actor":{"display_login":"alalek"}}