aisingapore / PeekingDuck

A modular framework built to simplify Computer Vision inference workloads.
Apache License 2.0
162 stars 38 forks source link

OpenCV python GUI window receiving last keypress from previous runs even after closing WSL #630

Open eric-kwok-nt opened 2 years ago

eric-kwok-nt commented 2 years ago

For WSL users, the GUI window will receive the last keypress from previous run. i.e. after pressing q to close the GUI window such as a video output from cv2.imshow(), when the user runs a script again, cv2.waitKey(1) & 0xFF == ord("q") will be evaluated to True without the user pressing anything, causing the video output to end prematurely.

Same issue has been documented in https://github.com/microsoft/wslg/issues/213

liyier90 commented 1 year ago

After updating WSL2 to the latest version with wsl --update, this issue appears to be resolved.

WSL2 version after update:

WSL version: 1.0.3.0
Kernel version: 5.15.79.1
WSLg version: 1.0.47
MSRDC version: 1.2.3575
Direct3D version: 1.606.4
DXCore version: 10.0.25131.1002-220531-1700.rs-onecore-base2-hyp
Windows version: 10.0.19045.2364