c++ - cmake opencv for contrib - 配置不完整,发生错误

标签 c++ linux opencv compilation

我已经在我的机器上安装了 opencv。我现在正在尝试安装一个额外的模块。但它失败了,我不明白我做错了什么。

我正在尝试执行以下命令:

$ cd <opencv_build_directory>
$ cmake -DOPENCV_EXTRA_MODULES_PATH=<opencv_contrib>/modules <opencv_source_directory>
$ make -j5

来源:https://github.com/opencv/opencv_contrib

但是当我尝试执行此操作时:

cmake
-DOPENCV_EXTRA_MODULES_PATH=/home/yalishanda/Downloads/opencv_contrib-master/modules -D CMAKE_INSTALL_PREFIX=/usr/local ..

我得到:

-- Detected version of GNU GCC: 54 (504)
-- Found ZLIB: /usr/lib/i386-linux-gnu/libz.so (found suitable version "1.2.8", minimum required is "1.2.3") 
-- Could NOT find TIFF (missing:  TIFF_LIBRARY TIFF_INCLUDE_DIR) 
-- Could NOT find JPEG (missing:  JPEG_LIBRARY JPEG_INCLUDE_DIR) 
-- Could NOT find Jasper (missing:  JASPER_LIBRARIES JASPER_INCLUDE_DIR) 
-- Found ZLIB: /usr/lib/i386-linux-gnu/libz.so (found version "1.2.8") 
CMake Warning at cmake/OpenCVFindLibsGUI.cmake:18 (find_package):
  By not providing "FindQt5Core.cmake" in CMAKE_MODULE_PATH this project has
  asked CMake to find a package configuration file provided by "Qt5Core", but
  CMake did not find one.

  Could not find a package configuration file provided by "Qt5Core" with any
  of the following names:

    Qt5CoreConfig.cmake
    qt5core-config.cmake

  Add the installation prefix of "Qt5Core" to CMAKE_PREFIX_PATH or set
  "Qt5Core_DIR" to a directory containing one of the above files.  If
  "Qt5Core" provides a separate development package or SDK, be sure it has
  been installed.
Call Stack (most recent call first):
  CMakeLists.txt:535 (include)


CMake Warning at cmake/OpenCVFindLibsGUI.cmake:19 (find_package):
  By not providing "FindQt5Gui.cmake" in CMAKE_MODULE_PATH this project has
  asked CMake to find a package configuration file provided by "Qt5Gui", but
  CMake did not find one.

  Could not find a package configuration file provided by "Qt5Gui" with any
  of the following names:

    Qt5GuiConfig.cmake
    qt5gui-config.cmake

  Add the installation prefix of "Qt5Gui" to CMAKE_PREFIX_PATH or set
  "Qt5Gui_DIR" to a directory containing one of the above files.  If "Qt5Gui"
  provides a separate development package or SDK, be sure it has been
  installed.
Call Stack (most recent call first):
  CMakeLists.txt:535 (include)


CMake Warning at cmake/OpenCVFindLibsGUI.cmake:20 (find_package):
  By not providing "FindQt5Widgets.cmake" in CMAKE_MODULE_PATH this project
  has asked CMake to find a package configuration file provided by
  "Qt5Widgets", but CMake did not find one.

  Could not find a package configuration file provided by "Qt5Widgets" with
  any of the following names:

    Qt5WidgetsConfig.cmake
    qt5widgets-config.cmake

  Add the installation prefix of "Qt5Widgets" to CMAKE_PREFIX_PATH or set
  "Qt5Widgets_DIR" to a directory containing one of the above files.  If
  "Qt5Widgets" provides a separate development package or SDK, be sure it has
  been installed.
Call Stack (most recent call first):
  CMakeLists.txt:535 (include)


CMake Warning at cmake/OpenCVFindLibsGUI.cmake:21 (find_package):
  By not providing "FindQt5Test.cmake" in CMAKE_MODULE_PATH this project has
  asked CMake to find a package configuration file provided by "Qt5Test", but
  CMake did not find one.

  Could not find a package configuration file provided by "Qt5Test" with any
  of the following names:

    Qt5TestConfig.cmake
    qt5test-config.cmake

  Add the installation prefix of "Qt5Test" to CMAKE_PREFIX_PATH or set
  "Qt5Test_DIR" to a directory containing one of the above files.  If
  "Qt5Test" provides a separate development package or SDK, be sure it has
  been installed.
Call Stack (most recent call first):
  CMakeLists.txt:535 (include)


