http://blog.csdn.NET/daunxx/article/details/50506625

转载注释:有些包名和系统包名并不匹配,yum install 找不到的时候,可以yum search一下。比如gtk2-devel和gstreamer-plugins-base-devel

<code class="hljs ruby has-numbering" style="display: block; padding: 0px; background: transparent; color: inherit; box-sizing: border-box; font-family: "Source Code Pro", monospace;font-size:undefined; white-space: pre; border-radius: 0px; word-wrap: normal;"><span class="hljs-variable" style="color: rgb(102, 0, 102); box-sizing: border-box;">@time</span> <span class="hljs-symbol" style="color: rgb(0, 102, 102); box-sizing: border-box;">:</span> <span class="hljs-constant" style="box-sizing: border-box;">Jan</span> <span class="hljs-number" style="color: rgb(0, 102, 102); box-sizing: border-box;">13</span>,<span class="hljs-number" style="color: rgb(0, 102, 102); box-sizing: border-box;">2016</span> <span class="hljs-number" style="color: rgb(0, 102, 102); box-sizing: border-box;">20</span><span class="hljs-symbol" style="color: rgb(0, 102, 102); box-sizing: border-box;">:</span><span class="hljs-number" style="color: rgb(0, 102, 102); box-sizing: border-box;">29</span> <span class="hljs-variable" style="color: rgb(102, 0, 102); box-sizing: border-box;">@author</span> <span class="hljs-symbol" style="color: rgb(0, 102, 102); box-sizing: border-box;">:</span> duanxxnj<span class="hljs-variable" style="color: rgb(102, 0, 102); box-sizing: border-box;">@163</span>.com</code><ul class="pre-numbering" style="box-sizing: border-box; position: absolute; width: 50px;  top: 0px; left: 0px; margin: 0px; padding: 6px 0px 40px; border-right: 1px solid rgb(221, 221, 221); list-style: none; text-align: right;"><li style="box-sizing: border-box; padding: 0px 5px;">1</li><li style="box-sizing: border-box; padding: 0px 5px;">2</li></ul><ul class="pre-numbering" style="box-sizing: border-box; position: absolute; width: 50px;  top: 0px; left: 0px; margin: 0px; padding: 6px 0px 40px; border-right: 1px solid rgb(221, 221, 221); list-style: none; text-align: right;"><li style="box-sizing: border-box; padding: 0px 5px;">1</li><li style="box-sizing: border-box; padding: 0px 5px;">2</li></ul>
花了两天时间才把Openv3.1的Python安装完成。
中间遇到了好多奇怪的错误,在这里记录下整个安装过程。

系统环境

<code class="hljs ruby has-numbering" style="display: block; padding: 0px; background: transparent; color: inherit; box-sizing: border-box; font-family: "Source Code Pro", monospace;font-size:undefined; white-space: pre; border-radius: 0px; word-wrap: normal;">[<span class="hljs-constant" style="box-sizing: border-box;">Duanxx</span><span class="hljs-variable" style="color: rgb(102, 0, 102); box-sizing: border-box;">@CentOS</span> ~]<span class="hljs-variable" style="color: rgb(102, 0, 102); box-sizing: border-box;">$ </span>uname -a <span class="hljs-constant" style="box-sizing: border-box;">Linux</span> <span class="hljs-constant" style="box-sizing: border-box;">CentOS</span>.<span class="hljs-constant" style="box-sizing: border-box;">Duanxx</span> <span class="hljs-number" style="color: rgb(0, 102, 102); box-sizing: border-box;">3.10</span>.<span class="hljs-number" style="color: rgb(0, 102, 102); box-sizing: border-box;">0</span>-<span class="hljs-number" style="color: rgb(0, 102, 102); box-sizing: border-box;">327.3</span>.<span class="hljs-number" style="color: rgb(0, 102, 102); box-sizing: border-box;">1</span>.el7.x86_64 <span class="hljs-comment" style="color: rgb(136, 0, 0); box-sizing: border-box;">#1 SMP Wed Dec 9 14:09:15 UTC 2015 x86_64 x86_64 x86_64 GNU/Linux</span> [<span class="hljs-constant" style="box-sizing: border-box;">Duanxx</span><span class="hljs-variable" style="color: rgb(102, 0, 102); box-sizing: border-box;">@CentOS</span> ~]<span class="hljs-variable" style="color: rgb(102, 0, 102); box-sizing: border-box;">$ </span>cat /etc/centos-release <span class="hljs-constant" style="box-sizing: border-box;">CentOS</span> <span class="hljs-constant" style="box-sizing: border-box;">Linux</span> release <span class="hljs-number" style="color: rgb(0, 102, 102); box-sizing: border-box;">7.2</span>.<span class="hljs-number" style="color: rgb(0, 102, 102); box-sizing: border-box;">1511</span> (<span class="hljs-constant" style="box-sizing: border-box;">Core</span>) </code><ul class="pre-numbering" style="box-sizing: border-box; position: absolute; width: 50px;  top: 0px; left: 0px; margin: 0px; padding: 6px 0px 40px; border-right: 1px solid rgb(221, 221, 221); list-style: none; text-align: right;"><li style="box-sizing: border-box; padding: 0px 5px;">1</li><li style="box-sizing: border-box; padding: 0px 5px;">2</li><li style="box-sizing: border-box; padding: 0px 5px;">3</li><li style="box-sizing: border-box; padding: 0px 5px;">4</li></ul><ul class="pre-numbering" style="box-sizing: border-box; position: absolute; width: 50px;  top: 0px; left: 0px; margin: 0px; padding: 6px 0px 40px; border-right: 1px solid rgb(221, 221, 221); list-style: none; text-align: right;"><li style="box-sizing: border-box; padding: 0px 5px;">1</li><li style="box-sizing: border-box; padding: 0px 5px;">2</li><li style="box-sizing: border-box; padding: 0px 5px;">3</li><li style="box-sizing: border-box; padding: 0px 5px;">4</li></ul>

软件源安装

EPEL

主页 
下载EL7后面的数据源即可

<code class="hljs lasso has-numbering" style="display: block; padding: 0px; background: transparent; color: inherit; box-sizing: border-box; font-family: "Source Code Pro", monospace;font-size:undefined; white-space: pre; border-radius: 0px; word-wrap: normal;">sudo rpm <span class="hljs-attribute" style="box-sizing: border-box;">-ivh</span> epel<span class="hljs-attribute" style="box-sizing: border-box;">-release</span><span class="hljs-attribute" style="box-sizing: border-box;">-latest</span><span class="hljs-subst" style="color: rgb(0, 0, 0); box-sizing: border-box;">-</span><span class="hljs-number" style="color: rgb(0, 102, 102); box-sizing: border-box;">7.</span>noarch<span class="hljs-built_in" style="color: rgb(102, 0, 102); box-sizing: border-box;">.</span>rpm</code><ul class="pre-numbering" style="box-sizing: border-box; position: absolute; width: 50px;  top: 0px; left: 0px; margin: 0px; padding: 6px 0px 40px; border-right: 1px solid rgb(221, 221, 221); list-style: none; text-align: right;"><li style="box-sizing: border-box; padding: 0px 5px;">1</li></ul><ul class="pre-numbering" style="box-sizing: border-box; position: absolute; width: 50px;  top: 0px; left: 0px; margin: 0px; padding: 6px 0px 40px; border-right: 1px solid rgb(221, 221, 221); list-style: none; text-align: right;"><li style="box-sizing: border-box; padding: 0px 5px;">1</li></ul>

nux-dextop

主页 
下载el7的数据源

