*Update: For OpenCV 2.4 on Ubuntu 12.04 see
my latest post.
OpenCV (Open Source Computer Vision) is a library of programming functions for real time computer vision. It is released under a
BSD license, it is free for both academic and commercial use. It has C++, C, Python and soon Java interfaces running on Windows, Linux, Android and Mac.
This is how to build and install OpenCV 2.2 on Ubuntu 10.10.
First, install the dependencies from the repositories:
sudo apt-get install build-essential libgtk2.0-dev libavcodec-dev libavformat-dev libjpeg62-dev libtiff4-dev cmake libswscale-dev libjasper-dev
Download the source code:
wget http://sourceforge.net/projects/opencvlibrary/files/opencv-unix/2.2/OpenCV-2.2.0.tar.bz2
Extract, create the build directory:
tar xfv OpenCV-2.2.0.tar.bz2
rm OpenCV-2.2.0.tar.bz2
cd OpenCV-2.2.0
mkdir opencv.build
cd opencv.build
Configure, make and install:
cmake ..
make
sudo make install
To configure the library, edit the following file (might be empty):
sudo gedit /etc/ld.so.conf.d/opencv.conf
and add the line
/usr/local/lib
Then run:
sudo ldconfig
Finally, edit the file:
sudo gedit /etc/bash.bashrc
and add the following lines at the end:
PKG_CONFIG_PATH=$PKG_CONFIG_PATH:/usr/local/lib/pkgconfig
export PKG_CONFIG_PATH
Most of the above was find
here.
Older versions? Take a look at the following links:
OpenCV 2.1 on Ubuntu 10.04 (pretty much the same as above, but with
TBB)
OpenCV 2.0 on Ubuntu 9.10
For OpenCV 2.3.1 see
this post.