Here are instructions for installation of Opencv 2.3.1 on Ubuntu 12.04 Precise Pangolin. For opencv installation we need FFmpeg, x264, v4l and their dependencies. It is a bit longer process as compared to windows installations. Step by step process is shown below.
1. Install dependencies for
FFmpeg and
x264
Enter following lines in terminal to check and install dependencies.
sudo apt-get install build-essential checkinstall git cmake libfaac-dev libjack-jackd2-dev libmp3lame-dev libopencore-amrnb-dev libopencore-amrwb-dev libsdl1.2-dev libtheora-dev libva-dev libvdpau-dev libvorbis-dev libx11-dev libxfixes-dev libxvidcore-dev texi2html yasm zlib1g-dev
2. Install
Gstreamer by entering following lines in terminal
sudo apt-get install libgstreamer0.10-0 libgstreamer0.10-dev gstreamer0.10-tools gstreamer0.10-plugins-base libgstreamer-plugins-base0.10-dev gstreamer0.10-plugins-good gstreamer0.10-plugins-ugly gstreamer0.10-plugins-bad gstreamer0.10-ffmpeg
3. Download recent version (0.8+)of
FFmpeg from
https://github.com/FFmpeg/FFmpeg extract it and go to the directory. Now configure and install FFmpeg by entering following commons one by one.
./configure --enable-gpl --enable-libfaac --enable-libmp3lame --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libtheora --enable-libvorbis --enable-libx264 --enable-libxvid --enable-nonfree --enable-postproc --enable-version3 --enable-x11grab
make
sudo make install
4. Install recent version of
x264 from
ftp://ftp.videolan.org/pub/videolan/x264/snapshots/ extract it and go to the directory. Now configure and install x264 by entering following commons one by one.
./configure --enable-static
make
sudo make install
5. Download video for linux
v4l libs from
http://www.linuxtv.org/downloads/v4l-utils/ extract it and go to the directory. Install v4l using following command.
make
sudo make install
6. Install
gtk libs using apt-get
sudo apt-get install libgtk2.0-0 libgtk2.0-dev
7. Install
libjpeg using following command
sudo apt-get install libjpeg62 libjpeg62-dev
8. Now our dependencies are complete. We can install
Opencv now. Download Opencv from
http://sourceforge.net/projects/opencvlibrary/files/opencv-unix/ Extract it and go to the directory. Enter following command to configure and install Opencv
mkdir build
cd build
cmake ..
make
sudo make install
We are done with installing Opencv on ubuntu 12.04 Precise Pangolin. In order to set path open /etc/bash.bashrc using your favorite text editor and add following lines
PKG_CONFIG_PATH=$PKG_CONFIG_PATH:/usr/local/lib/pkgconfig
export PKG_CONFIG_PATH
Restart your system and you are ready to use awesome Opencv!