Hope you are already have installed Eclipse, g++ and OpenCV. If not, then go to my article, and see how it can be done.
Today, we are going to create our first "hello world" application using OpenCV and Eclipse.
- Run Eclipse
- Create Empty C++ project
- Open terminal window and type "pkg-config opencv --cflags". It will show you paths to OpenCV
- Right click on your Project folder.
- Select "Properties" item
- In the Property window go to "C/C++ Build- Settings- Includes" and put there paths to OpenCV libs that you obtained using pkg-config tool
- Click "Apply" button to save your changes.
- Switch back to your terminal window and type "pkg-config opencv --libs" It will show you list of libs registered in system for OpenCV
- Switch to Eclipse again.
- Go to "C/C++ Build- Settings- GCC C++ Linker- Libraries"
- In the Libraries (-l) list add all libraries hat you have got in your terminal window. Each Library should be described from new line.
- In the "Library Search path (-L)" add paths to OpenCV libs that you can see in terminal window.
Click OK Button, to close Property window.
That's all, your project configured and ready to work with OpenCV.
- Go to your OpenCV/sample/cpp folder, select any cpp file, copy content into your "HelloWorld.cpp"
- Press "Ctrl+B" to build your project
- Run it.
No comments:
Post a Comment