1
votes

I need help to compile that piece of code:

It has some stuff that I need for my project, but I can't compile it.

I compile the whole ´OpenCV´ library from the source, following instructions right there:

But there's big problems:

1 - in the include files, in directory "opencv2/stitching", there's not sub-directory called "detail" (there's one in the source files, but not in the compiled version in /usr/local/include/opencv2/stitching).

2 - in the current version, in the sample, in stitching_detailed.cpp, there's no modification at all regarding this!

Also, I didn't have any error while compiling... there's only warnings for unused variables...

MORE INFO:

So, I'm using this to compile:

g++ stitching_detail.cpp -o stitcher pkg-config --libs opencv -lopencv_stitching -lopencv_gpu

But there's a lot of errors in opencv_stitching like:

undefined reference to `cv::gpu::buildWarpCylindricalMaps(cv::Size_, cv::Rect_, cv::Mat const&, cv::Mat const&, float, cv::gpu::GpuMat&, cv::gpu::GpuMat&, cv::gpu::Stream&)'

Is there a way to remove the dependencies to opencv_gpu ? Because the only problems that I have right now are caused by this!

IMPORTANT:

In the configuration, it's specified that I want to compile OpenCV without CUDA, I clearly have the following third-party information:

-- Other third-party libraries:

-- Use IPP: NO

-- Use TBB: NO

-- Use Cuda: NO

-- Use Eigen: NO

1

1 Answers

2
votes

You are getting this error because you compiled the library without CUDA support and there are functions that needs it. The compiller is trying to link against the cv::gpu functions and they are not added at the compiled library if you don't use CUDA flag during CMAKE solution generation. To avoid this behaviour you have two options:

  1. Recompile OpenCV with CUDA flag. (you will need to install all CUDA dependencies first):
  2. Remove all cv::gpu calls from the example code.

If you are at windows environment, you can easily download the pre-compiled library with cuda support and test the code. If you don't have CUDA support, probably the code will crash during cv::gpu functions.

The second option is pretty easy to do. The code has declared using namespace cv, so you just need to look for all gpu::(function_name) calls and erase it. Just take care to not use --try_gpu argument because I didn't read all the code and this probably will call some undefined behaviors during execution time.