Ubuntu OpenCV Install and Setup (Qt5 ?)
New Linux user. OS: Ubuntu 14.04 Install: 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:
I first used https://help.ubuntu.com/community/OpenCV including the provided script.
Then 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/
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.
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
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 """""""""""""""*
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)
Answers
I was able to solve this by using sudo apt-get install qt5-default
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.
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)
Then the only thing you need to do in QT-Creator is go to yourProjectName.pro file and add the following lines
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.
In https://help.ubuntu.com/community/OpenCV, change the cmake command by removing -D WITH_QT=ON if want to install opencv without qt5.
1.Open your .bashrc file: gedit ~/.bashrc
add a line like following to the end of the .bashrc file:
export CMAKE_PREFIX_PATH=/usr/local/Qt5.5.1/5.5/gcc_64/lib/cmake
source ~/.bashrc
Then, it works for me.