Ubuntu OpenCV安装和设置(Qt5?)

时间:2014-06-24 04:42:14

标签: qt opencv ubuntu installation

新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的安装前缀 做这个 export CMAKE_PREFIX_PATH = / home / user / Programs / 其中引用编译器等,以便此完整路径有效: / home / user中/程序//斌/ QMAKE 的 #&34;"""""""""""&# 34;"" *

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

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

4 个答案:

答案 0 :(得分:28)

我可以使用sudo apt-get install qt5-default

来解决这个问题

答案 1 :(得分:1)

这个答案有点迟了但我可以建议使用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应用程序,并且也可以轻松调试。

答案 2 :(得分:1)

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

答案 3 :(得分:0)

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

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

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

  2. source~ / .bashrc

  3. 然后,它对我有用。