Take the 2-minute tour ×
Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free, no registration required.

I've downloaded opencv but unfortunately I've got no idea how to install it. All the pages I found online were only telling me how to download and install it directly from the console, not what to do when you already have it downloaded. Could anybody tell me what to do?

share|improve this question
There is a lot of opencv libs in the software center or in apt. Not sure whether it is a standalone as such too? –  don.joey Aug 18 '13 at 15:19
add comment

4 Answers

To Install OpenCV on Ubuntu, just press Ctrl+Alt+T on your keyboard to open Terminal. When it opens, run the command(s) below:

Ubuntu 12.04 provides a package of OpenCV 2.3.1 that you can easily install by typing:

sudo apt-get install libopencv-dev

If you do not care about having the latest version you could skip the rest.

Install Dependencies

sudo apt-get install build-essential checkinstall cmake pkg-config yasm
sudo apt-get install libtiff4-dev libjpeg-dev libjasper-dev
sudo apt-get install libavcodec-dev libavformat-dev libswscale-dev libdc1394-22-dev libxine-dev libgstreamer0.10-dev 
libgstreamer-plugins-base0.10-dev libv4l-dev
sudo apt-get install python-dev python-numpy
sudo apt-get install libtbb-dev
sudo apt-get install libqt4-dev libgtk2.0-dev

Download OpenCV for Unix to: ~/Downloads

cd Downloads
wget http://downloads.sourceforge.net/project/opencvlibrary/opencv-unix/

tar -xvf opencv-
cd opencv-
mkdir build
cd build

Configure using CMake.


Notice, that by adding the -D WITH_QT=ON, the highgui module will use QT instead of GTK. If you want to go with GTK just remove this. For more information on the options, look at the CMakeLists.txt file. When you are happy with the configuration you have, you can start compiling:


If compilation finishes without errors, you can install by saying:

sudo make install

Finally, make sure that your programs can link to the OpenCV library in run-time by adding the following line at the end of your /etc/ld.so.conf:


And then configure dynamic linker run-time bindings:

sudo ldconfig

Source:How To Install OpenCV on Ubuntu

share|improve this answer
As of writing, the libopencv-dev fails to install the folder /usr/include/opencv, containing the 'old' header files. They are present in (the original source)[archive.ubuntu.com/ubuntu/pool/universe/o/opencv/… and the folder is referenced in the pkg-config file opencv.pc, so downloading and unzipping the original source, then linking/copying the include/opencv folder into /usr/include works. –  drevicko Apr 6 at 5:03
add comment

To install OpenCV using the terminal on Ubuntu:

$ su -
# apt-get update
# apt-get install build-essential
# apt-get install libavformat-dev
# apt-get install x264 v4l-utils ffmpeg
# apt-get install libcv2.3 libcvaux2.3 libhighgui2.3 python-opencv opencv-doc libcv-dev libcvaux-dev libhighgui-dev

OpenCV should be installed in /usr/local/ Installation Directory

You may also want to compile and view examples

$ cp -r /usr/share/doc/opencv-doc/examples .
$ cd examples
$ cd c
$ sh build_all.sh

Source: http://namhuy.net/1205/how-to-install-opencv-on-ubuntu.html

share|improve this answer
add comment

Watch this video.. It'll help you. https://www.youtube.com/watch?v=MqQB5KKJCh0

share|improve this answer
While this may answer the question, it would be preferable to include the essential parts of the answer here, and provide the link for reference. –  guntbert Jan 18 at 13:24
add comment

Here's a script to help install opencv on ubuntu https://gist.github.com/olupotd/cd0c68f4c84153dffd16/download

share|improve this answer
add comment

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.