我已经为Raspberry Pi使用了已经编译的openCV版本。 任何感兴趣的人的链接
尝试使用此命令行进行编译后 g++ test3.cpp -o test3 -I/usr/local/include/ -lraspicam -lraspicam_cv -L/opt/vc/lib -lmmal -lmmal_core -lmmal_util -I/usr/include -lopencv_core -lopencv_highgui -lopencv_imgproc -lwiringPi -lpthread
我收到以下错误行。
//usr/local/lib/libopencv_stitching.so.2.4: 未定义的引用 'cv::gpu::ensureSizeIsEnough(int, int, int, cv::gpu::GpuMat&)'
//usr/local/lib/libopencv_calib3d.so.2.4: 对'cv::p arallel_for_(cv::range const&, cv::P arallelLoopBody const&, double)的未定义引用
//usr/local/lib/libopencv_calib3d.so.2.4:对 'typeinfo for cv::P arallelLoopBody' 的未定义引用
//usr/local/lib/libopencv_calib3d.so.2.4:未定义对'cv::Mutex::unlock()'的引用
//usr/local/lib/libopencv_calib3d.so.2.4:对'cv::Mutex::lock()'的未定义引用
//usr/local/lib/libopencv_ocl.so.2.4: 对 cv::TLSDataContainer::getData() const 的未定义引用
//usr/local/lib/libopencv_features2d.so.2.4: 对 cv::AlgorithmInfo::addParam(cv::Algorithm&, char const*, unsigned char&, bool, unsigned char (cv::Algorithm::)(),void (cv::Algorithm::)(unsigned char), std::basic_string, std::allocator> const&)
//usr/local/lib/libopencv_features2d.so.2.4: 对'cv::AlgorithmInfo::addParam(cv::Algorithm&, char const*, float&, bool, float (cv::Algorithm::)(),void (cv::Algorithm::)(float), std::basic_string, std::分配器> const&)'
//usr/local/lib/libopencv_features2d.so.2.4: 未定义的引用 'cv::AlgorithmInfo::addParam(cv::Algorithm&, char const*, short&, bool, int (cv::Algorithm::)(),void (cv::Algorithm::)(int), std::basic_string, std:::allocator> const&)'
//usr/local/lib/libopencv_calib3d.so.2.4:对'cv::Mutex::Mutex()'的未定义引用
//usr/local/lib/libopencv_ocl.so.2.4: 未定义引用 'cv::TLSDataContainer::TLSDataContainer()'
//usr/local/lib/libopencv_calib3d.so.2.4: 对'cv::P arallelLoopBody::~ParallelLoopBody()' 的未定义引用
//usr/local/lib/libopencv_calib3d.so.2.4:未定义的引用 'cv::Mutex::~Mutex()'
//usr/local/lib/libopencv_ocl.so.2.4: 对'cv::TLSDataContainer::~TLSDataContainer()' 的未定义引用 收集2:LD 返回 1 个退出状态
您尚未将可执行文件链接到程序所需的多个库
尝试使用这个:
g++ -lpthread `pkg-config opencv --libs` -I/usr/local/include/ -lraspicam -lraspicam_cv -L/opt/vc/lib -lmmal -lmmal_core -lmmal_util -I/usr/include -lwiringPi test3.cpp -o test3