install opencv 2.4.2 on centos 6.3
系统环境介绍:
centos 6.3 x86_64
假设已经安装了 cmake ,并下载了opencv2.4.2
1.安装依赖包
yum install gtk+-devel.x86_64 gimp-devel.x86_64 gimp-devel-tools.x86_64 gimp-help-browser.x86_64 zlib-devel.x86_64 libtiff-devel.x86_64 libjpeg-devel.x86_64 libpng-devel.x86_64 gstreamer-devel.x86_64 libavc1394-devel.x86_64 libraw1394-devel.x86_64 libdc1394-devel.x86_64 jasper-devel.x86_64 jasper-utils.x86_84 swig python libtool nasm.x86_84
2.生成make文件并安装
cd opencv 2.4.2
cmake -D CMAKE_BUILD_TYPE=RELEASE -D CMAKE_INSTALL_PREFIX=/usr/local -D BUILD_NEW_PYTHON_SUPPORT=NO .
make
sudo make install
3.配置
新建文件 /etc/ld.so.conf.d/opencv.conf
在文件中添加 /usr/local/lib
保存之后执行配置
sudo ldconfig
4.环境变量配置
sudo vim /etc/bashrc
PKG_CONFIG_PATH=$PKG_CONFIG_PATH:/usr/local/lib/pkgconfig
export PKG_CONFIG_PATH
保存之后执行
source /etc/bashrc
5.测试安装是否成功
cd OpenCV-2.4.1/samples/c
chmod +x build_all.sh
./build_all.sh
编译结束之后执行
./facedetect cascade="/usr/local/share/OpenCV/haarcascades/haarcascade_frontalface_alt.xml" --scale=1.5 lena.jpg
如果安装成功的话,lena脸上会有一个蓝色的圈