Firstly, I'm assuming that you have installed OpenCV on Ubuntu. If not, then follow the link. Secondly You need to install Eclipse + JDK7. Following command will install eclipse for c++ developer with JDK7. Just Run following command.
Open Eclipse and right click or Go to File > new project > C/C++ > C++ Project > Next
Name the project as TestOpenCV and select Hello World C++ Project then click next. Write Author name whatever you want then click next next and finish.
Before to run project expand src directory and add following lines of code in TestOpenCV.cpp
Run following commands to get includes paths
Copy all include paths and add into include paths (-I) tab like following- sudo apt-get install eclipse eclipse-cdt g++
Open Eclipse and right click or Go to File > new project > C/C++ > C++ Project > Next
Name the project as TestOpenCV and select Hello World C++ Project then click next. Write Author name whatever you want then click next next and finish.
Before to run project expand src directory and add following lines of code in TestOpenCV.cpp
- #include "stdfix.h"#include <iostream>
#include <opencv/cv.h>#include <opencv/highgui.h>
#include <opencv2/core.hpp>
#include <opencv2/opencv.hpp>
#include <opencv2/imgproc/imgproc.hpp>
#include <opencv2/highgui/highgui.hpp>
using namespace std;
using namespace cv;
int main()
{
Mat image;
image = cv::imread("/home/test.png");
namedWindow("Display window", 1);
imshow("Display window",image);
waitKey(0);
return 0;
}
Run following commands to get includes paths
- pkg-config --cflags opencv
Run following command in terminal to get all libraries paths and lib files
- pkg-config --libs opencv
Now Click on Cross G++ Linker > Liberalities
and add lib path in Library search path (-L) tab and all OpenCV libs in Libraries(-I) tab
and add lib path in Library search path (-L) tab and all OpenCV libs in Libraries(-I) tab
- Path: /usr/local/lib
- Libs: opencv_calib3d opencv_contrib opencv_core opencv_features2d opencv_flann opencv_gpu opencv_highgui opencv_imgproc opencv_legacy opencv_ml opencv_nonfree opencv_objdetect opencv_ocl opencv_photo opencv_stitching opencv_superres opencv_ts opencv_video opencv_videostab
0 comments:
Post a Comment
Any suggesstion or issue please comment here