OpenCV on Mac OSX Yosemite

From XPUB & Lens-Based wiki
Revision as of 00:12, 28 March 2015 by Ruben (talk | contribs) (Created page with "== Installing OpenCV on OS X Yosemite (10.10) == Mainly thanks to [http://blogs.wcode.org/2014/10/howto-install-build-and-use-opencv-macosx-10-10/ this chap] I was able to in...")
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)

Installing OpenCV on OS X Yosemite (10.10)

Mainly thanks to this chap I was able to install OpenCV on my Mac Yosemite installation.

After using his walk trough I had the error when running some of the OpenCV samples:

AttributeError: 'module' object has no attribute 'CV_AA'

After some search it turned out to be the fact that OpenGL was not enabled. I had it checked, but for it to properly work QT should be enabled as well. So these are in the end the steps that should make it work:

  1. Download Cmake and drag to application directory.
  2. Download OpenCV beta zip and extract.
  3. Download MacPorts and install the qt5-mac package.
  4. Go to the extracted folder of OpenCV and make a directory called StaticLibs
  5. Open Cmake 'Browse Source...' pick the path of the extracted zip 'Browse Build...' pick the newly created StaticLibs folder
  6. Check:
    • WITH_QT
    • WITH_FFMPEG (I guess this is optional)
    • INSTALL_PYTHON_EXAMPLES (this definitely is optional)
  7. Uncheck:
    • BUILD_SHARED_LIBS
    • BUILD_TESTS
    • WITH_1394
  8. Fill in properly (some of these might already be filled in properly)
    • CMAKE_OSX_SYSROOT: /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.10.sdk (or another SDK path)
    • CMAKE_OSX_ARCHITECTURES: x86_64
    • QT_QMAKE_EXECUTABLE: /opt/local/bin/qmake (this is the qmake install from MacPorts)
    • PYTHON2_EXECUTABLE: /usr/bin/python2.7
    • PYTHON2_PACKAGES_PATH: /Library/Python/2.7/site-packages
  9. Click Configure, then click Generate
  10. Open a terminal and type:
    • cd <path/to/your/opencv/staticlibs/folder/>
    • make (This will take awhile)
    • sudo make install


Enjoy! R