Showing posts with label install. Show all posts
Showing posts with label install. Show all posts

Monday, February 4, 2013

Installing OpenCV on Ubuntu

To find out what version of ubuntu you have, type this at the command prompt
> lsb_release -a

For me, the answer is Ubuntu 12.04.1. Here are the sequence of steps that led to a successful OpenCV install (using terminal )

1. Download OpenCV 2.4.3 from here http://opencv.org/downloads.html
2. Unpack tar file and create a directory called release
~/OpenCV-2.4.3/release
3. Make sure packages are installed using the command
> sudo apt-get install [package-name]

where packages I installed were (these may not be required but I installed them anyways)
build-essential cmake pkg-config libpng12-0 libpng12-dev libpng++-dev libpng3 libpnglite-dev
zlib1g-dbg zlib1g zlib1g-dev
libjasper-dev libjasper-runtime libjasper1
pngtools libtiff4-dev libtiff4 libtiffxx0c2 libtiff-tools
libjpeg8 libjpeg8-dev libjpeg8-dev libjpeg8-dbg libjpeg-progs libjpeg-dev
ffmpeg libavcodec-dev libavcodec52 libavformat52 libavformat-dev
libgstreamer0.10-dev libgstreamer0.10-0 libgstreamer0.10-0-dbg
libv4l-dev
yasm
libtbb-dev libqt4-dev libtbb2

You may need some other things like numpy, python etc. which I already had.

4. Run cmake command with following flags
> cmake -D CMAKE_BUILD_TYPE=RELEASE -D BUILD_EXAMPLES=ON -D BUILD_DOCS=ON -D BUILD_NEW_PYTHON_SUPPORT=ON -D WITH_TBB=ON -D WITH_CUDA=OFF -D WITH_QT=ON ..

5. 'make' and then 'sudo make install'

Oh one thing I forgot to mention which may or may not make a difference, is that I installed ffmpeg from source by downloading from ffmpeg.org. The configure script had a few flags that were enabled... again not sure if this makes a big difference to the success of the build/install of opencv.