Tuesday, December 11, 2012

Configure OpenCV 2.4 for Eclipse

Open Eclipse IDE

File --> New --> C++ Project

Give a project name
Select project type Hello World C++ Project from Executables

Project --> Properties
C/C++ Build --> Settings

Cross G++ Compiler --> Includes
Add /usr/local/include/opencv to Include paths(-l)

Cross G++ Linker --> Libraries
Add /usr/local/lib to Library search path (-L)
Add the following to Libraries(-l)

opencv_core
opencv_imgproc
opencv_highgui
opencv_ml
opencv_video
opencv_features2d
opencv_calib3d
opencv_objdetect
opencv_contrib
opencv_legacy
opencv_flann
opencv_nonfree


Copy the following test app, build and run.

#include <iostream>
#include <cv.h>
#include <highgui.h>

using namespace std;
using namespace cv;

int main() {
    cout << "!!!Hello World!!!" << endl;

    VideoCapture cap(0);
    Mat frame;
    do{
        cap >> frame;
        imshow("Disp", frame);
    }while(waitKey(30)<0);

    return 0;
}


It works !

1 comment:

  1. Hi. Great tutorials on your blog. really helpful. Thanks.

    I tried this code, it compiles, but I get an error when running:

    HIGHGUI ERROR: V4L/V4L2: VIDIOC_S_CROP
    (Disp:27554): Gtk-WARNING **: cannot open display:

    Any sugestions?

    ReplyDelete