首页 > 代码库 > CentOS7配置OpenCV2.4.13
CentOS7配置OpenCV2.4.13
以管理员身份运行
su root
输入密码
安装依赖包
yum install gcc gcc-c++ gtk2-devel gimp-devel gimp-devel-tools gimp-help-browser zlib-devel libtiff-devel libjpeg-devel libpng-devel gstreamer-devel libavc1394-devel libraw1394-devel libdc1394-devel jasper-devel jasper-utils swig python libtool nasm
官网下载opencv2.4.13.zip到usr/local
cd /usr/local
unzip opencv-2.4.13.zip
cd opencv-2.4.13/
cmake CMakeLists.txt
make
make install
cp /usr/local/opencv-2.4.13/unix-install/opencv.pc /usr/lib64/pkgconfig/
gedit /etc/ld.so.conf.d/opencv.conf
将以下内容添加到最后:
/usr/local/lib
保存关闭
ldconfig
gedit /etc/bash.bashrc
在文件后添加:
PKG_CONFIG_PATH=$PKG_CONFIG_PATH:/usr/local/lib/pkgconfig
export PKG_CONFIG_PATH
保存关闭
重启终端
【测试】
cd /usr/local/opencv-2.4.13/samples/c
chmod +xbuild_all.sh
./build_all.sh
./facedetectcascade="/usr/local/share/OpenCV/haarcascades/haarcascade_frontalface_alt.xml"--scale=1.5 lena.jpg
如果看到lena图像,说明成功
CentOS7配置OpenCV2.4.13