Installing OpenCV 2.3 in Eclipse in Ubuntu 11.04( updated to 12.10)
I'm writing this particular post because I didn't find a convincing working easy to follow article of how to install OpenCV for Eclipse in Ubuntu 11.04 and up (till 12.10).
Installing OpenCV
Congratulations !! Now you are good to go. Here's a test program to test your configurations..!!
#include “highgui/highgui.hpp”
int main( int argc, char** argv ) {
IplImage* img = cvLoadImage( argv[1] );
cvNamedWindow( “Example1”, CV_WINDOW_AUTOSIZE );
cvShowImage( “Example1”, img );
cvWaitKey(0);
cvReleaseImage( &img );
cvDestroyWindow( “Example1” );
}
// add a image and rename the img parameter from "Example 1" to whatever your image file name is :)
Installing OpenCV
- Install OpenCV libraries from Ubuntu Software Center. Install libcv, libcv-dev, libhighgui, libhighgui-dev (and Whatever other libraries of your favor.)
- You can check the installation by opening up a terminal and typing pkg-config --libs opencv and pkg-config --cflags opencv
and it should result something like this if you have installed all the libraries,
-lopencv_core -lopencv_imgproc -lopencv_highgui -lopencv_ml -lopencv_video -lopencv_features2d -lopencv_calib3d -lopencv_objdetect -lopencv_contrib -lopencv_legacy -lopencv_flann
-I/usr/include/opencv
- Create a new C++ project and fill in the details
- Then go to Project>Properties>C/C++ Build>Settings> Tools Tab
- Under GCC C++ compliler > Directories add /usr/include/opencv
4. Then under GCC C++ Linker > Libraries add these parameters
#include “highgui/highgui.hpp”
int main( int argc, char** argv ) {
IplImage* img = cvLoadImage( argv[1] );
cvNamedWindow( “Example1”, CV_WINDOW_AUTOSIZE );
cvShowImage( “Example1”, img );
cvWaitKey(0);
cvReleaseImage( &img );
cvDestroyWindow( “Example1” );
}
// add a image and rename the img parameter from "Example 1" to whatever your image file name is :)
Hi,
ReplyDeleteI followed your guide to use opencv with eclipse on ubuntu 11.10. I have already installed opencv and i installed eclipse along with cdt plug in and installed g++. But, it does not work. I compiled the program and then run it , it gives me an error "Launched failed: binary not found" Why is this happening. I set up everything like you had mentioned in your blog. I even tried downloading Eclipse with cdt plugin from the eclipse site and running it. But it still does not work. So, please help me out. Looking forward to your positive response.
Cheers,
Jayneil.
1. Did you try building your project before running it? It should do the trick of getting C and C++ working
ReplyDelete2.If then Open CV "doesn't work" try this link. It installs the latest version of OpenCV with all the features
http://karytech.blogspot.com/2012/05/opencv-24-on-ubuntu-1204.html
Let me know how it goes ...
Hey i have installed opencv but the problem is, upon entering the command "pkg-config --libs opencv", I am getting this as the output:
ReplyDelete"/usr/local/lib/libopencv_calib3d.so /usr/local/lib/libopencv_contrib.so
/usr/local/lib/libopencv_core.so /usr/local/lib/libopencv_features2d.so /usr/local/lib/libopencv_flann.so
/usr/local/lib/libopencv_gpu.so
/usr/local/lib/libopencv_highgui.so /usr/local/lib/libopencv_imgproc.so /usr/local/lib/libopencv_legacy.so
/usr/local/lib/libopencv_ml.so
/usr/local/lib/libopencv_nonfree.so /usr/local/lib/libopencv_objdetect.so /usr/local/lib/libopencv_photo.so /usr/local/lib/libopencv_stitching.so
/usr/local/lib/libopencv_ts.so
/usr/local/lib/libopencv_video.so /usr/local/lib/libopencv_videostab.so"
What should i do? plz help
Sorry for the long delay. It should work perfectly now.
ReplyDeleteThanks a lot for sharing about Installing OpenCV.
ReplyDeletefull version software free