Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commitefa4d91

Browse files
authored
Merge pull request#25661 from itlab-vision:framebuffer
Highgui backend on top of Framebuffer#25661### Pull Request Readiness ChecklistSee details athttps://github.com/opencv/opencv/wiki/How_to_contribute#making-a-good-pull-request- [ x] I agree to contribute to the project under Apache 2 License.- [ x] To the best of my knowledge, the proposed patch is not based on a code under GPL or another license that is incompatible with OpenCV- [ x] The PR is proposed to the proper branch- [ ] There is a reference to the original bug report and related work- [ x] There is accuracy test, performance test and test data in opencv_extra repository, if applicable Patch to opencv_extra has the same branch name.- [ x] The feature is well documented and sample code can be built with the project CMakeEnvironment variables used:OPENCV_UI_BACKEND - you need to add the value “FB”OPENCV_UI_PRIORITY_FB - requires priority indicationOPENCV_HIGHGUI_FB_MODE={FB|XVFB|EMU} - mode of using Framebuffer (default "FB")- FB - Linux Framebuffer- XVFB - virtual Framebuffer- EMU - emulation (images are not displayed)OPENCV_HIGHGUI_FB_DEVICE (FRAMEBUFFER) - path to the Framebuffer file (default "/dev/fb0").Examples of using:sudo OPENCV_UI_BACKEND=FB ./opencv_test_highguisudo OPENCV_UI_PRIORITY_FB=1111 ./opencv_test_highguiOPENCV_UI_BACKEND=FB OPENCV_HIGHGUI_FB_MODE=EMU ./opencv_test_highguisudo OPENCV_UI_BACKEND=FB OPENCV_HIGHGUI_FB_MODE=FB ./opencv_test_highguiexport DISPLAY=:99Xvfb $DISPLAY -screen 0 1024x768x24 -fbdir /tmp/ -f /tmp/user.xvfb.auth&sudo -u sipeed XAUTHORITY=/tmp/user.xvfb.auth x11vnc -display $DISPLAY -listen localhost&DISPLAY=:0 gvncviewer localhost&FRAMEBUFFER=/tmp/Xvfb_screen0 OPENCV_UI_BACKEND=FB OPENCV_HIGHGUI_FB_MODE=XVFB ./opencv_test_highgui
1 parent76a1d26 commitefa4d91

File tree

10 files changed

+991
-2
lines changed

10 files changed

+991
-2
lines changed

