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

有人会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 微信公众号自制会员卡没有收款渠道啊
    • ¥15 stable diffusion
    • ¥100 Jenkins自动化部署—悬赏100元
    • ¥15 关于#python#的问题:求帮写python代码
    • ¥20 MATLAB画图图形出现上下震荡的线条
    • ¥15 关于#windows#的问题:怎么用WIN 11系统的电脑 克隆WIN NT3.51-4.0系统的硬盘
    • ¥15 perl MISA分析p3_in脚本出错
    • ¥15 k8s部署jupyterlab,jupyterlab保存不了文件
    • ¥15 ubuntu虚拟机打包apk错误
    • ¥199 rust编程架构设计的方案 有偿