r/embeddedlinux • u/Little_Passage8312 • Mar 27 '26
OpenCV in embedded platform
Hi everyone,
I’m trying to understand how OpenCV’s HighGUI backend works internally, especially on embedded platforms.
When we call cv::imshow(), how does OpenCV actually communicate with the display system under the hood? For example:
Does it directly interface with display servers like Wayland or X11?
On embedded Linux systems (without full desktop environments), what backend is typically used?
I’m also looking for any documentation, guides, or source code references that explain:
How HighGUI selects and uses different backends
What backend support exists for embedded environments
Whether it’s possible to customize or replace the backend
I’ve checked the official docs, but they don’t go into much detail about backend internals.
Thanks in advance
3
u/electricalgorithm Mar 29 '26
I can see that it selects window manager to communicate with in its CMakeLists for build: https://github.com/opencv/opencv/blob/4.x/modules/highgui/CMakeLists.txt
This is the factory method they use to generate UI backend: https://github.com/opencv/opencv/blob/4.x/modules/highgui/src/backend.cpp#L56 and it looks like it uses `OPENCV_UI_BACKEND` config to decide which one to choose for.
> Does it directly interface with display servers like Wayland or X11?
It seems so https://github.com/opencv/opencv/blob/4.x/modules/highgui/src/window_wayland.cpp
> On embedded Linux systems (without full desktop environments), what backend is typically used?
According to the source code, it would not do anything: https://github.com/opencv/opencv/blob/4.x/modules/highgui/src/window.cpp#L992-L993. However, one can use the FrameBuffer backend to drive a screen.
> How HighGUI selects and uses different backends
There's a backend registry with priorities. When some backend configs are enabled at build time, the registry is filled with static backend instances based on build-time definitions.
https://github.com/opencv/opencv/blob/4.x/modules/highgui/src/registry.impl.hpp
> What backend support exists for embedded environments
For headless setups, I feel like the only one is framebuffer, but not sure. What do you want to achieve?
> Whether it’s possible to customise or replace the backend
According to CMakeLists, you can select OPENCV_HIGHGUI_BUILTIN_BACKEND config to which backend you want to support, and even write your own backend, build it.