Ask Your Question
2

Building OpenCV_contrib for OpenCV 3, Windows GUI

asked 2014-10-28 13:12:35 -0600

Doombot gravatar image

updated 2014-10-29 07:46:26 -0600

I built successfully the main branch of OpenCV 3 from Github. Now, I want to build the OpenCV_contrib portion of it, especially the xfeature2d (actually, it is the only thing that matters for me). There are instructions on how to do so in the readme section of the Github page.

I am using CMake 3.0.2 GUI on Windows 7. So far, I haven't found a command line version so I am using the GUI.

The steps I am using (from the readme):

  1. start cmake-gui

  2. select the opencv source code folder and the folder where binaries will be built (the 2 upper forms of the interface)

  3. press the configure button. you will see all the opencv build parameters in the central interface

  4. browse the parameters and look for the form called OPENCV_EXTRA_MODULES_PATH (use the search form to focus rapidly on it)

  5. complete this OPENCV_EXTRA_MODULES_PATH by the proper pathname to the <opencv_contrib>/modules value using its browse button.

  6. press the configure button followed by the generate button (the first time, you will be asked which makefile style to use)

  7. build the opencv core with the method you chose

Here is how the folder containing the sources and build looks like: image description

So the Master branch is in the "Sources" folder and the extra module are in the "Contrib" folder.

Following the instructions, the CMake part seems to work well. But, when I try to build it in Visual Studio, various errors about "No such files or directory" in "descriptors.hpp" and "types.hpp" and some problems with undeclared identifiers in the Saliency module.

There could be a lot of reasons for this. A knowledgeable person told me in a comment that I should launch CMake from the same build folder than for the main repo, but I don't see how with the GUI...

EDIT : Here is the output of CMake after I configured it, so just before I click on

"Generate":

Checking for Windows Platform SDK
Checking for Visual Studio 2012
found IPP (ICV version): 8.1.1 [8.1.1]
at: D:/OpenCV3/Sources/3rdparty/ippicv/unpack/ippicv_win
Could NOT find PythonInterp (missing:  PYTHON_EXECUTABLE) (Required is at least version "2.7")
Could NOT find PythonInterp (missing:  PYTHON_EXECUTABLE) (Required is at least version "2.6")
Could NOT find PythonInterp (missing:  PYTHON_EXECUTABLE) (Required is at least version "3.4")
Could NOT find PythonInterp (missing:  PYTHON_EXECUTABLE) (Required is at least version "3.2")
Could NOT find JNI (missing:  JAVA_AWT_LIBRARY JAVA_JVM_LIBRARY JAVA_INCLUDE_PATH JAVA_INCLUDE_PATH2 JAVA_AWT_INCLUDE_PATH) 
Could NOT find Matlab (missing:  MATLAB_MEX_SCRIPT MATLAB_INCLUDE_DIRS MATLAB_ROOT_DIR MATLAB_LIBRARIES MATLAB_LIBRARY_DIRS MATLAB_MEXEXT MATLAB_ARCH MATLAB_BIN) 
VTK is not found. Please set -DVTK_DIR in CMake to VTK build directory, or to VTK install subdirectory with VTKConfig.cmake file
Tesseract:   NO
CMake Warning (dev) at cmake/OpenCVModule.cmake:896 (get_target_property):
  Policy CMP0026 is not set: Disallow use of the LOCATION target property.
  Run "cmake --help-policy CMP0026" for policy details.  Use the cmake_policy
  command to set the policy and suppress this warning.

  The LOCATION property should not be read from target "opencv_test_core".
  Use ...
(more)
edit retag flag offensive close merge delete

Comments

1

Start by providing us with your CMAKE config output after configuring is completed.

StevenPuttemans gravatar imageStevenPuttemans ( 2014-10-29 04:03:25 -0600 )edit
1

Hmm that seems correct. How about removing the saliency module since you don't need it. This can be done by adding -DBUILD_opencv_saliency=OFF to your CMAKE command.

StevenPuttemans gravatar imageStevenPuttemans ( 2014-10-29 07:54:20 -0600 )edit

In the GUI, I have selected the xfeature2d module only. Now I just compiled the "Debug" version of ALL_BUILD without error. Will go through the Release version, then the INSTALL build and keep you updated. I should have thought of it before; compiling ALL the experimental modules isn't always a good idea ;)

Doombot gravatar imageDoombot ( 2014-10-29 08:14:50 -0600 )edit

@Doombot, was doing the check myself. Seems that on the current master branch the following modules are already broken: cvv cudastereo text ccalib ... and still not succeeding. It is a pitty that so much faulty code gets in ...

