My operating system is Ubuntu11.04Eclipse. The information is as follows: EclipseIDEforC/C ++ linuxpolicsversion: HeliosServiceRelease2Buildid: 20110218-0911. The specific steps are as follows: 1.
My operating system is Ubuntu 11.04
Eclipse information is as follows:
Eclipse IDE for C/C ++ Linux Developers
Version: Helios Service Release 2
Build id: 20110218-0911
The procedure is as follows:
1. First download the opencv-unixinstallation package opencv-2.3.0.tar.bz2 at http://sourceforge.net/projects/opencvlibrary/
2. Install cmake
Terminal run: sudo apt-get install cmake
3. Install cmake-qt-gui, a graphical interface of cmake
Terminal run: sudo apt-get install cmake-qt-gui
4. Compile and install opencv
(1) After cmake-qt-gui is installed, run cmake-gui on the terminal to open the graphical interface of cmake.
First, extract the downloaded opencv-2.3.0.tar.bz2, for example, to the OpenCV_2_3_src folder.
Create a new folder, such as OpenCV_2_3_build, as the directory to which the cmke build resides.
In the cmake-gui window, select OpenCV_2_3_src for the Browse Source and OpenCV_2_3_build for the Browse Build.
If the window turns red, click Configure and Generate as prompted.
(2) Open the terminal, cd to the OpenCV_2_3_build directory, and run
Make
It takes a long time.
After completion
Sudo make install
After completion, openCV is installed under usr/local.
Now openCV has been installed.
5. Create an openCV project in Eclipse
1) Open Eclipse, File --> New --> C ++ project. Create a Hello World project named firstOpencv.
2) Change the content in firstOpencv. cpp to the following, for example:
- # Include "cv. h"
- # Include
- # Include
- IntMain (IntArgc,Char* Argv [])
- {
- IplImage * img = cvLoadImage ("Image.jpg");
- CvNamedWindow ("Image :", 1 );
- CvShowImage ("Image :", Img );
- CvWaitKey ();
- CvDestroyWindow ("Image :");
- CvReleaseImage (& img );
- Return0;
- }