CMake Warning at cmake/OpenCVFindLibsGUI.cmake:22 (find_package):
  By not providing "FindQt5Concurrent.cmake" in CMAKE_MODULE_PATH this
  project has asked CMake to find a package configuration file provided by
  "Qt5Concurrent", but CMake did not find one.

  Could not find a package configuration file provided by "Qt5Concurrent"
  with any of the following names:

    Qt5ConcurrentConfig.cmake
    qt5concurrent-config.cmake

  Add the installation prefix of "Qt5Concurrent" to CMAKE_PREFIX_PATH or set
  "Qt5Concurrent_DIR" to a directory containing one of the above files.  If
  "Qt5Concurrent" provides a separate development package or SDK, be sure it
  has been installed.
Call Stack (most recent call first):
  CMakeLists.txt:535 (include)


-- 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 - found
-- Looking for sys/videoio.h
-- Looking for sys/videoio.h - not found
-- Checking for module 'libavcodec'
--   No package 'libavcodec' found
-- Checking for module 'libavformat'
--   No package 'libavformat' found
-- Checking for module 'libavutil'
--   No package 'libavutil' found
-- Checking for module 'libswscale'
--   No package 'libswscale' found
-- Checking for module 'libavresample'
--   No package 'libavresample' found
-- Looking for libavformat/avformat.h
-- Looking for libavformat/avformat.h - not found
-- Looking for ffmpeg/avformat.h
-- Looking for ffmpeg/avformat.h - not found
-- Checking for module 'libgphoto2'
--   No package 'libgphoto2' found
-- On 32-bit Linux IPP can not currently be used with dynamic libs because of linker errors. Set BUILD_SHARED_LIBS=OFF
-- 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: /usr/bin/python2.7 (found suitable version "2.7.12", minimum required is "2.7") 
-- Found PythonInterp: /usr/bin/python3 (found suitable version "3.5.1", minimum required is "3.4") 
-- Could NOT find PythonLibs (missing:  PYTHON_LIBRARIES PYTHON_INCLUDE_DIRS) (Required is exact version "3.5.1")
Traceback (most recent call last):
  File "<string>", line 1, in <module>
ImportError: No module named 'numpy'
-- 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_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
-- Caffe:   NO
-- Protobuf:   NO
-- Glog:   NO
CMake Error at cmake/OpenCVUtils.cmake:857 (file):
  file MD5 failed to read file
  "/home/yalishanda/Downloads/opencv-3.1.0/3rdparty/tinydnn/": Success
Call Stack (most recent call first):
  /home/yalishanda/Downloads/opencv_contrib-master/modules/dnn_modern/CMakeLists.txt:20 (ocv_download)


-- Downloading ...
CMake Error at cmake/OpenCVUtils.cmake:895 (file):
  file DOWNLOAD cannot open file for write.
Call Stack (most recent call first):
  /home/yalishanda/Downloads/opencv_contrib-master/modules/dnn_modern/CMakeLists.txt:20 (ocv_download)


CMake Error at cmake/OpenCVUtils.cmake:899 (message):
  Failed to download .  Status=
Call Stack (most recent call first):
  /home/yalishanda/Downloads/opencv_contrib-master/modules/dnn_modern/CMakeLists.txt:20 (ocv_download)


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

有人可以解释一下我可能做错了什么吗?

我尝试按如下方式安装 qt5,但这些错误仍然存​​在:

sudo apt-get remove qt5-default qttools5-dev-tools && sudo apt-get autoremove && sudo apt-get clean && sudo apt-get autoclean 

sudo apt-get install qt5-default qttools5-dev-tools

最佳答案

确保您为 opencv_contrib 模块使用与主 opencv 库相同的版本。您似乎正在使用版本 3.1.0,对于可以下载相应 opencv_contrib 的主库(here)。

关于 QT 部分,它看起来像是警告,但您可以检查安装 libqt5gui5libqt5concurrent5libqt5widgets5 是否可以解决该问题。

如果仍然存在错误,请尝试删除导致这些错误的模块(例如 tinydnndnn_modern)。

关于c++ - cmake opencv for contrib - 配置不完整,发生错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/44871470/

相关文章:

opencv - 查找图像中边缘的密度

linux - 如何在 Linux 中只提取文件的 inode 编号?

c++ - 如何使用 Boost Spirit 解析像转义字符串这样的 CSV?

c++ - 存储分组关系和支持外观的最佳数据结构

c++ - 关于 SIGNAL/SLOT qt4 的问题

c++ - 带线程的 fork 和 core dump

linux - 检查页面是否在任务的VMA中

c++ - 在 OpenCV 中将彩色图像转换为灰度问题

java - 无法使用 Android 解析 OpenCV 中的 putText()

c++ - 在 C++ 中记录代码执行