Ask Your Question

can we use gpu functions in other opencv modules?

asked 2013-08-26 10:19:38 -0500

gitgat gravatar image

I try to use gpu::resize in objdetect module. however, I dont know where to put

#include "opencv2/gpu/gpu.hpp"

When I include gpu.hpp in precomp.hpp, I get 157 link errors such as below. Can we actually use gpu functions in other modules???

Error 145 error LNK2019: unresolved external symbol "public: void __thiscall cv::gpu::ImagePyramid::build(class cv::gpu::GpuMat const &,int,class cv::gpu::Stream &)" ([email protected]@[email protected]@@[email protected]@[email protected]@@Z) referenced in function "public: __thiscall cv::gpu::ImagePyramid::ImagePyramid(class cv::gpu::GpuMat const &,int,class cv::gpu::Stream &)" ([email protected]@[email protected]@[email protected]@[email protected]@[email protected]@Z) opencv_objdetect_pch.obj Error 141 error LNK2019: unresolved external symbol "public: void __thiscall cv::gpu::CannyBuf::create(class cv::Size_<int> const &,int)" ([email protected]@[email protected]@@[email protected]@[email protected]@Z) referenced in function "public: __thiscall cv::gpu::CannyBuf::CannyBuf(class cv::Size_<int> const &,int)" ([email protected]@[email protected]@[email protected][email protected]@[email protected]@Z) opencv_objdetect_pch.obj Error 117 error LNK2019: unresolved external symbol "public: virtual void __thiscall cv::SimpleBlobDetector::write(class cv::FileStorage &)const " ([email protected]@[email protected]@[email protected]@@Z) referenced in function "[thunk]:public: virtual void __thiscall cv::SimpleBlobDetector::writevtordisp{4294967292,0}' (class cv::FileStorage &)const " ([email protected]@[email protected]@[email protected]@[email protected]@@Z) opencv_objdetect_pch.obj Error 121 error LNK2019: unresolved external symbol "public: virtual void __thiscall cv::SimpleBlobDetector::read(class cv::FileNode const &)" ([email protected]@[email protected]@[email protected]@@Z) referenced in function "[thunk]:public: virtual void __thiscall cv::SimpleBlobDetector::readvtordisp{4294967292,0}' (class cv::FileNode const &)" ([email protected]@[email protected]@[email protected]@[email protected]@@Z) opencv_objdetect_pch.obj Error 139 error LNK2019: unresolved external symbol "public: virtual void __thiscall cv::OpponentColorDescriptorExtractor::write(class cv::FileStorage &)const " ([email protected]@[email protected]@[email protected]@@Z) referenced in function "[thunk]:public: virtual void __thiscall cv::OpponentColorDescriptorExtractor::write`vtordisp{4294967292,0}' (class cv::FileStorage &)const " ([email protected]@[email protected]@[email protected]@[email protected]@@Z) opencv_objdetect_pch.obj

edit retag flag offensive close merge delete

1 answer

Sort by ยป oldest newest most voted

answered 2013-08-26 12:03:44 -0500

Vladislav Vinogradov gravatar image

One OpenCV module can use another. Module dependecies are described in CMakeLists.txt file in module directory. Here is an example for superres module:

ocv_define_module(superres opencv_imgproc opencv_video OPTIONAL opencv_gpu opencv_highgui opencv_ocl)

First parameter (superres) is module name (without opencv_ prefix), next parameters are required dependencies and after OPTIONAL - optional dependecies. If one of the requered dependecies is missing module will be excluded from build.

As for your quiestion, answer is no in 2.4 branch. gpu module already depends on objdetect module, so objdetect can't depend on gpu (transitive dependecies is not supported). You can create separate module, that depends on both objdetect and gpu modules.

edit flag offensive delete link more


Thanks for the answer.

I wonder why we dont have independent gpu functions such as gpu::resize etc. which really don't use objdetect or other modules. Maybe we can add a set of minimal gpu functions for GpuMat in core/gpumat.hpp??

It can be of great interest to have access to simple GpuMat functions everywhere in Opencv. what do you think?

gitgat gravatar imagegitgat ( 2013-08-27 02:50:10 -0500 )edit

Actually in master branch gpu module was splitted onto several smaller sub-modules. They have less strict dependencies. resize function is located in gpuwarping module. Also new header only module for CUDA programming with some basic operations was introduced (cudev module). But the work is not finished and structure of this modules can be changed.

Vladislav Vinogradov gravatar imageVladislav Vinogradov ( 2013-08-27 03:22:16 -0500 )edit

Question Tools

1 follower


Asked: 2013-08-26 10:19:38 -0500

Seen: 884 times

Last updated: Aug 26 '13