1 | initial version |
A minute of googling could have made you find out that you can use getWindowProperty() to check whether the window is ok: https://medium.com/@mh_yip/opencv-detect-whether-a-window-is-closed-or-close-by-press-x-button-ee51616f7088
2 | No.2 Revision |
A minute of googling could have made you find out that you can use getWindowProperty() to check whether the window is ok: https://medium.com/@mh_yip/opencv-detect-whether-a-window-is-closed-or-close-by-press-x-button-ee51616f7088
[EDIT] in case of link becomes unavailable, here's the relevant part of the article: you can check if the window is still open using the WND_PROP_VISIBLE
propoerty of the window. So the waitKey()
line becomes:
while( (chr<0) && (getWindowProperty("Image1",WND_PROP_VISIBLE)) ){ chr=waitKey(100); }