Ask Your Question

building opencv and opencv_contrib

asked 2016-06-21 15:50:32 -0500

atv gravatar image

So i need the dpm module in opencv, which is in contrib. And brew doesn't seem to install the separate contrib, only what's already part of the regular tree. Would appreciate some help in building this as so far i've been relying on brew installs and my command line skills have gotten a little rusty.

Should i: 1. Download opencv 2. Download the opencv_contrib

Then as per : $ cd Is that the root dir of the unzipped opencv download $ cmake -DOPENCV_EXTRA_MODULES_PATH=/modules Unsure what refers to. $ make -j5 What does -j5 refer to, amount of CPU's ?

Do i need to do a make install ? This is all done on a iMac. Thanks!


edit retag flag offensive close merge delete

1 answer

Sort by ยป oldest newest most voted

answered 2016-06-22 01:18:37 -0500

berak gravatar image

updated 2016-06-22 01:21:21 -0500

1.: yes. and please use git clone (to get proper versioning)

2.: yes. put it next to your opencv folder

3.: make a "build" folder (anywhere, but preferably not in your src tree, so you can throw it away later) and cd there

4.: invoke cmake (better even: cmake-gui), and add -DOPENCV_EXTRA_MODULES_PATH=/where/you/put/the/contrib/folder/modules (or locate the option in cmake-gui). the /modules at the end is important ! -DCMAKE_INSTALL_PREFIX=/some/folder should point to the final install path (/usr/local by default), see 6. the last argument to cmake should be /path/to/opencv/folder .

5.: call make -j5 (5 is the number ofthreads to be used. you may skip the option, it'll just take longer)

6.: if no errors occurred, run make install

(7.: good luck !)

edit flag offensive delete link more


Thanks a lot berak - i'll give that a go! Many thanks

atv gravatar imageatv ( 2016-06-22 02:27:27 -0500 )edit

So i build this, and all was well. I used git clone git clone mkdir build cd build cmake -DOPENCV_EXTRA_MODULES_PATH=../opencv_contrib/modules/ -DCMAKE_INSTALL_PREFIX=/usr/local/ -DWITH_QT=ON -DCMAKE_PREFIX_PATH=/usr/local/Cellar/qt5/5.5.1_2/ ../opencv/ make -j5 make install

But for some reason, and code that includes:

include "opencv2/contrib/contrib.hpp"

Does not find the contrib.hpp file. What did i do wrong?

atv gravatar imageatv ( 2016-06-27 15:44:20 -0500 )edit
Login/Signup to Answer

Question Tools

1 follower


Asked: 2016-06-21 15:50:32 -0500

Seen: 190 times

Last updated: Jun 22 '16