Install Opencv in CentOS
博客专区 > Mark93 的博客 > 博客详情
Install Opencv in CentOS
Mark93 发表于1年前
Install Opencv in CentOS
  • 发表于 1年前
  • 阅读 10
  • 收藏 0
  • 点赞 0
  • 评论 0


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
$ cd opencv
$ git checkout tags/

Create a new directory build to compile opencv from source.

$ mkdir build
$ cd build
$ 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/ /usr/lib/python2.7/site-packages

Verify Installation:

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

That’s it.

  • 打赏
  • 点赞
  • 收藏
  • 分享
共有 人打赏支持
粉丝 6
博文 96
码字总数 33965
* 金额(元)
¥1 ¥5 ¥10 ¥20 其他金额
* 支付类型