码迷,mamicode.com
首页 > Windows程序 > 详细

Add opencv to eclipse on Windows

时间:2015-09-14 15:12:29      阅读:248      评论:0      收藏:0      [点我收藏+]

标签:

reference from http://stackoverflow.com/questions/13754348/opencv-on-eclipse-on-windows

 

step 1. download

1. eclipse c++. select Windows 32-bit or Windows 64-bit

2. mingGW.

  2.1 follow "Basic Setup", select all and click Installation -> apply...

技术分享

  2.2 Add bin directory to path  (mycomputer -> prosperties -> advanced system settings -> Environment Variables -> system Variables:Path ->Edit add the directory).

3. OpenCV for Windows 2.4.10. Extract files and  add the bin directory => Path (mycomputer -> prosperties -> advanced system settings -> Environment Variables -> system Variables:Path ->Edit add the directory).

 

step 2. Create and Configure

1. Open the Eclipse, Create a new C++ project : File > New > C++ Project ( Don‘t forget to select the MinGW toolchains)

2. replace test code

///////////////CODE///////////

#include "opencv2/highgui/highgui.hpp"
#include <iostream>
using namespace cv;
using namespace std;
int main(int argc, char** argv)
{
  Mat im = imread(argc == 2 ? argv[1] : "lenna.png", 1);// the image in your project
  if (im.empty())
  {
    cout << "Cannot open image!" << endl;
    return -1;
  }
  imshow("image", im);
  waitKey(0);
  return 0;
}
///////////////CODE///////////

3. Now go to Properties >> C/C++ Build >> Settings on the Tool Setting tab :

    GCC C++ Compiler >> Includes and include opencv path ! [opencvDir\build\include]

    MinGW C++ Linker >> Libraries and add the Library search path [opencvDIR\build\x86\mingw\lib]

 

Add opencv to eclipse on Windows

标签:

原文地址:http://www.cnblogs.com/freyfly/p/4806969.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!