标签:
openCV源码下载地址:http://opencv.org/
cmake build-essential libgtk2.0-dev
进入源码根目录执行:cmake .
也可以用cmake-gui进行图像界面配置
sudo make
sudo make install
mkdir ~/opencv-lena
cd ~/opencv-lena
gedit DisplayImage.cpp
#include <stdio.h>
#include <opencv2/opencv.hpp>
using namespace cv;
int main(int argc, char** argv )
{
if ( argc != 2 )
{
printf("usage: DisplayImage.out <Image_Path>\n");
return -1;
}
Mat image;
image = imread( argv[1], 1 );
if ( !image.data )
{
printf("No image data \n");
return -1;
}
namedWindow("Display Image", WINDOW_AUTOSIZE );
imshow("Display Image", image);
waitKey(0);
return 0;
}
gedit CMakeLists.txt
写入如下内容
cmake_minimum_required(VERSION 2.8)
project( DisplayImage )
find_package( OpenCV REQUIRED )
add_executable( DisplayImage DisplayImage.cpp )
target_link_libraries( DisplayImage ${OpenCV_LIBS} )
cd ~/opencv-lena
cmake .
make
此时opencv-lena文件夹中已经产生了可执行文件DisplayImage,下载lena.jpg放在opencv-lena下,运行
./DisplayImage lena.jpg
Ubuntu14.04LTS 32bit 安装openCV3.0
标签:
原文地址:http://www.cnblogs.com/zhanghongjay/p/4827699.html