I’m working on a program (python ,opencv) in which I use the spacebar to go to the next frame, and Esc to exit the program. These are the only two keys i’ve got working. I tried to find out about more keys , tried various codes for them but didnt work. especially arrow keys.
I found this about waitkey, but it doesn’t work.
So my question is, How do I catch other keys besides esc and spacebar to trigger certain functions in my python-opencv program?
You can use
ord()function in Python for that.For example, if you want to trigger ‘a’ key press, do as follows :
See a sample code here: Drawing Histogram
UPDATE :
To find the key value for any key is to print the key value using a simple script as follows :
With this code, I got following values :