From charlesreid1

Revision as of 06:37, 27 October 2017 by Admin (talk | contribs)

The OpenCV library is a general, all-purpose computer vision library. It's high performance and written in C++. It has many dependencies and is non-trivial to install, so the best approach is to either use a detailed guide, a package manager like aptitude or homebrew, or an Ansible playbook.

Operating Systems

Mac

OpenCV3

To install OpenCV3 on a Mac, use Homebrew:

$ brew install opencv3 --with-python3 --c++11 --with-contrib
$ brew link --force opencv3

Test that it installed okay:

$ python3
>>> import cv2
>>> print(cv2.__version__)

OpenCV2

To install OpenCV version 2, use the (at)2 after opencv:

$ brew install opencv@2
$ brew unlink opencv # This is necessary if you already installed opencv (version 3 by default)
$ brew link --force opencv@2

Raspberry Pi

Install OpenCV using aptitude:

#!/bin/bash

### # This is a meta-package that points to other dev packages.
### # Try the stuff below first.
### apt-get -y install libopencv-dev

apt-get -y install libopencv-core-dev
apt-get -y install libopencv-video-dev
apt-get -y install libopencv-features2d-dev
apt-get -y install python-opencv

See the pi-opencv repository on Github: https://github.com/charlesreid1-raspberry-pi/pi-opencv


Flags