CentOS安装 opencv3.4.1
CentOS及Python库安装pip3 install opencv-pythonpip3 install mxnet(mxnet-cu90 gpu安装)yum install lrzszXshell实现Windows上传文件到Linux主机rz上传文件不能超过4GWindow Xftp6破解版下载选择"网通用户下载",可以上传大文件,而且速度快5-7M/spip3 i...
Centos7 安装 opencv3.4.1
1.下载源码包
所有版本的:https://github.com/opencv/opencv/releases
opencv3.4.1:https://github.com/opencv/opencv/releases?after=3.4.1-cvsdk
2.安装依赖
在安装之前,要先配置好epel源,因为下面的某些安装在系统自带的源中找不到
yum -y install epel-release
首先是gcc,g++等这些基本的工具,一般都是有的。没有的话就用yum install来安装。
yum install gcc gcc-c++
yum install cmake
yum install python-devel numpy
yum install gtk2-devel
yum install libdc1394-devel
yum install libv4l-devel
yum install gstreamer-plugins-base-devel
3.编译安装
$tar -zxvf opencv-3.4.1.tar.gz
$cd opencv-3.4.1
$mkdir build
$cd build
$cmake -D WITH_TBB=ON -D WITH_EIGEN=ON ..
$cmake -D BUILD_DOCS=ON -D BUILD_TESTS=OFF -D BUILD_PERF_TESTS=OFF -D BUILD_EXAMPLES=OFF ..
$cmake -D WITH_OPENCL=OFF -D WITH_CUDA=OFF -D BUILD_opencv_gpu=OFF -D BUILD_opencv_gpuarithm=OFF -D BUILD_opencv_gpubgsegm=OFF -D BUILD_opencv_gpucodec=OFF -D BUILD_opencv_gpufeatures2d=OFF -D BUILD_opencv_gpufilters=OFF -D BUILD_opencv_gpuimgproc=OFF -D BUILD_opencv_gpulegacy=OFF -D BUILD_opencv_gpuoptflow=OFF -D BUILD_opencv_gpustereo=OFF -D BUILD_opencv_gpuwarping=OFF ..
$cmake -D CMAKE_BUILD_TYPE=RELEASE -D CMAKE_INSTALL_PREFIX=/usr/local ..
$make
$sudo make install
4.环境变量配置(64位版本)
3.1路径添加和加载
cd /etc/ld.so.conf.d
vim opencv.conf
输入 /usr/local/lib64 (看哪个下面有pkgconfig文件夹,32位系统应该是/usr/local/lib )
:wq退出
加载:ldconfig
OK
3.2添加PATH
输入命令gedit /etc/bashrc
在文件末尾另起行加入
PKG_CONFIG_PATH=$PKG_CONFIG_PATH:/usr/local/lib64/pkgconfig
export PKG_CONFIG_PATH
:wq保存退出
(注意:/usr/local/lib64/pkgconfig 路径可能是lib or lib64)
输入source /etc/bashrc使配置生效
如报错:-bash: i#: command not found
gedit /etc/bashrc
然后你会发现你第一行是i#。把i去掉然后保存在source /etc/bashrc就可以了
输入updatedb更新数据库
查看opencv版本
pkg-config --modversion opencv
5、opencv测试
cd到samples下我的在/home/opencv/opencv-3.4.1/samples
cd ../samples/cpp/example_cmake
make
./opencv_example
执行后出现如下对话框,恭喜你,安装成功了。
问题
1.error while loading shared libraries: libopencv_highgui.so.4.1
1.1 cd /etc/ld.so.conf.d
1.2 vim opencv.conf 输入
/usr/local/lib 或者 /usr/local/lib64 (看哪个下面有pkgconfig文件夹)
1.3 ldconfig
2.环境变量未配置
3.源码编译opencv卡在IPPICV: Download: ippicv_2017u3_lnx_intel64_general_20170822.tgz解决办法
更多推荐
所有评论(0)