August 4, 2012

Install OpenCV+Python on OSX Snow Leopard


Environment
OSX Snow Leopard
X-code v4.0.2

How-To
The reason I failed to install it with other methods is that everyone's environment is a bit different, and some tutorials are outdated.  So check your environment against mine and if it's not what you have, then please find other tutorials.

  1. install mac port, if it's already installed clean it up (e.g. sudo port -f clean --all all)
  2. mv /usr/local /usr/local.bak (remember to change it back later)
  3. sudo port install opencv +python27 configure.compiler=clang

(Help from: https://trac.macports.org/wiki/ProblemHotlist#compiler)

Note

  • It's easier to experiment with Python.
  • What I'd like to try with OpenCV is to feed photos and videos to recognize faces and add meta tags to the photo, and make it more searchable.  Picasa already has that feature for photos, but not for videos.
  • Using MacBook's built-in webcam, the face detection works great.

Other How-To's
http://opencv.willowgarage.com/wiki/Mac_OS_X_OpenCV_Port
http://opencv.willowgarage.com/wiki/UsingOpenCVUnderOSX
http://opencv.willowgarage.com/wiki/InstallGuide
http://tilomitra.com/opencv-on-mac-osx/
http://vislab.cs.vt.edu/~vislab/wiki/index.php?title=Vision#OpenCV_2.0_universal_framework_for_Mac_.28ppc.2Fi386.29
http://www.tsd.net.au/blog/opencv-python-bindings-macports
http://code.google.com/p/opencv-cocoa/wiki/Building
http://stackoverflow.com/questions/3681496/opencv-macport-python-bindings
http://www.janeriksolem.net/2010/12/opencv-with-python-on-mac-os-x.html

OpenCV and Python
http://opencv.willowgarage.com/documentation/python/cookbook.html
http://opencv.willowgarage.com/documentation/python/index.html
http://recursive-design.com/blog/2010/12/14/face-detection-with-osx-and-python/