小鱼儿学Java 2020-03-19 16:25
浏览 690

有人会Qt调用yolo检测视频的吗?error: C2664: “std::vector<bbox_t,std::allocator<_Ty>> Detector::detect(image_t,float,bool)”: 无法将参数 1 从“cv::Mat”转换为“std::string” with [ _Ty=bbox_t ]

使用Yolov3中的Detector类老是报错:
error: C2664: “std::vector> Detector::detect(image_t,float,bool)”: 无法将参数 1 从“cv::Mat”转换为“std::string” with [ _Ty=bbox_t ]

void MainWindow::on_pushbutton_video()
{
    std::string names_file = "E:/YoloTest/coco.names";
    std::string cfg_file = "E:/YoloTest/yolov3.cfg";
    std::string weights_file = "E:/YoloTest/yolov3.weights";
    Detector detector(cfg_file,weights_file,0);
    //std::vector<std::string> obj_names = objects_names_from_file(names_file); //调用获得分类对象名称
    //或者使用以下四行代码也可实现读入分类对象文件
    std::vector<std::string> obj_names;
    std::ifstream ifs(names_file.c_str());
    std::string line;
    while (getline(ifs, line)) obj_names.push_back(line);

    capture.open("E:/YoloTest/test1.mp4");
    if (!capture.isOpened())
    {
        printf("文件打开失败");
    }
    cv::Mat frame;

    while (true)
    {
        capture >> frame;
        std::vector<bbox_t> result_vec = detector.detect(frame);
        draw_boxes(frame, result_vec, obj_names);

        cv::namedWindow("test", CV_WINDOW_NORMAL);
        cv::imshow("test", frame);
        cv::waitKey(3);
    }
}

求助orz

  • 写回答

0条回答 默认 最新

    报告相同问题?

    悬赏问题

    • ¥15 vue3页面el-table页面数据过多
    • ¥100 vue3中融入gRPC-web
    • ¥15 kali环境运行volatility分析android内存文件,缺profile
    • ¥15 写uniapp时遇到的问题
    • ¥15 vs 2008 安装遇到问题
    • ¥15 matlab有限元法求解梁带有若干弹簧质量系统的固有频率
    • ¥15 找一个网络防御专家,外包的
    • ¥100 能不能让两张不同的图片md5值一样,(有尝)
    • ¥15 informer代码训练自己的数据集,改参数怎么改
    • ¥15 请看一下,学校实验要求,我需要具体代码