标签:
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