简体   繁体   English

OpenCV-Python安装-缺少vtkRenderingOpenGL的CMake错误[Ubuntu 16.04]

[英]OpenCV-Python installation - CMake error missing vtkRenderingOpenGL [Ubuntu 16.04]

I'm trying to install Python-OpenCV in Python3 on my LTS system following this guide. 我正在尝试按照指南在LTS系统上的Python3中安装Python-OpenCV

When I try to run CMake: 当我尝试运行CMake时:

cmake -D CMAKE_BUILD_TYPE=RELEASE -D CMAKE_INSTALL_PREFIX=/usr/local -D INSTALL_PYTHON_EXAMPLES=ON -D INSTALL_C_EXAMPLES=OFF -D OPENCV_EXTRA_MODULES_PATH=~/opencv_contrib-3.1.0/modules -D PYTHON_EXECUTABLE=~/.virtualenvs/cv/bin/python -D BUILD_EXAMPLES=ON ..

I get the following error: 我收到以下错误:

-- Detected version of GNU GCC: 54 (504)
-- Found ZLIB: /usr/lib/x86_64-linux-gnu/libz.so (found suitable version "1.2.8", minimum required is "1.2.3") 
-- Found ZLIB: /usr/lib/x86_64-linux-gnu/libz.so (found version "1.2.8") 
-- 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
-- Looking for linux/videodev.h
-- Looking for linux/videodev.h - not found
-- Looking for linux/videodev2.h
-- Looking for linux/videodev2.h - found
-- Looking for sys/videoio.h
-- Looking for sys/videoio.h - not found
-- Checking for module 'libavresample'
--   No package 'libavresample' found
-- 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
-- found IPP (ICV version): 9.0.1 [9.0.1]
-- at: /home/matt/opencv-3.1.0/3rdparty/ippicv/unpack/ippicv_lnx
-- Could NOT find Doxygen (missing:  DOXYGEN_EXECUTABLE) 
-- To enable PlantUML support, set PLANTUML_JAR environment variable or pass -DPLANTUML_JAR=<filepath> option to cmake
-- Found PythonInterp: /home/matt/.virtualenvs/cv/bin/python (found suitable version "3.5.2", minimum required is "2.7") 
-- Found PythonInterp: /home/matt/.virtualenvs/cv/bin/python3 (found suitable version "3.5.2", minimum required is "3.4") 
-- 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) 
CMake Error at /usr/local/lib/cmake/vtk-7.1/vtkModuleAPI.cmake:120 (message):
  Requested modules not available:

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


-- Configuring incomplete, errors occurred!
See also "/home/matt/opencv-3.1.0/build/CMakeFiles/CMakeOutput.log".
See also "/home/matt/opencv-3.1.0/build/CMakeFiles/CMakeError.log".

I've followed the guide completely up until this point so I'm not sure what is wrong. 到目前为止,我已经完全按照指南进行操作,所以我不确定出什么问题了。

I've looked around to try and fix the missing package vtkRenderingOpenGL and followed this post. 我环顾四周,尝试修复缺少的软件包vtkRenderingOpenGL并关注了这篇文章。

I'm sure that I've installed this in the past and so unsurprisingly I get: 我确定我已经安装了该软件,所以我得到了:

sudo apt -y install freeglut3-dev

Reading package lists... Done
Building dependency tree       
Reading state information... Done
freeglut3-dev is already the newest version (2.8.1-2).
0 to upgrade, 0 to newly install, 0 to remove and 1 not to upgrade.

Any and all help is much appreciated! 任何帮助都将不胜感激!

Taking advice given from the OpenCV community forum ( post ). 接受来自OpenCV社区论坛的建议( post )。

Add this to CMake options: 将此添加到CMake选项:

-D WITH_VTK=OFF -D BUILD_opencv_viz=OFF

"opencv_viz is the only opencv module, that depends on vtk, and you cannot use it from python" “ opencv_viz是唯一依赖于vtk的opencv模块,您不能从python使用它”

Therefore it is fine to just disable it all together and after doing so CMake completes. 因此,最好将它们全部一起禁用,然后完成CMake。

My advice is: uninstall your ffmpeg and install an older one. 我的建议是:卸载ffmpeg并安装较旧的版本。 For me, I installed opencv3.2.0 with ffmpeg4.0, and I got the error: 对我来说,我用ffmpeg4.0安装了opencv3.2.0,但出现错误:

'No package 'libavresample' found' '未找到软件包'libavresample''

and so on. 等等。 Now, I change my ffmpeg to ffmpeg2.7.2, and it works for me. 现在,我将ffmpeg更改为ffmpeg2.7.2,它对我有用。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM