Skip to content

Commit 63b9d10

Browse files
wswdayhellock
authored andcommitted
Press key to exit (open-mmlab#1155)
1 parent 87d9ca4 commit 63b9d10

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

tools/webcam_demo.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,9 +27,15 @@ def main():
2727

2828
camera = cv2.VideoCapture(args.camera_id)
2929

30+
print('Press "Esc", "q" or "Q" to exit.')
3031
while True:
3132
ret_val, img = camera.read()
3233
result = inference_detector(model, img)
34+
35+
ch = cv2.waitKey(1)
36+
if ch == 27 or ch == ord('q') or ch == ord('Q'):
37+
break
38+
3339
show_result(
3440
img, result, model.CLASSES, score_thr=args.score_thr, wait_time=1)
3541

0 commit comments

Comments
 (0)