Compile and install OpenCV2.3.1 in Ubuntu

Source: Internet
Author: User
OpenCV2.3.1 compilation and installation in Ubuntu: 1. First, run the following commands on the terminal to install the necessary compiling environment. Sudoapt-getinstallbuild-essentiallibgtk2.0-devlibavcodec-devlibavformat-devlibjpeg62-devlibtiff4-devcmakelibswscale-devlibjas

How to compile and install OpenCV 2.3.1 in Ubuntu:

1. First, run the following command on the terminal to install the necessary compiling environment.
 
Sudo apt-get install build-essential libgtk2.0-dev libavcodec-dev libavformat-dev libjpeg62-dev libtiff4-dev cmake libswscale-dev libjasper-dev
 
2. Download the corresponding version to the computer, here we download OpenCV-2.3.1 as an example.
 
Run the cd command to enter the corresponding download directory. Run the following commands in sequence

Tar xf OpenCV-2.3.1.tar.bz2
Cd OpenCV-2.3.1
 
3. Terminal Operation

Mkdir build
Cd build
Cmake... here is the second point after the cmake space.
 
4. Run in sequence

Make
Sudo make install

The compilation is successful.

5. Now you need to configure the necessary libraries. Run sudo gedit/etc/ld. so. conf. d/opencv. conf.
 
Add this command to the file:/usr/local/lib. The file may be empty and will not be affected.
 
6. Run sudo ldconfig.
 
7. Run the sudo gedit/etc/bash. bashrc command to add the following two lines to the end of the file and save them.

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

8. Run the routine test.

Cd ~
Mkdir openCV_samples
Cp OpenCV-2.3.1/samples/c/* openCV_samples
Cd openCV_samples/
Chmod + x build_all.sh
./Build_all.sh

./Facedetect -- cascade = "/usr/local/share/OpenCV/haarcascades/haarcascade_frontalface_alt.xml" -- scale = 1.5 lena.jpg

Recommended reading:

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

For more information about Ubuntu, see Ubuntu special page http://www.linuxidc.com/topicnews.aspx? Tid = 2

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.