Skip to content

Commit eb5f7c2

Browse files
committed
handle mouse clicking window close icon to exit program
1 parent d2ad12d commit eb5f7c2

1 file changed

Lines changed: 5 additions & 0 deletions

File tree

cmd/yolo-detection/main.go

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -96,9 +96,14 @@ func main() {
9696
detect(&net, &img, outputNames)
9797

9898
window.IMShow(img)
99+
99100
if window.WaitKey(1) >= 0 {
100101
break
101102
}
103+
// break if user clicked the window close button
104+
if window.GetWindowProperty(gocv.WindowPropertyVisible) < 1 {
105+
break
106+
}
102107
}
103108
}
104109

0 commit comments

Comments
 (0)