基于opencv制作GUI界面

可以基于cvui头文件实现一些控件操作,头文件及demo实例

这是一个demo
main.cpp

#include <opencv2/opencv.hpp>
#define CVUI_IMPLEMENTATION
#include "cvui.h"
 
#define WINDOW_NAME "CVUI Hello World!"
 
int main(void)
{
    cv::Mat frame = cv::Mat(200, 500, CV_8UC3);
    int count = 0;
 
    // Init a OpenCV window and tell cvui to use it.
    cv::namedWindow(WINDOW_NAME);
    cvui::init(WINDOW_NAME);
 
    while (true) {
        // Fill the frame with a nice color
        frame = cv::Scalar(49, 52, 49);
 
        // Show a button at position (110, 80)
        if (cvui::button(frame, 110, 80, "Hello, world!")) {
            // The button was clicked, so let's increment our counter.
            count++;
        }
 
        // Show how many times the button has been clicked.
        // Text at position (250, 90), sized 0.4, in red.
        cvui::printf(frame, 250, 90, 0.4, 0xff0000, "Button click count: %d", count);
 
        // Update cvui internal stuff
        cvui::update();
 
        // Show everything on the screen
        cv::imshow(WINDOW_NAME, frame);
 
        // Check if ESC key was pressed
        if (cv::waitKey(20) == 27) {
            break;
        }
    }
    return 0;
}

可以结合CPack将工程打包为执行文件,进行发布

参考

https://www.cnblogs.com/luohenyueji/p/16990946.html
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值