Skip to content

tomtec77/practical-python-opencv

Repository files navigation

Practical Python and OpenCV

OpenCV Installation with Anaconda Python

Create an environment for OpenCV:

conda create --name opencv numpy scipy matplotlib jupyter

This will install required packages and their dependencies. Mahotas is not available via the conda command, so we have to install it via Anaconda Cloud:

source activate opencv
conda install -c http://conda.anaconda.org/luispedro mahotas

OpenCV is available via conda install, but apparently that version is compiled without GTK+ 2.x support. If you install this version you'll get the following error when runnning the first example from Chapter 3:

OpenCV Error: Unspecified error (The function is not implemented. Rebuild
the library with Windows, GTK+ 2.x or Carbon support. If you are on Ubuntu
or Debian, install libgtk2.0-dev and pkg-config, then re-run cmake or
configure script) in cvShowImages file ...

This error will occur even if you already have both libgtk2.0-dev and pkg-config installed. Installing OpenCV 3 from Anaconda Cloud solved the problem.

conda install -c http://conda.anaconda.org/menpo opencv3

There's also the imutils package of convenience functions which is not available via Anaconda Cloud - install it via pip instead (just make sure the environment is activated first):

pip install imutils

Windows installation

Open the Anaconda prompt and create an environment:

conda create --name opencv numpy scipy matplotlib jupyter

To install Mahotas we need to select another source from Anaconda Cloud:

activate opencv
conda install --name opencv -c http://conda.anaconda.org/conda-forge mahotas

Finally, install OpenCV 3:

conda install --name opencv -c http://conda.anaconda.org/menpo opencv3

About

Examples and exercises from the Practical Python and OpenCV book

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages