cvui
v2.7.0
一個(非常)簡單的UI lib構建在OpenCV繪製繪製基礎上的頂部。其他UI LIB,例如IMGUI,需要圖形後端(例如OpenGL)工作,因此,如果您想在OpenCV應用中使用IMGUI,則必須使其啟用OpenGL。 CVUI並非如此,該CVUI僅使用OpenCV繪製原始圖來完成所有渲染(無需openGL或QT)。
CVUI是不需要構建的僅標題LIB。只需將cvui.h (或cvui.py )添加到您的項目中,就可以開始使用。唯一的依賴性是OPENCV( 2.x版或3.x版),您可能已經使用了。
檢查在線文檔或示例文件夾以了解如何使用CVUI。 C ++和Python中的一般用法如下所示。
在C ++中使用:
# include < opencv2/opencv.hpp >
// One (and only one) of your C++ files must define CVUI_IMPLEMENTATION
// before the inclusion of cvui.h to ensure its implementaiton is compiled.
# define CVUI_IMPLEMENTATION
# include " cvui.h "
# define WINDOW_NAME " CVUI Hello World! "
int main ( int argc, const char *argv[])
{
// Create a frame where components will be rendered to.
cv::Mat frame = cv::Mat ( 200 , 500 , CV_8UC3);
// Init cvui and tell it to create a OpenCV window, i.e. cv::namedWindow(WINDOW_NAME).
cvui::init (WINDOW_NAME);
while ( true ) {
// Fill the frame with a nice color
frame = cv::Scalar ( 49 , 52 , 49 );
// Render UI components to the frame
cvui::text (frame, 110 , 80 , " Hello, world! " );
cvui::text (frame, 110 , 120 , " cvui is awesome! " );
// Update cvui stuff and show everything on the screen
cvui::imshow (WINDOW_NAME, frame);
if ( cv::waitKey ( 20 ) == 27 ) {
break ;
}
}
return 0 ;
}在Python中使用:
import numpy as np
import cv2
import cvui
WINDOW_NAME = 'CVUI Hello World!'
# Create a frame where components will be rendered to.
frame = np . zeros (( 200 , 500 , 3 ), np . uint8 )
# Init cvui and tell it to create a OpenCV window, i.e. cv2.namedWindow(WINDOW_NAME).
cvui . init ( WINDOW_NAME )
while True :
# Fill the frame with a nice color
frame [:] = ( 49 , 52 , 49 )
# Render UI components to the frame
cvui . text ( frame , 110 , 80 , 'Hello, world!' )
cvui . text ( frame , 110 , 120 , 'cvui is awesome!' )
# Update cvui stuff and show everything on the screen
cvui . imshow ( WINDOW_NAME , frame )
if cv2 . waitKey ( 20 ) == 27 :
break 版權(C)2016 Fernando Bevilacqua。根據MIT許可獲得許可。
查看ChangElog文件中的所有更改。