<code class="hljs avrasm has-numbering" style="display: block; padding: 0px; background: transparent; color: inherit; box-sizing: border-box; font-family: "Source Code Pro", monospace;font-size:undefined; white-space: pre; border-radius: 0px; word-wrap: normal;">sudo rpm -ivh nux-dextop-release-<span class="hljs-number" style="color: rgb(0, 102, 102); box-sizing: border-box;">0</span>-<span class="hljs-number" style="color: rgb(0, 102, 102); box-sizing: border-box;">5.</span>el7<span class="hljs-preprocessor" style="color: rgb(68, 68, 68); box-sizing: border-box;">.nux</span><span class="hljs-preprocessor" style="color: rgb(68, 68, 68); box-sizing: border-box;">.noarch</span><span class="hljs-preprocessor" style="color: rgb(68, 68, 68); box-sizing: border-box;">.rpm</span></code><ul class="pre-numbering" style="box-sizing: border-box; position: absolute; width: 50px;  top: 0px; left: 0px; margin: 0px; padding: 6px 0px 40px; border-right: 1px solid rgb(221, 221, 221); list-style: none; text-align: right;"><li style="box-sizing: border-box; padding: 0px 5px;">1</li></ul><ul class="pre-numbering" style="box-sizing: border-box; position: absolute; width: 50px;  top: 0px; left: 0px; margin: 0px; padding: 6px 0px 40px; border-right: 1px solid rgb(221, 221, 221); list-style: none; text-align: right;"><li style="box-sizing: border-box; padding: 0px 5px;">1</li></ul>

ELRepo

主页

<code class="hljs avrasm has-numbering" style="display: block; padding: 0px; background: transparent; color: inherit; box-sizing: border-box; font-family: "Source Code Pro", monospace;font-size:undefined; white-space: pre; border-radius: 0px; word-wrap: normal;">rpm --import https://www<span class="hljs-preprocessor" style="color: rgb(68, 68, 68); box-sizing: border-box;">.elrepo</span><span class="hljs-preprocessor" style="color: rgb(68, 68, 68); box-sizing: border-box;">.org</span>/RPM-GPG-KEY-elrepo<span class="hljs-preprocessor" style="color: rgb(68, 68, 68); box-sizing: border-box;">.org</span> rpm -Uvh http://www<span class="hljs-preprocessor" style="color: rgb(68, 68, 68); box-sizing: border-box;">.elrepo</span><span class="hljs-preprocessor" style="color: rgb(68, 68, 68); box-sizing: border-box;">.org</span>/elrepo-release-<span class="hljs-number" style="color: rgb(0, 102, 102); box-sizing: border-box;">7.0</span>-<span class="hljs-number" style="color: rgb(0, 102, 102); box-sizing: border-box;">2.</span>el7<span class="hljs-preprocessor" style="color: rgb(68, 68, 68); box-sizing: border-box;">.elrepo</span><span class="hljs-preprocessor" style="color: rgb(68, 68, 68); box-sizing: border-box;">.noarch</span><span class="hljs-preprocessor" style="color: rgb(68, 68, 68); box-sizing: border-box;">.rpm</span></code><ul class="pre-numbering" style="box-sizing: border-box; position: absolute; width: 50px;  top: 0px; left: 0px; margin: 0px; padding: 6px 0px 40px; border-right: 1px solid rgb(221, 221, 221); list-style: none; text-align: right;"><li style="box-sizing: border-box; padding: 0px 5px;">1</li><li style="box-sizing: border-box; padding: 0px 5px;">2</li></ul><ul class="pre-numbering" style="box-sizing: border-box; position: absolute; width: 50px;  top: 0px; left: 0px; margin: 0px; padding: 6px 0px 40px; border-right: 1px solid rgb(221, 221, 221); list-style: none; text-align: right;"><li style="box-sizing: border-box; padding: 0px 5px;">1</li><li style="box-sizing: border-box; padding: 0px 5px;">2</li></ul>

基本准备

<code class="hljs bash has-numbering" style="display: block; padding: 0px; background: transparent; color: inherit; box-sizing: border-box; font-family: "Source Code Pro", monospace;font-size:undefined; white-space: pre; border-radius: 0px; word-wrap: normal;"><span class="hljs-built_in" style="color: rgb(102, 0, 102); box-sizing: border-box;">sudo</span> yum update</code><ul class="pre-numbering" style="box-sizing: border-box; position: absolute; width: 50px;  top: 0px; left: 0px; margin: 0px; padding: 6px 0px 40px; border-right: 1px solid rgb(221, 221, 221); list-style: none; text-align: right;"><li style="box-sizing: border-box; padding: 0px 5px;">1</li></ul><ul class="pre-numbering" style="box-sizing: border-box; position: absolute; width: 50px;  top: 0px; left: 0px; margin: 0px; padding: 6px 0px 40px; border-right: 1px solid rgb(221, 221, 221); list-style: none; text-align: right;"><li style="box-sizing: border-box; padding: 0px 5px;">1</li></ul>
<code class="hljs lasso has-numbering" style="display: block; padding: 0px; background: transparent; color: inherit; box-sizing: border-box; font-family: "Source Code Pro", monospace;font-size:undefined; white-space: pre; border-radius: 0px; word-wrap: normal;">sudo yum install autoconf automake cmake freetype<span class="hljs-attribute" style="box-sizing: border-box;">-devel</span> gcc gcc<span class="hljs-attribute" style="box-sizing: border-box;">-c</span><span class="hljs-subst" style="color: rgb(0, 0, 0); box-sizing: border-box;">++</span> git libtool make mercurial nasm pkgconfig zlib<span class="hljs-attribute" style="box-sizing: border-box;">-devel</span></code><ul class="pre-numbering" style="box-sizing: border-box; position: absolute; width: 50px;  top: 0px; left: 0px; margin: 0px; padding: 6px 0px 40px; border-right: 1px solid rgb(221, 221, 221); list-style: none; text-align: right;"><li style="box-sizing: border-box; padding: 0px 5px;">1</li></ul><ul class="pre-numbering" style="box-sizing: border-box; position: absolute; width: 50px;  top: 0px; left: 0px; margin: 0px; padding: 6px 0px 40px; border-right: 1px solid rgb(221, 221, 221); list-style: none; text-align: right;"><li style="box-sizing: border-box; padding: 0px 5px;">1</li></ul>

安装cmake-gui

这里需要特别说明一下,这个是一定要安装的,等会编译的时候需要使用到它
<code class="hljs bash has-numbering" style="display: block; padding: 0px; background: transparent; color: inherit; box-sizing: border-box; font-family: "Source Code Pro", monospace;font-size:undefined; white-space: pre; border-radius: 0px; word-wrap: normal;"><span class="hljs-built_in" style="color: rgb(102, 0, 102); box-sizing: border-box;">sudo</span> yum install cmake-gui</code><ul class="pre-numbering" style="box-sizing: border-box; position: absolute; width: 50px;  top: 0px; left: 0px; margin: 0px; padding: 6px 0px 40px; border-right: 1px solid rgb(221, 221, 221); list-style: none; text-align: right;"><li style="box-sizing: border-box; padding: 0px 5px;">1</li></ul><ul class="pre-numbering" style="box-sizing: border-box; position: absolute; width: 50px;  top: 0px; left: 0px; margin: 0px; padding: 6px 0px 40px; border-right: 1px solid rgb(221, 221, 221); list-style: none; text-align: right;"><li style="box-sizing: border-box; padding: 0px 5px;">1</li></ul>

为了支持GUI特征

