[Mac] OpenCV + Python

openCV 2.x + Python 2.x on MacOS

brew 安裝 python

$ brew install python

安裝 cmake

$ brew install cmake

安裝 openCV 2.x

$ brew install homebrew/science/opencv

會有警告訊息

Warning: opencv dependency gcc was built with a different C++ standard
library (libstdc++ from clang). This may cause problems at runtime.

不理他 可以用

安裝 numpy

$ pip install numpy

安裝完 /Library/Caches/Homebrew/opencv-2.4.11.tar.gz 有範例

$ mkdir dev
$ cd dev
$ tar xvfz /Library/Caches/Homebrew/opencv-2.4.11.tar.gz
$ cd opencv-2.4.11/sample/python2
$ python demo.py

如果用人臉辨識 特徵在 data/haarcascades

Leave a Comment