Ask Your Question
1

can we use gpu functions in other opencv modules?

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

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 &)" (?build@ImagePyramid@gpu@cv@@QAEXABVGpuMat@23@HAAVStream@23@@Z) referenced in function "public: __thiscall cv::gpu::ImagePyramid::ImagePyramid(class cv::gpu::GpuMat const &,int,class cv::gpu::Stream &)" (??0ImagePyramid@gpu@cv@@QAE@ABVGpuMat@12@HAAVStream@12@@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)" (?create@CannyBuf@gpu@cv@@QAEXABV?$Size_@H@3@H@Z) referenced in function "public: __thiscall cv::gpu::CannyBuf::CannyBuf(class cv::Size_<int> const &,int)" (??0CannyBuf@gpu@cv@@QAE@ABV?$Size_@H@2@H@Z) opencv_objdetect_pch.obj Error 117 error LNK2019: unresolved external symbol "public: virtual void __thiscall cv::SimpleBlobDetector::write(class cv::FileStorage &)const " (?write@SimpleBlobDetector@cv@@UBEXAAVFileStorage@2@@Z) referenced in function "[thunk]:public: virtual void __thiscall cv::SimpleBlobDetector::writevtordisp{4294967292,0}' (class cv::FileStorage &)const " (?write@SimpleBlobDetector@cv@@$4PPPPPPPM@A@BEXAAVFileStorage@2@@Z) opencv_objdetect_pch.obj Error 121 error LNK2019: unresolved external symbol "public: virtual void __thiscall cv::SimpleBlobDetector::read(class cv::FileNode const &)" (?read@SimpleBlobDetector@cv@@UAEXABVFileNode@2@@Z) referenced in function "[thunk]:public: virtual void __thiscall cv::SimpleBlobDetector::readvtordisp{4294967292,0}' (class cv::FileNode const &)" (?read@SimpleBlobDetector@cv@@$4PPPPPPPM@A@AEXABVFileNode@2@@Z) opencv_objdetect_pch.obj Error 139 error LNK2019: unresolved external symbol "public: virtual void __thiscall cv::OpponentColorDescriptorExtractor::write(class cv::FileStorage &)const " (?write@OpponentColorDescriptorExtractor@cv@@UBEXAAVFileStorage@2@@Z) referenced in function "[thunk]:public: virtual void __thiscall cv::OpponentColorDescriptorExtractor::write`vtordisp{4294967292,0}' (class cv::FileStorage &)const " (?write@OpponentColorDescriptorExtractor@cv@@$4PPPPPPPM@A@BEXAAVFileStorage@2@@Z) opencv_objdetect_pch.obj

edit retag flag offensive close merge delete

1 answer

Sort by ยป oldest newest most voted
3

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

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

Comments

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 -0600 )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 -0600 )edit

Question Tools

1 follower

Stats

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

Seen: 986 times

Last updated: Aug 26 '13