How to install opencv on mac with virtualenv with opencv_contrib modules (Easy and fast)
Jul 30, 2017 · 1 min read
Previously, i tried to install opencv with homebrew and have difficulty configuring for the python packages for virtualenv. I finally found a working methods which works!
- Download cmake with gui using macport
- sudo port install cmake +gui
- git clone https://github.com/opencv/opencv
- git clone https://github.com/opencv/opencv_contrib
- create empty folder build in opencv/build
- run opencv-gui
- configure opencv-gui based on the following, change to your specific folder when necessary
cmake -D CMAKE_BUILD_TYPE=RELEASE -D CMAKE_INSTALL_PREFIX=/usr/local \-D PYTHON2_PACKAGES_PATH=~/.virtualenvs/notebook/lib/python2.7/site-packages \-D PYTHON2_LIBRARY=/usr/local/Cellar/python/2.7.8_1/Frameworks/Python.framework/Versions/2.7/bin \-D PYTHON2_INCLUDE_DIR=/usr/local/Cellar/python/2.7.8_1/Frameworks/Python.framework/Headers \-D PYTHON_EXECUTABLE=/Users/yj/.virtualenvs/notebook/bin/python \-D PYTHON2_NUMPY_INCLUDE_DIRS=~/.virtualenvs/notebook/lib/python2.7/site-packages/numpy/core/include \-D INSTALL_C_EXAMPLES=OFF -D INSTALL_PYTHON_EXAMPLES=ON \-D BUILD_EXAMPLES=ON \-D OPENCV_EXTRA_MODULES_PATH=/Users/yj/Projects/opencv_contrib/modules ..
