新的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/
我甚至看到将"Qt5Widgets"的安装前缀添加到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 …Run Code Online (Sandbox Code Playgroud) 我成功安装并链接并包含OpenCV.(我知道它是成功的,因为我编译并运行了本网站上的opencv程序)
所以我回到了OpenCV文档和教程页面.我从这个页面复制了下面的确切代码.
#include <iostream>
#include <opencv2/core/core.hpp>
#include <opencv2/highgui/highgui.hpp>
using namespace cv;
using namespace std;
int main(int argc, char** argv)
{
if( argc != 2)
{
cout <<" Usage: display_image ImageToLoadAndDisplay" << endl;
return -1;
}
Mat image;
image = imread(argv[1], CV_LOAD_IMAGE_COLOR); // Read the file
if(!image.data ) // Check for invalid input
{
cout << "Could not open or find the image" << std::endl ;
return -1;
}
namedWindow( "Display window", WINDOW_AUTOSIZE );// Create a window …Run Code Online (Sandbox Code Playgroud)