使用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