Ubuntu12.04 install OpenCV2.4.1 and compile and Test

Source: Internet
Author: User
Compiling OpenCV applications on Ubuntu has many advantages, although it is a little troublesome to configure the environment at first. Next, configure OpenCV2.4.1 in Ubuntu12.04LTS as follows. -------------------------------------- Split line -------------------------------------- recommended reading: Under UbuntuLinux

Compiling OpenCV applications on Ubuntu has many advantages, although it is a little troublesome to configure the environment at first. Next, I will deploy OpenCV2.4.1 In the Ubuntu 12.04 LTS environment as follows.

-------------------------------------- Split line --------------------------------------

Recommended reading:

OpenCV2.4.1 package http://www.linuxidc.com/Linux/2012-08/68184.htm installed in Ubuntu Linux

Ubuntu 12.04 install OpenCV2.4.2 http://www.linuxidc.com/Linux/2012-09/70158.htm

OpenCV in CentOS cannot read video file http://www.linuxidc.com/Linux/2011-07/39295.htm

Summary of installing OpenCV 2.4.5 in Ubuntu 12.04Http://www.linuxidc.com/Linux/2013-06/86704.htm

Install OpenCv2.1 nine-step http://www.linuxidc.com/Linux/2010-09/28678.htm in Ubuntu 10.04

Http://www.linuxidc.com/Linux/2011-11/47806.htm of face recognition system based on QT and OpenCV

-------------------------------------- Split line --------------------------------------

1. for Ubuntu systems, we must first ensure that each system software is up-to-date. Just like this

Sudo apt-get update
Sudo apt-get upgrade

2. OpenCv depends on various packages and needs to be installed.

Sudo apt-get install build-essential libgtk2.0-dev libjpeg-dev libtiff4-dev libjasper-dev libopenexr-dev cmake python-dev python-numpy python-tk libtbb-dev libeigen2-dev yasm libfaac-dev libopencore -amrnb-dev libopencore-amrwb-dev libtheora-dev libvorbis-dev libxvidcore-dev libx264-dev libqt4-dev libqt4-opengl-dev sph?- common texlive-latex-extra libv4l-dev libdc1394-22-dev libavcodec-dev avlibformat-libdev swscale-dev

3. Download and decompress OpenCv.

Wget http://downloads.sourceforge.net/project/opencvlibrary/opencv-unix/2.4.1/OpenCV-2.4.1.tar.bz2
Tar-xvf OpenCV-2.4.1.tar.bz2
Cd OpenCV-2.4.1

Of course there are other methods. As shown in the following figure, you can directly unzip the file.

4. Create a new folder and compile it using cmake.

Mkdir build
Cd build
Cmake-D WITH_TBB = ON-D BUILD_NEW_PYTHON_SUPPORT = ON-D WITH_V4L = ON-D INSTALL_C_EXAMPLES = ON-D events = ON-D BUILD_EXAMPLES = ON-D WITH_QT = ON-D WITH_OPENGL = ON ..

In this way, you are ready to compile and install OpenCv.

Make
Sudo make install

5. Configure OpenCv.

Sudo gedit/etc/ld. so. conf. d/opencv. conf

Add/usr/local/lib at the end of the file and run

Sudo ldconfig

Open another file and add the lines at the end.

Sudo gedit/etc/bash. bashrc

Add content

PKG_CONFIG_PATH = $ PKG_CONFIG_PATH:/usr/local/lib/pkgconfig
Export PKG_CONFIG_PATH

For more details, refer to the highlights on the next page.: Http://www.linuxidc.com/Linux/2014-05/101221p2.htm

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.