请求的模块不可用:vtkRenderingOpenGL-cmake / OpenCVDetectVTK.cmake:6(find_package)

时间:2016-08-02 22:16:55

标签: python macos opencv cmake opencv3.0

我基本上尝试使用Python3.5安装OpenCV3。我已成功完成this tutorial中opencv git checkout 3.1.0的所有步骤。但是,当我输入此命令时:

cmake -D CMAKE_BUILD_TYPE=RELEASE \
    -D CMAKE_INSTALL_PREFIX=/usr/local \
    -D PYTHON3_PACKAGES_PATH=~/.virtualenvs/cv3/lib/python3.5/site-packages \
    -D PYTHON3_LIBRARY=/usr/local/Cellar/python3/3.5.2_1/Frameworks/Python.framework/Versions/3.5/lib/libpython3.5.dylib \
    -D PYTHON3_INCLUDE_DIR=/usr/local/Cellar/python3/3.5.2_1/Frameworks/Python.framework/Versions/3.5/include/python3.5m/ \
    -D INSTALL_C_EXAMPLES=ON \
    -D INSTALL_PYTHON_EXAMPLES=ON \
    -D BUILD_EXAMPLES=ON \
    -D BUILD_opencv_python3=ON \
    -D OPENCV_EXTRA_MODULES_PATH=~/opencv_contrib/modules ..

我收到此错误:

...etc...
-- Checking for module 'gstreamer-base-1.0'
--   No package 'gstreamer-base-1.0' found
-- Checking for module 'gstreamer-video-1.0'
--   No package 'gstreamer-video-1.0' found
-- Checking for module 'gstreamer-app-1.0'
--   No package 'gstreamer-app-1.0' found
-- Checking for module 'gstreamer-riff-1.0'
--   No package 'gstreamer-riff-1.0' found
-- Checking for module 'gstreamer-pbutils-1.0'
--   No package 'gstreamer-pbutils-1.0' found
-- Checking for module 'gstreamer-base-0.10'
--   No package 'gstreamer-base-0.10' found
-- Checking for module 'gstreamer-video-0.10'
--   No package 'gstreamer-video-0.10' found
-- Checking for module 'gstreamer-app-0.10'
--   No package 'gstreamer-app-0.10' found
-- Checking for module 'gstreamer-riff-0.10'
--   No package 'gstreamer-riff-0.10' found
-- Checking for module 'gstreamer-pbutils-0.10'
--   No package 'gstreamer-pbutils-0.10' found
-- Checking for module 'libdc1394-2'
--   No package 'libdc1394-2' found
-- Checking for module 'libdc1394'
--   No package 'libdc1394' found
-- Checking for module 'libv4l1'
--   No package 'libv4l1' found
-- Checking for module 'libv4l2'
--   No package 'libv4l2' found
-- Looking for linux/videodev.h
-- Looking for linux/videodev.h - not found
-- Looking for linux/videodev2.h
-- Looking for linux/videodev2.h - not found
-- Looking for sys/videoio.h
-- Looking for sys/videoio.h - not found
-- Checking for module 'libavcodec'
--   Found libavcodec, version 57.48.101
-- Checking for module 'libavformat'
--   Found libavformat, version 57.41.100
-- Checking for module 'libavutil'
--   Found libavutil, version 55.28.100
-- Checking for module 'libswscale'
--   Found libswscale, version 4.1.100
-- Checking for module 'libavresample'
--   Found libavresample, version 3.0.0
-- Looking for libavformat/avformat.h
-- Looking for libavformat/avformat.h - found
-- Looking for ffmpeg/avformat.h
-- Looking for ffmpeg/avformat.h - not found
-- Checking for module 'libgphoto2'
--   No package 'libgphoto2' found
-- ICV: Removing previous unpacked package: /Users/mona/computer_vision/Face_Recognition/opencv/3rdparty/ippicv/unpack
-- ICV: Unpacking ippicv_macosx_20151201.tgz to /Users/mona/computer_vision/Face_Recognition/opencv/3rdparty/ippicv/unpack...
-- ICV: Package successfully downloaded
-- found IPP (ICV version): 9.0.1 [9.0.1]
-- at: /Users/mona/computer_vision/Face_Recognition/opencv/3rdparty/ippicv/unpack/ippicv_osx
-- Found Doxygen: /usr/local/bin/doxygen (found version "1.8.11")
-- To enable PlantUML support, set PLANTUML_JAR environment variable or pass -DPLANTUML_JAR=<filepath> option to cmake
-- Found PythonInterp: /usr/local/bin/python2.7 (found suitable version "2.7.12", minimum required is "2.7")
-- Could NOT find PythonLibs: Found unsuitable version "2.7.10", but required is exact version "2.7.12" (found /usr/lib/libpython2.7.dylib)
-- Found PythonInterp: /usr/local/bin/python3.4 (found suitable version "3.4.1", minimum required is "3.4")
-- Could NOT find PythonLibs: Found unsuitable version "3.5.2", but required is exact version "3.4.1" (found /usr/local/Cellar/python3/3.5.2_1/Frameworks/Python.framework/Versions/3.5/lib/libpython3.5.dylib)
-- Found apache ant 1.9.7: /usr/local/bin/ant
-- Found JNI: /System/Library/Frameworks/JavaVM.framework
-- 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)
CMake Error at /usr/local/Cellar/vtk/7.0.0_1/lib/cmake/vtk-7.0/vtkModuleAPI.cmake:120 (message):
  Requested modules not available:

    vtkRenderingOpenGL
