Skip to content

InstallingOpenCVUbuntu

heynemann edited this page Jun 5, 2011 · 1 revision

Install opencv from source in linux

This tutorial is for:

Distro: ubuntu 10.10 Opencv Version: 2.2

Installation

Install the necessary dependencies:

sudo apt-get install libtbb2 libtbb-dev \
    libgtk2.0-dev build-essential pkg-config \
    libpng12-0 libpng12-dev libpng++-dev libpng3 libpnglite-dev \
    libpngwriter0-dev libpngwriter0c2 zlib1g-dbg zlib1g zlib1g-dev \
    libjasper-dev libjasper-runtime libjasper1 \
    pngtools libtiff4-dev libtiff4 libtiffxx0c2 libtiff-tools \
    libjpeg62 libjpeg62-dev libjpeg62-dbg libjpeg-progs \
    ffmpeg libavcodec-dev libavcodec52 libavformat52 libavformat-dev \
    libgstreamer0.10-0-dbg libgstreamer0.10-0 libgstreamer0.10-dev \
    libgstreamer-plugins-base0.10-dev libxine1-ffmpeg libxine-dev \
    libxine1-bin libunicap2 libunicap2-dev libdc1394-22-dev libdc1394-22 \
    libdc1394-utils swig libv4l-0 libv4l-dev python-numpy libpython2.6 \
    python-dev python2.6-dev openexr libswscale0 libswscale-dev \
    libeigen2-dev libopenexr-dev cmake

Download, extract and compile using the following commands:

wget http://sourceforge.net/projects/opencvlibrary/files/opencv-unix/2.2/OpenCV-2.2.0.tar.bz2
tar -jxvf OpenCV-2.2.0.tar.bz2
cd OpenCV-2.2.0
mkdir release
cd release
cmake -D CMAKE_BUILD_TYPE=RELEASE -D WITH_TBB=ON -D TBB_INCLUDE_DIRS=/usr/include/tbb CMAKE_INSTALL_PREFIX=/usr/local -D BUILD_PYTHON_SUPPORT=ON -D WITH_GTK=ON -D BUILD_EXAMPLES=ON ..
make -j 2 && sudo make install && sudo ldconfig
sudo mv /usr/local/lib/python2.6/site-packages/cv.so /usr/local/lib/python2.6/dist-packages/cv.so

Uninstall

Inside the dir release run the command:

sudo make uninstall
Clone this wiki locally