Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How can I read a "ctrl+q" input from user using opencv and Python?

Tags:

python

opencv

I am using:-

key=cv2.waitKey(1) #& 0xFF 
    if key== ord('q'):
        ....................

but I need the input from user to be ctrl+q

Thanks

like image 394
Walid Ahmed Avatar asked Jan 31 '26 21:01

Walid Ahmed


1 Answers

CTRL+Q is encoded as 17 in ASCII control key table. Below is a sample code.

cv2.imshow('frame', frame)
key = cv2.waitKey(1)
if key == 17:        # Ctrl+Q or ^Q
    break
like image 153
thewaywewere Avatar answered Feb 03 '26 09:02

thewaywewere



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!