How to install OpenCV 2.1 on Ubuntu

The new version of OpenCV's changed the way to install by using cmake. I also have to update myself and find some information regarding it. Recently, I've read the tutorial on installing OpenCV 2.1 in Ubuntu which explains very well; so, I follow this tutorial and I would note my installation steps here.

  1. install dependencies as follows (please also see the screen shots below).
    • libcv4
    • libcv-dev
    • libcvaux4
    • libcvaux-dev
    • libhighgui4
    • libhighgui-dev
    • opencv-doc (optional)
    • ffmpeg (optional; if you want to use ffmpeg to do video processing)

    check-opencv-packages01

    check-opencv-packages02

  2. install cmake using the command sudo apt-get install cmake.
  3. run cmake -D WITH_FFMPEG=ON -D CMAKE_INSTALL_PREFIX=${HOME}/opencv/ ..
    • Note that there is a dot at the end of the command above which means to run at the current directory.
    • The options mean to use ffmpeg and to set the OpenCV path in your home directory.
  4. check if ffmpeg is available and the folder to install is correct. See the screen shot below.

    config-checking

  5. run the command make
  6. run the command sudo make install.
  7. The last thing is to is to tell the dynamic linker where the DLLs are; so, add the line: export LD_LIBRARY_PATH=${HOME}/opencv/lib to ~/.bashrc and then relogin.

finish.. 🙂

Author: zkan

Soon to be a newbie data scientist. I ♥ machine learning, computer vision, robotics, image processing, data visualization, and data analytics.

3 thoughts on “How to install OpenCV 2.1 on Ubuntu”

Leave a Reply

Your email address will not be published. Required fields are marked *