<code class="hljs bash has-numbering" style="display: block; padding: 0px; background: transparent; color: inherit; box-sizing: border-box; font-family: "Source Code Pro", monospace;font-size:undefined; white-space: pre; border-radius: 0px; word-wrap: normal;"><span class="hljs-built_in" style="color: rgb(102, 0, 102); box-sizing: border-box;">sudo</span> yum install gtk2-devel</code><ul class="pre-numbering" style="box-sizing: border-box; position: absolute; width: 50px;  top: 0px; left: 0px; margin: 0px; padding: 6px 0px 40px; border-right: 1px solid rgb(221, 221, 221); list-style: none; text-align: right;"><li style="box-sizing: border-box; padding: 0px 5px;">1</li></ul><ul class="pre-numbering" style="box-sizing: border-box; position: absolute; width: 50px;  top: 0px; left: 0px; margin: 0px; padding: 6px 0px 40px; border-right: 1px solid rgb(221, 221, 221); list-style: none; text-align: right;"><li style="box-sizing: border-box; padding: 0px 5px;">1</li></ul>

为了支持摄像头

<code class="hljs bash has-numbering" style="display: block; padding: 0px; background: transparent; color: inherit; box-sizing: border-box; font-family: "Source Code Pro", monospace;font-size:undefined; white-space: pre; border-radius: 0px; word-wrap: normal;"><span class="hljs-built_in" style="color: rgb(102, 0, 102); box-sizing: border-box;">sudo</span> yum install libdc1394-devel <span class="hljs-built_in" style="color: rgb(102, 0, 102); box-sizing: border-box;">sudo</span> yum install libv4l-devel</code><ul class="pre-numbering" style="box-sizing: border-box; position: absolute; width: 50px;  top: 0px; left: 0px; margin: 0px; padding: 6px 0px 40px; border-right: 1px solid rgb(221, 221, 221); list-style: none; text-align: right;"><li style="box-sizing: border-box; padding: 0px 5px;">1</li><li style="box-sizing: border-box; padding: 0px 5px;">2</li></ul><ul class="pre-numbering" style="box-sizing: border-box; position: absolute; width: 50px;  top: 0px; left: 0px; margin: 0px; padding: 6px 0px 40px; border-right: 1px solid rgb(221, 221, 221); list-style: none; text-align: right;"><li style="box-sizing: border-box; padding: 0px 5px;">1</li><li style="box-sizing: border-box; padding: 0px 5px;">2</li></ul>

为了支持视频媒体

<code class="hljs lasso has-numbering" style="display: block; padding: 0px; background: transparent; color: inherit; box-sizing: border-box; font-family: "Source Code Pro", monospace;font-size:undefined; white-space: pre; border-radius: 0px; word-wrap: normal;">sudo yum install ffmpeg<span class="hljs-attribute" style="box-sizing: border-box;">-devel</span> sudo yum install gstreamer<span class="hljs-attribute" style="box-sizing: border-box;">-plugins</span><span class="hljs-attribute" style="box-sizing: border-box;">-base</span><span class="hljs-attribute" style="box-sizing: border-box;">-devel</span></code><ul class="pre-numbering" style="box-sizing: border-box; position: absolute; width: 50px;  top: 0px; left: 0px; margin: 0px; padding: 6px 0px 40px; border-right: 1px solid rgb(221, 221, 221); list-style: none; text-align: right;"><li style="box-sizing: border-box; padding: 0px 5px;">1</li><li style="box-sizing: border-box; padding: 0px 5px;">2</li></ul><ul class="pre-numbering" style="box-sizing: border-box; position: absolute; width: 50px;  top: 0px; left: 0px; margin: 0px; padding: 6px 0px 40px; border-right: 1px solid rgb(221, 221, 221); list-style: none; text-align: right;"><li style="box-sizing: border-box; padding: 0px 5px;">1</li><li style="box-sizing: border-box; padding: 0px 5px;">2</li></ul>

这里需要说明,ffmpeg其实最好是手动安装 
这里给出手动安装教程连接手动安装教程连接

顺便说一句,很多人都在抱怨Centos上无法看视频的问题。 
其实就是没有解码器。 
个人建议使用vlc这个开源的视频解码器。

<code class="hljs bash has-numbering" style="display: block; padding: 0px; background: transparent; color: inherit; box-sizing: border-box; font-family: "Source Code Pro", monospace;font-size:undefined; white-space: pre; border-radius: 0px; word-wrap: normal;"><span class="hljs-built_in" style="color: rgb(102, 0, 102); box-sizing: border-box;">sudo</span> yum install vlc</code><ul class="pre-numbering" style="box-sizing: border-box; position: absolute; width: 50px;  top: 0px; left: 0px; margin: 0px; padding: 6px 0px 40px; border-right: 1px solid rgb(221, 221, 221); list-style: none; text-align: right;"><li style="box-sizing: border-box; padding: 0px 5px;">1</li></ul><ul class="pre-numbering" style="box-sizing: border-box; position: absolute; width: 50px;  top: 0px; left: 0px; margin: 0px; padding: 6px 0px 40px; border-right: 1px solid rgb(221, 221, 221); list-style: none; text-align: right;"><li style="box-sizing: border-box; padding: 0px 5px;">1</li></ul>

需要播放视频的时候,使用下面的命令即可

<code class="hljs avrasm has-numbering" style="display: block; padding: 0px; background: transparent; color: inherit; box-sizing: border-box; font-family: "Source Code Pro", monospace;font-size:undefined; white-space: pre; border-radius: 0px; word-wrap: normal;">vlc name<span class="hljs-preprocessor" style="color: rgb(68, 68, 68); box-sizing: border-box;">.mp</span>4</code><ul class="pre-numbering" style="box-sizing: border-box; position: absolute; width: 50px;  top: 0px; left: 0px; margin: 0px; padding: 6px 0px 40px; border-right: 1px solid rgb(221, 221, 221); list-style: none; text-align: right;"><li style="box-sizing: border-box; padding: 0px 5px;">1</li></ul><ul class="pre-numbering" style="box-sizing: border-box; position: absolute; width: 50px;  top: 0px; left: 0px; margin: 0px; padding: 6px 0px 40px; border-right: 1px solid rgb(221, 221, 221); list-style: none; text-align: right;"><li style="box-sizing: border-box; padding: 0px 5px;">1</li></ul>

关于python

我的Python版本是当前最新2.7.11,集成在Anaconda中。 
个人感觉这个很好用,建议大家安装使用

因为Centos是自带pyhton的,所以需要将Anaconda的Python添加环境变量。

<code class="hljs avrasm has-numbering" style="display: block; padding: 0px; background: transparent; color: inherit; box-sizing: border-box; font-family: "Source Code Pro", monospace;font-size:undefined; white-space: pre; border-radius: 0px; word-wrap: normal;">vim ~/<span class="hljs-preprocessor" style="color: rgb(68, 68, 68); box-sizing: border-box;">.bashrc</span></code><ul class="pre-numbering" style="box-sizing: border-box; position: absolute; width: 50px;  top: 0px; left: 0px; margin: 0px; padding: 6px 0px 40px; border-right: 1px solid rgb(221, 221, 221); list-style: none; text-align: right;"><li style="box-sizing: border-box; padding: 0px 5px;">1</li></ul><ul class="pre-numbering" style="box-sizing: border-box; position: absolute; width: 50px;  top: 0px; left: 0px; margin: 0px; padding: 6px 0px 40px; border-right: 1px solid rgb(221, 221, 221); list-style: none; text-align: right;"><li style="box-sizing: border-box; padding: 0px 5px;">1</li></ul>

在文件最后面添加:

