Add OpenCV to eclipse on Windows

Source: Internet
Author: User

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-& Gt 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, ENV Ironment 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 sel ECT 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 Imag E 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 + + 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

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.