在win10+python+opencv3.4.5,測試
while True: key = cv2.waitKey(0) print('key =', key)
依次按上、下、左、右方向鍵,輸出:
key = 0 key = 0 key = 0 key = 0
測試代碼:
while True: key = cv2.waitKeyEx(0) print('key =', key)
依次按上、下、左、右方向鍵,輸出:
key = 2490368 key = 2621440 key = 2424832 key = 2555904
官方說,waitKeyEx和waitKey類似,Key code is implementation specific and depends on used backend: QT/GTK/Win32/etc