我正在尝试在Ubuntu上使用CodeBlocks运行opencv程序。我使用opencv_contrib成功构建了opencv,但是由于某些原因,当尝试构建程序本身时,我的dnn模块无法正常工作。
我曾经安装过opencv的指南: https://importgeek.wordpress.com/2016/08/27/install-and-configure-opencv-in-code-blocks/ 注意:我将cmake配置为可以与dnn一起正常使用。组态 图片中包含的规格:https://imgur.com/a/vH09Vj7 我尝试过的 卸载并重新安装opencv。 我运行pkg-config --cflags --libs opencv来检查是否提到了dnn。包括了opencv_dnn,但奇怪的是,也包括了opencv_saliency,即使我在cmake中未选中它。
尝试运行程序的构建日志如下。
-------------- Build: Debug in FBT (compiler: GNU GCC Compiler)---------------
g++ -Wall -g -std=c++11 -I/usr/local/include/opencv -I/usr/local/include -c /home/nurc/Desktop/FBT-Code-master/main.cpp -o obj/Debug/FBT-Code-master/main.o
In file included from /home/nurc/Desktop/FBT-Code-master/main.cpp:5:0:
/home/nurc/Desktop/FBT-Code-master/detect_track.hpp: In member function ‘void detectionModel::runModel(cv::Mat&, std::vector<player>&, std::vector<foundBox>&)’:
/home/nurc/Desktop/FBT-Code-master/detect_track.hpp:13:67: error: cannot convert ‘cv::Mat’ to ‘double’ for argument ‘2’ to ‘cv::Mat cv::dnn::experimental_dnn_v2::blobFromImage(const cv::Mat&, double, const Size&, const Scalar&, bool, bool)’
blobFromImage(frame, blob, 1.0, inpSize, Scalar(), true, false);
^
/home/nurc/Desktop/FBT-Code-master/detect_track.hpp:16:31: error: no matching function for call to ‘cv::dnn::experimental_dnn_v2::Net::forward(std::vector<cv::Mat>&, const std::vector<std::__cxx11::basic_string<char> >&)’
net.forward(outs, outNames);
^
In file included from /usr/local/include/opencv2/dnn.hpp:62:0,
from /home/nurc/Desktop/FBT-Code-master/detect_track.hpp:4,
from /home/nurc/Desktop/FBT-Code-master/main.cpp:5:
/usr/local/include/opencv2/dnn/dnn.hpp:396:21: note: candidate: cv::Mat cv::dnn::experimental_dnn_v2::Net::forward(const cv::String&)
CV_WRAP Mat forward(const String& outputName = String());
^
/usr/local/include/opencv2/dnn/dnn.hpp:396:21: note: candidate expects 1 argument, 2 provided
/usr/local/include/opencv2/dnn/dnn.hpp:403:22: note: candidate: void cv::dnn::experimental_dnn_v2::Net::forward(std::vector<cv::Mat>&, const cv::String&)
CV_WRAP void forward(std::vector<Mat>& outputBlobs, const String& outputName = String());
^
/usr/local/include/opencv2/dnn/dnn.hpp:403:22: note: no known conversion for argument 2 from ‘const std::vector<std::__cxx11::basic_string<char> >’ to ‘const cv::String&’
/usr/local/include/opencv2/dnn/dnn.hpp:409:22: note: candidate: void cv::dnn::experimental_dnn_v2::Net::forward(std::vector<cv::Mat>&, const std::vector<cv::String>&)
CV_WRAP void forward(std::vector<Mat>& outputBlobs,
^
/usr/local/include/opencv2/dnn/dnn.hpp:409:22: note: no known conversion for argument 2 from ‘const std::vector<std::__cxx11::basic_string<char> >’ to ‘const std::vector<cv::String>&’
/usr/local/include/opencv2/dnn/dnn.hpp:416:22: note: candidate: void cv::dnn::experimental_dnn_v2::Net::forward(std::vector<std::vector<cv::Mat> >&, const std::vector<cv::String>&)
CV_WRAP void forward(std::vector<std::vector<Mat> >& outputBlobs,
^
/usr/local/include/opencv2/dnn/dnn.hpp:416:22: note: no known conversion for argument 1 from ‘std::vector<cv::Mat>’ to ‘std::vector<std::vector<cv::Mat> >&’
In file included from /home/nurc/Desktop/FBT-Code-master/main.cpp:5:0:
/home/nurc/Desktop/FBT-Code-master/detect_track.hpp:50:70: error: ‘NMSBoxes’ was not declared in this scope
NMSBoxes(boxes, confidences, confThreshold, nmsThreshold, indices);
^
/home/nurc/Desktop/FBT-Code-master/detect_track.hpp: In member function ‘bool tracker::add(cv::Mat&, std::vector<foundBox>&)’:
/home/nurc/Desktop/FBT-Code-master/detect_track.hpp:130:70: error: ‘NMSBoxes’ was not declared in this scope
NMSBoxes(boxes, confidences, confThreshold, nmsThreshold, indices);
^
/home/nurc/Desktop/FBT-Code-master/detect_track.hpp:140:22: error: ‘TrackerCSRT’ has not been declared
fb.tracker = TrackerCSRT::create();
^
/home/nurc/Desktop/FBT-Code-master/detect_track.hpp: In member function ‘bool tracker::add(cv::Mat&, std::vector<player>&)’:
/home/nurc/Desktop/FBT-Code-master/detect_track.hpp:171:70: error: ‘NMSBoxes’ was not declared in this scope
NMSBoxes(boxes, confidences, confThreshold, nmsThreshold, indices);
^
/home/nurc/Desktop/FBT-Code-master/detect_track.hpp:181:21: error: ‘TrackerCSRT’ has not been declared
p.tracker = TrackerCSRT::create();
^
/home/nurc/Desktop/FBT-Code-master/detect_track.hpp: In member function ‘bool tracker::add(cv::Mat&, std::vector<player>&, std::vector<foundBox>&)’:
/home/nurc/Desktop/FBT-Code-master/detect_track.hpp:212:70: error: ‘NMSBoxes’ was not declared in this scope
NMSBoxes(boxes, confidences, confThreshold, nmsThreshold, indices);
^
Process terminated with status 1 (0 minute(s), 1 second(s))
8 error(s), 0 warning(s) (0 minute(s), 1 second(s))