StevenPuttemans gravatar imageStevenPuttemans ( 2014-10-29 08:19:57 -0600 )edit

hmm it seems even more stuff is breaking down... not in the mood to fix it all...

StevenPuttemans gravatar imageStevenPuttemans ( 2014-10-29 08:22:07 -0600 )edit
1

Wow I understand. I understand a lot of modules no longer work now... (even though there is no Release candidate of OpenCV3 out yet).

Well I just finished to compile everything, I am preparing a sample program with some xfeature2d in it (like FREAK) but right now I tested with a BRISK demo program I made and everything works. Thanks a lot @StevenPuttemans !

Doombot gravatar imageDoombot ( 2014-10-29 08:28:33 -0600 )edit

You are welcome! Yep it seems that the buildbots dont succeed in capturing all problems. But then the developing community jumps in!

StevenPuttemans gravatar imageStevenPuttemans ( 2014-10-29 10:48:58 -0600 )edit

I was able to use the cmake gui to successfully (?) create a makefile. At least, I see a file opencv/build/Makefile. I told cmake to use MinGW as the generator (was having trouble with Visual Studio 11). In MinGW (actually, Git Bash), I navigate to the build dir and type make -j4 (or even just make), and nothing seems to happen but the terminal prints Microsoft Windows [Version 10.0.14393] (c) 2016 Microsoft Corporation. All rights reserved. Any ideas?

centraltendency gravatar imagecentraltendency ( 2017-01-21 21:22:05 -0600 )edit

2 answers

Sort by ยป oldest newest most voted
2

answered 2015-01-06 09:16:08 -0600

codingTornado gravatar image

updated 2015-01-07 07:23:25 -0600

I'm posting this answer so this looks a bit more tidy for searches since there is a big conversation in the comments but no "answer" to the thread.

What has been said is that some extra modules are broken, for example saliency(which up to this date 06/Jan/2015 still won't compile on windows), and won't compile properly. Fixing needs to be done on this modules, so unless you really need them, just exclude them from the cmake configuring process.

EDIT:
As pointed out in the comments, I forgot about the flags to exclude the non-compiling modules.

Add -DBUILD_opencv_saliency=OFF to the CMake command to remove saliency.
I also found trouble with missing headers and a non-portable suffix for a number (used LLU instead of ULL, which Visual Studio doesn't recognize as valid), so if you come into trouble building line_descriptor add -DBUILD_opencv_line_descriptor=OFF to the CMake command.

In case you would like to remove any other extra modules that don't depend on 3rd parties like matlab here is the full list of flag names:

  • BUILD_opencv_adas for adas
  • BUILD_opencv_bgsegm for bgsegm
  • BUILD_opencv_bioinspired for bioinspired
  • BUILD_opencv_ccalib for ccalib
  • BUILD_opencv_datasets for datasets
  • BUILD_opencv_face for face
  • BUILD_opencv_latentsvm for latentsvm
  • BUILD_opencv_line_descriptor for line_descriptor
  • BUILD_opencv_optflow for optflow
  • BUILD_opencv_reg for reg
  • BUILD_opencv_rgbd for rgbd
  • BUILD_opencv_saliency for saliency
  • BUILD_opencv_surface_matching for surface_matching
  • BUILD_opencv_text for text
  • BUILD_opencv_tracking for tracking
  • BUILD_opencv_xfeatures2d for xfeatures2d
  • BUILD_opencv_ximgproc for ximgproc
  • BUILD_opencv_xobjdetect for xobjdetect
  • BUILD_opencv_xphoto for xphoto
edit flag offensive delete link more

Comments

1

Please if you bring everything together, then also add the correct commands for excluding modules...

StevenPuttemans gravatar imageStevenPuttemans ( 2015-01-06 09:34:48 -0600 )edit
2

answered 2015-01-27 06:58:20 -0600

Philip gravatar image

I found that I can build it by just following what you did then remove any project which fails to compile. In my case, right now, only one project failed to compile so I had to remove it and its two test projects.

edit flag offensive delete link more

Comments

By now I hope the problem has been solved, but I don't understand how you can even build the main tree without JAVA SDK or Python installed. Anyone trying to build OpenCV should install those before trying to debug any further, IMHO.

elchan gravatar imageelchan ( 2016-09-15 22:01:58 -0600 )edit

Question Tools

Stats

Asked: 2014-10-28 13:12:35 -0600

Seen: 26,071 times

Last updated: Jan 27 '15