<code class="hljs bash has-numbering" style="display: block; padding: 0px; background: transparent; color: inherit; box-sizing: border-box; font-family: "Source Code Pro", monospace;font-size:undefined; white-space: pre; border-radius: 0px; word-wrap: normal;">PATH=<span class="hljs-string" style="color: rgb(0, 136, 0); box-sizing: border-box;">"/usr/local/anaconda2/bin:<span class="hljs-variable" style="color: rgb(102, 0, 102); box-sizing: border-box;">$PATH</span>"</span> <span class="hljs-keyword" style="color: rgb(0, 0, 136); box-sizing: border-box;">export</span> PATH</code><ul class="pre-numbering" style="box-sizing: border-box; position: absolute; width: 50px;  top: 0px; left: 0px; margin: 0px; padding: 6px 0px 40px; border-right: 1px solid rgb(221, 221, 221); list-style: none; text-align: right;"><li style="box-sizing: border-box; padding: 0px 5px;">1</li><li style="box-sizing: border-box; padding: 0px 5px;">2</li></ul><ul class="pre-numbering" style="box-sizing: border-box; position: absolute; width: 50px;  top: 0px; left: 0px; margin: 0px; padding: 6px 0px 40px; border-right: 1px solid rgb(221, 221, 221); list-style: none; text-align: right;"><li style="box-sizing: border-box; padding: 0px 5px;">1</li><li style="box-sizing: border-box; padding: 0px 5px;">2</li></ul>

这样在使用python的时候用的就是Anaconda的python了。

ipp_icv下载

下载地址

这个东西是一个并行计算库,在编译的时候如果没有这货,就会编译不通过。 
虽然可以直接在命令中忽略这个,但个人建议还是用上比较好

可选的依赖项

上面的那些依赖如果安装完成后,就已经具备了安装Opencv的基本依赖了。
根据个人需要,可能还需要安装一些其他的依赖,下面给出一些可选的依赖项。

图形文件解码库更新

opencv自带了一些png/jpg等图片的解码器,但可能有一些老了。
可以使用一些比较新的图片解码库:
<code class="hljs lasso has-numbering" style="display: block; padding: 0px; background: transparent; color: inherit; box-sizing: border-box; font-family: "Source Code Pro", monospace;font-size:undefined; white-space: pre; border-radius: 0px; word-wrap: normal;">sudo yum install libpng<span class="hljs-attribute" style="box-sizing: border-box;">-devel</span> sudo yum install libjpeg<span class="hljs-attribute" style="box-sizing: border-box;">-turbo</span><span class="hljs-attribute" style="box-sizing: border-box;">-devel</span> sudo yum install jasper<span class="hljs-attribute" style="box-sizing: border-box;">-devel</span> sudo yum install openexr<span class="hljs-attribute" style="box-sizing: border-box;">-devel</span> sudo yum install libtiff<span class="hljs-attribute" style="box-sizing: border-box;">-devel</span> sudo yum install libwebp<span class="hljs-attribute" style="box-sizing: border-box;">-devel</span></code><ul class="pre-numbering" style="box-sizing: border-box; position: absolute; width: 50px;  top: 0px; left: 0px; margin: 0px; padding: 6px 0px 40px; border-right: 1px solid rgb(221, 221, 221); list-style: none; text-align: right;"><li style="box-sizing: border-box; padding: 0px 5px;">1</li><li style="box-sizing: border-box; padding: 0px 5px;">2</li><li style="box-sizing: border-box; padding: 0px 5px;">3</li><li style="box-sizing: border-box; padding: 0px 5px;">4</li><li style="box-sizing: border-box; padding: 0px 5px;">5</li><li style="box-sizing: border-box; padding: 0px 5px;">6</li></ul><ul class="pre-numbering" style="box-sizing: border-box; position: absolute; width: 50px;  top: 0px; left: 0px; margin: 0px; padding: 6px 0px 40px; border-right: 1px solid rgb(221, 221, 221); list-style: none; text-align: right;"><li style="box-sizing: border-box; padding: 0px 5px;">1</li><li style="box-sizing: border-box; padding: 0px 5px;">2</li><li style="box-sizing: border-box; padding: 0px 5px;">3</li><li style="box-sizing: border-box; padding: 0px 5px;">4</li><li style="box-sizing: border-box; padding: 0px 5px;">5</li><li style="box-sizing: border-box; padding: 0px 5px;">6</li></ul>

线程构建模块

Intel’s Threading Building Blocks (TBB),是Intel公司开发的并行编程开发的工具。 
想要使用这个的话,在Cmake的时候,需要使用参数 -D WITH_TBB=ON

<code class="hljs bash has-numbering" style="display: block; padding: 0px; background: transparent; color: inherit; box-sizing: border-box; font-family: "Source Code Pro", monospace;font-size:undefined; white-space: pre; border-radius: 0px; word-wrap: normal;"><span class="hljs-built_in" style="color: rgb(102, 0, 102); box-sizing: border-box;">sudo</span> yum install tbb-devel</code><ul class="pre-numbering" style="box-sizing: border-box; position: absolute; width: 50px;  top: 0px; left: 0px; margin: 0px; padding: 6px 0px 40px; border-right: 1px solid rgb(221, 221, 221); list-style: none; text-align: right;"><li style="box-sizing: border-box; padding: 0px 5px;">1</li></ul><ul class="pre-numbering" style="box-sizing: border-box; position: absolute; width: 50px;  top: 0px; left: 0px; margin: 0px; padding: 6px 0px 40px; border-right: 1px solid rgb(221, 221, 221); list-style: none; text-align: right;"><li style="box-sizing: border-box; padding: 0px 5px;">1</li></ul>

矩阵计算

Eigen是一个开源的C++矩阵计算工具 
想要使用这个的花,在Cmake的时候,需要使用参数 -D WITH_EIGEN=ON 
当然最好的安装方式是从源码安装,这里直接用yum安装了

<code class="hljs bash has-numbering" style="display: block; padding: 0px; background: transparent; color: inherit; box-sizing: border-box; font-family: "Source Code Pro", monospace;font-size:undefined; white-space: pre; border-radius: 0px; word-wrap: normal;"><span class="hljs-built_in" style="color: rgb(102, 0, 102); box-sizing: border-box;">sudo</span> yum install eigen3-devel</code><ul class="pre-numbering" style="box-sizing: border-box; position: absolute; width: 50px;  top: 0px; left: 0px; margin: 0px; padding: 6px 0px 40px; border-right: 1px solid rgb(221, 221, 221); list-style: none; text-align: right;"><li style="box-sizing: border-box; padding: 0px 5px;">1</li></ul><ul class="pre-numbering" style="box-sizing: border-box; position: absolute; width: 50px;  top: 0px; left: 0px; margin: 0px; padding: 6px 0px 40px; border-right: 1px solid rgb(221, 221, 221); list-style: none; text-align: right;"><li style="box-sizing: border-box; padding: 0px 5px;">1</li></ul>

cuda安装

cuda是NVIDIA推出的通用并行计算架构,该架构使GPU能够解决复杂的计算问题。 
使用C语言来为CUDA™架构编写程序。

我的笔记本上只有Centos系统,并不是使用的虚拟机。 
如果是你使用的是虚拟机,就可以直接跳过这个了。

