如何通过在Linux上集成GPU库来编译和运行Opencv C ++代码?

时间:2018-08-25 07:42:41

标签: c++ linux opencv cuda gpu

我正在尝试使用Gpu库软件包编译一个opencv C ++程序。代码的描述是使用GPU显示图像。

enter image description here

这是我用来编译代码的命令:

g++ -ggdb image_read.cpp -o image_read `pkg-config --cflags --libs opencv` -lopencv_gpu 

但是我遇到了以下编译错误。这是错误:

In file included from /usr/include/opencv2/core/opengl_interop.hpp:49:0,
                 from image_read.cpp:8:

/usr/include/opencv2/core/opengl_interop_deprecated.hpp:116:61: error: no member function ‘delete_obj’ declared in ‘cv::Ptr<cv::GlBuffer::Impl>’
 template <> CV_EXPORTS void Ptr<GlBuffer::Impl>::delete_obj();

                                                             ^
/usr/include/opencv2/core/opengl_interop_deprecated.hpp:163:62: error: no member function ‘delete_obj’ declared in ‘cv::Ptr<cv::GlTexture::Impl>’
 template <> CV_EXPORTS void Ptr<GlTexture::Impl>::delete_obj();
                                                              ^
In file included from image_read.cpp:8:0:
/usr/include/opencv2/core/opengl_interop.hpp:277:68: error: no member function ‘delete_obj’ declared in ‘cv::Ptr<cv::ogl::Buffer::Impl>’
 template <> CV_EXPORTS void Ptr<cv::ogl::Buffer::Impl>::delete_obj();


/usr/include/opencv2/core/opengl_interop.hpp:278:71: error: no member function ‘delete_obj’ declared in ‘cv::Ptr<cv::ogl::Texture2D::Impl>’
 template <> CV_EXPORTS void Ptr<cv::ogl::Texture2D::Impl>::delete_obj();

In file included from image_read.cpp:9:0:
/usr/include/opencv2/gpu/gpu.hpp:432:29: error: ‘vector’ does not name a type
 CV_EXPORTS void merge(const vector<GpuMat>& src, GpuMat& dst, Stream& stream = Stream::Null());


/usr/include/opencv2/gpu/gpu.hpp:432:35: error: expected ‘,’ or ‘...’ before ‘<’ token
 CV_EXPORTS void merge(const vector<GpuMat>& src, GpuMat& dst, Stream& stream = Stream::Null());


/usr/include/opencv2/gpu/gpu.hpp:438:42: error: ‘vector’ has not been declared
 CV_EXPORTS void split(const GpuMat& src, vector<GpuMat>& dst, Stream& stream = Stream::Null());


/usr/include/opencv2/gpu/gpu.hpp:438:48: error: expected ‘,’ or ‘...’ before ‘<’ token
 CV_EXPORTS void split(const GpuMat& src, vector<GpuMat>& dst, Stream& stream = Stream::Null());


/usr/include/opencv2/gpu/gpu.hpp:1265:4: error: ‘vector’ does not name a type
    vector<Point> locations;


/usr/include/opencv2/gpu/gpu.hpp:1266:4: error: ‘vector’ does not name a type
    vector<double> confidences;


/usr/include/opencv2/gpu/gpu.hpp:1267:4: error: ‘vector’ does not name a type
    vector<double> part_scores[4];


/usr/include/opencv2/gpu/gpu.hpp:1285:31: error: ‘vector’ does not name a type
     void setSVMDetector(const vector<float>& detector);


/usr/include/opencv2/gpu/gpu.hpp:1285:37: error: expected ‘,’ or ‘...’ before ‘<’ token
     void setSVMDetector(const vector<float>& detector);


/usr/include/opencv2/gpu/gpu.hpp:1287:12: error: ‘vector’ does not name a type
     static vector<float> getDefaultPeopleDetector();


/usr/include/opencv2/gpu/gpu.hpp:1288:12: error: ‘vector’ does not name a type
     static vector<float> getPeopleDetector48x96();


/usr/include/opencv2/gpu/gpu.hpp:1289:12: error: ‘vector’ does not name a type
     static vector<float> getPeopleDetector64x128();


/usr/include/opencv2/gpu/gpu.hpp:1291:36: error: ‘vector’ has not been declared
     void detect(const GpuMat& img, vector<Point>& found_locations,


/usr/include/opencv2/gpu/gpu.hpp:1291:42: error: expected ‘,’ or ‘...’ before ‘<’ token
     void detect(const GpuMat& img, vector<Point>& found_locations,


/usr/include/opencv2/gpu/gpu.hpp:1295:46: error: ‘vector’ has not been declared
     void detectMultiScale(const GpuMat& img, vector<Rect>& found_locations,


/usr/include/opencv2/gpu/gpu.hpp:1295:52: error: expected ‘,’ or ‘...’ before ‘<’ token
     void detectMultiScale(const GpuMat& img, vector<Rect>& found_locations,


/usr/include/opencv2/gpu/gpu.hpp:1300:47: error: ‘vector’ has not been declared
     void computeConfidence(const GpuMat& img, vector<Point>& hits, double hit_threshold,


/usr/include/opencv2/gpu/gpu.hpp:1300:53: error: expected ‘,’ or ‘...’ before ‘<’ token
     void computeConfidence(const GpuMat& img, vector<Point>& hits, double hit_threshold,

/usr/include/opencv2/gpu/gpu.hpp:1303:57: error: ‘vector’ has not been declared
     void computeConfidenceMultiScale(const GpuMat& img, vector<Rect>& found_locations,


/usr/include/opencv2/gpu/gpu.hpp:1303:63: error: expected ‘,’ or ‘...’ before ‘<’ token
     void computeConfidenceMultiScale(const GpuMat& img, vector<Rect>& found_locations, 

0 个答案:

没有答案