Sergej Sergeenko
Sergej Sergeenko
271 0
22.01.2017

OpenCV – (computer vision library with open source) – the library of computer vision algorithms, image processing and numerical algorithms for general purpose open source.
If you only get started work with Neural Network and trying detect human faces or facial feature detection with ready example youcan get error:

$ tensorflow/example/test.py train
Traceback (most recent call last):
  File "tensorflow/example/test.py", line 13, in 
    import cv2
ImportError: No module named cv2

So you need install cv2 library. Trying did command install cv2 not helped me:

pip install cv2
Collecting cv2
  Could not find a version that satisfies the requirement cv2 (from versions: )
No matching distribution found for cv2

The “traditional” way didn’t work out. For installing “cv2″ i used Homebrew – is a package manager for Mac OS X. If you haven’t Homebrew istall it by command:

ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"

After that did follow steps:

brew tap homebrew/science
brew install opencv

Python setup

cat ~/.bash_profile | grep PYTHONPATH
ln -s /usr/local/Cellar/opencv/2.4.10/lib/python2.7/site-packages/cv.py cv.py
ln -s /usr/local/Cellar/opencv/2.4.10/lib/python2.7/site-packages/cv2.so cv2.so

And it’s all!



Comments are closed.