zoukankan      html  css  js  c++  java
  • linux mint 安装 opencv2.4

    Download opencv

    https://github.com/opencv/opencv/tree/2.4

    安装必要的依赖

    sudo apt-get install build-essential
    sudo apt-get install cmake git libgtk2.0-dev pkg-config libavcodec-dev libavformat-dev libswscale-dev
    sudo apt-get install python-dev python-numpy libtbb2 libtbb-dev libjpeg-dev libpng-dev libtiff-dev libjasper-dev libdc1394-22-dev
    

    Enter opencv dirctory and install

    cd  XXXX/opencv2.4
    mkdir Release
    cd Release
    cmake -D CMAKE_BUILD_TYPE=RELEASE -D CMAKE_INSTALL_PREFIX=/usr/local -D WITH_TBB=ON -D BUILD_NEW_PYTHON_SUPPORT=ON -D WITH_V4L=ON -D INSTALL_C_EXAMPLES=ON -D INSTALL_PYTHON_EXAMPLES=ON -D BUILD_EXAMPLES=ON -D WITH_QT=ON -D WITH_GTK=ON -D WITH_OPENGL=ON ..
    

    cmake 出错,报错如下

    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:489 (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:489 (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:489 (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:489 (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:489 (include)
    
    
    qmake: could not exec '/usr/lib/x86_64-linux-gnu/qt4/bin/qmake': No such file or directory
    CMake Error at /usr/share/cmake-3.5/Modules/FindQt4.cmake:1326 (message):
      Found unsuitable Qt version "" from NOTFOUND, this code requires Qt 4.x
    Call Stack (most recent call first):
      cmake/OpenCVFindLibsGUI.cmake:34 (find_package)
      CMakeLists.txt:489 (include)
    
    
    -- Configuring incomplete, errors occurred!
    See also "/home/feng/Documents/opencv-2.4/Release/CMakeFiles/CMakeOutput.log".
    See also "/home/feng/Documents/opencv-2.4/Release/CMakeFiles/CMakeError.log".
    

    根据报错信息,应该是qt没装
    安装qt

    sudo apt-get install libqt4-dev
    

    cmake成功会生成如下文件

    feng@mint ~/Documents/opencv-2.4/Release $ ls
    3rdparty  CMakeCache.txt       cmake_uninstall.cmake  CPackSourceConfig.cmake  data     junk      modules             OpenCVConfig-version.cmake  unix-install
    apps      CMakeFiles           CMakeVars.txt          CTestTestfile.cmake      doc      lib       opencv2             OpenCVModules.cmake         version_string.tmp
    bin       cmake_install.cmake  CPackConfig.cmake      cvconfig.h               include  Makefile  OpenCVConfig.cmake  samples
    
    make
    sudo make install
    

    the whole installation tutorial

    http://docs.opencv.org/trunk/d7/d9f/tutorial_linux_install.html

    参考博客:
    http://www.linuxidc.com/Linux/2016-07/132879.htm

  • 相关阅读:
    mybatis 枚举的支持
    windows系统下Disconf web安装-分布式配置管理平台
    Tomcat启动报Error listenerStart错误
    Java并发编程:volatile关键字解析
    深入理解java异常处理机制
    Java 常见异常种类
    Java RMI与RPC的区别
    Java的快速失败和安全失败
    mysql数据类型介绍(含text,longtext,mediumtext说明)
    DTO – 服务实现中的核心数据
  • 原文地址:https://www.cnblogs.com/0x12345678/p/6504638.html
Copyright © 2011-2022 走看看