Ubuntu OpenCV安装和安装(Qt5 ?)

时间:2022-01-17 02:29:02

New Linux user. OS: Ubuntu 14.04 Install: OpenCV 2.4.9

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

I'm attempting to install OpenCV for use on codeblocks (or other IDE). I've followed (or attempted to follow, actually) each and every instruction on the following pages:

我正在尝试安装OpenCV以用于codeblocks(或其他IDE)。我跟随(或试图追随,实际上)每条指令在以下几页:

I first used https://help.ubuntu.com/community/OpenCV including the provided script.

我首先使用https://help.ubuntu.com/community/OpenCV,包括提供的脚本。

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

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

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

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

I even saw Add the installation prefix of "Qt5Widgets" to CMAKE_PREFIX_PATH but I'm not even sure what the answer means, let alone if it will work since it apparently didn't for the Question OP.

我甚至还看到了将“Qt5Widgets”的安装前缀添加到CMAKE_PREFIX_PATH,但我甚至不确定它的答案是什么,更不用说它是否会起作用,因为它显然并没有用于问题OP。

This is where the errors appear to start in terminal output while running the script:

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

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".

After prior attempts, I've got a folder OpenCV inside Home, with a zip file and folder both named opencv-2.4.9

在之前的尝试之后,我在家里有一个文件夹OpenCV,有一个zip文件和文件夹,都叫OpenCV -2.4.9。

So "some" things have been done, but not a complete install ready for use. Maybe a simpler explanation of what

所以“有些”已经完成了,但还没有完全安装好。也许是更简单的解释。

"""""""""""""(quoted answer from earlier question) This is documented: http://doc-snapshot.qt-project.org/qt5-stable/cmake-manual.html The easiest way to use CMake is to set the CMAKE_PREFIX_PATH environment variable to the install prefix of Qt 5 Do this export CMAKE_PREFIX_PATH=/home/user/Programs/ where references the compiler etc, so that this complete path is valid: /home/user/Programs//bin/qmake """""""""""""""*

使用CMake的最简单的方法是将CMAKE_PREFIX_PATH环境变量设置为Qt 5的安装前缀,这样做可以导出CMAKE_PREFIX_PATH=/home/user/程序/引用编译器等,这样完整的路径是有效的:/ home/ user/programs/bin /qmake“”“”“”“”“”“”“”“”“”“”“”“”“”“”“”“”“”“”“”“”“”

means exactly would solve this.

意思就是解决这个问题。

Thanks. (FYI, I can't/don't know how to use this because I don't have programs folder, or even user folder , and the suggested terminal command kicks out an error)

谢谢。(FYI,我不能/不知道如何使用它,因为我没有程序文件夹,甚至没有用户文件夹,建议的终端命令会触发一个错误)

4 个解决方案

#1


24  

I was able to solve this by using sudo apt-get install qt5-default

我可以通过使用sudo apt-get安装qt5-default来解决这个问题。

#2


1  

In https://help.ubuntu.com/community/OpenCV, change the cmake command by removing -D WITH_QT=ON if want to install opencv without qt5.

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

#3


0  

This answer is a bit on the late side but may i suggest using the QT-Creator IDE it has everything in it you will need to build your application. Even a designer to easily create a user interface.

这个答案有点晚了,但是我建议您使用QT-Creator IDE,它包含了您需要构建应用程序的所有内容。甚至设计人员也可以轻松地创建用户界面。

Other than that I see that you are using Ubuntu 14.04, if you plan on reading and/or writing video files you should compile FFmpeg from source (if you don't do this it doesn't work for some reason) and OpenCV after wards like in the link you gave up (maybe alter to 2.4.10)

除此之外,我看到您使用的是Ubuntu 14.04,如果你打算读和/或写视频文件你应该从源代码编译FFmpeg(如果你不这样做它不工作由于某种原因)和OpenCV病房的链接你放弃了(也许改变2.4.10)

Then the only thing you need to do in QT-Creator is go to yourProjectName.pro file and add the following lines

然后,在QT-Creator中唯一需要做的就是进入你的projectname。支持文件并添加以下代码行。

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

You don't need cmake anymore and you can create QT-applications with OpenCV pretty fast and there easy to debug as well.

您不再需要cmake,您可以快速创建具有OpenCV的qt应用程序,并且也可以很容易地进行调试。

#4


0  

1.Open your .bashrc file: gedit ~/.bashrc

1。打开.bashrc文件:gedit ~/.bashrc。

  1. add a line like following to the end of the .bashrc file:

    在.bashrc文件的末尾添加一行。

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

    出口CMAKE_PREFIX_PATH = / usr /地方/ Qt5.5.1/5.5 / gcc_64 / lib / cmake

  2. source ~/.bashrc

    源~ / . bashrc

Then, it works for me.

然后,它对我有用。

#1


24  

I was able to solve this by using sudo apt-get install qt5-default

我可以通过使用sudo apt-get安装qt5-default来解决这个问题。

#2


1  

In https://help.ubuntu.com/community/OpenCV, change the cmake command by removing -D WITH_QT=ON if want to install opencv without qt5.

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

#3


0  

This answer is a bit on the late side but may i suggest using the QT-Creator IDE it has everything in it you will need to build your application. Even a designer to easily create a user interface.

这个答案有点晚了,但是我建议您使用QT-Creator IDE,它包含了您需要构建应用程序的所有内容。甚至设计人员也可以轻松地创建用户界面。

Other than that I see that you are using Ubuntu 14.04, if you plan on reading and/or writing video files you should compile FFmpeg from source (if you don't do this it doesn't work for some reason) and OpenCV after wards like in the link you gave up (maybe alter to 2.4.10)

除此之外,我看到您使用的是Ubuntu 14.04,如果你打算读和/或写视频文件你应该从源代码编译FFmpeg(如果你不这样做它不工作由于某种原因)和OpenCV病房的链接你放弃了(也许改变2.4.10)

Then the only thing you need to do in QT-Creator is go to yourProjectName.pro file and add the following lines

然后,在QT-Creator中唯一需要做的就是进入你的projectname。支持文件并添加以下代码行。

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

You don't need cmake anymore and you can create QT-applications with OpenCV pretty fast and there easy to debug as well.

您不再需要cmake,您可以快速创建具有OpenCV的qt应用程序,并且也可以很容易地进行调试。

#4


0  

1.Open your .bashrc file: gedit ~/.bashrc

1。打开.bashrc文件:gedit ~/.bashrc。

  1. add a line like following to the end of the .bashrc file:

    在.bashrc文件的末尾添加一行。

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

    出口CMAKE_PREFIX_PATH = / usr /地方/ Qt5.5.1/5.5 / gcc_64 / lib / cmake

  2. source ~/.bashrc

    源~ / . bashrc

Then, it works for me.

然后,它对我有用。