【问题标题】:Ubuntu OpenCV Install and Setup (Qt5 ?)Ubuntu OpenCV 安装和设置(Qt5 ?)
【发布时间】:2014-08-14 05:37:00
【问题描述】:

新的 Linux 用户。操作系统:Ubuntu 14.04 安装:OpenCV 2.4.9

我正在尝试安装 OpenCV 以用于代码块(或其他 IDE)。 我已经遵循(或实际上试图遵循)以下页面上的每一条说明:

我第一次使用 https://help.ubuntu.com/community/OpenCV 包括提供的脚本。

然后 http://docs.opencv.org/doc/tutorials/introduction/linux_install/linux_install.html

终于 http://www.samontab.com/web/2012/06/installing-opencv-2-4-1-ubuntu-12-04-lts/

我什至看到Add the installation prefix of "Qt5Widgets" to CMAKE_PREFIX_PATH 但我什至不确定答案是什么意思,更不用说它是否会起作用,因为它显然不适用于问题 OP。

这是运行脚本时在终端输出中出现错误的地方:

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:466 (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:466 (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:466 (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:466 (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:466 (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-2.8/Modules/FindQt4.cmake:1386 (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:466 (include)


-- Configuring incomplete, errors occurred!
See also "/home/*******/OpenCV/opencv-2.4.9/build/CMakeFiles/CMakeOutput.log".
See also "/home/*******/OpenCV/opencv-2.4.9/build/CMakeFiles/CMakeError.log".

经过之前的尝试,我在 Home 中有一个 OpenCV 文件夹,其中包含一个 zip 文件和一个名为 opencv-2.4.9 的文件夹

所以“一些”事情已经完成,但还没有完全安装好使用。也许更简单的解释是什么

"""""""""""""(引用之前问题的答案) 这是记录在案的: http://doc-snapshot.qt-project.org/qt5-stable/cmake-manual.html 使用 CMake 最简单的方法是设置 CMAKE_PREFIX_PATH 环境变量到 Qt 5 的安装前缀 做这个 导出 CMAKE_PREFIX_PATH=/home/user/Programs/ where 引用编译器等,以便此完整路径有效: /home/user/Programs//bin/qmake """""""""""""""*

意味着完全可以解决这个问题。

谢谢。 (仅供参考,我不能/不知道如何使用它,因为我没有程序文件夹,甚至没有用户文件夹,建议的终端命令会出现错误)

【问题讨论】:

    标签: qt opencv ubuntu installation


    【解决方案1】:

    我可以使用sudo apt-get install qt5-default解决这个问题

    【讨论】:

      【解决方案2】:

      这个答案有点晚了,但我可以建议使用 QT-Creator IDE,它包含构建应用程序所需的一切。即使是设计师也能轻松创建用户界面。

      除此之外,我看到您使用的是 Ubuntu 14.04,如果您打算读取和/或写入视频文件,您应该编译 来自源代码的 FFmpeg(如果你不这样做,由于某种原因它不起作用)和之后的 OpenCV,就像你放弃的链接一样(可能会更改为 2.4.10)

      那么在 QT-Creator 中你唯一需要做的就是进入 yourProjectName.pro 文件并添加以下行

      QT_CONFIG -= no-pkg-config
      CONFIG += link_pkgconfig
      PKGCONFIG += opencv
      CONFIG += c++11
      LIBS += -ltbb
      

      您不再需要 cmake,您可以使用 OpenCV 非常快速地创建 QT 应用程序,并且易于调试。

      【讨论】:

        【解决方案3】:

        https://help.ubuntu.com/community/OpenCV 中,如果想在没有 qt5 的情况下安装 opencv,请通过删除 -D WITH_QT=ON 来更改 cmake 命令。

        【讨论】:

          【解决方案4】:

          1.打开您的.bashrc 文件: gedit ~/.bashrc

          1. 在 .bashrc 文件的末尾添加如下一行:

            导出 CMAKE_PREFIX_PATH=/usr/local/Qt5.5.1/5.5/gcc_64/lib/cmake

          2. 来源 ~/.bashrc

          然后,它对我有用。

          【讨论】:

            猜你喜欢
            • 1970-01-01
            • 1970-01-01
            • 1970-01-01
            • 2015-05-11
            • 1970-01-01
            • 1970-01-01
            • 2019-04-27
            • 1970-01-01
            • 2021-12-01
            相关资源
            最近更新 更多