Latest YouTube Video

Friday, June 5, 2015

Install OpenCV 3.0 and Python 2.7+ on OSX

Step 1:

Install Homebrew and update

$ cd ~
$ ruby -e "$(curl -fsSL http://ift.tt/YQTuQh)"
$ brew update

Step 2:

Install python

$ brew install python

Update

PATH
  in
~/.bash_profile
# Homebrew
export PATH=/usr/local/bin:$PATH

Reload

~/.bash_profile
$ source ~/.bash_profile

Confirm version of Python:

$ which python
/usr/bin/local/python

Step 3:

Install

virtualenv
  and
virtualenvwrapper
$ pip install virtualenv virtualenvwrapper

Update

~/.bash_profile
  again
# Virtualenv/VirtualenvWrapper
source /usr/local/bin/virtualenvwrapper.sh

Reload

~/.bash_profile

Create

cv
  virtual environment
$ mkvirtualenv cv

Step 4:

Install NumPy

$ pip install numpy

Step 5:

Use brew to install required developers tools and packages

$ brew install cmake pkg-config

Install the necessary image I/O packages. These packages allow you to load various image file formats such as JPEG, PNG, TIFF, etc.

$ brew install jpeg libpng libtiff openexr

Install libraries that are used to optimize various operations within OpenCV:

$ brew install eigen tbb

Step 6:

Grab OpenCV from GitHub and checkout the 3.0.0 version:

$ cd ~
$ git clone http://ift.tt/1jCrzMq
$ cd opencv
$ git checkout 3.0.0

Pull down the

opencv_contrib
  repo which contains extra modules for OpenCV, such as feature detection and local invariant descriptors (SIFT, SURF, etc.), text detection in natural images, line descriptors, and more:
$ cd ~
$ git clone http://ift.tt/1sDkzzf
$ cd opencv_contrib
$ git checkout 3.0.0

Step 7:

Setup the OpenCV build:

$ cd ~/opencv
$ mkdir build
$ cd build
$ cmake -D CMAKE_BUILD_TYPE=RELEASE -D CMAKE_INSTALL_PREFIX=/usr/local -D INSTALL_C_EXAMPLES=ON -D INSTALL_PYTHON_EXAMPLES=ON  -D BUILD_EXAMPLES=ON -D OPENCV_EXTRA_MODULES_PATH=~/opencv_contrib/modules ..

***I THINK ffmpeg MIGHT BE USEFUL HERE FOR VIDEO SUPPORT***

Compile OpenCV:

$ make

And assuming that OpenCV compiled without error, you can now install it on your OSX system:

$ make install

If you get an error message related to permissions, you’ll need to run the install command as sudo:

$ sudo make install

 

The post Install OpenCV 3.0 and Python 2.7+ on OSX appeared first on PyImageSearch.



from PyImageSearch http://ift.tt/1MbC2rQ
via IFTTT

No comments: