###1. 安装 opencv
####1) 安装依赖
sudo apt-get install libcv-dev libcvaux-dev libhighgui-dev
####2) 下载源码编译安装 下载列表
cd ~/opencv
mkdir release
cd release
cmake -D CMAKE_BUILD_TYPE=RELEASE -D CMAKE_INSTALL_PREFIX=/usr/local ..
make
sudo make install
###2.测试 HelloWorld
####1) eclipse设置
Project –> Properties -> C/C++ Build -> Settings -> GCC C++ Compiler -> Includes , 添加opencv目录: /usr/include/opencv
####2) eclipse设置
Project –> Properties -> C/C++ Build -> Settings -> GCC C++ Linker -> Libraries, 添加 lib:opencv_core opencv_imgproc opencv_highgui opencv_ml opencv_video opencv_features2d opencv_calib3d opencv_objdetect opencv_contrib opencv_legacy opencv_flann
####3) 测试代码
#include <cv.h>
#include <highgui.h>
using namespace cv;
int main( int argc, char** argv )
{
Mat image;
image = imread( argv[1], 1 );
if( argc != 2 || !image.data )
{
printf( "No image data \n" );
return -1;
}
namedWindow( "Display Image", CV_WINDOW_AUTOSIZE );
imshow( "Display Image", image );
waitKey(0);
return 0;
}
####4) 效果图片: