Facebooktwittergoogle_plusredditpinterestlinkedinmail

Install opencv in CentOS
Opencv can be install in CentOS in two ways:

1) Install from available yum repository.
But till the time of writing this post opencv-2.0.0 repository are available. If you need latest version of opencv then go for 2. option.
2) Opencv installation from source.

1) Install opencv from yum repo
Before installation of opencv-python from yum repository we have to install require library numpy.

$ sudo yum install python-devel python-nose python-setuptools gcc gcc-gfortran gcc-c++ blas-devel lapack-devel atlas-devel
$ sudo easy_install pip
$ sudo pip install numpy==1.6.1

If you haven’t installed opencv rpm then you can download from here and install it first . After installation of rpm now opencv will be available for installation.

$ yum install opencv

2) Installing Opencv from Source:
To install opencv from we need to install require and optional dependencies.

  • CMake : For configure the opencv installation.
  • Python-devel and Numpy : For Creating python extension.
  • GCC: For compilation.
$ yum install cmake
$ yum install python-devel numpy
$ yum install gcc gcc-c++

Install GTK To support GUI features, Camera support (libdc1394, libv4l), Media Support (ffmpeg, gstreamer) etc.

$ yum install gtk2-devel
$ yum install libdc1394-devel
$ yum install libv4l-devel
$ yum install ffmpeg-devel
$ yum install gstreamer-plugins-base-devel

Optional Dependencies:
Install below pakcages if you need latest libraries of PNG, JPEG, JPEG2000, TIFF, WebP.

$ yum install libpng-devel libjpeg-turbo-devel jasper-devel openexr-devel libtiff-devel libwebp-devel

Now we have finish the first step of opencv installation. In next step download the opencv source from git repository.

$ yum install git
$ mkdir opencv-build
$ cd opencv-build
$ git clone https://github.com/Itseez/opencv.git
$ cd opencv
$ git checkout tags/2.4.8.2

Create a new directory build to compile opencv from source.

$ mkdir build
$ cd build
$ cmake -D CMAKE_BUILD_TYPE=RELEASE -D CMAKE_INSTALL_PREFIX=/usr/local ..
$ make
$ sudo make install

Above installation will install package in /usr/local/lib . To use this we need to copy site-packages from /usr/local/lib to /usr/lib.
Move opencv module from in defult python path:

$ cp /usr/local/lib/python2.7/site-packages/cv2.so /usr/lib/python2.7/site-packages

Verify Installation:

$ python
>>> import cv2
>>> print cv2.__version__

That’s it 🙂

Install Opencv in CentOS Roopendra Linux,
Install opencv in CentOS Opencv can be install in CentOS in two ways:1) Install from available yum repository. But till the time of writing this post opencv-2.0.0 repository are available. If you need latest version of opencv then go for 2. option. 2) Opencv installation from source.1) Install opencv from yum repo Before...
<strong>Install opencv in CentOS</strong> Opencv can be install in CentOS in two ways:1) Install from available yum repository. But till the time of writing this post opencv-2.0.0 repository are available. If you need latest version of opencv then go for 2. option. 2) Opencv installation from source.<strong>1) Install opencv from yum repo</strong> Before installation of opencv-python from yum repository we have to install require library numpy. <pre>$ sudo yum install python-devel python-nose python-setuptools gcc gcc-gfortran gcc-c++ blas-devel lapack-devel atlas-devel $ sudo easy_install pip $ sudo pip install numpy==1.6.1</pre> If you haven't installed opencv rpm then you can download from <a href="http://rpmfind.net/linux/rpm2html/search.php?query=opencv&submit=Search+...&system=Centos&arch=" target="_blank">here</a> and <a href="http://techieroop.com/install-rpm-in-centos/#.VcD61PlF76A" target="_blank">install</a> it first . After installation of rpm now opencv will be available for installation. <pre>$ yum install opencv</pre> <strong>2) Installing Opencv from Source:</strong> To install opencv from we need to install require and optional dependencies. <ul> <li><strong>CMake</strong> : For configure the opencv installation.</li> <li><strong>Python-devel</strong> and <strong>Numpy</strong> : For Creating python extension.</li> <li><strong>GCC</strong>: For compilation.</li> </ul> <pre>$ yum install cmake $ yum install python-devel numpy $ yum install gcc gcc-c++</pre> Install GTK To support GUI features, Camera support (libdc1394, libv4l), Media Support (ffmpeg, gstreamer) etc. <pre>$ yum install gtk2-devel $ yum install libdc1394-devel $ yum install libv4l-devel $ yum install ffmpeg-devel $ yum install gstreamer-plugins-base-devel</pre> <strong>Optional Dependencies:</strong> Install below pakcages if you need latest libraries of<strong> PNG, JPEG, JPEG2000, TIFF, WebP</strong>. <pre>$ yum install libpng-devel libjpeg-turbo-devel jasper-devel openexr-devel libtiff-devel libwebp-devel</pre> Now we have finish the first step of opencv installation. In next step download the opencv source from git repository. <pre>$ yum install git $ mkdir opencv-build $ cd opencv-build $ git clone https://github.com/Itseez/opencv.git $ cd opencv $ git checkout tags/2.4.8.2</pre> Create a new directory build to compile opencv from source. <pre>$ mkdir build $ cd build $ cmake -D CMAKE_BUILD_TYPE=RELEASE -D CMAKE_INSTALL_PREFIX=/usr/local .. $ make $ sudo make install</pre> Above installation will install package in <strong>/usr/local/lib </strong>. To use this we need to copy site-packages from <strong>/usr/local/lib</strong> to <strong>/usr/lib.</strong> Move opencv module from in defult python path: <pre>$ cp /usr/local/lib/python2.7/site-packages/cv2.so /usr/lib/python2.7/site-packages</pre> <strong>Verify Installation:</strong> <pre>$ python >>> import cv2 >>> print cv2.__version__</pre> That's it 🙂
(Visited 16,573 times, 1,289 visits today)
Facebooktwittergoogle_pluslinkedinrss