opencv读入一个视频,识别其中的不同颜色的能量条并用矩形框选,框选后能用滑动条进行颜色切换,并输出能量条中心点


#include <opencv2/highgui/highgui.hpp>
#include <opencv2/imgproc/imgproc.hpp>
#include <opencv2/opencv.hpp>
#include <iostream>
#include "armordetection.h"

using namespace cv;
using namespace std;

int main()
{
    VideoCapture capture("D:/1/1.avi");

    //创建滑动条
    int i = 0;
    int max = 1;
    void text(int,void*);
    namedWindow("测试窗口", WINDOW_NORMAL);
    createTrackbar("数字:", "测试窗口:", &i, max, text);

    void text()
    {



    }

    while (1)
    {
        Mat frame;
        capture >> frame;


        //分离图像通道
        vector<Mat> channels;

        split(frame, channels);

        for (;;)
        {
            capture >> frame;
            imshow("original", frame);
            split(frame, channels);

            imshow("red", channels.at(2));
            imshow("green", channels.at(1));
            imshow("blue", channels.at(0));

            if (waitKey(30) >= 0)
                break;
        }

    }
    return 0;
}

然后怎么写?程序有什么问题呢?

img

你好,我是有问必答小助手,非常抱歉,本次您提出的有问必答问题,技术专家团超时未为您做出解答


本次提问扣除的有问必答次数,已经为您补发到账户,我们后续会持续优化,扩大我们的服务范围,为您带来更好地服务。

您好,我是有问必答小助手,您的问题已经有小伙伴帮您解答,感谢您对有问必答的支持与关注!
PS:问答VIP年卡 【限时加赠:IT技术图书免费领】,了解详情>>> https://vip.csdn.net/askvip?utm_source=1146287632