Install OpenCV 2.4.8 on Ubuntu 13.10

Following are the instructions to install OpenCV on Ubuntu machine. I am using latest version of OpenCV 2.4.8 and latest version of Ubuntu 13.10. For old versions (2.3 and earlier) of OpenCV you can follow my earlier blog post here. Installing new version of OpenCV is slightly different hence I am presenting this post.

Following steps will guide you to install OpenCV 2.4.8 on Ubuntu 13.10

1. First we will install essential tools for buidling OpenCV. Use following command in your terminal to install them.

sudo apt-get install build-essential cmake pkg-config

2. Following command will install required Image I/O libraries.

sudo apt-get install libjpeg62-dev libtiff4-dev libjasper-dev


3. Install gtk libraries for highgui

sudo apt-get install  libgtk2.0-dev

4. Install required video libraries.


sudo apt-get install libavcodec-dev libavformat-dev libswscale-dev libv4l-dev

5. Download OpenCV from sourceforge using below link and extract zipped file. Enter into zipped directly.


http://sourceforge.net/projects/opencvlibrary/files/opencv-unix/2.4.8/


6. Create a build directory in zipped file and enter into it using following terminal command.


mkdir build
cd build


7. Type following command in terminal window to start building process.


cmake -D CMAKE_BUILD_TYPE=RELEASE -D MAKE_INSTALL_PREFIX=/usr/local -D  WITH_TBB=ON -D BUILD_NEW_PYTHON_SUPPORT=ON -D WITH_V4L=ON -D INSTALL_C_EXAMPLES=ON -D INSTALL_PYTHON_EXAMPLES=ON -D BUILD_EXAMPLES=ON -D WITH_QT=ON -D WITH_OPENGL=ON ..


8.  Compile the source code using following command.


make

9.  Install OpenCV using following command.

sudo make install


Now your machine is ready to rock with OpenCV. 

12 comments:

  1. very helpful, thanks.

    ReplyDelete
    Replies
    1. I am glad that my post helped :)

      Delete
  2. Getting an error after following the 7th step. Please help.

    -- Configuring incomplete, errors occurred!

    ReplyDelete
    Replies
    1. didn't work for me either, try this one:
      https://help.ubuntu.com/community/OpenCV

      Delete
  3. Also get errors on 7th.. Followed every bit, except I had to replace libjpeg62-dev with libjpeg-dev because of compatibility coplaints.

    ReplyDelete
  4. Check http://ubuntuforums.org/archive/index.php/t-1985957.html for the mentioned problems. Or better follow https://help.ubuntu.com/community/OpenCV if you are using Ubuntu. Installation is silent without output for a few minutes right after the start. But then it works smoothly.

    ReplyDelete
  5. step 7 worked for me after I executed this:
    sudo apt-get install libqt4-core libqt4-dev libqt4-gui qt4-dev-tools

    ReplyDelete
  6. To work on OpenCV with Python visit -- https://li8bot.wordpress.com/

    ReplyDelete
  7. Step 7: it is missing C before MAKE, so this is the correct way
    -D CMAKE_INSTALL_PREFIX=/usr/local

    ReplyDelete