Linux: install and configure opencv2.1 in eclipse, and use C ++ to call the opencv process and test instances.

Source: Internet
Author: User

Installation Method: Run Yum install opencv-devel to complete the installation.

The key is to configure eclipse and let him find the library of opencv, that is, G ++ test. CPP-O test-I ......................... -l .............................,, one is the include directory and the other is the library directory.

The configuration method is as follows:

1. Create a new C ++ Project (provided that the CDT has been installed ).

2. Right-click the new project and choose C ++ build-> settings in the project properties. Here, you need to set the compiler parameters. Add/usr/include/opencv in the include paths of gcc C ++ compiler-> include;

3. Add CV, highgui, and cxcore to the gcc c ++ linker-> libraries respectively (note that only one can be added at a time. The default value is-L, you only need to fill in the CV, and the other two classes are the same), and add/usr/include/opencv in the following library search path.

In these three steps, you have completed the steps for configuring opencv in eclipse! The effect of step 3 is as follows. There are four databases in total! Be sure to add one by one

 

A test example:

# Include <iostream>
# Include "cv. H"
# Include "highgui. H"
Using namespace STD;

Int main (){
Iplimage * pimg = cvloadimage ("/home/Yan/download/zhuntifomu.jpg ");
Cvnamedwindow ("image", 1 );
Cvshowimage ("image", pimg );
Cvwaitkey (0 );
Cout <"!!! Hello world !!! "<Endl; // prints !!! Hello world !!!
Return 0;
}

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.