OpenCV: Difference between revisions
From charlesreid1
No edit summary |
|||
| Line 5: | Line 5: | ||
==Mac== | ==Mac== | ||
To install | ===OpenCV3=== | ||
To install OpenCV3 on a Mac, use Homebrew: | |||
<pre> | |||
$ brew install opencv3 --with-python3 --c++11 --with-contrib | |||
$ brew link --force opencv3 | |||
</pre> | |||
Test that it installed okay: | |||
<pre> | |||
$ python3 | |||
>>> import cv2 | |||
>>> print(cv2.__version__) | |||
</pre> | |||
===OpenCV2=== | |||
To install OpenCV version 2, use the (at)2 after opencv: | |||
<pre> | |||
$ brew install opencv@2 | |||
$ brew unlink opencv # This is necessary if you already installed opencv (version 3 by default) | |||
$ brew link --force opencv@2 | |||
</pre> | |||
==Raspberry Pi== | ==Raspberry Pi== | ||
Install OpenCV using aptitude: https:// | Install OpenCV using aptitude: | ||
<pre> | |||
#!/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 | |||
</pre> | |||
See the pi-opencv repository on Github: https://github.com/charlesreid1-raspberry-pi/pi-opencv | |||
=Flags= | =Flags= | ||
[[Category:OpenCV]] | [[Category:OpenCV]] | ||
Revision as of 06:37, 27 October 2017
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