Loading...
 

Install and Build OpenCV 3 on Yosemite

HOWTO: Install, Build and Use openCV (MacOSX 10.10)

Overview

Despite the wealth of information on the internet, installation guides for openCV are far and few between. Whilst we have used openCV packages in previous projects they have always been wrapped in an addon format, which obviously makes it easier to use but, for a forthcoming project we needed the ability to access the library directly. Briefly, openCV is a library of functions which mainly focuses on image analysis, processing and evaluation. In lamen’s terms, it allows computers to process and understand images and other forms of visual data.In this post we will explain how we managed to work around the mysterious installation process, and provide a simple set of instructions that will enable you to install, build and use the openCV libraries and binaries on your system.First you will need:

  • Mac OSX Yosemite 10.10
  • XCode
  • Command Line Tools (This is done from inside XCode)
  • Homebrew
  • CMake
  • Download openCV  and unzip it somewhere on your computer.
  • Create two new folders inside of the openCV directory, one called StaticLibs and the other SharedLibs.

Ready … lets begin!

Building Static Libraries OpenCV

This will install the static libraries on your computer.

  • Open CMake
  • Click Browse Source and navigate to your openCV folder.
  • Click Browse Build and navigate to your StaticLibs Folder.
  • Click the configure button.
  • Choose Unix-Makefile from the Drop Down menu and Click OK.

CMake will perform some tests and return a set of red boxes appear in the CMake Window.

You will need to uncheck and add to the following options:

  • Uncheck BUILD_SHARED_LIBS
  • Uncheck BUILD_TESTS
  • Add an SDK path to CMAKE_OSX_SYSROOT, it will look something like this:

/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.10.sdk

  • Add x86_64 to CMAKE_OSX_ARCHITECTURES
  • Uncheck WITH_1394
  • Uncheck WITH_FFMPEG

Click Configure again, then Click Generate.When the application has finished generating, Open Terminal and type the following commands.

make
sudo make install
Enter your password. (This will install the shared libraries on your computer.)

Building Shared Libraries OpenCV

  • Open CMake.
  • Click Browse Source and navigate to your openCV folder.
  • Click Browse Build and navigate to your SharedLib Folder.
  • Choose Unix-Makefile from the Drop Down menu and Click OK.

CMake will perform some tests and return a set of red boxes appear in the CMake Window.

You will need to uncheck and add to the following options:

  • Check BUILD_SHARED_LIBS
  • Uncheck BUILD_TESTS
  • Add an SDK path to CMAKE_OSX_SYSROOT, it will look something like this:

/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.10.sdk

  • Add x86_64 to CMAKE_OSX_ARCHITECTURES
  • Uncheck WITH_1394
  • Uncheck WITH_FFMPEG

Click Configure again, then Click Generate.When the application has finished generating, Open Terminal.

make
sudo make install
Enter your password. (This will install the shared libraries on your computer.)