Ask Your Question

Build opencv_contrib sample executables on Linux

asked 2014-09-23 18:42:58 -0500

Sebastián Ramírez gravatar image

updated 2014-09-25 11:30:50 -0500

berak gravatar image

System: VM Ubuntu 14.04 x64

I'm building OpenCV 3.0.0-dev with the contrib modules from but I can't get the executables from opencv_contrib.

I was trying to follow this tutorial about the tracking API:

Somewhere it says: To see how API works, try tracker demo:

But that's a forked old repository (by user lenlen), not the official repository. In the recent versions (with the new repos) it seems like that file is not in that location anymore but in:

The problem: I'm being able to build OpenCV without errors, but I can't see how to build that executable file from opencv_contrib, or where is it getting located.

I've tried:

  • Setting up OPENCV_EXTRA_MODULES_PATH with: cmake -D OPENCV_EXTRA_MODULES_PATH=../opencv_contrib/modules ..
  • Setting up INSTALL_C_EXAMPLES with: cmake -D INSTALL_C_EXAMPLES=ON ..
  • Entering in opencv_contrib, creating and entering into a "build" directory and from there executing: "cmake .." ...but that gives errors (no CMakeLists.txt).
  • Entering in "opencv_contrib/modules/tracking/", creating and entering into a "build" directory and executing "cmake .." (because there's a CMakeLists.txt inside of the tracking directory). But that also gives errors.
  • Entering in "opencv_contrib/modules/tracking/samples/" and executing "g++ tracker.cpp", but that also gives errors.

Thanks in advance!

edit retag flag offensive close merge delete


Entering "opencv_contrib/modules/tracking/samples/" and running cmake there worked nice for me.

berak gravatar imageberak ( 2014-09-25 11:30:21 -0500 )edit

2 answers

Sort by » oldest newest most voted

answered 2014-11-04 13:34:15 -0500

Sebastián Ramírez gravatar image

I solved it. It was a silly mistake.

I was setting up OPENCV_EXTRA_MODULES_PATH as: cmake -D OPENCV_EXTRA_MODULES_PATH=../opencv_contrib/modules ..

But my working directory was "opencv/build/" (I was in a directory "build" inside of opencv and the "opencv_contrib" was in the same directory as "opencv"), so that variable should have been: cmake -D OPENCV_EXTRA_MODULES_PATH=../../opencv_contrib/modules ..

edit flag offensive delete link more

answered 2018-06-28 01:06:48 -0500

samliu gravatar image

Try this, as you can't simply g++ tracker.cpp without telling the path/to/opencv/libs.

edit flag offensive delete link more

Question Tools


Asked: 2014-09-23 18:42:58 -0500

Seen: 6,601 times

Last updated: Nov 04 '14