Today I have been trying to figure out installation of OpenCV (a computer vision library) in my laptop. This article explain how I did the setup of OpenCV in Mac OSX (Mavericks).

Pre-requisite: Install CMake

  1. Download CMake build system from the official CMake website. I downloaded it from here: http://www.cmake.org/files/v3.2/cmake-3.2.2-Darwin-x86_64.dmg

  2. Install the dmg package and launch it from Applications. That will give you the UI app of CMake

  3. Add cmake command:

    1. Close the CMake app and open it from the terminal with sudo:
      sudo /Applications/CMake.app/Contents/MacOS/CMake
    2. From the CMake app window, choose menu Tools --> Install For Command Line Use. Install folder will be /usr/bin/ by default, submit it by choosing Install command line links.
    3. Make sure it works checking cmake --version.

Installation: OpenCV building from source


Download OpenCV from the official website. I downloaded it from OpenCV 3.0 RC1 for Linux/Mac.

Extract the zip file, copy the folder opencv-3.0.0-rc1 to your projects folder,

mv opencv-3.0.0-rc1 opencv
cd opencv
mkdir build
cd build
cmake -D CMAKE_BUILD_TYPE=RELEASE ..
make -j4
make install


Thats it, OpenCV is installed on your system. To confirm installation, do import cv from the python terminal:

$ python
    Python 2.7.8 |Anaconda 2.0.1 (x86_64)| (default, Aug 21 2014, 15:21:46)
    [GCC 4.2.1 (Apple Inc. build 5577)] on darwin
    Type "help", "copyright", "credits" or "license" for more information.
    Anaconda is brought to you by Continuum Analytics.
    Please check out: http://continuum.io/thanks and https://binstar.org
    >>> import cv
    >>>


If import cv doesn’t show errors, then the installation is success! Go ahead and write your hello-world opencv app!