November 8th, 2009 by alex
OpenCV is a widely used computer vision library for research and development.
I’ve tried using instructions for installing it from the official manual, but it failed miserably.
It seems that 2.0 code is incompatible with the latest incarnation of ffmpeg. Couple minutes in googling and I had it working.Here is what needs to be done:
Get all the prerequisites:
sudo apt-get install build-essential libgtk2.0-dev libavcodec-dev libavformat-dev libjpeg62-dev libtiff4-dev build-dep libswscale-dev swig
Get OpenCV 2.0, and unpack it somewhere
Fix ffmpeg links.
Make sure you are root (sudo -s) and do the following:
mkdir /usr/include/ffmpeg
ln -s /usr/include/libavcodec/avcodec.h /usr/include/ffmpeg/avcodec.h
ln -s /usr/include/libavformat/avformat.h /usr/include/ffmpeg/avformat.h
ln -s /usr/include/libavformat/avio.h /usr/include/ffmpeg/avio.h
ln -s /usr/include/libavutil/avutil.h /usr/include/ffmpeg/avutil.h
Configure OpenCV. In the folder you’ve unpacked it to run:
./configure --prefix=/usr/local/opencv --enable-apps --enable-shared --enable-swscale --enable-gpl --with-swig
sudo ln -s /usr/include/libswscale/swscale.h /usr/include/ffmpeg/swscale.h
Make and install itmake
sudo make install
You could also test it by running make test
Configure your system to look for opencv libraries
echo /usr/local/opencv/lib > /etc/ld.so.conf.d/opencv.conf
Reload the libraries and make sure opencv shows up now
ldconfig -v grep opencv
You may get warnings on unaccessible lib paths, that is ok.
You are looking for a line that says
“/usr/local/opencv/lib”
Set-up pkg-config
echo 'export PKG_CONFIG_PATH=$PKG_CONFIG_PATH:/usr/local/opencv/lib/pkgconfig' >> /etc/bash.bashrc
echo 'export PYTHONPATH=/usr/local/opencv/lib/python2.6/site-packages/opencv' >> /etc/bash.bashrc
Restart your terminal to get the new paths
Test by building samplescd
~/Programs/OpenCV-2.0.0/samples/c. build_all.sh
You’re done.
網誌存檔
-
▼
2009
(13)
-
▼
12月
(13)
- 由影像處理到電腦視覺(轉貼)
- Ubuntu的一些用法連結
- ubuntu9.10安装android SDK
- 在桌面或者gnome菜單中添加eclipse啟動圖標
- FAQ How do I increase the heap size available to E...
- Cross Compiling
- 上課講義摘錄之4:Android與Cross Compiler之關係
- ubuntu FTP SERVER 安裝設置( vsftp 版本 )
- FTP Server 的安裝設定 (vsftpd & proftpd)
- 關於編譯時出現錯誤41的解決方法
- Installing OpenCV 2.0 on Ubuntu 9.10 [轉貼]
- In Ubuntu 9.10, Android Build error: No module def...
- 在 Ubuntu 9.10下 build android
-
▼
12月
(13)
沒有留言:
張貼留言