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 !
Hi. Great tutorials on your blog. really helpful. Thanks.
ReplyDeleteI 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?