Use Eclipse on Ubuntu to create an OpenCV Project

Source: Internet
Author: User
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:

  1. # Include "cv. h"
  2. # Include
  3. # Include
  4. IntMain (IntArgc,Char* Argv [])
  5. {
  6. IplImage * img = cvLoadImage ("Image.jpg");
  7. CvNamedWindow ("Image :", 1 );
  8. CvShowImage ("Image :", Img );
  9. CvWaitKey ();
  10. CvDestroyWindow ("Image :");
  11. CvReleaseImage (& img );
  12.  Return0;
  13. }
Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.