Installing OpenCV contrib on OSX

Make sure you installed Xcode, cmake and qt.

git clone https://github.com/Itseez/opencv.git --depth=1
git clone https://github.com/Itseez/opencv_contrib --depth=1

OpenCV Install

cd opencv
mkdir build
cd build
cmake -D CMAKE_BUILD_TYPE=RELEASE \
      -D CMAKE_INSTALL_PREFIX=/usr/local \
      -D WITH_TBB=ON \
      -D BUILD_NEW_PYTHON_SUPPORT=ON \
      -D WITH_V4L=ON \
      -D WITH_OPENGL=ON \
      -D INSTALL_C_EXAMPLES=OFF \
      -D OPENCV_EXTRA_MODULES_PATH=../../opencv_contrib/modules ..
# Add -D WITH_QT=ON if needed.
make -j4
sudo make install

OpenCV for Python

export PYTHONPATH=/usr/local/lib/python2.7/site-packages:$PYTHONPATH

Run python and check:

import cv2
cv2.__version__

OpenCV Contrib

cd opencv_contrib
mkdir build
cd build