从源

时间:2016-05-07 22:39:52

标签: python macos opencv cmake

我试图在this文章之后从OSX上的源代码安装OpenCV 3.1.0 for Python。简而言之,我正在使用以下声明创建make文件:

cmake -D CMAKE_BUILD_TYPE=RELEASE -D CMAKE_INSTALL_PREFIX=/usr/local 
-D PYTHON2_PACKAGES_PATH=~/.virtualenvs/cv/lib/python2.7/site-packages 
-D PYTHON2_LIBRARY=/usr/local/Cellar/python/2.7.11/Frameworks/Python.framework/Versions/2.7/bin 
-D PYTHON2_INCLUDE_DIR=/usr/local/Frameworks/Python.framework/Headers 
-D INSTALL_C_EXAMPLES=OFF -D INSTALL_PYTHON_EXAMPLES=ON 
-D BUILD_EXAMPELS=ON 
-D OPENCV_EXTRA_MODULES_PATH=~/opencv_contrib/modules ..

我得到的结果信息包括:

    --   OpenCV modules:
    --     To be built:                 core flann imgproc ml photo reg
 surface_matching video dnn fuzzy imgcodecs shape videoio highgui objdetect plot
 superres ts xobjdetect xphoto bgsegm bioinspired dpm face features2d
 line_descriptor saliency text calib3d ccalib datasets rgbd stereo
 structured_light tracking videostab xfeatures2d ximgproc aruco optflow
 stitching python2
    --     Disabled:                    world contrib_world
    --     Disabled by dependency:      -
    --     Unavailable:                 cudaarithm cudabgsegm cudacodec cudafeatures2d cudafilters cudaimgproc cudalegacy cudaobjdetect cudaoptflow cudastereo cudawarping cudev java python3 viz cvv hdf matlab sfm

最值得注意的是:xfeatures2d

然后我运行make -j4然后运行sudo make install来安装已编译的OpenCV 3.1.0软件包。输出包括:

-- Installing: /usr/local/lib/libopencv_xfeatures2d.3.1.0.dylib
-- Up-to-date: /usr/local/lib/libopencv_xfeatures2d.3.1.dylib
-- Up-to-date: /usr/local/lib/libopencv_xfeatures2d.dylib
-- Up-to-date: /usr/local/include/opencv2/xfeatures2d.hpp
-- Up-to-date: /usr/local/include/opencv2/xfeatures2d/cuda.hpp
-- Up-to-date: /usr/local/include/opencv2/xfeatures2d/nonfree.hpp

之后,我为解释器运行python,然后import cvcv2.xfeatures2d并获取:

Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
AttributeError: 'module' object has no attribute 'xfeatures2d'

我不明白为什么opencv-contrib添加的额外软件包不包含在安装中。 cmake说他们被包括在内,但他们不是。

0 个答案:

没有答案