Tuesday, September 29, 2009

Eclipse - OpenCV Project Setup

After you install OpenCV you will most likely want to use a programming IDE to write your code. In this case I am assuming you have chosen the Eclipse C++ IDE. To install this go here to download and untar the program where you will want it to reside on your machine.  Then run the program (no install necessary... it's written in java).

If you have installed the OpenCV library on your machine to /usr/local then you can follow this setup. Otherwise you will have to change how you link to OpenCV appropriately.  This section also relates to the setup of gtkmm and fftw.  If you do not want to use them, remove their sections.

1) Right click on your project and go to Properties
2) Go to the C/C++ Build section and then Settings
3) Under GCC C++ Compiler,  click on Directories
4) Add the following paths under Include Paths

/usr/local/include/opencv
/usr/lib/gtkmm-2.4
/usr/include/gtkmm-2.4


5) Under GCC C++ Compiler,  click on Optimization
6) Add the following under Other optimization flags

-ggdb `pkg-config opencv --cflags --libs` `pkg-config gtkmm-2.4 --cflags --libs`


7) Under GCC C++ Linker,  click on Libraries
8) Add the following under Libraries

cv
gtkmm-2.4
highgui
fftw3
9) Add the following under Library search path


/usr/local/lib
/usr/lib

1 comment:

  1. Thanks for writing this tutorial. I have been dreading the thought of having to re-setup eclipse to work with opencv. This should make things a little easier

    ReplyDelete