linux mint 安装 opencv2.4

Download opencv

安装必要的依赖

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

Original: https://www.cnblogs.com/0x12345678/p/6504638.html
Author: Hackergin
Title: linux mint 安装 opencv2.4

原创文章受到原创版权保护。转载请注明出处:https://www.johngo689.com/562751/

转载文章受原作者版权保护。转载请注明原作者出处!

(0)

大家都在看

亲爱的 Coder【最近整理,可免费获取】👉 最新必读书单  | 👏 面试题下载  | 🌎 免费的AI知识星球