How to install OpenCV in CentOS 6.5

  
                

Opencv is a cross-platform computer vision library that can be used for image processing. How to install CentOS6.5? The following is an example of the installation of Opencv 2.3.1, for a detailed introduction.

One: Install dependencies

Dependencies can be installed with yum, you need the following installation package:

yum install cmake gcc 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

Make file and install

Opencv2.3.1 can be downloaded from the official website (link http://opencv.org/during the period to jump to the inexplicable website), if necessary, you can contact me.

The specific steps are:

(1) cdopencv2.3.1

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

//This may prompt line44 error. Go to Cmakelist.txt and comment out line 44

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

indicates theme file successfully generated cmake

(3) cmake

(4) sudo makeinstall

Three: Configure

New file /etc/ld.so.conf.d/opencv.conf

Add /usr/local/lib

to the file and execute the configuration after saving

sudoldconfig

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

Four: Environment Variable Configuration

sudo vim/etc/bashrc

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

exportPKG_CONFIG_PATH

Execute after saving

source /etc/bashrc

V. Test whether the installation is successful

cd OpenCV-2.3.1/samples/c

chmod +xbuild_all.sh

. /build_all.sh

Execute

after compilation. /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 the face of lena< Br>

The above is the introduction of CentOS6.5 OpenCV method. It should be noted that OpenCV needs to be configured after successful installation. This step cannot be saved.

Copyright © Windows knowledge All Rights Reserved