Install opencv with APT-Get on Ubuntu

Source: Internet
Author: User
0: Many tutorials for installing opencv on the Internet are installed based on the source code, which is troublesome and error-prone. You only need to enter a few commands to install opencv with APT-Get, it's much more convenient (I'm a cainiao, and I'm a hacker, haha)
1: Search for opencv-related software packages:

Apt-cache search opencv

2: install these packages (I will install them all by default)

Sudo apt-Get install xxx

3: Check the installed libraries (Libraries related to opencv)

PKG-config -- cflags -- libs opencv

4: Write a small example

# Include <cv. h> # include ProgramOptional const char * filename = "temp.png"; const char * Title = "image"; iplimage * image = cvloadimage (filename, cv_load_image_color); cvnamedwindow (title, cv_window_autosize ); cvshowimage (title, image); cvwaitkey (0); cvreleaseimage (& image); cvdestroywindow (title); Return 0 ;}

5. Compile and run

GCC test. C-o Test 'pkg-config -- cflags -- libs opencv './test

Everything is done

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.