ubuntu 11.04安装OpenCV

ubuntu 11.04安装OpenCV

by Elton on 七.27, 2011, under C/C++, Linux

Step 1:安装必要的依赖包

sudo apt-get install build-essential libgtk2.0-dev libjpeg62-dev libtiff4-dev libjasper-dev libopenexr-dev cmake python-dev python-numpy libtbb-dev libeigen2-dev yasm libfaac-dev libopencore-amrnb-dev libopencore-amrwb-dev libtheora-dev libvorbis-dev libxvidcore-dev


Step 2:安装ffmpeg

cd ~
wget http://ffmpeg.org/releases/ffmpeg-0.7-rc1.tar.gz
tar -xvzf ffmpeg-0.7-rc1.tar.gz
cd ffmpeg-0.7-rc1
./configure --enable-gpl --enable-version3 --enable-nonfree --enable-postproc --enable-libfaac --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libtheora --enable-libvorbis --enable-libxvid --enable-x11grab --enable-swscale --enable-shared
make
sudo make install

Step 3:安装OpenCV 2.3

cd ~
wget http://downloads.sourceforge.net/project/opencvlibrary/opencv-unix/2.3/OpenCV-2.3.0.tar.bz2
tar -xvf OpenCV-2.3.0.tar.bz2
cd OpenCV-2.3.0/
mkdir release
cd releasecmake -D CMAKE_BUILD_TYPE=RELEASE -D CMAKE_INSTALL_PREFIX=/usr/local -D BUILD_NEW_PYTHON_SUPPORT=ON -D WITH_TBB=ON -D WITH_V4L=OFF -D INSTALL_C_EXAMPLES=ON -D INSTALL_PYTHON_EXAMPLES=ON -D BUILD_EXAMPLES=ON ..
make
sudo make intall

Step 4:添加库的路径

sudo vim /etc/ld.so.conf.d/opencv.conf

加入:

/usr/local/lib

更新系统库

sudo ldconfig

设置环境变量

sudo vim /etc/environment

加入

PKG_CONFIG_PATH=$PKG_CONFIG_PATH:/usr/local/lib/pkgconfig

至此,OpenCV的设置都完成了。

Step 5:测试
进入OpenCV源代码目录中的sample

cd ~/OpenCV-2.3.0/samples/c
chmod +x build_all.sh
./build_all.sh

评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值