Ask Your Question
0

Build opencv_contrib sample executables on Linux

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

Sebastián Ramírez gravatar image

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

berak gravatar image

System: VM Ubuntu 14.04 x64

Summary:
I'm building OpenCV 3.0.0-dev with the contrib modules from https://github.com/Itseez/opencv_contrib but I can't get the executables from opencv_contrib.


I was trying to follow this tutorial about the tracking API: http://docs.opencv.org/trunk/modules/tracking/doc/tracking.html

Somewhere it says: To see how API works, try tracker demo: https://github.com/lenlen/opencv/blob/tracking_api/samples/cpp/tracker.cpp

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: https://github.com/Itseez/opencv_contrib/blob/master/modules/tracking/samples/tracker.cpp

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

Comments

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

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

2 answers

Sort by » oldest newest most voted
0

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

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
3

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

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

Question Tools

Stats

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

Seen: 6,756 times

Last updated: Nov 04 '14