Centos 安装 opencv

下载opencv : https://sourceforge.net/projects/opencvlibrary/files/opencv-unix/
opencv视频处理部分是基于ffmpeg的,所以如果想用opencv3来处理视频那么必须安装ffmpeg依赖,并且不能下载官网上最新的ffmpeg,opencv调用的是比较老的系统版本
然后如果需要ffmpeg支持,那么需要安装相关的库,安装过程如下:
安装epel扩展源 : yum -y install epel-release
添加扩展源 :

yum localinstall --nogpgcheck https://download1.rpmfusion.org/free/el/rpmfusion-free-release-7.noarch.rpm https://download1.rpmfusion.org/nonfree/el/rpmfusion-nonfree-release-7.noarch.rpm
rpm --import http://li.nux.ro/download/nux/RPM-GPG-KEY-nux.ro
rpm -Uvh http://li.nux.ro/download/nux/dextop/el7/x86_64/nux-dextop-release-0-1.el7.nux.noarch.rpm
安装ffmpeg依赖 : yum -y install ffmpeg ffmpeg-devel

安装opencv

解压 : unzip opencv-3.4.3.zip
cd opencv-3.4.3

开始安装 :
rm CMakeCache.txt (防止报错 error : in-source builds are not allowed)
mkdir build (opencv不允许在源目录安装)
cd build
cmake ..
make
make install

发表评论

电子邮件地址不会被公开。 必填项已用*标注