Install cross-platform computer vision library OpenCV in CentOS 6.5

Source: Internet
Author: User

Install cross-platform computer vision library OpenCV in CentOS 6.5

Opencv is a cross-platform computer vision library that can be used for image processing. The following uses Opencv2.3.1 as an example. If you do not know how to install it, you can check it out.

Opencv is a cross-platform computer vision library that can be used for image processing. How can we install it in centos? The following describes how to install Opencv2.3.1.

I. Install dependency packages

You can install the dependency package using yum. The following installation packages are required:

Yum install cmake gcc-c ++ gtk +-devel gimp-develgimp-devel-tools gimp-help-browser zlib-devel libtiff-devel libjpeg-devellibpng-devel gstreamer-devel libavc1394-devel libraw1394-devel libdc1394-develjasper-devel jasper-utils swig python libtool nasm

Ii. Generate and install the make File

Opencv2.3.1 can be downloaded from the official website (visit http://opencv.org/at this time to visit the website of the official website). If you need it, contact me.

The procedure is as follows:

(1) cdopencv2.3.1

(2) cmake-DCMAKE_BUILD_TYPE = RELEASE-D CMAKE_INSTALL_PREFIX =/usr/local-DBUILD_NEW_PYTHON_SUPPORT = NO.

// Line44 error may be prompted here. Go to cmakelist.txt and comment out row 44th.

// Note that NO is followed by a space +.

Indicates that the cmake file is successfully generated.

(3) cmake

(4) sudo makeinstall

Iii. Configuration

Create a file/etc/ld. so. conf. d/opencv. conf

Add/usr/local/lib to the file

Save and execute the configuration

Sudoldconfig

// Because all the/etc/ld. so. conf. d/*. conf files are included in the ld. so. conf file.

Iv. environment variable configuration

Sudo vim/etc/bashrc

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

ExportPKG_CONFIG_PATH

Save and run

Source/etc/bashrc

5. Test whether the installation is successful

Cd OpenCV-2.3.1/samples/c

Chmod + xbuild_all.sh

. /Build_all.sh

After compilation, execute

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

If the installation is successful, there will be a blue circle on lena's face.

The above describes how to install OpenCV in CentOS6.5. Note that after the installation is successful, you need to configure OpenCV. This step cannot be saved.

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.