1 Star 0 Fork 0

hwp9527 / cvui

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
克隆/下载
贡献代码
同步代码
取消
提示: 由于 Git 不支持空文件夾,创建文件夹后会生成空的 .keep 文件
Loading...
README
MIT

cvui

A (very) simple UI lib built on top of OpenCV drawing primitives. Other UI libs, such as imgui, require a graphical backend (e.g. OpenGL) to work, so if you want to use imgui in a OpenCV app, you must make it OpenGL enabled, for instance. It is not the case with cvui, which uses only OpenCV drawing primitives to do all the rendering (no OpenGL or Qt required).

image

Features

  • Lightweight and simple to use user interface;
  • Header-only with no external dependencies (except OpenCV);
  • Based on OpenCV drawing primitives only (OpenGL or Qt are not required);
  • Friendly and C-like API (no classes/objects, etc);
  • Easily render components without worrying about their position (using rows/columns);
  • Simple (yet powerful) mouse API;
  • Modest number of UI components (11 in total);
  • Available in C++ and Python (pure implementation, no bindings).

Build

cvui is a header-only lib that does not require a build. Just add cvui.h (or cvui.py) to your project and you are ready to go. The only dependency is OpenCV (version 2.x or 3.x), which you are probably using already.

Usage

Check the online documentation or the examples folder to learn how to use cvui. The general usage in C++ and Python is shown below.

Usage in 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;
}

Usage in 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

License

Copyright (c) 2016 Fernando Bevilacqua. Licensed under the MIT license.

Change log

See all changes in the CHANGELOG file.

The MIT License (MIT) Copyright (c) 2016 Fernando Bevilacqua Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

简介

A (very) simple UI lib built on top of OpenCV drawing primitives 展开 收起
C++ 等 4 种语言
MIT
取消

发行版

暂无发行版

贡献者

全部

近期动态

加载更多
不能加载更多了
1
https://gitee.com/hwp.git/cvui.git
git@gitee.com:hwp.git/cvui.git
hwp.git
cvui
cvui
master

搜索帮助