Call Stack (most recent call first):
  /usr/local/lib/cmake/vtk-7.0/VTKConfig.cmake:88 (vtk_module_config)
  cmake/OpenCVDetectVTK.cmake:6 (find_package)
  CMakeLists.txt:597 (include)

我已尝试同时使用ONOFF -D INSTALL_C_EXAMPLES=ON \行,但仍然没有成功。任何反馈都非常感谢!

这是设置为OFF的标志的日志:http://pastebin.com/NF1bbpBC

2 个答案:

答案 0 :(得分:3)

我花了好几个小时来解决这个问题。这就是我的所作所为:

wget https://github.com/Itseez/opencv/archive/3.1.0.zip
wget https://github.com/Itseez/opencv_contrib/archive/3.1.0.zip
unzip 3.1.0.zip
unzip 3.1.0.zip.1
cd opencv-3.1.0
mkdir build
cd build
cmake -D CMAKE_BUILD_TYPE=RELEASE \
      -D CMAKE_INSTALL_PREFIX=/usr/local \
      -D BUILD_opencv_java=OFF \
      -D WITH_IPP=OFF -D WITH_1394=OFF \
      -D WITH_FFMPEG=OFF \
      -D BUILD_EXAMPLES=OFF \
      -D BUILD_TESTS=OFF \
      -D BUILD_PERF_TESTS=OFF \
      -D BUILD_DOCS=OFF \
      -D BUILD_opencv_python2=ON \
      -D BUILD_opencv_python3=ON \
      -D BUILD_opencv_video=OFF \
      -D BUILD_opencv_videoio=OFF \
      -D BUILD_opencv_videostab=OFF \
      -D PYTHON_EXECUTABLE=$(which python) \
      -D OPENCV_EXTRA_MODULES_PATH=/Users/mona/computer_vision/Face_Recognition/opencv_contrib-3.1.0/modules ..

在最后一个中,确保绝对路径不是-D OPENCV_EXTRA_MODULES_PATH=~/opencv_contrib/opencv_contrib-3.1.0/modules ..

此外,您需要vi cmake/OpenCVDetectVTK.cmake并更改第6行,使其为vtkRenderingOpenGL2而不是vtkRenderingOpenGL

6 find_package(VTK QUIET COMPONENTS vtkRenderingOpenGL2 vtkInteractionStyle vtkRenderingLOD vtkIOPLY vtkFiltersTexture vtkRenderingFreeType vtkIOExport NO_MODULE)

答案 1 :(得分:1)

验证您是否使用VTK7。 如果是,则在文件/cmake/OpenCVDetectVTK.cmake的第6行中用vtkRenderingOpenGL2替换vtkRenderingOpenGL

答案发布在这里:https://github.com/opencv/opencv/issues/6180#issuecomment-204500571