Ask Your Question

Add Modules from opencv_contrib to opencv 3.0

asked 2014-09-22 17:57:06 -0500

jacobu gravatar image

updated 2014-09-23 04:37:44 -0500

When I follow the instruction in Git and type

cmake -DOPENCV_EXTRA_MODULES_PATH=<opencv_contrib>/modules -D CMAKE_INSTALL_PREFIX=/usr/local ..

it reported

Python error: <stdin> is a directory, cannot continue
Python error: <stdin> is a directory, cannot continue
Python error: <stdin> is a directory, cannot continue
CMake Error at modules/python/CMakeLists.txt:78 (set_target_properties):
  set_target_properties called with incorrect number of arguments.

the set_target_properties in the file was used as:
set_target_properties(${the_module} PROPERTIES
                      PREFIX ""
                      OUTPUT_NAME cv2
                      SUFFIX ${CVPY_SUFFIX})

I also tried to move the modules in opencv_contrib to opencv and install them , but xfeature2d, matlab,python,cvv failed even though the other modules succeed being installed.

Can anyone tell me what I need to change or correct? Thanks

edit retag flag offensive close merge delete


Okay some problems I see at the moment

  • there is a typo between -D and OPENCV_EXTRA_MODULES_PATH, a missing space
  • you need to replace <opencv_contrib> with the location of your contrib folder. Mainly it is something like ../../opencv_contrib/modules/ assuming you are in the build folder inside your opencv branch.

Can you check if this fixes the problem?

StevenPuttemans gravatar imageStevenPuttemans ( 2014-09-23 04:40:42 -0500 )edit

Thank you for your information. Now some modules can be installed, but the modules: xfeature2d, matlab,python,cvv still failed installing.

jacobu gravatar imagejacobu ( 2014-09-23 17:55:55 -0500 )edit

And you used the latest master branch? Python and xf2d were fixed there. Matlab bindings i havent build yet!

StevenPuttemans gravatar imageStevenPuttemans ( 2014-09-24 01:53:59 -0500 )edit

I've tried the latest version. I find that the modules can be installed in the release folder, but I still don't find the corresponding folder in my opencv_source_directory. When I want to use cv2.SURF, it still says that ' AttributeError: 'module' object has no attribute 'SURF''. Can you help me more about it? Thank you!

jacobu gravatar imagejacobu ( 2014-09-24 16:37:09 -0500 )edit

@steven , did you fix it ? I have the same problem as you an I can't find any solution

Balam gravatar imageBalam ( 2015-03-05 19:49:11 -0500 )edit

1 answer

Sort by ยป oldest newest most voted

answered 2015-07-09 02:24:04 -0500

mack_emb gravatar image

Hi there, I am facing the same problem. But i am little confused with the instructions. $ cd <opencv_build_directory> $ cmake -DOPENCV_EXTRA_MODULES_PATH=<opencv_contrib>/modules <opencv_source_directory> $ make -j5

which is build directory, opencv contrib and opencv source directoy. As far aa i am able to get it build_directory:- is directory in which i made the build folder while installing opencV. opencv_contrib :- is the folder which i downloaded from git. source_directory :- i am not getting any clue here,my guess is its in "usr/local/include/opencv2" ?? Please helpme out here. Thank you

edit flag offensive delete link more


Okay let me wrap some stuff up

  • You start by downloading the sourcecode for both opencv and opencv_contrib repository. Make sure they are in a common folder, to make stuff easier.
  • Inisde the opencv folder, you make a new folder called build
  • Now move into that folder and run there your CMAKE command

Making sure that you used the above configuration

  • The build directory will be ../build/ which means, just use the folder where you are now. In detail the .. means go up one folder, then look for the build folder, but you are already in it.
  • For the -DOPENCV_EXTRA_MODULES_PATH you will pass ../../opencv_contrib/modules/ which means, go 2 levels up into the common install folder of both opencv and opencv_contrib repo, then go into opencv_contrib and then into modules folder
StevenPuttemans gravatar imageStevenPuttemans ( 2015-07-09 04:11:47 -0500 )edit

Now run the make -j 5 command! Everything should install just fine now!

StevenPuttemans gravatar imageStevenPuttemans ( 2015-07-09 04:12:27 -0500 )edit

I am facing an issue in this regard, I have installed cmake yet it throws a 'command not found' error. Also, what is the path to be given for <opencv_source_directory> ??

Joshitha gravatar imageJoshitha ( 2018-02-28 09:52:28 -0500 )edit
Login/Signup to Answer

Question Tools


Asked: 2014-09-22 17:57:06 -0500

Seen: 8,559 times

Last updated: Sep 23 '14