Ask Your Question

Revision history [back]

waitkey fails to handle non-English keyboard input

I am using opencv to build a camera function and at some point in the Python script, it uses waitKey() to get what key is pressed by the user.

k = cv2.waitKey(1)

# ESC is pressed
if k % 256 == 27:

The problem is that when the keyboard input is switched to Russian or Chinese, and the keys (e.g. q, w, e r, ...etc) are pressed. The program terminates unexpectedly with this error

ASSERT: "false" in file qasciikey.cpp, line 501
Abort trap: 6

How should I handle the keyboard input correctly such that this issue can be eliminated?

Thanks in advance