<code class="hljs avrasm has-numbering" style="display: block; padding: 0px; background: transparent; color: inherit; box-sizing: border-box; font-family: "Source Code Pro", monospace;font-size:undefined; white-space: pre; border-radius: 0px; word-wrap: normal;">sudo rpm -ivh http://ftp-srv2<span class="hljs-preprocessor" style="color: rgb(68, 68, 68); box-sizing: border-box;">.kddilabs</span><span class="hljs-preprocessor" style="color: rgb(68, 68, 68); box-sizing: border-box;">.jp</span>/Linux/packages/fedora/epel/<span class="hljs-number" style="color: rgb(0, 102, 102); box-sizing: border-box;">7</span>/x86_64/e/epel-release-<span class="hljs-number" style="color: rgb(0, 102, 102); box-sizing: border-box;">7</span>-<span class="hljs-number" style="color: rgb(0, 102, 102); box-sizing: border-box;">5.</span>noarch<span class="hljs-preprocessor" style="color: rgb(68, 68, 68); box-sizing: border-box;">.rpm</span> wget http://developer<span class="hljs-preprocessor" style="color: rgb(68, 68, 68); box-sizing: border-box;">.download</span><span class="hljs-preprocessor" style="color: rgb(68, 68, 68); box-sizing: border-box;">.nvidia</span><span class="hljs-preprocessor" style="color: rgb(68, 68, 68); box-sizing: border-box;">.com</span>/compute/cuda/<span class="hljs-number" style="color: rgb(0, 102, 102); box-sizing: border-box;">7</span>_0/Prod/local_installers/rpmdeb/cuda-repo-rhel7-<span class="hljs-number" style="color: rgb(0, 102, 102); box-sizing: border-box;">7</span>-<span class="hljs-number" style="color: rgb(0, 102, 102); box-sizing: border-box;">0</span>-local-<span class="hljs-number" style="color: rgb(0, 102, 102); box-sizing: border-box;">7.0</span>-<span class="hljs-number" style="color: rgb(0, 102, 102); box-sizing: border-box;">28.</span>x86_64<span class="hljs-preprocessor" style="color: rgb(68, 68, 68); box-sizing: border-box;">.rpm</span> sudo rpm -ivh cuda-repo-rhel7-<span class="hljs-number" style="color: rgb(0, 102, 102); box-sizing: border-box;">7</span>-<span class="hljs-number" style="color: rgb(0, 102, 102); box-sizing: border-box;">0</span>-local-<span class="hljs-number" style="color: rgb(0, 102, 102); box-sizing: border-box;">7.0</span>-<span class="hljs-number" style="color: rgb(0, 102, 102); box-sizing: border-box;">28.</span>x86_64<span class="hljs-preprocessor" style="color: rgb(68, 68, 68); box-sizing: border-box;">.rpm</span> sudo yum install cuda</code><ul class="pre-numbering" style="box-sizing: border-box; position: absolute; width: 50px;  top: 0px; left: 0px; margin: 0px; padding: 6px 0px 40px; border-right: 1px solid rgb(221, 221, 221); list-style: none; text-align: right;"><li style="box-sizing: border-box; padding: 0px 5px;">1</li><li style="box-sizing: border-box; padding: 0px 5px;">2</li><li style="box-sizing: border-box; padding: 0px 5px;">3</li><li style="box-sizing: border-box; padding: 0px 5px;">4</li></ul><ul class="pre-numbering" style="box-sizing: border-box; position: absolute; width: 50px;  top: 0px; left: 0px; margin: 0px; padding: 6px 0px 40px; border-right: 1px solid rgb(221, 221, 221); list-style: none; text-align: right;"><li style="box-sizing: border-box; padding: 0px 5px;">1</li><li style="box-sizing: border-box; padding: 0px 5px;">2</li><li style="box-sizing: border-box; padding: 0px 5px;">3</li><li style="box-sizing: border-box; padding: 0px 5px;">4</li></ul>

Contrib modules