‎CMakeLists.txt‎

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -306,6 +306,10 @@ OCV_OPTION(WITH_GTK "Include GTK support" ON
306306
OCV_OPTION(WITH_GTK_2_X"Use GTK version 2"OFF
307307
VISIBLE_IFUNIXANDNOTAPPLEANDNOT ANDROID
308308
VERIFY HAVE_GTKANDNOT HAVE_GTK3)
309+
OCV_OPTION(WITH_FRAMEBUFFER"Include framebuffer support"OFF
310+
VISIBLE_IFUNIXANDNOTAPPLEANDNOT ANDROID)
311+
OCV_OPTION(WITH_FRAMEBUFFER_XVFB"Include virtual framebuffer support"OFF
312+
VISIBLE_IFUNIXANDNOTAPPLEANDNOT ANDROID)
309313
OCV_OPTION(WITH_WAYLAND"Include Wayland support"OFF
310314
VISIBLE_IFUNIXANDNOTAPPLEANDNOT ANDROID
311315
VERIFY HAVE_WAYLAND)
@@ -1462,6 +1466,13 @@ if(WITH_GTK OR HAVE_GTK)
14621466
endif()
14631467
endif()
14641468

1469+
if(WITH_FRAMEBUFFEROR HAVE_FRAMEBUFFER)
1470+
status(" Framebuffer UI:" HAVE_FRAMEBUFFER THENYES ELSENO)
1471+
if(WITH_FRAMEBUFFER_XVFBOR HAVE_FRAMEBUFFER_XVFB)
1472+
status(" Virtual framebuffer UI:" HAVE_FRAMEBUFFER_XVFB THENYES ELSENO)
1473+
endif()
1474+
endif()
1475+
14651476
if(WITH_OPENGLOR HAVE_OPENGL)
14661477
status(" OpenGL support:" HAVE_OPENGL THEN"YES (${OPENGL_LIBRARIES})" ELSENO)
14671478
endif()

‎cmake/checks/framebuffer.cpp‎

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
#include<X11/XWDFile.h>
2+
#include<X11/X.h>
3+
4+
intmain(void)
5+
{
6+
XWDFileHeader *xwd_header;
7+
XWDColor *xwd_colors;
8+
return0;
9+
}

‎modules/highgui/CMakeLists.txt‎

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,16 @@ list(REMOVE_ITEM highgui_ext_hdrs "${CMAKE_CURRENT_LIST_DIR}/include/opencv2/${n
4949

5050
set(OPENCV_HIGHGUI_BUILTIN_BACKEND"")
5151

52+
if(WITH_FRAMEBUFFERAND HAVE_FRAMEBUFFER)
53+
set(OPENCV_HIGHGUI_BUILTIN_BACKEND"FB")
54+
add_definitions(-DHAVE_FRAMEBUFFER)
55+
list(APPEND highgui_srcs${CMAKE_CURRENT_LIST_DIR}/src/window_framebuffer.cpp)
56+
list(APPEND highgui_hdrs${CMAKE_CURRENT_LIST_DIR}/src/window_framebuffer.hpp)
57+
if(HAVE_FRAMEBUFFER_XVFB)
58+
add_definitions(-DHAVE_FRAMEBUFFER_XVFB)
59+
endif()
60+
endif()
61+
5262
if(WITH_WAYLANDAND HAVE_WAYLAND)
5363
set(OPENCV_HIGHGUI_BUILTIN_BACKEND"Wayland")
5464
add_definitions(-DHAVE_WAYLAND)
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
# --- FB ---
2+
set(HAVE_FRAMEBUFFERON)
3+
if(WITH_FRAMEBUFFER_XVFB)
4+
try_compile(HAVE_FRAMEBUFFER_XVFB
5+
"${CMAKE_CURRENT_BINARY_DIR}"
6+
"${OpenCV_SOURCE_DIR}/cmake/checks/framebuffer.cpp")
7+
if(HAVE_FRAMEBUFFER_XVFB)
8+
message(STATUS"Check virtual framebuffer - done")
9+
else()
10+
message(STATUS
11+
"Check virtual framebuffer - failed\n"
12+
"Please install the xorg-x11-proto-devel or x11proto-dev package\n")
13+
endif()
14+
endif()

‎modules/highgui/cmake/init.cmake‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,8 @@ endmacro()
3939
add_backend("gtk" WITH_GTK)
4040
add_backend("win32ui" WITH_WIN32UI)
4141
add_backend("wayland" WITH_WAYLAND)
42+
add_backend("framebuffer" WITH_FRAMEBUFFER)
43+
4244
# TODO cocoa
4345
# TODO qt
4446
# TODO opengl

‎modules/highgui/src/backend.hpp‎

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -127,6 +127,10 @@ std::shared_ptr<UIBackend> createUIBackendGTK();
127127
std::shared_ptr<UIBackend> createUIBackendQT();
128128
#endif
129129

130+
#ifdef HAVE_FRAMEBUFFER
131+
std::shared_ptr<UIBackend>createUIBackendFramebuffer();
132+
#endif
133+
130134
#endif// BUILD_PLUGIN
131135

132136
}// namespace highgui_backend

‎modules/highgui/src/registry.impl.hpp‎

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,10 @@ std::vector<BackendInfo>& getBuiltinBackendsInfo()
4444
DECLARE_DYNAMIC_BACKEND("GTK2")
4545
#endif
4646

47+
#ifdef HAVE_FRAMEBUFFER
48+
DECLARE_STATIC_BACKEND("FB", createUIBackendFramebuffer)
49+
#endif
50+
4751
#if0 // TODO
4852
#ifdef HAVE_QT
4953
DECLARE_STATIC_BACKEND("QT", createUIBackendQT)

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp