Which GUI is used by my opencv program?


I want to write a program for windows, macos and WSL2 using pollkey. I need arrow key.

On windows left arrow key is

#define KEY_CODE_LEFT_ARROW 0x250000

Ubuntu WSL2 gtk3

#define KEY_CODE_LEFT_ARROW 0x10ff51

Mac os in progress

I don’t know how to check GUI used by opencv.
Somebody got an idea? (issue Expose HAVE_WIN32UI HAVE_GTK HAVE_COCOA HAVE_WAYLAND in cvconfig. · Issue #25329 · opencv/opencv · GitHub)

good luck with that. OpenCV is not a GUI library, nor is it meant to be very cross-platform.

it uses a different GUI library on every OS. Windows: native APIs. Linux: probably GTK. Apple: IDK, something native.

There’s a Qt backend. It has not been the choice for official builds in years, mostly because it’s too bloated both in its own operation and in terms of pulling in a gigantic dependency (Qt).

in the future, it might just use OpenGL on all of them. maybe then there might be some consistency in the key codes.

pollKey and waitKey are not called for the keys, but for the event processing.

note that pollKey only has an actual implementation on win32. on all others, it calls waitKey(1). I implemented it because waitKey() on Windows could not perform without at least a single Sleep(1) call in its code.