Uma Lib (muito) da interface do usuário, construída sobre as primitivas de desenho de OpenCV. Outras libs da interface do usuário, como o ImGui, exigem um back -end gráfico (por exemplo, o OpenGL) para funcionar; portanto, se você deseja usar o Imgui em um aplicativo OpenCV, você deve torná -lo ativado o OpenGL, por exemplo. Não é o caso da CVUI, que usa apenas as primitivas de desenho de OpenCV para fazer toda a renderização (sem necessidade de OpenGL ou QT).
O CVUI é um LIB somente para cabeçalho que não requer uma construção. Basta adicionar cvui.h (ou cvui.py ) ao seu projeto e você estará pronto para ir. A única dependência é o OpenCV (versão 2.x ou 3.x ), que você provavelmente já está usando.
Verifique a documentação on -line ou a pasta Exemplos para aprender a usar o CVUI. O uso geral em C ++ e Python é mostrado abaixo.
Uso em 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 ;
}Uso em 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 Copyright (c) 2016 Fernando Bevilacqua. Licenciado sob a licença do MIT.
Veja todas as alterações no arquivo Changelog.