Install OpenCV 2.3.1a in Ubuntu 11.10

If you want to install OpenCV 2.1 you can just use apt-get to do the work:

sudo apt-get install libcv-dev libcv2.1 libcvaux-dev libcvaux2.1 libhighgui-dev libhighgui2.1 opencv-doc python-opencv

Some changes introduced in Ubuntu 11.10 causes OpenCV 2.3.1a not to compile because of ffmpeg. This makes the installation more complicated as we have to compile some libraries on our own. The other option would be just disabling ffmpeg in OpenCV with ccmake in WITH_FFMPEG option or using “-DWITH_FFMPEG=NO” with cmake.

First we have to uninstall some libraries:

sudo apt-get remove ffmpeg x264 libx264-dev

Get all the dependencies we need (run sudo apt-get update before this just in case):

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 libtiff4-dev

Install gstreamer:

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

Download, compile and install a stable and recent version of x264 (in my case it was x264-snapshot-20111213-2245-stable):

wget ftp://ftp.videolan.org/pub/videolan/x264/snapshots/last_stable_x264.tar.bz2
tar -xjvf last_stable_x264.tar.bz2
cd `ls -1d */ | grep x264-snapshot-`
./configure --enable-static
make
sudo make install

If you are compiling for x64 arquitecture it may be necessary to use the --enable-pic and --enable-shared option when running ./configure:

./configure --enable-static --enable-pic --enable-shared

Download, compile and install a 0.8.x version of ffmpeg (in my case it was 0.8.7) (for versions prior to OpenCV 2.3.1 use a 0.7.x version), although with versión 0.10.x works too:

wget http://ffmpeg.org/releases/ffmpeg-0.8.7.tar.bz2
tar -xjvf fmpeg-0.8.7.tar.bz2
cd ffmpeg-0.8.7
./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

As it happend with x264 it may be necessary to use the –enable-pic and –enable-shared option when running ./configure:

./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 --enable-pic --enable-shared

Install gtk:

sudo apt-get install libgtk2.0-0 libgtk2.0-dev

Install libjpeg:

sudo apt-get install libjpeg62 libjpeg62-dev

Download, compile and install a 0.8.x version of v4l (in my case it was 0.8.5 but the, as of april 2012, 0.8.8 version works too):

wget http://www.linuxtv.org/downloads/v4l-utils/v4l-utils-0.8.5.tar.bz2
tar -xjvf v4l-utils-0.8.5.tar.bz2
cd v4l-utils-0.8.5
make
sudo make install

Download, compile and install OpenCV 2.3.1a:

wget http://sourceforge.net/projects/opencvlibrary/files/opencv-unix/2.3.1/OpenCV-2.3.1a.tar.bz2
tar -xjvf OpenCV-2.3.1a.tar.bz2
cd OpenCV-2.3.1
mkdir build
cd build
cmake ..
make
sudo make install

Beyond this point you can look at how to install OpenCV in Ubuntu 10.10 for more configuration options of OpenCV installation.

Sources: http://ozbots.org/opencv-installation/

http://thebitbangtheory.wordpress.com/2011/10/23/how-to-install-opencv-2-3-1-in-ubuntu-11-10-oneiric-ocelot-with-python-support/

Leave a comment ?

4 Comments.

  1. gracias por el aporte me sirvio …

    Reply
  2. Install OpenCV 2.3.1 in Ubuntu 12.04 | Programming and Technology - pingback on Thursday May 17th, 2012 at 01:55 PM
  3. Use OpenCV on Eclipse CDT | Programming and Technology - pingback on Friday May 18th, 2012 at 01:35 PM
  4. Install OpenCV 2.4 in Ubuntu 12.04 | Programming and Technology - pingback on Friday May 18th, 2012 at 01:45 PM

Leave a Comment

Trackbacks and Pingbacks: