1. 程式人生 > >opencv 在mac上xcode的安裝

opencv 在mac上xcode的安裝

  引自:

http://seeb0h.github.io/howto/howto-install-homebrew-python-opencv-osx-el-capitan/

Thanks to Homebrew, this is fairly easy. Follow these steps .

Homebrew

This up-to-date guide covers everything you need to know, including how to fix a broken brew installation caused by OS X upgrade.

With a fresh OSX install, I only need these steps :

  1. XCode Command Line tools:

    xcode-select --install
    
  2. Install Homebrew

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

    brew doctor
    

OpenCV/Python 2

I have choosen this flavour.

Python 2

Most OpenCV sample scripts don’t run with Python 3. In 4 steps :

  1. brew install python
  2. brew linkapps python
  3. brew install gcc
  4. sudo pip install -U numpy scipy matplotlib scikit-learn scikit-image

OpenCV

You may choose between OpenCV3 and OpenCV2

OpenCV3

Without OpenCL (better on my old 2010 laptop) :

  1. brew install tesseract
  2. brew tap homebrew/science
  3. brew install opencv3 --with-contrib
  4. ln -s /usr/local/opt/opencv3/lib/python2.7/site-packages/cv2.so /usr/local/lib/python2.7/site-packages/

OpenCV2

Without OpenCL (better on my old 2010 laptop) :

  • brew install tesseract
  • brew tap homebrew/science
  • brew install opencv

OpenCV/Python 3

Python 3

  1. brew install python3
  2. brew install gcc
  3. sudo pip3 install -U numpy scipy matplotlib scikit-learn scikit-image

OpenCV

You may choose between OpenCV3 and OpenCV2

OpenCV3/Python 3

  1. brew install opencv3 --with-python3
  2. ln -s /usr/local/opt/opencv3/lib/python3.5/site-packages/cv2.cpython-35m-darwin.so /usr/local/lib/python3.5/site-packages/

OpenCV2/Python 3

  1. brew install opencv --with-python3