Home
Uni-Logo
 

Setup OpenCV on Ubuntu Linux 10.04

The Ubuntu package for OpenCV is quite outdated, and other binary packages I found were not able to access the camera. I highly recommend to compile the most recent version from source. Get OpenCV-2.3.1.tar.bz2 from sourceforge, copy it to your source directory, e.g. '/home/ronneber/Docs/Katzenklappe/archive/' and perform the following steps:

sudo apt-get install build-essential libavformat-dev libswscale-dev libgtk2.0-dev cmake emacs
cd ~/Docs/Katzenklappe/
tar -jxvf archive/OpenCV-2.3.1.tar.bz2
mkdir ~/Docs/Katzenklappe/OpenCV-2.3.1/release
cd ~/Docs/Katzenklappe/OpenCV-2.3.1/release
cmake -D CMAKE_BUILD_TYPE=RELEASE -D CMAKE_INSTALL_PREFIX=/home/ronneber/Docs/Katzenklappe/OpenCV-2.3.1/installed ..
make
make install

This may take some time. Finally you have to to insert the following lines into your '.bashrc':

export PKG_CONFIG_PATH=~/Docs/Katzenklappe/OpenCV-2.3.1/installed/lib/pkgconfig/
export LD_LIBRARY_PATH=~/Docs/Katzenklappe/OpenCV-2.3.1/installed/lib:$LD_LIBRARY_PATH

That's it. After that you should be able to compile your opencv programs just by

c++ `pkg-config opencv --cflags --libs` yourprogram.cc -o yourprogram