我尝试使用Opencv 3.1.0的dnn模块进行一些对象检测,我在这里按照教程进行操作:Opencv dnn module tutorial
据我了解,应该使用Opencv源代码构建包含dnn模块的额外模块。因此,我遵循本教程:Build Opencv with Extra Modules。
但是,当我尝试在Microsoft Visual Studio 2013中编译此简单代码时,
#include <opencv2\dnn.hpp>
#include <opencv2\core.hpp>
using namespace cv;
using namespace cv::dnn;
void main() {
}
1> ------重建全部开始:项目:WithDnnModule,配置:Debug Win32 ------1> DnnTest.cpp1> DnnTest.obj:错误LNK2019:未解决的外部符号“私有:void __thiscall cv :: String :: deallocate(void)”(?deallocate @ String @ cv @@ AAEXXZ)在函数“ public:__thiscall cv :: String”中引用::〜String(void)“(?? 1String @ cv @@ QAE @ XZ)1> C:\ Rescourse \ Project \ opencvdnn \ WithDnnModule \ Debug \ WithDnnModule.exe:致命错误LNK1120:1个未解决的外部组件===========全部重建:0成功,1失败,0跳过===========
如果不包含opencv2 \ dnn.hpp,则可以成功构建代码。
请帮帮我。
我想您将其安装在/home/ubuntu/opencv310
:
对于安装,应通过将contrib目录放在/home/ubuntu/opencv_contrib
之类的位置来运行以下命令:
ccmake -DCMAKE_INSTALL_PREFIX=/home/ubuntu/opencv310 -DWITH_CUDA=ON -DBUILD_TESTS=OFF -DBUILD_PERF_TESTS=OFF -DOPENCV_EXTRA_MODULES_PATH=/home/ubuntu/opencv_contrib/modules ..
您将要运行this example:
g++ -I/home/ubuntu/opencv310/include -L/home/ubuntu/opencv310/lib caffe.cpp -lopencv_bgsegm -lopencv_bioinspired -lopencv_calib3d -lopencv_ccalib -lopencv_core -lopencv_datasets -lopencv_face -lopencv_features2d -lopencv_flann -lopencv_highgui -lopencv_imgcodecs -lopencv_imgproc -lopencv_line_descriptor -lopencv_ml -lopencv_objdetect -lopencv_optflow -lopencv_photo -lopencv_reg -lopencv_rgbd -lopencv_saliency -lopencv_shape -lopencv_stitching -lopencv_superres -lopencv_surface_matching -lopencv_text -lopencv_tracking -lopencv_videoio -lopencv_video -lopencv_videostab -lopencv_xfeatures2d -lopencv_ximgproc -lopencv_xobjdetect -lopencv_xphoto -lopencv_dnn -o caffe
现在您可以使用./caffe
运行它。
包括“ opencv2 / opencv.hpp”