在opencv2.4中,opencv_contrib模块已经集成在了其中。
但是对于opencv3.1而言,由于这个模块中的代码相对不太稳定
它并没有集成在opencv3.1中。[下载连接](https://github.com/Itseez/opencv_contrib)
强烈建议安装opencv的时候也安装这个。
当然,现在可以不用安装,毕竟东西太多就会繁琐。
它的安装方式在github上有详细的说明。
如果想要安装,可直接参考,这里不做过多说明。

Opencv3.1编译安装

下载Opencv3.1

源码连接

<code class="hljs bash has-numbering" style="display: block; padding: 0px; background: transparent; color: inherit; box-sizing: border-box; font-family: "Source Code Pro", monospace;font-size:undefined; white-space: pre; border-radius: 0px; word-wrap: normal;">unzip opencv-<span class="hljs-number" style="color: rgb(0, 102, 102); box-sizing: border-box;">3.1</span>.<span class="hljs-number" style="color: rgb(0, 102, 102); box-sizing: border-box;">0</span>.zip <span class="hljs-built_in" style="color: rgb(102, 0, 102); box-sizing: border-box;">cd</span> opencv-<span class="hljs-number" style="color: rgb(0, 102, 102); box-sizing: border-box;">3.1</span>.<span class="hljs-number" style="color: rgb(0, 102, 102); box-sizing: border-box;">0</span> mkdir build <span class="hljs-built_in" style="color: rgb(102, 0, 102); box-sizing: border-box;">cd</span> build</code><ul class="pre-numbering" style="box-sizing: border-box; position: absolute; width: 50px;  top: 0px; left: 0px; margin: 0px; padding: 6px 0px 40px; border-right: 1px solid rgb(221, 221, 221); list-style: none; text-align: right;"><li style="box-sizing: border-box; padding: 0px 5px;">1</li><li style="box-sizing: border-box; padding: 0px 5px;">2</li><li style="box-sizing: border-box; padding: 0px 5px;">3</li><li style="box-sizing: border-box; padding: 0px 5px;">4</li></ul><ul class="pre-numbering" style="box-sizing: border-box; position: absolute; width: 50px;  top: 0px; left: 0px; margin: 0px; padding: 6px 0px 40px; border-right: 1px solid rgb(221, 221, 221); list-style: none; text-align: right;"><li style="box-sizing: border-box; padding: 0px 5px;">1</li><li style="box-sizing: border-box; padding: 0px 5px;">2</li><li style="box-sizing: border-box; padding: 0px 5px;">3</li><li style="box-sizing: border-box; padding: 0px 5px;">4</li></ul>

先Cmake一次

<code class="hljs lasso has-numbering" style="display: block; padding: 0px; background: transparent; color: inherit; box-sizing: border-box; font-family: "Source Code Pro", monospace;font-size:undefined; white-space: pre; border-radius: 0px; word-wrap: normal;">cmake <span class="hljs-attribute" style="box-sizing: border-box;">-D</span> CMAKE_BUILD_TYPE<span class="hljs-subst" style="color: rgb(0, 0, 0); box-sizing: border-box;">=</span>RELEASE <span class="hljs-attribute" style="box-sizing: border-box;">-D</span> CMAKE_INSTALL_PREFIX<span class="hljs-subst" style="color: rgb(0, 0, 0); box-sizing: border-box;">=</span>/usr/<span class="hljs-built_in" style="color: rgb(102, 0, 102); box-sizing: border-box;">local</span> <span class="hljs-built_in" style="color: rgb(102, 0, 102); box-sizing: border-box;">..</span></code><ul class="pre-numbering" style="box-sizing: border-box; position: absolute; width: 50px;  top: 0px; left: 0px; margin: 0px; padding: 6px 0px 40px; border-right: 1px solid rgb(221, 221, 221); list-style: none; text-align: right;"><li style="box-sizing: border-box; padding: 0px 5px;">1</li></ul><ul class="pre-numbering" style="box-sizing: border-box; position: absolute; width: 50px;  top: 0px; left: 0px; margin: 0px; padding: 6px 0px 40px; border-right: 1px solid rgb(221, 221, 221); list-style: none; text-align: right;"><li style="box-sizing: border-box; padding: 0px 5px;">1</li></ul>

此时会发现Cmake停在了下面这个位置,直接用Ctrl+C停掉当前的Cmake

<code class="hljs haml has-numbering" style="display: block; padding: 0px; background: transparent; color: inherit; box-sizing: border-box; font-family: "Source Code Pro", monospace;font-size:undefined; white-space: pre; border-radius: 0px; word-wrap: normal;">-<span class="ruby" style="box-sizing: border-box;">- checking <span class="hljs-keyword" style="color: rgb(0, 0, 136); box-sizing: border-box;">for</span> <span class="hljs-class" style="box-sizing: border-box;"><span class="hljs-keyword" style="color: rgb(0, 0, 136); box-sizing: border-box;">module</span> '<span class="hljs-title" style="box-sizing: border-box; color: rgb(102, 0, 102);">libgphoto2</span>'</span> </span>-<span class="ruby" style="box-sizing: border-box;">- package <span class="hljs-string" style="color: rgb(0, 136, 0); box-sizing: border-box;">'libgphoto2'</span> <span class="hljs-keyword" style="color: rgb(0, 0, 136); box-sizing: border-box;">not</span> found </span>-<span class="ruby" style="box-sizing: border-box;">- <span class="hljs-constant" style="box-sizing: border-box;">ICV</span><span class="hljs-symbol" style="color: rgb(0, 102, 102); box-sizing: border-box;">:</span> <span class="hljs-constant" style="box-sizing: border-box;">Downloading</span> ippicv_linux_20151201.tgz...</span></code><ul class="pre-numbering" style="box-sizing: border-box; position: absolute; width: 50px;  top: 0px; left: 0px; margin: 0px; padding: 6px 0px 40px; border-right: 1px solid rgb(221, 221, 221); list-style: none; text-align: right;"><li style="box-sizing: border-box; padding: 0px 5px;">1</li><li style="box-sizing: border-box; padding: 0px 5px;">2</li><li style="box-sizing: border-box; padding: 0px 5px;">3</li></ul><ul class="pre-numbering" style="box-sizing: border-box; position: absolute; width: 50px;  top: 0px; left: 0px; margin: 0px; padding: 6px 0px 40px; border-right: 1px solid rgb(221, 221, 221); list-style: none; text-align: right;"><li style="box-sizing: border-box; padding: 0px 5px;">1</li><li style="box-sizing: border-box; padding: 0px 5px;">2</li><li style="box-sizing: border-box; padding: 0px 5px;">3</li></ul>

进入下面这个文件夹,会发现ippicv_linux_20151201.tgz文件

<code class="hljs has-numbering" style="display: block; padding: 0px; background: transparent; color: inherit; box-sizing: border-box; font-family: "Source Code Pro", monospace;font-size:undefined; white-space: pre; border-radius: 0px; word-wrap: normal;">opencv-3.1.0/3rdparty/ippicv/downloads/linux-808b791a6eac9ed78d32a7666804320e</code><ul class="pre-numbering" style="box-sizing: border-box; position: absolute; width: 50px;  top: 0px; left: 0px; margin: 0px; padding: 6px 0px 40px; border-right: 1px solid rgb(221, 221, 221); list-style: none; text-align: right;"><li style="box-sizing: border-box; padding: 0px 5px;">1</li></ul><ul class="pre-numbering" style="box-sizing: border-box; position: absolute; width: 50px;  top: 0px; left: 0px; margin: 0px; padding: 6px 0px 40px; border-right: 1px solid rgb(221, 221, 221); list-style: none; text-align: right;"><li style="box-sizing: border-box; padding: 0px 5px;">1</li></ul>

用 rm ippicv_linux_20151201.tgz,删除这个文件。 
然后将上面ipp_icv下载中下载的文件放在这个文件夹下。

重新使用上面的命令Cmake一次。这一此Cmake可以通过,并且也可以作make擦作。 
但是,在Cmake提供的logout中可以看到下面这条信息:

<code class="hljs d has-numbering" style="display: block; padding: 0px; background: transparent; color: inherit; box-sizing: border-box; font-family: "Source Code Pro", monospace;font-size:undefined; white-space: pre; border-radius: 0px; word-wrap: normal;">-- Found PythonInterp: /usr/local/anaconda2/bin/python2.7 (found suitable <span class="hljs-keyword" style="color: rgb(0, 0, 136); box-sizing: border-box;">version</span> <span class="hljs-string" style="color: rgb(0, 136, 0); box-sizing: border-box;">"2.7.11"</span>, minimum required <span class="hljs-keyword" style="color: rgb(0, 0, 136); box-sizing: border-box;">is</span> <span class="hljs-string" style="color: rgb(0, 136, 0); box-sizing: border-box;">"2.7"</span>) -- Could NOT find PythonLibs: Found unsuitable <span class="hljs-keyword" style="color: rgb(0, 0, 136); box-sizing: border-box;">version</span> <span class="hljs-string" style="color: rgb(0, 136, 0); box-sizing: border-box;">"2.7.5"</span>, but required <span class="hljs-keyword" style="color: rgb(0, 0, 136); box-sizing: border-box;">is</span> exact <span class="hljs-keyword" style="color: rgb(0, 0, 136); box-sizing: border-box;">version</span> <span class="hljs-string" style="color: rgb(0, 136, 0); box-sizing: border-box;">"2.7.11"</span> (found /lib64/libpython2.7.so) -- Could NOT find PythonInterp: Found unsuitable <span class="hljs-keyword" style="color: rgb(0, 0, 136); box-sizing: border-box;">version</span> <span class="hljs-string" style="color: rgb(0, 136, 0); box-sizing: border-box;">"2.7.11"</span>, but required <span class="hljs-keyword" style="color: rgb(0, 0, 136); box-sizing: border-box;">is</span> at least <span class="hljs-string" style="color: rgb(0, 136, 0); box-sizing: border-box;">"3.4"</span> (found /usr/local/anaconda2/bin/python) -- Could NOT find PythonInterp: Found unsuitable <span class="hljs-keyword" style="color: rgb(0, 0, 136); box-sizing: border-box;">version</span> <span class="hljs-string" style="color: rgb(0, 136, 0); box-sizing: border-box;">"2.7.11"</span>, but required <span class="hljs-keyword" style="color: rgb(0, 0, 136); box-sizing: border-box;">is</span> at least <span class="hljs-string" style="color: rgb(0, 136, 0); box-sizing: border-box;">"3.2"</span> (found /usr/local/anaconda2/bin/python)</code><ul class="pre-numbering" style="box-sizing: border-box; position: absolute; width: 50px;  top: 0px; left: 0px; margin: 0px; padding: 6px 0px 40px; border-right: 1px solid rgb(221, 221, 221); list-style: none; text-align: right;"><li style="box-sizing: border-box; padding: 0px 5px;">1</li><li style="box-sizing: border-box; padding: 0px 5px;">2</li><li style="box-sizing: border-box; padding: 0px 5px;">3</li><li style="box-sizing: border-box; padding: 0px 5px;">4</li></ul><ul class="pre-numbering" style="box-sizing: border-box; position: absolute; width: 50px;  top: 0px; left: 0px; margin: 0px; padding: 6px 0px 40px; border-right: 1px solid rgb(221, 221, 221); list-style: none; text-align: right;"><li style="box-sizing: border-box; padding: 0px 5px;">1</li><li style="box-sizing: border-box; padding: 0px 5px;">2</li><li style="box-sizing: border-box; padding: 0px 5px;">3</li><li style="box-sizing: border-box; padding: 0px 5px;">4</li></ul>

这里PythonInterp和PythonLibs都不符合,会导致Python的OpenCV库无法编译成功。 
但是C++的库是没有问题的。 
为了让OpenCV的Python库可以编译出来,需要做下面一步:

使用Cmake-gui

<code class="hljs lasso has-numbering" style="display: block; padding: 0px; background: transparent; color: inherit; box-sizing: border-box; font-family: "Source Code Pro", monospace;font-size:undefined; white-space: pre; border-radius: 0px; word-wrap: normal;">cmake<span class="hljs-attribute" style="box-sizing: border-box;">-gui</span> <span class="hljs-built_in" style="color: rgb(102, 0, 102); box-sizing: border-box;">..</span></code><ul class="pre-numbering" style="box-sizing: border-box; position: absolute; width: 50px;  top: 0px; left: 0px; margin: 0px; padding: 6px 0px 40px; border-right: 1px solid rgb(221, 221, 221); list-style: none; text-align: right;"><li style="box-sizing: border-box; padding: 0px 5px;">1</li></ul><ul class="pre-numbering" style="box-sizing: border-box; position: absolute; width: 50px;  top: 0px; left: 0px; margin: 0px; padding: 6px 0px 40px; border-right: 1px solid rgb(221, 221, 221); list-style: none; text-align: right;"><li style="box-sizing: border-box; padding: 0px 5px;">1</li></ul>

在cmake-gui的界面中找到python的配置选项,并且设置如下: 

大家可以按照自己的python环境来配置这些选项。

再按Configure,就会看到如下配置,这些配置必须要有。

<code class="hljs lasso has-numbering" style="display: block; padding: 0px; background: transparent; color: inherit; box-sizing: border-box; font-family: "Source Code Pro", monospace;font-size:undefined; white-space: pre; border-radius: 0px; word-wrap: normal;"> Python <span class="hljs-number" style="color: rgb(0, 102, 102); box-sizing: border-box;">2</span>: Interpreter: /usr/<span class="hljs-built_in" style="color: rgb(102, 0, 102); box-sizing: border-box;">local</span>/anaconda2/bin/python2<span class="hljs-number" style="color: rgb(0, 102, 102); box-sizing: border-box;">.7</span> (ver <span class="hljs-number" style="color: rgb(0, 102, 102); box-sizing: border-box;">2.7</span><span class="hljs-number" style="color: rgb(0, 102, 102); box-sizing: border-box;">.11</span>) Libraries: /usr/<span class="hljs-built_in" style="color: rgb(102, 0, 102); box-sizing: border-box;">local</span>/anaconda2/lib/libpython2<span class="hljs-number" style="color: rgb(0, 102, 102); box-sizing: border-box;">.7</span><span class="hljs-built_in" style="color: rgb(102, 0, 102); box-sizing: border-box;">.</span>so (ver <span class="hljs-number" style="color: rgb(0, 102, 102); box-sizing: border-box;">2.7</span><span class="hljs-number" style="color: rgb(0, 102, 102); box-sizing: border-box;">.11</span>) numpy: /usr/<span class="hljs-built_in" style="color: rgb(102, 0, 102); box-sizing: border-box;">local</span>/anaconda2/lib/python2<span class="hljs-number" style="color: rgb(0, 102, 102); box-sizing: border-box;">.7</span>/site<span class="hljs-attribute" style="box-sizing: border-box;">-packages</span>/numpy/core/include (ver <span class="hljs-number" style="color: rgb(0, 102, 102); box-sizing: border-box;">1.10</span><span class="hljs-number" style="color: rgb(0, 102, 102); box-sizing: border-box;">.1</span>) packages path: /usr/<span class="hljs-built_in" style="color: rgb(102, 0, 102); box-sizing: border-box;">local</span>/anaconda2/lib/python2<span class="hljs-number" style="color: rgb(0, 102, 102); box-sizing: border-box;">.7</span>/site<span class="hljs-attribute" style="box-sizing: border-box;">-packages</span> </code><ul class="pre-numbering" style="box-sizing: border-box; position: absolute; width: 50px;  top: 0px; left: 0px; margin: 0px; padding: 6px 0px 40px; border-right: 1px solid rgb(221, 221, 221); list-style: none; text-align: right;"><li style="box-sizing: border-box; padding: 0px 5px;">1</li><li style="box-sizing: border-box; padding: 0px 5px;">2</li><li style="box-sizing: border-box; padding: 0px 5px;">3</li><li style="box-sizing: border-box; padding: 0px 5px;">4</li><li style="box-sizing: border-box; padding: 0px 5px;">5</li><li style="box-sizing: border-box; padding: 0px 5px;">6</li></ul><ul class="pre-numbering" style="box-sizing: border-box; position: absolute; width: 50px;  top: 0px; left: 0px; margin: 0px; padding: 6px 0px 40px; border-right: 1px solid rgb(221, 221, 221); list-style: none; text-align: right;"><li style="box-sizing: border-box; padding: 0px 5px;">1</li><li style="box-sizing: border-box; padding: 0px 5px;">2</li><li style="box-sizing: border-box; padding: 0px 5px;">3</li><li style="box-sizing: border-box; padding: 0px 5px;">4</li><li style="box-sizing: border-box; padding: 0px 5px;">5</li><li style="box-sizing: border-box; padding: 0px 5px;">6</li></ul>

再按一下Generate,完成后就可以退出cmake-gui了。

编译安装Opencv

make 编译,后面的参数 -j8 指的是我的cpu有8线程,这个提议提高编译的效率。 
大家需要根据自己的CPU的线程数来确定这个值。 
当然,直接make也没问题,就是慢一点而已。

<code class="hljs lasso has-numbering" style="display: block; padding: 0px; background: transparent; color: inherit; box-sizing: border-box; font-family: "Source Code Pro", monospace;font-size:undefined; white-space: pre; border-radius: 0px; word-wrap: normal;">make <span class="hljs-attribute" style="box-sizing: border-box;">-j8</span></code><ul class="pre-numbering" style="box-sizing: border-box; position: absolute; width: 50px;  top: 0px; left: 0px; margin: 0px; padding: 6px 0px 40px; border-right: 1px solid rgb(221, 221, 221); list-style: none; text-align: right;"><li style="box-sizing: border-box; padding: 0px 5px;">1</li></ul><ul class="pre-numbering" style="box-sizing: border-box; position: absolute; width: 50px;  top: 0px; left: 0px; margin: 0px; padding: 6px 0px 40px; border-right: 1px solid rgb(221, 221, 221); list-style: none; text-align: right;"><li style="box-sizing: border-box; padding: 0px 5px;">1</li></ul>

看到这两句,就说明编译成功,否则的话将上面cmke-gui的步骤再来一次。

<code class="hljs vbnet has-numbering" style="display: block; padding: 0px; background: transparent; color: inherit; box-sizing: border-box; font-family: "Source Code Pro", monospace;font-size:undefined; white-space: pre; border-radius: 0px; word-wrap: normal;">Linking CXX <span class="hljs-keyword" style="color: rgb(0, 0, 136); box-sizing: border-box;">shared</span> <span class="hljs-keyword" style="color: rgb(0, 0, 136); box-sizing: border-box;">module</span> ../../<span class="hljs-keyword" style="color: rgb(0, 0, 136); box-sizing: border-box;">lib</span>/cv2.so [<span class="hljs-number" style="color: rgb(0, 102, 102); box-sizing: border-box;">100</span>%] Built target opencv_python2</code><ul class="pre-numbering" style="box-sizing: border-box; position: absolute; width: 50px;  top: 0px; left: 0px; margin: 0px; padding: 6px 0px 40px; border-right: 1px solid rgb(221, 221, 221); list-style: none; text-align: right;"><li style="box-sizing: border-box; padding: 0px 5px;">1</li><li style="box-sizing: border-box; padding: 0px 5px;">2</li></ul><ul class="pre-numbering" style="box-sizing: border-box; position: absolute; width: 50px;  top: 0px; left: 0px; margin: 0px; padding: 6px 0px 40px; border-right: 1px solid rgb(221, 221, 221); list-style: none; text-align: right;"><li style="box-sizing: border-box; padding: 0px 5px;">1</li><li style="box-sizing: border-box; padding: 0px 5px;">2</li></ul>

最后一行命令:

<code class="hljs bash has-numbering" style="display: block; padding: 0px; background: transparent; color: inherit; box-sizing: border-box; font-family: "Source Code Pro", monospace;font-size:undefined; white-space: pre; border-radius: 0px; word-wrap: normal;"><span class="hljs-built_in" style="color: rgb(102, 0, 102); box-sizing: border-box;">sudo</span> make install</code><ul class="pre-numbering" style="box-sizing: border-box; position: absolute; width: 50px;  top: 0px; left: 0px; margin: 0px; padding: 6px 0px 40px; border-right: 1px solid rgb(221, 221, 221); list-style: none; text-align: right;"><li style="box-sizing: border-box; padding: 0px 5px;">1</li></ul><ul class="pre-numbering" style="box-sizing: border-box; position: absolute; width: 50px;  top: 0px; left: 0px; margin: 0px; padding: 6px 0px 40px; border-right: 1px solid rgb(221, 221, 221); list-style: none; text-align: right;"><li style="box-sizing: border-box; padding: 0px 5px;">1</li></ul>

测试Opencv

在python的编辑器中写下面的代码,我用的编辑器是PyCharm,感觉很好用。

<code class="hljs python has-numbering" style="display: block; padding: 0px; background: transparent; color: inherit; box-sizing: border-box; font-family: "Source Code Pro", monospace;font-size:undefined; white-space: pre; border-radius: 0px; word-wrap: normal;"><span class="hljs-keyword" style="color: rgb(0, 0, 136); box-sizing: border-box;">import</span> cv2 <span class="hljs-keyword" style="color: rgb(0, 0, 136); box-sizing: border-box;">print</span> cv2.__version__</code><ul class="pre-numbering" style="box-sizing: border-box; position: absolute; width: 50px;  top: 0px; left: 0px; margin: 0px; padding: 6px 0px 40px; border-right: 1px solid rgb(221, 221, 221); list-style: none; text-align: right;"><li style="box-sizing: border-box; padding: 0px 5px;">1</li><li style="box-sizing: border-box; padding: 0px 5px;">2</li><li style="box-sizing: border-box; padding: 0px 5px;">3</li></ul><ul class="pre-numbering" style="box-sizing: border-box; position: absolute; width: 50px;  top: 0px; left: 0px; margin: 0px; padding: 6px 0px 40px; border-right: 1px solid rgb(221, 221, 221); list-style: none; text-align: right;"><li style="box-sizing: border-box; padding: 0px 5px;">1</li><li style="box-sizing: border-box; padding: 0px 5px;">2</li><li style="box-sizing: border-box; padding: 0px 5px;">3</li></ul>

输出结果3.1.0,说明opencv的python版本,安装成功

Opencv3.1+python2.7的CentOS7安装的更多相关文章

  1. Centos7 安装 python2.7

    Centos7 安装 python 2.7.15 和 pip  1.先安装 GCC 包,如果没安装 GCC包 就输入以下命令行安装: (*注:以下记得使用 su 权限) yum install gcc ...

  2. centos7安装Python3的过程中会和Python2.7版本冲突导致yum版本比对应,致使yum不能使用的问题。

    centos7安装Python3的过程中会和Python2.7版本冲突导致yum版本比对应,致使yum不能使用的问题. 原因:yum调用Python,启动程/usr/bin/yum就是一个python ...

  3. Centos7 安装 opencv

      Centos7 安装 opencv CentOS Linux release 7.2.1511 (Core)   1.安装依赖     yum install https://dl.fedorap ...

  4. CentOS7 安装Python

    CentOS7 安装Python 1. 前置条件 centos7 安装时 勾选Development Tools,如果你centos7没有选,需要更多必要库 必要库 # yum -y install ...

  5. centos7安装 python3.6,且保留2.7版本

    CENTOS7安装PYTHON3.6 1. 安装python3.6可能使用的依赖# yum install openssl-devel bzip2-devel expat-devel gdbm-dev ...

  6. CentOS7 安装Python3,开发SocketIO 客户端

    CentOS7安装Python3,开发SocketIO 客户端 参考:https://blog.csdn.net/lovefengruoqing/article/details/79284573 步骤 ...

  7. centos7 安装pip+python3.6

    centos7安装pip 1.执行:yum install python-pip 若没有python-pip包,先执行:yum -y install epel-release,再执行yum insta ...

  8. Centos7 安装 Python 的笔记

    Centos7 安装 Python 的笔记 注意:系统自带的Python2.7不要改动,最好也不要出错,不然yum之类的工具可能会出错. 安装Python3.7.0 TensorFlow对Python ...

  9. centos7安装python3.7

    Centos7安装Python3的方法   由于centos7原本就安装了Python2,而且这个Python2不能被删除,因为有很多系统命令,比如yum都要用到. [root@VM_105_217_ ...

随机推荐

  1. 秒懂ASP.NET中的内置对象

    上篇博客,小编主要简单的介绍了一下ASP.NET中的控件,这篇博客,小编主要简单总结一下ASP.NET中的内置对象,七个内置对象分别是:Request.Response.Application.Coo ...

  2. Mysql group by语句的优化

    默认情况下,MySQL排序所有GROUP BY col1, col2, ....,查询的方法如同在查询中指定ORDER BY  col1, col2, ....如果显式包括一个包含相同的列的ORDER ...

  3. 关于C语言中输出格式

    刷OJ题的时候,经常发现题目的输入输出会有相应的特殊要求,像位宽和位域输出就比较常见. 位宽:如果长度不足位宽大小,则默认情况下前面补空格. 标志位:有+有- 默认格式为左对齐. 在位宽前面加0,补全 ...

  4. UNIX环境高级编程——线程同步之互斥锁、读写锁和条件变量(小结)

    一.使用互斥锁 1.初始化互斥量 pthread_mutex_t mutex =PTHREAD_MUTEX_INITIALIZER;//静态初始化互斥量 int pthread_mutex_init( ...

  5. iOS中 UICollectionView UI_19

    UICollectionView 是UITableView加强版 UITableView 和UICollectionView的设计思想: 1.布局: UITableView 的布局可以由UITable ...

  6. 利用编辑距离(Edit Distance)计算两个字符串的相似度

    利用编辑距离(Edit Distance)计算两个字符串的相似度 编辑距离(Edit Distance),又称Levenshtein距离,是指两个字串之间,由一个转成另一个所需的最少编辑操作次数.许可 ...

  7. TCP的ACK确认系列 — 快速确认

    主要内容:TCP的快速确认.TCP_QUICKACK选项的实现. 内核版本:3.15.2 我的博客:http://blog.csdn.net/zhangskd 快速确认模式 (1) 进入快速确认模式 ...

  8. Struts Chain ClassCastException Aop

    我们知道struts的restult type 有很多,但主要就是四种 dispatch,rediret,chain,drdirectaction 要让数据从一个action传到另一个action,就 ...

  9. EBS 外部信用风险检查

    DECLARE l_msg_count NUMBER; l_msg_data VARCHAR2(2000); l_return_status VARCHAR2(30); l_cc_hold_comme ...

  10. Xcode调试非异常导致崩溃的程序

    如果App不是因为一个异常而崩溃,Xcode可能任然会指向main()函数为出错位置. 在这种情况下,你可能遇上了更低级别的问题.也许是一个除以0错误或是缓冲溢出问题,或者你寻址一个已经被释放的对象. ...